Ver Fonte

feat: 集体审议添加补充资料弹窗并对接接口

shiyanyu há 1 mês atrás
pai
commit
39873a3099

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

@@ -39,3 +39,12 @@ export function deleteCollectiveDeliberate(id) {
     method: 'delete',
   })
 }
+
+// 获取子单位列表
+export function getSubUnitList(data) {
+  return request({
+    url: url + '/api/enterprise/castTask/getChildTaskUnits',
+    method: 'get',
+    params: data,
+  })
+}

+ 267 - 0
src/views/costAudit/auditInfo/auditManage/collectiveMain.vue

@@ -5,6 +5,7 @@
         <span>集体审议</span>
       </div>
       <div class="collective-header-right">
+        <el-button type="primary" @click="handlePrint">补充资料</el-button>
         <el-button type="primary" @click="handleAddRecord">新增记录</el-button>
       </div>
     </div>
@@ -267,6 +268,59 @@
         </el-button>
       </div>
     </el-dialog>
+
+    <!-- 补充资料弹窗 -->
+    <el-dialog
+      :visible.sync="showSupplementDialog"
+      title="补充资料"
+      width="600px"
+      :modal="false"
+      custom-class="supplement-dialog"
+    >
+      <div class="supplement-dialog-content">
+        <div class="supplement-form-item">
+          <label class="supplement-form-label required">补充意见:</label>
+          <el-input
+            v-model="additionalParams.content"
+            type="textarea"
+            :rows="6"
+            placeholder="请输入补充意见"
+            maxlength="500"
+            show-word-limit
+            class="supplement-textarea"
+          />
+        </div>
+        <div class="supplement-form-item">
+          <label class="supplement-form-label required">选择子单位:</label>
+          <el-select
+            v-model="additionalParams.selectedSubUnits"
+            multiple
+            collapse-tags
+            placeholder="请选择子单位"
+            class="supplement-select"
+            filterable
+          >
+            <el-option
+              v-for="unit in subUnitList"
+              :key="unit.id"
+              :label="unit.name"
+              :value="unit.id"
+            />
+          </el-select>
+        </div>
+        <div class="supplement-form-item">
+          <label class="supplement-form-label required">发送方式:</label>
+          <el-checkbox-group v-model="additionalParams.sendType">
+            <el-checkbox label="site">站内消息</el-checkbox>
+            <el-checkbox label="sms">短信通知</el-checkbox>
+          </el-checkbox-group>
+        </div>
+      </div>
+      <div slot="footer" class="supplement-dialog-footer">
+        <el-button @click="showSupplementDialog = false">取消</el-button>
+        <el-button type="primary" @click="submitSupplement">发送</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 <script>
@@ -275,7 +329,9 @@
     updateCollectiveDeliberate,
     deleteCollectiveDeliberate,
     getCollectiveDeliberateList,
+    getSubUnitList,
   } from '@/api/audit/collective'
