|
@@ -168,11 +168,15 @@
|
|
|
width="80%"
|
|
|
top="10vh"
|
|
|
center
|
|
|
- :before-close="dialogClose"
|
|
|
+ :before-close="dialogItemClose"
|
|
|
:visible.sync="dialogDataItemVisible"
|
|
|
:close-on-click-modal="false"
|
|
|
:append-to-body="true">
|
|
|
<div>
|
|
|
+ <div style="margin-bottom: 10px;">
|
|
|
+ <span>组名称:{{ itemDataListByGroupName }}</span>
|
|
|
+ <el-checkbox v-model="isSelectAllItem" @change="selectAllItem" style="float: right;">全选</el-checkbox>
|
|
|
+ </div>
|
|
|
<el-input placeholder="请输入关键字进行过滤" v-model="filterItemData"></el-input>
|
|
|
<div style="height: 50vh; margin-top: 10px; overflow: auto;">
|
|
|
<el-tree class="cy-item-tree"
|
|
@@ -184,14 +188,15 @@
|
|
|
:check-on-click-node="true"
|
|
|
:filter-node-method="filterItemDataNode"
|
|
|
:highlight-current="true"
|
|
|
- :default-expand-all="true">
|
|
|
+ :default-expand-all="true"
|
|
|
+ @check-change="handleItemCheckChange">
|
|
|
<span class="custom-tree-node" slot-scope="{ node, data }">
|
|
|
<svg-icon v-if="!data.children || data.children.length == 0" icon-class="file"/>
|
|
|
<svg-icon v-else-if="node.expanded" icon-class="folder-open"/>
|
|
|
<svg-icon v-else icon-class="folder"/>
|
|
|
<span :title='data.itemName || "-"' style="margin-left: 2px;">
|
|
|
{{ data.describe
|
|
|
- ? ((data.itemName ? data.itemName : '') + '【' + data.describe + '】')
|
|
|
+ ? ((data.itemName ? data.itemName : '') + '(' + data.describe + ')')
|
|
|
: data.itemName ? data.itemName : '' }}
|
|
|
</span>
|
|
|
</span>
|
|
@@ -294,7 +299,7 @@
|
|
|
|
|
|
<!-- 选择数据组数据 -->
|
|
|
<el-dialog
|
|
|
- title="选择数据项"
|
|
|
+ title="数据项配置"
|
|
|
width="80%"
|
|
|
top="10vh"
|
|
|
center
|
|
@@ -323,7 +328,6 @@
|
|
|
:data="chooseGroupItemList"
|
|
|
:indent="10"
|
|
|
node-key="id"
|
|
|
- show-checkbox
|
|
|
:check-on-click-node="true"
|
|
|
:filter-node-method="filterItemDataNode"
|
|
|
:highlight-current="true"
|
|
@@ -346,8 +350,9 @@
|
|
|
</div>
|
|
|
<div v-if="chooseGroupItemList.length > 0">
|
|
|
<template>
|
|
|
- <el-divider content-position="left">数据显示方式</el-divider>
|
|
|
+ <el-divider content-position="left">数据显示</el-divider>
|
|
|
<div class="cy-line custom-tree">
|
|
|
+ <label>显示方式:</label>
|
|
|
<el-radio v-model="itemShowParams.fieldType" label="1">横向</el-radio>
|
|
|
<el-radio v-model="itemShowParams.fieldType" label="2">纵向</el-radio>
|
|
|
</div>
|
|
@@ -356,7 +361,7 @@
|
|
|
<el-divider content-position="left">值显示</el-divider>
|
|
|
<div class="cy-line custom-tree" style="display: flex; align-items: center;">
|
|
|
<div style="width: 50%;">
|
|
|
- <label>显示类型:</label>
|
|
|
+ <label>显示方式:</label>
|
|
|
<el-radio v-model="itemShowParams.valType" label="1">横向</el-radio>
|
|
|
<el-radio v-model="itemShowParams.valType" label="2">纵向</el-radio>
|
|
|
</div>
|
|
@@ -410,6 +415,7 @@ export default {
|
|
|
dialogCommReportVisible: false,
|
|
|
dialogGroupItemVisible: false,
|
|
|
dialogBaseDataVisible: false,
|
|
|
+ isSelectAllItem: false,
|
|
|
menuLeft: 0,
|
|
|
menuTop: 0,
|
|
|
visibleChartMenu: false,
|
|
@@ -437,6 +443,7 @@ export default {
|
|
|
chooseBaseData: null,
|
|
|
dataGroupList: [],
|
|
|
itemDataListByTree: [],
|
|
|
+ itemDataListByGroupName: '',
|
|
|
itemDataListByCalc: [],
|
|
|
chooseGroupItemList: [],
|
|
|
dataModelList: [],
|
|
@@ -588,6 +595,49 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ traverseNode(node) {
|
|
|
+ if (Object.prototype.toString.call(node) === '[object Array]') {
|
|
|
+ return node.map(t => this.traverseNode(t))
|
|
|
+ }
|
|
|
+ let data = node.data
|
|
|
+ data.visible = node.visible
|
|
|
+ return data
|
|
|
+ },
|
|
|
+ traverseVisible(arr) {
|
|
|
+ return arr.filter(t => {
|
|
|
+ let visible = t.visible
|
|
|
+ if (!visible) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (t.children) {
|
|
|
+ t.children = this.traverseVisible(t.children)
|
|
|
+ }
|
|
|
+ delete t.visible
|
|
|
+ return visible
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /** 数据项全选事件 */
|
|
|
+ selectAllItem() {
|
|
|
+ const data = this.traverseNode(this.$refs.itemTree.store.root.childNodes)
|
|
|
+ if (this.isSelectAllItem) {
|
|
|
+ // this.$refs.itemTree.setCheckedNodes(this.itemDataListByTree)
|
|
|
+ let arr = this.traverseVisible(data)
|
|
|
+ let ids = Array.from(arr, ({ id }) => id)
|
|
|
+ this.$refs.itemTree.setCheckedKeys(ids)
|
|
|
+ } else {
|
|
|
+ this.$refs.itemTree.setCheckedNodes([])
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**数据项单项选择判断 */
|
|
|
+ handleItemCheckChange(data, checked, indeterminate) {
|
|
|
+ const tdata = this.traverseNode(this.$refs.itemTree.store.root.childNodes)
|
|
|
+ let arr = this.traverseVisible(tdata)
|
|
|
+ if (arr.length == this.$refs.itemTree.getCheckedNodes().length) {
|
|
|
+ this.isSelectAllItem = true
|
|
|
+ } else {
|
|
|
+ this.isSelectAllItem = false
|
|
|
+ }
|
|
|
+ },
|
|
|
/** 保存模版信息 */
|
|
|
saveReportTemplate() {
|
|
|
this.$prompt('请输入/确认报表模板名称', '保存', {
|
|
@@ -786,16 +836,28 @@ export default {
|
|
|
})
|
|
|
return
|
|
|
}
|
|
|
+ this.itemDataListByTree = []
|
|
|
const loading = showLoading(this, '加载中,请稍候···')
|
|
|
getTableItemGroupById(id).then(res => {
|
|
|
loading.close()
|
|
|
+ this.itemDataListByGroupName = res.data.groupName
|
|
|
this.itemDataListByTree = res.data.itemList
|
|
|
- if (this.chooseItemData.length > 0) {
|
|
|
- let idList = []
|
|
|
- for (let i in this.chooseItemData) {
|
|
|
- idList.push(this.chooseItemData[i].id)
|
|
|
- }
|
|
|
+ // if (this.chooseItemData.length > 0) {
|
|
|
+ // let idList = []
|
|
|
+ // for (let i in this.chooseItemData) {
|
|
|
+ // idList.push(this.chooseItemData[i].id)
|
|
|
+ // }
|
|
|
+ // this.$refs.itemTree.setCheckedKeys(idList)
|
|
|
+ // }
|
|
|
+ this.$refs.itemTree.setCheckedKeys([])
|
|
|
+ if (this.chooseGroupItemList.length > 0) {
|
|
|
+ let idList = Array.from(this.chooseGroupItemList, ({ id }) => id)
|
|
|
this.$refs.itemTree.setCheckedKeys(idList)
|
|
|
+ if (this.itemDataListByTree.length == idList.length) {
|
|
|
+ this.isSelectAllItem = true
|
|
|
+ } else {
|
|
|
+ this.isSelectAllItem = false
|
|
|
+ }
|
|
|
}
|
|
|
this.dialogDataItemVisible = true
|
|
|
}).catch((e) => {
|
|
@@ -830,6 +892,7 @@ export default {
|
|
|
if (this.dialogGroupItemVisible) {
|
|
|
this.initGroupItem()
|
|
|
}
|
|
|
+ this.filterItemData = ''
|
|
|
// this.getAllDataModel(chooseList)
|
|
|
},
|
|
|
initGroupItem() {
|
|
@@ -1333,6 +1396,11 @@ export default {
|
|
|
},
|
|
|
/** 弹出层关闭事件 */
|
|
|
dialogClose(done) {
|
|
|
+ this.chooseDataGroup = null
|
|
|
+ this.chooseItemData = []
|
|
|
+ this.chooseGroupItemList = []
|
|
|
+ this.filterItemData = ''
|
|
|
+
|
|
|
this.commTemplate = null
|
|
|
if (typeof(done) === 'function') {
|
|
|
done()
|
|
@@ -1346,6 +1414,16 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
/** 弹出层关闭事件 */
|
|
|
+ dialogItemClose(done) {
|
|
|
+ this.itemDataListByTree = []
|
|
|
+ this.filterItemData = ''
|
|
|
+ if (typeof(done) === 'function') {
|
|
|
+ done()
|
|
|
+ } else {
|
|
|
+ this.dialogDataItemVisible = false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /** 弹出层关闭事件 */
|
|
|
dialogDataModelClose() {
|
|
|
if (typeof(done) === 'function') {
|
|
|
done()
|