Explorar el Código

feat: 添加禁用属性到文件上传组件,优化文件列表和编辑功能的交互

xieyong hace 3 semanas
padre
commit
70d4c4b841
Se han modificado 2 ficheros con 20 adiciones y 4 borrados
  1. 10 2
      src/components/addDoc/index.vue
  2. 10 2
      src/components/addDoc/main.vue

+ 10 - 2
src/components/addDoc/index.vue

@@ -20,7 +20,11 @@
       >
     </el-badge>
 
-    <file-upload @success="getFiles" ref="fileUploadRef"></file-upload>
+    <file-upload
+      @success="getFiles"
+      ref="fileUploadRef"
+      :disabled="disabled"
+    ></file-upload>
   </div>
 </template>
 
@@ -48,6 +52,10 @@
       size: {
         type: String,
         default: 'mini'
+      },
+      disabled: {
+        type: Boolean,
+        default: false
       }
     },
     data() {
@@ -66,7 +74,7 @@
     created() {},
     methods: {
       handleUpload() {
-        this.$refs.fileUploadRef.open(this.selectVal, this.type);
+        this.$refs.fileUploadRef.open(this.selectVal, this.type, this.disabled);
       },
       getFiles(val = []) {
         this.$emit('updateVal', val);

+ 10 - 2
src/components/addDoc/main.vue

@@ -92,6 +92,12 @@
 
   export default {
     mixins: [tabMixins],
+    props: {
+      disabled: {
+        type: Boolean,
+        default: false
+      }
+    },
     components: { doc_template, fileEdit, browse },
 
     data() {
@@ -186,12 +192,14 @@
         this.init();
       },
       openFileList(type) {
+        if (this.disabled) return;
         this.fileShow = true;
         this.$nextTick(() => {
-          this.$refs.doc_templateRef.query(type)
-        })
+          this.$refs.doc_templateRef.query(type);
+        });
       },
       fileEditOpen() {
+        if (this.disabled) return;
         this.$refs.fileEditRef.open();
       },
       remove(row) {