From 60020d0f3faec25d8de05250b260c05c6eee78fa Mon Sep 17 00:00:00 2001 From: kilo Date: Mon, 29 May 2023 18:44:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/option/basic/basicPrintTemplate.js | 16 ++++++ .../printTemplate/basicPrintTemplate.vue | 56 +++++++++++++++++-- .../warehouse/basicdataWarehouse.vue | 1 + 3 files changed, 67 insertions(+), 6 deletions(-) diff --git a/src/option/basic/basicPrintTemplate.js b/src/option/basic/basicPrintTemplate.js index 630652ba..39119e21 100644 --- a/src/option/basic/basicPrintTemplate.js +++ b/src/option/basic/basicPrintTemplate.js @@ -146,6 +146,15 @@ export default { editDisplay: false, viewDisplay: true, }, + { + label: "文件名称", + labelWidth: '100', + prop: "fileName", + type: "input", + addDisplay: false, + editDisplay: false, + viewDisplay: true, + }, { label: "模板文件", fileText:'附件上传', @@ -162,11 +171,17 @@ export default { propsHttp: { res: 'data', url: 'link', + name:'originalName' }, addDisplay: true, editDisplay: true, viewDisplay: false, hide: true, + rules:[{ + required: true, + message: "请上传附件", + trigger: "blur" + }] } // { // label: "预留1", @@ -195,3 +210,4 @@ export default { // }, ] } + diff --git a/src/views/basic/printTemplate/basicPrintTemplate.vue b/src/views/basic/printTemplate/basicPrintTemplate.vue index 37daf8d2..96f0be2d 100644 --- a/src/views/basic/printTemplate/basicPrintTemplate.vue +++ b/src/views/basic/printTemplate/basicPrintTemplate.vue @@ -8,6 +8,8 @@ :data="data" :permission="permissionList" :before-open="beforeOpen" + :upload-after="uploadAfter" + :upload-before="uploadBefore" ref="crud" @row-update="rowUpdate" @row-save="rowSave" @@ -18,7 +20,10 @@ @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" - @on-load="onLoad"> + @on-load="onLoad" + :cell-class-name="addClass" + @cell-click="pageto" + > - + + + + + @@ -65,7 +72,9 @@ }, selectionList: [], option: option, - data: [] + data: [], + fileName:'', + }; }, computed: { @@ -88,6 +97,8 @@ }, methods: { rowSave(row, done, loading) { + console.log("row",row); + row.fileName = this.fileName; add(row).then(() => { this.onLoad(this.page); this.$message({ @@ -205,9 +216,38 @@ this.onLoad(this.page, this.query); }, //下载模板 - viewTemplate(row){ + dowloadTemplate(row){ window.open(row.templateUrl,'_blank') }, + + viewTemplate(row){ + console.log('查看模板'); + // window.open(row.templateUrl,'_blank') + }, + uploadBefore(file, done, loading,column){ + console.log("上传之前file",file); + this.fileName = file.name; + done(file); + }, + uploadAfter(res, done, loading,column){ + console.log("上传之前之后",res); + done(); + + }, + addClass({ row, column, rowIndex, columnIndex }){ + if (columnIndex===6 && !!row.fileName){ + return "cell-color"; + } + }, + pageto(row, column, cell, event){ + console.log("点击文件名称"); + if (column.label == "文件名称") { + // let path = this.$router.push({ + // path: row.templateUrl, + // }); + window.open(row.templateUrl) + } + }, onLoad(page, params = {}) { this.loading = true; @@ -234,4 +274,8 @@ diff --git a/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue b/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue index 45fb907f..0bd0d23b 100644 --- a/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue +++ b/src/views/basicdata/warehouse/warehouse/basicdataWarehouse.vue @@ -614,6 +614,7 @@ export default { handleEdit (row) { this.title = '编辑' this.box = true + this.$refs['form'].resetFields(); getDetail(row.id).then(res => { this.form = res.data.data; this.form.fireRatingNot = this.form.fireRatingNot.toString();