Просмотр исходного кода

任务制定-工作流程时间限制,监审通知调试新增,成本调查表换接口

cb_luzhixia 1 месяц назад
Родитель
Сommit
7dcabb43f3

+ 75 - 39
src/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/auditNoticeTab.vue

@@ -8,6 +8,8 @@
           v-for="type in documentData.documentTypes"
           :key="type.id"
           class="type-item"
+          :class="{ active: activeDocumentTypeId === type.id }"
+          @click="handleDocumentTypeClick(type)"
         >
           {{ type.documentName }}
         </div>
@@ -138,10 +140,11 @@
           <el-form
             v-loading="loading.saveDocument"
             :model="document"
-            label-width="160px"
+            label-width="170px"
             size="small"
+            :rules="documentRules"
           >
-            <el-form-item label="选择模板:">
+            <el-form-item label="选择模板:" prop="documentId">
               <el-select
                 v-model="document.documentId"
                 placeholder="请选择模板"
@@ -156,7 +159,7 @@
                 ></el-option>
               </el-select>
             </el-form-item>
-            <el-form-item label="通知书文号:" prop="documentWhId">
+            <el-form-item label="通知书文号:" prop="documentNumber">
               <el-input
                 v-model="document.documentNumber"
                 placeholder="请选择通知书文号"
@@ -172,7 +175,7 @@
                 选择文号
               </el-button>
             </el-form-item>
-            <el-form-item label="被监审单位:">
+            <el-form-item label="被监审单位:" prop="enterpriseId">
               <el-select
                 v-model="document.enterpriseId"
                 placeholder="请选择被监审单位"
@@ -188,9 +191,9 @@
                 ></el-option>
               </el-select>
             </el-form-item>
-            <el-form-item label="是否推送被监审单位:">
+            <el-form-item label="是否推送被监审单位:" prop="isPushed">
               <!-- 是否推送被监审单位 -->
-              <el-radio-group v-model="document.isPush">
+              <el-radio-group v-model="document.isPushed">
                 <el-radio label="1">是</el-radio>
                 <el-radio label="0">否</el-radio>
               </el-radio-group>
@@ -227,24 +230,28 @@
                   label="数据项"
                   width="120"
                   align="center"
+                  show-overflow-tooltip
                 ></el-table-column>
                 <el-table-column
-                  prop="label"
+                  prop="labelValue"
                   label="标签"
                   width="100"
                   align="center"
+                  show-overflow-tooltip
                 ></el-table-column>
                 <el-table-column
                   prop="originalText"
                   label="描述"
                   min-width="120"
-                  align="left"
+                  align="center"
+                  show-overflow-tooltip
                 ></el-table-column>
                 <el-table-column
                   prop="dataValue"
                   label="数据值"
                   min-width="150"
-                  align="left"
+                  align="center"
+                  show-overflow-tooltip
                 ></el-table-column>
               </el-table>
               <div style="margin-top: 10px; font-size: 12px; color: #909399">
@@ -320,13 +327,7 @@
       },
       documentData: {
         type: Object,
-        default: () => ({
-          documentTypes: [],
-          list: [],
-          pagination: {},
-          dataList: [],
-          documentColumns: [],
-        }),
+        default: () => {},
       },
     },
     data() {
@@ -334,12 +335,14 @@
         dictData: {
           whGenerateType: [],
         },
+        activeDocumentTypeId: '',
         document: {
           documentId: '',
           documentWhId: '',
           documentNumber: '',
           enterpriseId: [],
           dataList: [],
+          isPushed: '1',
         },
         loading: {
           saveDocument: false,
@@ -362,6 +365,36 @@
         },
         selectDocumentWhSelection: [],
         costDocumentTemplateFiles: [],
+        documentRules: {
+          documentNumber: [
+            {
+              required: true,
+              message: '请选择通知书文号',
+              trigger: 'change',
+            },
+          ],
+          enterpriseId: [
+            {
+              required: true,
+              message: '请选择被监审单位',
+              trigger: 'change',
+            },
+          ],
+          documentId: [
+            {
+              required: true,
+              message: '请选择模板',
+              trigger: 'change',
+            },
+          ],
+          isPushed: [
+            {
+              required: true,
+              message: '请选择否推送被监审单位',
+              trigger: 'change',
+            },
+          ],
+        },
       }
     },
     computed: {
@@ -405,23 +438,15 @@
         ]
       },
     },
