From 3bee20e2930c5df3af1b01bba16c53e477bd8bf0 Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期二, 12 九月 2023 19:41:10 +0800
Subject: [PATCH] 元数据管理 枚举搜索 后端未调试

---
 Source/UBCS-WEB/src/views/modeling/originalAdd.vue |  154 ++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 114 insertions(+), 40 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/modeling/originalAdd.vue b/Source/UBCS-WEB/src/views/modeling/originalAdd.vue
index c6e0c48..c6b6974 100644
--- a/Source/UBCS-WEB/src/views/modeling/originalAdd.vue
+++ b/Source/UBCS-WEB/src/views/modeling/originalAdd.vue
@@ -6,7 +6,7 @@
             <el-form ref="form" :model="attribute" show-message="true" inline size="medium" label-suffix=":"
                 class="attributeForm" :rules="rules" @resetFields="resetAttributeForm" status-icon="true">
                 <el-form-item label="灞炴�х紪鍙�" label-width="100px" prop="id">
-                    <el-input v-model="attribute.id" maxlength="15" show-word-limit type="text"></el-input>
+                    <el-input v-model="attribute.id" maxlength="30" show-word-limit type="text"></el-input>
                 </el-form-item>
                 <el-form-item label="灞炴�у悕绉�" label-width="100px" prop="name">
                     <el-input v-model="attribute.name"></el-input>
@@ -17,9 +17,9 @@
                         </el-option>
                     </el-select>
                 </el-form-item>
-                <el-form-item label="鏍囩" label-width="100px">
+<!--                <el-form-item label="鏍囩" label-width="100px">
                     <el-input v-model="attribute.hashtag"></el-input>
-                </el-form-item>
+                </el-form-item>-->
                 <el-form-item label="榛樿鍊�" label-width="100px">
                     <el-input v-model="attribute.defaultValue"></el-input>
                 </el-form-item>
@@ -37,17 +37,16 @@
                 <el-form-item label="鎻忚堪" label-width="100px">
                     <el-input v-model="attribute.description" type="text"></el-input>
                 </el-form-item>
-
                 <el-tabs v-model="activeName" @tab-click="handleClick" stretch="true">
                     <el-tab-pane label="鍙傜収" name="referTab">
-                        <el-form-item label="鍙傜収绫诲瀷" label-width="100px">
+                        <el-form-item label="鍙傜収绫诲瀷" label-width="100px" class="referTypeForm">
                             <el-select v-model="attribute.referTypeKey" @change="referTypeSelectChange">
                                 <el-option v-for="item in btmRefer.referTypeList" :key="item.value" :label="item.label"
                                     :value="item.value">
                                 </el-option>
                             </el-select>
                         </el-form-item>
-                        <el-form-item label="鍙傜収鍚嶇О" label-width="100px">
+                        <el-form-item label="鍙傜収鍚嶇О" label-width="100px" class="referNameForm">
                             <el-input v-model="attribute.referToName" @focus="openReferConfig" clearable="true"
                                 :disabled="referToFlag" @clear="clearReferTo">
                                 <i slot="suffix" class="el-input__icon el-icon-search"></i>
@@ -61,14 +60,16 @@
                             </el-input>
                         </el-form-item>
                         <el-form-item label="鏋氫妇椤�" label-width="100px">
-
+                            <el-tag v-for="eItem in dictEnums" :key="eItem.itemName" type="info">
+                              {{eItem.itemName}}
+                            </el-tag>
                         </el-form-item>
                     </el-tab-pane>
                 </el-tabs>
             </el-form>
             <div slot="footer" class="dialog-footer">
                 <el-button type="primary" @click="submitAttribute">纭畾</el-button>
-                <el-button @click="cancleSubmit">鍙栨秷</el-button>
+                <el-button @click="cancelSubmit">鍙栨秷</el-button>
             </div>
             <!-- 閫夋嫨鍙傜収鏃剁殑寮圭獥 -->
             <el-dialog title="鍙傜収鍒楄〃" :visible.sync="btmRefer.show" append-to-body @close="closeReferDialog" width="80%"
@@ -104,13 +105,26 @@
                 </el-container>
                 <div slot="footer" class="dialog-footer">
                     <el-button type="primary" @click="confirmBtm" size="small">纭畾</el-button>
-                    <el-button @click="cancleBtm" size="small">鍙栨秷</el-button>
+                    <el-button @click="cancelBtm" size="small">鍙栨秷</el-button>
                 </div>
             </el-dialog>
             <!-- 閫夋嫨鏋氫妇鏃剁殑寮圭獥 -->
             <el-dialog title="鏋氫妇鍒楄〃" :visible.sync="enumRefer.show" append-to-body @close="closeEnumDialog" width="70%"
                 style="height: 115vh;">
