Răsfoiți Sursa

上传文件修改

duy 1 an în urmă
părinte
comite
c260d5c971
2 a modificat fișierele cu 24 adăugiri și 13 ștergeri
  1. 19 2
      src/views/data-fill/components/HcUpload.vue
  2. 5 11
      src/views/data-fill/wbs.vue

+ 19 - 2
src/views/data-fill/components/HcUpload.vue

@@ -2,10 +2,11 @@
     <el-upload
         :accept="accept" :action="action" :before-remove="delUploadData" :before-upload="beforeUpload"
         :data="uploadData"
-        :disabled="isCanuploadVal" :file-list="fileListData" :headers="getTokenHeader()" :on-error="uploadError"
+        :disabled="isCanuploadVal || !typevalue" :file-list="fileListData" :headers="getTokenHeader()" :on-error="uploadError"
         :on-exceed="uploadExceed" :on-preview="uploadPreview" :on-progress="uploadprogress"
         :on-remove="uploadRemove" :on-success="uploadSuccess" class="hc-upload-border"
         drag multiple
+        @click="clickUPload"
     >
         <div v-loading="uploadDisabled" :element-loading-text="loadingText" class="hc-upload-loading">
             <HcIcon name="backup" ui="text-5xl mt-4" />
@@ -51,6 +52,10 @@ const props = defineProps({
         type:String,
         default:'允许格式:jpg/png/pdf/excel/word, 文件大小 小于 60MB',
     },
+    typevalue:{
+        type:String,
+        default:'',
+    },
 
 })
 
@@ -64,6 +69,7 @@ const accept = ref(props.accept)
 const acceptTip = ref(props.acceptTip)
 const uploadDisabled = ref(false)
 const isCanuploadVal = ref(props.isCanupload)
+const typevalue = ref(props.typevalue)
 
 //监听
 watch(() => [
@@ -73,13 +79,15 @@ watch(() => [
     props.action,
     props.accept,
     props.acceptTip,
-], ([fileList, datas, isCanupload, Action, Accept, Tip]) => {
+    props.typevalue,
+], ([fileList, datas, isCanupload, Action, Accept, Tip, type]) => {
     uploadData.value = datas
     fileListData.value = fileList
     isCanuploadVal.value = isCanupload
     action.value = Action
     accept.value = Accept
     acceptTip.value = Tip
+    typevalue.value = type
 })
 
 //渲染完成
@@ -180,4 +188,13 @@ const uploadRemove = () => {
         emit('change', { type: 'del' })
     }
 }
+const clickUPload = ()=>{
+    console.log(111111111)
+    if (!typevalue.value) {
+        isCanuploadVal.value = true
+        window.$message.warning('请先选择模板')
+        return
+
+    }
+}
 </script>

+ 5 - 11
src/views/data-fill/wbs.vue

@@ -524,10 +524,10 @@
                 </el-select>
             </div>
             <HcUpload
-                :datas="uploadData" :file-list="fileListData" :is-canupload="false" action="/api/blade-manager/exceltab/add-bussfile-node" accept="application/pdf" accept-tip="允许格式:pdf" :disabled="!typevalue"
+                :datas="uploadData" :file-list="fileListData" :is-canupload="false" action="/api/blade-manager/exceltab/add-bussfile-node" accept="application/pdf" accept-tip="允许格式:pdf"
+                :typevalue="typevalue"
                 @change="uploadChange"
                 @close="uploadModalClose"
-                @upload="beforeUpload"
             />
         </hc-new-dialog>
     </div>
@@ -2008,7 +2008,7 @@ const typeoptions = ref([
 ])
 const getFileTypeApi = async () => {
     const { data } = await getDictionary({
-        code: 'wbs_node_type',
+        code: 'table_file_type',
     })
     //处理数据
     let newArr = []
@@ -2022,14 +2022,7 @@ const getFileTypeApi = async () => {
     typeoptions.value = newArr
 }
 const typevalue = ref('')
-const beforeUpload = ()=>{
-    console.log(1111111)
-    if (!typevalue.value) {
-        window.$message.warning('请先选择模板')
-        return
 
-    }
-}
 const isCanadd = ref(true)
  const uploadModal = ref(false)
  const fileListData = ref([])
@@ -2053,12 +2046,13 @@ const getBussFileList = async (pkeyId) => {
 const addFilelist = ()=>{
     getBussFileList(primaryKeyId.value)
      uploadModal.value = true
-    //  getFileTypeApi()
+     getFileTypeApi()
        //上传的配置
        uploadData.value = {
                 classify:authBtnTabKey.value,
                 nodeId: primaryKeyId.value,
                 type:typevalue.value,
+                contractId:contractId.value,
             }
 
 }