ZaiZai 1 年之前
父節點
當前提交
e4937db497
共有 1 個文件被更改,包括 21 次插入19 次删除
  1. 21 19
      src/views/tentative/material/sampling.vue

+ 21 - 19
src/views/tentative/material/sampling.vue

@@ -313,7 +313,12 @@ const getContractData = async () => {
         projectId: projectId.value,
         contractId: contractId.value,
     })
-    contractData.value = getArrValue(data)
+    const res = getArrValue(data)
+    contractData.value = res
+    if (res.length > 0) {
+        searchForm.value.contractId = res[0].id
+        searchClick()
+    }
 }
 
 //获取用户列表
@@ -405,25 +410,22 @@ const tableLoading = ref(false)
 const tableData = ref([])
 const getTableData = async () => {
     const nodeId = primaryKeyId.value
-    if (nodeId) {
-        tableLoading.value = true
-        const { error, code, data } = await samplingApi.queryPage({
-            projectId: projectId.value,
-            contractId: contractId.value,
-            nodeId,
-            ...searchForm.value,
-        })
-        //处理数据
-        tableLoading.value = false
-        if (!error && code === 200) {
-            tableData.value = getArrValue(data['records'])
-            searchForm.value.total = data.total || 0
-        } else {
-            tableData.value = []
-            searchForm.value.total = 0
-        }
+    if (isNullES(nodeId)) return
+    tableLoading.value = true
+    const { error, code, data } = await samplingApi.queryPage({
+        projectId: projectId.value,
+        contractId: contractId.value,
+        nodeId,
+        ...searchForm.value,
+    })
+    //处理数据
+    tableLoading.value = false
+    if (!error && code === 200) {
+        tableData.value = getArrValue(data['records'])
+        searchForm.value.total = data.total || 0
     } else {
-        window?.$message?.warning('请先选择一个树节点')
+        tableData.value = []
+        searchForm.value.total = 0
     }
 }