iZaiZaiA 2 лет назад
Родитель
Сommit
030a41109e

+ 40 - 0
src/api/modules/tentative/detect/test.js

@@ -81,6 +81,38 @@ export default {
             params: form
         }, msg);
     },
+    //自检表单复制
+    async copyBussTab(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/detection/self/copy-buss-tab',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //自检单表PDF预览
+    async getBussPdf(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/detection/get-buss-pdf',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //自检多表PDF预览
+    async getBussPdfs(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/detection/get-buss-pdfs',
+            method: 'get',
+            params: form
+        }, msg);
+    },
+    //自检隐藏表单
+    async showBussTab(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/detection/self/show-buss-tab',
+            method: 'get',
+            params: form
+        }, msg);
+    },
     //保存表单
     async saveExcelBussData(form, msg = true) {
         return httpApi({
@@ -89,4 +121,12 @@ export default {
             data: form
         }, msg);
     },
+    //查询关联样品信息列表
+    async sampleListInfo(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/detection/sample/list-info',
+            method: 'get',
+            params: form
+        }, msg);
+    },
 }

+ 2 - 37
src/layout/modules/MenuBar.vue

@@ -8,16 +8,14 @@
                 </div>
             </div>
         </el-menu-item>
-        <MenuItem :datas="menuDatas" :cur="curKey" :collapse="isCollapse" @change="MenuClick"/>
+        <MenuItem :datas="datas" :cur="curKey" :collapse="isCollapse" @change="MenuClick"/>
     </el-menu>
 </template>
 
 <script setup>
-import {nextTick, ref, watch} from "vue";
+import {ref, watch} from "vue";
 import MenuItem from "./MenuItem.vue"
-import {useAppStore} from "~src/store";
 import {getToken} from "~src/api/util/auth";
