From 875e26a11e28c1cefc1667bc25985dbb049f91f3 Mon Sep 17 00:00:00 2001
From: zhangxp <zhangxp@chicecm.com>
Date: 星期五, 16 六月 2023 18:34:01 +0800
Subject: [PATCH] 修复

---
 Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue |  109 ++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 72 insertions(+), 37 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue b/Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue
index 8e6bea6..a1afbc7 100644
--- a/Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue
+++ b/Source/UBCS-WEB/src/components/advanced-query/advancedQuery.vue
@@ -35,13 +35,12 @@
                 <el-row  
                     v-for="(item,index) in initOptions"
                     :key="item.queryField"
-                    v-show="!item.hidden"
                     :span="24">
                     <el-col :span="5">
                         <div class="grid-content">
-                            <el-select placeholder="璇烽�夋嫨" v-model="searchFormArrays[index].queryField">
+                            <el-select disabled placeholder="璇烽�夋嫨" v-model="searchFormArrays[index].queryField">
                                 <el-option
-                                    v-for="feildName in initOptions"
+                                    v-for="feildName in options"
                                     :key="feildName.queryField"
                                     :label="feildName.title"
                                     :value="feildName.queryField">
@@ -53,7 +52,8 @@
                         <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.fieldType==='text' || item.fieldType==='combox' ? 
+                                    item.fieldType==='text' ? searchConditions:switchSearchConditions:dateConditions"
                                     :key="condition.value"
                                     :label="condition.label"
                                     :value="condition.value">
@@ -67,12 +67,17 @@
                             <el-select v-else-if="item.fieldType==='combox'" v-model="searchFormArrays[index].fieldValue" placeholder="璇烽�夋嫨">
                                 <el-option
                                     v-for="option in item.data"
-                                    :key="option.value"
-                                    :label="option.key"
-                                    :value="option.value">
+                                    :key="option.itemValue"
+                                    :label="option.itemName"
+                                    :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==='date'"
+                                v-model="searchFormArrays[index].fieldValue"
+                                type="date"
+                                placeholder="閫夋嫨鏃ユ湡">
+                            </el-date-picker>
                         </div>
                     </el-col>
                     <el-col :span="2">
@@ -107,7 +112,7 @@
             // 瀵硅瘽妗嗘樉绀烘帶鍒�
             isShowDialog: this.visible,
             initOptions: [],
-            // 瀛楁鏄緭鍏ユ绫诲瀷鐨勬潯浠舵暟缁�
+            // 瀛楁绫诲瀷鏄緭鍏ユ绫诲瀷鐨勬潯浠舵暟缁�
             searchConditions: [
                 {
                     value: "_equal",
@@ -121,15 +126,9 @@
                 },{
                     value: "_notlike",
                     label: "涓嶅寘鍚�",
-                },{
-                    value: "_ge", //澶т簬锛岄粯璁や负澶т簬绛変簬
-                    label: "澶т簬", 
-                },{
-                    value: "_le", //灏忎簬锛岄粯璁や负灏忎簬绛変簬
-                    label: "灏忎簬",
-                },
+                }
             ],
-            // 瀛楁鏄崟閫夋垨涓嬫媺妗嗙被鍨嬬殑鏉′欢鏁扮粍
+            // 瀛楁绫诲瀷鏄崟閫夋垨涓嬫媺妗嗙被鍨嬬殑鏉′欢鏁扮粍
             switchSearchConditions: [
                 {
                     value: "_equal",
@@ -138,6 +137,22 @@
                     value: "_notequal",
                     label: "涓嶇瓑浜�",
                 }
+            ],
+            // 瀛楁绫诲瀷鏄棩鏈�
+            dateConditions: [
+                {
+                    value: "_equal",
+                    label: "绛変簬",
+                },{
+                    value: "_notequal",
+                    label: "涓嶇瓑浜�",
+                },{
+                    value: "_ge", //澶т簬锛岄粯璁や负澶т簬绛変簬
+                    label: "澶т簬", 
+                },{
+                    value: "_le", //灏忎簬锛岄粯璁や负灏忎簬绛変簬
+                    label: "灏忎簬",
+                },
             ],
             searchFormArrays: [],
             fieldValue: '',