+  import { getReviewTask } from '@/api/audit/reviewTask'
   export default {
     name: 'CollectiveMain',
     components: {},
@@ -303,6 +359,7 @@
         recordList: [],
         // 弹窗显示状态
         showRecordDialog: false,
+        showSupplementDialog: false,
         // 表单数据
         formData: {
           id: '',
@@ -323,6 +380,14 @@
         fileList: [],
         // 当前操作类型:add/edit
         operationType: 'add',
+        // 补充资料弹窗数据
+        additionalParams: {
+          content: '',
+          sendType: [],
+          selectedSubUnits: [],
+        },
+        // 子单位列表
+        subUnitList: [],
         // 模拟用户列表数据
         userList: [
           { id: 1, name: '张三' },
@@ -477,6 +542,120 @@
         this.formData.auditedUnit = 'XX有限公司'
       },
 
+      // 补充资料
+      handlePrint() {
+        this.additionalParams = {
+          content: '',
+          sendType: [],
+          selectedSubUnits: [],
+        }
+        this.loadSubUnitList()
+        this.showSupplementDialog = true
+      },
+
+      // 加载子单位列表
+      async loadSubUnitList() {
+        if (!this.id) {
+          return
+        }
+        try {
+          const res = await getSubUnitList({ taskId: this.id })
+          if (res && res.code === 200 && res.value) {
+            this.subUnitList = Array.isArray(res.value)
+              ? res.value.map((item) => ({
+                  id: item.id || item.unitId,
+                  name: item.name || item.unitName,
+                  taskId: item.taskId || item.childTaskId, // 保存子任务ID
+                }))
+              : []
+          } else {
+            this.subUnitList = []
+          }
+        } catch (error) {
+          console.error('获取子单位列表失败:', error)
+          this.subUnitList = []
+        }
+      },
+
+      // 提交补充资料
+      async submitSupplement() {
+        // 验证补充意见
+        if (
+          !this.additionalParams.content ||
+          !this.additionalParams.content.trim()
+        ) {
+          this.$message.error('请输入补充意见')
+          return
+        }
+
+        // 验证任务ID
+        if (!this.id) {
+          this.$message.error('缺少任务ID')
+          return
+        }
+
+        // 验证选择子单位
+        if (
+          !this.additionalParams.selectedSubUnits ||
+          this.additionalParams.selectedSubUnits.length === 0
+        ) {
+          this.$message.error('请选择子单位')
+          return
+        }
+
+        // 验证发送方式
+        if (
+          !this.additionalParams.sendType ||
+          this.additionalParams.sendType.length === 0
+        ) {
+          this.$message.error('请选择发送方式')
+          return
+        }
+
+        try {
+          // 转换发送方式:site -> 1, sms -> 2
+          const sendTypeMap = {
+            site: '1',
+            sms: '2',
+          }
+          const sendTypeStr = this.additionalParams.sendType
+            .map((type) => sendTypeMap[type])
+            .filter(Boolean)
+            .join(',')
+
+          // 获取子任务ID(选中的子单位ID)
+          const childTaskId = this.additionalParams.selectedSubUnits.join(',')
+
+          const params = {
+            taskId: this.id,
+            processNodeKey: this.currentNode || '',
+            key: 1,
+            sendType: sendTypeStr,
+            content: this.additionalParams.content,
+            childTaskId: childTaskId,
+          }
+
+          const response = await getReviewTask(params)
+
+          if (response && response.code === 200) {
+            this.$message.success(response.message || '补充资料发送成功')
+            // 关闭弹窗
+            this.showSupplementDialog = false
+            // 重置表单数据
+            this.additionalParams = {
+              content: '',
+              sendType: [],
+              selectedSubUnits: [],
+            }
+          } else {
+            this.$message.error(response?.message || '补充资料发送失败')
+          }
+        } catch (error) {
+          console.error('补充资料发送失败:', error)
+          this.$message.error('补充资料发送失败')
+        }
+      },
+
       // 新增记录
       handleAddRecord() {
         this.operationType = 'add'
@@ -983,6 +1162,94 @@
     }
   }
 
+  /* 补充资料弹窗样式优化 */
+  ::v-deep .supplement-dialog {
+    .el-dialog__header {
+      padding: 20px 25px 15px;
+      border-bottom: 1px solid #ebeef5;
+      background-color: #fafafa;
+    }
+
+    .el-dialog__title {
+      font-size: 16px;
+      font-weight: 500;
+      color: #303133;
+    }
+
+    .el-dialog__body {
+      padding: 25px;
+    }
+
+    .el-dialog__footer {
+      padding: 15px 25px 20px;
+      border-top: 1px solid #ebeef5;
+      background-color: #fafafa;
+      text-align: right;
+    }
+  }
+
+  .supplement-dialog-content {
+    padding: 0;
+  }
+
+  .supplement-form-item {
+    display: flex;
+    align-items: flex-start;
+    margin-bottom: 20px;
+  }
+
+  .supplement-form-item:last-child {
+    margin-bottom: 0;
+  }
+
+  .supplement-form-label {
+    display: inline-block;
+    width: 100px;
+    text-align: left;
+    color: #606266;
+    font-size: 14px;
+    line-height: 32px;
+    flex-shrink: 0;
+    margin-right: 12px;
+  }
+
+  .supplement-form-label.required::before {
+    content: '*';
+    color: #f56c6c;
+    margin-right: 4px;
+  }
+
+  .supplement-textarea {
+    flex: 1;
+  }
+
+  .supplement-select {
+    flex: 1;
+    min-width: 300px;
+  }
+
+  .supplement-checkbox-group {
+    display: flex;
+    flex-direction: column;
+    flex: 1;
+  }
+
+  .supplement-checkbox-group .el-checkbox {
+    margin-bottom: 8px;
+  }
+
+  .supplement-checkbox-group .el-checkbox:last-child {
+    margin-bottom: 0;
+  }
+
+  .supplement-dialog-footer {
+    text-align: right;
+  }
+
+  .supplement-dialog-footer .el-button {
+    margin-left: 10px;
+  }
+
   /* 打印样式 */
   @media print {
     .collective {