From ca6ec80da1bffc13e67b2ce5e34ff67f485cc74f Mon Sep 17 00:00:00 2001
From: lihang <lihang@vci-tech.com>
Date: 星期二, 16 五月 2023 17:51:56 +0800
Subject: [PATCH] 业务类型新增按钮联调修正。 业务类型弹出表单细节修正。

---
 Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue |  156 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 110 insertions(+), 46 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
index c56390b..946768b 100644
--- a/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
+++ b/Source/UBCS-WEB/src/views/modeling/BusinessAdd.vue
@@ -6,42 +6,54 @@
     @close="closeSubmitDialog"
     width="74%"
     >
-        <el-form ref="form" :model="btmType" show-message="true" inline>
-            <el-form-item label="鑻辨枃鍚嶇О:" label-width="100px">
+        <el-form ref="form" :model="btmType" show-message="true" inline size="medium" label-suffix=":" class="btmTypeForm">
+                
+            <el-form-item label="鑻辨枃鍚嶇О" label-width="100px" required="true">
                 <el-input v-model="btmType.id" :prefix-icon="icons.key"></el-input>
             </el-form-item>
-            <el-form-item label="涓枃鍚嶇О:" label-width="100px">
+            <el-form-item label="涓枃鍚嶇О" label-width="100px">
                 <el-input v-model="btmType.name" :prefix-icon="icons.name"></el-input>
             </el-form-item>
-            <el-form-item label="鏁版嵁搴撹〃鍚�:" label-width="100px">
+            <el-form-item label="鏁版嵁搴撹〃鍚�" label-width="100px">
                 <el-input v-model="btmType.tableName" :prefix-icon="icons.tableName"></el-input>
             </el-form-item>
-            <el-form-item label="鎵�灞為鍩�:" label-width="100px">
+            <el-form-item label="鎵�灞為鍩�" label-width="100px">
                 <el-select v-model="btmType.domain" :prefix-icon="icons.domain">
                     <el-option v-for="item in domainOption"
-                    :label="item"></el-option>
+                    :label="item.label" :value="item.value" :key="item.value"></el-option>
                 </el-select>
             </el-form-item>
-            <el-form-item label="鐗堟湰瑙勫垯:" label-width="100px">
-                <el-input v-model="btmType.revisionRuleId" :prefix-icon="icons.revisionRule">
+            <el-form-item label="鐗堟湰瑙勫垯" label-width="100px">
+                <el-input v-model="btmType.revisionRuleId" :prefix-icon="icons.revisionRule" class="revisionRule">
                     <i slot="suffix" class="el-input__icon el-icon-search"></i>
                 </el-input>
             </el-form-item>
-            <el-form-item label="鐢熷懡鍛ㄦ湡:" label-width="100px">
+            <el-form-item label="鐢熷懡鍛ㄦ湡" label-width="100px">
                 <el-input v-model="btmType.lifeCycleId" :prefix-icon="icons.lifeCycle">
                     <i slot="suffix" class="el-input__icon el-icon-search"></i>
                 </el-input>
             </el-form-item>
-            <el-form-item label="瑙嗗浘:" label-width="100px">
-                <el-input v-model="btmType.view" :prefix-icon="icons.view"></el-input>
+            <div>
+            <el-form-item label="寮�鍚鍥�" label-width="100px" class="viewFlag">
+                <el-switch v-model="btmType.viewFlag" active-color="#13ce66" @change="viewChange"></el-switch>
             </el-form-item>
-            <el-form-item label="鎻忚堪:" label-width="100px">
+            <el-form-item label="瑙嗗浘璇彞" label-width="100px">
+                <el-input v-model="btmType.view" :prefix-icon="icons.view" :disabled="!btmType.viewFlag"></el-input>
+            </el-form-item>
+        </div>
+            <el-form-item label="鎻忚堪" label-width="100px" class="description">
                 <el-input v-model="btmType.description" 
                 :prefix-icon="icons.desc" 
+                class="descClass"
                 ></el-input>
             </el-form-item>
         </el-form>
