From 1a7af6fff5185bb257c16b0445140c93263a3331 Mon Sep 17 00:00:00 2001 From: jinlin <jinlin> Date: 星期一, 15 一月 2024 11:18:17 +0800 Subject: [PATCH] 修改 --- web/src/components/config-uploader/src/config-uploader.vue | 44 ++++++++++++++++++++++++++++---------------- 1 files changed, 28 insertions(+), 16 deletions(-) diff --git a/web/src/components/config-uploader/src/config-uploader.vue b/web/src/components/config-uploader/src/config-uploader.vue index bae704a..956ed4e 100644 --- a/web/src/components/config-uploader/src/config-uploader.vue +++ b/web/src/components/config-uploader/src/config-uploader.vue @@ -34,23 +34,24 @@ <zt-uploader v-model="dataForm[field.busiField]" multiple :limit="field.fileLimit" :file-type="field.fileType" :accept="field.accept" :file-size="field.fileSize" @input="change(field.busiField)"/> </zt-form-item>--> - <template slot="title"> - <el-tag>{{group.busiFieldGroup}}</el-tag> - </template> +<!-- <template slot="title">--> +<!-- <el-tag>{{group.busiFieldGroup}}</el-tag>--> +<!-- </template>--> <!-- <zt-form-item :label="field.busiFieldName" :prop="field.busiField" v-for="field in group.fields" :key="field.busiField" :rules="field.isRequired ? 'required':''" style="width: 100%;"> <zt-uploader v-model="dataForm[field.busiField]" multiple :limit="field.fileLimit" :file-type="field.fileType" :accept="field.accept" :file-size="field.fileSize" @input="change(field.busiField)"/> </zt-form-item>--> <el-table :data="group.fields" :show-header="false"> - <el-table-column width="180" style="text-align: left;white-space:nowrap;"> - <template slot-scope="scope"> - <span v-html="(scope.row.isRequired?'<font color=red>* </font>':'')+ scope.row.busiFieldName"></span> - </template> - </el-table-column> +<!-- <el-table-column width="180" style="text-align: left;white-space:nowrap;">--> +<!-- <template slot-scope="scope">--> +<!-- <span v-html="(scope.row.isRequired?'<font color=red>* </font>':'')+ scope.row.busiFieldName"></span>--> +<!-- </template>--> +<!-- </el-table-column>--> <el-table-column align="left"> <template slot-scope="scope"> <zt-uploader v-model="dataForm[scope.row.busiField]" :dataForm="dataForm" multiple + :lineHeight="lineHeight" :limit="scope.row.fileLimit" :file-type="scope.row.fileTypeArr" :showFileList2="false" :accept="scope.row.accept" :file-size="scope.row.fileSize" @input="change(scope.row.busiField)" @getUploaderImg="getUploaderImg"/> @@ -68,6 +69,14 @@ name: 'ConfigUploader', components: {}, props: { + busiTypeVarName: { + type : String, + default:'files' + }, + lineHeight:{ + type:Boolean, + default:false + }, value: Object, dataForm: Object, busiType: String // 涓氬姟绫诲瀷 @@ -81,9 +90,9 @@ computed: { fields() { let arr = [] - if (this.dataForm.files && this.dataForm.files.groups) { + if (this.value && this.value.groups) { console.log(this.dataForm,"fields this.dataForm") - this.dataForm.files.groups.forEach(group => { + this.value.groups.forEach(group => { group.fields.forEach(field => { let arrType = [] if (field.fileTypes) { @@ -104,9 +113,8 @@ ...this.getOss(), ...(val || {}) } - // this.dataForm.files = this.oss - this.$set(this.dataForm, 'files', this.oss) - + this.$set(this.dataForm, this.busiTypeVarName, this.oss) + console.log(this.fields, 'watch this.fields') // 鍒嗚В鍒版瘡涓瓧娈电粰dataForm璧嬪�� this.fields.forEach(field => { // this.dataForm[field.busiField] = field.files @@ -121,8 +129,7 @@ this.oss.groups.forEach(group => { this.activeNames.push(group.busiFieldGroup) }) - // this.dataForm.files = this.oss - this.$set(this.dataForm, 'files', this.oss) + this.$set(this.dataForm, this.busiTypeVarName, this.oss) } }, methods: { @@ -151,7 +158,11 @@ } }, change(busiField) { - console.log(busiField, 'config_uploader change(busiField) busiField') + console.log(busiField,this.uploadList, 'config_uploader change(busiField) busiField') + console.log(this.fields, 'change this.fields') + if (!Array.isArray(this.dataForm[busiField])) { + this.$set(this.dataForm, busiField, []) + } this.fields.forEach(field => { if (field.busiField === busiField) { field.files.length = 0 @@ -162,6 +173,7 @@ if (this.dataForm) { this.dataForm.hasUploadFinsh = 100 } + console.log(this.dataForm[busiField], 'config_uploader change(busiField) this.dataForm[busiField]') } }) console.log(this.dataForm, 'config_uploader change(busiField)') -- Gitblit v1.9.1