|
@@ -13,12 +13,12 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div v-else>
|
|
<div v-else>
|
|
- <HcDataTree
|
|
|
|
|
|
+ <HcDataTree
|
|
ref="leftTree"
|
|
ref="leftTree"
|
|
- tree-key="id"
|
|
|
|
- show-checkbox
|
|
|
|
- :datas="leftTreeData"
|
|
|
|
- :h-props="lefttreeProps"
|
|
|
|
|
|
+ tree-key="id"
|
|
|
|
+ show-checkbox
|
|
|
|
+ :datas="leftTreeData"
|
|
|
|
+ :h-props="lefttreeProps"
|
|
:default-expand-all="defaultExpandAll"
|
|
:default-expand-all="defaultExpandAll"
|
|
:check-strictly="checkStrictly"
|
|
:check-strictly="checkStrictly"
|
|
:default-checked-keys="defaultCheckedKeys"
|
|
:default-checked-keys="defaultCheckedKeys"
|
|
@@ -61,7 +61,7 @@
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
import { nextTick, ref, watch } from 'vue'
|
|
import { nextTick, ref, watch } from 'vue'
|
|
-import { arrToId, arrUnion, getArrValue, getRandom, isArrItem } from 'js-fast-way'
|
|
|
|
|
|
+import { arrToId, arrUnion, getArrValue, getRandom } from 'js-fast-way'
|
|
import unitApi from '~api/project/debit/contract/unit.js'
|
|
import unitApi from '~api/project/debit/contract/unit.js'
|
|
import { useAppStore } from '~src/store'
|
|
import { useAppStore } from '~src/store'
|
|
|
|
|
|
@@ -114,7 +114,7 @@ const getTreeDataList = async ()=>{
|
|
const { error, code, data } = await unitApi.getLeftList({
|
|
const { error, code, data } = await unitApi.getLeftList({
|
|
id:ids.value,
|
|
id:ids.value,
|
|
})
|
|
})
|
|
-
|
|
|
|
|
|
+
|
|
if (!error && code === 200) {
|
|
if (!error && code === 200) {
|
|
treeDataList.value = getArrValue(data)
|
|
treeDataList.value = getArrValue(data)
|
|
} else {
|
|
} else {
|
|
@@ -138,15 +138,15 @@ const getLeftTreeData = async (id) => {
|
|
const { error, code, data } = await unitApi.getCurrentNodeTree({
|
|
const { error, code, data } = await unitApi.getCurrentNodeTree({
|
|
id,
|
|
id,
|
|
contractId:contractId.value,
|
|
contractId:contractId.value,
|
|
-
|
|
|
|
|
|
+
|
|
})
|
|
})
|
|
treeLoading.value = false
|
|
treeLoading.value = false
|
|
if (!error && code === 200) {
|
|
if (!error && code === 200) {
|
|
leftTreeData.value = getArrValue(data)
|
|
leftTreeData.value = getArrValue(data)
|
|
-
|
|
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
leftTreeData.value = []
|
|
leftTreeData.value = []
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//监听
|
|
//监听
|
|
@@ -195,9 +195,9 @@ watch(isShow, (val) => {
|
|
if (val) {
|
|
if (val) {
|
|
setSplitRef()
|
|
setSplitRef()
|
|
checkStrictly.value = false
|
|
checkStrictly.value = false
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
@@ -246,14 +246,14 @@ const modalSave = async () => {
|
|
requestType:menuType.value === 'add' ? 1 : 2, //请求类型 1=节点新增 2=增补单元新增
|
|
requestType:menuType.value === 'add' ? 1 : 2, //请求类型 1=节点新增 2=增补单元新增
|
|
templateId: templateId.value,
|
|
templateId: templateId.value,
|
|
dataList:tableData.value,
|
|
dataList:tableData.value,
|
|
-
|
|
|
|
|
|
+
|
|
})
|
|
})
|
|
//判断状态
|
|
//判断状态
|
|
addNodeLoading.value = false
|
|
addNodeLoading.value = false
|
|
if (!error && code === 200) {
|
|
if (!error && code === 200) {
|
|
window?.$message?.success(msg)
|
|
window?.$message?.success(msg)
|
|
tableData.value = []
|
|
tableData.value = []
|
|
-
|
|
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
window.$message.error(msg)
|
|
window.$message.error(msg)
|
|
}
|
|
}
|
|
@@ -264,22 +264,22 @@ const modalSave = async () => {
|
|
contractId:contractId.value,
|
|
contractId:contractId.value,
|
|
id:ids.value,
|
|
id:ids.value,
|
|
vo2s:tableData.value,
|
|
vo2s:tableData.value,
|
|
-
|
|
|
|
|
|
+
|
|
})
|
|
})
|
|
//判断状态
|
|
//判断状态
|
|
addNodeLoading.value = false
|
|
addNodeLoading.value = false
|
|
if (!error && code === 200) {
|
|
if (!error && code === 200) {
|
|
window?.$message?.success(msg)
|
|
window?.$message?.success(msg)
|
|
tableData.value = []
|
|
tableData.value = []
|
|
-
|
|
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
window.$message.error(msg)
|
|
window.$message.error(msg)
|
|
}
|
|
}
|
|
emit('finish')
|
|
emit('finish')
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|
|
const closeAddModal = ()=>{
|
|
const closeAddModal = ()=>{
|
|
tableData.value = []
|
|
tableData.value = []
|
|
@@ -333,7 +333,7 @@ const treeNodeCheck = (checkdata, { checkedNodes, halfCheckedNodes }) => {
|
|
const uniqueArray = alarr.reduce((acc, current) => {
|
|
const uniqueArray = alarr.reduce((acc, current) => {
|
|
// 检查当前对象的某个字段是否已存在于累积数组中
|
|
// 检查当前对象的某个字段是否已存在于累积数组中
|
|
const x = acc.find(item => item.id === current.id)
|
|
const x = acc.find(item => item.id === current.id)
|
|
-
|
|
|
|
|
|
+
|
|
// 如果不存在,则将其添加到累积数组中
|
|
// 如果不存在,则将其添加到累积数组中
|
|
if (!x) {
|
|
if (!x) {
|
|
return acc.concat([current])
|
|
return acc.concat([current])
|
|
@@ -341,12 +341,12 @@ const treeNodeCheck = (checkdata, { checkedNodes, halfCheckedNodes }) => {
|
|
return acc
|
|
return acc
|
|
}
|
|
}
|
|
}, [])
|
|
}, [])
|
|
-
|
|
|
|
|
|
+
|
|
tableData.value = uniqueArray
|
|
tableData.value = uniqueArray
|
|
|
|
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
const checkStrictly = ref(false)
|
|
const checkStrictly = ref(false)
|
|
const defaultCheckedKeys = ref([])
|
|
const defaultCheckedKeys = ref([])
|
|
@@ -359,7 +359,7 @@ const changeIsAdd = (val, row, index)=>{
|
|
let delKeys = arrToId(rowTreeData.data.children).split(',')
|
|
let delKeys = arrToId(rowTreeData.data.children).split(',')
|
|
nextTick(()=>{
|
|
nextTick(()=>{
|
|
delKeys.forEach((ele)=>{
|
|
delKeys.forEach((ele)=>{
|
|
-
|
|
|
|
|
|
+
|
|
leftTree.value.treeRef.setChecked(ele, false, true)
|
|
leftTree.value.treeRef.setChecked(ele, false, true)
|
|
leftTree.value.treeRef.setChecked(row.id, true, false)
|
|
leftTree.value.treeRef.setChecked(row.id, true, false)
|
|
let checkKeys = leftTree.value.treeRef.getCheckedKeys()
|
|
let checkKeys = leftTree.value.treeRef.getCheckedKeys()
|
|
@@ -372,7 +372,7 @@ const changeIsAdd = (val, row, index)=>{
|
|
})
|
|
})
|
|
})
|
|
})
|
|
tableData.value = arr
|
|
tableData.value = arr
|
|
-
|
|
|
|
|
|
+
|
|
})
|
|
})
|
|
const isIdExist = tableData.value.some(obj => obj.id === parentData.value.id)
|
|
const isIdExist = tableData.value.some(obj => obj.id === parentData.value.id)
|
|
if (!isIdExist) {
|
|
if (!isIdExist) {
|
|
@@ -388,7 +388,7 @@ const changeIsAdd = (val, row, index)=>{
|
|
},
|
|
},
|
|
)
|
|
)
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
})
|
|
})
|
|
} else if (isParent && val === 1) {
|
|
} else if (isParent && val === 1) {
|
|
checkStrictly.value = false
|
|
checkStrictly.value = false
|