From 80ef464bf93212805d6b36f12b7791edda04e23e Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 15 九月 2023 09:36:22 +0800
Subject: [PATCH] 集成模块 搜索回显

---
 Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue |   95 +++++++++++++++++++++++++++++++++++++----------
 1 files changed, 74 insertions(+), 21 deletions(-)

diff --git a/Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue b/Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue
index 81b9f58..0edd298 100644
--- a/Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue
+++ b/Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue
@@ -1,21 +1,15 @@
 <template>
   <div style="display: flex" >
     <el-form :inline="true" :model="formInline" class="demo-form-inline">
+<!--      闆嗘垚鏃ュ織 浠诲姟 鏁版嵁鍏ㄩ儴鍏敤-->
       <el-form-item label="闆嗘垚鏌ヨ:" size="small">
         <el-select v-model="formInline.type" placeholder="璇烽�夋嫨鍒嗙被" @change="SelectChange">
-          <el-option :label="item.label" :value="item.value" v-for="item in SearchObject.searchData" ></el-option>
+          <el-option :label="item.label" :value="item.value" :key="item.value" v-for="(item,index) in SearchObject.searchData"></el-option>
         </el-select>
       </el-form-item>
-<!--      闆嗘垚鏃ュ織鏄惁鎴愬姛-->
+<!--      闆嗘垚鏃ュ織 鏄惁鎴愬姛-->
       <el-form-item v-if="(status.type == 'loge' && status.stateFlag)" size="small">
         <el-select v-model="formInline.state" placeholder="璇烽�夋嫨鐘舵��">
-          <el-option label="鏄�" value="true"></el-option>
-          <el-option label="鍚�" value="false"></el-option>
-        </el-select>
-      </el-form-item>
-<!--      闆嗘垚浠诲姟鏄惁鎺ㄩ�佹垚鍔�-->
-      <el-form-item v-if="(status.type == 'task' && status.stateTaskFlag)" size="small">
-        <el-select v-model="formInline.stateTask" placeholder="璇烽�夋嫨鐘舵��">
           <el-option label="鏄�" value="true"></el-option>
           <el-option label="鍚�" value="false"></el-option>
         </el-select>
@@ -32,15 +26,22 @@
           <el-option label="鏁版嵁鏌ヨ" value="queryData"></el-option>
         </el-select>
       </el-form-item>
-<!--      闆嗘垚浠诲姟鎺ㄩ�佺被鍨�-->
-      <el-form-item v-if="(status.type === 'task' && status.sendTypeFlga)" size="small">
+<!--      闆嗘垚浠诲姟 鏄惁鎺ㄩ�佹垚鍔�  闆嗘垚鏁版嵁  鏄惁鍒嗚В浠诲姟-->
+      <el-form-item v-if="((status.type == 'task' || status.type == 'data')&& status.stateTaskDataFlag)" size="small">
+        <el-select v-model="formInline.stateTask" placeholder="璇烽�夋嫨鐘舵��">
+          <el-option label="鏄�" value="true"></el-option>
+          <el-option label="鍚�" value="false"></el-option>
+        </el-select>
+      </el-form-item>
+<!--      闆嗘垚浠诲姟 闆嗘垚鏁版嵁 鎺ㄩ�佺被鍨�-->
+      <el-form-item v-if="((status.type === 'task' || status.type === 'data') && status.sendTypeFlga)" size="small">
         <el-select v-model="formInline.taskCut" placeholder="璇烽�夋嫨鎺ㄩ�佺被鍨�">
           <el-option label="鍙戝竷" value="Enabled"></el-option>
           <el-option label="鍥炴敹" value="TakeBack"></el-option>
           <el-option label="鍋滅敤" value="Disabled"></el-option>
         </el-select>
       </el-form-item>
-<!--      鍒涘缓鏃ユ湡-->
+<!--      闆嗘垚浠诲姟 鍒涘缓鏃ユ湡  闆嗘垚鏃ュ織 璁板綍鏃堕棿-->
       <el-form-item size="small" v-if="((status.type == 'loge' ||status.type == 'task') && status.dateFlag)">
         <el-date-picker
           v-model="formInline.Date"
@@ -48,7 +49,7 @@
           placeholder="閫夋嫨鏃ユ湡鏃堕棿">
         </el-date-picker>
       </el-form-item>
-<!--      鏈�鍚庢帹閫佹椂闂�-->
+<!--      闆嗘垚浠诲姟 鏈�鍚庢帹閫佹椂闂�-->
       <el-form-item size="small" v-if="status.type == 'task' && status.lastDateFlag">
         <el-date-picker
           v-model="formInline.lastDate"
@@ -56,13 +57,14 @@
           placeholder="閫夋嫨鏃ユ湡鏃堕棿">
         </el-date-picker>
       </el-form-item>
+<!--      鍏敤妯″潡-->
 <!--      杈撳叆鍐呭-->
       <el-form-item size="small" v-if="shouldShowInput">
-        <el-input v-model="formInline.text" placeholder="璇疯緭鍏ュ唴瀹�" @keyup.enter.native="SaveHandler"></el-input>
+        <el-input v-model="formInline.text" placeholder="鎸変笅鍥炶溅閿繘琛屾煡璇紒" @keyup.enter.native="SaveHandler"></el-input>
       </el-form-item>
 <!--      鏌ヨ鎸夐挳-->
       <el-form-item size="small" v-if="shouldShowButton">