-    // 添加watch监听project变化,确保项目数据更新时重新加载数据
-    watch: {
-      project: {
-        handler(newVal) {
-          if (newVal && newVal.projectId) {
-            // 通知父组件需要加载数据
-            this.$emit('refresh', newVal.projectId)
-          }
-        },
-        deep: true,
-        immediate: true,
-      },
-    },
+    watch: {},
     mounted() {
       this.loadOpts()
     },
     methods: {
+      handleDocumentTypeClick(data) {
+        this.activeDocumentTypeId = data.id
+        this.$emit('refresh', data)
+      },
       getEnterpriseName(row) {
         // 处理enterpriseId,无论是数组还是逗号分隔的字符串
         let enterpriseIds = []
@@ -477,6 +502,10 @@
           documentWhId: '',
           documentNumber: '',
           enterpriseId: [],
+          isPushed: '1', // 默认设置为'1'(是)
+        }
+        if (this.activeDocumentTypeId) {
+          this.document.documentId = this.activeDocumentTypeId
         }
         this.costProjectDocumentFiles = []
       },
@@ -507,10 +536,6 @@
           this.selectDocumentWhSelection = selection
         }
       },
-      // 选择文档类型
-      selectDocumentType(doc) {
-        // this.documentData.selectedDoc = doc.value
-      },
       handleTemplateChange() {
         this.fileUrl = this.documentData.documentTypes.find(
           (item) => item.id === this.document.documentId
@@ -566,8 +591,8 @@
             documentId: this.document.documentId,
             documentNumber: this.document.documentNumber,
             documentWhId: this.document.documentWhId,
-            costProjectDocumentFiles: this.costProjectDocumentFiles || [],
-            // isPushed: this.document.isPushed,
+            costProjectDocumentFiles: this.costDocumentTemplateFiles,
+            isPushed: this.document.isPushed, // 添加isPushed字段
             projectId: this.project.projectId,
             // electronicDocumentUrl: '',
             enterpriseId: this.document.enterpriseId.join(','), // 保存时转换为逗号分隔的字符串
@@ -594,13 +619,13 @@
               documentId: this.document.documentId,
               documentNumber: this.document.documentNumber,
               documentWhId: this.document.documentWhId,
-              costProjectDocumentFiles: this.costProjectDocumentFiles || [],
+              costProjectDocumentFiles: this.costDocumentTemplateFiles || [],
               enterpriseId: enterpriseId,
               // electronicDocumentUrl: '',
               // feedbackDocumentUrl: '',
               // feedbackTime: '',
               // generateTime: '',
-              isPushed: this.document.isPushed,
+              isPushed: this.document.isPushed, // 使用isPushed,如果不存在则使用isPushed
               // orderNum: 0,
               // pushTime: '',
               // scanDocumentUrl: '',
@@ -611,7 +636,7 @@
             .then(() => {
               this.loading.saveDocument = false
               this.$message.success('保存成功!')
-              this.dialogVisible = false
+              this.documentDialogVisible = false
               this.activeView = ''
               this.$emit('refresh', this.project.projectId)
             })
@@ -746,8 +771,15 @@
           : []
         this.document = {
           ...row,
+          documentId: Number(row.documentId),
           enterpriseId,
+          // 确保isPushed有值,如果row中没有,设置默认值'1'
+          isPushed: row.isPushed !== undefined ? row.isPushed : '1',
         }
+        this.fileUrl = this.documentData.documentTypes.find(
+          (item) => item.id === this.document.documentId
+        ).fileUrl
+        this.getDocumentData(this.document.documentId)
       },
 
       // 签章
@@ -800,7 +832,11 @@
   }
 
   .type-item:hover {
-    color: #409eff;
+    color: $base-color-default;
+  }
+
+  .type-item.active {
+    color: $base-color-default;
   }
 
   .documents-content {

+ 42 - 36
src/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/index.js

@@ -217,7 +217,7 @@ export const taskMixin = {
         },
         surveyColumns: [
           {
-            prop: 'surveyTemplateId',
+            prop: 'surveyTemplateName',
             label: '成本调查表',
             minWidth: 200,
             align: 'left',
@@ -240,14 +240,6 @@ export const taskMixin = {
             label: '操作',
             width: 120,
             align: 'center',
-            actions: [
-              {
-                name: 'view',
-                label: '查看模板',
-                type: 'text',
-                onClick: this.handleViewTemplate,
-              },
-            ],
           },
         ],
       },
@@ -429,18 +421,16 @@ export const taskMixin = {
     }
   },
   computed: {},
