Sfoglia il codice sorgente

试验自检设备容器参数拼接修改

duy 2 anni fa
parent
commit
f29a3c56c4

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

@@ -9,6 +9,14 @@ export default {
             params: form
         }, msg);
     },
+    // 获取试验树节点下的记录信息接口:
+    async gettrialPage(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/trial/data/page',
+            method: 'post',
+            data: form
+        }, msg);
+    },
     //分页条件查询
     async queryPage(form, msg = true) {
         return httpApi({

+ 345 - 4
src/views/data-fill/components/ListItem.vue

@@ -136,9 +136,89 @@
     </HcDialog>
 
     <!--关联试验数据-->
-    <HcDialog :show="CTDModal" title="关联试验数据" widths="850px" saveText="确认关联" @close="CTDModal = false" @save="CTDModal = false">
-        开发中...
+    <HcDialog :show="CTDModal" title="关联试验数据"  widths="84%"  saveText="确认关联" @close="CTDModal = false" @save="CTDModal = false">
+       <div class="adding-form-dialog-box">
+            <div class="dialog-tree-box">
+                 <el-scrollbar>
+                      <ElTree class="hc-tree-node tree-line"
+                        :class="ui"
+                        ref="ElTreeRef"
+                        :props="ElTreeProps"
+                        :load="ElTreeLoadNode"
+                        lazy
+                        highlight-current
+                        accordion
+                        node-key="primaryKeyId"
+                        :default-expanded-keys="defaultExpandedCids"
+                        @node-click="CTDElTreeClick"
+                        :indent="0">
+                      </ElTree>
+                 </el-scrollbar>
+            </div>
+            <div class="dialog-table-box">
+                <div class="dialog-search">
+                     <div class="w-64 ml-2">
+                            <HcDatePicker :dates="CTDbetweenTime" clearable @change="CTDbetweenTimeUpdate"/>
+                    </div>
+                     <div class="ml-2">
+                            <el-button type="primary" @click="CTDsearchClick">
+                                <HcIcon name="search-2"/>
+                                <span>搜索</span>
+                            </el-button>
+                    </div>
+                </div>
+                <div class="dialog-table">
+                        <HcTable ref="dialogTableRef" :loading="CTDdialogTableLoading" :column="CTDdialogTableColumn" :datas="CTDdialogTableData" isCheck @selection-change="CTDdialogTableSelection">
+                             <template #name="{row}">
+                                <span class="text-link" @click="CTDtableRowName(row)">{{row?.name}}</span>
+                            </template>
+                        </HcTable>
+                </div>
+                <div class="dialog-pages">
+                        <HcPages :pages="CTDsearchFormPage" @change="CTDsearchFormPageChange"/>
+                </div>
+            </div>
+       </div>
+                
+
     </HcDialog>
+    <!-- 选择要插入的数据 -->
+      <HcDialog :show="insertDataShow" title="选择需要插入的数据"  widths="84%"  saveText="保存" @close="insertDataShow = false" @save="insertDataShow = false">
+          <div>
+               <div class="flex-1" style="padding-left:20px">
+                    <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange" size="default" :round="false"/>
+                      <el-select v-model="testReportId" placeholder="试验记录表" clearable class="ml-2 w-80">
+                                <el-option v-for="item in testReportData" :key="item.value" :label="item['label']" :value="item['value']"/>
+                      </el-select>
+                </div>
+                <!-- <div class="copy-node-many-table">
+                    <el-scrollbar v-loading="insertDataTableLoading" >
+                        <el-table :data="insertDataTable" border stripe>
+                            <el-table-column prop="fullName" label="数据名称"/>
+                            <el-table-column prop="action" label="操作" width="120" align="center">
+                                <template #default="{row}">
+                                      <el-checkbox v-model="row.isCheck"  size="large"  @change="insertDataTableCheck(row)"/>
+                                </template>
+                            </el-table-column>
+                        </el-table>
+                    </el-scrollbar>
+                </div> -->
+                <div class="dialog-table-box">
+                     <div class="dialog-table">
+                        <HcTable :column="insertDataTableColumn" :datas="insertDataTable" :loading="insertDataTableLoading">
+                            <template #tempLow="{row}">{{row['tempLow']}} ~ {{row['tempHigh']}}</template>
+                            <template #action="{row}">
+                                     <el-checkbox v-model="row.isCheck"  size="large"  @change="insertDataTableCheck(row)"/>
+                               
+                            </template>
+                        </HcTable>
+                     </div>
+                     <div class="dialog-pages">
+                        <HcPages :pages="insertDataPage" @change="insertDataPageChange"/>
+                    </div>
+                </div>
+          </div>
+      </HcDialog>
     <!-- 复制本表 -->
      <HcDialog :show="CopyModal" title="复制本表" widths="1200px" saveText="确认复制" @close="CopyModal = false" @save="CopyModal = false">
         <el-alert title="复跨节点复制: 把当前表格已形成的数据复制到其他工程部位的相同表格里面" type="warning" :closable="false"/>
@@ -174,6 +254,49 @@
                     </el-scrollbar>
                 </div>
             </div>
+    </HcDialog>
+        <!--关联试验文件-->
+    <HcDialog :show="fileModal" title="关联试验文件"  widths="84%"  saveText="确认关联" @close="fileModal = false" @save="fileModal = false">
+        <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>
+        </div>
+       <div class="adding-form-dialog-box">
+            <div class="dialog-tree-box">
+                 <el-scrollbar>
+                     <ElTree class="hc-tree-node">
+                     </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"/>
+                    </div>
+                     <div class="ml-2">
+                            <el-button type="primary" @click="searchClick">
+                                <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>
+                </div>
+                <div class="dialog-pages">
+                        <HcPages :pages="searchFormPage" @change="searchFormPageChange"/>
+                </div>
+            </div>
+       </div>
+                
+
     </HcDialog>
 </template>
 
@@ -187,6 +310,7 @@ import wbsApi from "~api/data-fill/wbs"
 import HcUpload from "./HcUpload.vue"
 import {utilsText, isType, formValidate, deepClone, getObjValue} from "vue-utils-plus"
 import {useAppStore} from "~src/store";
+import samplingApi from "~api/tentative/material/sampling"
 
 //初始
 const props = defineProps({
@@ -522,8 +646,40 @@ const CopyModal = ref(false);
 const CopyModalType=ref('1');
 const treeLoading = ref(false);
 const copyModalTable=ref([])
+const insertDataShow = ref(false);
+//类型tab数据和相关处理
+const tabTypeKey = ref('1')
+const tabTypeTab = ref([
+    {key:'1',  name: '试验记录表'},
+    {key:'2', name: '试验报告单'},
+]);
+const tabTypeChange = ({key}) => {
+    tabTypeKey.value = key
+    // listItemBaseData.value.tableType = key
+    // getSearchNodeTables()
+}
+const insertDataTableLoading=ref(false)
+const insertDataTableColumn = ref(
+      [{key:'key1', name: '数据名称'}],
+)
+const insertDataTable=ref([])
+const insertDataTableCheck=()=>{
+    console.log('insertDataTableCheck');
+}
+//分页
+const insertDataPage = ref({current: 1, size: 20, total: 0})
+const insertDataPageChange = ({current, size}) => {
+    insertDataPage.value.current = current
+    insertDataPage.value.size = size
+    // getDialogTableData()
+}
 
-
+const testReportId=ref('1');
+const testReportData=ref(
+    [
+        {id:'1',value:'1',label:'记录表1柔柔弱弱柔柔弱弱柔柔弱弱柔柔弱弱rrr'}
+    ]
+)
 //树相关变量
 // const primaryKeyId = ref('')
 const nodeItemInfo = ref({})
@@ -704,7 +860,8 @@ const setTableFormMenu = (info) => {
     }
     //newArr.push({label: '插入设计值/频率', key: "IDVF"})
     newArr.push({label: '插入特殊字符', key: "special"})
-    newArr.push({label: '关联试验数据', key: "CTD"})
+    newArr.push({label: '关联试验数据', key: "CTD"}),
+    newArr.push({label: '关联试文件', key: "file"})
     tableFormMenu.value = newArr
 }
 
@@ -729,6 +886,8 @@ const handleMenuSelect = ({key}) => {
         specialModalShow()
     } else if (key === 'CTD') {
         CTDModal.value = true
+    }else if(key === 'file'){
+        fileModal.value=true
     }
 }
 
@@ -807,7 +966,122 @@ const specialNodeClick = async () => {
 
 //关联试验数据
 const CTDModal = ref(false)
+//树形结构异步加载数据
+const defaultExpandedCids = ref([])
+const ElTreeLoadNode = async (node, resolve) => {
+    let parentId = '0';
+    if (node.level !== 0) {
+        parentId = node?.data?.id
+    }
+    //获取数据
+    const {error, code, data} = await samplingApi.queryLazyTree({
+        wbsId: wbsTempId.value,
+        tenantId: tenantId.value,
+        projectId: projectId.value,
+        parentId,
+        wbsType: wbsType.value
+    })
+    //处理数据
+    if (!error && code === 200) {
+        let clickKey = '', defaultExpandedArr = [];
+        const keys = TreeExpandKey.value || []
+        const resData = getArrValue(data)
+        for (let i = 0; i < resData.length; i++) {
+            resData[i].hasChildren = !resData[i].hasChildren
+        }
+        if (keys.length > 0) {
+            let lastKey = keys[keys.length-1];
+            for (const item of resData) {
+                //自动展开
+                if (isItem(keys,item?.primaryKeyId)) {
+                    defaultExpandedArr.push(item?.primaryKeyId)
+                }
+                //最后一个,选中点击
+                if (item?.primaryKeyId === lastKey) {
+                    clickKey = item?.primaryKeyId
+                }
+            }
+        } else if (node.level === 0) {
+            defaultExpandedArr.push(resData[0]?.primaryKeyId)
+        }
+        //自动展开
+        defaultExpandedCids.value = defaultExpandedArr
+        if (node.level === 0) {
+            emit('nodeLoading')
+        }
+        resolve(resData)
+        //最后一个,执行点击
+        if (clickKey) {
+            await nextTick(() => {
+                document.getElementById(`${idPrefix.value}${clickKey}`)?.click()
+            })
+        }
+    } else {
+        if (node.level === 0) {
+            emit('nodeLoading')
+        }
+        resolve([])
+    }
+}
+//节点被点击
+const CTDElTreeClick = async (data,node) => {
+    console.log('获取节点数据');
+    // let autoKeysArr = []
+    // await getNodeExpandKeys(node, autoKeysArr)
+    // const autoKeys = autoKeysArr.reverse()
+    // emit('nodeTap', {node, data, keys: autoKeys})
+}
+//处理自动展开的节点KEY
+const getNodeExpandKeys = async (node, newKeys) => {
+    const parent = node?.parent ?? []
+    const primaryKeyId = node?.data?.primaryKeyId ?? ''
+    if (primaryKeyId) {
+        newKeys.push(primaryKeyId)
+        await getNodeExpandKeys(parent, newKeys)
+    }
+}
+const CTDbetweenTime = ref(null)
+//搜索表单
+const CTDsearchFormPage = ref({
+   betweenTime: null,queryTime: null,  wbsId: null, current: 1, size: 20, total: 0
+})
+const CTDsearchFormPageChange = ({current, size}) => {
+    CTDsearchFormPage.value.current = current
+    CTDsearchFormPage.value.size = size
+    // getDialogTableData()
+}
+const CTDbetweenTimeUpdate = ({arr, query}) => {
+    CTDbetweenTime.value = arr
+    CTDsearchFormPage.value.queryTime = query
+}//搜索
+const CTDsearchClick = () => {
+    CTDsearchFormPage.value.current = 1;
+    // getTableData()
+}
+const CTDdialogTableLoading = ref (false)
+const CTDdialogTableKeys = ref ([])
+const CTDdialogTableColumn = ref([
+    {key:'title', name: '表单名称'},
+    {key:'tabType', name: '元素表类型'},
+    {key:'elementTotal', name: '元素总量'},
+    {key:'tabOwner', name: '所属方'},
+    {key:'fillRate', name: '填报率'}
+])
+const CTDdialogTableData=[]
 
+const CTDdialogTableSelection = (rows) => {
+    CTDdialogTableKeys.value = rows
+}
+//名称被点击
+const CTDtableRowName = (row) => {
+    console.log('行',row);
+   
+ }
+
+
+//关联试验文件
+const fileModal = ref(false)
+const radio = ref(3)
 //设计值频率计算
 const IDVFModalSaveClick = async () => {
     const {pkeyId, KeyName, index} = tableFormItemNode.value
@@ -889,6 +1163,18 @@ const setActiveKey = (key) => {
     return ActiveKey.value = key;
 }
 
+//名称被点击
+const tableRowName = (row) => {
+    console.log(row,'row');
+    //如果 evisaPdfUrl 不为空,使用evisaPdfUrl,反之使用pdfUrl
+    // if (row['evisaPdfUrl']) {
+    //     window.open(row['evisaPdfUrl'],'_blank')
+    // } else if (row['pdfUrl']) {
+    //     window.open(row['pdfUrl'],'_blank')
+    // } else {
+    //     window.$message?.warning('文件不存在')
+    // }
+}
 // 暴露出去
 defineExpose({
     getFormData,
@@ -1080,4 +1366,59 @@ defineExpose({
         padding: 20px 0 20px 20px;
     }
 }
+
+//关联试验数据
+.adding-form-dialog-box {
+    position: relative;
+    height: 100%;
+    display: flex;
+    .dialog-tree-box {
+        position: relative;
+        border-right: 1px solid #EEEEEE;
+        width: 500px;
+        height: 100%
+    }
+    .dialog-table-box {
+        position: relative;
+        flex: 1;
+        height: 100%;
+        padding: 18px;
+        .dialog-search {
+            position: relative;
+            display: flex;
+        }
+        .dialog-table {
+            position: relative;
+            height: calc(100% - 68px);
+            padding: 18px 0;
+        }
+        .dialog-pages {
+            position: relative;
+        }
+    }
+}
+.copy-node-many-table {
+    position: relative;
+    flex: 1;
+    height: 100%;
+    padding: 20px 0 20px 20px;
+}
+.dialog-table-box {
+        position: relative;
+        flex: 1;
+        height: 100%;
+        padding: 18px;
+        .dialog-search {
+            position: relative;
+            display: flex;
+        }
+        .dialog-table {
+            position: relative;
+            height: calc(100% - 68px);
+            padding: 18px 0;
+        }
+        .dialog-pages {
+            position: relative;
+        }
+    }
 </style>

+ 4 - 1
src/views/tentative/detect/components/ListItem.vue

@@ -777,12 +777,15 @@ const deviceModalSave = () => {
         const form = formData.value[item.index]
         const val =[]
         const idarr=[]
+        const listr=[]
          deviceTableKeys.value.forEach((item)=>{
              val.push(item.deviceNumber)
              idarr.push(item.id)
+             listr.push(item.deviceNumber+"_"+item.deviceName)
          })
-         const newval=val.join('_');
+         const newval=listr.join('、');
          const idval=idarr.join(',')
+         
         formData.value[item.index][item.KeyName] = setPosInsert(item.startPos, item.endPos, form[item.KeyName], newval)
         vesselModal.value = false
         let posVal = item.startPos + newval.length;