From 1dbb5bb85691cc48a0f6f64c999e91729d4ad22d Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期五, 19 九月 2025 00:17:04 +0800
Subject: [PATCH] 优化审批界面

---
 src/views/flow/todolist.vue |  185 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 160 insertions(+), 25 deletions(-)

diff --git a/src/views/flow/todolist.vue b/src/views/flow/todolist.vue
index 1ed38a4..f149360 100644
--- a/src/views/flow/todolist.vue
+++ b/src/views/flow/todolist.vue
@@ -1,6 +1,7 @@
 <template>
     <basic-container>
         <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" v-model="form" ref="crud"
+            :search="query"
             @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange"
             @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad"
             @selection-change="selectionTransferTask">
@@ -13,15 +14,22 @@
                 <el-button type="primary" :disabled="this.transferTaskSelection.length==0" plain @click="reassign(0)">杞淳</el-button>
                 <el-button type="primary" :disabled="this.transferTaskSelection.length==0" v-if="permission.batch_approve" plain @click="reassign(3)">鎵归噺瀹℃壒
                 </el-button>
+
+                <el-button type="primary" :disabled="this.transferTaskSelection.length==0" v-if="permission.batch_on_machine" plain @click="showBatchOnMachine()">鐜板満缂栧埗
+                </el-button>
             </template>
             <template #menu="scope">
                 <el-button type="primary" text size="default" @click.stop="handleAction(scope.row, scope.index)">
                     {{approveButtonText(scope.row.taskDefinitionKey)}}
                 </el-button>
             </template>
+              
         </avue-crud>
         <el-dialog title=" " append-to-body v-model="reassignBox" width="30%">
             <avue-form ref="reassginform" :option="reassignOption" v-model="reassignForm" @submit="toPerson"></avue-form>
+        </el-dialog>
+        <el-dialog title="鐜板満缂栧埗" append-to-body v-model="onMachineBox" width="30%">
+            <avue-form :option="onMachineOption" v-model="onMachineForm" @submit="batchOnMachine"></avue-form>
         </el-dialog>
         <div  class="box-drawer">
         <el-drawer title="瀹℃壒" append-to-body v-model="approveBox" size="100%" v-if="approveBox" class="remark-drawer">
@@ -53,7 +61,7 @@
     </basic-container>
 </template>
 <script>
-import { getList, approve, getAssignee,getAssigneeTree,reassgin,manualDispatch,autoDispatch,todoChangeNotify,batchApprove } from '@/api/flow/todolist';
+import { getList, approve, getAssignee,getAssigneeTree,reassgin,manualDispatch,autoDispatch,todoChangeNotify,batchApprove, batchApproveOnMachine } from '@/api/flow/todolist';
 import { mapGetters } from 'vuex';
 import dayjs from 'dayjs';
 import TodolistLeft from './components/TodolistLeft.vue';
@@ -145,7 +153,12 @@
                 total: 0,
             },
             form: {},
-            query: {},
+            query: {
+                machineSpec: ['1','2']
+            },
+            defaultQuery: {
+                machineSpec: ['1','2']
+            },
             loading: true,
             option: {
                 rowKey: "taskId",
@@ -156,7 +169,7 @@
                 tip: false,
                 searchEnter:true,
                 searchShow: true,
-                searchMenuSpan: 6,
+                searchMenuSpan: 4,
                 dialogWidth: '60%',
                 border: true,
                 index: true,
@@ -168,7 +181,7 @@
                     {
                         label: '鍏抽敭瀛�',
                         prop: 'keyword',
-                        width: 300,
+                        width: 200,
                         search: true,
                         searchType: 'input',
                         hide: true,
@@ -180,6 +193,27 @@
                             {
                                 label: '宸ユ帶缃戣溅搴婄▼搴�',
                                 value: 2,
+                            },
+                        ],
+                    },
+                    {
+                        label: '鏈哄簥绫诲瀷',
+                        prop: 'machineSpec',
+                        width: 200,
+                        search: true,
+                        searchType: 'select',
+                        multiple:true,
+                        clearable:false,
+                        hide: true,
+                        emptyValues :["1",'2'],
+                        dicData: [
+                            {
+                                label: '鏁版帶杞﹀簥',
+                                value: '1',
+                            },
+                            {
+                                label: '鍔犲伐涓績',
+                                value: '2',
                             },
                         ],
                     },
