From b37218106425b48ac85cf8869caa1383d3facc2b Mon Sep 17 00:00:00 2001 From: Lufaneng Date: Mon, 2 Feb 2026 16:21:59 +0800 Subject: [PATCH] 11 --- pages/index/index.vue | 42 +++--- pagesA/generate-record/generate-record.vue | 145 +++++++++++++++++++-- pagesA/template-apply/template-apply.vue | 8 +- vite.config.js | 9 +- 4 files changed, 166 insertions(+), 38 deletions(-) diff --git a/pages/index/index.vue b/pages/index/index.vue index 9ebce1c..98d04f3 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -110,7 +110,7 @@ border="bottom" :placeholderStyle="{ color: '#666778' }" :placeholder="item.type === 'number' ? `范围:${item.min} - ${item.max === 0 ? '不限' : item.max}` : (item.name === '土建图号' - ? '将根据土建图型号自动生成' + ? '自动生成' : '请输入')" > @@ -199,7 +199,8 @@ import { } from "@dcloudio/uni-app"; import { useAuthStore, useUserStore } from "@/store"; import RPC from "@/utils/request"; -import { usePermission } from "@/hooks/usePermission"; +import { usePermission } from "@/hooks/usePermission"; +import dayjs from 'dayjs' const authStore = useAuthStore(); const userStore = useUserStore(); @@ -289,11 +290,11 @@ const confirm = (val) => { console.log(val); currentParams.value.value = val.value[0]; // 如果修改的是土建图型号,需要重新生成土建图号 - if (currentParams.value.name === "土建图型号") { - nextTick(() => { - generateDrawingNumber(); - }); - } + // if (currentParams.value.name === "土建图型号") { + // nextTick(() => { + // generateDrawingNumber(); + // }); + // } }; // 打开申请权限弹框 @@ -344,11 +345,11 @@ const cancelApply = () => { // 处理输入变化 const handleInputChange = (item) => { // 如果修改的是土建图型号,需要重新生成土建图号 - if (item.name === "土建图型号") { - nextTick(() => { - generateDrawingNumber(); - }); - } + // if (item.name === "土建图型号") { + // nextTick(() => { + // generateDrawingNumber(); + // }); + // } }; // 验证数字范围 @@ -394,21 +395,21 @@ const generateDrawingNumber = () => { if (!params) return; // 找到土建图型号和土建图号字段 - const modelParam = params.find((p) => p.name === "土建图型号"); + // const modelParam = params.find((p) => p.name === "土建图型号"); const numberParam = params.find((p) => p.name === "土建图号"); - if (!modelParam || !numberParam || !modelParam.value) return; + if (!numberParam) return; // 获取当前年份和月份 - const now = new Date(); - const year = now.getFullYear().toString().slice(-2); // 取年份后两位 - const month = (now.getMonth() + 1).toString().padStart(2, "0"); // 月份补零 + // const now = new Date(); + // const year = now.getFullYear().toString().slice(-2); // 取年份后两位 + // const month = (now.getMonth() + 1).toString().padStart(2, "0"); // 月份补零 // 生成4位随机数字+字母 const randomPart = generateRandomCode(); // 组合生成土建图号:GSE400-V25-10-0002A - numberParam.value = `${modelParam.value}-V${year}${month}-${randomPart}`; + numberParam.value = dayjs().format('YYYYMMDDHHmmss') + randomPart; }; // 生成随机编码(4位数字+1位字母) @@ -418,7 +419,7 @@ const generateRandomCode = () => { .padStart(4, "0"); const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; const letter = letters.charAt(Math.floor(Math.random() * letters.length)); - return numbers + letter; + return numbers; }; const generating = ref(false); @@ -477,7 +478,8 @@ const getList = () => { has_access.value = true; RPC.post("/template/detail", { id: currentTemplate.value.id }) .then((res) => { - currentTemplate.value.params = res?.params; + currentTemplate.value.params = res?.params; + generateDrawingNumber() }) .finally(() => { params_loading.value = false; diff --git a/pagesA/generate-record/generate-record.vue b/pagesA/generate-record/generate-record.vue index e210702..435febb 100644 --- a/pagesA/generate-record/generate-record.vue +++ b/pagesA/generate-record/generate-record.vue @@ -3,17 +3,18 @@ - + - {{ record.file_name || record.order_no || record.plannedNo }} + {{ record.file_name || record.order_no || record.plannedNo }} + 生成时间: {{ record.CreatedAt - ? dayjs(record.CreatedAt).format("YYYY-MM-DD") + ? dayjs(record.CreatedAt).format("YYYY-MM-DD HH:mm:ss") : "" }} @@ -22,10 +23,12 @@ 已完成 - 生成失败 + 生成失败 + 等待生成 生成中 @@ -54,6 +57,21 @@ + + + + + + 暂无参数信息 + + + + {{ param.name }}: + {{ param.value || '未设置' }} + + + + @@ -71,14 +89,41 @@ } from "@dcloudio/uni-app"; const options = ref([{ + text: "参数", + style: { + backgroundColor: "#6eb0ea", + }, + }, { text: "删除", style: { backgroundColor: "#f56c6c", }, - }, ]); - const delItem = (item) => { - console.log(item); - deleteRecord(item); + }]); + const currentParams = ref([]) + const showParamsModal = ref(false) + const paramsModalRef = ref(null) + + const controlItem = (index, item) => { + console.log(index, item); + if (index.index === 0) { + // 显示参数弹窗 + showParams(item); + } else { + deleteRecord(item); + } + }; + + // 显示参数弹窗 + const showParams = (item) => { + if (item.template_data) { + currentParams.value = Object.entries(item.template_data).map(([key, value]) => ({ + name: key, + value: value + })); + } else { + currentParams.value = []; + } + paramsModalRef.value.open(); }; // 响应式数据 const loading = ref(false); @@ -86,7 +131,6 @@ const page = ref(1); const list = ref([]); const count = ref(0); - // 下载记录 const downloadRecord = (record) => { uni.showLoading({ @@ -102,12 +146,38 @@ document.body.appendChild(link); link.click(); document.body.removeChild(link); - + // downloadA(record.result_url, (record.file_name || record.plannedNo)) uni.hideLoading(); uni.showToast({ title: "开始下载", icon: "success", }); + // uni.request({ + // url:'/api/proxyDownload', + // data:{"name":record.file_name || record.plannedNo,url:record.result_url}, + // method:'POST', + // responseType: 'arraybuffer', + // success:res => { + // const blob = new Blob([res.data], { + // type: 'application/pdf' + // }) + // const base64 = res.data + // const iframe = document.createElement('iframe') + // iframe.style.display = 'none' + // iframe.src = `data:application/pdf;base64,${base64}` + // document.body.appendChild(iframe) + + // // const url = URL.createObjectURL(blob) + // // const a = document.createElement('a') + // // a.href = url + // // a.download = record.file_name + // // a.click() + // // URL.revokeObjectURL(url) + // }, + // complete:() => { + // uni.hideLoading(); + // } + // }) // #endif // #ifdef MP-WEIXIN // 小程序和App端使用uni.downloadFile @@ -274,8 +344,8 @@ color: #333; font-weight: 500; margin-bottom: 6px; - word-wrap: break-word; - white-space: normal; + word-wrap: break-word; + white-space: normal; } .record-time { @@ -306,6 +376,10 @@ &.processing { background: #fff7e6; color: #fa8c16; + } + &.waitting { + background: #fff7e6; + color: #4ad6f1; } } @@ -335,4 +409,47 @@ padding: 20px; text-align: center; } + + .params-modal-content { + padding: 20px 0; + max-height: 400px; + overflow-y: auto; + + .no-params { + text-align: center; + color: #999; + font-size: 14px; + padding: 20px 0; + } + + .params-list { + .param-item { + display: flex; + align-items: flex-start; + padding: 12px 0; + border-bottom: 1px solid #f0f0f0; + + &:last-child { + border-bottom: none; + } + + .param-name { + flex-shrink: 0; + font-weight: 500; + color: #333; + font-size: 14px; + min-width: 80px; + margin-right: 12px; + } + + .param-value { + flex: 1; + color: #666; + font-size: 14px; + word-wrap: break-word; + white-space: normal; + } + } + } + } \ No newline at end of file diff --git a/pagesA/template-apply/template-apply.vue b/pagesA/template-apply/template-apply.vue index a1219fd..2622fd7 100644 --- a/pagesA/template-apply/template-apply.vue +++ b/pagesA/template-apply/template-apply.vue @@ -14,7 +14,7 @@ - 申请权限 @@ -22,8 +22,8 @@ {{get_access_status(record.access_status)}} @@ -111,6 +111,8 @@ const get_access_status = (access_status) => { str = "待审批"; } else if (access_status === "rejected") { str = "已拒绝"; + } else if (access_status === "revoked") { + str = "已撤回"; } else if (access_status === "approved") { str = "已通过"; } else { diff --git a/vite.config.js b/vite.config.js index 66c83f5..40e8b41 100644 --- a/vite.config.js +++ b/vite.config.js @@ -28,7 +28,14 @@ export default defineConfig(({ mode }) => { proxy: { ['/jsonrpc']: { changeOrigin: true, - target: 'https://lift-drawing-h5.ruixininfo.com', + // target: 'https://lift-drawing-h5.ruixininfo.com', + target: 'https://lift-h5.shulinelev.com', + // target: 'https://lift-drawing.ruixininfo.com', + }, + ['/api/proxyDownload']: { + changeOrigin: true, + // target: 'https://lift-drawing-h5.ruixininfo.com', + target: 'https://lift-h5.shulinelev.com', // target: 'https://lift-drawing.ruixininfo.com', }, },