From 85b03822bb9b53f63d3d3543ce4582104eaac81f Mon Sep 17 00:00:00 2001 From: qianlishi <1432731663@qq.com> Date: Sat, 14 May 2022 15:40:22 +0800 Subject: [PATCH 1/2] upload --- .../src/components/AnjiPlus/anji-checkbox.vue | 2 +- .../src/components/AnjiPlus/anji-select.vue | 4 +- .../src/components/AnjiPlus/anji-upload.vue | 82 +++---------------- report-ui/src/views/reportManage/index.vue | 14 ++-- 4 files changed, 22 insertions(+), 80 deletions(-) diff --git a/report-ui/src/components/AnjiPlus/anji-checkbox.vue b/report-ui/src/components/AnjiPlus/anji-checkbox.vue index e78d4c67..e3587225 100644 --- a/report-ui/src/components/AnjiPlus/anji-checkbox.vue +++ b/report-ui/src/components/AnjiPlus/anji-checkbox.vue @@ -80,7 +80,7 @@ export default { }, // 从本地localStorage取 gaeaDict getOptionsFromLocalStorage() { - let dicts = JSON.parse(localStorage.getItem("gaeaDict")); + let dicts = JSON.parse(localStorage.getItem("AJReportDict")); let options = []; if (!dicts.hasOwnProperty(this.dictCode)) { return []; diff --git a/report-ui/src/components/AnjiPlus/anji-select.vue b/report-ui/src/components/AnjiPlus/anji-select.vue index f184126e..86d44cd5 100644 --- a/report-ui/src/components/AnjiPlus/anji-select.vue +++ b/report-ui/src/components/AnjiPlus/anji-select.vue @@ -244,9 +244,9 @@ export default { } return result; }, - // 从本地localStorage取 gaeaDict + // 从本地localStorage取 AJReportDict getOptionsFromLocalStorage() { - let dicts = JSON.parse(localStorage.getItem("gaeaDict")); + let dicts = JSON.parse(localStorage.getItem("AJReportDict")); let options = []; if (!dicts.hasOwnProperty(this.dictCode)) { return []; diff --git a/report-ui/src/components/AnjiPlus/anji-upload.vue b/report-ui/src/components/AnjiPlus/anji-upload.vue index 18c3b7eb..4f7282d0 100644 --- a/report-ui/src/components/AnjiPlus/anji-upload.vue +++ b/report-ui/src/components/AnjiPlus/anji-upload.vue @@ -15,26 +15,9 @@ >
- - - - + @@ -80,16 +63,7 @@ export default { } }, value: { - type: Array, - default: () => { - return []; - } - }, - uploadType: { - type: String, - default: () => { - return "img"; - } + type: Array | String } }, data() { @@ -118,38 +92,6 @@ export default { this.echoUpload(this.value); }, methods: { - // 图片 - typeImgShow(file) { - if (!file.fileType) return; - const fileType = file.fileType.toLowerCase(); - if ( - fileType == "jpg" || - fileType == "png" || - fileType == "gif" || - fileType == "icon" - ) { - return true; - } - return false; - }, - // pdf - typePdfShow(file) { - if (!file.fileType) return; - const fileType = file.fileType.toLowerCase(); - if (fileType == "pdf") { - return true; - } - return false; - }, - // excel - typeExcelShow(file) { - if (!file.fileType) return; - const fileType = file.fileType.toLowerCase(); - if (fileType == "xlsx" || fileType == "xls" || fileType == "csv") { - return true; - } - return false; - }, handleRemove(file) { const fileList = []; this.fileList.forEach(el => { @@ -185,6 +127,7 @@ export default { // 回传出去 change() { const fileList = this.fileList; + console.log(fileList); this.$emit("input", fileList); this.$emit("change", fileList); }, @@ -214,18 +157,13 @@ export default { }, // 回显 echoUpload(val) { - if (val && val.length > 0) { - const fileList = []; - for (let i = 0; i < val.length; i++) { - const obj = {}; - obj.url = val[i].urlPath || val[i].url; - obj.fileType = val[i].fileType; - obj.fileId = val[i].fileId; - fileList.push(obj); - } - fileList.forEach((el, index) => { - this.$set(this.fileList, index, el); - }); + console.log(val); + if (val) { + this.fileList = [ + { + url: val + } + ]; } else { this.fileList = []; } diff --git a/report-ui/src/views/reportManage/index.vue b/report-ui/src/views/reportManage/index.vue index 5ddde90e..60e6d43f 100644 --- a/report-ui/src/views/reportManage/index.vue +++ b/report-ui/src/views/reportManage/index.vue @@ -4,7 +4,7 @@ * @Author: qianlishi * @Date: 2021-12-11 14:48:27 * @LastEditors: qianlishi - * @LastEditTime: 2022-03-09 09:54:15 + * @LastEditTime: 2022-05-14 15:23:55 -->