diff --git a/.env.development b/.env.development index eb8185a..9ab76bb 100644 --- a/.env.development +++ b/.env.development @@ -6,7 +6,7 @@ VITE_APP_ENV = 'development' # 开发环境 # 李陈杰 209 -VITE_APP_BASE_API = 'http://192.168.110.188:8899' +VITE_APP_BASE_API = 'http://192.168.110.180:8899' # 曾涛 # VITE_APP_BASE_API = 'http://192.168.110.180:8899' # 罗成 diff --git a/public/catalog.xlsx b/public/catalog.xlsx index 7ebf378..eb9e383 100644 Binary files a/public/catalog.xlsx and b/public/catalog.xlsx differ diff --git a/src/api/design/volumeCatalog/index.ts b/src/api/design/volumeCatalog/index.ts index be533ae..aff48d6 100644 --- a/src/api/design/volumeCatalog/index.ts +++ b/src/api/design/volumeCatalog/index.ts @@ -127,6 +127,17 @@ export const majorList = (params) => { params: params }); }; +/** + * 获取人员列表 + * @param query + */ +export const copyUserList = (params) => { + return request({ + url: '/design/volumeCatalog/copyUserList', + method: 'get', + params: params + }); +}; /** * 获取二维码信息 * @param query diff --git a/src/utils/projectTeam.ts b/src/utils/projectTeam.ts index 23f482d..c0c8d23 100644 --- a/src/utils/projectTeam.ts +++ b/src/utils/projectTeam.ts @@ -5,8 +5,6 @@ import { ProjectTeamVO } from '@/api/project/projectTeam/types'; import useUserStore from '@/store/modules/user'; export const getProjectTeam = async () => { const isPermission = useUserStore().permissions.some((item) => item == 'project:team:list'); - console.log(useUserStore().permissions); - if (!isPermission && useUserStore().permissions[0] != '*:*:*') return; const { id } = $cache.local.getJSON('selectedProject'); diff --git a/src/views/design/billofQuantities/index.vue b/src/views/design/billofQuantities/index.vue index fe4e7e2..7a45fe1 100644 --- a/src/views/design/billofQuantities/index.vue +++ b/src/views/design/billofQuantities/index.vue @@ -16,7 +16,7 @@ - {{ isExpandAll ? '一键收起' : '一键展开' }} + {{ isExpandAll ? '一键收起' : '一键展开' }} 下载模板 @@ -62,15 +62,10 @@ - 审核 + 审核 - 查看流程 + 查看流程 @@ -313,7 +308,7 @@ function handleChangeVersion(versions) { handleQueryList(); } // 在 openTable 方法中通过索引获取对应的表格实例 -function openTable( index) { +function openTable(index) { isExpandAll.value = !isExpandAll.value; nextTick(() => { // 通过索引获取当前标签页的表格实例 @@ -358,12 +353,12 @@ function lookApprovalFlow(row) { const downloadTemplate = (type) => { // 导出模版文件 try { - let linkurl = ''; + let linkurl = ''; let name = ''; - if (type==1) { + if (type == 1) { linkurl = '/billOfQuantities.xlsx'; name = '工程量清单模板.xlsx'; - }else{ + } else { linkurl = '/materialsEquipment.xlsx'; name = '物资设备清单模板.xlsx'; } diff --git a/src/views/design/volumeCatalog/index.vue b/src/views/design/volumeCatalog/index.vue index cf56f7d..2b4ea8e 100644 --- a/src/views/design/volumeCatalog/index.vue +++ b/src/views/design/volumeCatalog/index.vue @@ -162,6 +162,11 @@ >>>>>>> 8a3f338e2734575bcb743e917b1232bedc76f105 + + + + + @@ -264,7 +269,8 @@ import { uploadVolumeFile, majorList, getVolumeCatafileList, - volumeFileList + volumeFileList, + copyUserList } from '@/api/design/volumeCatalog'; import { VolumeCatalogVO } from '@/api/design/volumeCatalog/types'; import { useUserStoreHook } from '@/store/modules/user'; @@ -290,6 +296,7 @@ const uploadOpinionVisible = ref(false); const design = ref(''); const total = ref(0); const dialogHistory = ref(false); +const userCoryList = ref([]); const opinion = ref(''); const updateRow = ref({ opinion: [] @@ -425,7 +432,13 @@ const cancel = () => { reset(); dialog.visible = false; }; - +// 获取人员列表 +const getDesignUserList = async () => { + const res = await copyUserList({}); + if (res.code === 200) { + userCoryList.value = res.data; + } +}; /** 表单重置 */ const reset = () => { form.value = { ...initFormData }; @@ -555,7 +568,7 @@ const onSubmit = async () => { type: uploadForm.type }; try { - await uploadVolumeFile(obj); + await uploadVolumeFile({ ...obj, userIds: form.value.userIds }); proxy?.$modal.msgSuccess('文件上传成功'); uploadVisible.value = false; await getList(); @@ -665,6 +678,7 @@ const handleAuditInfo = (row) => { // 审核图纸 }; onMounted(() => { + getDesignUserList(); getSpecialtyList(); getList(); }); @@ -675,6 +689,7 @@ const listeningProject = watch( (nid, oid) => { queryParams.value.projectId = nid; form.value.projectId = nid; + getDesignUserList(); getSpecialtyList(); getList(); } diff --git a/src/views/out/monthPlan/index.vue b/src/views/out/monthPlan/index.vue index c426eca..d9aab38 100644 --- a/src/views/out/monthPlan/index.vue +++ b/src/views/out/monthPlan/index.vue @@ -36,7 +36,6 @@ - diff --git a/src/views/out/monthPlan/indexEdit.vue b/src/views/out/monthPlan/indexEdit.vue index 708f793..01cd497 100644 --- a/src/views/out/monthPlan/indexEdit.vue +++ b/src/views/out/monthPlan/indexEdit.vue @@ -175,7 +175,7 @@ const getInfo = () => { form.value = res.data as any; console.log('🚀 ~ getInfo ~ form.value:', form.value[0].projectId); - + form.value[0].mid = form.value[0].id; form.value[0].id = form.value[0].projectId + '_' + form.value[0].planMonth; loading.value = false; buttonLoading.value = false; @@ -231,13 +231,15 @@ const approvalVerifyOpen = async () => { // 图纸上传成功之后 开始提交 const submit = async (status, data) => { form.value = data; + console.log(form.value); + if (status === 'draft') { buttonLoading.value = false; proxy?.$modal.msgSuccess('暂存成功'); proxy.$tab.closePage(proxy.$route); proxy.$router.go(-1); } else { - const res = await isSubmit(data[1]?.id); + const res = await isSubmit(data[0]?.mid); if (!res.data) { proxy?.$modal.msgError('三种计划产值必须填写'); diff --git a/src/views/project/landTransfer/BasicData/landBlock/index.vue b/src/views/project/landTransfer/BasicData/landBlock/index.vue index 8c215a0..8aca093 100644 --- a/src/views/project/landTransfer/BasicData/landBlock/index.vue +++ b/src/views/project/landTransfer/BasicData/landBlock/index.vue @@ -78,6 +78,7 @@ + @@ -107,20 +108,22 @@ - + + 添加 - + - - + + + - + - + + - + @@ -181,21 +191,35 @@ import { } from '@/api/system/landTransfer/landBlock'; import { LandBlockVO, LandBlockQuery, LandBlockForm } from '@/api/system/landTransfer/landBlock/types'; import { useUserStoreHook } from '@/store/modules/user'; -import { getCurrentInstance, ComponentInternalInstance, onMounted, onUnmounted, watch } from 'vue'; -import { ElFormInstance, ElMessage } from 'element-plus'; +import { getCurrentInstance, ComponentInternalInstance, onMounted, onUnmounted, watch, reactive, ref, toRefs, computed } from 'vue'; +import { ElFormInstance } from 'element-plus'; -// 类型定义补充(避免any) +// 类型定义补充 interface DialogOption { visible: boolean; title: string; } +// 方阵级联选择器选项类型 +interface FangzhenOption { + matrixId: string | number; + name: string; + children?: FangzhenOption[]; +} + +// 方阵表单项类型 interface UnitBoItem { unitProjectArea: string; unitProjectStatus: string; unitProjectId: (string | number)[]; // 级联选择值(数组) } +// 方阵表单根模型类型(关键:显式声明unitBoList) +interface MatrixForm { + landId?: string | number; // 关联的地块ID + unitBoList: UnitBoItem[]; // 方阵列表 +} + // 基础实例与Store const { proxy } = getCurrentInstance() as ComponentInternalInstance; const userStore = useUserStoreHook(); @@ -203,14 +227,17 @@ const currentProject = computed(() => userStore.selectedProject); // 响应式数据 const landBlockList = ref([]); -const fangzhenList = ref([]); // 方阵列表(实际项目建议定义具体类型) +const fangzhenList = ref([]); const buttonLoading = ref(false); const loading = ref(true); const showSearch = ref(true); -const uploadRef = ref(null); // upload组件ref +const uploadRef = ref(null); -// 方阵表单数据(核心修改:初始值为空,避免默认填充无效数据) -const unitBoList = ref([{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }]); +// 方阵表单模型(核心修复:使用reactive并显式声明结构) +const formM = reactive({ + landId: undefined, + unitBoList: [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }] +}); // 表格选择相关 const ids = ref>([]); @@ -243,7 +270,6 @@ const initFormData: LandBlockForm = { // 核心数据(含表单规则) const data = reactive({ form: { ...initFormData }, - formM: { landId: undefined }, // 方阵关联表单(仅存地块ID) queryParams: { pageNum: 1, pageSize: 10, @@ -256,7 +282,7 @@ const data = reactive({ farmerCount: undefined, params: {} }, - // 地块表单规则(原有规则保留) + // 地块表单规则 rules: { id: [{ required: true, message: '主键ID不能为空', trigger: 'blur' }], projectId: [{ required: true, message: '项目ID不能为空', trigger: 'blur' }], @@ -265,7 +291,7 @@ const data = reactive({ } }); -const { queryParams, form, rules, formM } = toRefs(data); +const { queryParams, form, rules } = toRefs(data); /** 查询地块列表 */ const getList = async () => { @@ -381,10 +407,10 @@ const getfangzhenList = async () => { loading.value = true; try { const res = await subMatrix(currentProject.value.id); - // 处理方阵数据(级联选择需父子结构,此处保留原有逻辑) + // 处理方阵数据(级联选择需父子结构) res.data.forEach((item: any) => { item.children?.forEach((item2: any) => { - item2.matrixId = `${item2.name}_${item2.matrixId}`; // 拼接名称+ID,便于后续拆分 + item2.matrixId = `${item2.name}_${item2.matrixId}`; }); }); fangzhenList.value = res.data; @@ -395,68 +421,74 @@ const getfangzhenList = async () => { } }; -/** 关联方阵(核心修改:打开弹窗前强制重置表单) */ +/** 关联方阵 */ const handleView = async (row: LandBlockVO) => { if (!row?.id) return proxy?.$modal.msgWarning('请选择有效的地块'); - // 1. 重置方阵表单(清空历史数据) + // 重置方阵表单 resetMatrix(); - // 2. 绑定当前地块ID - formM.value.landId = row.id; - // 3. 打开弹窗 + // 绑定当前地块ID + formM.landId = row.id; + // 打开弹窗 dialogMatrix.visible = true; dialogMatrix.title = `关联方阵(地块:${row.landName || row.landCode})`; }; /** 新增方阵表单项 */ const addUnitBoItem = () => { - unitBoList.value.push({ + formM.unitBoList.push({ unitProjectArea: '', unitProjectStatus: '', - unitProjectId: [] // 级联选择初始为空数组 + unitProjectId: [] }); + // 重置校验状态 + landBlockFormMatrixRef.value?.clearValidate(); }; /** 删除方阵表单项 */ const removeUnitBoItem = (index: number) => { - if (unitBoList.value.length <= 1) { + if (formM.unitBoList.length <= 1) { return proxy?.$modal.msgWarning('至少保留一项方阵配置'); } - unitBoList.value.splice(index, 1); - // 重置表单校验状态(避免删除后残留校验提示) + formM.unitBoList.splice(index, 1); landBlockFormMatrixRef.value?.clearValidate(); }; -/** 提交方阵关联表单 */ +/** 提交方阵关联表单(核心修复:数据处理逻辑) */ const submitFormMatrix = () => { landBlockFormMatrixRef.value?.validate(async (valid: boolean) => { if (!valid) return; - if (!formM.value.landId) return proxy?.$modal.msgWarning('地块ID异常,请重新选择地块'); + if (!formM.landId) return proxy?.$modal.msgWarning('地块ID异常,请重新选择地块'); try { - // 处理方阵数据(拆分名称+ID) - const unitBoListParams = unitBoList.value.map((item) => { - const [unitProjectName, unitProjectId] = item.unitProjectId[1]?.split('_') || []; - if (!unitProjectId) throw new Error('方阵ID解析失败,请重新选择方阵'); + // 处理方阵数据(修复ID拆分逻辑) + const unitBoListParams = formM.unitBoList.map((item) => { + // 取级联选择的最后一层值 + const lastLevelValue = item.unitProjectId[item.unitProjectId.length - 1]; + if (!lastLevelValue) throw new Error('请选择完整的方阵'); + + // 拆分名称和ID + const [unitProjectName, unitProjectId] = String(lastLevelValue).split('_'); + if (!unitProjectId) throw new Error('方阵ID解析失败,请重新选择'); return { unitProjectArea: item.unitProjectArea.trim(), unitProjectStatus: item.unitProjectStatus.trim(), - unitProjectId: unitProjectId, // 纯ID(后端需要) - unitProjectName: unitProjectName // 名称(可选,用于显示) + unitProjectId: unitProjectId, + unitProjectName: unitProjectName }; }); // 调用关联接口 const res = await LandUnit({ - landId: formM.value.landId, + landId: formM.landId, unitBoList: unitBoListParams }); if (res.code === 200) { proxy?.$modal.msgSuccess('关联方阵成功'); dialogMatrix.visible = false; - await getList(); // 刷新地块列表 + await getList(); } else { proxy?.$modal.msgError(res.msg || '关联失败'); } @@ -472,13 +504,10 @@ const cancelMatrix = () => { dialogMatrix.visible = false; }; -/** 方阵表单重置(核心修改:清空所有数据+重置校验) */ +/** 方阵表单重置 */ const resetMatrix = () => { - // 1. 清空地块ID - formM.value.landId = undefined; - // 2. 重置方阵列表(仅保留一个空项) - unitBoList.value = [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }]; - // 3. 重置表单校验状态 + formM.landId = undefined; + formM.unitBoList = [{ unitProjectArea: '', unitProjectStatus: '', unitProjectId: [] }]; if (landBlockFormMatrixRef.value) { landBlockFormMatrixRef.value.resetFields(); landBlockFormMatrixRef.value.clearValidate(); @@ -491,11 +520,11 @@ const listeningProject = watch( (newId) => { if (newId) { queryParams.value.projectId = newId; - getfangzhenList(); // 刷新方阵列表 - getList(); // 刷新地块列表 + getfangzhenList(); + getList(); } }, - { immediate: true } // 初始加载时执行一次 + { immediate: true } ); /** 导入Excel */ @@ -524,36 +553,34 @@ const handleImport = (options: { file: File }) => { loading.value = false; }); }; + +/** 导出模板 */ const exportFile = () => { - // 导出模版文件 try { - // 创建a标签 const link = document.createElement('a'); - // 设置PDF文件路径 - 相对于public目录 link.href = '/dikuai.xlsx'; - // 设置下载后的文件名 link.download = '地块信息导入模版.xlsx'; - // 触发点击 document.body.appendChild(link); link.click(); - // 清理 document.body.removeChild(link); } catch (error) { alert('下载失败,请重试'); } }; + /** 下载导入模板 */ const downloadTemplate = () => { try { const link = document.createElement('a'); - link.href = '/landBlock.xlsx'; // 模板路径(需确保public目录下存在该文件) - link.download = '地块信息导入模板.xlsx'; // 下载后文件名 + link.href = '/landBlock.xlsx'; + link.download = '地块信息导入模板.xlsx'; document.body.appendChild(link); - link.click(); // 触发下载 + link.click(); } catch (err) { proxy?.$modal.msgError('模板下载失败,请重试'); } finally { - document.body.removeChild(link); // 清理DOM + const link = document.querySelector('a[download="地块信息导入模板.xlsx"]'); + if (link) document.body.removeChild(link); } };