Ver Fonte

点击关联质检资料树修改

duy há 1 ano atrás
pai
commit
d4fa23707f

+ 8 - 0
src/api/modules/other.js

@@ -49,3 +49,11 @@ export const getContractInfo = (form, msg = true) => HcApi({
     method: 'get',
     params: form,
 }, msg)
+
+
+//获取质检划分树
+export const queryWbsTreeData = (form, msg = true) => HcApi({
+    url: '/api/blade-user/wbs/lazyQueryContractWbsTree',
+    method: 'get',
+    params: form,
+}, msg)

+ 35 - 9
src/views/debit-pay/admin/components/middlepay/qualityRleation.vue

@@ -4,7 +4,7 @@
         <div class="relative h-full flex">
             <div :id="`hc_tree_card_${uuid}`" class="hc_tree_card_border relative">
                 <hc-body scrollbar padding="0px">
-                    <hc-lazy-tree :h-props="treeProps" tree-key="id" :auto-expand-keys="treeAutoExpandKeys" @load="treeLoadNode" />
+                    <hc-lazy-tree tree-key="id" :auto-expand-keys="treeAutoExpandKeys" @load="treeLoadNode" />
                 </hc-body>
             </div>
             <div :id="`hc_table_card_${uuid}`" class="relative flex-1">
@@ -17,8 +17,9 @@
 <script setup>
 import { nextTick, ref, watch } from 'vue'
 import { getArrValue, getObjValue, getRandom } from 'js-fast-way'
-
+import { useAppStore } from '~src/store'
 import unitApi from '~api/project/debit/contract/unit'
+import { queryWbsTreeData } from '~api/other'
 const props = defineProps({
     qualityMoadal: {
         type: Boolean,
@@ -35,6 +36,10 @@ const props = defineProps({
     
 })
 const emit = defineEmits([ 'close'])
+const useAppState = useAppStore()
+const contractInfo = ref(useAppState.getContractInfo)
+const { contractType } = contractInfo.value
+const classifyType = ref(contractType === 2 ? '2' : '1')
 const qualityMoadal = ref(props.qualityMoadal)
 const cid = ref(props.cid)
 const periodId = ref(props.periodId)
@@ -78,19 +83,40 @@ const treeProps = {
     isLeaf: 'notExsitChild',
 }
 const treeAutoExpandKeys = ref([])
-const treeLoadNode = async ({ item, level }, resolve) => {
-    let id = 0
+// const treeLoadNode = async ({ item, level }, resolve) => {
+//     let id = 0
+//     if (level !== 0) {
+//         const nodeData = getObjValue(item)
+//         id = nodeData?.id || ''
+//     }
+//     //获取数据
+//     const { data } = await unitApi.lazyTree({
+//         id: id,
+//         contractId: cid.value,
+//         contractPeriodId: periodId.value,
+//     })
+//     resolve(getArrValue(data))
+// }
+//懒加载的数据
+const treeLoadNode = async ({ node, item, level }, resolve) => {
+    let contractIdRelation = '', parentId = '', primaryKeyId = ''
     if (level !== 0) {
         const nodeData = getObjValue(item)
-        id = nodeData?.id || ''
+        contractIdRelation = nodeData?.contractIdRelation || ''
+        parentId = contractIdRelation ? nodeData?.primaryKeyId : nodeData?.id
+        primaryKeyId = nodeData?.id || ''
     }
     //获取数据
-    const { data } = await unitApi.lazyTree({
-        id: id,
-        contractId: cid.value,
-        contractPeriodId: periodId.value,
+    const { data } = await queryWbsTreeData({
+        contractId: cid.value || '',
+        contractIdRelation,
+        primaryKeyId,
+        parentId,
+        classifyType: classifyType.value,
+        tableOwner:classifyType.value,
     })
     resolve(getArrValue(data))
+   
 }
 const tableColumn = [
     { key: 'name', name: '分/子分项部位' },