|
@@ -27,7 +27,7 @@
|
|
<HcTable :column="tableBasicColumn" :datas="tableBasicData" :isIndex="false" border>
|
|
<HcTable :column="tableBasicColumn" :datas="tableBasicData" :isIndex="false" border>
|
|
<template #type="{row}">{{getRowType(row['type'])}}</template>
|
|
<template #type="{row}">{{getRowType(row['type'])}}</template>
|
|
<template #majorDataType="{row}">{{getRowMajorType(row['majorDataType'])}}</template>
|
|
<template #majorDataType="{row}">{{getRowMajorType(row['majorDataType'])}}</template>
|
|
-
|
|
|
|
|
|
+
|
|
</HcTable>
|
|
</HcTable>
|
|
</HcCard>
|
|
</HcCard>
|
|
</div>
|
|
</div>
|
|
@@ -49,7 +49,7 @@
|
|
<span>删除</span>
|
|
<span>删除</span>
|
|
</el-button>
|
|
</el-button>
|
|
</HcTooltip>
|
|
</HcTooltip>
|
|
- </template>
|
|
|
|
|
|
+ </template>
|
|
</HcTable>
|
|
</HcTable>
|
|
</HcCard>
|
|
</HcCard>
|
|
</div>
|
|
</div>
|
|
@@ -277,7 +277,10 @@
|
|
@select="searchTreeSelect"/>
|
|
@select="searchTreeSelect"/>
|
|
</div>
|
|
</div>
|
|
<div class="dialog-table">
|
|
<div class="dialog-table">
|
|
- <HcTable ref="dialogTableRef" :loading="dialogTableLoading" :column="dialogTableColumn" :datas="dialogTableData" isCheck @selection-change="dialogTableSelection"/>
|
|
|
|
|
|
+ <HcTable ref="dialogTableRef" :loading="dialogTableLoading" :column="dialogTableColumn" :datas="dialogTableData" isCheck
|
|
|
|
+ @select="dialogTableSelect"
|
|
|
|
+ @select-all="dialogTableSelectAll"
|
|
|
|
+ />
|
|
</div>
|
|
</div>
|
|
<div class="dialog-pages">
|
|
<div class="dialog-pages">
|
|
<HcPages :pages="searchFormPage" @change="searchFormPageChange"/>
|
|
<HcPages :pages="searchFormPage" @change="searchFormPageChange"/>
|
|
@@ -448,7 +451,7 @@ const tableBasicColumn = ref([
|
|
{key:'partitionCode', name: '划分编号'},
|
|
{key:'partitionCode', name: '划分编号'},
|
|
{key:'type', name: '节点类型'},
|
|
{key:'type', name: '节点类型'},
|
|
{key:'majorDataType', name: '资料类型'},
|
|
{key:'majorDataType', name: '资料类型'},
|
|
-
|
|
|
|
|
|
+
|
|
])
|
|
])
|
|
const tableBasicData = ref([])
|
|
const tableBasicData = ref([])
|
|
|
|
|
|
@@ -1057,13 +1060,14 @@ const addingFormTreeClick = async (data, node) => {
|
|
console.log(addingFormTreeItem.value.primaryKeyId,'addingFormTreeItem.value');
|
|
console.log(addingFormTreeItem.value.primaryKeyId,'addingFormTreeItem.value');
|
|
if (node?.level === 1) {
|
|
if (node?.level === 1) {
|
|
getDialogTableData().then()
|
|
getDialogTableData().then()
|
|
-
|
|
|
|
|
|
+
|
|
} else if (node?.level === 2) {
|
|
} else if (node?.level === 2) {
|
|
searchFormPage.value.total = 1
|
|
searchFormPage.value.total = 1
|
|
dialogTableData.value = [data]
|
|
dialogTableData.value = [data]
|
|
nextTick(()=>{
|
|
nextTick(()=>{
|
|
dialogTableRef.value?.toggleRowSelection(data,true);
|
|
dialogTableRef.value?.toggleRowSelection(data,true);
|
|
})
|
|
})
|
|
|
|
+ selectItems.value.push(data)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1086,6 +1090,7 @@ const querySearchTree = async (key, resolve) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
const searchTreeSelect = (item) => {
|
|
const searchTreeSelect = (item) => {
|
|
|
|
+ console.log("searchTreeSelect")
|
|
dialogTableRef.value?.clearSelection()
|
|
dialogTableRef.value?.clearSelection()
|
|
dialogTableKeys.value = []
|
|
dialogTableKeys.value = []
|
|
dialogTableData.value = [item]
|
|
dialogTableData.value = [item]
|
|
@@ -1126,11 +1131,25 @@ const getDialogTableData = async () => {
|
|
//获取数据
|
|
//获取数据
|
|
const resData = await tabTypeLazyTree(primaryKeyId, searchTitle, true, true)
|
|
const resData = await tabTypeLazyTree(primaryKeyId, searchTitle, true, true)
|
|
const records = getArrValue(resData?.data)
|
|
const records = getArrValue(resData?.data)
|
|
|
|
+
|
|
//处理返回的数据
|
|
//处理返回的数据
|
|
dialogTableData.value = records
|
|
dialogTableData.value = records
|
|
dialogTableLoading.value = false
|
|
dialogTableLoading.value = false
|
|
if (records.length > 0) {
|
|
if (records.length > 0) {
|
|
searchFormPage.value.total = resData.total || 0
|
|
searchFormPage.value.total = resData.total || 0
|
|
|
|
+
|
|
|
|
+ //表格勾选回显
|
|
|
|
+ selectItems.value.forEach((item)=>{
|
|
|
|
+ dialogTableData.value.forEach((item1)=>{
|
|
|
|
+ if(item.id===item1.id){
|
|
|
|
+ nextTick(()=>{
|
|
|
|
+ dialogTableRef.value?.toggleRowSelection(item1,true);
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ })
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
searchFormPage.value.total = 0
|
|
searchFormPage.value.total = 0
|
|
}
|
|
}
|
|
@@ -1138,20 +1157,44 @@ const getDialogTableData = async () => {
|
|
|
|
|
|
//多选
|
|
//多选
|
|
const dialogTableKeys = ref([]);
|
|
const dialogTableKeys = ref([]);
|
|
-const dialogTableSelection = (rows) => {
|
|
|
|
- console.log(rows,'rows');
|
|
|
|
- dialogTableKeys.value = rows
|
|
|
|
- // selectItem.value.rows=rows;
|
|
|
|
- // selectItem.value.type=addingFormTreeItem.value.primaryKeyId
|
|
|
|
- // console.log(rows,'rows');
|
|
|
|
- // if(selectItem.value.rows.length>0){
|
|
|
|
- // selectItems.value.push(selectItem.value)
|
|
|
|
- // var newArr = [...new Set(selectItems.value)];
|
|
|
|
- // selectItems.value=newArr
|
|
|
|
- // }
|
|
|
|
- // setStoreData('selectItems',rows)
|
|
|
|
|
|
+
|
|
|
|
+// 全选
|
|
|
|
+const dialogTableSelectAll = (rows) => {
|
|
|
|
+ if (rows.length) { /* 全选 */
|
|
|
|
+ if (selectItems.value.length <= 0) {
|
|
|
|
+ rows.forEach(row => {
|
|
|
|
+ selectItems.value.push(row)
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ rows.forEach(row => {
|
|
|
|
+ const flag = selectItems.value.filter(e => e.id === row.id)
|
|
|
|
+ if (flag.length <= 0) {
|
|
|
|
+ selectItems.value.push(row)
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ } else { /* 反选-清空当前列表数据 */
|
|
|
|
+ dialogTableData.value.forEach(row => {
|
|
|
|
+ // 取消选中时过滤
|
|
|
|
+ selectItems.value = selectItems.value.filter(e => e.id !== row.id)
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console.log(selectItems.value, "dialogTableSelectAll selectItems")
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const dialogTableSelect = ({selection, row}) => {
|
|
|
|
+ dialogTableKeys.value = selection
|
|
|
|
+ const flag = selectItems.value.filter(e => e.id === row.id)
|
|
|
|
+ if (flag.length <= 0) { /* 不存在表示是选中,勾选时添加 */
|
|
|
|
+ selectItems.value.push(row)
|
|
|
|
+ } else {
|
|
|
|
+ // 取消选中时过滤
|
|
|
|
+ selectItems.value = selectItems.value.filter(e => e.id !== row.id)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console.log(selectItems.value, "dialogTableSelect selectItems")
|
|
|
|
+}
|
|
//获取数据
|
|
//获取数据
|
|
const tabTypeLazyTree = async (parentId = '12345678910', titleName = '', search = false, form = {},size) => {
|
|
const tabTypeLazyTree = async (parentId = '12345678910', titleName = '', search = false, form = {},size) => {
|
|
let obj = {}, searchObj = {}
|
|
let obj = {}, searchObj = {}
|
|
@@ -1176,7 +1219,9 @@ const tabTypeLazyTree = async (parentId = '12345678910', titleName = '', search
|
|
//保存
|
|
//保存
|
|
const addingFormLoading = ref(false)
|
|
const addingFormLoading = ref(false)
|
|
const addingFormSave = async () => {
|
|
const addingFormSave = async () => {
|
|
- const rows = dialogTableKeys.value
|
|
|
|
|
|
+ // const rows = dialogTableKeys.value
|
|
|
|
+ console.log(dialogTableKeys.value, "addingFormSave")
|
|
|
|
+ const rows = selectItems.value
|
|
if (rows.length > 0) {
|
|
if (rows.length > 0) {
|
|
addingFormLoading.value = true
|
|
addingFormLoading.value = true
|
|
const { primaryKeyId } = treeItemInfo.value
|
|
const { primaryKeyId } = treeItemInfo.value
|