From b187b6cf678f0e6b17e3612c5681ecd35434f15a Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期三, 25 六月 2025 10:36:11 +0800 Subject: [PATCH] 任务管理界面新增巡查单据下载功能 --- /dev/null | 0 package-lock.json | 180 ++++++++++++++++++++++++++++------- public/餐饮巡查单据模板.docx | 0 src/components/FYImageSelectDialog.vue | 23 +++- package.json | 2 public/工地巡查单据模板.docx | 0 src/views/fysp/scene/SceneInspectFile.vue | 69 ++++++++----- 7 files changed, 207 insertions(+), 67 deletions(-) diff --git a/package-lock.json b/package-lock.json index 32e37e1..b3f4309 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@vueuse/core": "^9.7.0", "axios": "^1.2.1", "dayjs": "^1.11.13", + "docx-preview": "^0.3.5", "docxtemplater": "^3.50.0", "docxtemplater-image-module": "^3.1.0", "docxtemplater-image-module-free": "^1.1.1", @@ -32,6 +33,7 @@ "vue": "^3.2.45", "vue-demi": "^0.14.6", "vue-i18n": "^9.8.0", + "vue-print-nb": "^1.7.5", "vue-router": "^4.1.6", "xlsx": "^0.18.5" }, @@ -512,17 +514,17 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.19.4", - "dev": true, - "license": "MIT", + "version": "7.27.1", + "resolved": "https://registry.npmmirror.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.19.1", - "dev": true, - "license": "MIT", + "version": "7.27.1", + "resolved": "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==", "engines": { "node": ">=6.9.0" } @@ -640,8 +642,12 @@ } }, "node_modules/@babel/parser": { - "version": "7.20.5", - "license": "MIT", + "version": "7.27.5", + "resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.27.5.tgz", + "integrity": "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg==", + "dependencies": { + "@babel/types": "^7.27.3" + }, "bin": { "parser": "bin/babel-parser.js" }, @@ -1785,13 +1791,12 @@ } }, "node_modules/@babel/types": { - "version": "7.20.5", - "dev": true, - "license": "MIT", + "version": "7.27.6", + "resolved": "https://registry.npmmirror.com/@babel/types/-/types-7.27.6.tgz", + "integrity": "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q==", "dependencies": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" }, "engines": { "node": ">=6.9.0" @@ -3948,6 +3953,14 @@ }, "engines": { "node": ">=6.0.0" + } + }, + "node_modules/docx-preview": { + "version": "0.3.5", + "resolved": "https://registry.npmmirror.com/docx-preview/-/docx-preview-0.3.5.tgz", + "integrity": "sha512-nod1jG5PkvzDIiZAcgAY4gSFQzgmAAChcuZH4Hj9dj7oCzscY3Hn8NfbUv7X7Jk4xL1lfKO113JLDhWKOt6fYw==", + "dependencies": { + "jszip": ">=3.0.0" } }, "node_modules/docxtemplater": { @@ -7455,14 +7468,6 @@ "node": ">=8.17.0" } }, - "node_modules/to-fast-properties": { - "version": "2.0.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=4" - } - }, "node_modules/to-regex-range": { "version": "5.0.1", "dev": true, @@ -8086,6 +8091,57 @@ }, "peerDependencies": { "vue": "^3.0.0" + } + }, + "node_modules/vue-print-nb": { + "version": "1.7.5", + "resolved": "https://registry.npmmirror.com/vue-print-nb/-/vue-print-nb-1.7.5.tgz", + "integrity": "sha512-iNbNyUVRWz0Ha1UTiCKxMPtHLUDGgNI8e8xmD3xqm9RlXIUeX9bT7DgNAfY8vPzqyFRHqGjxLI1rycKH366ziQ==", + "dependencies": { + "vue": "^2.6.11" + } + }, + "node_modules/vue-print-nb/node_modules/@vue/compiler-sfc": { + "version": "2.7.16", + "resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz", + "integrity": "sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==", + "dependencies": { + "@babel/parser": "^7.23.5", + "postcss": "^8.4.14", + "source-map": "^0.6.1" + }, + "optionalDependencies": { + "prettier": "^1.18.2 || ^2.0.0" + } + }, + "node_modules/vue-print-nb/node_modules/csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" + }, + "node_modules/vue-print-nb/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmmirror.com/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "optional": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/vue-print-nb/node_modules/vue": { + "version": "2.7.16", + "resolved": "https://registry.npmmirror.com/vue/-/vue-2.7.16.tgz", + "integrity": "sha512-4gCtFXaAA3zYZdTp5s4Hl2sozuySsgz4jy1EnpBHNfpMa9dK1ZCG7viqBPCwXtmgc8nHqUsAu3G4gtmXkkY3Sw==", + "deprecated": "Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details.", + "dependencies": { + "@vue/compiler-sfc": "2.7.16", + "csstype": "^3.1.0" } }, "node_modules/vue-router": { @@ -8758,12 +8814,14 @@ } }, "@babel/helper-string-parser": { - "version": "7.19.4", - "dev": true + "version": "7.27.1", + "resolved": "https://registry.npmmirror.com/@babel/helper-string-parser/-/helper-string-parser-7.27.1.tgz", + "integrity": "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA==" }, "@babel/helper-validator-identifier": { - "version": "7.19.1", - "dev": true + "version": "7.27.1", + "resolved": "https://registry.npmmirror.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.27.1.tgz", + "integrity": "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow==" }, "@babel/helper-validator-option": { "version": "7.18.6", @@ -8842,7 +8900,12 @@ } }, "@babel/parser": { - "version": "7.20.5" + "version": "7.27.5", + "resolved": "https://registry.npmmirror.com/@babel/parser/-/parser-7.27.5.tgz", + "integrity": "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg==", + "requires": { + "@babel/types": "^7.27.3" + } }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { "version": "7.18.6", @@ -9515,12 +9578,12 @@ } }, "@babel/types": { - "version": "7.20.5", - "dev": true, + "version": "7.27.6", + "resolved": "https://registry.npmmirror.com/@babel/types/-/types-7.27.6.tgz", + "integrity": "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q==", "requires": { - "@babel/helper-string-parser": "^7.19.4", - "@babel/helper-validator-identifier": "^7.19.1", - "to-fast-properties": "^2.0.0" + "@babel/helper-string-parser": "^7.27.1", + "@babel/helper-validator-identifier": "^7.27.1" } }, "@colors/colors": { @@ -10998,6 +11061,14 @@ "dev": true, "requires": { "esutils": "^2.0.2" + } + }, + "docx-preview": { + "version": "0.3.5", + "resolved": "https://registry.npmmirror.com/docx-preview/-/docx-preview-0.3.5.tgz", + "integrity": "sha512-nod1jG5PkvzDIiZAcgAY4gSFQzgmAAChcuZH4Hj9dj7oCzscY3Hn8NfbUv7X7Jk4xL1lfKO113JLDhWKOt6fYw==", + "requires": { + "jszip": ">=3.0.0" } }, "docxtemplater": { @@ -13309,10 +13380,6 @@ "rimraf": "^3.0.0" } }, - "to-fast-properties": { - "version": "2.0.0", - "dev": true - }, "to-regex-range": { "version": "5.0.1", "dev": true, @@ -13669,6 +13736,47 @@ "@vue/devtools-api": "^6.5.0" } }, + "vue-print-nb": { + "version": "1.7.5", + "resolved": "https://registry.npmmirror.com/vue-print-nb/-/vue-print-nb-1.7.5.tgz", + "integrity": "sha512-iNbNyUVRWz0Ha1UTiCKxMPtHLUDGgNI8e8xmD3xqm9RlXIUeX9bT7DgNAfY8vPzqyFRHqGjxLI1rycKH366ziQ==", + "requires": { + "vue": "^2.6.11" + }, + "dependencies": { + "@vue/compiler-sfc": { + "version": "2.7.16", + "resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz", + "integrity": "sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==", + "requires": { + "@babel/parser": "^7.23.5", + "postcss": "^8.4.14", + "prettier": "^1.18.2 || ^2.0.0", + "source-map": "^0.6.1" + } + }, + "csstype": { + "version": "3.1.3", + "resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.3.tgz", + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" + }, + "prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmmirror.com/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "optional": true + }, + "vue": { + "version": "2.7.16", + "resolved": "https://registry.npmmirror.com/vue/-/vue-2.7.16.tgz", + "integrity": "sha512-4gCtFXaAA3zYZdTp5s4Hl2sozuySsgz4jy1EnpBHNfpMa9dK1ZCG7viqBPCwXtmgc8nHqUsAu3G4gtmXkkY3Sw==", + "requires": { + "@vue/compiler-sfc": "2.7.16", + "csstype": "^3.1.0" + } + } + } + }, "vue-router": { "version": "4.1.6", "requires": { diff --git a/package.json b/package.json index 4b341e9..c219580 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@vueuse/core": "^9.7.0", "axios": "^1.2.1", "dayjs": "^1.11.13", + "docx-preview": "^0.3.5", "docxtemplater": "^3.50.0", "docxtemplater-image-module": "^3.1.0", "docxtemplater-image-module-free": "^1.1.1", @@ -37,6 +38,7 @@ "vue": "^3.2.45", "vue-demi": "^0.14.6", "vue-i18n": "^9.8.0", + "vue-print-nb": "^1.7.5", "vue-router": "^4.1.6", "xlsx": "^0.18.5" }, diff --git "a/public/\345\267\245\345\234\260\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.docx" "b/public/\345\267\245\345\234\260\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.docx" index c1a8470..5455724 100644 --- "a/public/\345\267\245\345\234\260\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.docx" +++ "b/public/\345\267\245\345\234\260\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.docx" Binary files differ diff --git "a/public/\351\244\220\351\245\256\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.doc" "b/public/\351\244\220\351\245\256\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.doc" deleted file mode 100644 index b65f9c3..0000000 --- "a/public/\351\244\220\351\245\256\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.doc" +++ /dev/null Binary files differ diff --git "a/public/\351\244\220\351\245\256\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.docx" "b/public/\351\244\220\351\245\256\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.docx" new file mode 100644 index 0000000..5ce80a0 --- /dev/null +++ "b/public/\351\244\220\351\245\256\345\267\241\346\237\245\345\215\225\346\215\256\346\250\241\346\235\277.docx" Binary files differ diff --git a/src/components/FYImageSelectDialog.vue b/src/components/FYImageSelectDialog.vue index 4d2602a..7a10793 100644 --- a/src/components/FYImageSelectDialog.vue +++ b/src/components/FYImageSelectDialog.vue @@ -9,9 +9,18 @@ :close-on-press-escape="false" > <el-row justify="end"> - <el-text v-if="onContextMenu != undefined" size="small" type="info">{{ - `锛�${contextMenuStr}锛塦 - }}</el-text> + <el-space v-if="onContextMenu != undefined"> + <el-switch + v-model="useContextMenu" + inline-prompt + active-text="寮�" + inactive-text="鍏�" + /> + <el-text size="small" type="info"> + {{ `锛�${contextMenuStr}锛塦 }} + </el-text> + </el-space> + <div v-if="!readonly"> <el-text size="small" type="info" class="m-r-8" >鏈�澶氶�夋嫨{{ maxSelect }}寮犲浘鐗�</el-text @@ -104,7 +113,7 @@ }, contextMenuStr: { type: String, - default: '鍙抽敭鐐瑰嚮鍥剧墖瑙﹀彂棰濆鎿嶄綔' + default: '鍙抽敭鐐瑰嚮鍥剧墖绉诲姩' } }); @@ -113,6 +122,8 @@ const activeId = ref(''); const selectedImgUrlList = ref([]); + +const useContextMenu = ref(false); let loadedImgCount = ref(0); // 鍔犺浇鐘舵�� @@ -186,9 +197,9 @@ emit('update:dialogVisible', false); } -// 鍥剧墖鍙抽敭鐐瑰嚮鏃堕棿 +// 鍥剧墖鍙抽敭鐐瑰嚮浜嬩欢 function showContextMenu(event, index) { - if (props.onContextMenu) { + if (props.onContextMenu && useContextMenu.value) { event.preventDefault(); props.onContextMenu(event, activeId.value, index); } diff --git a/src/views/fysp/scene/SceneInspectFile.vue b/src/views/fysp/scene/SceneInspectFile.vue index ddd17c8..3e1d912 100644 --- a/src/views/fysp/scene/SceneInspectFile.vue +++ b/src/views/fysp/scene/SceneInspectFile.vue @@ -53,9 +53,9 @@ <el-button type="primary" :loading="docLoading" @click="handelDownload"> 涓嬭浇 </el-button> - <el-button type="default" :loading="docLoading" @click="handelPrint"> + <!-- <el-button type="default" :loading="docLoading" @click="handelPrint"> 鎵撳嵃 - </el-button> + </el-button> --> </div> </template> </el-dialog> @@ -124,6 +124,20 @@ emits('update:modelValue', value); } +function setParam(value, length) { + const _value = value ? value : ''; + const offset = length - _value.length; + if (offset > 0) { + let str = _value; + for (let i = 0; i < offset; i++) { + str += ' '; + } + return str; + } else { + return _value; + } +} + // 鏍煎紡鍖栧満鏅俊鎭紝鐢熸垚鍙傛暟缁撴瀯 function parseParam() { const selected = sceneInfoList.value.filter((v, i) => { @@ -137,16 +151,19 @@ type: v.scense.typeid, params: { district: v.scense.districtname, - name: v.scense.name, - employerUnit: v.scense.csEmployerUnit, - constructionUnit: v.subScene.csConstructionUnit, - timeRange: v.subScene.csStartTime - ? `${v.subScene.csStartTime}鑷�${v.subScene.csEndTime}` - : undefined, - stage: v.subScene.siExtension1, - contacts: v.subScene.csConstructionContacts, - contactsTel: v.subScene.csConstructionContactsTel, - location: v.scense.location + name: setParam(v.scense.name, 57), + employerUnit: setParam(v.scense.csEmployerUnit, 30), + constructionUnit: setParam(v.subScene.csConstructionUnit, 36), + timeRange: setParam( + v.subScene.csStartTime + ? `${v.subScene.csStartTime}鑷�${v.subScene.csEndTime}` + : '', + 26 + ), + stage: setParam(v.subScene.siExtension1, 36), + contacts: setParam(v.scense.contacts, 27), + contactsTel: setParam(v.scense.contactst, 40), + location: setParam(v.scense.location, 27) } }; // 椁愰ギ @@ -155,10 +172,10 @@ type: v.scense.typeid, params: { district: v.scense.districtname, - location: v.scense.location, - name: v.scense.name, - contacts: v.scense.contacts, - contactsTel: v.scense.contactst + location: setParam(v.scense.location, 63), + name: setParam(v.scense.name, 64), + contacts: setParam(v.scense.contacts, 67), + contactsTel: setParam(v.scense.contactst, 62) } }; // default: @@ -167,15 +184,15 @@ } }); - param.forEach((p) => { - for (const key in p.params) { - let value = p.params[key]; - if (value == undefined) { - // 鑻ュ睘鎬х己澶憋紝鍒欐敼涓�20涓┖鏍肩锛屽搴攚ord涓�10涓腑鏂囧瓧绗︾殑闀垮害 - p.params[key] = ' '; - } - } - }); + // param.forEach((p) => { + // for (const key in p.params) { + // let value = p.params[key]; + // if (value == undefined) { + // // 鑻ュ睘鎬х己澶憋紝鍒欐敼涓�20涓┖鏍肩锛屽搴攚ord涓�10涓腑鏂囧瓧绗︾殑闀垮害 + // p.params[key] = ' '; + // } + // } + // }); return param; } @@ -192,6 +209,8 @@ break; // 椁愰ギ case 5: + template = '/椁愰ギ宸℃煡鍗曟嵁妯℃澘.docx'; + _param = p.params; break; default: break; -- Gitblit v1.9.3