-                <avue-crud ref="eunmTable" :option="enumRefer.option" :data="enumRefer.data" class="enumTable"
+                <div>
+                  <el-form :inline="true" :model="form" class="demo-form-inline" size="small">
+                    <el-form-item label="鏋氫妇浠e彿">
+                      <el-input v-model="form.name" placeholder="鏋氫妇浠e彿"></el-input>
+                    </el-form-item>
+                    <el-form-item label="鏋氫妇鍚嶇О">
+                        <el-input v-model="form.label" placeholder="鏋氫妇鍚嶇О"></el-input>
+                    </el-form-item>
+                    <el-form-item>
+                      <el-button type="primary" @click="onSubmit">鏌ヨ</el-button>
+                    </el-form-item>
+                  </el-form>
+                </div>
+                <avue-crud ref="eunmTable" :option="enumRefer.option"  @on-load="enumOnLoad" :data="enumRefer.data" class="enumTable"
                     @row-click="enumReferClick" :page.sync="enumRefer.enumPage">
                     <template slot="radio" slot-scope="{row}">
                         <el-radio v-model="enumRefer.selectRow" :label="row.$index">&nbsp;
@@ -119,7 +133,7 @@
                 </avue-crud>
                 <div slot="footer" class="dialog-footer">
                     <el-button type="primary" @click="confirmEnum" size="small">纭畾</el-button>
-                    <el-button @click="cancleEnum" size="small">鍙栨秷</el-button>
+                    <el-button @click="cancelEnum" size="small">鍙栨秷</el-button>
                 </div>
             </el-dialog>
         </el-dialog>
@@ -140,6 +154,10 @@
     },
     data() {
         return {
+            form:{
+              name:'',
+              label:''
+            },
             showSubmitDialog: false,
             // 榛樿鐨勯〉绛�
             activeName: 'referTab',
@@ -152,7 +170,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: 30, message: '闀垮害鍦�2鍒�30涓瓧绗�', trigger: 'blur' }
                 ],
                 name: [
                     { required: true, message: '璇疯緭鍏ュ睘鎬у悕绉�', trigger: 'blur' }
@@ -223,12 +241,13 @@
                     addBtn: false,
                     refreshBtn: false,
                     columnBtn: false,
-                    selection: true,
+                    // selection: true,
                     menu: false,
                     border: true,
                     reserveSelection: true,
                     searchMenuSpan: 32,
-                    searchShowBtn: false,
+                    // searchShowBtn: false,
+                    // search:true,
                     highlightCurrentRow: true,
                     column: [{
                         label: '',
@@ -240,13 +259,13 @@
                         prop: 'name',
                         align: 'center',
                         searchSpan: 8,
-                        search: true,
+                        // search: true,
                     }, {
                         label: '鏋氫妇鍚嶇О',
                         prop: 'label',
                         align: 'center',
                         searchSpan: 8,
-                        search: true,
+                        // search: true,
                     }]
                 },
                 // 鏋氫妇鍙傜収琛ㄦ牸鏁版嵁
@@ -267,7 +286,12 @@
                         value: 'oid',
                     }
                 }