-        <avue-crud :option="option" :data="btmType.attributes" :page.sync="page" ref="attrTable">
+        <avue-crud :option="option" 
+        :data="btmType.attributes" 
+        :page.sync="page" 
+        ref="attrTable"
+        @cell-mouse-enter="cellEditClick"
+        @cell-mouse-leave="cellEditSave">
             <template slot-scope="scope" slot="menuLeft">
                 <el-button type="danger"
                 icon="el-icon-plus"
@@ -50,8 +62,10 @@
             </template>
             
         </avue-crud>
-        <el-button @click="submitBtmType">纭畾</el-button>
+        <div slot="footer" class="dialog-footer">
+            <el-button @click="submitBtmType">纭畾</el-button>
             <el-button @click="cancleSubmitBtmType">鍙栨秷</el-button>
+        </div>
 
 
         <el-dialog title="灞炴�ф睜"
@@ -66,13 +80,16 @@
             :page.sync="attrRef.page"
             ref="attrRef"
             @on-load="attrRefOnLoad"
+            @search-change="attrRefSearch"
             @selection-change="selectionChange">
                 <template slot="name" slot-scope="scope" >
                     <el-tag>{{scope}}</el-tag>
                 </template>
             </avue-crud>
-            <el-button @click="confirmSelectAttr">纭畾</el-button>
-            <el-button @click="cancleSelectAttr">鍙栨秷</el-button>
+            <div slot="footer" class="dialog-footer">
+                <el-button @click="confirmSelectAttr">纭畾</el-button>
+                <el-button @click="cancleSelectAttr">鍙栨秷</el-button>
+            </div>
         </el-dialog>
     </el-dialog>
 </template>
@@ -80,8 +97,8 @@
 
 <script>
 
-import {  } from '@/api/omd/btmType';
-import { getPage } from '@/api/omd/OmdAttribute';
+import { add,update } from '@/api/omd/btmType';
+import { queryPage } from '@/api/omd/OmdAttribute';
 export default {
     name: 'BusinessAdd',
     props: {
@@ -117,17 +134,18 @@
                 highlightCurrentRow: true,
                 column: [
                     {
-                        label: '灞炴�ц嫳鏂囧悕绉�',
+                        label: '鑻辨枃鍚嶇О',
                         prop: 'id',
                         align: 'left'
                     }, {
-                        label: '灞炴�т腑鏂囧悕绉�',
+                        label: '涓枃鍚嶇О',
                         prop: 'name',
-                        align: 'center'
+                        align: 'center',
+                        cell: true
                     },
                     {
-                        label: "灞炴�х被鍨�",
-                        prop: "typeValue",
+                        label: "绫诲瀷",
+                        prop: "attrDataType",
                         align: 'center',
                         slot: true
                     },
@@ -135,13 +153,15 @@
                         label: "榛樿鍊�",
                         prop: "defaultValue",
                         cell: 'true',
-                        align: 'center'
+                        align: 'center',
+                        cell: true
                     },
                     {
                         label: "璇存槑",
                         prop: "description",
                         cell: 'true',
-                        align: 'center'
+                        align: 'center',
+                        cell:true
                     }
                 ]
             },
@@ -150,8 +170,8 @@
                 page: {
                     currentPage:1,
                     pageSize:10,
-                    key:''
                 },
+                key: null,
                 option:{
                     height: 360,
                     addBtn: false,
@@ -160,19 +180,22 @@
                     selection: true,
                     menu: false,
                     border: true,
+                    reserveSelection: true,
+                    searchMenuSpan:8,
                     column: [
                         {
-                        label: '灞炴�ц嫳鏂囧悕绉�',
+                        label: '鑻辨枃鍚嶇О',
                         prop: 'key',
                         align: 'left',
+                        search: true,
                         width: 230
                     }, {
-                        label: '灞炴�т腑鏂囧悕绉�',
+                        label: '涓枃鍚嶇О',
                         prop: 'label',
-                        align: 'center'
+                        align: 'center',
                     },
                     {
-                        label: "灞炴�х被鍨�",
+                        label: "绫诲瀷",
                         prop: "typeValue",
                         align: 'center'
                     },
@@ -199,12 +222,13 @@
                     {
                         label: "璇存槑",
                         prop: "description",
+                        cell:true,
                         align: 'center'
                     }
                     ]
                 },
                 data: [],
