From 8499181e9d717bfc5a689d6a5f61c3b182f2f28e Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期四, 04 九月 2025 20:02:47 +0800
Subject: [PATCH] 提示改为alert

---
 src/views/flowmgr/taskassign.vue |  122 ++++++++++++++++++++++++++++++++++------
 1 files changed, 104 insertions(+), 18 deletions(-)

diff --git a/src/views/flowmgr/taskassign.vue b/src/views/flowmgr/taskassign.vue
index eab0580..5096daf 100644
--- a/src/views/flowmgr/taskassign.vue
+++ b/src/views/flowmgr/taskassign.vue
@@ -8,7 +8,14 @@
 -->
 <template>
   <basic-container>
-    <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit" @blur="handleTrim"></avue-form>
+    <avue-form ref="form" :option="attachOption" v-model="attachForm" @submit="formSubmit">
+      <template #machineCode="{}">
+        <el-tree-select ref="tree" filterable  v-model="attachForm.machineCode"
+         node-key="machineCode"
+          :data="treeData" :props="defaultProps">
+          </el-tree-select>
+      </template>
+    </avue-form>
   </basic-container>
 </template>
 
@@ -39,13 +46,21 @@
   },
   data() {
     
-    var isTempFlow = getQueryString("isTempFlow");
-    isTempFlow = isTempFlow === 'Y'?'Y':'N';
+    //var isTempFlow = getQueryString("isTempFlow");
+    //isTempFlow = isTempFlow === 'Y'?'Y':'N';
     
     var that = this;
     return {
       form: {},
-      machineCodeList: [],
+
+      treeData: [],
+      defaultProps: {
+        children: 'children',
+        label: 'name',
+        disabled: (data) => data.nodeType!=='machine',//浠呮満搴婅妭鐐瑰彲閫�
+        isLeaf: (data) => !data.hasChildren
+      },
+
       attachOption: {
         labelWidth: 160,
         submitBtn: true,
@@ -58,11 +73,7 @@
             type: 'input',
             span: 24,
             disabled:true,
-            dataType: 'string',
-            rules: [{ required: true, message: '蹇呭~'}],
-            blur: (col) => {
-              this.handleTrim(col)
-            }
+            dataType: 'string'
           },
           {
             label: '闆剁粍浠跺彿',
@@ -144,7 +155,7 @@
               this.handleTrim(col)
             },
           },
-          {
+          /*{
             label: '鍔犲伐鏈哄簥',
             prop: 'machineCode',
             type: 'select',
@@ -159,6 +170,14 @@
               label: 'code',
               value: 'code',
             },
+            span: 12
+          },*/
+          {
+            label: '鍔犲伐鏈哄簥',
+            prop: 'machineCode',
+            type: 'select',
+            rules: [{ required: true, message: '蹇呭~', trigger: 'blur' }],
+            
             span: 12
           },
           {
@@ -189,6 +208,7 @@
             type: 'input',
             span: 12,
             dataType: 'string',
+            class:'input_holder_warn',
             placeholder:'闈炲亸绂诲崟浠诲姟璇风暀绌�',
             blur: (col) => {
               this.handleTrim(col)
@@ -197,10 +217,57 @@
           }
         ],
       },
-      attachForm: {planLockDays:7},//榛樿7澶�
+      attachForm: {planLockDays:7,planStartTime: this.$dayjs().format('YYYY-MM-DD')},//榛樿7澶�
+      defaultForm: {planLockDays:7,planStartTime: this.$dayjs().format('YYYY-MM-DD')},
     };
   },
   methods: {
+    treeLoad () {
+      axios({
+        url: '/blade-mdm/gkw/node/load-tree',
+        method: 'get',
+      }).then(
+        res => {
+          this.treeData = this.filterTreeData(res.data.data);
+          var firstIndex = 0;
+          res.data.data.forEach((item,index)=> {
+            if(item.children.length != 0) {
+              firstIndex = index;
+            }
+          })
+          //defaultKeys.push(item.id);
+          this.defaultKeys = [res.data.data[firstIndex].id];
+        }
+      )
+    },
+    filterTreeData(oriTreeData){
+      var roots = [];
+      for(var i=0;i<oriTreeData.length;i++){
+        roots.push(this.filterTreeNodes(oriTreeData[i]));
+      }
+      return roots;
+    },
+    filterTreeNodes(node) {
+      // 濡傛灉褰撳墠鑺傜偣鐨刵odeType鏄�'machine'锛屽垯娓呴櫎鍏跺瓙鑺傜偣
+      if (node.nodeType === 'machine') {
+          // 鍒涘缓涓�涓柊瀵硅薄锛屽鍒跺綋鍓嶈妭鐐圭殑灞炴�э紝浣嗘竻闄hildren
+          return {
+              ...node,
+              children: []
+          };
+      }
+      
+      // 濡傛灉褰撳墠鑺傜偣鏈夊瓙鑺傜偣锛岄�掑綊澶勭悊姣忎釜瀛愯妭鐐�
+      if (node.children && node.children.length > 0) {
+          return {
+              ...node,
+              children: node.children.map(child => this.filterTreeNodes(child))
+          };
+      }
+      
+      // 濡傛灉鏃笉鏄痬achine鑺傜偣涔熸病鏈夊瓙鑺傜偣锛岀洿鎺ヨ繑鍥炲師鑺傜偣
+      return node;
+    },
     
     handleTrim(col){
       //console.log(col)
@@ -216,23 +283,31 @@
     },
     formSubmit(form, done) {
       var form = { ...form };
+      /*
       this.machineCodeList.forEach(item => {
         if (form.machineCode == item.code) {
           form.machineMode = item.name;
         }
       })
-
+      */
       axios({
         url: '/blade-mdm/flow/dispatch/start',
         method: 'post',
         data: form,
       }).then(
         res => {
-          this.$message({
-            type: 'success',
-            message: '鎿嶄綔鎴愬姛!',
-          });
-          this.$refs.form.resetForm();
+          
+          if(res.data.code == 200){
+            this.$message({
+              type: 'success',
+              message: '鎿嶄綔鎴愬姛!',
+            });
+            this.$refs.form.resetForm();
+            this.attachForm = this.defaultForm;
+            
+          }else{
+            this.$alert(res.data.msg, '鍙戣捣浠诲姟澶辫触',{type:'error',confirmButtonText:'鍏抽棴'});
+          }
           done();
         },
         error => {
@@ -264,7 +339,18 @@
         }
     }
   },
+
+  mounted() {
+    this.treeLoad();
+  },
 };
 </script>
 
-<style lang="scss"></style>
+<style lang="scss">
+.input_holder_warn {
+  .el-input__inner::placeholder {
+  color: rgb(255, 106, 0); /* 璁剧疆棰滆壊涓虹孩鑹� */
+  font-size: 16px; /* 璁剧疆瀛椾綋澶у皬涓�16px */
+  }
+}
+</style>

--
Gitblit v1.9.3