From c2e36c45578e63ad17c5e258c92d62d9ae03dadb Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期五, 30 五月 2025 11:55:52 +0800 Subject: [PATCH] Merge branch 'master' of ssh://114.215.109.124:29418/underway-vue --- src/components/search/SearchBar.vue | 120 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 110 insertions(+), 10 deletions(-) diff --git a/src/components/search/SearchBar.vue b/src/components/search/SearchBar.vue index 03e4082..16572cc 100644 --- a/src/components/search/SearchBar.vue +++ b/src/components/search/SearchBar.vue @@ -1,33 +1,133 @@ <template> - <BaseCard class="map-date-selector"> + <BaseCard size="middle-s" direction="down"> <template #content> <el-form :inline="true"> - <OptionMission v-model="formSearch.missionCode"></OptionMission> - <OptionType v-model="formSearch.type"></OptionType> + <OptionMission v-model="mission" @init-over="initOver"></OptionMission> + <OptionType + v-model="formSearch.deviceType" + @init-over="initOver" + ></OptionType> <OptionDevice - :type="formSearch.type" + :type="formSearch.deviceType" v-model="formSearch.deviceCode" + @init-over="initOver" ></OptionDevice> - <OptionTime v-model="formSearch.timeArray"></OptionTime> + <OptionTime + v-model="formSearch.timeArray" + :start-date="dateRange[0]" + :end-date="dateRange[1]" + ></OptionTime> + <el-button + :loading="loading" + type="primary" + class="el-button-custom" + @click="handleClick" + > + 鍒嗘瀽 + </el-button> </el-form> </template> </BaseCard> </template> <script> +// 鍙兘浼氭湁寤舵椂鍒濆鍖栫殑閫夐」鎬绘暟锛屽寘鎷蛋鑸换鍔°�佽澶囩被鍨嬨�佽澶囩紪鍙� +const MAX_INIT = 3; +// 宸插垵濮嬪寲鐨勯�夐」鏁� +let initCount = 0; +let initEvents = []; + // 鎼滅储妗� export default { + props: { + loading: Boolean, + searchTime: Array + }, data() { return { + mission: undefined, formSearch: { - missionCode: '', - type: '', + deviceType: '', deviceCode: '', timeArray: [] - } + }, + // 鍙�夋棩鏈熻寖鍥达紝鏍规嵁璧拌埅浠诲姟鍐冲畾 + dateRange: [] }; }, - method: {} + emits: ['search'], + watch: { + searchTime(nV, oV) { + if (nV != oV) { + this.formSearch.timeArray = this.searchTime; + } + }, + mission(nV, oV) { + if (nV != oV) { + this.onInit(() => { + setTimeout(() => { + // 寤舵椂璧嬪�硷紝鍥犱负deviceType鍜宒eviceCode涔熸湁榛樿鍒濆鍊� + this.formSearch.timeArray = [ + new Date(nV.startTime), + new Date(nV.endTime) + ]; + this.dateRange = [new Date(nV.startTime), new Date(nV.endTime)]; + this.formSearch.deviceType = nV.deviceType; + this.formSearch.deviceCode = nV.deviceCode; + // 浠h〃棣栨杩涘叆鐣岄潰锛屾鏃惰嚜鍔ㄦ墽琛岄涓换鍔$殑鏁版嵁鏌ヨ鎿嶄綔 + if (oV == undefined) { + this.handleClick(); + } + }, 500); + }); + } + } + }, + methods: { + // 鍚勯�夐」鍒濆鍖栧姞杞藉畬鎴愬垽瀹� + initOver() { + initCount++; + if (initCount == MAX_INIT && initEvents.length > 0) { + initEvents.forEach((e) => { + e(); + }); + initEvents = []; + } + }, + onInit(event) { + if (initCount == MAX_INIT) { + event(); + } else { + initEvents.push(event); + } + }, + handleClick() { + this.$emit('search', { ...this.formSearch, mission: this.mission }); + } + }, + created() { + initCount = 0; + initEvents = []; + } }; </script> -<style scoped></style> +<style scoped lang="scss"> +.map-date-selector { + display: inline-block; + position: relative; + /* left: 0; + right: 0; + top: 0px; */ + /* padding: 0 4px; */ + /* color: ffffffbd; */ + /* background-color: antiquewhite; */ +} + +.p-events-auto { +} + +.el-form-item { + margin-bottom: 0px; + margin-right: 8px !important; +} +</style> -- Gitblit v1.9.3