From 5ac5fd23fe42935d00ea1fd24417e4309e312999 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期一, 16 十月 2023 17:46:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 Source/UBCS-WEB/src/views/code/Match.vue |  283 +++++++++++++++++++++++++++++++-------------------------
 1 files changed, 156 insertions(+), 127 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/code/Match.vue b/Source/UBCS-WEB/src/views/code/Match.vue
index bf67ba0..9a98bd2 100644
--- a/Source/UBCS-WEB/src/views/code/Match.vue
+++ b/Source/UBCS-WEB/src/views/code/Match.vue
@@ -1,106 +1,107 @@
 <template>
-<basic-container>
-  <avue-crud :option="option"
-             :table-loading="loading"
-             :data="data"
-             ref="crud"
-             v-model="form"
-             :page.sync="page"
-             @row-del="rowDel"
-             @row-update="rowUpdate"
-             @row-save="rowSave"
-             @selection-change="selectionChange"
-             @current-change="currentChange"
-             @size-change="sizeChange"
-             @refresh-change="refreshChange"
-             @on-load="onLoad">
-    <template slot="menuLeft">
-      <el-button type="primary"
-                 size="small"
-                 icon="el-icon-search"
-                 plain @click="searchHandler">鏌� 璇�
-      </el-button>
-      <advanced-query :options="options" :visible.sync="findvisible"
-                      @echoContion="echoContion"></advanced-query>
-      <el-button type="danger"
-                 size="small"
-                 icon="el-icon-delete"
-                 plain @click="deleteHandler">鍒� 闄�
-      </el-button>
-      <el-button type="success"
-                 size="small"
-                 icon="el-icon-edit"
-                 plain>淇� 鏀�
-      </el-button>
-      <el-button type="primary"
-                 size="small"
-                 icon="el-icon-refresh-right"
-                 plain>鍒� 鏂�
-      </el-button>
-    </template>
-  </avue-crud>
-</basic-container>
+  <basic-container>
+    <avue-crud ref="crud"
+               v-model="form"
+               :data="data"
+               :option="option"
+               :page.sync="page"
+               :table-loading="loading"
+               @row-del="rowDel"
+               @row-update="rowUpdate"
+               @row-save="rowSave"
+               @selection-change="selectionChange"
+               @current-change="currentChange"
+               @size-change="sizeChange"
+               @refresh-change="refreshChange"
+               @on-load="onLoad">
+      <template slot="menuLeft" slot-scope="scope">
+        <el-button icon="el-icon-search"
+                   plain
+                   size="small"
+                   type="primary" @click="searchHandler">鏌� 璇�
+        </el-button>
+        <advanced-query :options="options" :visible.sync="findvisible"
+                        @echoContion="echoContion"></advanced-query>
+        <el-button icon="el-icon-delete"
+                   plain
+                   size="small"
+                   type="danger" @click="deleteHandler">鍒� 闄�
+        </el-button>
+        <el-button icon="el-icon-edit"
+                   plain
+                   size="small"
+                   type="success" @click="editHandler">淇� 鏀�
+        </el-button>
+        <el-button icon="el-icon-refresh-right"
+                   plain
+                   size="small"
+                   type="primary" @click="onLoad">鍒� 鏂�
+        </el-button>
+      </template>
+    </avue-crud>
+  </basic-container>
 </template>
 
 <script>
