Parcourir la source

fix:修复平台表单子表上传附件无效和重复上传的bug

luoaoxuan il y a 1 an
Parent
commit
ffa4695104

+ 9 - 0
src/business/platform/form/formrender/dynamic-form/dynamic-form-field.vue

@@ -387,6 +387,7 @@
             :media="fieldOptions.media"
             :media="fieldOptions.media"
             :style="{ width: width }"
             :style="{ width: width }"
             v-on="$listeners"
             v-on="$listeners"
+            @input="resetFileId"
         />
         />
         <!-- 选择器-->
         <!-- 选择器-->
         <div v-else-if="(fieldType === 'selector' || fieldType === 'currentUser' || fieldType === 'currentOrg' || fieldType === 'currentPosition') && readonlyText && !dataModel" :class="isTable ? '' : 'ibps-field-text-no'">/</div>
         <div v-else-if="(fieldType === 'selector' || fieldType === 'currentUser' || fieldType === 'currentOrg' || fieldType === 'currentPosition') && readonlyText && !dataModel" :class="isTable ? '' : 'ibps-field-text-no'">/</div>
@@ -979,6 +980,7 @@ export default {
         },
         },
         dataModel: {
         dataModel: {
             handler (val) {
             handler (val) {
+                if (this.fieldType === 'attachment') return
                 this.$emit('update:value', val)
                 this.$emit('update:value', val)
             },
             },
             deep: true
             deep: true
@@ -1250,6 +1252,13 @@ export default {
         proceedCont () {
         proceedCont () {
             // 防止恶意查询 。 为空表示可以点击了
             // 防止恶意查询 。 为空表示可以点击了
             this.watchKey = false
             this.watchKey = false
+        },
+        // 解决同一个附件重复上传的问题
+        resetFileId (val) {
+            if (val) {
+                this.dataModel = [...new Set(val.split(','))].join(',')
+            }
+            this.$emit('update:value', this.dataModel)
         }
         }
     }
     }
 }
 }

+ 4 - 0
src/business/platform/form/formrender/dynamic-form/dynamic-form-table-item.vue

@@ -143,6 +143,10 @@ export default {
                 if (this.field.field_type === 'checkbox') {
                 if (this.field.field_type === 'checkbox') {
                     this.handleModels(this.field.name, Array.isArray(val) ? val.join(',') : val)
                     this.handleModels(this.field.name, Array.isArray(val) ? val.join(',') : val)
                 }
                 }
+                // 对附件的处理
+                if (this.field.field_type === 'attachment') {
+                    this.handleModels(this.field.name, val)
+                }
                 this.$nextTick(() => {
                 this.$nextTick(() => {
                     // 值改变进行公式计算
                     // 值改变进行公式计算
                     this.runCalFormula()
                     this.runCalFormula()