From 0aa0bbdfde221a46019f90a245e40d6b57fd251b Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 11 七月 2023 19:09:03 +0800
Subject: [PATCH] 编码规则bug修复

---
 Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue |  185 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 130 insertions(+), 55 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue b/Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue
index b6354df..eea22b8 100644
--- a/Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue
+++ b/Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue
@@ -10,8 +10,9 @@
         width="55vw"
         style="height: 115vh; margin-top: -10vh; overflow: hidden"
         :visible.sync="isShowDialog"
-        @close="recoverPage"
-        destroy-on-close>
+        lock-scroll
+        :close-on-click-modal="false"
+        @close="recoverPage">
         <div class="search-total">
             <!-- 澶撮儴鎸夐挳鍖哄煙 -->
             <div slot="title" class="dialog-search-button"> 
@@ -52,7 +53,7 @@
                         <div class="grid-content">
                             <el-select placeholder="璇烽�夋嫨" v-model="searchFormArrays[index].condition">
                                 <el-option
-                                    v-for="condition in item.fieldType=='text' ? searchConditions:switchSearchConditions"
+                                    v-for="condition in item.conditions"
                                     :key="condition.value"
                                     :label="condition.label"
                                     :value="condition.value">
@@ -71,7 +72,20 @@
                                     :value="option.itemValue">
                                 </el-option>
                             </el-select>
-                            <el-switch  v-else-if="item.fieldType==='truefalse'" v-model="searchFormArrays[index].fieldValue"></el-switch>
+                            <el-switch v-else-if="item.fieldType==='truefalse'" v-model="searchFormArrays[index].fieldValue"></el-switch>
+                            <el-date-picker v-else-if="item.fieldType==='datetime'"
+                                v-model="searchFormArrays[index].fieldValue"
+                                type="date"
+                                placeholder="閫夋嫨鏃ユ湡">
+                            </el-date-picker>
+                            <vci-web-refer
+                                v-else-if="item.fieldType==='refer'"
+                                :referConfig="item.referConfigData || {}"
+                                :value="searchFormArrays[index].fieldValue"
+                                :text="item.showField"
+                                :display="!item.hidden"
+                                @setReferValue="val=>setReferValue(val,index)">
+                            </vci-web-refer>
                         </div>
                     </el-col>
                     <el-col :span="2">
@@ -87,7 +101,9 @@
 
 <script>
 import { getDictionary } from "@/api/omd/enum";
