From dd2cbe9c6f7360d0f50da4e5f0fc506ad3915d8b Mon Sep 17 00:00:00 2001
From: lihang <lihang@vci-tech.com>
Date: 星期一, 10 七月 2023 18:04:43 +0800
Subject: [PATCH] 业务类型修改功能修正

---
 Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue |   87 ++++++++++++++++++++++++++++++-------------
 1 files changed, 60 insertions(+), 27 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
index d61723b..3a057e4 100644
--- a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
+++ b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
@@ -1,5 +1,5 @@
 <template>
-    <el-dialog 
+    <el-dialog
     title="涓氬姟绫诲瀷"
     :visible.sync="showSubmitDialog"
     append-to-body
@@ -43,26 +43,28 @@
             </el-form-item>
         </div>
             <el-form-item label="鎻忚堪" label-width="100px" class="description">
-                <el-input v-model="btmType.description" 
-                :prefix-icon="icons.desc" 
+                <el-input v-model="btmType.description"
+                :prefix-icon="icons.desc"
                 class="descClass"
                 id="descId"
                 ></el-input>
             </el-form-item>
         </el-form>
-        <avue-crud :option="option" 
-        :data="btmType.attributes" 
-        :page.sync="page" 
-        ref="attrTable"
-        @cell-mouse-enter="cellEditClick"
-        @cell-mouse-leave="cellEditSave">
+        <avue-crud :option="option"
+        :data="btmType.attributes"
+        :page.sync="page"
+        ref="attrTable">
             <template slot-scope="scope" slot="menuLeft">
                 <el-button type="danger"
                 icon="el-icon-plus"
                 size="small"
                 @click="rowAdd()">灞炴�ч�夋嫨</el-button>
             </template>
-            
+          <template slot="menu" slot-scope="{row,index}">
+            <el-button icon="el-icon-edit" size="small" type="text" v-if="!row.$cellEdit" @click="cellEditClick(row)">缂栬緫</el-button>
+            <el-button icon="el-icon-delete" size="small" type="text" v-if="!row.$cellEdit" @click="removeFormAttrTable(row,index)">绉婚櫎</el-button>
+            <el-button icon="el-icon-check" size="small" type="text" v-if="row.$cellEdit" @click="cellEditSave(row,index)">淇濆瓨</el-button>
+          </template>
         </avue-crud>
         <div slot="footer" class="dialog-footer">
             <el-button type="primary" @click="submitBtmType">纭畾</el-button>
@@ -76,14 +78,15 @@
             @close="closeAttrDialog"
             width="80%"
         >
-            <avue-crud class="attrRef" 
-            :option="attrRef.option" 
-            :data="attrRef.data" 
+            <avue-crud class="attrRef"
+            :option="attrRef.option"
+            :data="attrRef.data"
             :page.sync="attrRef.page"
             ref="attrRef"
             @on-load="attrRefOnLoad"
             @search-change="attrRefSearch"
-            @selection-change="selectionChange">
+            @selection-change="selectionChange"
+            v-loading="attrRef.loading">
                 <template slot="typeValue" slot-scope="scope" >
                     <el-tag>{{scope.row.typeValue}}</el-tag>
                 </template>
@@ -98,7 +101,7 @@
             :visible.sync="revisionRef.visible"
             append-to-body
             width="80%">
-            
+
             <avue-crud class="revisionRef"
              :option="revisionRef.option"
              :data="revisionRef.data"
