From ee5102cc92b919623139e88819a945e02e611182 Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期六, 06 九月 2025 19:15:32 +0800
Subject: [PATCH] 解锁增加解锁原因和展示

---
 src/views/wel/shemi.vue |  186 +++++++++++++++++++---------------------------
 1 files changed, 76 insertions(+), 110 deletions(-)

diff --git a/src/views/wel/shemi.vue b/src/views/wel/shemi.vue
index 3a48b74..1a3f0b2 100644
--- a/src/views/wel/shemi.vue
+++ b/src/views/wel/shemi.vue
@@ -39,20 +39,10 @@
             </el-col>
           </el-row>
         </template>
-        <!-- <template #menu-left>
-        <el-button :size="size" type="primary" @click="showAdd()">鏂板鏍硅妭鐐�</el-button>
-      </template> -->
+       
         <template #name="{ row }">
           <span>{{ row.name }}</span>
-          <!-- <el-button :size="size" text v-if="row.nodeType != 70" icon="el-icon-setting" type="primary" placeholder="淇敼" @click="showEdit(row)" title="淇敼"></el-button>
-        <el-button :size="size" text v-if="row.nodeType != 10" icon="el-icon-delete" type="primary" @click="showDel(row)" placeholder="鍒犻櫎" title="鍒犻櫎"></el-button>
-        <el-button :size="size" text v-if="row.nodeType != 60 && row.nodeType != 70" icon="el-icon-document-add" type="primary" @click="showAdd(row)" placeholder="鏂板瀛愮骇" title="鏂板瀛愮骇"></el-button>
-        <el-button :size="size" text v-if="row.nodeType == 60 || row.nodeType == 50" icon="el-icon-upload" type="primary" @click="showUpload(row)" placeholder="鏂囦欢涓婁紶" title="鏂囦欢涓婁紶"></el-button> -->
-          <!-- 娑夊瘑缃戞墠鏈� -->
-          <!-- <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-pie-chart" type="primary" @click="upgrade(row)" placeholder="鍗囩増" title="鍗囩増"></el-button> -->
-          <!-- 宸ユ帶缃戞墠鏈� -->
-          <!-- <el-button :size="size" text v-if="row.nodeType == 70" icon="el-icon-position" type="primary" @click="downsend(row)" placeholder="涓嬪彂" title="涓嬪彂"></el-button> -->
-
+          
           <!-- 鏇挎崲  v-if="permission.auto_dispatch"-->
           <el-button :size="size" text v-if="row.nodeType == 60 && row.parentIds.indexOf('0,1,') > -1"
             icon="el-icon-switch" type="primary" @click="replacement(row)" placeholder="鏇挎崲" title="鏇挎崲"></el-button>
@@ -61,7 +51,7 @@
             icon="el-icon-lock" type="primary" @click="showLockDlg(row)" placeholder="閿佸畾" title="閿佸畾"></el-button>
           <el-button :size="size" text
             v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2') > -1 && row.isLocked == 1"
-            icon="el-icon-unlock" type="primary" @click="startUnlock(row)" placeholder="瑙i攣" title="瑙i攣"></el-button>
+            icon="el-icon-unlock" type="primary" @click="showUnLockDlg(row)" placeholder="瑙i攣" title="瑙i攣"></el-button>
         </template>
       </avue-crud>
     </div>
@@ -118,7 +108,7 @@
             icon="el-icon-lock" type="primary" @click="showLockDlg(row)" placeholder="閿佸畾" title="閿佸畾"></el-button>
           <el-button :size="size" text
             v-if="permission.lock_button && row.nodeType == 60 && row.parentIds.indexOf('0,2') > -1 && row.isLocked == 1"
-            icon="el-icon-unlock" type="primary" @click="startUnlock(row)" placeholder="瑙i攣" title="瑙i攣"></el-button>
+            icon="el-icon-unlock" type="primary" @click="showUnLockDlg(row)" placeholder="瑙i攣" title="瑙i攣"></el-button>
         </template>
       </avue-crud>
     </div>
@@ -142,7 +132,9 @@
     <el-dialog title="绋嬪簭閿佸畾" append-to-body v-model="lockBox">
       <avue-form :option="lockOption" v-model="lockForm" @submit="lockSubmit" @reset-change="lockCancel" />
     </el-dialog>