-        <el-button type="success" size="small">鏌ヨ</el-button>
+        <el-button type="success" size="small" @click="handleSearch">鏌ヨ</el-button>
       </el-form-item>
     </el-form>
   </div>
@@ -82,18 +84,22 @@
     shouldShowInput() {
       const isLogeType = this.status.type === 'loge';
       const isTaskType = this.status.type === 'task';
+      const isDataType = this.status.type === 'data';
       return (
         (isLogeType && !this.status.stateFlag && !this.status.dateFlag && !this.status.typeFlag) ||
-        (isTaskType && !this.status.stateTaskFlag && !this.status.dateFlag && !this.status.lastDateFlag && !this.status.sendTypeFlga)
+        (isTaskType && !this.status.stateTaskDataFlag && !this.status.dateFlag && !this.status.lastDateFlag && !this.status.sendTypeFlga) ||
+        (isDataType && !this.status.stateTaskDataFlag && !this.status.sendTypeFlga)
       );
     },
     //鎸夐挳鍒ゆ柇
     shouldShowButton() {
       const isLogeType = this.status.type === 'loge';
       const isTaskType = this.status.type === 'task';
+      const isDataType = this.status.type === 'data';
       return(
         (isLogeType && (this.status.dateFlag || this.status.stateFlag || this.status.typeFlag)) ||
-        (isTaskType && (this.status.stateTaskFlag || this.status.dateFlag || this.status.lastDateFlag || this.status.sendTypeFlga))
+        (isTaskType && (this.status.stateTaskDataFlag || this.status.dateFlag || this.status.lastDateFlag || this.status.sendTypeFlga)) ||
+        (isDataType && (this.status.stateTaskDataFlag || this.status.sendTypeFlga))
       );
     }
   },
@@ -101,17 +107,64 @@
     SelectChange(val) {
       const logeType = this.status.type === 'loge';
       const taskType = this.status.type === 'task';
+      const dataType = this.status.type === 'data';
       this.status.typeFlag = logeType && val === 5;
       this.status.dateFlag = (logeType && val === 6) || (taskType && val === 6);
       this.status.stateFlag = logeType && val === 7;
-      this.status.stateTaskFlag = taskType && val === 8;
       this.status.lastDateFlag = taskType && val === 7;
-      this.status.sendTypeFlga = taskType && val === 5;
+      this.status.stateTaskDataFlag = (taskType && val === 8) || (dataType && val === 4);
+      this.status.sendTypeFlga = (taskType && val === 5) || (dataType && val === 3);
     },
     SaveHandler(){
       let name = this.SearchObject.searchData[this.formInline.type].prop;
-      getList(this.page.currentPage, this.page.pageSize, {[name]: this.formInline.text}).then(res => {
-        console.log(res);
+      getList(this.page.currentPage, this.page.pageSize, { [`conditionMap[${name}_like]`]: this.formInline.text}).then(res => {
+        if(!res.data.data.records){
+          this.$message.error('鏆傛湭鏌ュ埌鏁版嵁锛�')
+        }else {
+          let Data=res.data.data;
+          this.$emit('getList',Data);
+        }
+      });
+    },
+    handleSearch() {
+      const { type, typeFlag, stateFlag, stateTaskDataFlag, dateFlag, lastDateFlag ,sendTypeFlga} = this.status;
+      const { currentPage, pageSize } = this.page;
+      const { cut, state, stateTask, Date, lastDate, taskCut } = this.formInline;
+      const requestParams = {};
+      // 闆嗘垚鏃ュ織绫诲瀷
+      if (type === 'loge' && typeFlag) {
+        requestParams['conditionMap[type_like]'] = cut;
+      }
+      // 闆嗘垚鏃ュ織鏄惁鎴愬姛
+      if (type === 'loge' && stateFlag) {
+        requestParams['conditionMap[interfaceStatus_like]'] = state;
+      }
+      // 闆嗘垚浠诲姟 鏄惁鎺ㄩ�佹垚鍔�  闆嗘垚鏁版嵁  鏄惁鍒嗚В浠诲姟
+      if ((type === 'task' || type === 'data') && stateTaskDataFlag) {
+        requestParams['conditionMap[sendFlag_like]'] = stateTask;
+      }
+      // 闆嗘垚浠诲姟 鍒涘缓鏃ユ湡 鍜� 闆嗘垚鏃ュ織 璁板綍鏃堕棿
+      if ((type === 'loge' || type === 'task') && dateFlag) {
+        const formattedDate = this.$moment(Date).format('YYYY-M-D');
+        requestParams['conditionMap[createTime_like]'] = formattedDate;
+      }
+      // 闆嗘垚浠诲姟 鏈�鍚庢帹閫佹椂闂�
+      if (type === 'task' && lastDateFlag) {
+        const formattedDate = this.$moment(lastDate).format('YYYY-M-D');
+        requestParams['conditionMap[lastModifyTime_like]'] = formattedDate;
+      }
+      // 闆嗘垚浠诲姟 闆嗘垚鏁版嵁 鎺ㄩ�佺被鍨�
+      if ((type === 'task' || type === 'data') && sendTypeFlga) {
+        requestParams['conditionMap[sendType_like]'] = taskCut;
+      }
+      // 璇锋眰
+      getList(currentPage, pageSize, requestParams).then(res => {
+        if(!res.data.data.records){
+          this.$message.error('鏆傛湭鏌ュ埌鏁版嵁锛�')
+        }else {
+          let Data=res.data.data;
+          this.$emit('getList',Data);
+        }
       });
     }
   }

--
Gitblit v1.9.3