Bladeren bron

关联实验文件弹窗修改

duy 2 jaren geleden
bovenliggende
commit
83ecfe0e26
2 gewijzigde bestanden met toevoegingen van 220 en 17 verwijderingen
  1. 8 0
      src/api/modules/tentative/material/sampling.js
  2. 212 17
      src/views/data-fill/components/ListItem.vue

+ 8 - 0
src/api/modules/tentative/material/sampling.js

@@ -66,4 +66,12 @@ export default {
             params: form
         }, msg);
     },
+    //关联试验文件信息提交保存接口
+    async submitRelationFile(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/trial/file/submit',
+            method: 'post',
+            data: form
+        }, msg);
+    },
 }

+ 212 - 17
src/views/data-fill/components/ListItem.vue

@@ -259,42 +259,65 @@
             </div>
     </HcDialog>
         <!--关联试验文件-->
-    <HcDialog :show="fileModal" title="关联试验文件"  widths="84%"  saveText="保存" @close="fileModal = false" @save="fileModal = false">
+    <HcDialog :show="fileModal" title="关联试验文件"  widths="84%"  saveText="保存" @close="fileModal = false" @save="savefileModal">
         <div class="radio-box">
-                <el-radio-group v-model="radio">
-                    <el-radio :label="3">Option A</el-radio>
-                    <el-radio :label="6">Option B</el-radio>
-                    <el-radio :label="9">Option C</el-radio>
+                <el-radio-group v-model="fileModalradio" @change="radioChange">
+                    <el-radio :label="1">试验检测</el-radio>
+                    <el-radio :label="2">第三方检测</el-radio>
+                    <el-radio :label="3">外委检测</el-radio>
                 </el-radio-group>
         </div>
        <div class="adding-form-dialog-box">
             <div class="dialog-tree-box">
                  <el-scrollbar>
-                     <ElTree class="hc-tree-node">
-                     </ElTree>
+                    <!-- 试验检测树 -->
+                        <ElTree class="hc-tree-node tree-line"
+                        ref="ElTreeRef1"
+                        :props="ElTreeProps"
+                        :load="ElTreeLoadNode"
+                        lazy
+                        highlight-current
+                        accordion
+                        node-key="primaryKeyId"
+                        @node-click="fileModalElTreeClick"
+                        :indent="0"
+                        v-if="fileModalradio==1"
+                      >
+                      </ElTree>
+                      <!-- 第三方树 -->
+                        <ElTree 
+                        v-else
+                        class="hc-tree-node" ref="ElTreeRef2" :props="thirdElTreeProps" :data="thirdtreeDatas" highlight-current accordion node-key="id"
+                         @node-click="thirdtreeDatasElTreeClick" :indent="0">
+                        </ElTree>
                  </el-scrollbar>
             </div>
             <div class="dialog-table-box">
                 <div class="dialog-search">
                      <div class="w-64 ml-2">
-                            <HcDatePicker :dates="betweenTime" clearable @change="betweenTimeUpdate"/>
+                            <HcDatePicker :dates="filebetweenTime" clearable @change="filebetweenTimeUpdate"/>
                     </div>
                      <div class="ml-2">
-                            <el-button type="primary" @click="searchClick">
+                            <el-button type="primary" @click="filesearchClick">
                                 <HcIcon name="search-2"/>
                                 <span>搜索</span>
                             </el-button>
                     </div>
                 </div>
                 <div class="dialog-table">
-                        <HcTable ref="dialogTableRef" :loading="dialogTableLoading" :column="dialogTableColumn" :datas="dialogTableData" isCheck @selection-change="dialogTableSelection">
-                             <template #name="{row}">
-                                <span class="text-link" @click="tableRowName(row)">{{row?.name}}</span>
-                            </template>
+                        <HcTable ref="dialogTableRef" :loading="filedialogTableLoading" :column="filedialogTableColumn" :datas="filedialogTableData" isCheck @selection-change="filedialogTableSelection"  v-if="fileModalradio==1">
+                             <!-- <template #name="{row}">
+                                <span class="text-link" @click="filetableRowName(row)">{{row?.recordNo}}</span>
+                            </template> -->
+                        </HcTable>
+                        <HcTable ref="dialogTableRef" :loading="filedialogTableLoading" :column="filedialogTableColumn1" :datas="filedialogTableData" isCheck @selection-change="filedialogTableSelection" v-else>
+                             <!-- <template #name="{row}">
+                                <span class="text-link" @click="filetableRowName(row)">{{row?.recordNo}}</span>
+                            </template> -->
                         </HcTable>
                 </div>
                 <div class="dialog-pages">
-                        <HcPages :pages="searchFormPage" @change="searchFormPageChange"/>
+                        <HcPages :pages="filesearchFormPage" @change="filesearchFormPageChange"/>
                 </div>
             </div>
        </div>
