|
@@ -18,7 +18,7 @@
|
|
|
<template v-if="formModel.name">
|
|
|
<template v-if="isTreeMode === 1">
|
|
|
<hc-lazy-tree
|
|
|
- v-if="isShow" ref="treeRef1" :h-props="treeProps" tree-key="id" :show-checkbox="isTreeCheck" check-strictly
|
|
|
+ v-if="isShow" ref="treeRef1" :h-props="treeProps" tree-key="id" :show-checkbox="tabsKey === '2'" check-strictly
|
|
|
:default-checked-keys="treeNodeIds" @load="treeLoadNode" @node-tap="treeNodeTap"
|
|
|
>
|
|
|
<template #name="{ data }">
|
|
@@ -28,7 +28,7 @@
|
|
|
</template>
|
|
|
<template v-if="isTreeMode === 2">
|
|
|
<hc-data-tree
|
|
|
- ref="treeRef2" :h-props="treeProps" tree-key="id" :show-checkbox="isTreeCheck" :datas="treeData"
|
|
|
+ ref="treeRef2" :h-props="treeProps" tree-key="id" :show-checkbox="tabsKey === '2'" :datas="treeData"
|
|
|
check-strictly :default-checked-keys="treeNodeIds" @node-tap="treeNodeTap"
|
|
|
>
|
|
|
<template #name="{ data }">
|
|
@@ -40,7 +40,17 @@
|
|
|
</hc-card>
|
|
|
</div>
|
|
|
<div class="right h-full flex-1">
|
|
|
- 222
|
|
|
+ <hc-tab-card :tabs="tabsData" :tab-key="tabsKey" @change="tabsChange">
|
|
|
+ <template v-if="tabsKey === '1'">
|
|
|
+ <hc-table :column="nodeTableColumn" :datas="nodeTableData" :is-index="false">
|
|
|
+ <template #action="{ row }">
|
|
|
+ <el-link v-if="row.checknd" type="warning" @click="rowUnlinkClick(row)">取消关联</el-link>
|
|
|
+ <el-link v-else type="primary" @click="rowLinkClick(row)">选择关联</el-link>
|
|
|
+ </template>
|
|
|
+ </hc-table>
|
|
|
+ </template>
|
|
|
+ 内容区域
|
|
|
+ </hc-tab-card>
|
|
|
</div>
|
|
|
</div>
|
|
|
<template #footer>
|
|
@@ -93,8 +103,17 @@ watch(isShow, (val) => {
|
|
|
})
|
|
|
|
|
|
//获取数据详情
|
|
|
+const tableData = ref([])
|
|
|
const getInfoData = () => {
|
|
|
getWbsTypeList()
|
|
|
+ //处理元素字段信息
|
|
|
+ const data = getArrValue(datas.value)
|
|
|
+ for (let i = 0; i < data.length; i++) {
|
|
|
+ data[i].eName = data[i].textInfo
|
|
|
+ data[i].eType = data[i].textElementType
|
|
|
+ data[i].eAllowDeviation = data[i].textDeviation
|
|
|
+ }
|
|
|
+ tableData.value = data
|
|
|
}
|
|
|
|
|
|
//获取清表模板信息
|
|
@@ -107,7 +126,6 @@ const getWbsTypeList = async () => {
|
|
|
//树配置
|
|
|
const treeRef1 = ref(null)
|
|
|
const treeRef2 = ref(null)
|
|
|
-const isTreeCheck = ref(false)
|
|
|
const treeProps = {
|
|
|
label: 'title',
|
|
|
children: 'children',
|
|
@@ -166,17 +184,63 @@ const getTreeAllData = async () => {
|
|
|
//树节点被点击
|
|
|
const nodeInfo = ref({})
|
|
|
const treeNodeIds = ref([])
|
|
|
-const treeNodeTap = async ({ data, keys }) => {
|
|
|
+const treeNodeTap = ({ data, keys }) => {
|
|
|
nodeInfo.value = data
|
|
|
- /*
|
|
|
- if (data.fileType !== 3) {
|
|
|
- isTreeNode.value = false
|
|
|
- return
|
|
|
- }
|
|
|
- await getExcelHtmlCol(data.id)
|
|
|
- await getTableData()
|
|
|
- isTreeNode.value = true*/
|
|
|
treeNodeIds.value = keys
|
|
|
+ getNodeTable(data.id)
|
|
|
+}
|
|
|
+
|
|
|
+//获取清表信息
|
|
|
+const nodeTableColumn = [
|
|
|
+ { key: 'tableName', name: '已有元素表名称' },
|
|
|
+ { key: 'action', name: '操作', width: 90, align: 'center' },
|
|
|
+]
|
|
|
+const nodeTableData = ref([])
|
|
|
+const getNodeTable = async (id) => {
|
|
|
+ const { data } = await mainApi.getNodeTable({ id })
|
|
|
+ const res = getArrValue(data)
|
|
|
+ for (let i = 0; i < res.length; i++) {
|
|
|
+ res[i].checknd = Number(res[i].isLinkTable) === 2
|
|
|
+ }
|
|
|
+ nodeTableData.value = res
|
|
|
+}
|
|
|
+
|
|
|
+//选择关联
|
|
|
+const rowLinkClick = async (row) => {
|
|
|
+ const { isRes } = await mainApi.saveRelation({
|
|
|
+ id: row.id,
|
|
|
+ excelTabId: dataInfo.value.id,
|
|
|
+ elementList: tableData.value,
|
|
|
+ })
|
|
|
+ if (!isRes) return
|
|
|
+ row.checknd = true
|
|
|
+ row.isLinkTable = 2
|
|
|
+}
|
|
|
+
|
|
|
+//取消关联
|
|
|
+const rowUnlinkClick = async (row) => {
|
|
|
+ const { isRes } = await mainApi.cancelRelation({
|
|
|
+ id: row.id,
|
|
|
+ excelTabId: dataInfo.value.id,
|
|
|
+ })
|
|
|
+ if (!isRes) return
|
|
|
+ row.checknd = false
|
|
|
+ row.isLinkTable = 1
|
|
|
+}
|
|
|
+
|
|
|
+//选项卡
|
|
|
+const tabsKey = ref('1')
|
|
|
+const tabsData = ref([
|
|
|
+ { key: '1', name: '关联元素表' },
|
|
|
+ { key: '2', name: '新增元素表' },
|
|
|
+])
|
|
|
+const tabsChange = ({ key }) => {
|
|
|
+ tabsKey.value = key
|
|
|
+ if (key === '1') {
|
|
|
+ getNodeTable(nodeInfo.value.id)
|
|
|
+ } else if (key === '2') {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//表单
|
|
@@ -228,4 +292,10 @@ const dialogClose = () => {
|
|
|
--el-card-padding: 0;
|
|
|
box-shadow: none;
|
|
|
}
|
|
|
+.hc-exctab-element-web-temp-box .hc-div-new-card-box.hc-tab-card-box .el-card .hc-card-header-box{
|
|
|
+ margin-top: 0;
|
|
|
+}
|
|
|
+.hc-exctab-element-web-temp-box .hc-div-new-card-box.hc-tab-card-box .el-card .tab-card-header-tabs .item {
|
|
|
+ height: 30px;
|
|
|
+}
|
|
|
</style>
|