@@ -349,7 +383,52 @@
                     },
                 ],
             },
-            reassignForm: {}
+            reassignForm: {},
+
+            onMachineBox: false,//鐜板満缂栧埗妗�
+            onMachineForm: {},
+            onMachineOption: {
+                submitBtn: true,
+                emptyBtn: false,
+                column: [
+                    {
+                        label: '瀹℃壒缁撴灉',
+                        prop: 'approve',
+                        type: 'radio',
+                        span: 24,
+                        display: false,
+                        dicData: [
+                            { label: '閫氳繃', value: 'Y' },
+                            { label: '椹冲洖', value: 'N' },
+                        ],
+                        rules: [{ required: true, message: '璇烽�夋嫨瀹℃壒缁撴灉', trigger: 'blur' }],
+                    },
+                    {
+                        label: '鍙戦�佺粰',
+                        prop: 'assignee',
+                        component: 'elTreeSelect',
+                        params: {
+                            props:{
+                                label: 'name',
+                                value:'id',
+                                disabled: (data) => data.nodeType==='dept',
+                                isLeaf: (data) => data.children==null || data.children.length==0,
+                            },
+                        },
+                        display: true,
+                        filterable: true,
+                        span: 24,
+                        disabled: false,
+                        rules: [{ required: true, message: '璇疯緭鍏ラ�夋嫨', trigger: 'blur' }],
+                    },
+                    {
+                        label: '澶囨敞',
+                        span: 24,
+                        prop: 'comment',
+                        type: 'textarea',
+                    },
+                ],
+            },
         };
     },
     watch: {
@@ -409,6 +488,7 @@
                 
                 this.optionApprove.column[1].data = this.assigneeData;
                 this.reassignOption.column[1].data = this.assigneeData;
+                this.onMachineOption.column[1].data = this.assigneeData;
              });
     },
     methods: {
@@ -631,8 +711,41 @@
                 }
             }
             
-            
         },
+        showBatchOnMachine(){//鏄剧ず鐜板満缂栧埗瀵硅瘽妗�
+            this.onMachineBox = true;
+            this.onMachineForm.assignee = this.transferTaskSelection[0].variables.checker;
+
+        },
+        batchOnMachine() {//缂栧埗鎵归噺澶勭悊锛堢幇鍦虹紪鍒讹級
+           
+            this.$confirm('璇风‘璁ゆ槸鍚﹀皢閫夊畾浠诲姟璁剧疆涓虹幇鍦虹紪鍒讹紵', '', {
+                confirmButtonText: this.$t('submitText'),
+                cancelButtonText: this.$t('cancelText'),
+                type: 'warning',
+            }).then(() => {
+                batchApproveOnMachine({
+                    taskIds: this.transferTaskSelection.map(v => v.taskId),
+                    processInstanceIds: this.transferTaskSelection.map(v => v.processInstanceId),
+                    assignee: this.onMachineForm.assignee,
+                }).then(res => {
+                    if(res.data.code !== 200) {
+                        this.$message.error(res.data.msg);
+                        return;
+                    }
+                    this.$message.success('鎿嶄綔鎴愬姛');
+                    this.onMachineBox = false;
+                    this.onLoad(this.page, this.query);
+                    todoChangeNotify();
+                }).catch(err => {
+                    this.$message.success('鎿嶄綔澶辫触');
+                })
+            }).catch(() => {
+                // this.$message.info('宸插彇娑堟搷浣�');
+            });
+           
+        },
+
         toPerson(form, done) {
             let tip = ''
             this.reassignType === 1 ? tip = '璇风‘璁ゆ槸鍚︽墜鍔ㄦ淳宸�' : this.reassignType === 2 ? tip = '璇风‘璁ゆ槸鍚﹁嚜鍔ㄦ淳宸�' : tip = '璇风‘璁ゆ槸鍚﹂噸鏂版寚娲�';
@@ -770,16 +883,35 @@
             this.setApproveBtn(row);
             //console.log('handleAction', row, index);
         },