@@ -156,11 +171,15 @@
             //console.log(this.initOptions); 
             this.initOptions.forEach((item,index) => {
                 if(item.fieldType==='combox') {
-
-                   this.getEnum(item.comboxKey).then(res=>{
-                        console.log(res.data);
-                   })
-                   //item.data = 
+                    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),
@@ -172,22 +191,34 @@
             //console.log(this.searchFormArrays);
         }
     },
-    created () {
-        
-    },
     methods: {
 
-        async getEnum(enumText){
-            let enumParam = '';
-            await getDictionary({code: enumText}).then(res=>{
-                enumParam = res.data.data;
-                // console.log(res.data);
-            })
-            //console.log(enumParam);
-            return enumParam;
-        },
+        // 灞炴�у垏鎹㈡椂鏌ヨ鏉′欢鍜屾煡璇㈠�间篃闇�瑕佸杈撳叆妗嗚繘琛屽垏鎹�
+        // changeField(index) {
+        //     //console.log(option,this.searchFormArrays[index],index);
+        //     // 鎵惧埌鏁扮粍涓搴旂殑瑕佸垏鎹负鐨勯偅涓璞�
+        //     let changeItem = this.options.filter((item)=>{
+        //         return item.queryField == this.searchFormArrays[index].queryField;
+        //     })[0]
+        //     // 濡傛灉鏄痗ombox绫诲瀷鐨勮繕闇�瑕佸鏋氫妇绫诲瀷杩涜璇锋眰
+        //     if(changeItem.fieldType==='combox' && changeItem.comboxKey != '') {
+        //         changeItem.data = JSON.parse(localStorage.getItem(changeItem.comboxKey));
+        //     }
+        //     //console.log(changeItem.fieldType);
+        //     // 灏嗗綋鍓嶅垏鎹㈢殑閰嶇疆椤硅祴鍊煎埌option鐨勫搴旂殑閭d釜瀵硅薄杩涜瑕嗙洊
+        //     this.initOptions[index] = changeItem;
+        //     // 瑕嗙洊v-model鐨勫璞�
+        //     this.searchFormArrays[index] = {
+        //         queryField: String(changeItem.queryField),
+        //         condition: changeItem.fieldType==='text' ? String("_like"):String("_equal"),
+        //         fieldValue: changeItem.fieldType==='truefalse' ? Boolean(false):String(""),
+        //     };
+        //     //console.log(this.initOptions);
+        //     //console.log(this.searchFormArrays);
+        // },
 
         // 绉婚櫎鎼滅储妗�
+        
         removeInput(index){
             //console.log(this.initOptions);
             this.$delete(this.initOptions,index);
@@ -221,17 +252,18 @@
             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+']']+''.trim() != 'undefined' ) {
+                    if(condtionParam['conditionMap['+searchConditions[index].queryField+']']+'' != 'undefined' ) {
                         this.$message.warning("瀛樺湪閲嶅鏌ヨ鏉′欢锛岃浠旂粏鏍稿!");
+                        console.log(condtionParam['conditionMap['+searchConditions[index].queryField+']']);
                         return false;
                     }
                     //鎷兼帴鎴恗ap瀵硅薄锛屽皢鏌ヨ瀵硅薄鍜宑ondition鎷兼帴鍦ㄤ竴璧凤紝缁勬垚楂樼骇鏌ヨmap鐨刱ey
                     condtionParam['conditionMap['+searchConditions[index].queryField+searchConditions[index].condition+']'] = searchConditions[index].fieldValue;
                 }
             }
-            // 鏌ヨ鏉′欢娌℃湁鍑虹幇閲嶅灞炴�э紝骞朵笖杩囨护鎺変簡绌哄�硷紝浼犻�掔粰鐖剁粍浠�
+            // 鏌ヨ鏉′欢娌℃湁鍑虹幇閲嶅灞炴�э紝骞朵笖杩囨护鎺変簡绌哄�硷紝灏变紶閫掔粰鐖剁粍浠�
             // console.log(condtionParam);
             this.$emit('echoContion',condtionParam)
             this.isShowDialog = false;
@@ -300,6 +332,9 @@
         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