From e3410e9cdb22cfea4e46537d34db303612411e93 Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期日, 21 五月 2023 23:22:45 +0800
Subject: [PATCH] 代码整合

---
 Source/UBCS-WEB/src/components/Tree/classifyTrees.vue |  225 ++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 195 insertions(+), 30 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/Tree/classifyTrees.vue b/Source/UBCS-WEB/src/components/Tree/classifyTrees.vue
index d522692..a867a7d 100644
--- a/Source/UBCS-WEB/src/components/Tree/classifyTrees.vue
+++ b/Source/UBCS-WEB/src/components/Tree/classifyTrees.vue
@@ -1,3 +1,4 @@
+<!--suppress ALL -->
 <template>
   <el-container>
     <!--    宸︿晶鑿滃崟-->
@@ -70,16 +71,43 @@
         <avue-tabs :option="tabOption" @change="handleChange"></avue-tabs>
         <span v-if="type.prop==='tab1'">
           <basic-container>
-               <avue-crud v-model="crudForm" :data="this.Formlist" :option="this.crudTreeOption" v-loading="FormLoing"
+               <avue-crud v-model="crudForm" v-loading="FormLoing" :data="this.Formlist" :option="this.crudTreeOption"
+                          @row-save="CrudRowSave"
+                          @row-del="CrudRowDel"
+                          @row-update="CrudRowUpdata"
                >
             <template slot="menuLeft">
-              <el-button plain size="small" type="primary">鏌ヨ</el-button>
+              <el-button plain size="small" type="primary" @click="FindFormVisible = true;">鏌ヨ</el-button>
               <el-button plain size="small" type="primary" @click="TemRefresh">鍒锋柊</el-button>
               <el-button plain size="small" type="primary">浠庡叾瀹冩ā鏉垮厠闅�</el-button>
               <div style="display: inline-block"> <el-input v-model="FindText" placeholder="璇疯緭鍏ュ叧閿瓧鎸夊洖杞︽煡璇�"
                                                             size="small"
                                                             @keyup.enter.native="EnterFind"></el-input></div>
-
+           <el-dialog :visible.sync="FindFormVisible" append-to-body title="楂樼骇鏌ヨ">
+              <div>
+                <el-button size="small" type="primary" @click="AdvQueries">鏌ヨ</el-button>
+                <el-button size="small" type="primary">閲嶇疆</el-button>
+              </div>
+             <div style="padding-left: 80px;margin-top: 15px;">
+               <template v-for="(value, key) in FindSelect">
+                <div style="display: flex;justify-content: space-around;width: 85%;margin-bottom: 15px">
+                <el-select v-model="FindSelect[key]" placeholder="璇烽�夋嫨" style="width: 28%" @change="handleSelectChange(key)">
+                  <el-option label="妯℃澘缂栧彿" value="0"></el-option>
+                  <el-option label="妯℃澘鍚嶇О" value="1"></el-option>
+                  <el-option label="妯℃澘鎻忚堪" value="2"></el-option>
+                  <el-option label="鐗堟湰鍙�" value="3"></el-option>
+                  <el-option label="鐘舵��" value="4"></el-option>
+                 </el-select>
+                <el-select v-model="condition[0]" placeholder="璇烽�夋嫨" style="width: 15%">
+                  <el-option label="鍖呭惈" value="0"></el-option>
+                  <el-option label="绛変簬" value="1"></el-option>
+                </el-select>
+              <el-input v-model="QueryArray[key]" style="width: 49%"></el-input>
+          <span> <i class="el-icon-delete" style="font-size: 22px;margin-top:8px;margin-left: 10px"/></span>
+    </div>
+  </template>
+</div>
+           </el-dialog>
             </template>
           </avue-crud>
           </basic-container>
@@ -108,7 +136,11 @@
   importClassify,
   gridCodeClassifyTemplate,
   getObjectByOid,
-  gridCodeClassifyTemplateAttr
+  gridCodeClassifyTemplateAttr,
+  gridCodeClassifyFindTemplate,
+  addSave,
+  deleteData,
+  editSave
 } from "@/api/template/templateAttr";
 
 export default {
@@ -119,9 +151,33 @@
   inject: ['crudTreeOption', "crudTreeData"],
   data() {
     return {
+      //妯℃澘灞炴�у睍绀哄唴瀹�
       ProData: [],
+      //鍥炶溅閿悳绱㈢粦瀹氬��
       FindText: "",
-      fileList: [],
+      //楂樼骇鏌ヨ瀵硅瘽妗�
+      FindFormVisible: false,
+      //楂樼骇鏌ヨ涓嬫媺妗�
+      FindSelect: {
+        id: "0",
+        name: "1",
+        description: "2",
+        revisionValue: "3",
+        lcStatus: "4"
+      },
+      //楂樼骇鏌ヨ鏉′欢
+      condition: ["0", "0", "0", "0", "0"],
+      //楂樼骇鏌ヨ 绛変簬/涓嶇瓑浜�
+      Equalto: "0",
+      //楂樼骇鏌ヨ 杈撳叆妗嗘暟鎹�
+      QueryArray: {
+        id: "",
+        name: "",
+        description: "",
+        revisionValue: "",
+        lcStatus: ""
+      },
+      //鍋滅敤鍚敤鎺ユ敹鏁扮粍
       FlagObj: {},
       //淇敼瀵硅瘽妗�
       TreeEditFormVisible: false,
@@ -133,7 +189,7 @@
       TreeFlag: false,
       //鏍戝姞杞�
       loading: false,
-      FormLoing:false,
+      FormLoing: false,
       TreeAddform: {
         id: "",
         name: "",
@@ -191,7 +247,7 @@
       ],
       //浼犻�掔粰瀛愮粍浠跺姩鎬佹覆鏌撶殑鏁版嵁
       TreeList: {},
-      //瀹氫箟涓�涓ā鏉垮睘鎬d锛屾暟鎹槸妯℃澘绠$悊琛ㄦ牸閲岄潰鐨刼id
+      codeClassifyOid:""
     }
   },
   //tab鏍忛粯璁ゆ槸琛ㄦ牸
@@ -215,7 +271,7 @@
         this.$message.error(res)
       })
     },