-        handleSubmit(form, done) {
-            
-            
-            //this.$alert(this.$refs.todolistLeft.programOnMachine)
-            //done();
-            //return;
+        async handleSubmit(form, done) {
+
             let programOnMachine = 'N'
-            if(this.row.taskDefinitionKey==='programmingTask'){
+            let goApprove = true;
+            if(this.row.taskDefinitionKey==='programmingTask' || this.row.taskDefinitionKey==='cureProgramTask'){
                 programOnMachine = this.$refs.todolistLeft.programOnMachine?'Y':'N';
+
+                let atts = this.$refs.todolistLeft.tableData;
+                let otherFileCOunt = atts.filter(att => att.program === false).length;
+                if(otherFileCOunt == 0 && programOnMachine != 'Y'){
+                    let confirResult = await this.$confirm('鏂囦欢鍒楄〃涓棤鍏朵粬鏂囦欢锛岀‘璁よ鎻愪氦鍚楋紵', '', {
+                        confirmButtonText: this.$t('submitText'),
+                        cancelButtonText: this.$t('cancelText'),
+                        type: 'warning',
+                    }).then(()=>{
+                        goApprove = true;
+                    }).catch(action => {
+                        //鍙栨秷鎿嶄綔
+                        goApprove = false;
+                    });
+
+                }
+                
             }
+            if(goApprove == false){
+                done();
+                return;
+            }
+
             approve({
                 ...this.formApprove,
                 taskId: this.row.taskId,
@@ -806,6 +938,7 @@
             let data = {}
             this.query = params;
             this.page.currentPage = 1;
+            /*
             console.log('searchChange', params);
             params.createTimeBegin = params?.processCreateTime?.[0] || '';
             params.createTimeEnd = params?.processCreateTime?.[1] || '';
@@ -815,11 +948,12 @@
                 keyword: params.keyword || ''
             }
             this.query = data
-            this.onLoad(this.page, data);
+            */
+            this.onLoad(this.page, {});
             done();
         },
         searchReset() {
-            this.query = {};
+            this.query = this.defaultQuery;
             this.onLoad(this.page);
         },
         currentChange(currentPage) {
@@ -835,7 +969,6 @@
         onLoad(page, params = {}) {
             const query = {
                 ...this.query,
-                // category: params.category ? flowCategory(params.category) : null,
                 mode: this.mode,
             };
             try {
@@ -843,7 +976,9 @@
             } catch (error) {
                 console.error('鏃ユ湡鏍煎紡鍖栭敊璇�', error);
             }
-
+             console.log('params',params);
+            console.log('q',query);
+            console.log('thisq',this.query);
             this.loading = true;
             getList(page.currentPage, page.pageSize, Object.assign(query, params)).then(res => {
                 const data = res.data.data;
@@ -859,19 +994,19 @@
 };
 </script>
 
-<style scoped="scoped" lang="scss">
-.box-drawer {
-  &:deep(.el-drawer.remark-drawer) {
-    width: 30vw !important;
+<style lang="scss">
+.remark-drawer  {
     .el-drawer__header {
+        padding-top:5px;
       margin-bottom: 0px !important;
-      padding: 1vh 1vw !important;
     }
-    .el-drawer__body {
-      padding: 0px 1vw !important;
+    .el-drawer__body{
+        padding-top:5px;
     }
-  }
 }
+</style>
+<style scoped="scoped" lang="scss">
+
 .approve-box {
     display: flex;
 

--
Gitblit v1.9.3