From 36c3a0fe4f6750891cb69f9622e141b2f74f38b9 Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期五, 15 十一月 2024 17:01:58 +0800 Subject: [PATCH] 码头搅拌站模版导出 --- src/views/fysp/data-product/ProdSceneReport.vue | 73 +++++++++++++++++++++++++++--------- public/单体模版(码头).docx | 0 public/单体模版(工地).docx | 0 public/单体模版(搅拌站).docx | 0 4 files changed, 55 insertions(+), 18 deletions(-) diff --git "a/public/\345\215\225\344\275\223\346\250\241\347\211\210.docx" "b/public/\345\215\225\344\275\223\346\250\241\347\211\210\357\274\210\345\267\245\345\234\260\357\274\211.docx" similarity index 100% rename from "public/\345\215\225\344\275\223\346\250\241\347\211\210.docx" rename to "public/\345\215\225\344\275\223\346\250\241\347\211\210\357\274\210\345\267\245\345\234\260\357\274\211.docx" Binary files differ diff --git "a/public/\345\215\225\344\275\223\346\250\241\347\211\210\357\274\210\346\220\205\346\213\214\347\253\231\357\274\211.docx" "b/public/\345\215\225\344\275\223\346\250\241\347\211\210\357\274\210\346\220\205\346\213\214\347\253\231\357\274\211.docx" new file mode 100644 index 0000000..4f69435 --- /dev/null +++ "b/public/\345\215\225\344\275\223\346\250\241\347\211\210\357\274\210\346\220\205\346\213\214\347\253\231\357\274\211.docx" Binary files differ diff --git "a/public/\345\215\225\344\275\223\346\250\241\347\211\210\357\274\210\347\240\201\345\244\264\357\274\211.docx" "b/public/\345\215\225\344\275\223\346\250\241\347\211\210\357\274\210\347\240\201\345\244\264\357\274\211.docx" new file mode 100644 index 0000000..f8cb2ac --- /dev/null +++ "b/public/\345\215\225\344\275\223\346\250\241\347\211\210\357\274\210\347\240\201\345\244\264\357\274\211.docx" Binary files differ diff --git a/src/views/fysp/data-product/ProdSceneReport.vue b/src/views/fysp/data-product/ProdSceneReport.vue index 239545e..4e768b9 100644 --- a/src/views/fysp/data-product/ProdSceneReport.vue +++ b/src/views/fysp/data-product/ProdSceneReport.vue @@ -13,21 +13,21 @@ <template #main> <el-scrollbar class="el-scrollbar" v-loading="mainLoading"> <CompSceneConstructionInfo - v-if="curSubtask.data && curSubtask.data.sceneType == '宸ュ湴'" + v-if="curSubtask.data && curSubtask.data.sceneTypeId == 1" title="A銆佸熀鏈俊鎭�" :scene="formScene" :form-info="formSubScene" :scene-type="1" /> <CompSceneWharfInfo - v-else-if="curSubtask.data && curSubtask.data.sceneType == '鐮佸ご'" + v-else-if="curSubtask.data && curSubtask.data.sceneTypeId == 2" title="A銆佸熀鏈俊鎭�" :scene="formScene" :form-info="formSubScene" :scene-type="2" /> <CompSceneMixingPlantInfo - v-else-if="curSubtask.data && curSubtask.data.sceneType == '鎼呮媽绔�'" + v-else-if="curSubtask.data && curSubtask.data.sceneTypeId == 3" title="A銆佸熀鏈俊鎭�" :scene="formScene" :form-info="formSubScene" @@ -94,7 +94,7 @@ :max-select="1" :readonly="false" :subtask="curSubtask.data" - @selectByAnyPhonoEvent="handleSelectAnyPhoto" + @submit="handleSelectAnyPhoto" :defaultFile="[sceneImg]" > </ArbitraryPhoto> @@ -113,7 +113,6 @@ </template> <script setup> import { ref, computed } from 'vue'; - import { $fysp } from '@/api/index'; import taskApi from '@/api/fysp/taskApi'; import sceneApi from '@/api/fysp/sceneApi'; @@ -121,6 +120,7 @@ import evaluateApi from '@/api/fysp/evaluateApi'; import { formatDeviceList } from '@/model/fysp/device'; import { enumDevice, toLabel } from '@/enum/device/device'; +import { enumScene } from '@/enum/scene'; import { exportDocx } from '@/utils/doc'; import right_triangle from '@/assets/image/right_triangle.png'; @@ -132,6 +132,7 @@ import CompImgInfo from '@/views/fysp/data-product/components/CompImgInfo.vue'; import CompProblemTable from './components/CompProblemTable.vue'; import dayjs from 'dayjs'; +import { useCloned } from '@vueuse/core'; /************************* 宸︿晶宸℃煡浠诲姟閫夊崟 **********************************/ const curSubtask = ref({}); @@ -361,10 +362,33 @@ } /************************* 鐢熸垚鎶ュ憡 **********************************/ +// 鏍囧噯鍖栧睘鎬у悕 +function convertKeys(obj) { + // 灏嗕竴涓猨s瀵硅薄涓墍鏈墂, mp, cs寮�澶寸殑灞炴�у叏閮ㄦ敼鎴愬幓鎺夎繖浜涘墠缂�骞朵笖閲嶆柊鍙樹负椹煎嘲寮忓懡鍚� + const newObj = {}; + for (const key in obj) { + let newKey = key; + if (key.startsWith('w')) { + newKey = key.substring(1); + } else if (key.startsWith('mp')) { + newKey = key.substring(2); + } else if (key.startsWith('cs')) { + newKey = key.substring(2); + } + newKey = newKey.charAt(0).toLowerCase() + newKey.slice(1); + newObj[newKey] = obj[key]; + } + return newObj; +} const docLoading = ref(false); // 鐢熸垚word鎶ュ憡 function genWord() { + // 璁╁師鏉ョ殑瀵硅薄涓嶅彈褰卞搷 + let formSceneCopy = ref(useCloned(formSubScene.value).cloned.value); + // 鏍囧噯鍖栧睘鎬у�� + let convertedFormScene = convertKeys(formSceneCopy.value); + const _deviceList = []; for (let i = 0; i < deviceList.value.length; i += 2) { const d1 = deviceList.value[i]; @@ -381,21 +405,28 @@ const param = { index: formScene.value.index, sceneName: formScene.value.name, - projectType: formSubScene.value.csProjectType, - stage: formSubScene.value.siExtension1, - startTime: formSubScene.value.csStartTime, - endTime: formSubScene.value.csEndTime, - leftTime: formSubScene.value.csLeftTime, + projectType: convertedFormScene.projectType, + stage: convertedFormScene.siExtension1, + startTime: convertedFormScene.startTime, + endTime: convertedFormScene.endTime, + leftTime: convertedFormScene.leftTime, location: formScene.value.location, - floorSpace: formSubScene.value.csFloorSpace, - constructionArea: formSubScene.value.csConstructionArea, - constructionAreaPerMonth: formSubScene.value.csConstructionAreaPerMonth, + floorSpace: convertedFormScene.floorSpace, + constructionArea: convertedFormScene.constructionArea, + constructionAreaPerMonth: convertedFormScene.constructionAreaPerMonth, contacts: formScene.value.contacts, contactst: formScene.value.contactst, - securityOfficer: formSubScene.value.csSecurityOfficer, - securityOfficerTel: formSubScene.value.csSecurityOfficerTel, - constructionUnit: formSubScene.value.csConstructionUnit, - employerUnit: formSubScene.value.csEmployerUnit, + securityOfficer: convertedFormScene.securityOfficer, + securityOfficerTel: convertedFormScene.securityOfficerTel, + constructionUnit: convertedFormScene.constructionUnit, + employerUnit: convertedFormScene.employerUnit, + + planningArea: convertedFormScene.planningArea, + rentUnit: convertedFormScene.rentUnit, + + greenPlant: convertedFormScene.greenPlant, + civillyPlant: convertedFormScene.civillyPlant, + sceneType: formScene.value.type, imgTitle: imgTitle.value, imgTitle_url: sceneImg.value.url, @@ -421,8 +452,14 @@ console.log(param); docLoading.value = true; + // 鏍规嵁鍦烘櫙绫诲瀷閫夋嫨妯℃澘 + const sceneTypes = enumScene(2, false); + const type = sceneTypes.filter( + (item) => item.value == formScene.value.typeid + )[0].label; + const docxTemplatepath = `/鍗曚綋妯$増锛�${type}锛�.docx`; exportDocx( - '/鍗曚綋妯$増.docx', + docxTemplatepath, param, `${param.sceneName}鍗曚綋锛�${date}锛�.docx`, { -- Gitblit v1.9.3