|
@@ -125,12 +125,21 @@
|
|
|
@close="processNodeModal = false" @save="processNodeClick"
|
|
|
>
|
|
|
<div class="node-many-tree">
|
|
|
- <el-tree
|
|
|
+ <!-- <el-tree
|
|
|
ref="processElTree" :default-checked-keys="defaultChecked"
|
|
|
:default-expanded-keys="defaultExpanded" :load="ElTreeLoadNode" :props="processTreeProps"
|
|
|
check-strictly
|
|
|
class="my-tree" lazy node-key="primaryKeyId"
|
|
|
show-checkbox
|
|
|
+ /> -->
|
|
|
+ <HcLazyTree
|
|
|
+ ref="processElTree"
|
|
|
+
|
|
|
+ :h-props="processTreeProps"
|
|
|
+ :auto-expand-keys="defaultExpanded"
|
|
|
+ check-strictly show-checkbox
|
|
|
+ :default-checked-keys="defaultChecked"
|
|
|
+ @load="ElTreeLoadNode"
|
|
|
/>
|
|
|
</div>
|
|
|
</HcDialog>
|
|
@@ -174,7 +183,7 @@
|
|
|
|
|
|
<script setup>
|
|
|
import { onActivated, onDeactivated, onMounted, onUnmounted, ref, watch } from 'vue'
|
|
|
-import { arrToId, getArrValue, getObjVal, getObjValue, isNullES, isString } from 'js-fast-way'
|
|
|
+import { arrToId, getArrValue, getObjVal, getObjValue, isArrIndex, isNullES, isString } from 'js-fast-way'
|
|
|
import DateCalendar from './dateCalendar/index.vue'
|
|
|
//import HcTableForm from "~com/table-form/index.vue";
|
|
|
import HTableForm from '~src/plugins/HTableForm'
|
|
@@ -386,6 +395,10 @@ const checkTheLogTaskStatus = async (choices, primaryKeyId) => {
|
|
|
const processNodeModal = ref(false)
|
|
|
const showProcessModal = () => {
|
|
|
processNodeModal.value = true
|
|
|
+ defaultChecked.value = []
|
|
|
+ processDataList.value.forEach((ele)=>{
|
|
|
+ defaultChecked.value.push(ele?.primaryKeyId)
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
//树的配置
|
|
@@ -395,7 +408,7 @@ const defaultExpanded = ref([]) //默认展开
|
|
|
const defaultChecked = ref([]) //默认选中
|
|
|
|
|
|
//树形结构异步加载数据
|
|
|
-const ElTreeLoadNode = async (node, resolve) => {
|
|
|
+const ElTreeLoadNode = async ({ node, item, level }, resolve) => {
|
|
|
if (node.level === 0) {
|
|
|
const { error, code, data } = await wbsQueryApi.queryWbsTreeData({
|
|
|
contractId: contractId.value || '',
|
|
@@ -432,22 +445,52 @@ const ElTreeLoadNode = async (node, resolve) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//数组对象去重
|
|
|
+
|
|
|
+const getNorepeatArr = (tempArr)=> {
|
|
|
+ let newArr = []
|
|
|
+ for (let i = 0; i < tempArr.length; i++) {
|
|
|
+ if (newArr.indexOf(tempArr[i].primaryKeyId) == -1) {
|
|
|
+ newArr.push(tempArr[i].primaryKeyId)
|
|
|
+ } else {
|
|
|
+ tempArr.splice(i, 1)
|
|
|
+ i--
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return tempArr
|
|
|
+
|
|
|
+}
|
|
|
//确认关联工序
|
|
|
const processDataList = ref([])
|
|
|
const processNodeClick = () => {
|
|
|
- const keys = processElTree.value.getCheckedKeys()
|
|
|
+ const keys = processElTree.value.treeRef.getCheckedKeys()
|
|
|
const formIndex = formLogIndex.value
|
|
|
const formData = formLogDataList.value[formIndex]
|
|
|
- const linkTabIds = getArrValue(formData?.linkTabIds)
|
|
|
+ let linkTabIds = getArrValue(formData?.linkTabIds)
|
|
|
+ if (keys.length === 0) {
|
|
|
+ linkTabIds = []
|
|
|
+ }
|
|
|
+ //去出掉取消勾选的
|
|
|
+ for (let index = 0; index < keys.length; index++) {
|
|
|
+ linkTabIds = linkTabIds.filter((ele)=>{
|
|
|
+ if (ele.primaryKeyId === keys[index]) {
|
|
|
+ return ele
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
for (let index = 0; index < keys.length; index++) {
|
|
|
let pathArr = []
|
|
|
- let node = processElTree.value.getNode(keys[index])
|
|
|
+ let node = processElTree.value.treeRef.getNode(keys[index])
|
|
|
getPathName(node, pathArr)
|
|
|
+
|
|
|
linkTabIds.push({
|
|
|
path: pathArr.join('/'),
|
|
|
primaryKeyId: keys[index],
|
|
|
})
|
|
|
}
|
|
|
+ //去除掉重复的
|
|
|
+ getNorepeatArr(linkTabIds)
|
|
|
formLogDataList.value[formIndex]['linkTabIds'] = linkTabIds
|
|
|
processDataList.value = linkTabIds
|
|
|
processNodeModal.value = false
|
|
@@ -565,8 +608,10 @@ const queryCurrentLogSelectProcessList = async (bid) => {
|
|
|
let linkTabIds = getArrValue(data)
|
|
|
formLogDataList.value[formIndex]['linkTabIds'] = linkTabIds
|
|
|
processDataList.value = linkTabIds
|
|
|
+
|
|
|
} else {
|
|
|
processDataList.value = []
|
|
|
+ defaultChecked.value = []
|
|
|
if (msg) window?.$message?.warning(msg)
|
|
|
}
|
|
|
} else {
|