From d7e3c8a813f8f85c89c06782f1e36e8089ffc31b Mon Sep 17 00:00:00 2001 From: 田源 <tianyuan@vci-tech.com> Date: 星期四, 09 一月 2025 11:42:06 +0800 Subject: [PATCH] 集成模块回车查询报错问题 --- Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue | 103 +++++++++++++++++++++++++++------------------------ 1 files changed, 55 insertions(+), 48 deletions(-) diff --git a/Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue b/Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue index 4216767..92da52c 100644 --- a/Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue +++ b/Source/UBCS-WEB/src/components/dockingSearch/VciDockingSearch.vue @@ -1,20 +1,21 @@ <template> - <div style="display: flex" > + <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" :key="item.value" v-for="(item,index) in SearchObject.searchData"></el-option> + <el-option v-for="(item,index) in SearchObject.searchData" :key="item.value" :label="item.label" + :value="item.value"></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 == 'loge' && status.typeFlag)" size="small"> <el-select v-model="formInline.cut" placeholder="璇烽�夋嫨绫诲瀷"> <el-option label="鏁版嵁鎺ㄩ��" value="pushData"></el-option> @@ -29,15 +30,15 @@ <el-option label="浜哄憳鐢宠" value="syncDataForPerson"></el-option> </el-select> </el-form-item> -<!-- 闆嗘垚浠诲姟 鏄惁鎺ㄩ�佹垚鍔� -闆嗘垚鏁版嵁 鏄惁鍒嗚В浠诲姟--> + <!-- 闆嗘垚浠诲姟 鏄惁鎺ㄩ�佹垚鍔� + 闆嗘垚鏁版嵁 鏄惁鍒嗚В浠诲姟--> <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> @@ -45,30 +46,30 @@ <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-form-item v-if="((status.type == 'loge' ||status.type == 'task') && status.dateFlag)" size="small"> <el-date-picker v-model="formInline.Date" - type="date" - placeholder="閫夋嫨鏃ユ湡鏃堕棿"> + placeholder="閫夋嫨鏃ユ湡鏃堕棿" + type="date"> </el-date-picker> </el-form-item> -<!-- 闆嗘垚浠诲姟 鏈�鍚庢帹閫佹椂闂�--> - <el-form-item size="small" v-if="status.type == 'task' && status.lastDateFlag"> + <!-- 闆嗘垚浠诲姟 鏈�鍚庢帹閫佹椂闂�--> + <el-form-item v-if="status.type == 'task' && status.lastDateFlag" size="small"> <el-date-picker v-model="formInline.lastDate" - type="date" - placeholder="閫夋嫨鏃ユ湡鏃堕棿"> + placeholder="閫夋嫨鏃ユ湡鏃堕棿" + type="date"> </el-date-picker> </el-form-item> -<!-- 鍏敤妯″潡--> -<!-- 杈撳叆鍐呭--> - <el-form-item size="small" v-if="shouldShowInput"> + <!-- 鍏敤妯″潡--> + <!-- 杈撳叆鍐呭--> + <el-form-item v-if="shouldShowInput" size="small"> <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" @click="handleSearch">鏌ヨ</el-button> + <!-- 鏌ヨ鎸夐挳--> + <el-form-item v-if="shouldShowButton" size="small"> + <el-button size="small" type="success" @click="handleSearch">鏌ヨ</el-button> </el-form-item> </el-form> </div> @@ -78,12 +79,12 @@ import {getLogoList} from "@/api/docking/loge"; import {getDataList} from "@/api/docking/data"; import {getTaskList} from "@/api/docking/task"; + export default { name: "VciDockingSearch", - props:['SearchObject','page','formInline','status'], + props: ['SearchObject', 'page', 'formInline', 'status'], data() { - return { - } + return {} }, computed: { //杈撳叆妗嗗垽鏂� @@ -102,14 +103,14 @@ const isLogeType = this.status.type === 'loge'; const isTaskType = this.status.type === 'task'; const isDataType = this.status.type === 'data'; - return( + return ( (isLogeType && (this.status.dateFlag || this.status.stateFlag || this.status.typeFlag)) || (isTaskType && (this.status.stateTaskDataFlag || this.status.dateFlag || this.status.lastDateFlag || this.status.sendTypeFlga)) || (isDataType && (this.status.stateTaskDataFlag || this.status.sendTypeFlga)) ); } }, - methods:{ + methods: { SelectChange(val) { const logeType = this.status.type === 'loge'; const taskType = this.status.type === 'task'; @@ -121,43 +122,49 @@ 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; - const requestApi = (api) => { - api(this.page.currentPage, this.page.pageSize,'createTime','desc',{[`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); - } - }); + SaveHandler() { + let searchDataItem = Object.values(this.SearchObject.searchData).find(item => item.value === this.formInline.type); + let name = searchDataItem ? searchDataItem.prop : null; + if (!searchDataItem) { + this.$message.error('鏈壘鍒板搴旀悳绱㈢被鍨嬭鏌ョ湅鎺у埗鍙拌緭鍑猴紒') } + const requestApi = (api) => { + api(this.page.currentPage, this.page.pageSize, 'createTime', 'desc', {[`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); + } + }); + } + //鏃ュ織 - if(this.status.type=='loge'){ + if (this.status.type == 'loge') { requestApi(getLogoList); } //鏁版嵁 - if(this.status.type=='data'){ + if (this.status.type == 'data') { requestApi(getDataList); } //浠诲姟 - if(this.status.type=='task'){ + if (this.status.type == 'task') { requestApi(getTaskList); } }, 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 {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 = {}; const requestApi = (api) => { - api(currentPage, pageSize,'createTime','desc',requestParams).then(res => { - if(!res.data.data.records){ + api(currentPage, pageSize, 'createTime', 'desc', requestParams).then(res => { + if (!res.data.data.records) { this.$message.error('鏆傛湭鏌ュ埌鏁版嵁锛�'); } else { - let Data=res.data.data; - this.$emit('getList',Data); + let Data = res.data.data; + this.$emit('getList', Data); } }); } -- Gitblit v1.9.3