From e38ea524ec4107ed7f8b1d7491a4177632dd3402 Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期二, 15 十月 2024 11:26:26 +0800 Subject: [PATCH] 部分代码修正 --- src/api/fytz/userApi.js | 2 src/api/fysp/taskApi.js | 4 src/views/fysp/check/ProCheck.vue | 5 + src/views/fysp/task/components/CompDayTask.vue | 53 +++++++++++++++++ src/components.d.ts | 3 + src/views/fysp/check/components/CompProblemAddOrUpd.vue | 11 ++- .prettierrc.json | 2 src/views/fysp/check/components/CompProRecent.vue | 6 +- src/components/core/BaseContentLayout.vue | 30 ++++++++- src/views/fysp/task/TaskManage.vue | 59 ++++++++++++------- 10 files changed, 134 insertions(+), 41 deletions(-) diff --git a/.prettierrc.json b/.prettierrc.json index 5eb97e4..12e3a09 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -3,6 +3,6 @@ "semi": true, "tabWidth": 2, "singleQuote": true, - "printWidth": 100, + "printWidth": 80, "trailingComma": "none" } \ No newline at end of file diff --git a/src/api/fysp/taskApi.js b/src/api/fysp/taskApi.js index 3da40bd..da5ef7a 100644 --- a/src/api/fysp/taskApi.js +++ b/src/api/fysp/taskApi.js @@ -89,8 +89,8 @@ /** * 鑾峰彇瀛愪换鍔¢棶棰樿鎯� */ - async getProBySubtask(id) { - return await $fysp + getProBySubtask(id) { + return $fysp .get('problemlist/subtask', { params: { stGuid: id diff --git a/src/api/fytz/userApi.js b/src/api/fytz/userApi.js index 8c49db9..c93ecb6 100644 --- a/src/api/fytz/userApi.js +++ b/src/api/fytz/userApi.js @@ -45,7 +45,7 @@ * 閲嶇疆鐢ㄦ埛瀵嗙爜 */ resetPassword(id) { - return $fytz.post(`userInfo/resetPw?userId=${id}`).then((res) => res); + return $fytz.post(`userInfo/resetPw?userId=${id}`).then((res) => res.data); }, diff --git a/src/components.d.ts b/src/components.d.ts index 6523c81..ec0d630 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -11,12 +11,14 @@ BasePanelLayout: typeof import('./components/core/BasePanelLayout.vue')['default'] CompQuickSet: typeof import('./components/search-option/CompQuickSet.vue')['default'] Content: typeof import('./components/core/Content.vue')['default'] + ElAffix: typeof import('element-plus/es')['ElAffix'] ElAside: typeof import('element-plus/es')['ElAside'] ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElBadge: typeof import('element-plus/es')['ElBadge'] ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] ElButton: typeof import('element-plus/es')['ElButton'] + ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup'] ElCalendar: typeof import('element-plus/es')['ElCalendar'] ElCard: typeof import('element-plus/es')['ElCard'] ElCascader: typeof import('element-plus/es')['ElCascader'] @@ -42,6 +44,7 @@ ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElMenuItemGroup: typeof import('element-plus/es')['ElMenuItemGroup'] ElOption: typeof import('element-plus/es')['ElOption'] + ElPageHeader: typeof import('element-plus/es')['ElPageHeader'] ElPagination: typeof import('element-plus/es')['ElPagination'] ElPopover: typeof import('element-plus/es')['ElPopover'] ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] diff --git a/src/components/core/BaseContentLayout.vue b/src/components/core/BaseContentLayout.vue index a90aa16..ce92424 100644 --- a/src/components/core/BaseContentLayout.vue +++ b/src/components/core/BaseContentLayout.vue @@ -1,15 +1,15 @@ <template> <el-container> - <el-header class="el-header"> + <el-header ref="headerRef" class="el-header"> <slot name="header"></slot> </el-header> <el-container> - <el-aside class="el-aside"> + <el-aside class="el-aside" :style="'height: ' + mainHeight"> <el-scrollbar> <slot name="aside"></slot> </el-scrollbar> </el-aside> - <el-main class="el-main"> + <el-main class="el-main" :style="'height: ' + mainHeight"> <slot name="main"></slot> </el-main> </el-container> @@ -19,6 +19,26 @@ <script> export default { // 鍙充晶鎿嶄綔鐣岄潰鍩虹甯冨眬 + data() { + return { + mainHeight: 'calc(100vh - 60px * 2 - var(--el-main-padding) * 2)' + }; + }, + methods: { + // 鍐呭楂樺害 + calHeight() { + if (this.$refs.headerRef) { + const h1 = this.$refs.headerRef.$el.offsetHeight; + const h = h1; + return `calc(100vh - ${h}px - 60px - var(--el-main-padding) * 2)`; + } else { + return `calc(100vh - 60px * 2 - var(--el-main-padding) * 2)`; + } + } + }, + mounted() { + this.mainHeight = this.calHeight(); + } }; </script> @@ -26,7 +46,7 @@ .el-aside { /* width: initial; */ position: relative; - height: calc(100vh - 60px * 2 - 20px * 2); + /* height: calc(100vh - 60px * 2 - 20px * 2); */ /* background-color: aqua; */ /* overflow-y: auto; */ border-right: 1px solid var(--el-color-info-light-7); @@ -43,7 +63,7 @@ .el-main { position: relative; /* background-color: whitesmoke; */ - height: calc(100vh - 60px * 2 - 20px * 2); + /* height: calc(100vh - 60px * 2 - 20px * 2); */ padding: initial; padding-left: 20px; /* overflow: hidden; */ diff --git a/src/views/fysp/check/ProCheck.vue b/src/views/fysp/check/ProCheck.vue index 4be5761..1fc2217 100644 --- a/src/views/fysp/check/ProCheck.vue +++ b/src/views/fysp/check/ProCheck.vue @@ -237,8 +237,9 @@ }); }, // 鍏抽棴璁惧鍥惧脊绐� - beforeDeviceShowDialogclose() { - this.deviceShowDialog = false; + beforeDeviceShowDialogclose(done) { + // this.deviceShowDialog = false; + done() }, // 鍏抽棴浠绘剰鍥剧墖寮圭獥 beforeAnyPhotoDialogclose() { diff --git a/src/views/fysp/check/components/CompProRecent.vue b/src/views/fysp/check/components/CompProRecent.vue index 3dff972..c97fad2 100644 --- a/src/views/fysp/check/components/CompProRecent.vue +++ b/src/views/fysp/check/components/CompProRecent.vue @@ -155,11 +155,11 @@ /** * 鑾峰彇杩戞湡鎯呭喌 * */ - async getRecentPros() { + getRecentPros() { this.loading = true; this.subtaskCount = 0 // 鑾峰彇瀛愪换鍔″垪琛� - await taskApi.getSubtaskByScene(this.generateQueryParam()).then((subtasks) => { + taskApi.getSubtaskByScene(this.generateQueryParam()).then((subtasks) => { this.curProList = []; if (subtasks) { subtasks.forEach((subtask) => { @@ -175,7 +175,7 @@ this.loading = false; }, // 鏍规嵁瀛愪换鍔¤幏鍙栭噷闈㈢殑闂鍒楄〃 - async getProBySubtask(subtask) { + getProBySubtask(subtask) { taskApi.getProBySubtask(subtask.stGuid).then((pros) => { if (pros) { pros.forEach((pro) => { diff --git a/src/views/fysp/check/components/CompProblemAddOrUpd.vue b/src/views/fysp/check/components/CompProblemAddOrUpd.vue index 00f7751..19c20e3 100644 --- a/src/views/fysp/check/components/CompProblemAddOrUpd.vue +++ b/src/views/fysp/check/components/CompProblemAddOrUpd.vue @@ -311,11 +311,12 @@ return new Date(x.dlCreateTime) - new Date(y.dlCreateTime); // 闄嶅簭锛屽崌搴忓垯鍙嶄箣 }); }, - async getDeviceImgList() { + getDeviceImgList() { this.deviceImgObjList = []; - for (const deviceTopTypeElement of this.deviceTopTypes) { - const topTypeId = deviceTopTypeElement.id; - await deviceApi.fetchDevices(this.subtask.sceneId, topTypeId).then((result) => { + this.deviceTopTypes.forEach(e => { + + const topTypeId = e.id; + deviceApi.fetchDevices(this.subtask.sceneId, topTypeId).then((result) => { // 鏍囧噯鍖栧睘鎬у悕 for (let i = 0; i < result.data.length; i++) { var element = this.convertKeys(result.data[i]); @@ -355,7 +356,7 @@ .catch((err) => {}); } }); - } + }); }, initOptions() { if (this.problem == undefined || this.problem == null) { diff --git a/src/views/fysp/task/TaskManage.vue b/src/views/fysp/task/TaskManage.vue index 4239a94..7d1c5d4 100644 --- a/src/views/fysp/task/TaskManage.vue +++ b/src/views/fysp/task/TaskManage.vue @@ -3,7 +3,6 @@ <template #header> <FYSearchBar @search="search"> <template #options> - <!-- 鍖哄幙 --> <FYOptionLocation :allOption="true" :level="3" @@ -11,13 +10,14 @@ v-model:value="formSearch.locations" ></FYOptionLocation> </template> - <!-- <template #buttons> - <slot name="buttons"></slot> - </template> --> </FYSearchBar> </template> <template #aside> - <SideList :items="tasks" :loading="sideLoading" @item-click="chooseTask"></SideList> + <SideList + :items="tasks" + :loading="sideLoading" + @item-click="chooseTask" + ></SideList> </template> <template #main> <ToolBar @@ -33,35 +33,42 @@ > <el-row justify="space-between"> <div><el-text>鐩戠璁″垝</el-text></div> - <el-button type="warning" size="small" @click="editPlan">璁″垝璋冩暣</el-button> - <CompMonitorPlan :task="curTask.data"></CompMonitorPlan> + <el-button type="warning" size="small" @click="editPlan" + >璁″垝璋冩暣</el-button + > + <CompMonitorPlan + :task="curTask.data" + @date-change="onDateChange" + ></CompMonitorPlan> </el-row> <el-divider></el-divider> <el-row justify="space-between"> <div><el-text>鐩戠鍦烘櫙</el-text></div> - <el-button type="warning" size="small" @click="editTask">鍦烘櫙璋冩暣</el-button> + <el-button type="warning" size="small" @click="editTask" + >鍦烘櫙璋冩暣</el-button + > </el-row> <CompMonitorObj :data="curMonitorObjList"></CompMonitorObj> - <!-- <div><el-text>鐩戠鍦烘櫙</el-text></div> - <div> - <el-space wrap> - <ItemMonitorObj - v-for="item in curMonitorObjList" - :key="item.movid" - :item="item" - ></ItemMonitorObj> - </el-space> - </div> --> </el-scrollbar> <el-empty v-else description="鏆傛棤璁板綍" v-loading="mainLoading" /> </template> </BaseContentLayout> + <el-drawer + v-model="subTaskDrawer" + title="鍗曟棩璁″垝" + direction="btt" + size="80%" + destroy-on-close + > + <CompDayTask :day-task="curDayTask"></CompDayTask> + </el-drawer> </template> <script> import taskApi from '@/api/fysp/taskApi'; import CompMonitorObj from './components/CompMonitorObj.vue'; import CompMonitorPlan from './components/CompMonitorPlan.vue'; +import CompDayTask from './components/CompDayTask.vue'; export default { beforeRouteEnter(to, from, next) { // 鍦ㄦ覆鏌撹缁勪欢鐨勫搴旇矾鐢辫楠岃瘉鍓嶈皟鐢� @@ -73,7 +80,7 @@ } }); }, - components: { CompMonitorObj, CompMonitorPlan }, + components: { CompMonitorObj, CompMonitorPlan, CompDayTask }, data() { return { formSearch: { @@ -104,7 +111,11 @@ // name: '鍦烘櫙璋冩暣', // color: 'warning' // } - ] + ], + // 瀛愪换鍔$紪杈戝脊鍑烘 + subTaskDrawer: false, + // 褰撳墠閫夋嫨鐨勬棩浠诲姟 + curDayTask: {} }; }, computed: { @@ -182,14 +193,18 @@ } }); }, - editPlan(){ + editPlan() { this.$router.push({ name: 'monitorPlanEdit', query: { data: encodeURIComponent(JSON.stringify(this.curMonitorObjList)), - task: encodeURIComponent(JSON.stringify(this.curTask.data)), + task: encodeURIComponent(JSON.stringify(this.curTask.data)) } }); + }, + onDateChange(dayTask) { + this.subTaskDrawer = true; + this.curDayTask = dayTask; } }, mounted() { diff --git a/src/views/fysp/task/components/CompDayTask.vue b/src/views/fysp/task/components/CompDayTask.vue new file mode 100644 index 0000000..9617c22 --- /dev/null +++ b/src/views/fysp/task/components/CompDayTask.vue @@ -0,0 +1,53 @@ +<template> + <el-row justify="space-between"> + <el-text>鍗曟棩璁″垝</el-text> + <el-button type="success" size="small" @click="editTask">鏂板</el-button> + </el-row> + <el-divider /> + <ItemSubTask v-for="stask in curSubTaskList" :key="stask.guid" :item="stask"> + <template #default="{ item }"> + <el-button type="danger" size="small" @click="editTask">绉婚櫎</el-button> + </template> + </ItemSubTask> +</template> +<script setup> +import { ref, watch, onMounted } from 'vue'; +import taskApi from '@/api/fysp/taskApi'; + +const props = defineProps({ + // 鏃ヤ换鍔� + dayTask: Object +}); + +// 宸℃煡瀛愪换鍔¢泦鍚� +const curSubTaskList = ref([]); + +// 鐩戝惉鏃ヤ换鍔″彉鍖� +watch( + () => props.dayTask, + (nV, oV) => { + // if (nV != oV) { + // onDayTaskChange(nV) + // } + onDayTaskChange(nV) + }, + { immediate: true } +); + +// 鏍规嵁鏃ヤ换鍔¤幏鍙栧搴斿瓙浠诲姟 +function onDayTaskChange(dayTask) { + if (dayTask) { + fetchSubTask(dayTask.guid); + } else { + curSubTaskList.value = []; + } +} + +// 鑾峰彇宸℃煡瀛愪换鍔� +function fetchSubTask(dayTaskId) { + taskApi.fetchSubtaskByDayTask(dayTaskId).then((res) => { + curSubTaskList.value = res; + }); +} +</script> +<style scoped></style> -- Gitblit v1.9.3