-  methods: {
-    // 获取用户信息
-    getUser() {
-      getAllUserList()
-        .then((res) => {
-          this.userList = res.value || []
-        })
-        .catch(() => {})
+  watch: {
+    activeTab: {
+      handler(newVal) {
+        this.handleTabClick()
+      },
+      immediate: false, // 可选:如果需要在组件初始化时就执行,可以设置为true
     },
-    // 标签页切换
-    handleTabClick(tab) {
-      // 可添加标签页切换时的逻辑
+  },
+  methods: {
+    async handleTabClick() {
       switch (this.activeTab) {
         case 'basicInfo':
           this.getBasicInfo()
@@ -455,6 +445,8 @@ export const taskMixin = {
           this.getSurveyData()
           break
         case 'auditNotice':
+          const res = await getWhCateList()
+          this.documentData.documentTypes = res.value || []
           this.getDocumentData()
           break
         case 'workflow':
@@ -464,15 +456,27 @@ export const taskMixin = {
           break
       }
     },
+    // 获取用户信息
+    getUser() {
+      getAllUserList()
+        .then((res) => {
+          this.userList = res.value || []
+        })
+        .catch(() => {})
+    },
     getBasicInfo() {
       getCostProjectDetail({
         id: this.project.projectId,
-      }).then((res) => {
-        this.formData.basicInfo = {
-          ...this.project,
-          ...res.value,
-        }
       })
+        .then((res) => {
+          this.formData.basicInfo = {
+            ...this.project,
+            ...res.value,
+          }
+        })
+        .catch(() => {
+          this.formData.basicInfo = this.project
+        })
     },
     // 获取监审工作方案数据
     getScenarioData() {
@@ -495,31 +499,33 @@ export const taskMixin = {
         pageSize: this.materialData.pagination.pageSize,
         projectId: this.project.projectId,
       }).then((res) => {
-        if (res.code == 200) {
-          this.materialData.list = res.value.value.records
+        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() {
-      getCostProjectSurveyPageList({
-        pageNum: this.surveyData.pagination.currentPage,
-        pageSize: this.surveyData.pagination.pageSize,
-        projectId: this.project.projectId,
+      getCostSurveyTemplates({
+        // pageNum: this.surveyData.pagination.currentPage,
+        // pageSize: this.surveyData.pagination.pageSize,
+        catalogId: this.project.catalogId,
       }).then((res) => {
-        this.surveyData.survey = res.value.records
-        this.surveyData.pagination.total = res.value.total
+        this.surveyData.list = res.value
+        // this.surveyData.pagination.total = res.value.total
       })
     },
     // 获取监审通知数据
-    async getDocumentData() {
-      const res = await getWhCateList()
-      this.documentData.documentTypes = res.value || []
+    async getDocumentData(data) {
       getCostProjectDocumentPageList({
         pageNum: this.documentData.pagination.currentPage,
         pageSize: this.documentData.pagination.pageSize,
         projectId: this.project.projectId,
+        documentName: data ? data.documentName : '',
       }).then((res) => {
         this.documentData.list = res.value.value.records
         this.documentData.pagination.total = res.value.value.total

+ 49 - 23
src/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/materialTab.vue

@@ -42,7 +42,6 @@
   </div>
 </template>
 <script>
-  import { taskMixin } from './index.js'
   import {
     addCostProjectMaterial,
     updateCostProjectMaterial,
@@ -55,7 +54,6 @@
       CostAuditTable,
       LegalDialog,
     },
-    mixins: [taskMixin],
     props: {
       // 父组件传递的参数
       project: {
@@ -66,6 +64,10 @@
         type: Boolean,
         default: false,
       },
+      materialData: {
+        type: Object,
+        default: () => {},
+      },
     },
     data() {
       return {
@@ -88,19 +90,20 @@
             align: 'center',
           },
         ],
+        formData: {
+          material: {},
+        },
       }
     },
     watch: {
-      // 监听project变化,当项目信息更新时重新获取材料数据
-      // project: {
-      //   handler(newVal) {
-      //     if (newVal && newVal.projectId) {
-      //       this.getMaterialData()
-      //     }
-      //   },
-      //   deep: true,
-      //   immediate: true
-      // }
+      materialData: {
+        handler(val) {
+          if (val) {
+            this.formData.material = val.material
+          }
+        },
+        deep: true,
+      },
     },
     mounted() {},
     methods: {
@@ -114,7 +117,7 @@
         updateCostProjectMaterial(data)
           .then((res) => {
             this.$message.success('修改成功')
-            this.getMaterialData()
+            this.$emit('refresh')
           })
           .catch(() => {})
       },
@@ -130,15 +133,24 @@
           orderNum: 1,
           isRequired: '0',
         }
-        this.materialData.addMaterial = true
-        this.materialData.materialDialogVisible = true
+        // 通知父组件更新状态
+        this.$emit('update:materialData', {
+          ...this.materialData,
+          addMaterial: true,
+          materialDialogVisible: true,
+          materialDialogTitle: '添加',
+        })
       },
 
       // 编辑材料
       handleEditMaterial(row) {
-        this.materialData.materialDialogTitle = '修改'
         this.formData.material = { ...row }
-        this.materialData.materialDialogVisible = true
+        // 通知父组件更新状态
+        this.$emit('update:materialData', {
+          ...this.materialData,
+          materialDialogTitle: '修改',
+          materialDialogVisible: true,
+        })
       },
 
       // 删除材料
@@ -156,7 +168,7 @@
             try {
               deleteCostProjectMaterial(row.id).then((res) => {
                 this.$message.success('删除成功')
-                this.getMaterialData()
+                this.$emit('refresh')
               })
             } catch (error) {
               console.error('删除失败:', error)
@@ -177,24 +189,38 @@
           addCostProjectMaterial(data).then((res) => {
             this.$message.success('添加成功')
             this.$refs.legalDialog.setSubmitting(false)
-            this.materialData.materialDialogVisible = false
-            this.getMaterialData()
+            // 通知父组件关闭弹窗并刷新数据
+            this.$emit('update:materialData', {
+              ...this.materialData,
+              materialDialogVisible: false,
+            })
+            this.$emit('refresh')
           })
         } else {
           updateCostProjectMaterial(data).then((res) => {
             this.$message.success('修改成功')
             this.$refs.legalDialog.setSubmitting(false)
-            this.materialData.materialDialogVisible = false
-            this.getMaterialData()
+            // 通知父组件关闭弹窗并刷新数据
+            this.$emit('update:materialData', {
+              ...this.materialData,
+              materialDialogVisible: false,
+            })
+            this.$emit('refresh')
           })
         }
       },
       handleLegalSubmit() {},
       handleMaterialCancel() {
-        this.materialData.materialDialogVisible = false
+        this.$emit('update:materialData', {
+          ...this.materialData,
+          materialDialogVisible: false,
+        })
       },
       getTemplateOptions() {},
       templatePaginationChange() {},
+      handlePaginationChange({ currentPage, pageSize }) {
+        this.$emit('paginationChange', { currentPage, pageSize })
+      },
     },
   }
 </script>

+ 31 - 5
src/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/surveyTab.vue

@@ -2,7 +2,7 @@
   <div>
     <CostAuditTable
       :table-data="surveyData.list"
-      :columns="surveyData.surveyColumns"
+      :columns="getSurveyColumns()"
       :show-index="true"
       :show-action-column="true"
     ></CostAuditTable>
@@ -17,7 +17,6 @@
   </div>
 </template>
 <script>
-  import { taskMixin } from './index.js'
   import CostAuditTable from '@/components/costAudit/CostAuditTable.vue'
   import SurveyDialog from '@/views/costAudit/baseInfo/catalogManage/surveyDialog.vue'
   export default {
@@ -25,7 +24,6 @@
       CostAuditTable,
       SurveyDialog,
     },
-    mixins: [taskMixin],
     props: {
       // 父组件传递的参数
       project: {
@@ -36,6 +34,10 @@
         type: Boolean,
         default: false,
       },
+      surveyData: {
+        type: Object,
+        default: () => {},
+      },
     },
     data() {
       return {
@@ -55,16 +57,40 @@
         },
       }
     },
-    mounted() {},
+    mounted() {
+      // this.getSurveyData()
+    },
 
     methods: {
+      // 获取带操作按钮的表格列配置
+      getSurveyColumns() {
+        const columns = JSON.parse(
+          JSON.stringify(this.surveyData.surveyColumns || [])
+        )
+        const actionColumn = columns.find((col) => col.prop === 'action')
+        if (actionColumn) {
+          actionColumn.actions = [
+            {
+              name: 'view',
+              label: '查看模板',
+              type: 'text',
+              onClick: this.handleViewTemplate,
+            },
+          ]
+        }
+        return columns
+      },
       // 查看成本调查表内容弹窗
       handleViewTemplate(data) {
         // 设置表单数据
         this.contentEditForm = {
           surveyTemplateName: data.surveyTemplateName || '',
           templateType: data.templateType || '',
-          data: data || {},
+          data:
+            {
+              ...data,
+              surveyId: data.surveyTemplateId,
+            } || {},
         }
         // 设置弹窗标题
         this.contentEditDialogTitle = '查看'

+ 3 - 0
src/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/tabs.vue

@@ -126,6 +126,9 @@
             :project="project"
             :is-view="isView"
             :material-data="materialData"
+            @refresh="getMaterialData"
+            @paginationChange="handlePaginationChange"
+            @update:materialData="(val) => (materialData = val)"
           ></materialTab>
         </el-tab-pane>
 

+ 12 - 8
src/views/costAudit/projectInfo/auditTaskManage/taskCustomizedRelease/workflowTab.vue

@@ -40,12 +40,8 @@
       :show-action-column="true"
     >
       <template #action="{ row }">
-        <el-button
-          v-if="row.nodeType == 1"
-          type="text"
-          :disabled="isView"
-          @click="handleSetStep(row)"
-        >
+        <!-- v-if="row.nodeType == 1" -->
+        <el-button type="text" :disabled="isView" @click="handleSetStep(row)">
           设置
         </el-button>
       </template>
@@ -200,6 +196,7 @@
             default-first-option
             placeholder="请选择主办人员"
             style="width: 100%"
+            :disabled="formData.currentStep.nodeType == 0"
           >
             <el-option
               v-for="item in formatterMainUserList()"
@@ -218,7 +215,10 @@
             default-first-option
             placeholder="请选择从办人员"
             style="width: 100%"
-            :disabled="!formData.currentStep.mainUserId"
+            :disabled="
+              !formData.currentStep.mainUserId ||
+              formData.currentStep.nodeType == 0
+            "
           >
             <el-option
               v-for="item in formatterUserList(formData.currentStep.mainUserId)"
@@ -237,6 +237,7 @@
             default-first-option
             placeholder="请选择预置流转操作"
             style="width: 100%"
+            :disabled="formData.currentStep.nodeType == 0"
           >
             <el-option
               v-for="item in dictData['processStatus']"
@@ -255,6 +256,7 @@
             value-format="yyyy-MM-dd"
             style="width: 100%"
             :disabled="isTimePickerDisabled"
+            :picker-options="getPickerOptions(formData.currentStep)"
           ></el-date-picker>
         </el-form-item>
       </el-form>
@@ -372,7 +374,9 @@
         deep: true,
       },
     },
-    mounted() {},
+    mounted() {
+      this.getWorkflow()
+    },
 
     methods: {
       formatterUserList(userId) {