-            }
+            },
+            dictEnums: [],
+            enumEditFlag: false,
+            enumInitFlag: false,
+            referInitFlag: false,
+            referEditFlag: false,
         }
     },
     created() {
@@ -275,6 +299,26 @@
         this.initAttributeReferTypeList();
     },
     methods: {
+      onSubmit() {
+        const conditionMap = {};
+        if (this.form.name) {
+          conditionMap[`conditionMap['name_like']`] = this.form.name;
+        }
+        if (this.form.label) {
+          conditionMap[`conditionMap['label_like']`] = this.form.label;
+        }
+        getParentList(this.enumRefer.enumPage.currentPage, this.enumRefer.enumPage.pageSize, conditionMap)
+          .then((res) => {
+            this.enumRefer.enumPage.total = res.data.data.total;
+            this.enumRefer.data = res.data.data.records;
+          });
+      },
+        enumOnLoad(){
+          getParentList(this.enumRefer.enumPage.currentPage, this.enumRefer.enumPage.pageSize).then(res => {
+            this.enumRefer.enumPage.total = res.data.data.total;
+            this.enumRefer.data = res.data.data.records;
+          })
+        },
         closeSubmitDialog() {
             this.resetAttributeForm();
             this.showSubmitDialog = false;
@@ -286,9 +330,23 @@
             };
             this.referToFlag = true;
             this.$refs.form.resetFields();
+            this.dictEnums = [];
         },
         submitAttribute() {
             const that = this;
+            if (that.referInitFlag && that.referEditFlag){
+                this.$set(this.attribute,'dictCode','');
+                this.$set(this.attribute,'dictKey','');
+                this.$set(this.attribute,'dictValue','');
+                this.$set(this.attribute,'usingDict','');
+            }
+            if (that.enumInitFlag && that.enumEditFlag){
+                this.$set(this.attribute,'referTypeCode','');
+                this.$set(this.attribute,'referTypeKey','');
+                this.$set(this.attribute,'referTypeValue','');
+                this.$set(this.attribute,'referToId','');
+                this.$set(this.attribute,'referToName','');
+            }
             this.$refs.form.validate(function (pass, field) {
                 if (pass) {
                     add(that.attribute).then(res => {
@@ -302,21 +360,23 @@
                 }
             })
         },
-        cancleSubmit() {
+        cancelSubmit() {
             this.closeSubmitDialog();
         },
         closeEnumDialog() {
-            this.cancleEnum();
+            this.cancelEnum();
         },
         closeReferDialog() {
-            this.cancleBtm();
+            this.cancelBtm();
         },
         confirmBtm() {
             this.attribute.referToId = this.btmRefer.selectItem.oid;
             this.attribute.referToName = this.btmRefer.selectItem.name;
             this.btmRefer.show = false;
+            this.referEditFlag =  true;
+            this.enumEditFlag = false;
         },
-        cancleBtm() {
+        cancelBtm() {
             this.btmRefer.selectItem = {};
             this.btmRefer.show = false;
             this.btmRefer.selectRow = '';
@@ -326,8 +386,13 @@
             this.attribute.dictCode = this.enumRefer.selectItem.name;
             this.attribute.dictValue = this.enumRefer.selectItem.label;
             this.enumRefer.show = false;
+            getDictionary({code :this.enumRefer.selectItem.name}).then(res => {
+                this.dictEnums = res.data.data;
+            });
+            this.referEditFlag =  false;
+            this.enumEditFlag = true;
         },
-        cancleEnum() {
+        cancelEnum() {
             this.enumRefer.selectItem = {};
             this.enumRefer.show = false;
             this.enumRefer.selectRow = '';
@@ -345,20 +410,19 @@
                 this.domain.data = res.data.data;
             })
             this.btmRefer.show = true;
-
         },
         // 鍙傜収绫诲瀷鏍戠殑鐐瑰嚮浜嬩欢
         nodeClick(data) {
             // 鍖哄垎涓氬姟绫诲瀷鐨勬煡璇㈠拰閾炬帴绫诲瀷鐨勬煡璇�
             if (this.attribute.referTypeKey == 'btmType') {
-                btmPage(this.btmRefer.btmPage.currentPage, this.btmRefer.btmPage.pageSize, { domain: data.id }).then(res => {
+                btmPage(this.btmRefer.btmPage.currentPage, this.btmRefer.btmPage.pageSize, { bizDomain: data.id }).then(res => {
                     this.btmRefer.data = res.data.data.records;
                     this.btmRefer.btmPage.total = res.data.data.total;
                 })
             }
-            if (this.attribute.referTypeKey == 'linkType') {
-
-            }
+            // if (this.attribute.referTypeKey == 'linkType') {
+            //
+            // }
         },
         // 鏋氫妇绫诲瀷杈撳叆妗嗚幏寰楃劍鐐规椂鐨勪簨浠�
         openEnumConfig() {
@@ -431,18 +495,16 @@
             this.btmRefer.selectItem = {};
             this.btmRefer.selectRow = '';
         },
-        // handleClick(tab){
-        //     // 鍥犱负鍙兘鍙傜収鍜屾灇涓句簩閫変竴銆傛墍浠ュ湪鍒囨崲鐨勬椂鍊欐妸灞炴�х粰娓呯┖銆�
-        //     this.$delete(this.attribute,'referTypeCode');
-        //     this.$delete(this.attribute,'referTypeKey');
-        //     this.$delete(this.attribute,'referTypeValue');
-        //     this.$delete(this.attribute,'referToId');
-        //     this.$delete(this.attribute,'referToName');
-        //     this.$delete(this.attribute,'dictCode');
-        //     this.$delete(this.attribute,'dictKey');
-        //     this.$delete(this.attribute,'dictValue');
-        //     this.$delete(this.attribute,'usingDict');
-        // }
+        handleClick(tab){
+            // 鍥犱负鍙兘鍙傜収鍜屾灇涓句簩閫変竴銆傛墍浠ュ湪鍒囨崲鐨勬椂鍊欐妸灞炴�х粰娓呯┖銆�
+            if (tab.name === 'enumTab'){
+              this.enumInitFlag = true;
+              this.referInitFlag = false;
+            }else {
+              this.enumInitFlag = false;
+              this.referInitFlag = true;
+            }
+        }
     }
 }
 </script>
@@ -462,4 +524,16 @@
 
 .attributeForm>.el-form-item>.el-form-item__content>.el-select>.el-input>.el-input__inner {
     width: 200px;
-}</style>
\ No newline at end of file
+}
+.attributeForm>.el-form-item>.el-form-item__content{
+  width :190px;
+}
+
+.referTypeForm > .el-form-item__content > .el-select > .el-input>.el-input__inner {
+  width: 200px;
+}
+
+.referNameForm > .el-form-item__content > .el-input > .el-input__inner {
+  width: 200px;
+}
+</style>

--
Gitblit v1.9.3