From 7602a824e39e19260ae32bb45e799e6ce43300ac Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期五, 14 七月 2023 21:15:29 +0800
Subject: [PATCH] 参照配置组件修改

---
 Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue |  163 +++++++++++++++++++++++++++++-------------------------
 1 files changed, 87 insertions(+), 76 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue b/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
index f5bbfaf..cf0f19d 100644
--- a/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
+++ b/Source/UBCS-WEB/src/components/code-dialog-page/referConfigFormDialog.vue
@@ -6,6 +6,7 @@
       :visible.sync="isShowReferConfigForm"
       width="90%"
       id="refer-config-form"
+      destroy-on-close
       @close="recoveryDataAndForm('initData')"
       style="height: 115vh; margin-top: -14vh; overflow-y: hidden">
         <div style="width: 100%; overflow-y: auto; height: 70vh">
@@ -234,8 +235,9 @@
 <script>
     import func from "@/util/func";
     export default {
-        name: "referConfigDialog",
+        name: "referConfigFormDialog",
         props: {
+           
         },
         data() {
             let element = '';
@@ -244,6 +246,7 @@
                 labelWidth: '150',   // 鏍囬瀹藉害
                 isShowReferConfigForm: false,  // 绗竴灞傚璇濇鏄剧ず闅愯棌鎺у埗
                 referTypeIsReadOnly: false,
+
                 // 琛ㄥ崟瀵硅薄
                 form: {
                     referTypeName: '', //鏄剧ず鐨勫��
@@ -419,7 +422,7 @@
                                 },{
                                     value: "_notlike", label: "涓嶅寘鍚�",
                                 }, {
-                                    value: 'equal', label: '绛変簬'
+                                    value: '_equal', label: '绛変簬'
                                 }, {
                                     value: '_notequal', label: '涓嶇瓑浜�'
                                 }, {
@@ -594,7 +597,7 @@
                                             this.isDisabledTabs = false;
                                         } else if(value == 'default' || value == 'grid'){
                                             addFrom = {
-                                                limit: '15',
+                                                limit: 15,
                                                 sortField: '',
                                                 sortType: 'asc',
                                             };
@@ -625,19 +628,21 @@
                                         // 鍚堝苟涓や釜琛ㄥ崟
                                         this.form = Object.assign(addFrom,this.form);
                                         // console.log("endFilter",this.form.type);
-                                        //console.log(this.form);
+                                        // console.log(this.form);
                                     },
                                 },{
-                                    label: '鏄惁寮�鍚寔涔呭寲',
+                                    label: '鏄惁鎸佷箙鍖栧弬鐓ч厤缃�',
                                     prop: 'isPersistence',
+                                    labelWidth: '142',
                                     tip: 'true:寮�鍚寔涔呭寲锛屽褰撳墠瀹氫箟鐨勫弬鐓ч厤缃繘琛屾寔涔呭寲瀛樺偍锛屼笅娆″彲鐩存帴閫夊彇锛沠alse:浠呭褰撳墠娆$爜娈垫柊澧炵敓鏁堛��',
                                     tipPlacement: 'bottom',
                                     span: 6,
                                     type: 'switch',
                                 },{
                                     display: this.form.isPersistence | this.form.isPersistence=='true',
-                                    label: '缂栧彿',
+                                    label: '鍙傜収閰嶇疆缂栧彿',
                                     prop: 'id',
+                                    tip: '璁剧疆璇ュ弬鐓ч厤缃寔涔呭寲瀛樺偍鏃剁殑缂栧彿銆�',
                                     rules: [{
                                         required: true,
                                         message: "(寮�鍚寔涔呭寲鏃剁紪鍙�)蹇呭~椤逛笉鑳戒负绌�",
@@ -646,8 +651,9 @@
                                     span: 6,
                                 },{
                                     display: this.form.isPersistence | this.form.isPersistence=='true',
-                                    label: '鍚嶇О',
+                                    label: '鍙傜収閰嶇疆鍚嶇О',
                                     prop: 'name',
+                                    tip: '璁剧疆璇ュ弬鐓ч厤缃寔涔呭寲瀛樺偍鏃剁殑鍚嶇О銆�',
                                     rules: [{
                                         required: true,
                                         message: "(寮�鍚寔涔呭寲鏃跺悕绉�)蹇呭~椤逛笉鑳戒负绌�",
@@ -670,11 +676,11 @@
                                     tip: '榛樿绌虹潃锛岃缃悗琛ㄧず寮哄埗鏄剧ず杩欐牱鐨勯珮搴�',
                                     tipPlacement: 'right',
                                     span: 7,
-                                    // rules:[{
-                                    //     validator: validateNumber,
-                                    //     message: "绐楀彛鏄剧ず鐨勯珮搴﹀繀椤讳负鏁板�肩被鍨�",
-                                    //     trigger: "blur",
-                                    // }]
+                                    rules:[{
+                                        validator: validateNumber,
+                                        message: "绐楀彛鏄剧ず鐨勯珮搴﹀繀椤讳负鏁板�肩被鍨�",
+                                        trigger: "blur",
+                                    }]
                                 },{
                                     label: '杩囨护(绾ц仈)灞炴��',
                                     prop: 'useFormKey',
@@ -769,7 +775,7 @@
                                     prop: 'limit',
                                     span: 8,
                                     tip: '鍒嗛〉鏃舵瘡椤垫樉绀虹殑鏁伴噺锛屼笉鍒嗛〉濉�-1',
-                                    //value: 15,
+                                    value: 15,
                                     tipPlacement: 'right',
                                 },{
                                     label: '鎺掑簭瀛楁',
@@ -892,14 +898,10 @@
             },
         },
         mounted() {
-            // 楹荤殑杩欎釜鍦版柟璋冩鎴戜簡
+            // 浜嬩欢鐩戝惉锛屽疄鐜拌〃鏍艰缂栬緫鐐瑰嚮琛ㄦ牸鍖哄煙澶栧唴瀹规椂閫�鍑虹紪杈戠姸鎬�
             this.element = document.getElementById('refer-config-form');
             this.element.addEventListener("click", (e) => {
                 //<table cellspacing="0" cellpadding="0" border="0" class="el-table__body" style="width: 911px;">
-                //console.log(e.target);
-                // console.log(this.$refs.crudAttr);
-                // console.log(this.$refs.crudAttr.$el.contains(e.target));
-                //console.log(!this.$refs.crudAttr.$el.contains(e.target) && this.preClickAttrRow != null);
                 if (!this.$refs.crudAttr.$el.contains(e.target) && 
                    this.preClickAttrRow != '') {
                    this.preClickAttrRow.$cellEdit = false;
@@ -914,56 +916,16 @@
             // 璐煎潙锛屽垏鎹㈢被鍨嬫椂琛ㄦ牸锛岄殣钘忓啀鏄剧ず灏变細鍑虹幇琛ㄦ牸閿欎綅闂锛�
             'form.type'(value) {
                 this.onloadAttrData();
+            },
+            // 鐩戝惉鐖剁粍浠朵紶鐨勭獥鍙f樉绀洪殣钘忕殑鍊�
+            isShowReferConfigForm (){
+                if(this.isShowReferConfigForm){
+                    this.onloadAttrData();
+                }
             }
         },
         methods: {
-
-            // 鍗曞嚮琛ㄦ牸瀹炵幇琛ㄦ牸琛岀紪杈�
-            clickAttrEdit(row, column, event){
-                if(this.preClickAttrRow && this.preClickAttrRow != row){
-                    //console.log(this.codeShowFieldConfigVOS[this.preClickAttrRow.$index]);
-                    this.codeShowFieldConfigVOS[this.preClickAttrRow.$index].$cellEdit = false;
-                }
-                row.$cellEdit = true;
-                this.preClickAttrRow = row;
-            },
-            // 灞炴�ц〃鏍艰缂栬緫澶卞幓鐒︾偣鏃朵繚瀛樻柟娉�
-            // updateAttrBlur(value){
-                //console.log(this.codeShowFieldConfigVOS[0]);
-                
-            // },
-
-            // 鍗曞嚮琛ㄦ牸瀹炵幇琛ㄦ牸琛岀紪杈�
-            clickAddSearchCondtionEdit(row, column, event){
-                if(this.preClickAddSearchConditionRow && this.preClickAddSearchConditionRow != row){
-                    //console.log(this.codeShowFieldConfigVOS[this.preClickAttrRow.$index]);
-                    this.form.codeSrchCondConfigVOS[this.preClickAddSearchConditionRow.$index].$cellEdit = false;
-                }
-                row.$cellEdit = true;
-                this.preClickAddSearchConditionRow = row;
-            },
-            //涓婁竴涓〉闈㈠凡缁忛�変腑鍙傜収搴旂敤鐨勪笟鍔$被鍨嬬殑鎯呭喌锛屽拰涓婁竴娆″凡缁忛厤缃繃鍙傜収閰嶇疆鐨勬儏鍐典笅杩涜椤甸潰鍒濆鍖栨覆鏌�
-            initPageData(val){
-                //console.log(val);
-                if(func.notEmpty(val.referConfig)){
-                    this.form = JSON.parse(val.referConfig);
-                    // console.log(this.form);
-                    this.form.isPersistence = this.form.isPersistence == 'true' ? true:false;
-                    // 鍙傜収寮曠敤鐨勪笟鍔$被鍨嬩笉鍙��
-                    this.referTypeIsReadOnly = true;
-                    if((this.form.type == 'default' || this.form.type  == 'grid') && (this.form.codeShowFieldConfigVOS != undefined && this.form.codeShowFieldConfigVOS.length > 0)){
-                        this.codeShowFieldConfigVOS = this.form.codeShowFieldConfigVOS;
-                    }
-                    return;
-                }
-                if(func.notEmpty(val.referType)){
-                    this.form.referTypeName = val.referTypeName;
-                    this.form.referType = val.referType;
-                    this.referTypeIsReadOnly = true;
-                    return;
-                }
-                //console.log(localStorage.getItem("userId"));
-            },
+            
             // 閫夋嫨瀹屽弬鐓ч厤缃箣鍚庣偣鍑讳繚瀛樻寜閽Е鍙�
             async selectedListReferConfig(){
                 // 鏍囪鎵�鏈夎〃鍗曟槸鍚﹂�氳繃鏍¢獙鐨勫彉閲�
@@ -991,6 +953,52 @@
                     this.isShowReferConfigForm = false;
                 }
             },
+            // 鍗曞嚮琛ㄦ牸瀹炵幇琛ㄦ牸琛岀紪杈�
+            clickAttrEdit(row, column, event){
+                if(this.preClickAttrRow && this.preClickAttrRow != row){
+                    //console.log(this.codeShowFieldConfigVOS[this.preClickAttrRow.$index]);
+                    this.codeShowFieldConfigVOS[this.preClickAttrRow.$index].$cellEdit = false;
+                }
+                row.$cellEdit = true;
+                this.preClickAttrRow = row;
+            },
+            // 灞炴�ц〃鏍艰缂栬緫澶卞幓鐒︾偣鏃朵繚瀛樻柟娉�
+            // updateAttrBlur(value){
+                //console.log(this.codeShowFieldConfigVOS[0]);
+                
+            // },
+
+            // 鍗曞嚮琛ㄦ牸瀹炵幇琛ㄦ牸琛岀紪杈�
+            clickAddSearchCondtionEdit(row, column, event){
+                if(this.preClickAddSearchConditionRow && this.preClickAddSearchConditionRow != row){
+                    //console.log(this.codeShowFieldConfigVOS[this.preClickAttrRow.$index]);
+                    this.form.codeSrchCondConfigVOS[this.preClickAddSearchConditionRow.$index].$cellEdit = false;
+                }
+                row.$cellEdit = true;
+                this.preClickAddSearchConditionRow = row;
+            },
+            //涓婁竴涓〉闈㈠凡缁忛�変腑鍙傜収搴旂敤鐨勪笟鍔$被鍨嬬殑鎯呭喌锛屽拰涓婁竴娆″凡缁忛厤缃繃鍙傜収閰嶇疆鐨勬儏鍐典笅杩涜椤甸潰鍒濆鍖栨覆鏌�
+            initPageData(val){
+                // console.log(val.referConfig);
+                if(func.notEmpty(val.referConfig)){
+                    this.form = JSON.parse(val.referConfig);
+                    // 鍙傜収寮曠敤鐨勪笟鍔$被鍨嬩笉鍙��
+                    // this.referTypeIsReadOnly = true;
+                    if((this.form.type == 'default' || this.form.type  == 'grid') && (this.form.codeShowFieldConfigVOS != undefined && this.form.codeShowFieldConfigVOS.length > 0)){
+                        this.codeShowFieldConfigVOS = this.form.codeShowFieldConfigVOS;
+                    }
+                    return;
+                }else {
+                    this.onloadAttrData()
+                }
+                if(func.notEmpty(val.referType)){
+                    this.form.referTypeName = val.referTypeName;
+                    this.form.referType = val.referType;
+                    this.referTypeIsReadOnly = true;
+                    return;
+                }
+                //console.log(localStorage.getItem("userId"));
+            },
             /** 鍏跺疄閫夊彇灞炴�ц〃鏍肩殑榛樿鏁版嵁涓嶉渶瑕佸姞杞斤紝
              浣嗘槸寮圭獥鎵撳紑浼氭湁琛ㄦ牸閿欒闂鎵�浠ラ渶瑕佸湪杩欒皟鐢╠oLayout鏂规硶*/
             onloadAttrData(){
@@ -1017,9 +1025,9 @@
                         $cellEdit: false
                     }
                 ];
-                this.$nextTick(() => {
-                    this.$refs.crudAttr.doLayout()
-                })
+                // this.$nextTick(() => {
+                //     this.$refs.crudAttr.doLayout()
+                // })
             },
             // 灞炴�ч�夋嫨琛ㄦ牸涓殑绉婚櫎鎸夐挳鍔熻兘
             removeCurrentRow(row,condition){
@@ -1179,12 +1187,12 @@
             /** 涓恒�愬弬鐓у紩鐢ㄧ殑涓氬姟绫诲瀷銆戦�夊彇鍊间箣鍚庣殑鍐呭鍥炴樉鏃惰皟鐢� */
             echoReferBtmType(content){
                 // 瀹炵幇鍥炴樉
-                this.form.referTypeName = content.name;
-                this.form.referType = content.id;
+                this.form.referTypeName = content.name || content.id;
+                this.form.referType = content.id || '';
             },
             /** 鎺掑簭瀛楁銆佹樉绀虹殑灞炴�с�佹煡璇㈡潯浠剁殑琛ㄦ牸琛岄�夋嫨涔嬪悗鍥炴樉 */
             echoSelectedAttr(data){
-                console.log(data);
+                // console.log(data);
                 // 涓恒�愭帓搴忓瓧娈点�戦�夊彇鍊�
                 if(data.condition === 'sortField'){
                     this.form.sortField = data.selectedArrary[0].id;
@@ -1193,7 +1201,7 @@
                         this.form.codeSrchCondConfigVOS.push(
                             {
                                 filterField: item.id,
-                                filterType: 'equal',
+                                filterType: '_equal',
                                 filterTypeText: item.name, 
                                 filterValue: '',
                                 $cellEdit: false
@@ -1203,15 +1211,18 @@
                 }else{
                     // 閫夋嫨鏄剧ず瀛楁
                     data.selectedArrary.forEach(item => {
+                        console.log(item);
                         this.codeShowFieldConfigVOS.push(
                             {
                                 field: item.id,
-                                title: item.id,
-                                fieldType: item.attrType,
-                                fieldTypeText: item.attrTypeText,
+                                title: item.name,
+                                // fieldType: item.attrType,
+                                // fieldTypeText: item.attrTypeText,
+                                fieldType: 'text',
+                                fieldTypeText: '鏂囨湰妗�',
                                 sort: false,
                                 attrSortField: item.id,
-                                width: item.attrLength,
+                                width: item.attributeLength,
                                 isquery: false,
                                 $cellEdit: false
                             }

--
Gitblit v1.9.3