import { getCostProjectDetail, getCostProjectScenarioDetail, getCostProjectDocumentPageList, getCostProjectMaterialPageList, getCostProjectNodeTmpletePageList, getCostProjectNodeTmpleteGetDetail, getCostProjectSurveyPageList, } from '@/api/taskCustomizedRelease.js' import { getAllUserList } from '@/api/uc' import { getCostSurveyTemplates } from '@/api/catalogManage.js' import { getWhCateList, getDocList } from '@/api/auditReviewDocManage.js' // 引入地区选择混入 import { dictMixin, regionMixin, catalogMixin, commonMixin, } from '@/mixins/useDict' export const taskMixin = { mixins: [dictMixin, regionMixin, catalogMixin, commonMixin], data() { return { dictData: { auditType: [], //监审形式 materialType: [], //资料类别 formatAsk: [], //格式要求 processNodeType: [], //流程环节类型 projectProposal: [], //立项来源 processStatus: [], //预置流转操作 whGenerateType: [], }, userList: [], // 弹窗状态管理 dialogs: { materialDialogVisible: false, setStepDialogVisible: false, stepDialogVisible: false, detailDialogVisible: false, documentDialogVisible: false, }, loading: { save: false, saveDocument: false, }, // 当前激活的标签页 activeTab: 'scenario', formCities: [], formDistricts: [], // 所有表单数据聚合 formData: { // 监审立项信息表单 basicInfo: { projectName: '', catalogId: '', areaCode: '', auditedUnitName: '', auditedUnitId: '', orgId: '', orgName: '', planYear: '', projectYear: '', sourceType: '', auditPeriod: '', auditPeriodArray: [{ value: '' }], needHearing: 1, isEmergency: 1, establishmentReason: '', accordingFileUrl: '', otherFileUrl: '', expertStr: '', auditGroup: '', projectMembers: '', auditTeamMembers: [], }, // 监审工作方案表单 workPlan: { basicInfo: '', scopeContent: '', stepsMethods: '', otherContent: '', attachmentIds: [], }, // 材料表单(弹窗用) material: { materialType: '综合性材料', materialName: '', materialAsk: '', formatAsk: '文档文件', orderNum: '', isMust: '否', }, // 当前流程环节(弹窗用) currentStep: { mainUserId: '', userId: [], status: [], }, currentStepRules: { mainUserId: [ { required: true, message: '请选择主办人员', trigger: 'change' }, ], userId: [ { required: true, message: '请选择从办人员', trigger: 'change', }, ], status: [ { required: true, message: '请输入预置流转操作', trigger: 'blur', }, ], endTime: [ { required: true, message: '请选择截止时间', trigger: 'change' }, ], }, // 监审工作流程表单 workflow: { plannedAuditEndDate: '', plannedAuditStartDate: '', }, }, scenarioData: { addScenario: false, saveScenario: false, }, workflowData: { list: [], detailInfo: {}, stepList: [], pagination: { currentPage: 1, pageSize: 10, total: 0, }, listColumns: [ { prop: 'processNodeValue', label: '流程环节', width: 100, align: 'center', }, { prop: 'nodeType', label: '环节类型', width: 100, align: 'center', formatter: (row) => { return this.getDictName('processNodeType', row.nodeType) }, }, { prop: 'mainUserName', label: '主办人员', minWidth: 100, align: 'left', }, { prop: 'userName', label: '从办人员', minWidth: 150, align: 'left', }, { prop: 'status', label: '预置流转操作', minWidth: 150, align: 'left', formatter: (row) => { return this.getDictName('processStatus', row.status) }, }, { prop: 'actStartTime', label: '开始时间', width: 140, align: 'center', }, { prop: 'actEndTime', label: '结束时间', width: 140, align: 'center', }, { prop: 'endTime', label: '预置环节截止时间', width: 140, align: 'center', }, { prop: 'action', label: '操作', width: 100, align: 'center', slotName: 'action', }, ], workflowColumns: [ { prop: 'processNodeValue', label: '流程环节', width: 100, align: 'center', }, { prop: 'nodeType', label: '环节类型', width: 100, align: 'center', formatter: (row) => { return this.getDictName('processNodeType', row.nodeType) }, }, { prop: 'mainUserId', label: '主办人员', minWidth: 100, align: 'left', slotName: 'mainUserId', }, { prop: 'userId', label: '从办人员', minWidth: 200, align: 'left', slotName: 'userId', }, { prop: 'status', label: '预置流转操作', minWidth: 150, align: 'left', slotName: 'status', }, { prop: 'endTime', label: '预置环节截止时间', width: 150, align: 'center', slotName: 'endTime', }, ], }, documentData: { documentTypes: [], selectedDoc: 'notice', list: [], pagination: { currentPage: 1, pageSize: 50, total: 0, }, dataList: [], // 保持原数据结构,实际使用时会填充 documentColumns: [ { prop: 'documentId', label: '文书类型', align: 'center', slotName: 'documentId', }, { prop: 'documentNumber', label: '文书文号', width: 200, align: 'center', }, { prop: 'enterpriseId', label: '被监审单位', width: 200, align: 'left', slotName: 'enterpriseId', }, { prop: 'generateTime', label: '生成时间', width: 100, align: 'center', slotName: 'generateTime', }, { prop: 'electronicDocumentUrl', label: '电子文书', width: 200, align: 'center', slotName: 'electronicDocumentUrl', }, { prop: 'scanDocumentUrl', label: '上传扫描件', width: 150, align: 'center', slotName: 'scanDocumentUrl', }, { prop: 'isPushed', label: '是否推送被监审单位', width: 100, align: 'center', formatter: (row) => (row.isPushed == 1 ? '是' : '否'), }, { prop: 'feedbackDocumentUrl', label: '被监审单位反馈资料', width: 150, align: 'center', slotName: 'feedbackDocumentUrl', }, ], }, } }, computed: { surveyData() { return { list: [], pagination: { currentPage: 1, pageSize: 50, total: 0, }, surveyColumns: [ { prop: 'surveyTemplateName', label: '成本调查表', width: 300, align: 'left', showOverflowTooltip: true, }, { prop: 'templateType', label: '资料类型', width: 120, align: 'center', formatter: (row) => { return row.templateType == '1' ? '单记录' : row.templateType == '2' ? '固定表' : '动态表' }, }, // { // prop: 'isMust', // label: '是否必填', // width: 100, // align: 'center', // }, { prop: 'action', label: '操作', width: 120, align: 'center', }, ], } }, // 数据列表聚合 materialData() { return { list: [], pagination: { currentPage: 1, pageSize: 50, total: 0, }, materialDialogTitle: '添加', materialDialogVisible: false, saveMaterial: false, addMaterial: false, materialColumns: [ { prop: 'informationType', label: '材料分类', width: 120, align: 'center', formatter: (row) => { return this.getDictName('materialType', row.informationType) }, }, { prop: 'informationName', label: '材料名称', minWidth: 200, align: 'left', }, { prop: 'informationRequire', label: '材料要求说明', minWidth: 300, align: 'left', }, { prop: 'formatRequired', label: '格式要求', width: 120, align: 'center', formatter: (row) => { return this.getDictName('formatAsk', row.formatRequired) }, }, { prop: 'orderNum', label: '排序', width: 120, align: 'center', slotName: 'orderNum', }, { prop: 'action', label: '操作', align: 'center', width: 200, slotName: 'action', actions: [ { name: 'edit', label: '修改', type: 'text', size: 'mini', onClick: this.handleEditMaterial, disabled: this.isView, }, { name: 'delete', label: '删除', type: 'text', size: 'mini', className: 'delete-btn', onClick: this.handleDeleteMaterial, disabled: this.isView, }, ], }, ], } }, }, watch: { activeTab: { handler(newVal) { this.handleTabClick() }, immediate: false, // 可选:如果需要在组件初始化时就执行,可以设置为true }, }, methods: { async handleTabClick() { switch (this.activeTab) { case 'basicInfo': this.getBasicInfo() break case 'scenario': this.getScenarioData() break case 'material': this.getMaterialData() break case 'survey': // this.getSurveyData() break case 'auditNotice': // const res = await getWhCateList() this.getDocumentData() break case 'workflow': this.getWorkflow() break default: break } }, // 获取用户信息 getUser() { getAllUserList() .then((res) => { this.userList = res.value || [] }) .catch(() => {}) }, getBasicInfo() { const pid = (this.project && (this.project.projectId || this.project.id)) || (this.taskData && (this.taskData.projectId || this.taskData.id)) || '' if (!pid) return getCostProjectDetail({ id: pid }) .then((res) => { this.formData.basicInfo = { ...this.project, ...res.value, } }) .catch(() => { this.formData.basicInfo = this.project }) }, // 获取监审工作方案数据 getScenarioData() { const pid = (this.project && (this.project.projectId || this.project.id)) || (this.taskData && (this.taskData.projectId || this.taskData.id)) || '' if (!pid) return getCostProjectScenarioDetail({ projectId: pid }).then((res) => { if (res.value) { this.formData.workPlan = res.value this.formData.workPlan.attachmentIds = res.value.attachmentIds ? res.value.attachmentIds.split(',') : [] } else { this.scenarioData.addScenario = true } }) }, // 报送资料要求数据 getMaterialData() { const pid = (this.project && (this.project.projectId || this.project.id)) || (this.taskData && (this.taskData.projectId || this.taskData.id)) || '' if (!pid) return getCostProjectMaterialPageList({ pageNum: this.materialData.pagination.currentPage, pageSize: this.materialData.pagination.pageSize, projectId: pid, }).then((res) => { if (res.value.code == 200) { this.materialData.list = res.value.value.records || [] this.materialData.pagination.total = res.value.value.total } else { this.materialData.list = [] this.materialData.pagination.total = 0 } }) }, // 获取成本调查表数据 getSurveyData() { getCostSurveyTemplates({ // pageNum: this.surveyData.pagination.currentPage, // pageSize: this.surveyData.pagination.pageSize, catalogId: this.project.catalogId, }).then((res) => { this.surveyData.list = res.value // this.surveyData.pagination.total = res.value.total }) }, // 获取监审通知数据 async getDocumentData(data) { const res = await getDocList({ page: 1, pageSize: 50, }) this.documentData.documentTypes = res.value.records || [] const pid = (this.project && (this.project.projectId || this.project.id)) || (this.taskData && (this.taskData.projectId || this.taskData.id)) || '' if (!pid) return // 查看/编辑权限类型区分,未传会导致列表为空 const permissionType = this.isView ? '0' : '1' // 确保data是对象,避免当传入非对象类型(如字符串)时出错 const documentType = typeof data === 'object' && data !== null ? data.documentType || '' : '' getCostProjectDocumentPageList({ pageNum: this.documentData.pagination.currentPage, pageSize: this.documentData.pagination.pageSize, projectId: pid, // documentName: data ? data.documentName : '', documentType, permissionType, }).then((res) => { let records = res.value.value.records this.documentData.list = records.filter((item) => { const excludeTypes = [ '成本监审工作底稿-送达回证', '成本监审提取资料登记表-送达回证', '成本审核初步意见表1-送达回证', '成本监审集体审议记录-送达回证', ] return !excludeTypes.includes(item.documentName) }) this.documentData.pagination.total = res.value.value.total }) }, // 获取流程数据 getWorkflow() { const pid = (this.project && (this.project.projectId || this.project.id)) || (this.taskData && (this.taskData.projectId || this.taskData.id)) || '' if (!pid) return getCostProjectNodeTmpleteGetDetail({ projectId: pid }).then((res) => { this.workflowData.list = res.value.nodeList || [] this.workflowData.detailInfo = res.value this.formData.workflow.plannedAuditStartDate = res.value.plannedAuditStartDate this.formData.workflow.plannedAuditEndDate = res.value.plannedAuditEndDate }) }, handlePaginationChange({ currentPage, pageSize }) { switch (this.activeTab) { case 'material': this.materialData.pagination.currentPage = currentPage this.materialData.pagination.pageSize = pageSize this.getMaterialData() break case 'survey': this.surveyData.pagination.currentPage = currentPage this.surveyData.pagination.pageSize = pageSize this.getSurveyData() break case 'auditNotice': this.documentData.pagination.currentPage = currentPage this.documentData.pagination.pageSize = pageSize this.getDocumentData() break default: break } }, formattertUserName(userId) { if (userId) { let arr = userId.split(',') return arr .map((item) => { let user = this.userList.find((user) => user.userId == item) return user.fullname }) .join(',') } }, }, }