소스 검색

关联原材料报告接口对接

duy 2 년 전
부모
커밋
3322a021ee
2개의 변경된 파일81개의 추가작업 그리고 11개의 파일을 삭제
  1. 16 0
      src/api/modules/tentative/detect/test.js
  2. 65 11
      src/views/tentative/detect/test-form.vue

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

@@ -137,6 +137,14 @@ export default {
             params: form
         }, msg);
     },
+    //查询关联原材料检测报告列表
+    async rawMaterialList(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/detection/self/raw-material/list',
+            method: 'get',
+            params: form
+        }, msg);
+    },
     //获取试验表中的data数据接口:
     async getBussddataInfotrial(form, msg = true) {
         return httpApi({
@@ -153,4 +161,12 @@ export default {
             data: form
         }, msg);
     },
+    //关联原材报告保存
+    async rawMaterialSubmit(form, msg = true) {
+        return httpApi({
+            url: '/api/blade-business/detection/self/raw-material/submit',
+            method: 'post',
+            data: form
+        }, msg);
+    },
 }

+ 65 - 11
src/views/tentative/detect/test-form.vue

@@ -406,37 +406,67 @@ const linksRawModal = ref(false)
 const linksRawModalClick = () => {
     linksRawModal.value = true
 }
-
+const linkNodeid=ref('')
 //树被点击
 const linksRawTreeClick = ({data}) => {
-
+    linkNodeid.value=data.primaryKeyId
+    getrawMaterialList()
 }
 
 
 //原材检测报告数据
 const tableRawRef = ref(null)
 const linksRawTableColumn = ref([
-    {key:'key1', name: '报告编号'},
-    {key:'key2', name: '试验项目名称'},
-    {key:'key3', name: '工程部位及用途'},
-    {key:'key4', name: '报告日期'}
+    {key:'reportNo', name: '报告编号'},
+    {key:'trialProjectName', name: '试验项目名称'},
+    {key:'projectPositionName', name: '工程部位及用途'},
+    {key:'reportDate', name: '报告日期'}
 ])
 const linksRawTableData = ref([])
 const linksRawTableLoading = ref(false)
 
 //多选
 const tableRawCheckedKeys = ref([]);
+const tableRawCheckedKeysid = ref('');
 const linksRawTableSelection = (rows) => {
     tableRawCheckedKeys.value = rows
-}
-
-const linksRawModalSave = () => {
-
+    let arr=[]
+     tableRawCheckedKeys.value.forEach((item)=>{
+         arr.push(item.id)
+     })
+    tableRawCheckedKeysid.value=arr.join()
+}
+
+const linksRawModalSave =async () => {
+    if(tableRawCheckedKeysid.value.length>0){
+        const { error, code, data } = await dataApi.rawMaterialSubmit({
+        id: dataId,
+        ids:tableRawCheckedKeysid.value,
+        projectId: projectId.value,
+        contractId: contractId.value,
+        primaryKeyId: nodeId,
+        type: authBtnTabKey.value,
+     })
+    if (!error && code === 200) {
+            window.$message?.success('操作成功')
+            tableRawCheckedKeys.value=[]
+            linksRawModal.value = false
+            tableRawRef.value?.clearSelection();
+     }
+     else {
+        window.$message?.warning(error)
+     }   
+    }else{
+         window.$message?.warning('请选择要关联的报告')
+    }
+     
 }
 
 //关闭原材检测报告
 const linksRawModalClose = () => {
     linksRawModal.value = false
+    linksRawTableData.value=[]
+    tableRawRef.value?.clearSelection();
 }
 
 
@@ -498,7 +528,31 @@ const getLinksSampleData = async () => {
         //searchForm.value.total = 0
     }
 }
-
+//获取关联原材料检测报告
+const getrawMaterialList = async () => {
+    linksRawTableLoading.value = true
+    const { error, code, data } = await dataApi.rawMaterialList({
+        nodeId: linkNodeid.value,
+        contractId: contractId.value
+    })
+    //处理数据
+    linksRawTableLoading.value = false
+    if (!error && code === 200) {
+        linksRawTableData.value = getArrValue(data)
+         linksRawTableData.value.forEach((iten)=>{
+             if(iten.isRawMaterialRelation===1){
+                 nextTick(()=>{
+                    tableRawRef.value?.toggleRowSelection(iten,true);
+                })
+                    
+             }
+         })
+        //searchForm.value.total = data.total || 0
+    } else {
+        linksRawTableData.value = []
+        //searchForm.value.total = 0
+    }
+}
 //多选
 const tableSampleCheckedKeys = ref([]);
 const linksSampleTableSelection = (rows) => {