@@ -311,6 +334,8 @@ import HTableForm from "~src/plugins/HTableForm"
 import WbsTree from "../components/WbsTree.vue"
 import wbsApi from "~api/data-fill/wbs"
 import dataApi from "~api/tentative/detect/test";
+import thirdApi from "~api/tentative/detect/third";
+import {getTreeAll} from "~api/tentative/detect"
 import HcUpload from "./HcUpload.vue"
 import {utilsText, isType, formValidate, deepClone, getObjValue} from "vue-utils-plus"
 import {useAppStore} from "~src/store";
@@ -938,7 +963,8 @@ const handleMenuSelect = ({key}) => {
     } else if (key === 'CTD') {
         CTDModal.value = true
     }else if(key === 'file'){
-        fileModal.value=true
+        fileModal.value=true;
+        // getTreeDatas()
     }
 }
 
@@ -1086,12 +1112,47 @@ const ElTreeLoadNode = async (node, resolve) => {
 const CTDnodeItemInfo = ref({})
 const CTDnodeDataInfo = ref({})
 const CTDdialogTableData1=ref([])
+const filedialogTableData=ref([])
+//多选
+const filetableCheckedKeys = ref([]);
+const filedialogTableSelection = (rows) => {
+    filetableCheckedKeys.value = rows.filter((item) => {
+        return (item??'') !== '';
+    })
+    console.log( filetableCheckedKeys.value,' filetableCheckedKeys.value');
+}
+//确认关联试验文件
+const savefileModal = ()=>{
+   console.log( filetableCheckedKeys.value,' filetableCheckedKeys.value');
+    const idarr=[]
+    filetableCheckedKeys.value.forEach((item)=>{
+             idarr.push(item.id)
+    })
+    const idval=idarr.join(',')
+    
+    savesubmitRelationFile(idval)
+    fileModal.value=false
+}
 const CTDdialogTableColumn = ref([
     {key:'recordNo', name: '报告编号'},
     {key:'reportDate', name: '报告日期'},
     {key:'projectPositionName', name: '工程用途及部位'},
     {key:'detectionResultName', name: '检测结果'},
 ])
+const filedialogTableColumn = ref([
+    // reportNo
+    {key:'recordNo', name: '报告编号'},
+    {key:'reportDate', name: '报告日期'},
+    {key:'projectPositionName', name: '工程用途及部位'},
+    {key:'detectionResultName', name: '检测结果'},
+])
+const filedialogTableColumn1 = ref([
+    // reportNo
+    {key:'reportNo', name: '报告编号'},
+    {key:'reportDate', name: '报告日期'},
+    {key:'projectPositionName', name: '工程用途及部位'},
+    {key:'detectionResultName', name: '检测结果'},
+])
 const CTDElTreeClick = (data,node,keys) => {
     CTDnodeItemInfo.value = node
     CTDnodeDataInfo.value = data
@@ -1107,7 +1168,7 @@ const getNodeData = async ()=>{
     CTDdialogTableLoading.value = true
     const {error, code, data} = await samplingApi.gettrialPage({
         contractId: contractId.value,
-        nodeId: CTDnodeDataInfo.primaryKeyId,
+        nodeId: CTDnodeDataInfo.value.primaryKeyId,
         current: CTDsearchFormPage.value.current,
         size: CTDsearchFormPage.value.size,
         startTime:CTDsearchFormPage.value.startTime,
@@ -1124,6 +1185,29 @@ const getNodeData = async ()=>{
         CTDdialogTableLoading.value = false
     }
 }
+//试验文件节点下的数据
+const getfileNodeData = async ()=>{
+    //获取数据
+    filedialogTableLoading.value = true
+    const {error, code, data} = await samplingApi.gettrialPage({
+        contractId: contractId.value,
+        nodeId: filenodeDataInfo.value.primaryKeyId,
+        current: filesearchFormPage.value.current,
+        size: filesearchFormPage.value.size,
+        startTime:filesearchFormPage.value.startTime,
+        endTime:filesearchFormPage.value.lastTime,
+    })
+    //处理数据
+    if (!error && code === 200) {
+        filedialogTableData.value = getArrValue(data['records'])
+        filesearchFormPage.value.total = data.total || 0
+        filedialogTableLoading.value = false
+    } else {
+        filedialogTableData.value = []
+        filesearchFormPage.value.total = 0
+        filesearchFormPage.value = false
+    }
+}
 //获取试验表中的data数据接口:
 const getBussddataInfotrialData = async ()=>{
     insertDataTableLoading.value=true;
@@ -1189,26 +1273,45 @@ const getNodeExpandKeys = async (node, newKeys) => {
     }
 }
 const CTDbetweenTime = ref([])
+const filebetweenTime = ref([])
 //搜索表单
 const CTDsearchFormPage = ref({
    startTime: null,lastTime: null,  wbsId: null, current: 1, size: 20, total: 0
 })
+const filesearchFormPage = ref({
+   startTime: null,lastTime: null,  wbsId: null, current: 1, size: 20, total: 0
+})
 const CTDsearchFormPageChange = ({current, size}) => {
     CTDsearchFormPage.value.current = current
     CTDsearchFormPage.value.size = size
     // getDialogTableData()
 }
+const filesearchFormPageChange = ({current, size}) => {
+    filesearchFormPage.value.current = current
+    filesearchFormPage.value.size = size
+    // getDialogTableData()
+}
 const CTDbetweenTimeUpdate = ({arr, query}) => {
     CTDbetweenTime.value = arr
     CTDsearchFormPage.value.startTime = arr[0]
      CTDsearchFormPage.value.lastTime = arr[1]
 }
+const filebetweenTimeUpdate = ({arr, query}) => {
+    filebetweenTime.value = arr
+    filesearchFormPage.value.startTime = arr[0]
+     filesearchFormPage.value.lastTime = arr[1]
+}
 //搜索
 const CTDsearchClick = () => {
     CTDsearchFormPage.value.current = 1;
     getNodeData()
 }
+const filesearchClick = () => {
+    filesearchFormPage.value.current = 1;
+    getfileNodeData()
+}
 const CTDdialogTableLoading = ref (false)
+const filedialogTableLoading = ref (false)
 const insertDataSelectoading=ref(false)
 const CTDdialogTableKeys = ref ([])
 
@@ -1241,7 +1344,99 @@ const getSearchNodeTables = async () => {
 
 //关联试验文件
 const fileModal = ref(false)
-const radio = ref(3)
+const fileModalradio = ref(1)
+const radioChange = (val)=>{
+    if(val!==1){
+        getthirdTreeDatas(val)
+    }
+}
+//获取试验文件树树数据
+const fileModaltreeDatas = ref([])
+//节点被点击
+//节点被点击
+const filenodeItemInfo = ref({})
+const filenodeDataInfo = ref({})
+const  fileTableData1=ref([])
+const  fileTableColumn = ref([
+    {key:'recordNo', name: '报告编号'},
+    {key:'reportDate', name: '报告日期'},
+    {key:'projectPositionName', name: '工程用途及部位'},
+    {key:'detectionResultName', name: '检测结果'},
+])
+
+const fileModalElTreeClick = async (data,node) => {
+   filenodeItemInfo.value = node
+    filenodeDataInfo.value = data
+    getfileNodeData()
+}
+
+//获取第三方树试验文件
+
+//获取树数据
+const thirdtreeDatas = ref([])
+const thirdElTreeProps = ref({
+    label: 'nodeName',
+    children: 'children',
+    isLeaf: 'hasChildren'
+})
+const getthirdTreeDatas = async (type) => {
+    const { error, code, data } = await getTreeAll({
+        projectId: projectId.value,
+        contractId: contractId.value
+    })
+    if (!error && code === 200) {
+        if(type==2){
+            thirdtreeDatas.value = getArrValue(data['rightTree'])
+        }else{
+             thirdtreeDatas.value = getArrValue(data['leftTree'])
+        }
+        console.log(thirdtreeDatas,'thirdtreeDatas');
+        
+    } else {
+        thirdtreeDatas.value = []
+    }
+}
+const thirdfilenodeItemInfo = ref({})
+const thirdfilenodeDataInfo = ref({})
+//获取第三方树节点下的数据
+const getthirdTreetavleDatas = async () => {
+    const { error, code, data } = await thirdApi.queryPage({
+        projectId: projectId.value,
+        contractId: contractId.value,
+        nodeId: thirdfilenodeDataInfo.value.id,
+        current: filesearchFormPage.value.current,
+        size: filesearchFormPage.value.size,
+        startTime:filesearchFormPage.value.startTime,
+        endTime:filesearchFormPage.value.lastTime,
+
+    })
+     //处理数据
+    if (!error && code === 200) {
+        filedialogTableData.value = getArrValue(data['records'])
+        filesearchFormPage.value.total = data.total || 0
+        filedialogTableLoading.value = false
+    } else {
+        filedialogTableData.value = []
+        filesearchFormPage.value.total = 0
+        filesearchFormPage.value = false
+    }
+}
+const thirdtreeDatasElTreeClick =(data,node)=>{
+    thirdfilenodeItemInfo.value = node
+    thirdfilenodeDataInfo.value = data
+    getthirdTreetavleDatas()
+}
+//关联试验文件
+ const savesubmitRelationFile =async (ids)=>{
+    const { error, code, data } = await samplingApi.submitRelationFile({
+        projectId: projectId.value,
+        contractId: contractId.value,
+        nodeId: isPrimaryKeyId.value,
+        type:fileModalradio.value,
+        ids
+
+    })
+ }
 //设计值频率计算
 const IDVFModalSaveClick = async () => {
     const {pkeyId, KeyName, index} = tableFormItemNode.value