-    
+    <el-dialog title="绋嬪簭瑙i攣" append-to-body v-model="unlockBox">
+      <avue-form :option="unlockOption" v-model="unlockForm" @submit="unlockSubmit" @reset-change="unlockCancel" />
+    </el-dialog>
     <avue-tabs :option="tabsOption" @change="tabsHandleChange" style="margin-top: 30px;" v-if="isShowTabs"></avue-tabs>
     <avue-form v-if="tabsType == 'tab1'" :option="tabsFormOption" v-model="tabsForm"></avue-form>
     <!--<span v-else-if="tabsType == 'tab2'">鐗堟湰淇℃伅</span>-->
@@ -191,6 +183,7 @@
 import { ElMessage } from 'element-plus';
 import TodolistLeft from './components/TodolistLeft.vue';
 import TodolistRightTop from './components/TodolistRightTop.vue';
+import qs from 'qs';
 export default {
   components: {
     TodolistLeft,
@@ -307,22 +300,16 @@
           icon: 'el-icon-info',
           label: '鑺傜偣淇℃伅',
           prop: 'tab1',
-        }/*, {
-          icon: 'el-icon-warning',
-          label: '鐗堟湰淇℃伅',
-          prop: 'tab2',
-        }*/]
+        }
+      ]
       },
       tabsOption2: {
         column: [{
           icon: 'el-icon-info',
           label: '鑺傜偣淇℃伅',
           prop: 'tab1',
-        },/* {
-          icon: 'el-icon-warning',
-          label: '鐗堟湰淇℃伅',
-          prop: 'tab2',
-        }, */{
+        },
+        {
           icon: 'el-icon-warning',
           label: '鏂囦欢鍐呭',
           prop: 'tab3'
@@ -464,6 +451,37 @@
       lockForm: {},
       lockBox: false,
 
+      unlockOption: {
+        submitText: "鍚姩瑙i攣娴佺▼",
+        emptyText: "鍙栨秷",
+        menuPosition: "right",
+        column: [
+          {
+            label: '绋嬪簭鍖呭悕',
+            prop: 'name',
+            disabled:true,
+            labelWidth: "120",
+          },
+          {
+            label: '閿佸畾鍘熷洜',
+            prop: 'remark',
+            type: "textarea",
+            disabled:true,
+            labelWidth: "120",
+            span: 24,
+          },
+          {
+            label: '瑙i攣鍘熷洜',
+            prop: 'unlockReason',
+            type: "textarea",
+            labelWidth: "120",
+            span: 24,
+          }
+        ]
+      },
+      unlockForm: {},
+      unlockBox: false,
+
       id: "",
       parentId: 1,
       loading: true,
@@ -521,7 +539,7 @@
             width: '360'
           },
           {
-            label: '鐗堟湰',
+            label: '绋嬪簭鐗堟湰',
             prop: 'versionNumber',
             formatter: (val, value, label) => {
               if (val.nodeType == '60') {
@@ -780,9 +798,10 @@
         });
     },
     showLockDlg(row){
-      this.lockForm = row;
-     //this.lockForm.name = row.name;
-     // this.lockForm.id = row.id;
+      //this.lockForm = row;
+      this.lockForm.id = row.id;
+      this.lockForm.name = row.name
+      this.lockForm.parentId = row.parentId;
       this.lockForm.remark = '';
       this.lockBox = true;
     },
@@ -790,33 +809,43 @@
       this.lockBox = false;
       this.lockForm = {};
     },
-    lockSubmit() {  
+    showUnLockDlg(row){
+      this.unlockForm.id = row.id;
+      this.unlockForm.name = row.name
+      this.unlockForm.remark = row.remark;
+      this.unlockForm.unlockReason='';
+      this.unlockForm.parentId = row.parentId;
+      this.unlockBox = true;
+    },
+    lockSubmit(row,done) {  
+      //console.log(row,done)
       //閿佸畾鎻愪氦
       this.$confirm('鏄惁閿佸畾', {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning',
       }).then(() => {
-        axios({
-          url: '/blade-mdm/program/node/lock',
-          method: 'post',
-          params: this.lockForm
-        }).then(res => {
+        axios.post('/blade-mdm/program/node/lock',qs.stringify(this.lockForm)).then(res=>{
+          console.log('res',res.data)
           if (res.data.code == 200) {
             this.$message({ type: 'success', message: '鎿嶄綔鎴愬姛!' });
             this.addLocalTreeNode(this.lockForm.parentId);
-            this.lockBox = false;
+            this.unlockBox = false;
           } else {
-            this.$message({ type: 'success', message: res.data.msg });
+            this.$message({ type: 'error', message: res.data.msg });
           }
+          this.lockBox = false;
+        }).catch(error => {
+          this.$message({ type: 'error', message: res.data.msg });
         });
+        done();
       }).catch(action => {
         console.log('cancel')
       });
     },
-    startUnlock(row) {
+    unlockSubmit(row,done) {
       //鍚姩瑙i攣娴佺▼
-      this.$confirm(`鏄惁瑙i攣`, {
+      this.$confirm(`纭瑙i攣`, {
         confirmButtonText: '纭畾',
         cancelButtonText: '鍙栨秷',
         type: 'warning',
@@ -824,18 +853,22 @@
         axios({
           url: '/blade-mdm/flow/lock/start-unlock',
           method: 'post',
-          params: {nodeId: row.id }
+          params: {nodeId: row.id,unlockReason:row.unlockReason }
         }).then(res => {
           if (res.data.code == 200) {
             this.$message({ type: 'success', message: '瑙i攣娴佺▼宸插惎鍔�!' });
             this.addLocalTreeNode(row.parentId);
           } else {
-            this.$message({ type: 'success', message: res.data.msg });
+            this.$message({ type: 'error', message: res.data.msg });
           }
         });
+        done();
       }).catch(action => {
         console.log('cancel')
       });
+    },
+    unlockCancel() {
+      this.unlockBox = false;
     },
     handleSubmit(form, done) {
       //鍙戣捣绋嬪簭鏇挎崲娴佺▼
@@ -861,31 +894,7 @@
         window.console.log('haha', error);
         done();
       });
-      // if(this.row.taskDefinitionKey === 'programmingTask') {
-      //     // if(this.applist.length !== 1) {
-      //     //     done();
-      //     //     return this.$message.success('璇烽�夋嫨1涓▼搴�');
-      //     // }
-      // }
-      // approve({
-      //     ...this.formApprove,
-      //     taskId: this.row.taskId,
-      //     processInstanceId: this.row.processInstanceId,
-      //     // programIds: this.row.taskDefinitionKey === 'programmingTask' ? this.applist.map(v => v.id).join(',') : '',
-      // }).then(res => {
-      //     if(res.data.code !== 200) {
-      //         this.$message.error(res.data.msg);
-      //         done();
-      //         return;
-      //     }
-      //     this.$message.success('瀹℃壒鎴愬姛');
-      //     this.approveBox = false;
-      //     this.onLoad(this.page, this.query);
-      //     done();
-      // }).catch(err => {
-      //     done();
-      //     console.error(err);
-      // });
+      
     },
     todoSelectionChange(applist) {
       this.applist = applist;
@@ -1241,50 +1250,7 @@
       this.modalBox = true;
       this.modalForm = row;
     },
-    showDel(row) {
-      this.$confirm('灏嗕細鍒犻櫎璇ヨ妭鐐瑰強鍏跺瓙鑺傜偣锛屾槸鍚︾‘璁ゅ垹闄�?', {
-        confirmButtonText: '鏄�',
-        cancelButtonText: '鍚�',
-        type: 'warning',
-      }).then(() => {
-        //璋冪敤鎺ュ彛
-        this.loading = true;
-        axios({
-          url: '/blade-mdm/program/node/remove',
-          method: 'post',
-          params: { id: row.id },
-        }).then(
-          res => {
-            this.loading = false;
-            this.addLocalTreeNode(row.parentId);
-          }
-        );
-      })
-    },
-    showAdd(row) {  //鏂板瀛愯妭鐐�
-      if (!row) {
-        this.modalTitle = "鏂板鏍硅妭鐐�";
-        this.modalForm.nodeType = this.nodeTypeList[0].dictKey;
-        this.modalForm.parentId = 0;
-      } else {
-        if (row.nodeType == 60) { //绋嬪簭鍖�
-          return;
-        }
-        var defalutNodeType = "";  //涓嬩竴绾ц妭鐐圭被鍨�
-        for (var i = 0; i < this.nodeTypeList.length; i++) {
-          if (row.nodeType == this.nodeTypeList[i].dictKey) {
-            defalutNodeType = this.nodeTypeList[i + 1].dictKey;
-          }
-        }
-        this.modalTitle = "鏂板瀛愯妭鐐�";
-        this.selectedColumn.nodeType = defalutNodeType;
-        this.selectedColumn.parentId = row.id;
-        this.selectedColumn.name = "";
-        this.selectedColumn.id = "";
-        this.modalForm = this.selectedColumn;
-      }
-      this.modalBox = true;
-    },
+    
     modalSubmit(row, done) {  //鏂板瀛愯妭鐐逛繚瀛�/淇敼
       if (this.modalTitle == "淇敼") {
         var url = "/blade-mdm/program/node/update";

--
Gitblit v1.9.3