-const useAppState = useAppStore()
 const props = defineProps({
     datas: {
         type: Array,
@@ -34,17 +32,9 @@ const props = defineProps({
 })
 
 //初始变量
-const menuDatas = ref([]);
 const curKey = ref(props.cur);
 const isCollapse = ref(props.collapse);
 
-//监听
-/*watch(() => [
-    props.datas
-], ([datas]) => {
-    setMenuDatas(datas)
-})*/
-
 //监听
 watch(() => [
     props.cur,
@@ -54,31 +44,6 @@ watch(() => [
     isCollapse.value = collapse
 })
 
-//渲染完成
-nextTick(() => {
-    setMenuDatas(props.datas)
-});
-
-//设置菜单数据
-const setMenuDatas = (datas) => {
-    let newArr = datas || [];
-    const res = getToArchivesUrl();
-    if (res) {
-        newArr.push({
-            code: res.code,
-            source: res.source,
-            path: res.path,
-            name: res.name,
-            children: []
-        })
-    }
-    menuDatas.value = newArr
-}
-
-//获取档案管理的数据
-const getToArchivesUrl = () => {
-    return useAppState.getButtonsVal('to-archives-url')
-}
 
 //事件
 const emit = defineEmits(['change'])

+ 1 - 1
src/styles/tentative/detect/test-form.scss

@@ -23,6 +23,7 @@
     .hc-links-sample-tree-box,
     .hc-links-sample-table-box {
         position: relative;
+        width: 300px;
         height: 100%;
     }
     .hc-links-sample-tree-box {
@@ -33,4 +34,3 @@
         flex: 1;
     }
 }
-

+ 20 - 21
src/views/tentative/detect/components/ListItem.vue

@@ -195,11 +195,11 @@ const getValString = (val) => {
 }
 
 //获取表单初始数据
-const getFormDataInit = ({projectId, contractId, pKeyId}) => {
-    const { nodeId } = baseData.value
+const getFormDataInit = ({projectId, cid, pKeyId}) => {
+    const { nodeId, contractId } = baseData.value
     return {
         projectId: projectId,
-        contractId: contractId,
+        contractId: cid || contractId,
         pkeyId: getValString(pKeyId),
         nodeId: nodeId
     }
@@ -334,7 +334,7 @@ const tableFormSaveClick = async (item,index) => {
     if (isStatus.value !== '3') {
         const res = await saveExcelBussData(item,index)
         if (res) {
-            //await getBussPdfInfo(item)
+            await getBussPdfInfo(item)
             renewData()
         }
     } else {
@@ -368,11 +368,11 @@ const saveExcelBussData = async (item, index, showTip = true) => {
 }
 
 //预览PDF
-const getBussPdfInfo = async (item, showTip = true) => {
-    const pkeyIds = item.pKeyId ? item.pKeyId + '' : ''
+const getBussPdfInfo = async ({pKeyId}, showTip = true) => {
+    const pkeyIds = getValString(pKeyId)
     if (pkeyIds) {
-        const {error, code, data} = await wbsApi.getBussPdfInfo({
-            pkeyId: pkeyIds
+        const {error, code, data} = await dataApi.getBussPdf({
+            pKeyId: pkeyIds
         },false)
         if (!error && code === 200) {
             if (data) {
@@ -413,7 +413,7 @@ const delClick = async (item) => {
 
 //复制本表
 const copyClick = async (item,index) => {
-    const pkeyIds = item.pKeyId ? item.pKeyId + '' : ''
+    const pkeyIds = getValString(item.pKeyId)
     if (pkeyIds) {
         if (isStatus.value !== '3') {
             if (!item.isRenderTableForm) {
@@ -428,7 +428,7 @@ const copyClick = async (item,index) => {
                     window?.$message?.warning('复制本表操作失败')
                 }
             } else {
-                window?.$message?.warning(`数据异常了, isRenderTableForm: ${item.isRenderTableForm}, isTableForm: ${item.isTableForm}, pkeyIds:${pkeyIds}`)
+                window?.$message?.warning(`数据异常了, isRenderTableForm: ${item.isRenderTableForm}, isTableForm: ${item.isTableForm}, pKeyId:${pkeyIds}`)
             }
         } else {
             window?.$message?.warning('已上报的资料,不允许复制')
@@ -439,8 +439,8 @@ const copyClick = async (item,index) => {
 }
 
 const copeBussTab = async (pkeyIds) => {
-    const {error, code} = await wbsApi.copeBussTab({
-        pkeyId: pkeyIds
+    const {error, code} = await dataApi.copyBussTab({
+        pKeyId: pkeyIds
     })
     if (!error && code === 200) {
         window?.$message?.success('操作成功')
@@ -448,16 +448,15 @@ const copeBussTab = async (pkeyIds) => {
     }
 }
 
-
 //隐藏本表
-const hideClick = async (item) => {
-    const pkeyIds = item.pKeyId ? item.pKeyId + '' : ''
+const hideClick = async ({pKeyId, isBussShow}) => {
+    const pkeyIds = getValString(pKeyId)
     if (pkeyIds) {
         if (isStatus.value !== '3') {
-            const isBussShow = item['isBussShow'] === 2 ? 1 : 2 //状态(1显示 2隐藏)
-            const {error, code} = await wbsApi.showBussTab({
-                pkeyId: pkeyIds,
-                status: isBussShow
+            const isBussShows = isBussShow === 2 ? 1 : 2 //状态(1显示 2隐藏)
+            const {error, code} = await dataApi.showBussTab({
+                pKeyId: pkeyIds,
+                status: isBussShows
             })
             if (!error && code === 200) {
                 window?.$message?.success('操作成功')
@@ -680,8 +679,8 @@ const renewData = () => {
 //获取表单数据
 const getFormData = () => {
     const formArr = formData.value;
-    return formArr.filter((item) => {
-        return (item.pkeyId??'') !== '' && item.isCollapseLoad;
+    return  formArr.filter(({pkeyId, isCollapseLoad}) => {
+        return (pkeyId ?? '') !== '' && isCollapseLoad;
     })
 }
 

+ 160 - 25
src/views/tentative/detect/test-form.vue

@@ -45,19 +45,19 @@
                 <ListItem ref="ListItemRef" :datas="listItemData" :status="1" :baseData="listItemBaseData" @offsetTop="ListItemOffsetTop" @renew="getTableDataAll"/>
             </el-scrollbar>
             <template #action>
-                <el-button type="primary" hc-btn>
+                <el-button type="primary" hc-btn :disabled="listItemData.length <= 0" :loading="tableFormSaveLoading" @click="tableFormSaveClick">
                     <HcIcon name="save"/>
                     <span>保存</span>
                 </el-button>
-                <el-button hc-btn>
+                <el-button hc-btn :loading="reportLoading" @click="reportModalClick">
                     <HcIcon name="send-plane-2"/>
                     <span>上报</span>
                 </el-button>
-                <el-button hc-btn>
+                <el-button hc-btn :loading="bussPdfsLoading" @click="bussPdfsClick">
                     <HcIcon name="eye"/>
                     <span>预览</span>
                 </el-button>
-                <el-button hc-btn>
+                <el-button hc-btn @click="abolishOneClick">
                     <HcIcon name="arrow-go-back"/>
                     <span>撤回上报流程</span>
                 </el-button>
@@ -80,7 +80,7 @@
                 </div>
                 <div class="hc-tree-scrollbar" v-loading="linksRelateTreeLoading" element-loading-text="获取数据中...">
                     <el-scrollbar>
-                        <WbsTree :projectId="projectId" :contractId="contractId"/>
+                        <TestTree :projectId="projectId" :contractId="contractId"/>
                     </el-scrollbar>
                 </div>
             </div>
@@ -91,7 +91,7 @@
             <div class="hc-links-sample-modal-box">
                 <div class="hc-links-sample-tree-box">
                     <el-scrollbar>
-                        <WbsTree :projectId="projectId" :contractId="contractId"/>
+                        <TestTree :projectId="projectId" :wbsTempId="projectInfo?.referenceWbsTemplateIdTrial" :wbsType="2" :tenantId="userInfo?.tenant_id" @nodeTap="linksRawTreeClick"/>
                     </el-scrollbar>
                 </div>
                 <div class="hc-links-sample-table-box">
@@ -105,7 +105,7 @@
             <div class="hc-links-sample-modal-box">
                 <div class="hc-links-sample-tree-box">
                     <el-scrollbar>
-                        <WbsTree :projectId="projectId" :contractId="contractId"/>
+                        <TestTree :projectId="projectId" :wbsTempId="projectInfo?.referenceWbsTemplateIdTrial" :wbsType="2" :tenantId="userInfo?.tenant_id" @nodeTap="linksSampleTreeClick"/>
                     </el-scrollbar>
                 </div>
                 <div class="hc-links-sample-table-box">
@@ -124,17 +124,20 @@ import {useRouter, useRoute} from 'vue-router'
 import ListItem from "./components/ListItem.vue"
 import dataApi from "~api/tentative/detect/test";
 import {getStoreData} from '~src/utils/storage'
-import WbsTree from "../../data-fill/components/WbsTree.vue"
-import {getArrValue, getObjValue} from "vue-utils-plus";
+import TestTree from "../material/components/TestTree.vue"
+import {getArrValue, getObjValue, getObjNullValue} from "vue-utils-plus";
 import {getDictionary} from "~api/other";
+import {rowsToId} from "~uti/tools";
 import dayjs from "dayjs"
 
 //变量
 const router = useRouter()
 const useRoutes = useRoute()
 const useAppState = useAppStore()
+const userInfo = ref(useAppState.getUserInfo);
 const projectId = ref(useAppState.getProjectId);
 const contractId = ref(useAppState.getContractId);
+const projectInfo = ref(useAppState.getProjectInfo);
 const contractInfo = ref(useAppState.getContractInfo);
 
 //路由参数
@@ -197,7 +200,7 @@ const getCategoryData = async () => {
 }
 
 //顶部表单
-const topFormModel = ref({})
+const ListItemRef = ref(null);
 const listItemBaseData = ref({
     sampleIds: '', contractId: null, nodeId: nodeId, trialProjectName: null, type: dataType, tableType: '1',
     detectionCategory: '', detection_result: '', reportDate: '', trialUserName: '',
@@ -266,6 +269,12 @@ const linksRawModalClick = () => {
     linksRawModal.value = true
 }
 
+//树被点击
+const linksRawTreeClick = ({data}) => {
+
+}
+
+
 //原材检测报告数据
 const tableRawRef = ref(null)
 const linksRawTableColumn = ref([
@@ -280,9 +289,7 @@ const linksRawTableLoading = ref(false)
 //多选
 const tableRawCheckedKeys = ref([]);
 const linksRawTableSelection = (rows) => {
-    tableRawCheckedKeys.value = rows.filter((item) => {
-        return (item??'') !== '';
-    })
+    tableRawCheckedKeys.value = rows
 }
 
 const linksRawModalSave = () => {
@@ -296,41 +303,169 @@ const linksRawModalClose = () => {
 
 
 
-//关联进场材料
+//关联取样
 const linksSampleModal = ref(false)
 const linksSampleModalClick = () => {
+    linksSampleTableData.value = [];
     linksSampleModal.value = true
 }
 
-//关联进场材料数据
+//搜索表单
+const linksSampleSearchForm = ref({
+    nodeId: null, current: 1, size: 20, total: 0
+})
+
+//树被点击
+const linksSampleTreeClick = ({data}) => {
+    linksSampleSearchForm.value.nodeId = data.primaryKeyId;
+    linksSampleSearchForm.value.current = 1;
+    getLinksSampleData()
+}
+
+//关联取样数据
 const tableSampleRef = ref(null)
 const linksSampleTableColumn = ref([
-    {key:'key1', name: '样品名称'},
-    {key:'key2', name: '取样日期'},
-    {key:'key4', name: '规格型号'},
-    {key:'key7', name: '拟用部位'},
-    {key:'key9', name: '取样人'},
+    {key:'materialName', name: '样品名称'},
+    {key:'samplingDate', name: '取样日期'},
+    {key:'specificationModel', name: '规格型号'},
+    {key:'proposedPosition', name: '拟用部位'},
+    {key:'userName', name: '取样人'},
 ])
 const linksSampleTableData = ref([])
+
+//获取关联数据
 const linksSampleTableLoading = ref(false)
+const getLinksSampleData = async () => {
+    linksSampleTableLoading.value = true
+    const { error, code, data } = await dataApi.sampleListInfo({
+        ...linksSampleSearchForm.value,
+        projectId: projectId.value,
+        contractId: contractId.value
+    })
+    //处理数据
+    linksSampleTableLoading.value = false
+    if (!error && code === 200) {
+        linksSampleTableData.value = getArrValue(data)
+        //searchForm.value.total = data.total || 0
+    } else {
+        linksSampleTableData.value = []
+        //searchForm.value.total = 0
+    }
+}
 
 //多选
 const tableSampleCheckedKeys = ref([]);
 const linksSampleTableSelection = (rows) => {
-    tableSampleCheckedKeys.value = rows.filter((item) => {
-        return (item??'') !== '';
-    })
+    tableSampleCheckedKeys.value = rows
 }
 
+//保存关联
 const linksSampleModalSave = () => {
-
+    const rows = tableSampleCheckedKeys.value
+    if (rows.length > 0) {
+        listItemBaseData.value.sampleIds = rowsToId(rows) || '';
+        tableSampleRef.value?.clearSelection();
+        tableSampleCheckedKeys.value = [];
+        linksSampleModal.value = false
+    } else {
+        window.$message?.warning('请先勾选需要关联的记录')
+    }
 }
 
-//关闭关联进场材料
+//关闭关联取样
 const linksSampleModalClose = () => {
     linksSampleModal.value = false
 }
 
+//保存
+const tableFormSaveLoading = ref(false)
+const tableFormSaveClick = async () => {
+    let FormData = ListItemRef.value?.getFormData()
+    let FormRegExpJson = ListItemRef.value?.getFormRegExpJson()
+    //效验数据
+    if (getObjNullValue(FormRegExpJson)) {
+        setFormRegExpJson(FormRegExpJson)
+    } else if (FormData.length > 0) {
+        tableFormSaveLoading.value = true
+        const {error, code} = await dataApi.saveExcelBussData({
+            ...listItemBaseData.value,
+            dataInfo: {orderList: FormData}
+        })
+        tableFormSaveLoading.value = false
+        if (!error && code === 200) {
+            window?.$message?.success('保存成功')
+            //bussPdfsClick()
+            getTableDataAll()
+        }
+    } else {
+        //bussPdfsClick()
+    }
+}
+
+//效验数据
+const setFormRegExpJson = (FormRegExpJson) => {
+    let nodeName = '', itemId = '';
+    Object.keys(FormRegExpJson).forEach(key => {
+        const name = FormRegExpJson[key]?.nodeName ?? ''
+        if (name) {
+            if (nodeName) {
+                nodeName += ',' + name
+            } else {
+                nodeName = name
+                itemId = FormRegExpJson[key]?.itemId
+            }
+        }
+    })
+    //const activeKey = ListItemRef.value?.getActiveKey()
+    //弹出提示
+    const val = '<div style="font-size: 16px;">请先完善  <span style="color:#1ECC95;">' + nodeName + '</span>  的数据内容</div>'
+    window?.$messageBox?.alert(val, '表单完善提醒', {
+        confirmButtonText: '确定',
+        dangerouslyUseHTMLString: true,
+        callback: (action) => {
+            if (action === 'confirm') {
+                ListItemRef.value?.setActiveKey(itemId)
+                ListItemOffsetTop(0)
+                setTimeout(() => {
+                    const offsetTop = document.getElementById(itemId)?.offsetTop
+                    ListItemOffsetTop(offsetTop)
+                }, 350)
+            }
+        }
+    })
+}
+
+
+//上报数据
+const reportLoading = ref(false)
+const reportModalClick = async () => {
+
+}
+
+//多表预览
+const bussPdfsLoading = ref(false)
+const bussPdfsClick = async () => {
+    bussPdfsLoading.value = true
+    const {error, code, data} = await dataApi.getBussPdfs({
+        projectId: projectId.value,
+        contractId: contractId.value,
+        classify: authBtnTabKey.value,
+        tableType: tabTypeKey.value,
+        nodeId: nodeId,
+    })
+    bussPdfsLoading.value = false
+    if (!error && code === 200) {
+        window.open(data,'_blank')
+    } else {
+        window.$message?.warning('获取PDF失败')
+    }
+}
+
+//撤回上报流程
+const abolishOneClick = () => {
+
+}
+
 //返回
 const toBackClick = () => {
     router.push({

+ 3 - 1
src/views/tentative/detect/test.vue

@@ -135,7 +135,9 @@
             <div class="hc-switch-tab-content" v-loading="viewAttachmentLoading">
                 <div class="h-full w-full flex">
                     <div class="pdf-file-list-box">
-                        <div class="file-item cur">文件名称1.pdf</div>
+                        <template v-for="item in viewAttachmentData">
+                            <div class="file-item cur">文件名称1.pdf</div>
+                        </template>
                         <div class="file-item">文件名称2.pdf</div>
                         <div class="file-item">文件名称3.pdf</div>
                         <div class="file-item">文件名称4.pdf</div>