From dc3531814c2cfbf6d42065972abd5278e9afa086 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期一, 04 十二月 2023 10:12:22 +0800
Subject: [PATCH] 规则基础配置模块优化修改+删除

---
 Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue |   67 ++++++++++++++++++++++++++++-----
 1 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue b/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue
index fe196c6..9b0b88e 100644
--- a/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue
+++ b/Source/UBCS-WEB/src/views/ruleBasic/prefixConfig.vue
@@ -101,14 +101,30 @@
       </el-table>
     </el-main>
     <el-footer>
-      <div style="width: 260px; display: flex; align-items: center;margin-top: 5px">
+      <div style="width: 460px; display: flex; align-items: center;margin-top: 5px">
         <p>鍊硷細</p>
-        <el-input v-model="characterValue" size="small" style="flex: 1;"></el-input>
+        <el-input v-model="characterValue" size="small" style="flex: 1; display: flex;">
+          <template slot="prefix">
+            <div style="display: flex; align-items: center;height: 100%;text-align: center;margin-left: 5px">
+              <el-tag v-for="(item,index) in this.editValueList" :key="index" closable size="small"
+                      @close="handleClose(item,index)">
+                {{ item }}
+              </el-tag>
+            </div>
+          </template>
+        </el-input>
       </div>
     </el-footer>
+    <el-dialog :visible.sync="editVisble" append-to-body title="淇敼鍙敤瀛楃" width="40%">
+      <el-input v-model="characterValue" size="small"></el-input>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="editVisble = false">鍙� 娑�</el-button>
+        <el-button type="primary" @click="editSaveHandler">纭� 瀹�</el-button>
+  </span>
+    </el-dialog>
     <div style="margin-bottom: 10px;text-align: center">
       <el-button icon="el-icon-plus" plain size="small" type="success" @click="addSaveHandler">娣诲姞</el-button>
-      <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editSaveHandler">淇敼</el-button>
+      <el-button icon="el-icon-edit" plain size="small" type="primary" @click="editDialog">淇敼</el-button>
       <el-button icon="el-icon-delete" plain size="small" type="danger" @click="delSaveHandler">鍒犻櫎</el-button>
     </div>
   </basic-container>
@@ -119,10 +135,11 @@
 import {gridCodeRule} from "@/api/code/codeCharcter"
 
 export default {
-  name: "prefixConfig",
+  name: "usableCharacter",
   data() {
     return {
       loading: false,
+      editValueList: [],
       //涓嬫媺妗嗘暟缁�
       queryReleasedList: [],
       //涓嬫媺妗嗗垵濮嬫暟鎹暟缁�
@@ -131,7 +148,8 @@
       characterEditOldValue: "",
       tableData: [],
       select: "",
-      selectValue: ""
+      selectValue: "",
+      editVisble: false
     }
   },
   watch: {
@@ -145,9 +163,32 @@
     this.getCodeRule();
   },
   methods: {
+    editDialog(){
+      if(this.editValueList.length > 1){
+        this.$message.warning('鍙兘閫夋嫨涓�鏉℃暟鎹紒');
+        return;
+      }
+      if(this.editValueList.length === 0){
+        this.$message.warning('璇烽�夋嫨涓�鏉℃暟鎹紒');
+        return;
+      }
+      this.editVisble = true;
+    },
+    handleClose(tag, index) {
+      this.$delete(this.editValueList, index);
+      if (this.editValueList.length === 0) {
+        this.characterValue = "";
+        return;
+      }
+    },
     cellClickHandler(row, column) {
       this.characterValue = row[column.property];
-      this.characterEditOldValue = row[column.property]
+      this.characterEditOldValue = row[column.property];
+      if (this.editValueList.includes(row[column.property])) {
+        this.$message.warning('璇锋鏌ュ瓧绗﹂泦鏄惁鏈夐噸澶嶏紒')
+      } else {
+        this.editValueList.push(row[column.property]);
+      }
     },
     async getCodeRule() {
       try {
@@ -160,14 +201,12 @@
         const res2 = await getList({codeRuleId: this.select, chartType: "prefix", chartValue: this.characterValue});
         this.tableData = res2.data.data;
         this.loading = false;
-        // console.log("this.tableData", this.tableData);
       } catch (error) {
         this.$message.warning(error)
       }
     },
     //缂栫爜瑙勫垯涓嬫媺妗嗘悳绱�
     filterValue(query) {
-      console.log(query)
       if (query !== "") {
         this.queryReleasedList = this.characterReleasedList.filter(item => {
           return item.name.includes(query.toString());
@@ -196,12 +235,14 @@
         this.$message.warning('璇峰~鍐欒娣诲姞鐨勫�硷紒');
         return; // 鍒ゆ柇杈撳叆鍊�
       }
-
+      if (this.editValueList.length != 0) {
+        this.$message.warning('璇峰厛鍙栨秷宸查�夋嫨鐨勫�硷紒');
+        return; // 鍒ゆ柇杈撳叆鍊�
+      }
       const targetObject = this.characterReleasedList.find(obj => obj.oid === this.select);
       if (!targetObject) {
         return; // 鏌ユ壘瀵瑰簲typeText
       }
-
       const codeRuleCharacterVO = {
         codeRuleId: this.select,
         chartType: "prefix",
@@ -246,6 +287,8 @@
         .then(res => {
           this.$message.success(res.data.msg);
           this.characterValue = "";
+          this.editVisble = false;
+          this.editValueList = [];
           this.getTableData();
         }).catch(error => {
         this.$message.error('淇敼澶辫触');
@@ -262,16 +305,18 @@
       if (!targetObject) {
         return; // 鏌ユ壘瀵瑰簲typeText
       }
+      const value = this.editValueList.join("");
       const codeRuleCharacterVO = {
         codeRuleId: this.select,
         chartType: "prefix",
-        chartValue: this.characterValue,
+        chartValue: value,
         chartTypeText: targetObject.name
       };
 
       deleteSave(codeRuleCharacterVO)
         .then(res => {
           this.$message.success(res.data.msg);
+          this.editValueList = [];
           this.characterValue = "";
           this.getTableData();
         }).catch(error => {

--
Gitblit v1.9.3