-                queryNotIn: []
+                queryNotIn: null
             }
         }
     },
@@ -214,42 +238,52 @@
     methods: {
         closeSubmitDialog(){
             this.showSubmitDialog = false;
+            this.btmType.attributes = [];
             this.btmType = {};
+            this.attrRef.selectData = [];
+            this.attrRef.queryNotIn = null;
         },
         closeAttrDialog(){
             this.attrRef.visible = false;
         },
         rowAdd(){
             this.attrRef.visible = true;
-            this.$refs.attrRef.refreshTable();
             this.attrRefOnLoad();
-       
         },
         attrRefOnLoad(){
-            var str = '';
-            this.attrRef.queryNotIn.forEach(item => {
-                str = str + item + ','
-            });
-            getPage(this.attrRef.page.currentPage, this.attrRef.page.pageSize,{'condition["key_like"]':this.attrRef.page.key}).then(res => {
+            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;
-            })
+            });
+            this.$nextTick(() => {
+                this.$refs.attrRef.refreshTable();
+            });
+        },
+        attrRefSearch(form,done){
+            this.attrRef.key = form.key;
+            this.attrRefOnLoad();
+            done();
+            this.attrRef.key = null;
         },
         selectionChange(list){
             this.attrRef.selectData = list;
         },
         confirmSelectAttr(){
             this.btmType.attributes = [];
+            this.attrRef.queryNotIn = "";
             this.attrRef.selectData.forEach(item => {
                 this.btmType.attributes.push({
                     id: item.key,
                     name: item.label,
                     typeValue: item.typeValue,
+                    typeKey: item.typeValue,
+                    attrDataType : item.typeValue,
                     defaultValue: item.defaultValue,
-                    description: item.description
+                    description: item.description,
+                    attributeLength: item.maxLength
                 });
-                this.attrRef.queryNotIn.push(item.key);
+                this.attrRef.queryNotIn += (item.key + ",")
             });
             this.closeAttrDialog();
         },
@@ -258,17 +292,35 @@
             this.closeAttrDialog();
         },
         submitBtmType(){
-            // 娣诲姞瀹屾垚锛屽洖璋冪埗缁勪欢鐨勫埛鏂�
             console.log(this.btmType);
-            this.$emit('refreshTable');
+            add(this.btmType,true).then(res => {
+                // 娣诲姞瀹屾垚锛屽洖璋冪埗缁勪欢鐨勫埛鏂�
+                this.$message.success('淇濆瓨鎴愬姛');
+                this.cancleSubmitBtmType();
+                this.$emit('refreshTable');
+            })
         },
         cancleSubmitBtmType(){
             this.btmType = {};
             this.btmType.attributes = [];
-            console.log(this.btmType);
+            this.showSubmitDialog = false;
         },
         refreshAttrTable(){
-            this.$refs.attrTable.refreshTable();
+            this.$nextTick( () => {
+                this.$refs.attrTable.refreshTable();
+            })
+        },
+        viewChange(){
+
+        },
+        cellEditClick(cell){
+            cell.$cellEdit = true;
+        },
+        cellEditSave(row){
+            this.btmType.attributes[row.$index].name = row.name
+            this.btmType.attributes[row.$index].defaultValue = row.defaultValue;
+            this.btmType.attributes[row.$index].description = row.description;
+            row.$cellEdit = false;
         }
     }
 }
@@ -277,6 +329,18 @@
 <style>
 /* 灞炴�ф睜鍙傜収鍒楄〃 */
 .attrRef > .el-card:nth-of-type(2) > .el-card__body > .avue-crud__menu{
-        display: none !important;
+    display: none !important;
+}
+
+.btmTypeForm > .el-form-item > .el-form-item__content > .el-input > .el-input__inner {
+    width: 200px;
+}
+
+.viewFlag {
+    width: 305px;
+}
+
+.descClass > .el-input__inner {
+    width: 57vw
 }
 </style>
\ No newline at end of file

--
Gitblit v1.9.3