Przeglądaj źródła

fix:审核端任务办理集体审议数据详情及审议项目、被审单位回显

shiyanyu 3 tygodni temu
rodzic
commit
5f9dff004a

+ 9 - 0
src/api/audit/collective.js

@@ -50,3 +50,12 @@ export function getSubUnitList(data) {
     params: data,
   })
 }
+
+// 集体审计详情
+export function infoCollectiveDeliberate(data) {
+  return request({
+    url: url + '/api/costProjectDeliberate/v1/getDetail',
+    method: 'get',
+    params: data,
+  })
+}

+ 87 - 28
src/views/costAudit/auditInfo/auditManage/collectiveMain.vue

@@ -237,6 +237,8 @@
               type="textarea"
               :rows="5"
               placeholder="填写"
+              maxlength="200"
+              show-word-limit
               class="form-textarea"
             ></el-input>
           </div>
@@ -345,6 +347,8 @@
     getSubUnitList,
   } from '@/api/audit/collective'
   import { getReviewTask } from '@/api/audit/reviewTask'
+  import { getCostProjectDetail } from '@/api/taskCustomizedRelease'
+  import { infoCollectiveDeliberate } from '@/api/audit/collective'
   export default {
     name: 'CollectiveMain',
     components: {},
@@ -523,6 +527,28 @@
       this.getProjectInfo()
     },
     methods: {
+      // 读取项目详情并回显“审议项目/被审单位”
+      async loadProjectDetailAndFill() {
+        try {
+          const projectId = this.project && this.project.projectId
+          if (!projectId) return
+          const res = await getCostProjectDetail({ id: projectId })
+          if (res && res.code === 200) {
+            const v = res.value || {}
+            this.formData.reviewProject =
+              v.projectName || v.name || this.formData.reviewProject || ''
+            this.formData.auditedUnit =
+              v.auditedUnitName ||
+              v.auditUnitName ||
+              v.enterpriseName ||
+              v.unitName ||
+              this.formData.auditedUnit ||
+              ''
+          }
+        } catch (e) {
+          console.error('获取监审立项信息详情失败:', e)
+        }
+      },
       // 加载记录列表
       loadRecordList() {
         // 调用API获取集体审议记录列表
@@ -568,8 +594,8 @@
       // 获取项目信息
       getProjectInfo() {
         // 模拟获取项目信息,实际应该调用API
-        this.formData.reviewProject = 'XX项目成本监审'
-        this.formData.auditedUnit = 'XX有限公司'
+        // this.formData.reviewProject = 'XX项目成本监审'
+        // this.formData.auditedUnit = 'XX有限公司'
       },
 
       // 补充资料
@@ -687,40 +713,73 @@
       },
 
       // 新增记录
-      handleAddRecord() {
+      async handleAddRecord() {
         this.operationType = 'add'
         this.resetForm()
+        await this.loadProjectDetailAndFill()
         this.showRecordDialog = true
       },
 
       // 编辑记录
-      handleEditRecord(row) {
+      async handleEditRecord(row) {
         this.operationType = 'edit'
-        // 复制数据到表单
-        this.formData = {
-          id: row.id,
-          deliberationForm: row.deliberationForm,
-          location: row.location,
-          // 解析时间,实际应该根据API返回格式处理
-          startDate: row.reviewTime,
-          endDate: row.reviewTime,
-          hostPerson: row.hostPerson,
-          recordPerson: row.recordPerson,
-          participants: '',
-          reviewProject: this.formData.reviewProject,
-          auditedUnit: this.formData.auditedUnit,
-          reviewSituation: '',
-          reviewConclusion: '',
-          attachments: row.attachments || [],
-        }
-        // 设置文件列表
-        this.fileList = row.attachments
-          ? row.attachments.map((file) => ({
-              name: file.name,
-              url: file.url,
-              uid: file.name,
+        // 优先从后端详情获取并回显
+        try {
+          const detailRes = await infoCollectiveDeliberate({ id: row.id })
+          if (detailRes && detailRes.code === 200 && detailRes.value) {
+            const v = detailRes.value
+            this.formData = {
+              id: v.id || row.id,
+              deliberationForm: v.deliberationForm || '',
+              // beginTime/endTime 后端已按 yyyy-MM-dd HH:mm 返回,直接回显
+              startDate: v.beginTime || '',
+              endDate: v.endTime || '',
+              location: v.location || '',
+              hostPerson: v.hostPerson || '',
+              recordPerson: v.recordPerson || '',
+              participants: v.participants || '',
+              reviewProject: this.formData.reviewProject, // 由项目详情回显
+              auditedUnit: this.formData.auditedUnit, // 由项目详情回显
+              reviewSituation: v.deliberationContent || '',
+              reviewConclusion: v.conclusionOpinion || '',
+              attachments: [],
+            }
+            // 附件IDS -> 文件列表(此处仅占位展示,真实URL可在预览接口中换取)
+            const ids = (v.attachmentIds || '').split(',').filter(Boolean)
+            this.fileList = ids.map((id) => ({
+              name: `附件_${id}`,
+              url: '#',
+              uid: id,
             }))
-          : []
+          } else {
+            // 回退到列表行数据
+            this.formData = {
+              id: row.id,
+              deliberationForm: row.deliberationForm,
+              location: row.location,
+              startDate: row.reviewTime,
+              endDate: row.reviewTime,
+              hostPerson: row.hostPerson,
+              recordPerson: row.recordPerson,
+              participants: '',
+              reviewProject: this.formData.reviewProject,
+              auditedUnit: this.formData.auditedUnit,
+              reviewSituation: '',
+              reviewConclusion: '',
+              attachments: row.attachments || [],
+            }
+            this.fileList = row.attachments
+              ? row.attachments.map((file) => ({
+                  name: file.name,
+                  url: file.url,
+                  uid: file.name,
+                }))
+              : []
+          }
+        } catch (e) {
+          console.error('获取集体审议详情失败:', e)
+        }
+        await this.loadProjectDetailAndFill()
         this.showRecordDialog = true
       },
 

+ 2 - 2
src/views/costAudit/auditInfo/auditManage/index.vue

@@ -409,12 +409,12 @@
 
       // 打开详情弹窗
       handleOpenDetails(project) {
-        console.log('project', project)
+        // console.log('project', project)
         this.selectedProject = project
         this.detailsVisible = true
       },
       handleOpenMainDetails(project) {
-        console.log('project', project)
+        // console.log('project', project)
         this.selectedProject = project
         this.mainDetailsVisible = true
       },