Browse Source

Merge remote-tracking branch 'origin/master'

ZaiZai 1 năm trước cách đây
mục cha
commit
9f7d883f97

+ 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)
 
 
 //获取表单的下拉框测站点数据

+ 2 - 2
src/api/modules/tentative/collect/month.js

@@ -16,14 +16,14 @@ export const editRemark = (form, msg = true) => httpApi({
 }, msg)
 
 //月报汇总下载
-export const download = (form, msg = true) => httpApi({
+export const downloadMonth = (form, msg = true) => httpApi({
     url: '/api/blade-business/trial/summary/monthly/download',
     method: 'post',
     data: form,
 }, msg)
 
 //月报汇总打印
-export const print = (form, msg = true) => httpApi({
+export const printMonth = (form, msg = true) => httpApi({
     url: '/api/blade-business/trial/summary/monthly/print',
     method: 'post',
     data: form,

+ 78 - 26
src/views/data-fill/components/HcUpload.vue

@@ -1,22 +1,32 @@
 <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"
         :on-exceed="uploadExceed" :on-preview="uploadPreview" :on-progress="uploadprogress"
         :on-remove="uploadRemove" :on-success="uploadSuccess" class="hc-upload-border"
         drag multiple
+        :auto-upload="autoUpload"
     >
-        <div v-loading="uploadDisabled" :element-loading-text="loadingText" class="hc-upload-loading">
-            <HcIcon name="backup" ui="text-5xl mt-4" />
-            <div class="el-upload__text">拖动文件到这里 或 <em>点击这里选择文件</em> 并上传</div>
-        </div>
+        <template #trigger>
+            <div v-loading="uploadDisabled" :element-loading-text="loadingText" class="hc-upload-loading" @click="submitUpload">
+                <HcIcon name="backup" ui="text-5xl mt-4" />
+                <div class="el-upload__text">拖动文件到这里 或 <em>点击这里选择文件</em></div>
+            </div>
+        </template>
+      
         <template #tip>
             <div class="el-upload__tip" style="font-size: 14px;">
                 {{ acceptTip }}
             </div>
         </template>
     </el-upload>
+    <div class="mt-3 ">
+        <el-button v-if="!autoUpload" type="primary" @click="submitUpload">
+            确认上传
+        </el-button>
+    </div>
 </template>
 
 <script setup>
@@ -25,6 +35,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: {
@@ -51,6 +62,14 @@ const props = defineProps({
         type:String,
         default:'允许格式:jpg/png/pdf/excel/word, 文件大小 小于 60MB',
     },
+    autoUpload:{
+        type:Boolean,
+        default:true,
+    },
+    typevalue:{
+        type:[String, Number],
+        default:'',
+    }, //附件类型
 
 })
 
@@ -64,6 +83,9 @@ const accept = ref(props.accept)
 const acceptTip = ref(props.acceptTip)
 const uploadDisabled = ref(false)
 const isCanuploadVal = ref(props.isCanupload)
+const autoUpload = ref(props.autoUpload)
+const typevalue = ref(props.typevalue)
+
 
 //监听
 watch(() => [
@@ -73,13 +95,18 @@ watch(() => [
     props.action,
     props.accept,
     props.acceptTip,
-], ([fileList, datas, isCanupload, Action, Accept, Tip]) => {
+    props.autoUpload,
+    props.typevalue,
+
+], ([fileList, datas, isCanupload, Action, Accept, Tip, auto, type]) => {
     uploadData.value = datas
     fileListData.value = fileList
     isCanuploadVal.value = isCanupload
     action.value = Action
     accept.value = Accept
     acceptTip.value = Tip
+    autoUpload.value = auto
+    typevalue.value = type
 })
 
 //渲染完成
@@ -143,35 +170,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 (!id || 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 (!id || 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
+            }
         }
+      
     }
 }
 
@@ -180,4 +223,13 @@ const uploadRemove = () => {
         emit('change', { type: 'del' })
     }
 }
+
+const submitUpload = () => {
+    if (!typevalue.value && !autoUpload.value) {
+        window.$message.warning('请先选择附件类型')
+        return
+    }
+
+  uploadRef.value.submit()
+}
 </script>

+ 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

+ 14 - 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,11 @@
                 </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"
+                :auto-upload="false"
+                :typevalue="typevalue"
                 @change="uploadChange"
                 @close="uploadModalClose"
-                @upload="beforeUpload"
             />
         </hc-new-dialog>
     </div>
@@ -554,7 +556,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 +2009,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 +2024,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 +2045,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') {

+ 77 - 22
src/views/tentative/collect/monthly.vue

@@ -42,13 +42,15 @@
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="tentative_collect_monthly_print">
-                        <el-button hc-btn color="#567722" @click="print">
+                        <el-button hc-btn color="#567722" :loading="printLoading" @click="printClick">
                             <HcIcon name="printer" />
                             <span>打印</span>
                         </el-button>
                     </HcTooltip>
                     <HcTooltip keys="tentative_collect_monthly_download">
-                        <el-button hc-btn color="#A16222">
+                        <el-button
+                            hc-btn color="#A16222" :loading="downLoading" @click="downClick"
+                        >
                             <HcIcon name="download" />
                             <span>下载</span>
                         </el-button>
@@ -102,11 +104,11 @@ import { useAppStore } from '~src/store'
 
 
 import queryApi from '~api/data-fill/query'
-import { calcDate, getArrValue } from 'js-fast-way'
+import { calcDate, downloadBlob, getArrValue, isString } from 'js-fast-way'
 import { getDictionary } from '~api/other'
 import samplingApi from '~api/tentative/material/sampling'
-import { editRemark, getMonthPage } from '~api/tentative/collect/month'
-import { isExactlyOneMonthApart } from '~uti/tools'
+import { downloadMonth, editRemark, getMonthPage, printMonth } from '~api/tentative/collect/month'
+import { toPdfPage } from '~uti/btn-auth'
 
 const useAppState = useAppStore()
 
@@ -294,6 +296,7 @@ const getTableData = async () => {
                 name: ele.currentMonth.qualifiedTotal,
                 state: ele.currentMonth.unQualifiedTotal,
                 zip:  ele.currentMonth.remarks,
+                recordId:ele.currentMonth.recordId,
 
             }
             let obj2 = {
@@ -302,6 +305,7 @@ const getTableData = async () => {
                 name: ele.totalMonth.qualifiedTotal,
                 state: ele.totalMonth.unQualifiedTotal,
                 zip:  ele.totalMonth.remarks,
+                recordId:ele.totalMonth.recordId,
 
             }
             arr.push(obj1)
@@ -309,8 +313,8 @@ const getTableData = async () => {
              tableData.value = arr
              searchForm.value.total = data['total']
         })
-  
-   
+
+
 
         } else {
             tableData.value = []
@@ -321,8 +325,13 @@ const getTableData = async () => {
 //新增/编辑
 const editorsNoteModal = ref(false)
 const editorsNoteVal = ref('')
+const recordId = ref('')
 const editorsNoteModalClick = (row) => {
+    console.log(row, 'row')
     editorsNoteModal.value = true
+    recordId.value = row.recordId
+
+
 }
 
 //保存
@@ -331,35 +340,81 @@ const editorsNoteModalSave = async (id) => {
     // editorsNoteModal.value = true
     const { error, code, data, msg } = await editRemark({
         contractId: contractId.value,
-        recordId: id,
+        recordId: recordId.value,
         remarks:editorsNoteVal.value,
-      
+
     })
     //判断状态
     if (!error && code === 200) {
-     window.$message.success(msg)
+     window.$message.success('操作成功')
      editorsNoteModal.value = false
+     getTableData()
     }
 }
 const editorsNoteModalClose = () => {
     editorsNoteModal.value = false
 }
 
+const printLoading = ref(false)
+const printClick = async ()=>{
+    printLoading.value = true
+    if (!searchForm.value.type) {
+        window.$message.warning('请选择检查类别')
+        return
+    } else if (!searchForm.value.startTime || !searchForm.value.endTime) {
+        window.$message.warning('请选择开始时间和结束时间')
+        return
+    } else if (searchForm.value.ids) {
+        window.$message.warning('请选择试验检测项目名称')
+        return
+    }
+    const { error, code, data } = await printMonth({
+            ...searchForm.value,
+            ids:'1635200237830144002',
+            contractId:contractId.value,
+        })
+        printLoading.value = false
+        //判断状态
+        const res = isString(data) ? data || '' : ''
+            if (!error && code === 200 && res) {
+                toPdfPage(res)
+                //window.open(res, '_blank')
+            }
 
-//左右拖动,改变树形结构宽度
-const leftWidth = ref(382)
-const onmousedown = () => {
-    const leftNum = isCollapse.value ? 142 : 272
-    document.onmousemove = (ve) => {
-        let diffVal = ve.clientX - leftNum
-        if (diffVal >= 310 && diffVal <= 900) {
-            leftWidth.value = diffVal
-        }
+}
+const downLoading = ref(false)
+const downClick = async ()=>{
+    downLoading.value = true
+    if (!searchForm.value.type) {
+        window.$message.warning('请选择检查类别')
+        return
+    } else if (!searchForm.value.startTime || !searchForm.value.endTime) {
+        window.$message.warning('请选择开始时间和结束时间')
+        return
+    } else if (searchForm.value.ids) {
+        window.$message.warning('请选择试验检测项目名称')
+        return
     }
-    document.onmouseup = () => {
-        document.onmousemove = null
-        document.onmouseup = null
+    const {error, code, data} = await downloadMonth({
+            ...searchForm.value,
+            ids:'1635200237830144002',
+            contractId:contractId.value,
+        })
+        downLoading.value = false
+        /*//判断状态
+        if (!error) {
+        if (disposition) {
+            downloadBlob(res, disposition)
+        } else {
+            window.$message?.error('数据异常')
+        }
+    }*///判断状态
+    const res = isString(data) ? data || '' : ''
+    if (!error && code === 200 && res) {
+        //toPdfPage(res)
+        window.open(res, '_blank')
     }
+
 }
 </script>