-import {getList,add,editSave,deleteData} from "@/api/code/codeMatch";
+import {getList, add, editSave, deleteData} from "@/api/code/codeMatch";
+
 export default {
-name: "Match",
-  data(){
-    return{
+  name: "Match",
+  data() {
+    return {
       options: [
         {
-          fieid:'id',
-          title:'缂栧彿',
-          fieldType:'text',
-          queryField:'id'
+          fieid: 'id',
+          title: '缂栧彿',
+          fieldType: 'text',
+          queryField: 'id'
         },
         {
-          fieid:'name',
-          title:'鍚嶇О',
-          fieldType:'text',
-          queryField:'name'
+          fieid: 'name',
+          title: '鍚嶇О',
+          fieldType: 'text',
+          queryField: 'name'
         },
         {
-          fieid:'ignoreallspaceflag',
-          title:'蹇界暐鍏ㄩ儴绌烘牸',
-          fieldType:'truefalse',
-          queryField:'ignoreallspaceflag'
+          fieid: 'ignoreallspaceflag',
+          title: '蹇界暐鍏ㄩ儴绌烘牸',
+          fieldType: 'truefalse',
+          queryField: 'ignoreallspaceflag'
         },
         {
-          fieid:'ignorecaseflag',
-          title:'蹇界暐澶у皬鍐�',
-          fieldType:'truefalse',
-          queryField:'ignorecaseflag'
+          fieid: 'ignorecaseflag',
+          title: '蹇界暐澶у皬鍐�',
+          fieldType: 'truefalse',
+          queryField: 'ignorecaseflag'
         },
         {
-          fieid:'ignorespaceflag',
-          title:'蹇界暐绌烘牸',
-          fieldType:'truefalse',
-          queryField:'ignorespaceflag'
+          fieid: 'ignorespaceflag',
+          title: '蹇界暐绌烘牸',
+          fieldType: 'truefalse',
+          queryField: 'ignorespaceflag'
         },
         {
-          fieid:'ignorewidthflag',
-          title:'蹇界暐鍏ㄥ崐瑙�',
-          fieldType:'truefalse',
-          queryField:'ignorewidthflag'
+          fieid: 'ignorewidthflag',
+          title: '蹇界暐鍏ㄥ崐瑙�',
+          fieldType: 'truefalse',
+          queryField: 'ignorewidthflag'
         },
         {
-          fieid:'linkCharacter',
-          title:'蹇界暐杩炴帴瀛楃',
-          fieldType:'text',
-          queryField:'linkCharacter'
+          fieid: 'linkCharacter',
+          title: '蹇界暐杩炴帴瀛楃',
+          fieldType: 'text',
+          queryField: 'linkCharacter'
         },
       ],
-      findvisible:false,
-      selectRow:[],
-      option:{
-        height:700,
+      findvisible: false,
+      selectRow: [],
+      option: {
+        height: 700,
         calcHeight: 80,
         tip: false,
         searchShow: true,
         searchMenuSpan: 6,
-        columnBtn:false,
+        columnBtn: false,
         border: true,
         index: true,
         selection: true,
@@ -138,8 +139,8 @@
               label: '鏄�',
               value: 'true'
             }],
-            formatter:function(row){
-              return row.ignoreallspaceflag ==='true' ? '鏄�' : '鍚�'
+            formatter: function (row) {
+              return row.ignoreallspaceflag === 'true' ? '鏄�' : '鍚�'
             }
           },
           {
@@ -153,8 +154,8 @@
               label: '鏄�',
               value: 'true'
             }],
-            formatter:function(row){
-              return row.ignorecaseflag ==='true' ? '鏄�' : '鍚�'
+            formatter: function (row) {
+              return row.ignorecaseflag === 'true' ? '鏄�' : '鍚�'
             }
           },
           {
@@ -169,8 +170,8 @@
               label: '鏄�',
               value: 'true'
             }],
-            formatter:function(row){
-              return row.ignorespaceflag ==='true' ? '鏄�' : '鍚�'
+            formatter: function (row) {
+              return row.ignorespaceflag === 'true' ? '鏄�' : '鍚�'
             }
           },
           {
@@ -184,8 +185,8 @@
               label: '鏄�',
               value: 'true'
             }],
-            formatter:function(row){
-              return row.ignorewidthflag ==='true' ? '鏄�' : '鍚�'
+            formatter: function (row) {
+              return row.ignorewidthflag === 'true' ? '鏄�' : '鍚�'
             }
           },
           {
@@ -193,54 +194,79 @@
             prop: "linkCharacter",
             type: 'textarea',
             labelWidth: 100,
-            span:24
+            span: 24
 
           }
         ]
       },
