Commit 5cb33b906f4df395ba5c2f6cb179fe2757046c89
1 parent
83208d2e
完成巡查计划 详情
Showing
12 changed files
with
400 additions
and
140 deletions
api/patrol-manage/patrol-plan.js
| ... | ... | @@ -26,10 +26,20 @@ export const inspectionPlanDetail = (data) => { |
| 26 | 26 | return post('/app-api/app/garden/inspection-plan-detail/get-details',data); |
| 27 | 27 | }; |
| 28 | 28 | |
| 29 | + | |
| 30 | +// app-api/app/garden/inspection-plan-commit/get/by/plan_no?plan_no=P1765032669066674' | |
| 31 | +/** | |
| 32 | + * 巡查计划完成详情 | |
| 33 | + * @returns {Promise} | |
| 34 | + */ | |
| 35 | +export const inspectioDetailByPlanno = (params) => { | |
| 36 | + return get('/app-api/app/garden/inspection-plan-commit/get/by/plan_no',params); | |
| 37 | +}; | |
| 38 | + | |
| 29 | 39 | /** |
| 30 | - * 模块列表用这个 | |
| 40 | + * 巡查计划完成详情 | |
| 31 | 41 | * @returns {Promise} |
| 32 | 42 | */ |
| 33 | -export const moduleList = () => { | |
| 34 | - return get('/app-api/member/app-module/list'); | |
| 43 | +export const inspectionCreate = (data) => { | |
| 44 | + return post('/app-api/app/garden/inspection-plan-commit/create',data); | |
| 35 | 45 | }; | ... | ... |
common/utils/dict.js
| ... | ... | @@ -68,4 +68,73 @@ export const getDictSimpleList = (dictType) => { |
| 68 | 68 | value: item.value || '', |
| 69 | 69 | label: item.label || '' |
| 70 | 70 | })); |
| 71 | +}; | |
| 72 | + | |
| 73 | +/** | |
| 74 | + * 字典格式转换工具:{label, value} ↔ {name, value}(兼容笔误的vulue,同时支持正确value) | |
| 75 | + * 注:若需转换为 {name, vulue}(拼写错误),代码中已兼容,可按需切换 | |
| 76 | + */ | |
| 77 | + | |
| 78 | +/** | |
| 79 | + * 核心转换:将 {label, value} 数组转换为 {name, value} 数组(主流正确写法) | |
| 80 | + * @param {Array} list 源数组,例:[{label: "绿地卫生", value: "绿地卫生"}] | |
| 81 | + * @returns {Array} 转换后数组,例:[{name: "绿地卫生", value: "绿地卫生"}] | |
| 82 | + */ | |
| 83 | +export const transformLabelValueToNameValue = (list) => { | |
| 84 | + // 空值保护:非数组直接返回空数组 | |
| 85 | + if (!Array.isArray(list) || list.length === 0) return []; | |
| 86 | + | |
| 87 | + return list.map(item => { | |
| 88 | + // 兼容item为null/undefined的情况,兜底空字符串 | |
| 89 | + const safeItem = item || {}; | |
| 90 | + return { | |
| 91 | + name: safeItem.label || '', | |
| 92 | + value: safeItem.value || '' // 正确的value字段 | |
| 93 | + // 若需转换为 vulue(拼写错误),替换为:vulue: safeItem.value || '' | |
| 94 | + }; | |
| 95 | + }); | |
| 96 | +}; | |
| 97 | + | |
| 98 | +/** | |
| 99 | + * 单对象转换:将 {label, value} 转换为 {name, value} | |
| 100 | + * @param {Object} item 源对象,例:{label: "绿地卫生", value: "绿地卫生"} | |
| 101 | + * @returns {Object} 转换后对象,例:{name: "绿地卫生", value: "绿地卫生"} | |
| 102 | + */ | |
| 103 | +export const transformSingleLabelValueToNameValue = (item) => { | |
| 104 | + const safeItem = item || {}; | |
| 105 | + return { | |
| 106 | + name: safeItem.label || '', | |
| 107 | + value: safeItem.value || '' | |
| 108 | + // 若需 vulue:vulue: safeItem.value || '' | |
| 109 | + }; | |
| 110 | +}; | |
| 111 | + | |
| 112 | +/** | |
| 113 | + * 反向转换:{name, value} → {label, value}(可选,用于回显) | |
| 114 | + * @param {Array} list 源数组 | |
| 115 | + * @returns {Array} 转换后数组 | |
| 116 | + */ | |
| 117 | +export const transformNameValueToLabelValue = (list) => { | |
| 118 | + if (!Array.isArray(list) || list.length === 0) return []; | |
| 119 | + | |
| 120 | + return list.map(item => { | |
| 121 | + const safeItem = item || {}; | |
| 122 | + return { | |
| 123 | + label: safeItem.name || '', | |
| 124 | + value: safeItem.value || safeItem.vulue || '' // 兼容vulue拼写错误 | |
| 125 | + }; | |
| 126 | + }); | |
| 127 | +}; | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | +// 导出全部方法的集合(方便全局注册) | |
| 132 | +export default { | |
| 133 | + getDictList, | |
| 134 | + getDictLabel, | |
| 135 | + getDictValue, | |
| 136 | + getDictSimpleList, | |
| 137 | + transformLabelValueToNameValue, | |
| 138 | + transformSingleLabelValueToNameValue, | |
| 139 | + transformNameValueToLabelValue | |
| 71 | 140 | }; |
| 72 | 141 | \ No newline at end of file | ... | ... |
main.js
| ... | ... | @@ -5,10 +5,11 @@ import uviewPlus from '@/uni_modules/uview-plus' |
| 5 | 5 | import pinia from '@/pinia/index' |
| 6 | 6 | import EmptyView from '@/components/empty-view/empty-view.vue'; |
| 7 | 7 | import UploadImage from '@/components/upload-image/upload-image.vue'; |
| 8 | - | |
| 8 | +import dictUtils from '@/common/utils/dict'; | |
| 9 | 9 | // #ifdef VUE3 |
| 10 | 10 | import { createSSRApp } from 'vue' |
| 11 | - | |
| 11 | +// 挂载到uni全局 | |
| 12 | +uni.$dict = dictUtils; | |
| 12 | 13 | export function createApp() { |
| 13 | 14 | // 2. 创建 Vue 实例 |
| 14 | 15 | const app = createSSRApp(App) |
| ... | ... | @@ -18,6 +19,8 @@ export function createApp() { |
| 18 | 19 | |
| 19 | 20 | // 4. 注册 Pinia(核心:在 app 挂载前注册) |
| 20 | 21 | app.use(pinia) |
| 22 | + // 全局注入字典工具(关键:provide需在app实例上注册) | |
| 23 | + // app.provide('$dict', dictUtils); | |
| 21 | 24 | app.component('EmptyView', EmptyView) |
| 22 | 25 | app.component('UploadImage', UploadImage) |
| 23 | 26 | // 5. 返回 app + pinia(可选,便于调试) |
| ... | ... | @@ -29,21 +32,3 @@ export function createApp() { |
| 29 | 32 | // #endif |
| 30 | 33 | |
| 31 | 34 | |
| 32 | -// 全局注册(可选):如果需要全局使用,可在 main.js 中注册为全局方法: | |
| 33 | -// javascript | |
| 34 | -// 运行 | |
| 35 | -// import { createSSRApp } from 'vue'; | |
| 36 | -// import * as dictUtils from '@/utils/dict'; | |
| 37 | -// | |
| 38 | -// export function createApp() { | |
| 39 | -// const app = createSSRApp(App); | |
| 40 | -// // 注册全局字典方法 | |
| 41 | -// app.config.globalProperties.$dict = dictUtils; | |
| 42 | -// return { app }; | |
| 43 | -// } | |
| 44 | -// 组件中使用: | |
| 45 | -// javascript | |
| 46 | -// 运行 | |
| 47 | -// import { getCurrentInstance } from 'vue'; | |
| 48 | -// const { proxy } = getCurrentInstance(); | |
| 49 | -// const label = proxy.$dict.getDictLabel('ai_image_status', 10); | ... | ... |
pages-sub/daily/patrol-manage/add-patrol-record/index.vue
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | del-color="#ff4d4f" |
| 41 | 41 | class="upload-wrap" |
| 42 | 42 | ></up-upload> |
| 43 | - <view class="tips">(最少1张,最多3张)</view> | |
| 43 | +<!-- <view class="tips">(最少1张,最多3张)</view>--> | |
| 44 | 44 | </up-form-item> |
| 45 | 45 | |
| 46 | 46 | <!-- 3. 转为工单(单选框) --> |
| ... | ... | @@ -92,6 +92,8 @@ const inspectFormRef = ref<UniFormRef>(null) |
| 92 | 92 | |
| 93 | 93 | <script lang="ts"> |
| 94 | 94 | import { uploadImages } from '@/common/utils/upload'; |
| 95 | +import { inspectionCreate } from "@/api/patrol-manage/patrol-plan"; | |
| 96 | + | |
| 95 | 97 | |
| 96 | 98 | export default { |
| 97 | 99 | data() { |
| ... | ... | @@ -100,14 +102,15 @@ export default { |
| 100 | 102 | imagesList: [], |
| 101 | 103 | // 单选列表 |
| 102 | 104 | radioList: [ |
| 103 | - { label: '是', value: '1' }, | |
| 104 | - { label: '否', value: '2' } | |
| 105 | + { label: '是', value: '2' }, | |
| 106 | + { label: '否', value: '1' } | |
| 105 | 107 | ], |
| 106 | 108 | // 巡查表单数据 |
| 107 | 109 | inspectForm: { |
| 108 | 110 | content: '', // 巡查描述 |
| 109 | - isWorkOrder: '1' // 是否转为工单 1:是(默认) 2:否 | |
| 111 | + isWorkOrder: '2' // 是否转为工单 1:否(默认) 2:是 | |
| 110 | 112 | }, |
| 113 | + paramsOptins:{},//接受参数 | |
| 111 | 114 | // 表单校验规则 |
| 112 | 115 | inspectFormRules: { |
| 113 | 116 | images: [ |
| ... | ... | @@ -136,6 +139,10 @@ export default { |
| 136 | 139 | } |
| 137 | 140 | } |
| 138 | 141 | }, |
| 142 | + onLoad(option){ | |
| 143 | + console.log(option) | |
| 144 | + this.paramsOptins = option | |
| 145 | + }, | |
| 139 | 146 | onReady() { |
| 140 | 147 | // 兼容微信小程序,通过setRules设置校验规则 |
| 141 | 148 | this.$refs.inspectFormRef.setRules(this.inspectFormRules) |
| ... | ... | @@ -246,39 +253,42 @@ export default { |
| 246 | 253 | try { |
| 247 | 254 | // 先执行表单校验 |
| 248 | 255 | await this.$refs.inspectFormRef.validate() |
| 249 | - | |
| 256 | + console.log(this.imagesList) | |
| 250 | 257 | // 构造提交数据 |
| 251 | 258 | const submitData = { |
| 252 | - content: this.inspectForm.content, | |
| 253 | - images: this.getImgUrlList(this.imagesList), | |
| 254 | - isWorkOrder: this.inspectForm.isWorkOrder // 1=是,2=否 | |
| 259 | + // content: this.inspectForm.content, | |
| 260 | + // images: this.getImgUrlList(this.imagesList), | |
| 261 | + // isWorkOrder: this.inspectForm.isWorkOrder // 1=否,2=是 | |
| 262 | + | |
| 263 | + | |
| 264 | + "batchNo": this.paramsOptins.batchNo, | |
| 265 | + "planNo":this.paramsOptins.planNo, | |
| 266 | + "imgHost": "1", | |
| 267 | + "imgList": this.getImgUrlList(this.imagesList), | |
| 268 | + "inspectionState": this.inspectForm.isWorkOrder, | |
| 269 | + "transState": this.inspectForm.isWorkOrder==1?'1':'2', | |
| 270 | + "transWorkNo": "default'", | |
| 271 | + "remark": this.inspectForm.isWorkOrder | |
| 255 | 272 | } |
| 256 | 273 | |
| 257 | 274 | // 显示加载中 |
| 258 | 275 | uni.showLoading({ title: '提交中...' }) |
| 259 | 276 | |
| 260 | - // 这里替换为实际的接口调用 | |
| 261 | - // const res = await yourSubmitApi(submitData) | |
| 262 | - | |
| 263 | - // 模拟接口调用延迟 | |
| 264 | - await new Promise(resolve => setTimeout(resolve, 1500)) | |
| 277 | + await inspectionCreate(submitData) | |
| 265 | 278 | |
| 266 | 279 | uni.hideLoading() |
| 267 | 280 | uni.showToast({ |
| 268 | 281 | title: '提交成功', |
| 269 | 282 | icon: 'success', |
| 270 | - duration: 1500 | |
| 283 | + duration: 1000 | |
| 271 | 284 | }) |
| 272 | 285 | |
| 273 | - // 重置表单(保留默认值:转为工单=是) | |
| 286 | + // // 延迟跳转(等待提示框显示完成) | |
| 274 | 287 | setTimeout(() => { |
| 275 | - this.$refs.inspectFormRef.resetFields() | |
| 276 | - this.imagesList = [] | |
| 277 | - this.inspectForm = { | |
| 278 | - content: '', | |
| 279 | - isWorkOrder: '1' // 重置后仍默认选中“是” | |
| 280 | - } | |
| 281 | - }, 1500) | |
| 288 | + uni.redirectTo({ | |
| 289 | + url: '/pages-sub/patrol-manage/patrol-plan/index' | |
| 290 | + }) | |
| 291 | + }, 1000) | |
| 282 | 292 | |
| 283 | 293 | } catch (error) { |
| 284 | 294 | // 隐藏加载框 | ... | ... |
pages-sub/daily/patrol-manage/finish-plan-detail/index.vue
| 1 | -<script setup lang="ts"> | |
| 1 | +<template> | |
| 2 | + <view class="u-page"> | |
| 3 | + <!-- 页面级加载组件 --> | |
| 4 | + <up-loading-page | |
| 5 | + v-if="loading" | |
| 6 | + :loading="true" | |
| 7 | + title="加载中..." | |
| 8 | + color="#3c9cff" | |
| 9 | + ></up-loading-page> | |
| 2 | 10 | |
| 3 | -</script> | |
| 11 | + <!-- 内容容器 --> | |
| 12 | + <view v-else class="content-wrap"> | |
| 13 | + | |
| 14 | + | |
| 15 | + <template v-for="(i, index) in orderDetail" :key="index"> | |
| 16 | + <!-- 工单详情内容 --> | |
| 17 | + <up-cell-group :border="false" inset style="margin: 20rpx;"> | |
| 18 | + <!-- 1. 工单编号 --> | |
| 19 | + <up-cell | |
| 20 | + :title="i.planName" | |
| 21 | + | |
| 22 | + class="up-line-1" | |
| 23 | + align="middle" | |
| 24 | + ></up-cell> | |
| 25 | + | |
| 26 | + <!-- 2. 工单位置 --> | |
| 27 | + <up-cell | |
| 28 | + title="计划编码" | |
| 29 | + :value="i.planNo || '--'" | |
| 30 | + class="up-line-1" | |
| 31 | + align="middle" | |
| 32 | + ></up-cell> | |
| 33 | + | |
| 34 | + <!-- 3. 工单名称 --> | |
| 35 | + <up-cell | |
| 36 | + title="养护周期" | |
| 37 | + :value="`${i.rate}${uni.$dict.getDictLabel('cycle_id_type', i.cycleId)}`" | |
| 38 | + class="up-line-1" | |
| 39 | + align="middle" | |
| 40 | + ></up-cell> | |
| 41 | + | |
| 42 | + <!-- 4. 情况描述 --> | |
| 43 | + <up-cell | |
| 44 | + title="计划有效期" | |
| 45 | + :value="`${timeFormat(i.beginTime,'yy-mm-dd hh:MM:ss')} 至 ${timeFormat(i. endTime,'yy-mm-dd hh:MM:ss')}`" | |
| 46 | + class="up-line-1" | |
| 47 | + align="middle" | |
| 48 | + ></up-cell> | |
| 49 | + | |
| 50 | + <!-- 5. 问题照片(核心修复:判断条件+空值处理) --> | |
| 51 | + <up-cell title="照片" > | |
| 52 | + <template #value> | |
| 53 | + <view class="cell-content-wrap"> | |
| 54 | + | |
| 55 | + <!-- 修复1:正确判断problemImgsList,补充空数组默认值 --> | |
| 56 | + <up-album | |
| 57 | + v-if="!!i.imgList?.length" | |
| 58 | + :urls="i.imgList || []" | |
| 59 | + singleSize="70" | |
| 60 | + :preview-full-image="true" | |
| 61 | + | |
| 62 | + ></up-album> | |
| 63 | + <text v-else class="empty-text">暂无问题照片</text> | |
| 64 | + </view> | |
| 65 | + </template> | |
| 66 | + </up-cell> | |
| 67 | + | |
| 68 | + <!-- 7. 处理结果 --> | |
| 69 | + <up-cell | |
| 70 | + title="巡查描述" | |
| 71 | + :value="i.remark || '--'" | |
| 72 | + class="up-line-1" | |
| 73 | + align="middle" | |
| 74 | + :border="false" | |
| 75 | + ></up-cell> | |
| 76 | + | |
| 77 | + <up-cell | |
| 78 | + title="提交时间" | |
| 79 | + :value="timeFormat(i.finishTime,'yy-mm-dd hh:MM:ss') || '--'" | |
| 80 | + class="up-line-1" | |
| 81 | + align="middle" | |
| 82 | + :border="false" | |
| 83 | + ></up-cell> | |
| 84 | + | |
| 85 | + | |
| 86 | + <up-cell | |
| 87 | + title="提交人" | |
| 88 | + :value="i.userName || '--'" | |
| 89 | + class="up-line-1" | |
| 90 | + align="middle" | |
| 91 | + :border="false" | |
| 92 | + ></up-cell> | |
| 93 | + </up-cell-group> | |
| 94 | + </template> | |
| 4 | 95 | |
| 5 | -<template> | |
| 6 | 96 | |
| 97 | + </view> | |
| 98 | + </view> | |
| 7 | 99 | </template> |
| 8 | 100 | |
| 101 | +<script setup lang="ts"> | |
| 102 | +import { ref, reactive } from 'vue'; | |
| 103 | +import { inspectioDetailByPlanno } from "@/api/patrol-manage/patrol-plan"; | |
| 104 | +import { onLoad, onShow } from '@dcloudio/uni-app'; | |
| 105 | +import { timeFormat } from '@/uni_modules/uview-plus'; | |
| 106 | +// 状态管理 | |
| 107 | +const loading = ref(true); | |
| 108 | +const orderDetail = ref([]); | |
| 109 | + | |
| 110 | + | |
| 111 | +/** | |
| 112 | + * 获取工单详情 | |
| 113 | + */ | |
| 114 | +const getOrderDetail = async (plan_no: string) => { | |
| 115 | + try { | |
| 116 | + loading.value = true; | |
| 117 | + const res = await inspectioDetailByPlanno({ plan_no }); | |
| 118 | + console.log('接口返回:', res); | |
| 119 | + // 优化:确保图片数组为数组类型,避免非数组导致渲染错误 | |
| 120 | + orderDetail.value = { | |
| 121 | + ...res, | |
| 122 | + problemImgsList: Array.isArray(res.problemImgsList) ? res.problemImgsList : [], | |
| 123 | + completeImgsList: Array.isArray(res.completeImgsList) ? res.completeImgsList : [] | |
| 124 | + }; | |
| 125 | + } catch (error) { | |
| 126 | + console.error('获取工单详情失败:', error); | |
| 127 | + uni.showToast({ title: '加载失败,请重试', icon: 'none' }); | |
| 128 | + } finally { | |
| 129 | + loading.value = false; | |
| 130 | + } | |
| 131 | +}; | |
| 132 | + | |
| 133 | +// 页面加载 | |
| 134 | +onLoad((options) => { | |
| 135 | + const { planNo } = options; | |
| 136 | + if (planNo) { | |
| 137 | + getOrderDetail(planNo); | |
| 138 | + } else { | |
| 139 | + loading.value = false; | |
| 140 | + uni.showToast({ title: '缺少工单ID', icon: 'none' }); | |
| 141 | + } | |
| 142 | +}); | |
| 143 | +</script> | |
| 144 | + | |
| 9 | 145 | <style scoped lang="scss"> |
| 146 | +// 页面基础样式 | |
| 147 | +.u-page { | |
| 148 | + min-height: 100vh; | |
| 149 | + background-color: #f5f5f5; | |
| 150 | + box-sizing: border-box; | |
| 151 | +} | |
| 152 | + | |
| 153 | +// 内容容器 | |
| 154 | +.content-wrap { | |
| 155 | + background: #fff; | |
| 156 | + width: 100%; | |
| 157 | + box-sizing: border-box; | |
| 158 | + overflow-y: auto; | |
| 159 | + min-height: calc(100vh - 40rpx); | |
| 160 | +} | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | +// 空文本样式 | |
| 165 | +.empty-text { | |
| 166 | + color: #999; | |
| 167 | + font-size: 28rpx; | |
| 168 | + line-height: 80rpx; | |
| 169 | + display: block; | |
| 170 | + text-align: left; | |
| 171 | +} | |
| 172 | + | |
| 173 | +// 优化uview组件样式 | |
| 174 | +:deep(.up-cell-group) { | |
| 175 | + --u-cell-group-background-color: #fff; | |
| 176 | + --u-cell-group-border-radius: 12rpx; | |
| 177 | + --u-cell-group-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05); | |
| 178 | +} | |
| 179 | + | |
| 180 | +:deep(.up-cell) { | |
| 181 | + --u-cell-title-font-size: 28rpx; | |
| 182 | + --u-cell-value-font-size: 28rpx; | |
| 183 | + --u-cell-title-color: #666; | |
| 184 | + --u-cell-value-color: #333; | |
| 185 | + --u-cell-padding: 20rpx 15rpx; | |
| 186 | + --u-cell-border-color: #f5f5f5; | |
| 187 | +} | |
| 188 | + | |
| 189 | +// 相册样式优化(关键:适配图片展示) | |
| 190 | +:deep(.up-album) { | |
| 191 | + width: 100%; | |
| 192 | + box-sizing: border-box; | |
| 193 | +} | |
| 194 | + | |
| 195 | +:deep(.up-album__list) { | |
| 196 | + display: flex; | |
| 197 | + flex-wrap: wrap; | |
| 198 | + padding: 0; | |
| 199 | + margin: 0; | |
| 200 | +} | |
| 201 | + | |
| 202 | +:deep(.up-album__item) { | |
| 203 | + width: calc(33.333% - 10rpx); | |
| 204 | + height: 200rpx; // 固定图片高度,避免变形 | |
| 205 | + margin: 5rpx; | |
| 206 | + border-radius: 8rpx; | |
| 207 | + overflow: hidden; | |
| 208 | + background-color: #f8f8f8; | |
| 209 | +} | |
| 210 | + | |
| 211 | +:deep(.up-album__image) { | |
| 212 | + width: 100%; | |
| 213 | + height: 100%; | |
| 214 | + object-fit: cover; // 图片裁剪填充,避免拉伸 | |
| 215 | +} | |
| 216 | + | |
| 10 | 217 | |
| 11 | 218 | </style> |
| 12 | 219 | \ No newline at end of file | ... | ... |
pages-sub/daily/patrol-manage/patrol-plan/index.vue
| ... | ... | @@ -58,13 +58,14 @@ |
| 58 | 58 | <view class="row-item flex-between"> |
| 59 | 59 | <view> |
| 60 | 60 | <text class="label">养护级别:</text> |
| 61 | - <text class="value">{{ levelMap[item.levelId] || '未知级别' }}</text> | |
| 61 | + <text class="value">{{uni.$dict.getDictLabel('conserve_level', item.levelId)}}</text> | |
| 62 | 62 | </view> |
| 63 | 63 | <text class="detail-btn" @click="gotoDetail(item)">计划明细</text> |
| 64 | 64 | </view> |
| 65 | 65 | <view class="row-item"> |
| 66 | 66 | <text class="label">计划类型:</text> |
| 67 | - <text class="value up-line-1">{{ planTypeMap[item.planTypeId] || '未知类型' }}</text> | |
| 67 | + | |
| 68 | + <text class="value up-line-1"> {{uni.$dict.getDictLabel('inspection_maintain_type', item.planTypeId)}}</text> | |
| 68 | 69 | </view> |
| 69 | 70 | <view class="row-item"> |
| 70 | 71 | <text class="label">计划时间:</text> |
| ... | ... | @@ -101,17 +102,7 @@ const pageSize = ref(10); |
| 101 | 102 | |
| 102 | 103 | const planList = ref([]); |
| 103 | 104 | const paging = ref(null); |
| 104 | -// 养护级别/计划类型映射 | |
| 105 | -const levelMap = { | |
| 106 | - 11: '一级养护', | |
| 107 | - 12: '二级养护', | |
| 108 | - 13: '三级养护' | |
| 109 | -}; | |
| 110 | -const planTypeMap = { | |
| 111 | - 3001: '日常养护', | |
| 112 | - 3002: '专项养护', | |
| 113 | - 3003: '应急养护' | |
| 114 | -}; | |
| 105 | + | |
| 115 | 106 | |
| 116 | 107 | // Tab切换 |
| 117 | 108 | const handleTabChange = (val) => { |
| ... | ... | @@ -164,9 +155,6 @@ onLoad(() => { |
| 164 | 155 | }); |
| 165 | 156 | // 仅在页面从明细页返回时,若有数据则刷新当前tab数据(避免干扰上拉加载) |
| 166 | 157 | onShow(() => { |
| 167 | - if (planList.value.length > 0 && pageNo.value === 1) { | |
| 168 | - queryList(); | |
| 169 | - } | |
| 170 | 158 | }); |
| 171 | 159 | </script> |
| 172 | 160 | ... | ... |
pages-sub/daily/patrol-manage/pending-plan-detail/index.vue
| 1 | 1 | <template> |
| 2 | 2 | <view class="pending-plan-detail"> |
| 3 | 3 | <!-- 计划详情卡片 --> |
| 4 | - <view class="detail-card"> | |
| 4 | + <view class="detail-card" v-for="i in planInfo" :key="i.planNo"> | |
| 5 | 5 | <!-- 标题行 --> |
| 6 | 6 | <view class="detail-item"> |
| 7 | 7 | <text class="label">计划名称:</text> |
| 8 | - <text class="value up-line-1">{{ planInfo && planInfo.title ? planInfo.title : '-' }}</text> | |
| 8 | + <text class="value up-line-1">{{ i.planName || '-' }}</text> | |
| 9 | 9 | </view> |
| 10 | 10 | |
| 11 | 11 | <!-- 计划编码行 --> |
| 12 | 12 | <view class="detail-item"> |
| 13 | 13 | <text class="label">计划编码:</text> |
| 14 | - <text class="value up-line-1">{{ planInfo.planNo ? planInfo.planNo : '-' }}</text> | |
| 14 | + <text class="value up-line-1">{{ i.planNo || '-' }}</text> | |
| 15 | 15 | </view> |
| 16 | 16 | |
| 17 | 17 | <!-- 养护周期行 --> |
| 18 | 18 | <view class="detail-item"> |
| 19 | 19 | <text class="label">养护周期:</text> |
| 20 | - <text class="value up-line-1">{{ planInfo && planInfo.rate ? planInfo.rate : '-' }}</text> | |
| 20 | + <text class="value up-line-1">{{ i.rate || '-' }} {{ uni.$dict.getDictLabel('cycle_id_type', i.cycleId) }} | |
| 21 | + </text> | |
| 21 | 22 | </view> |
| 22 | - | |
| 23 | + <!-- cycle_id_type--> | |
| 23 | 24 | <!-- 计划完成次数行 --> |
| 24 | 25 | <view class="detail-item"> |
| 25 | 26 | <text class="label">计划完成次数:</text> |
| 26 | - <text class="value up-line-1">{{ planInfo && planInfo.planNum ? planInfo.planNum : 0 }} 次</text> | |
| 27 | + <text class="value up-line-1">{{ i.planNum || 0 }} 次</text> | |
| 27 | 28 | </view> |
| 28 | 29 | |
| 29 | 30 | <!-- 已完成次数行 + 查看记录按钮 --> |
| 30 | 31 | <view class="detail-item flex-between"> |
| 31 | 32 | <view class="left-wrap"> |
| 32 | 33 | <text class="label">已完成次数:</text> |
| 33 | - <text class="value up-line-1">{{ planInfo && planInfo.planFinishNum ? planInfo.planFinishNum : 0 }} 次</text> | |
| 34 | + <text class="value up-line-1">{{ planInfo.i || 0 }} 次</text> | |
| 34 | 35 | </view> |
| 35 | 36 | <!-- 查看记录按钮(限制宽度+紧凑样式) --> |
| 37 | + | |
| 36 | 38 | <up-button |
| 39 | + v-if="i.planFinishNum>0" | |
| 37 | 40 | type="primary" |
| 38 | 41 | size="mini" |
| 39 | - @click="gotoFinishPlanDetail" | |
| 42 | + @click="gotoFinishPlanDetail(i)" | |
| 40 | 43 | :style="{ width: '80px', height: '28px', fontSize: '14px', borderRadius: 4 }" |
| 41 | 44 | > |
| 42 | 45 | 查看记录 |
| ... | ... | @@ -46,17 +49,19 @@ |
| 46 | 49 | <!-- 计划有效期行 --> |
| 47 | 50 | <view class="detail-item"> |
| 48 | 51 | <text class="label">计划有效期:</text> |
| 49 | -<!-- <text class="value up-line-1">{{ planInfo && planInfo.validTime ? planInfo.validTime : '-' }}</text>--> | |
| 50 | - <text class="value up-line-1">{{ timeFormat(planInfo.beginTime,'yyyy-mm-dd')}} 至 {{ timeFormat(planInfo.endTime,'yyyy-mm-dd')}} </text> | |
| 52 | + <!-- <text class="value up-line-1">{{ planInfo && planInfo.validTime ? planInfo.validTime : '-' }}</text>--> | |
| 53 | + <text class="value up-line-1">{{ timeFormat(i.beginTime, 'yyyy-mm-dd') }} 至 | |
| 54 | + {{ timeFormat(i.endTime, 'yyyy-mm-dd') }} | |
| 55 | + </text> | |
| 51 | 56 | </view> |
| 52 | 57 | </view> |
| 53 | 58 | |
| 54 | - <!-- 底部新增记录按钮 --> | |
| 55 | - <view class="fixed-bottom-btn-wrap"> | |
| 59 | + <!-- 底部新增记录按钮 status=3--> | |
| 60 | + <view class="fixed-bottom-btn-wrap" v-if="finishState==1"> | |
| 56 | 61 | <up-button |
| 57 | 62 | type="primary" |
| 58 | 63 | size="default" |
| 59 | - @click="submit" | |
| 64 | + @click="addNewRecord" | |
| 60 | 65 | :style="{ width: '100%', height: '88rpx', fontSize: '32rpx', borderRadius: 0 }" |
| 61 | 66 | > |
| 62 | 67 | 新增记录 |
| ... | ... | @@ -71,13 +76,15 @@ import { ref } from 'vue'; |
| 71 | 76 | import { onLoad, onShow } from '@dcloudio/uni-app'; |
| 72 | 77 | import { inspectionPlanDetail } from "@/api/patrol-manage/patrol-plan"; |
| 73 | 78 | // 响应式数据定义 |
| 74 | -const planInfo = ref({}); | |
| 79 | +const planInfo = ref([]); | |
| 75 | 80 | const batchNo = ref('') |
| 81 | +const planNo = ref('') | |
| 76 | 82 | const finishState = ref('') |
| 77 | 83 | // 页面加载接收参数 |
| 78 | 84 | onLoad((options) => { |
| 79 | 85 | console.log('计划ID:', options.batchNo); |
| 80 | 86 | batchNo.value = options.batchNo; |
| 87 | + // planNo.value = options.planNo; | |
| 81 | 88 | finishState.value = options.status |
| 82 | 89 | }); |
| 83 | 90 | // 页面显示时请求数据 |
| ... | ... | @@ -98,46 +105,32 @@ const getPlanDetail = async () => { |
| 98 | 105 | } |
| 99 | 106 | console.log(queryData) |
| 100 | 107 | const planInfoRes = await inspectionPlanDetail(queryData) |
| 101 | - planInfo.value = planInfoRes[0] | |
| 108 | + planInfo.value = planInfoRes | |
| 102 | 109 | console.log(planInfoRes) |
| 103 | 110 | }; |
| 104 | 111 | // 跳转到已完成计划明细 |
| 105 | -const gotoFinishPlanDetail = () => { | |
| 106 | - | |
| 112 | +const gotoFinishPlanDetail = (i) => { | |
| 107 | 113 | uni.navigateTo({ |
| 108 | - url: `/pages-sub/daily/patrol-manage/finish-plan-detail/index?batchNo=${planInfo.value.code}` | |
| 114 | + url: `/pages-sub/daily/patrol-manage/finish-plan-detail/index?planNo=${i.planNo}` | |
| 109 | 115 | }); |
| 110 | 116 | }; |
| 111 | 117 | // 新增记录 |
| 112 | 118 | const addNewRecord = () => { |
| 113 | - if (!planInfo.value || !planInfo.value.code) { | |
| 114 | - uni.showToast({ | |
| 115 | - title: '计划数据未加载完成', | |
| 116 | - icon: 'none' | |
| 117 | - }); | |
| 118 | - return; | |
| 119 | - } | |
| 120 | 119 | uni.navigateTo({ |
| 121 | - url: `/pages-sub/daily/patrol-manage/add-patrol-record/index?batchNo=${planInfo.value.code}` | |
| 120 | + url: `/pages-sub/daily/patrol-manage/add-patrol-record/index?planNo=${planInfo.value[0].planNo}&batchNo=${batchNo.value}`, | |
| 122 | 121 | }); |
| 123 | 122 | }; |
| 124 | 123 | </script> |
| 125 | 124 | |
| 126 | 125 | <style scoped lang="scss"> |
| 127 | 126 | .pending-plan-detail { |
| 128 | - background-color: #f8f8f8; | |
| 129 | - display: flex; | |
| 130 | - flex-direction: column; | |
| 131 | - min-height: 100vh; // 恢复最小高度,保证页面占满屏幕 | |
| 132 | - padding-bottom: 88rpx; // 给底部按钮留空间 | |
| 127 | + | |
| 133 | 128 | } |
| 134 | 129 | |
| 135 | 130 | .detail-card { |
| 136 | 131 | padding: 20rpx; |
| 137 | 132 | background-color: #fff; |
| 138 | - border-radius: 12rpx; | |
| 139 | - box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03); | |
| 140 | - flex: 1; | |
| 133 | + margin-bottom: 20px; | |
| 141 | 134 | } |
| 142 | 135 | |
| 143 | 136 | .detail-item { | ... | ... |
pages-sub/daily/quick-order/add-order.vue
| ... | ... | @@ -108,14 +108,14 @@ |
| 108 | 108 | </up-form-item> |
| 109 | 109 | |
| 110 | 110 | <!-- 处理结果(不必填) --> |
| 111 | - <up-form-item label="处理结果" prop="handleResultDesc" class="mt-20"> | |
| 111 | + <up-form-item label="处理结果" prop="handleResult" class="mt-20"> | |
| 112 | 112 | <up-textarea |
| 113 | 113 | placeholder="请输入处理结果描述(最多200字,选填)" |
| 114 | - v-model="workOrderForm.handleResultDesc" | |
| 114 | + v-model="workOrderForm.handleResult" | |
| 115 | 115 | count |
| 116 | 116 | maxlength="200" |
| 117 | 117 | rows="4" |
| 118 | - @blur="() => $refs.workOrderFormRef.validateField('handleResultDesc')" | |
| 118 | + @blur="() => $refs.workOrderFormRef.validateField('handleResult')" | |
| 119 | 119 | ></up-textarea> |
| 120 | 120 | </up-form-item> |
| 121 | 121 | |
| ... | ... | @@ -151,17 +151,30 @@ |
| 151 | 151 | </template> |
| 152 | 152 | |
| 153 | 153 | <script setup lang="ts"> |
| 154 | -import {ref} from 'vue' | |
| 154 | +import {ref, inject} from 'vue' | |
| 155 | + | |
| 155 | 156 | import type {UniFormRef} from '@/uni_modules/uview-plus/types' |
| 156 | 157 | // 定义ref供选项式API使用 |
| 157 | 158 | const workOrderFormRef = ref<UniFormRef>(null) |
| 159 | +// | |
| 160 | +// // 注入全局字典工具 | |
| 161 | +// const $dict = inject('$dict'); | |
| 162 | +// const dictLabel = ref(''); | |
| 163 | +// const modeList = ref([]); | |
| 164 | +// | |
| 165 | + | |
| 166 | + | |
| 158 | 167 | </script> |
| 159 | 168 | |
| 160 | 169 | <script lang="ts"> |
| 161 | 170 | import {getRoadListByLatLng} from '@/api/common' |
| 162 | 171 | import {uploadImages} from '@/common/utils/upload'; |
| 163 | 172 | import {createQuick} from '@/api/quick-order/quick-order' |
| 164 | -import {toast} from '@/uni_modules/uview-plus' | |
| 173 | +// import { getCurrentInstance } from 'vue'; | |
| 174 | +// const { proxy } = getCurrentInstance(); | |
| 175 | +// const label = $dict.getDictLabel('ai_image_status', 10); | |
| 176 | +// const opdata = $dict.getDictLabel('ai_image_status'); | |
| 177 | +// console.log(opdata) | |
| 165 | 178 | |
| 166 | 179 | export default { |
| 167 | 180 | data() { |
| ... | ... | @@ -176,9 +189,9 @@ export default { |
| 176 | 189 | // 下拉列表数据 |
| 177 | 190 | roadNameList: [], |
| 178 | 191 | orderNameList: [ |
| 179 | - {name: '绿地卫生', code: 'ORDER001'}, | |
| 180 | - {name: '设施维修', code: 'ORDER002'}, | |
| 181 | - {name: '垃圾清理', code: 'ORDER003'} | |
| 192 | + // {name: '绿地卫生', code: 'ORDER001'}, | |
| 193 | + // {name: '设施维修', code: 'ORDER002'}, | |
| 194 | + // {name: '垃圾清理', code: 'ORDER003'} | |
| 182 | 195 | ], |
| 183 | 196 | // 工单表单数据 |
| 184 | 197 | workOrderForm: { |
| ... | ... | @@ -187,7 +200,7 @@ export default { |
| 187 | 200 | workLocation: '', // 工单位置 |
| 188 | 201 | orderName: '', // 工单名称 |
| 189 | 202 | problemDesc: '', // 情况描述 |
| 190 | - handleResultDesc: '', // 处理结果描述(不必填) | |
| 203 | + handleResult: '', // 处理结果描述(不必填) | |
| 191 | 204 | lat: 0, // 纬度 |
| 192 | 205 | lon: 0 // 经度 |
| 193 | 206 | }, |
| ... | ... | @@ -239,6 +252,12 @@ export default { |
| 239 | 252 | this.$refs.workOrderFormRef.setRules(this.workOrderFormRules) |
| 240 | 253 | console.log('工单表单规则初始化完成') |
| 241 | 254 | }, |
| 255 | + onShow(){ | |
| 256 | + console.log(uni.$dict.getDictLabel('ai_image_status', 20)) | |
| 257 | + console.log(uni.$dict.getDictSimpleList('work_name')) | |
| 258 | + this.orderNameList = uni.$dict.transformLabelValueToNameValue(uni.$dict.getDictSimpleList('work_name')) | |
| 259 | + console.log(this.orderNameList) | |
| 260 | + }, | |
| 242 | 261 | methods: { |
| 243 | 262 | /** |
| 244 | 263 | * 返回上一页 |
| ... | ... | @@ -406,6 +425,7 @@ export default { |
| 406 | 425 | * 选择工单名称 |
| 407 | 426 | */ |
| 408 | 427 | handleOrderNameSelect(e) { |
| 428 | + console.log(e) | |
| 409 | 429 | this.workOrderForm.orderName = e.name |
| 410 | 430 | this.showOrderName = false |
| 411 | 431 | this.$refs.workOrderFormRef.validateField('orderName') |
| ... | ... | @@ -439,7 +459,7 @@ export default { |
| 439 | 459 | imgs: this.getImgUrlList(this.problemImgsList), |
| 440 | 460 | longRangeImgList: this.getImgUrlList(this.completeImgsList), |
| 441 | 461 | remark: this.workOrderForm.problemDesc, |
| 442 | - handleResultDesc: this.workOrderForm.handleResultDesc, | |
| 462 | + handleResult: this.workOrderForm.handleResult, | |
| 443 | 463 | latLonType: 2, |
| 444 | 464 | lat: this.workOrderForm.lat, |
| 445 | 465 | lon: this.workOrderForm.lon, |
| ... | ... | @@ -461,7 +481,7 @@ export default { |
| 461 | 481 | uni.showToast({ |
| 462 | 482 | title: '工单提交成功', |
| 463 | 483 | icon: 'success', |
| 464 | - duration: 1500 | |
| 484 | + duration: 1000 | |
| 465 | 485 | }) |
| 466 | 486 | |
| 467 | 487 | // 延迟跳转(等待提示框显示完成) |
| ... | ... | @@ -469,7 +489,7 @@ export default { |
| 469 | 489 | uni.redirectTo({ |
| 470 | 490 | url: '/pages-sub/daily/quick-order/index' |
| 471 | 491 | }) |
| 472 | - }, 1500) | |
| 492 | + }, 1000) | |
| 473 | 493 | } catch (error) { |
| 474 | 494 | // 隐藏加载框 |
| 475 | 495 | uni.hideLoading() | ... | ... |
pages-sub/daily/quick-order/order-detail.vue
pages-sub/daily/quick-order/order-list.vue deleted
pages.json
pages/workbench/index.vue
| ... | ... | @@ -41,6 +41,7 @@ |
| 41 | 41 | v-for="(listItem,listIndex) in parentModule.children" |
| 42 | 42 | :key="listItem.id" |
| 43 | 43 | @click="handleMenuClick(listItem)" |
| 44 | + class="grid-item-wrap" | |
| 44 | 45 | > |
| 45 | 46 | <u-image |
| 46 | 47 | :src="listItem.icon " |
| ... | ... | @@ -53,7 +54,7 @@ |
| 53 | 54 | <text class="grid-text">{{ listItem.name }}</text> |
| 54 | 55 | </up-grid-item> |
| 55 | 56 | </up-grid> |
| 56 | - <up-toast ref="uToastRef"/> | |
| 57 | + | |
| 57 | 58 | </view> |
| 58 | 59 | </template> |
| 59 | 60 | </up-card> |
| ... | ... | @@ -160,6 +161,9 @@ const handleMenuClick = (item: MenuItem) => { |
| 160 | 161 | position: relative; |
| 161 | 162 | background-color: #fff; |
| 162 | 163 | } |
| 164 | +.grid-item-wrap{ | |
| 165 | + margin-top: 20px; | |
| 166 | +} | |
| 163 | 167 | |
| 164 | 168 | /* 蓝色块样式 */ |
| 165 | 169 | .blue-decor-block { |
| ... | ... | @@ -179,18 +183,6 @@ const handleMenuClick = (item: MenuItem) => { |
| 179 | 183 | padding-top: 160px; |
| 180 | 184 | } |
| 181 | 185 | |
| 182 | -/* 第一张卡片层级 */ | |
| 183 | -.first-card-position { | |
| 184 | - position: relative; | |
| 185 | - z-index: 3; | |
| 186 | -} | |
| 187 | - | |
| 188 | -/* 仅补充标题文字基础样式(确保显示,不修改卡片其他样式) */ | |
| 189 | -.card-title-text { | |
| 190 | - font-size: 32rpx; | |
| 191 | - color: #333; | |
| 192 | - font-weight: 600; | |
| 193 | -} | |
| 194 | 186 | |
| 195 | 187 | /* 网格文字样式(保留原始) */ |
| 196 | 188 | .grid-text { |
| ... | ... | @@ -200,8 +192,5 @@ const handleMenuClick = (item: MenuItem) => { |
| 200 | 192 | margin-top: 10rpx; |
| 201 | 193 | } |
| 202 | 194 | |
| 203 | -/* 加载页样式优化(可选) */ | |
| 204 | -:deep(.up-loading-page) { | |
| 205 | - background-color: rgba(255, 255, 255, 0.9); | |
| 206 | -} | |
| 195 | + | |
| 207 | 196 | </style> |
| 208 | 197 | \ No newline at end of file | ... | ... |