+import vciWebRefer from '../refer/vciWebRefer.vue';
 export default {
+  components: { vciWebRefer },
     name: "advancedQuery",
     props: {
         // 瀵硅瘽妗嗘樉绀洪殣钘忔帶鍒�
@@ -106,7 +122,7 @@
             // 瀵硅瘽妗嗘樉绀烘帶鍒�
             isShowDialog: this.visible,
             initOptions: [],
-            // 瀛楁鏄緭鍏ユ绫诲瀷鐨勬潯浠舵暟缁�
+            // 瀛楁绫诲瀷鏄緭鍏ユ绫诲瀷鐨勬潯浠舵暟缁�
             searchConditions: [
                 {
                     value: "_equal",
@@ -120,15 +136,9 @@
                 },{
                     value: "_notlike",
                     label: "涓嶅寘鍚�",
-                },{
-                    value: "_ge", //澶т簬锛岄粯璁や负澶т簬绛変簬
-                    label: "澶т簬", 
-                },{
-                    value: "_le", //灏忎簬锛岄粯璁や负灏忎簬绛変簬
-                    label: "灏忎簬",
-                },
+                }
             ],
-            // 瀛楁鏄崟閫夋垨涓嬫媺妗嗙被鍨嬬殑鏉′欢鏁扮粍
+            // 瀛楁绫诲瀷鏄崟閫夋垨涓嬫媺妗嗙被鍨嬬殑鏉′欢鏁扮粍
             switchSearchConditions: [
                 {
                     value: "_equal",
@@ -137,6 +147,38 @@
                     value: "_notequal",
                     label: "涓嶇瓑浜�",
                 }
+            ],
+            // 鍙傜収绫诲瀷鐨勬潯浠舵暟缁�
+            referSearchConditions: [
+                {
+                    value: "_equal",
+                    label: "绛変簬",
+                },{
+                    value: "_notequal",
+                    label: "涓嶇瓑浜�",
+                },{
+                    value: "_like",
+                    label: "鍖呭惈",
+                },{
+                    value: "_notlike",
+                    label: "涓嶅寘鍚�",
+                }
+            ],
+            // 瀛楁绫诲瀷鏄棩鏈�
+            dateConditions: [
+                {
+                    value: "_equal",
+                    label: "绛変簬",
+                },{
+                    value: "_notequal",
+                    label: "涓嶇瓑浜�",
+                },{
+                    value: "_ge", //澶т簬锛岄粯璁や负澶т簬绛変簬
+                    label: "澶т簬", 
+                },{
+                    value: "_le", //灏忎簬锛岄粯璁や负灏忎簬绛変簬
+                    label: "灏忎簬",
+                },
             ],
             searchFormArrays: [],
             fieldValue: '',
@@ -149,33 +191,77 @@
         },
         // 瀵硅瘽妗嗗唴瀹规覆鏌撻厤缃�
         options(){
-            // 灏唎ptions閰嶇疆璧嬪�煎埌data涓殑option涓紝閬垮厤娣辨祬鎷疯礉鐨勯棶棰樻墍浠ラ渶瑕佽浆json涔嬪悗鍐嶈祴鍊�
-            const data = JSON.stringify(this.options);
-            this.initOptions = JSON.parse(data);
-            //console.log(this.initOptions); 
-            this.initOptions.forEach((item,index) => {
-                if(item.fieldType==='combox') {
-                    let enumCach = JSON.parse(localStorage.getItem(item.comboxKey));
-                    if(enumCach != null) {
-                        item.data = enumCach;
-                    }else {
-                        getDictionary({code: item.comboxKey}).then(res=>{
-                            item.data = res.data.data;
-                            localStorage.setItem(item.comboxKey,JSON.stringify(res.data.data));
-                        })
-                    }
-                }
-                let add = {
-                    queryField: String(item.queryField),
-                    condition: item.fieldType==='text' ? String("_like"):String("_equal"),
-                    fieldValue: item.fieldType==='truefalse' ? Boolean(false):String(""),
-                }
-                this.searchFormArrays.push(add)
-            });
-            //console.log(this.searchFormArrays);
+            this.initData();
         }
     },
     methods: {
+
+        initData(){
+             // 灏唎ptions閰嶇疆璧嬪�煎埌data涓殑option涓紝閬垮厤娣辨祬鎷疯礉鐨勯棶棰樻墍浠ラ渶瑕佽浆json涔嬪悗鍐嶈祴鍊�
+            const data = JSON.stringify(this.options);
+            this.initOptions = JSON.parse(data);
+            //console.log(this.initOptions);
+                if(this.initOptions.length > 0){
+                    let array = [];
+                    this.initOptions.forEach((item,index) => {
+                        if(item.fieldType==='combox') {
+                            let enumCach = JSON.parse(localStorage.getItem(item.comboxKey));
+                            if(enumCach != null) {
+                                item.data = enumCach;
+                            }else {
+                                getDictionary({code: item.comboxKey}).then(res=>{
+                                    item.data = res.data.data;
+                                    localStorage.setItem(item.comboxKey,JSON.stringify(res.data.data));
+                                })
+                            }
+                        }else if(item.fieldType==='refer'){
+                            this.$set(item,"referConfigData",{
+                                title: item.title,
+                                showField: item.showField || item.field,
+                                field: item.field,
+                                placeholder: item.inputTip || '',
+                                options: Object.assign(item.referConfig,{width:"80%"}),
+                            })
+                            //console.log(item.referConfigData.options);
+                            //console.log(item);   
+                        }
+                        // TODO: 杩欏効淇敼涓�涓嬪弬鐓х殑鏌ヨ鏉′欢
+                        let conditions = [];
+                        if(item.fieldType==='text'){
+                            conditions = this.searchConditions;
+                        }else if (item.fieldType==='combox'){
+                            conditions = this.dateConditions;
+                        }else if (item.fieldType==='datetime') {
+                            conditions = this.switchSearchConditions;
+                        }else {
+                            conditions = this.referSearchConditions;
+                        }
+                        // console.log(conditions);
+                        this.$set(item,"conditions",conditions)
+                        
+                        let add = {
+                            queryField: String(item.queryField),
+                            condition: item.fieldType==='text' ? String("_like"):String("_equal"),
+                            fieldValue: item.fieldType==='truefalse' ? Boolean(false):String(''),
+                        }
+                        array.push(add)
+                    });
+                    this.searchFormArrays = array;
+            }
+            //console.log(this.initOptions);
+            //console.log(this.searchFormArrays);
+        },
+
+        /** 涓哄弬鐓х被鍨嬫椂鍊奸�夋嫨涔嬪悗鐨勫鐞� */
+        setReferValue(data,index){
+            // console.log(index);
+            if(data.field) {
+                this.searchFormArrays[index][data.fieldValue] = data.value || '';
+                this.initOptions[index][data.showField] = data.text || '';
+            }
+            // console.log(this.initOptions[index][data.showField]);
+            // console.log(data);
+        },
 
         // 灞炴�у垏鎹㈡椂鏌ヨ鏉′欢鍜屾煡璇㈠�间篃闇�瑕佸杈撳叆妗嗚繘琛屽垏鎹�
         // changeField(index) {
@@ -210,20 +296,7 @@
         },
         // 閲嶇疆褰撳墠鐣岄潰鐨勮緭鍏ユ
         resetInput(){
-            const data = JSON.stringify(this.options);
-            this.initOptions = JSON.parse(data);
-            let array = [];
-            this.initOptions.forEach((item,index) => {
-                let add = {
-                    queryField: String(item.queryField),
-                    condition:item.fieldType=='text' ? String("_like"):String("_equal"),
-                    fieldValue: item.fieldType=='truefalse' ? Boolean(false):String(''),
-                }
-                array.push(add)
-            });
-            this.searchFormArrays = array;
-            //console.log(this.initOptions);
-            //console.log(this.searchFormArrays);
+            this.initData();
         },
         // 鎭㈠椤甸潰
         recoverPage(){
@@ -236,7 +309,7 @@
             const searchConditions = this.searchFormArrays;
             for(let index = 0; index < searchConditions.length; index++) {
                 //console.log(condtionParam['conditionMap['+searchConditions[index].queryField+']']+'' == 'undefined');
-                if(searchConditions[index].fieldValue.trim() != '' || searchConditions[index].fieldValue+''==='false') {
+                if(searchConditions[index].fieldValue+'' != '' || searchConditions[index].fieldValue+''==='false') {
                     // 瀛樺湪鐩稿悓鐨勬煡璇㈡潯浠�
                     if(condtionParam['conditionMap['+searchConditions[index].queryField+']']+'' != 'undefined' ) {
                         this.$message.warning("瀛樺湪閲嶅鏌ヨ鏉′欢锛岃浠旂粏鏍稿!");
@@ -247,8 +320,8 @@
                     condtionParam['conditionMap['+searchConditions[index].queryField+searchConditions[index].condition+']'] = searchConditions[index].fieldValue;
                 }
             }
-            // 鏌ヨ鏉′欢娌℃湁鍑虹幇閲嶅灞炴�э紝骞朵笖杩囨护鎺変簡绌哄�硷紝浼犻�掔粰鐖剁粍浠�
-            // console.log(condtionParam);
+            // 鏌ヨ鏉′欢娌℃湁鍑虹幇閲嶅灞炴�э紝骞朵笖杩囨护鎺変簡绌哄�硷紝灏变紶閫掔粰鐖剁粍浠�
+            console.log(condtionParam);
             this.$emit('echoContion',condtionParam)
             this.isShowDialog = false;
         },    
@@ -316,6 +389,8 @@
         line-height: 40px;
         height: 40px;
     }
-
+    .grid-content > .el-date-editor.el-input, .el-date-editor.el-input__inner{
+        width: 100%;
+    }
 
 </style>
\ No newline at end of file

--
Gitblit v1.9.3