@@ -145,13 +148,16 @@
             showSubmitDialog : false,
             option: {
                 height: "330px",
-                selection: true,
+                selection: false,
                 headerAlign: 'center',
                 border: true,
                 index: true,
                 rowKey: 'id',
                 tabs: true,
-                menu: false,
+                menu: true,
+                editBtn: false,
+                delBtn: false,
+                menuWidth: 150,
                 addBtn:false,
                 highlightCurrentRow: true,
                 column: [
@@ -191,6 +197,7 @@
                     currentPage:1,
                     pageSize:10,
                 },
+                loading: false,
                 key: null,
                 option:{
                     height: 360,
@@ -203,6 +210,7 @@
                     reserveSelection: true,
                     searchMenuSpan:8,
                     highlightCurrentRow: true,
+                    rowKey: 'id',
                     column: [
                         {
                         label: '鑻辨枃鍚嶇О',
@@ -250,7 +258,7 @@
                     ]
                 },
                 data: [],
-                queryNotIn: null
+                queryNotIn: ''
             },
             revisionRef: {
                 visible: false,
@@ -319,7 +327,7 @@
                 id: [
                     { required: true, message: '璇疯緭鍏ヤ笟鍔$被鍨嬬紪鍙�', trigger: 'blur' },
                     { pattern: /^[A-Za-z]+$/, message: '涓氬姟绫诲瀷缂栧彿鍙兘涓鸿嫳鏂�', trigger: 'blur' },
-                    { min: 2, max: 15, message: '闀垮害鍦�2鍒�15涓瓧绗�', trigger: 'blur' }
+                    { min: 2, max: 20, message: '闀垮害鍦�2鍒�20涓瓧绗�', trigger: 'blur' }
                 ],
                 domain: [
                     { required: true, message: '璇烽�夋嫨鎵�灞為鍩�', trigger: 'blur' }
@@ -344,28 +352,46 @@
         closeAttrDialog(){
             this.attrRef.visible = false;
         },
-        // 娣诲姞
-        rowAdd(){
+        // 灞炴�ч�夋嫨娣诲姞
+        async rowAdd() {
+            await this.attrRefOnLoad();
             this.attrRef.visible = true;
-            this.attrRefOnLoad();
         },
         // 灞炴�ф睜鍔犺浇
         attrRefOnLoad(){
+            if (!this.attrRef.queryNotIn || (this.attrRef.queryNotIn === '' && this.btmType.attributes !== [])){
+              this.attrRef.queryNotIn = '';
+               this.btmType.attributes.forEach(item => {
+                  this.attrRef.queryNotIn += (item.id + ",")
+               })
+            }
+            this.attrRef.loading = true;
             queryPage(this.attrRef.key,this.attrRef.queryNotIn,this.attrRef.page.currentPage, this.attrRef.page.pageSize).then(res => {
                 const data = res.data.data;
                 this.attrRef.page.total = data.total;
                 this.attrRef.data = data.records;
             });
+            setTimeout(() => {
+              this.attrRef.loading = false;
+            },600)
             this.$nextTick(() => {
                 this.$refs.attrRef.refreshTable();
             });
         },
         // 灞炴�ф睜妫�绱�
         attrRefSearch(form,done){
-            this.attrRef.key = form.key;
+            this.attrRef.key = form.id;
             this.attrRefOnLoad();
             done();
             this.attrRef.key = null;
+        },
+        // 浠庡睘鎬ф睜涓Щ闄�
+        removeFormAttrTable(row,index){
+          this.btmType.attributes.splice(index,1);
+          this.attrRef.queryNotIn = "";
+          this.btmType.attributes.forEach(item => {
+            this.attrRef.queryNotIn += (item.id + ",")
+          })
         },
         // 灞炴�ф睜鍕鹃�変簨浠�
         selectionChange(list){
@@ -373,8 +399,9 @@
         },
         // 纭灞炴�ф睜鍕鹃��
         confirmSelectAttr(){
-            this.btmType.attributes = [];
-            this.attrRef.queryNotIn = "";
+            if(!this.btmType.attributes) {
+              this.btmType.attributes = [];
+            }
             this.attrRef.selectData.forEach(item => {
                 this.btmType.attributes.push({
                     id: item.id,
@@ -384,10 +411,15 @@
                     attrDataType : item.typeKey,
                     defaultValue: item.defaultValue,
                     description: item.description,
-                    attributeLength: item.maxLength
+                    attributeLength: item.maxLength,
+                    referBtmTypeId: item.referTypeCode,
+                    referBtmTypeName: item.referToName,
+                    enumId: item.dictCode,
+                    // enumName: item,
                 });
                 this.attrRef.queryNotIn += (item.id + ",")
             });
+            this.attrRef.data = [];
             this.closeAttrDialog();
         },
         // 鍙栨秷灞炴�ф睜鍕鹃��
@@ -417,12 +449,13 @@
                 this.$refs.attrTable.refreshTable();
             })
         },
-        // 
+        //
         viewChange(){
 
         },
         // 鍒楄〃缂栬緫
         cellEditClick(cell){
+          console.log(cell);
             cell.$cellEdit = true;
         },
         // 鍒楄〃缂栬緫淇濆瓨

--
Gitblit v1.9.3