-      loading:true,
-      data:[],
-      form:{},
+      loading: true,
+      data: [],
+      form: {},
       page: {
         pageSize: 10,
         currentPage: 1,
         total: 0
       },
-   }
+    }
   },
   created() {
     this.onLoad()
   },
-  methods:{
-    searchHandler(){
-      this.findvisible=true;
+  methods: {
+    searchHandler() {
+      this.findvisible = true;
     },
-    echoContion(row){
+    echoContion(val) {
+      console.log(...val)
+      // FindData({
+      //   templateOid: this.templateOid,
+      //   codeClassifyOid: this.codeClassifyOid,
+      //   ...val,
+      // }).then((res) => {
+      //   this.tableData = res.data.data;
+      //   this.page.total = res.data.total
+      // });
+    },
+    deleteHandler() {
+      const length = this.selectRow.length;
+      if (length > 1) {
+        this.$message.warning('鍙兘閫夋嫨涓�鏉℃暟鎹紒');
+        return;
+      }
+      if (length <= 0) {
+        this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�! ');
+        return;
+      }
+      this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
+        confirmButtonText: "纭畾",
+        cancelButtonText: "鍙栨秷",
+        type: "warning"
+      })
+        .then(() => {
+          return deleteData(this.selectRow[0])
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "鎿嶄綔鎴愬姛!"
+          });
+        });
 
     },
-    deleteHandler(){
-      if(this.selectRow.length <= 0){
-        this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�')
-      }else {
-        this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
-          confirmButtonText: "纭畾",
-          cancelButtonText: "鍙栨秷",
-          type: "warning"
-        })
-          .then(() => {
-            const Obj = [...this.selectRow];
-            return deleteData(item);
-          })
-          .then(() => {
-            this.onLoad(this.page);
-            this.$message({
-              type: "success",
-              message: "鎿嶄綔鎴愬姛!"
-            });
-          });
+    editHandler() {
+      const length = this.selectRow.length;
+      if (length > 1) {
+        this.$message.warning('鍙兘閫夋嫨涓�鏉℃暟鎹紒');
+        return;
       }
+      if (length <= 0) {
+        this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹�! ');
+        return;
+      }
+      this.$refs.crud.rowEdit(this.selectRow[0]);
     },
-    rowDel(row){
+    rowDel(row) {
       this.$confirm("纭畾灏嗛�夋嫨鏁版嵁鍒犻櫎?", {
         confirmButtonText: "纭畾",
         cancelButtonText: "鍙栨秷",
@@ -257,7 +283,7 @@
           });
         });
     },
-    rowUpdate(row, index, done, loading){
+    rowUpdate(row, index, done, loading) {
       console.log(row)
       editSave(row).then(() => {
         this.onLoad(this.page);
@@ -284,9 +310,9 @@
         loading();
       });
     },
-    selectionChange(row){
-      console.log(row)
-      this.selectRow=row;
+    selectionChange(row) {
+      // console.log(row)
+      this.selectRow = row;
     },
     currentChange(currentPage) {
       this.page.currentPage = currentPage;
@@ -295,15 +321,18 @@
       this.page.pageSize = pageSize;
     },
     refreshChange() {
-      this.onLoad( this.page.currentPage,this.page.pageSize);
+      this.onLoad(this.page.currentPage, this.page.pageSize);
     },
-    onLoad(page){
-      getList( this.page.currentPage,this.page.pageSize).then(res=>{
-        this.page.total = res.data.total;
-        this.data = res.data.data;
+    onLoad(page) {
+      this.loading = true;
+      getList(this.page.currentPage, this.page.pageSize).then(res => {
+        if (res.data && res.data.data.length > 0) {
+          this.page.total = res.data.total;
+          this.data = res.data.data;
+        }
         this.loading = false;
-      })
-    },
+      });
+    }
   }
 }
 </script>

--
Gitblit v1.9.3