6
jinlin
2023-12-03 c8d8a511f45c96ed3a5123a88e48de2ffdbf632a
web/src/components/config-uploader/src/config-uploader.vue
@@ -27,7 +27,7 @@
        </el-table>
      </el-collapse-item>
    </el-collapse>
    <div v-else class="config-uploader" v-model="activeNames" >
    <div v-else class="config-uploader" v-model="activeNames">
      <div v-for="group in (oss.groups || [])" :key="group.busiFieldGroup">
        <!-- <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%;">
@@ -53,7 +53,7 @@
              <zt-uploader v-model="dataForm[scope.row.busiField]" :dataForm="dataForm" multiple
                           :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)"/>
                           @input="change(scope.row.busiField)" @getUploaderImg="getUploaderImg"/>
            </template>
          </el-table-column>
        </el-table>
@@ -82,13 +82,13 @@
      fields() {
        let arr = []
        if (this.dataForm.files && this.dataForm.files.groups) {
          console.log(this.dataForm,"fields this.dataForm")
          this.dataForm.files.groups.forEach(group => {
            group.fields.forEach(field => {
              let arrType = []
              if (field.fileTypes) {
                arrType = field.fileTypes.split(',')
              }
              //this.$set(field, 'fileTypeArr', arrType)
              field.fileTypeArr = arrType
              arr.push(field)
            })
@@ -139,21 +139,33 @@
              field.fileTypeArr = arrType
            })
          })
          console.log(JSON.parse(JSON.stringify(arr[0])),'JSON.parse(JSON.stringify(arr[0]))')
          console.log(JSON.parse(JSON.stringify(arr[0])), 'JSON.parse(JSON.stringify(arr[0]))')
          return JSON.parse(JSON.stringify(arr[0]))
        }
        return null
      },
      getUploaderImg(list) {
        // this.imageList = list
        if (list[0].url) {
          this.$emit('getImageUrl', list[0].url)
        }
      },
      change(busiField) {
        console.log(busiField, 'config_uploader change(busiField) busiField')
        this.fields.forEach(field => {
          if (field.busiField === busiField) {
            field.files.length = 0
            this.dataForm[busiField].forEach(file => field.files.push(file))
            this.dataForm[busiField].forEach(file => {
                field.files.push(file)
              }
            )
            if (this.dataForm) {
              this.dataForm.hasUploadFinsh = 100
            }
          }
        })
        console.log(this.dataForm, 'config_uploader change(busiField)')
        this.$emit('getImageUrl')
      }
    }
  }
@@ -162,7 +174,8 @@
  .config-uploader label {
    width: 260px !important;
  }
   .zt .el-upload-list__item .el-progress{
    top:15px !important;
  .zt .el-upload-list__item .el-progress {
    top: 15px !important;
  }
</style>