Browse Source

Merge remote-tracking branch 'origin/master'

liuyc 8 tháng trước cách đây
mục cha
commit
6c659c0932

+ 6 - 0
src/api/modules/other.js

@@ -57,6 +57,12 @@ export const getDictionary = (form, msg = true) => httpApi({
     method: 'get',
     params: form,
 }, msg)
+//业务字典
+export const getDictionaryBiz = (form, msg = true) => httpApi({
+    url: '/api/blade-system/dict-biz/dictionary',
+    method: 'get',
+    params: form,
+}, msg)
 
 
 //获取表单的下拉框测站点数据

+ 43 - 21
src/views/data-fill/components/HcUpload.vue

@@ -1,5 +1,6 @@
 <template>
     <el-upload
+        ref="uploadRef"
         :accept="accept" :action="action" :before-remove="delUploadData" :before-upload="beforeUpload"
         :data="uploadData"
         :disabled="isCanuploadVal" :file-list="fileListData" :headers="getTokenHeader()" :on-error="uploadError"
@@ -25,6 +26,7 @@ import { getTokenHeader } from '~src/api/request/header'
 import wbsApi from '~api/data-fill/wbs'
 import { isFileSize } from 'js-fast-way'
 import { toPdfPage } from '~uti/btn-auth'
+import { number } from 'echarts'
 
 const props = defineProps({
     fileList: {
@@ -52,6 +54,7 @@ const props = defineProps({
         default:'允许格式:jpg/png/pdf/excel/word, 文件大小 小于 60MB',
     },
 
+
 })
 
 //事件
@@ -65,6 +68,7 @@ const acceptTip = ref(props.acceptTip)
 const uploadDisabled = ref(false)
 const isCanuploadVal = ref(props.isCanupload)
 
+
 //监听
 watch(() => [
     props.fileList,
@@ -73,6 +77,7 @@ watch(() => [
     props.action,
     props.accept,
     props.acceptTip,
+
 ], ([fileList, datas, isCanupload, Action, Accept, Tip]) => {
     uploadData.value = datas
     fileListData.value = fileList
@@ -80,6 +85,7 @@ watch(() => [
     action.value = Action
     accept.value = Accept
     acceptTip.value = Tip
+
 })
 
 //渲染完成
@@ -143,35 +149,51 @@ const uploadPreview = ({ url }) => {
         window.open(url, '_blank')
     }*/
 }
-
+const uploadRef = ref(null)
 //删除文件
-const delUploadData = async ({ id }) => {
+const delUploadData = async (res) => {
+    const { id, status } = res
+
     if (accept.value === 'application/pdf') {
-        loadingText.value = '删除中...'
-        uploadDisabled.value = true
-        const { error, code } = await wbsApi.delTabById({
-            ids: id,
-        })
-        uploadDisabled.value = false
-        if (!error && code === 200) {
-            window?.$message?.success('删除成功')
+        if (status === 'uploading') {
+            uploadRef.value.abort()
+            uploadDisabled.value = false
             return true
-        } else {
-            return false
+         } else {
+            loadingText.value = '删除中...'
+            uploadDisabled.value = true
+            const { error, code } = await wbsApi.delTabById({
+                ids: id,
+            })
+            uploadDisabled.value = false
+            if (!error && code === 200) {
+                window?.$message?.success('删除成功')
+                return true
+            } else {
+                return false
+            }
         }
+        
     } else {
-        loadingText.value = '删除中...'
-        uploadDisabled.value = true
-        const { error, code } = await wbsApi.removeBussFile({
-            ids: id,
-        })
-        uploadDisabled.value = false
-        if (!error && code === 200) {
-            window?.$message?.success('删除成功')
+        if (status === 'uploading') {
+            uploadRef.value.abort()
+            uploadDisabled.value = false
             return true
         } else {
-            return false
+            loadingText.value = '删除中...'
+            uploadDisabled.value = true
+            const { error, code } = await wbsApi.removeBussFile({
+                ids: id,
+            })
+            uploadDisabled.value = false
+            if (!error && code === 200) {
+                window?.$message?.success('删除成功')
+                return true
+            } else {
+                return false
+            }
         }
+      
     }
 }
 

+ 3 - 3
src/views/data-fill/query.vue

@@ -608,17 +608,17 @@ const tableRowName = (row) => {
     // } else {
     //     window.$message?.warning('文件不存在')
     // }
-    bussPreview()
+    bussPreview(row)
 }
 
 
 //多表预览
 const bussPreviewLoading = ref(false)
-const bussPreview = async () => {
+const bussPreview = async (row) => {
     const info = nodeDataInfo.value
     bussPreviewLoading.value = true
     const { error, code, data } = await wbsApi.getBussPdfs({
-        nodeId: info?.primaryKeyId || '',
+        nodeId: row?.wbsId || '',
         classify: contractTypeTabKey.value,
         projectId: projectId.value,
         // contractId: contractId.value

+ 13 - 14
src/views/data-fill/wbs.vue

@@ -514,6 +514,7 @@
                     placeholder="请选择"
                     style="width: 240px"
                     clearable
+                    @change="changeType"
                 >
                     <el-option
                         v-for="item in typeoptions"
@@ -524,10 +525,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"
+                :disabled="!typevalue"
                 @change="uploadChange"
                 @close="uploadModalClose"
-                @upload="beforeUpload"
             />
         </hc-new-dialog>
     </div>
@@ -554,7 +555,7 @@ import {
     isString,
     setCopyText,
 } from 'js-fast-way'
-import { eVisaTaskCheckApi, getDictionary } from '~api/other'
+import { eVisaTaskCheckApi, getDictionary, getDictionaryBiz } from '~api/other'
 import wbsApi from '~api/data-fill/wbs'
 import queryApi from '~api/data-fill/query'
 import Draggable from 'vuedraggable'
@@ -2007,8 +2008,8 @@ const typeoptions = ref([
   },
 ])
 const getFileTypeApi = async () => {
-    const { data } = await getDictionary({
-        code: 'wbs_node_type',
+    const { data } = await getDictionaryBiz({
+        code: 'table_file_type',
     })
     //处理数据
     let newArr = []
@@ -2022,14 +2023,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([])
@@ -2050,18 +2044,23 @@ const getBussFileList = async (pkeyId) => {
         fileListData.value = []
     }
 }
-const addFilelist = ()=>{
+const addFilelist = async ()=>{
     getBussFileList(primaryKeyId.value)
      uploadModal.value = true
-    //  getFileTypeApi()
+    await getFileTypeApi()
+  
        //上传的配置
        uploadData.value = {
                 classify:authBtnTabKey.value,
                 nodeId: primaryKeyId.value,
                 type:typevalue.value,
+                contractId:contractId.value,
             }
 
 }
+const changeType = (val)=>{
+    uploadData.value.type = val
+}
 //上传文件
 const uploadChange = async ({ type }) => {
     if (type === 'success') {