|
@@ -5,14 +5,14 @@
|
|
|
<template #header>
|
|
|
<el-button hc-btn type="primary" :loading="setLoading" @click="setTree">重新设置treeCode</el-button>
|
|
|
</template>
|
|
|
- <hc-lazy-tree
|
|
|
- v-if="ishowTree"
|
|
|
+ <hc-lazy-tree
|
|
|
+ v-if="ishowTree"
|
|
|
:auto-expand-keys="TreeAutoExpandKeys"
|
|
|
- tree-key="id"
|
|
|
- :h-props="treeProps"
|
|
|
- is-load-menu
|
|
|
- @load="treeLoadNode"
|
|
|
- @load-menu="treeLoadMenu"
|
|
|
+ tree-key="id"
|
|
|
+ :h-props="treeProps"
|
|
|
+ is-load-menu
|
|
|
+ @load="treeLoadNode"
|
|
|
+ @load-menu="treeLoadMenu"
|
|
|
@menu-tap="treeMenuTap"
|
|
|
@node-tap="treeNodeTap"
|
|
|
/>
|
|
@@ -34,7 +34,10 @@
|
|
|
</template>
|
|
|
</HcTitle>
|
|
|
<div style="height: calc(100vh - 420px);">
|
|
|
- <hc-table :is-stripe="false" :column="tableColumn" :datas="tableData" :loading="tableLoading" is-new :index-style="{ width: 60 }" :row-style="tableRowStyle">
|
|
|
+ <hc-table
|
|
|
+ :is-stripe="false" :column="tableColumn" :datas="tableData" :loading="tableLoading"
|
|
|
+ is-new :index-style="{ width: 60 }" :row-style="tableRowStyle"
|
|
|
+ >
|
|
|
<template #key1="{ row }">
|
|
|
<i class="i-iconoir-open-select-hand-gesture inline-block" />
|
|
|
</template>
|
|
@@ -45,13 +48,22 @@
|
|
|
</div>
|
|
|
|
|
|
<!-- 节点新增和编辑 -->
|
|
|
- <treeForm v-model="treeModalShow" :ids="curTreeData.id" :menu-type="menuType" :template-id="curTreeData.templateId" @finish="finishForm" />
|
|
|
+ <treeForm
|
|
|
+ v-model="treeModalShow" :ids="curTreeData.id" :menu-type="menuType"
|
|
|
+ :template-id="curTreeData.templateId" @finish="finishForm"
|
|
|
+ />
|
|
|
|
|
|
<!-- 修改合同计量单元 -->
|
|
|
- <rowData v-model="editModalShow" :is-table="isInfoView" :ids="curTreeData.id" :cur-tree-data="curTreeData" @finish="finishEdit" @close="closeEdit" />
|
|
|
+ <rowData
|
|
|
+ v-model="editModalShow" :is-table="isInfoView" :ids="curTreeData.id" :cur-tree-data="curTreeData"
|
|
|
+ @finish="finishEdit" @close="closeEdit" @get-detail="getTreeNodeDetail"
|
|
|
+ />
|
|
|
|
|
|
<!-- 调整排序 -->
|
|
|
- <hc-new-dialog v-model="sortModalShow" is-table widths="1100px" title="调整排序" :loading="sortNodeLoading" @save="sortModalSave">
|
|
|
+ <hc-new-dialog
|
|
|
+ v-model="sortModalShow" is-table widths="1100px" title="调整排序" :loading="sortNodeLoading"
|
|
|
+ @save="sortModalSave"
|
|
|
+ >
|
|
|
<hc-table
|
|
|
ui="hc-table-row-drop"
|
|
|
:column="sortTableColumn" :datas="sortTableData" :loading="sortTableLoading"
|
|
@@ -85,6 +97,7 @@ import { useAppStore } from '~src/store'
|
|
|
import { getStoreValue, setStoreValue } from '~src/utils/storage'
|
|
|
import { delMessageV2 } from '~com/message/index.js'
|
|
|
import { getDictionary } from '~api/other'
|
|
|
+
|
|
|
const useAppState = useAppStore()
|
|
|
const projectId = ref(useAppState.getProjectId || '')
|
|
|
const contractId = ref(useAppState.getContractId || '')
|
|
@@ -115,10 +128,10 @@ const setSplitRef = () => {
|
|
|
const nodeOptions = ref([])
|
|
|
const getNodeType = async (id) => {
|
|
|
const { data } = await unitApi.getNodeTypeList({
|
|
|
- id,
|
|
|
+ id,
|
|
|
})
|
|
|
nodeOptions.value = getArrValue(data)
|
|
|
- nodeOptions.value.forEach((ele)=>{
|
|
|
+ nodeOptions.value.forEach((ele) => {
|
|
|
ele.dictKey = Number(ele.dictKey)
|
|
|
})
|
|
|
}
|
|
@@ -134,10 +147,10 @@ const treeProps = {
|
|
|
const ishowTree = ref(true)
|
|
|
//重新设置树
|
|
|
const setLoading = ref(false)
|
|
|
-const setTree = async ()=>{
|
|
|
+const setTree = async () => {
|
|
|
const { error, code, msg } = await unitApi.refresh({
|
|
|
projectId: projectId.value,
|
|
|
- contractId:contractId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
})
|
|
|
setLoading.value = false
|
|
|
if (!error && code === 200) {
|
|
@@ -146,9 +159,9 @@ const setTree = async ()=>{
|
|
|
setTimeout(() => {
|
|
|
ishowTree.value = true
|
|
|
}, 100)
|
|
|
- } else {
|
|
|
- // newlistdata.value = []
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ // newlistdata.value = []
|
|
|
+ }
|
|
|
}
|
|
|
//懒加载的数据
|
|
|
const TreeAutoExpandKeys = ref(getStoreValue('wbsTreeExpandKeys') || [])
|
|
@@ -161,7 +174,7 @@ const treeLoadNode = async ({ node, item, level }, resolve) => {
|
|
|
//获取数据
|
|
|
const { error, code, data } = await unitApi.lazyTree({
|
|
|
contractId: contractId.value,
|
|
|
- id:id,
|
|
|
+ id: id,
|
|
|
})
|
|
|
|
|
|
resolve(getArrValue(data))
|
|
@@ -176,29 +189,26 @@ const treeNodeTap = ({ node, data, keys }) => {
|
|
|
setStoreValue('wbsTreeExpandKeys', keys)
|
|
|
getTreeNodeDetail(data)
|
|
|
}
|
|
|
+
|
|
|
//获取节点详情
|
|
|
const curTreeData = ref({})
|
|
|
-const getTreeNodeDetail = async (node)=>{
|
|
|
- const { id } = node
|
|
|
- const { error, code, data } = await unitApi.getNodeDetail({
|
|
|
- id,
|
|
|
- })
|
|
|
+const getTreeNodeDetail = async ({ id }) => {
|
|
|
+ console.log('getTreeNodeDetail:', id)
|
|
|
+ const { error, code, data } = await unitApi.getNodeDetail({ id })
|
|
|
if (!error && code === 200) {
|
|
|
curTreeData.value = getObjValue(data)
|
|
|
tableData.value = curTreeData.value['decompositionList']
|
|
|
- nodeOptions.value.forEach((ele)=>{
|
|
|
+ nodeOptions.value.forEach((ele) => {
|
|
|
if (curTreeData.value.nodeType === ele.dictKey) {
|
|
|
curTreeData.value.nodeTypeName = ele.dictValue
|
|
|
}
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
} else {
|
|
|
curTreeData.value = {}
|
|
|
tableData.value = []
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
//菜单
|
|
|
const treeLoadMenu = ({ item, level }, resolve) => {
|
|
|
const { isLock } = item
|
|
@@ -218,7 +228,7 @@ const treeLoadMenu = ({ item, level }, resolve) => {
|
|
|
{ icon: 'arrow-up-down-line', label: '排序', key: 'sort' },
|
|
|
])
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
if (isLock === 1) {
|
|
|
return resolve([
|
|
@@ -253,11 +263,11 @@ const treeMenuTap = ({ key, node, data, keys }) => {
|
|
|
if (key === 'add') {
|
|
|
if (isDecompositionData === 1) {
|
|
|
window.$message.warning('该节点下面不允许新增节点')
|
|
|
-
|
|
|
+
|
|
|
} else {
|
|
|
treeModalShow.value = true
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
if (key === 'edit') {
|
|
|
editModalShow.value = true
|
|
@@ -265,12 +275,12 @@ const treeMenuTap = ({ key, node, data, keys }) => {
|
|
|
if (key === 'sort') {
|
|
|
let nodes = [], childNodes = []
|
|
|
childNodes = node?.parent?.childNodes || node?.parent?.children || []
|
|
|
-
|
|
|
+
|
|
|
for (let i = 0; i < childNodes.length; i++) {
|
|
|
const res = childNodes[i]?.data
|
|
|
nodes.push({
|
|
|
- nodeName:res?.nodeName,
|
|
|
- id:res?.id,
|
|
|
+ nodeName: res?.nodeName,
|
|
|
+ id: res?.id,
|
|
|
})
|
|
|
}
|
|
|
sortTableData.value = nodes
|
|
@@ -283,16 +293,16 @@ const treeMenuTap = ({ key, node, data, keys }) => {
|
|
|
if (data?.isLock === 1 && key !== 'lock') {
|
|
|
window.$message.warning('当前节点为锁定状态,不允许操作')
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (key === 'lock') {
|
|
|
handleLockNode()
|
|
|
}
|
|
|
}
|
|
|
//锁定节点
|
|
|
-const handleLockNode = async ()=>{
|
|
|
+const handleLockNode = async () => {
|
|
|
const { error, code, msg } = await unitApi.getLock({
|
|
|
id: curTreeData.value.id || '',
|
|
|
- lockStatus:curTreeData.value?.isLock === 1 ? 0 : 1,
|
|
|
+ lockStatus: curTreeData.value?.isLock === 1 ? 0 : 1,
|
|
|
})
|
|
|
if (!error && code === 200) {
|
|
|
window?.$message?.success(msg)
|
|
@@ -302,14 +312,14 @@ const handleLockNode = async ()=>{
|
|
|
//删除节点
|
|
|
const delModalClick = () => {
|
|
|
delMessageV2(async (action, instance, done) => {
|
|
|
- if (action === 'confirm') {
|
|
|
- instance.confirmButtonLoading = true
|
|
|
- removeContractTreeNode()
|
|
|
- instance.confirmButtonLoading = false
|
|
|
- done()
|
|
|
- } else {
|
|
|
- done()
|
|
|
- }
|
|
|
+ if (action === 'confirm') {
|
|
|
+ instance.confirmButtonLoading = true
|
|
|
+ removeContractTreeNode()
|
|
|
+ instance.confirmButtonLoading = false
|
|
|
+ done()
|
|
|
+ } else {
|
|
|
+ done()
|
|
|
+ }
|
|
|
})
|
|
|
}
|
|
|
const removeContractTreeNode = async () => {
|
|
@@ -339,9 +349,7 @@ const tableColumn = ref([
|
|
|
{ key: 'poseNum', name: '施工图数量', align: 'center' },
|
|
|
{ key: 'changeTotal', name: '施工图变更后数量', align: 'center' },
|
|
|
])
|
|
|
-const tableData = ref([
|
|
|
-
|
|
|
-])
|
|
|
+const tableData = ref([])
|
|
|
//设置某一行的样式
|
|
|
const tableRowStyle = ({ row, rowIndex }) => {
|
|
|
if (row.poseNum > row.contractTotal) {
|
|
@@ -351,7 +359,7 @@ const tableRowStyle = ({ row, rowIndex }) => {
|
|
|
//弹窗
|
|
|
const treeModalShow = ref(false)
|
|
|
const editModalShow = ref(false)
|
|
|
-const finishForm = ()=>{
|
|
|
+const finishForm = () => {
|
|
|
treeModalShow.value = false
|
|
|
ishowTree.value = false
|
|
|
setTimeout(() => {
|
|
@@ -359,14 +367,14 @@ const finishForm = ()=>{
|
|
|
}, 100)
|
|
|
}
|
|
|
|
|
|
-const finishEdit = ()=>{
|
|
|
+const finishEdit = () => {
|
|
|
editModalShow.value = false
|
|
|
ishowTree.value = false
|
|
|
setTimeout(() => {
|
|
|
ishowTree.value = true
|
|
|
}, 100)
|
|
|
}
|
|
|
-const closeEdit = ()=>{
|
|
|
+const closeEdit = () => {
|
|
|
editModalShow.value = false
|
|
|
ishowTree.value = false
|
|
|
setTimeout(() => {
|
|
@@ -377,8 +385,8 @@ const closeEdit = ()=>{
|
|
|
const sortModalShow = ref(false)
|
|
|
//表格数据
|
|
|
const sortTableColumn = ref([
|
|
|
- { key:'nodeName', name: '节点名称' },
|
|
|
- { key:'action', name: '排序', width: 90 },
|
|
|
+ { key: 'nodeName', name: '节点名称' },
|
|
|
+ { key: 'action', name: '排序', width: 90 },
|
|
|
])
|
|
|
const sortTableLoading = ref(false)
|
|
|
const sortTableData = ref([])
|
|
@@ -415,8 +423,8 @@ const upSortClick = (index) => {
|
|
|
const sortNodeLoading = ref(false)
|
|
|
const sortModalSave = async () => {
|
|
|
const ids = arrToId(sortTableData.value)
|
|
|
- //发起请求
|
|
|
- sortNodeLoading.value = true
|
|
|
+ //发起请求
|
|
|
+ sortNodeLoading.value = true
|
|
|
const { error, code } = await unitApi.sortForm({ ids })
|
|
|
sortNodeLoading.value = false
|
|
|
//判断状态
|