Procházet zdrojové kódy

部门任务添加功能

liuhj před 1 měsícem
rodič
revize
3c92473d3d
1 změnil soubory, kde provedl 69 přidání a 5 odebrání
  1. 69 5
      src/components/OP/DepartProcessList.vue

+ 69 - 5
src/components/OP/DepartProcessList.vue

@@ -18,7 +18,7 @@
                                 <el-button type="primary" @click="add">新增</el-button>
                             </div>
                         </div>
-                        <el-table class="table_list" border :data="tableData" style="width: 100%">
+                        <el-table class="table_list" border :data="tableData" style="width: 100%" :row-key="expandid" :expand-row-keys="expandRows" @expand-change="expandRowschande">
                             <el-table-column type="expand">
                                 <template slot-scope="props">
                                     <div style="padding: 5px 20px;">
@@ -55,7 +55,7 @@
                                                     :style="{ 'color': index < props.row.stepInfo.active - 1 ? '#67c23a' : props.row.stepInfo.active - 1 == index ? 'black' : '#c0c4cc' }">
                                                     <!-- props.row.stepInfo.active - 1 == index -->
                                                     <span class="step_icon"
-                                                        @click="showdialog(true, stepItem.id, props.row.id, props.row.isReview, props.row.stepInfo.active - 1 == index)">
+                                                        @click="showdialog(true, stepItem.id, props.row.id, props.row.isReview, props.row.stepInfo.active - 1 == index,props.row.stepInfo.active,index)">
                                                         {{
                                                             stepItem.name
                                                         }}
@@ -210,8 +210,11 @@
                     </div>
                 </el-card>
                 <span slot="footer" class="dialog-footer">
-                    <el-button @click="dialogVisible = false">取 消</el-button>
-                    <el-button type="primary" @click="submitForm(isReview)">确 定</el-button>
+                    <el-button type="primary" v-if="!isReview" @click="SubmitWorkTaskNotRecord">无记录通过</el-button>
+                    <div>
+                        <el-button @click="dialogVisible = false">取 消</el-button>
+                        <el-button type="primary" @click="submitForm(isReview)">确 定</el-button>
+                    </div>
                 </span>
             </el-dialog>
         </div>
@@ -259,9 +262,19 @@ export default {
             historyForm: [],
             isReview: false,
             isSubmit: true,
+            expandRows: [],
         }
     },
     methods: {
+        expandRowschande(row, expandedRows){
+            this.expandRows=[];
+            for (let index = 0; index < expandedRows.length; index++) {
+                this.expandRows.push(expandedRows[index].id)
+            }
+        },
+        expandid(row){
+           return row.id
+        },
         Search() {
             this.load();
         },
@@ -282,6 +295,48 @@ export default {
             const { file } = option;
             return new Promise((resolve) => resolve());
         },
+        //无记录通过
+        SubmitWorkTaskNotRecord(){
+            this.$axios({
+                method: 'post',
+                url: '/api/Task/SubmitWorkTaskNotRecord',
+                data: {
+                    userId:this.userId,
+                    workOrderId:this.form.workOrderId,
+                    workTaskId:this.form.workTaskId,
+                },
+            }).then(response => {
+                if (response.data.code == 200) {
+                    this.$message({
+                        message: '任务通过',
+                        type: 'success'
+                    });
+                } else {
+                    this.$message({
+                        message: response.data.msg || '任务通过失败',
+                        type: 'warning'
+                    });
+                }
+            }).catch(error => {
+                // 处理错误
+                console.error(error);
+                this.$message({
+                    message: '请求失败,请检查网络连接',
+                    type: 'error'
+                });
+            }).finally(() => {
+                this.dialogVisible = false;
+                // 重置表单
+                this.form = {
+                    isCompleted: 1,
+                    content: '',
+                    fileList: [],
+                    workOrderId: 0,
+                    workTaskId: 0,
+                }
+                this.load();
+            });
+        },
         // 提交表单和文件
         submitForm() {
 
@@ -391,7 +446,11 @@ export default {
             this.pagination.pageIndex = 1; // 重置到第一页
             this.load(); // 重新加载数据
         },
-        showdialog(flag, workTaskId, workOrderId, isReview, isSubmit) {
+        showdialog(flag, workTaskId, workOrderId, isReview, isSubmit,active,indexs) {
+            console.log(flag, workTaskId, workOrderId, isReview, isSubmit,active,indexs);
+            if (active!=indexs+1&&active!==undefined&&indexs!==undefined) {
+                return;
+            }
             this.dialogVisible = flag;
             this.form.workTaskId = workTaskId;
             this.form.workOrderId = workOrderId;
@@ -612,4 +671,9 @@ export default {
 .toppx>div {
     margin-top: 5px;
 }
+.dialog-footer{
+    display: flex;
+    justify-content: space-between;
+    align-items: center;
+}
 </style>