<template> <div class="fundAnalysis"> <div class="top"> <el-form ref="ruleForm" :model="form" v-show="showSearch"> <el-row :gutter="20"> <el-col :span="6"> <el-form-item label="项目名称:" prop="projectName" class="formItem110"> <el-input v-model="form.projectName" placeholder="请输入项目名称" style="width: 100%" ></el-input> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="项目类型:" prop="projectTypeId"> <el-select v-model="form.projectTypeId" placeholder="请选择项目类型" style="width: 100%" > <el-option label="全部" value="" /> <el-option v-for="dict in projectTypes" :key="dict.id" :label="dict.projectTypeName" :value="dict.id" /> </el-select> </el-form-item> </el-col> <el-col :span="6"> <el-form-item> <el-button type="primary" icon="Search" @click="search"> 查询</el-button > <el-button icon="Refresh" @click="resetQuery">重置</el-button> </el-form-item> </el-col> </el-row> </el-form> </div> <el-row class="row"> <el-button type="primary" plain icon="Link" @click="syncData" >同步数据</el-button > <right-toolbar v-model:showSearch="showSearch" @queryTable="resetQuery" ></right-toolbar> </el-row> <div class="table" ref="table_box"> <el-table :data="tableData" v-loading="loading" stripe :max-height="maxHeight" ref="multipleTableRef" > <el-table-column type="selection" width="55" /> <el-table-column type="index" label="序号" align="center" width="55" /> <el-table-column label="项目编码" align="center" prop="projectNo" show-overflow-tooltip /> <el-table-column label="项目类型" align="center" prop="projectTypeName" show-overflow-tooltip /> <el-table-column label="项目名称" prop="projectName" show-overflow-tooltip /> <el-table-column label="最后提交年月" align="center" prop="lastYearMonth" show-overflow-tooltip /> <el-table-column label="最后提交用户" align="center" prop="lastSubmitUser" show-overflow-tooltip /> <el-table-column label="操作" align="center" show-overflow-tooltip width="170"> <template #default="{ row }"> <el-button type="primary" link @click="openDialog(row, 'edit')">编辑</el-button> <el-button type="primary" link @click="openDialog(row, 'view')">查看</el-button> </template> </el-table-column> </el-table> <pagination class="pagination" :total="total" v-model:page="pageNum" v-model:limit="pageSize" @pagination="getTableList" /> </div> <el-dialog v-model="visible" :title="`${opts.text}资金分析`" :close-on-click-modal="false" width="70%" :before-close="close" class="dialog" > <operate ref="operateRef" :cur-row="curRow" v-if="visible" @close="close" :opts="opts" /> </el-dialog> </div> </template> <script setup> import { ref, reactive, watch, onMounted, shallowRef, computed } from 'vue' import { usePagination, useAdaption } from '@/hooks' import operate from './operate.vue' import { optTextMap } from '@/utils/map' import { projectTypeList } from '@/api/projectInformationNew' import { getProjectFundAnalysisSelectFundPage, projectFundAnalysisSyncData } from '@/api/fundAnalysis' const { proxy } = getCurrentInstance(); const { maxHeight, onResize } = useAdaption(proxy, 'table_box') const showSearch = ref(true) const visible = ref(false) const opts = reactive({ type: '', text: '' }) const curRow = shallowRef({}) const form = reactive({ projectName: '', projectTypeId: '', }) const { pageNum, pageSize, tableData, total, loading, getTableList } = usePagination(getProjectFundAnalysisSelectFundPage, { value: form }) const projectTypes = ref([]) const getProjectTypeList = async () => { const res = await projectTypeList({ status: '0' }) if(res?.code !== 200) return projectTypes.value = res?.data || [] } const openDialog = (data, type) => { visible.value = true opts.type = type opts.text = optTextMap.get(type) curRow.value = data } const close = () => { visible.value = false opts.type = '' opts.text = '' search() } const search = () => { pageNum.value = 1 getTableList() } const resetQuery = () => { proxy.$refs.ruleForm.resetFields() search() } const submit = () => { proxy.$refs.operateRef.submit() } const syncData = () => { const list = proxy.$refs.multipleTableRef.getSelectionRows() if(!list.length) return proxy.$modal.msgError('请选择一条数据!') const projectNos = list.map(item => item.projectNo) const formData = new FormData() formData.append('projectNo', projectNos.join()) proxy.$modal .confirm("是否确认同步?") .then(async () => { const res = await projectFundAnalysisSyncData(formData) if(res?.code !== 200) return proxy.$modal.msgSuccess('操作成功') }) .catch(() => {}); } watch(showSearch, onResize) onMounted(() => { getTableList() getProjectTypeList() }) </script> <style lang="scss" scoped> .fundAnalysis { padding: 20px; height: 90vh; display: flex; flex-direction: column; .top, .row { flex-shrink: 0; } .table { flex: 1; :deep(.pagination) { margin-top: 0; margin-right: 10px; .el-pagination { right: 20px; } } } } // :deep(.el-dialog__body) { // background-color: #eef1fb; // } </style>