diff --git a/api/patrol-manage/patrol-plan.js b/api/patrol-manage/patrol-plan.js index ab33a5e..64149b3 100644 --- a/api/patrol-manage/patrol-plan.js +++ b/api/patrol-manage/patrol-plan.js @@ -26,10 +26,20 @@ export const inspectionPlanDetail = (data) => { return post('/app-api/app/garden/inspection-plan-detail/get-details',data); }; + +// app-api/app/garden/inspection-plan-commit/get/by/plan_no?plan_no=P1765032669066674' +/** + * 巡查计划完成详情 + * @returns {Promise} + */ +export const inspectioDetailByPlanno = (params) => { + return get('/app-api/app/garden/inspection-plan-commit/get/by/plan_no',params); +}; + /** - * 模块列表用这个 + * 巡查计划完成详情 * @returns {Promise} */ -export const moduleList = () => { - return get('/app-api/member/app-module/list'); +export const inspectionCreate = (data) => { + return post('/app-api/app/garden/inspection-plan-commit/create',data); }; diff --git a/common/utils/dict.js b/common/utils/dict.js index 3195cf8..b16f82d 100644 --- a/common/utils/dict.js +++ b/common/utils/dict.js @@ -68,4 +68,73 @@ export const getDictSimpleList = (dictType) => { value: item.value || '', label: item.label || '' })); +}; + +/** + * 字典格式转换工具:{label, value} ↔ {name, value}(兼容笔误的vulue,同时支持正确value) + * 注:若需转换为 {name, vulue}(拼写错误),代码中已兼容,可按需切换 + */ + +/** + * 核心转换:将 {label, value} 数组转换为 {name, value} 数组(主流正确写法) + * @param {Array} list 源数组,例:[{label: "绿地卫生", value: "绿地卫生"}] + * @returns {Array} 转换后数组,例:[{name: "绿地卫生", value: "绿地卫生"}] + */ +export const transformLabelValueToNameValue = (list) => { + // 空值保护:非数组直接返回空数组 + if (!Array.isArray(list) || list.length === 0) return []; + + return list.map(item => { + // 兼容item为null/undefined的情况,兜底空字符串 + const safeItem = item || {}; + return { + name: safeItem.label || '', + value: safeItem.value || '' // 正确的value字段 + // 若需转换为 vulue(拼写错误),替换为:vulue: safeItem.value || '' + }; + }); +}; + +/** + * 单对象转换:将 {label, value} 转换为 {name, value} + * @param {Object} item 源对象,例:{label: "绿地卫生", value: "绿地卫生"} + * @returns {Object} 转换后对象,例:{name: "绿地卫生", value: "绿地卫生"} + */ +export const transformSingleLabelValueToNameValue = (item) => { + const safeItem = item || {}; + return { + name: safeItem.label || '', + value: safeItem.value || '' + // 若需 vulue:vulue: safeItem.value || '' + }; +}; + +/** + * 反向转换:{name, value} → {label, value}(可选,用于回显) + * @param {Array} list 源数组 + * @returns {Array} 转换后数组 + */ +export const transformNameValueToLabelValue = (list) => { + if (!Array.isArray(list) || list.length === 0) return []; + + return list.map(item => { + const safeItem = item || {}; + return { + label: safeItem.name || '', + value: safeItem.value || safeItem.vulue || '' // 兼容vulue拼写错误 + }; + }); +}; + + + +// 导出全部方法的集合(方便全局注册) +export default { + getDictList, + getDictLabel, + getDictValue, + getDictSimpleList, + transformLabelValueToNameValue, + transformSingleLabelValueToNameValue, + transformNameValueToLabelValue }; \ No newline at end of file diff --git a/main.js b/main.js index 54751ba..cec9938 100644 --- a/main.js +++ b/main.js @@ -5,10 +5,11 @@ import uviewPlus from '@/uni_modules/uview-plus' import pinia from '@/pinia/index' import EmptyView from '@/components/empty-view/empty-view.vue'; import UploadImage from '@/components/upload-image/upload-image.vue'; - +import dictUtils from '@/common/utils/dict'; // #ifdef VUE3 import { createSSRApp } from 'vue' - +// 挂载到uni全局 +uni.$dict = dictUtils; export function createApp() { // 2. 创建 Vue 实例 const app = createSSRApp(App) @@ -18,6 +19,8 @@ export function createApp() { // 4. 注册 Pinia(核心:在 app 挂载前注册) app.use(pinia) + // 全局注入字典工具(关键:provide需在app实例上注册) + // app.provide('$dict', dictUtils); app.component('EmptyView', EmptyView) app.component('UploadImage', UploadImage) // 5. 返回 app + pinia(可选,便于调试) @@ -29,21 +32,3 @@ export function createApp() { // #endif -// 全局注册(可选):如果需要全局使用,可在 main.js 中注册为全局方法: -// javascript -// 运行 -// import { createSSRApp } from 'vue'; -// import * as dictUtils from '@/utils/dict'; -// -// export function createApp() { -// const app = createSSRApp(App); -// // 注册全局字典方法 -// app.config.globalProperties.$dict = dictUtils; -// return { app }; -// } -// 组件中使用: -// javascript -// 运行 -// import { getCurrentInstance } from 'vue'; -// const { proxy } = getCurrentInstance(); -// const label = proxy.$dict.getDictLabel('ai_image_status', 10); diff --git a/pages-sub/daily/patrol-manage/add-patrol-record/index.vue b/pages-sub/daily/patrol-manage/add-patrol-record/index.vue index 826523a..af8f8ae 100644 --- a/pages-sub/daily/patrol-manage/add-patrol-record/index.vue +++ b/pages-sub/daily/patrol-manage/add-patrol-record/index.vue @@ -40,7 +40,7 @@ del-color="#ff4d4f" class="upload-wrap" > - (最少1张,最多3张) + @@ -92,6 +92,8 @@ const inspectFormRef = ref(null) + + + + + - + + \ No newline at end of file diff --git a/pages-sub/daily/patrol-manage/patrol-plan/index.vue b/pages-sub/daily/patrol-manage/patrol-plan/index.vue index b13eacf..715d1e3 100644 --- a/pages-sub/daily/patrol-manage/patrol-plan/index.vue +++ b/pages-sub/daily/patrol-manage/patrol-plan/index.vue @@ -58,13 +58,14 @@ 养护级别: - {{ levelMap[item.levelId] || '未知级别' }} + {{uni.$dict.getDictLabel('conserve_level', item.levelId)}} 计划明细 计划类型: - {{ planTypeMap[item.planTypeId] || '未知类型' }} + + {{uni.$dict.getDictLabel('inspection_maintain_type', item.planTypeId)}} 计划时间: @@ -101,17 +102,7 @@ const pageSize = ref(10); const planList = ref([]); const paging = ref(null); -// 养护级别/计划类型映射 -const levelMap = { - 11: '一级养护', - 12: '二级养护', - 13: '三级养护' -}; -const planTypeMap = { - 3001: '日常养护', - 3002: '专项养护', - 3003: '应急养护' -}; + // Tab切换 const handleTabChange = (val) => { @@ -164,9 +155,6 @@ onLoad(() => { }); // 仅在页面从明细页返回时,若有数据则刷新当前tab数据(避免干扰上拉加载) onShow(() => { - if (planList.value.length > 0 && pageNo.value === 1) { - queryList(); - } }); diff --git a/pages-sub/daily/patrol-manage/pending-plan-detail/index.vue b/pages-sub/daily/patrol-manage/pending-plan-detail/index.vue index 65e57cc..22b13b3 100644 --- a/pages-sub/daily/patrol-manage/pending-plan-detail/index.vue +++ b/pages-sub/daily/patrol-manage/pending-plan-detail/index.vue @@ -1,42 +1,45 @@ @@ -160,6 +161,9 @@ const handleMenuClick = (item: MenuItem) => { position: relative; background-color: #fff; } +.grid-item-wrap{ + margin-top: 20px; +} /* 蓝色块样式 */ .blue-decor-block { @@ -179,18 +183,6 @@ const handleMenuClick = (item: MenuItem) => { padding-top: 160px; } -/* 第一张卡片层级 */ -.first-card-position { - position: relative; - z-index: 3; -} - -/* 仅补充标题文字基础样式(确保显示,不修改卡片其他样式) */ -.card-title-text { - font-size: 32rpx; - color: #333; - font-weight: 600; -} /* 网格文字样式(保留原始) */ .grid-text { @@ -200,8 +192,5 @@ const handleMenuClick = (item: MenuItem) => { margin-top: 10rpx; } -/* 加载页样式优化(可选) */ -:deep(.up-loading-page) { - background-color: rgba(255, 255, 255, 0.9); -} + \ No newline at end of file