-    //瀹氫箟涓�涓慨鏀瑰璞″睘鎬у悕鐨勬柟娉�
+    //瀹氫箟涓�涓慨鏀瑰璞″睘鎬у悕鐨勬柟娉� 杩欓噷鍒敼锛侊紒锛佸ソ鍍忔槸鍚庡彴鎺ュ彛鏁版嵁瀛楁涓嶄竴鑷达紝娣诲姞鐨勬柟娉曘�傚叿浣撲粈涔堝師鍥犳垜涔熷繕璁颁簡
     ModifyProperties(obj, oldName, newName) {
       for (let key in obj) {
         if (key === oldName) {
@@ -388,10 +444,11 @@
         });
       }
     },
+    //鏍戠偣鍑讳簨浠�
     async nodeClick(data) {
       //瀹氫箟涓�涓ā鏉垮睘鎬d锛屾暟鎹槸妯℃澘绠$悊琛ㄦ牸閲岄潰鐨刼id
       this.nodeClickList = data
-      console.log(data.oid)
+      //console.log(data.oid)
       try {
         await TreeObjcet(data.oid).then(res => {
           this.FlagObj = res.data.data
@@ -399,11 +456,12 @@
           this.$message.error(res)
         })
         //妯℃澘绠$悊琛ㄦ牸鏁版嵁
-        await gridCodeClassifyTemplate(data.oid).then(res => {
+        await gridCodeClassifyTemplate({'conditionMap[codeClassifyOid]':data.oid }).then(res => {
           this.Formlist = res.data.data.filter(item => {
-          if(item.codeclassifyoid != ""){
-            return  item.codeclassifyoid == this.nodeClickList.oid
-          }
+            if (item.codeclassifyoid != "") {
+              this.codeClassifyOid=item.codeclassifyoid
+              return item.codeclassifyoid == this.nodeClickList.oid
+            }
           })
           console.log("formlist", this.Formlist)
           gridCodeClassifyTemplateAttr({'conditionMap[classifyTemplateOid]': this.Formlist[0].oid}).then(res => {
@@ -413,7 +471,7 @@
             this.$message.error(res)
           })
         }).catch(res => {
-              console.log(res)
+          console.log(res)
         })
         //  鍩烘湰淇℃伅琛ㄥ崟鏁版嵁
         await getObjectByOid(this.nodeClickList.oid).then(res => {
@@ -430,6 +488,114 @@
     handleChange(column) {
       this.type = column
     },
+    // //楂樼骇鏌ヨ鎸夐挳
+    // handleSelectChange(key) {
+    //   const selectedValue = this.FindSelect[key];
+    //   console.log(selectedValue)
+    //   console.log(this.QueryArray[0])
+    //   switch (this.FindSelect[key]) {
+    //     case '0':
+    //       this.QueryArray[key] = '';
+    //       this.$set(this.QueryArray, key, '');
+    //       // 濡傛灉閫変腑鐨勬槸妯℃澘缂栧彿锛岀浉搴旂殑杈撳叆妗嗗弻鍚戠粦瀹氬叧绯讳负 QueryArray.id
+    //       this.$set(this.QueryArray, 'id', this.QueryArray[key]);
+    //       break;
+    //     case '1':
+    //       this.QueryArray[key] = '';
+    //       this.$set(this.QueryArray, key, '');
+    //       // 濡傛灉閫変腑鐨勬槸妯℃澘鍚嶇О锛岀浉搴旂殑杈撳叆妗嗗弻鍚戠粦瀹氬叧绯讳负 QueryArray.name
+    //       this.$set(this.QueryArray, 'name', this.QueryArray[key]);
+    //       break;
+    //     case '2':
+    //       this.QueryArray[key] = '';
+    //       this.$set(this.QueryArray, key, '');
+    //       // 濡傛灉閫変腑鐨勬槸妯℃澘鎻忚堪锛岀浉搴旂殑杈撳叆妗嗗弻鍚戠粦瀹氬叧绯讳负 QueryArray.description
+    //       this.$set(this.QueryArray, 'description', this.QueryArray[key]);
+    //       break;
+    //     case '3':
+    //       this.QueryArray[key] = '';
+    //       this.$set(this.QueryArray, key, '');
+    //       // 濡傛灉閫変腑鐨勬槸鐗堟湰鍙凤紝鐩稿簲鐨勮緭鍏ユ鍙屽悜缁戝畾鍏崇郴涓� QueryArray.revisionValue
+    //       this.$set(this.QueryArray, 'revisionValue', this.QueryArray[key]);
+    //       break;
+    //     case '4':
+    //       this.QueryArray[key] = '';
+    //       this.$set(this.QueryArray, key, '');
+    //       // 濡傛灉閫変腑鐨勬槸鐘舵�侊紝鐩稿簲鐨勮緭鍏ユ鍙屽悜缁戝畾鍏崇郴涓� QueryArray.lcStatus
+    //       this.$set(this.QueryArray, 'lcStatus', this.QueryArray[key]);
+    //       break;
+    //   }
+    // },
+    AdvQueries() {
+      this.FindFormVisible = false
+      //濡傛灉鍏ㄩ儴涓虹┖ allEmpty涓簍rue
+      const allEmpty = Object.values(this.QueryArray).every(value => !value);
+      //濡傛灉鍏ㄩ儴涓虹┖锛岀偣鍑绘煡璇㈠嚭鐜版墍鏈夋暟鎹�
+      if (allEmpty) {
+        gridCodeClassifyTemplate().then(res => {
+          this.Formlist = res.data.data
+        })
+      } else {
+        //榛樿鏄瓑浜�
+        gridCodeClassifyFindTemplate({'conditionMap[id]': this.QueryArray.id},
+          {'conditionMap[name]': this.QueryArray.name},
+          {'conditionMap[description]': this.QueryArray.description},
+          {'conditionMap[revisionValue]': this.QueryArray.revisionValue},
+          {'conditionMap[lcStatus]': this.QueryArray.lcStatus}
+        ).then(res => {
+          this.Formlist = res.data.data
+        })
+      }
+    },
+    //妯℃澘绠$悊娓叉煋
+    CrudRend(){
+      gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]':this.nodeClickList.oid }).then(res=>{
+        this.Formlist = res.data.data
+      })
+    },
+    //妯℃澘绠$悊琛ㄦ牸娣诲姞
+    CrudRowSave(row){
+      if(this.nodeClickList.length <= 0){
+        this.$message({
+          type: 'warning',
+          message: '璇峰厛浠庢爲涓婇�夋嫨涓�鏉℃暟鎹�!'
+        });
+      }else {
+        console.log(this.nodeClickList)
+        let codeClassifyOid=this.codeClassifyOid
+        this.$set(row,"codeclassifyoid",codeClassifyOid)
+        addSave(row).then(res=>{
+          this.CrudRend()
+        }).catch(res=>{
+          this.$message({
+            type: 'info',
+            message: res
+          });
+        })
+      }
+    },
+    //妯℃澘绠$悊淇敼
+    CrudRowUpdata(row){
+      editSave(row).then(()=>{
+        this.CrudRend()
+      }).catch(res=>{
+        this.$message({
+          type: 'info',
+          message: res
+        });
+      })
+    },
+    //妯℃澘绠$悊鍒犻櫎
+    CrudRowDel(row){
+      deleteData(row).then(res=>{
+        this.CrudRend()
+      }).catch(res=>{
+        this.$message({
+          type: 'info',
+          message: res
+        });
+      })
+    },
     //妯℃澘绠$悊琛ㄦ牸鏌ヨ
     EnterFind() {
       console.log(this.Formlist)
@@ -439,27 +605,26 @@
         })
       } else {
         gridCodeClassifyTemplate().then(res => {
-            this.Formlist = res.data.data.filter(item => {
-                  return item.name.includes(this.FindText)
-              }
-            )
-          }
-        )
-      }
-    },
-    TemRefresh(){
-      this.FormLoing=true
-      if(this.nodeClickList.oid != ""){
-        gridCodeClassifyTemplate(this.nodeClickList.oid).then(res=>{
           this.Formlist = res.data.data.filter(item => {
-            return  item.codeclassifyoid == this.nodeClickList.oid
+            return item.name.includes(this.FindText)
           })
         })
-      }else {
-        this.FormLoing=true
+      }
+    },
+    //鍒锋柊
+    TemRefresh() {
+      this.FormLoing = true
+      if (this.nodeClickList.oid != "") {
+        gridCodeClassifyTemplate({'conditionMap[codeclassifyoid]':this.nodeClickList.oid}).then(res => {
+          this.Formlist = res.data.data.filter(item => {
+            return item.codeclassifyoid == this.nodeClickList.oid
+          })
+        })
+      } else {
+        this.FormLoing = true
       }
       setTimeout(() => {
-        this.FormLoing=false
+        this.FormLoing = false
       }, 600);
     },
     // 宸︽爲澶氶��

--
Gitblit v1.9.3