|
@@ -1,5 +1,5 @@
|
|
<template>
|
|
<template>
|
|
- <el-tabs class="cy-tabs" type="border-card">
|
|
|
|
|
|
+ <el-tabs class="cy-tabs" type="border-card" @tab-click="navGroupItemEvent">
|
|
<el-tab-pane>
|
|
<el-tab-pane>
|
|
<div slot="label" class="tab-div">
|
|
<div slot="label" class="tab-div">
|
|
<el-image :src="require('@/assets/images/report_model.png')" fit="contain"></el-image>
|
|
<el-image :src="require('@/assets/images/report_model.png')" fit="contain"></el-image>
|
|
@@ -95,7 +95,7 @@
|
|
</el-select>
|
|
</el-select>
|
|
<el-button size="mini" @click="addDataItem" style="float: right;width: 100px;margin-top: 4px;">添加数据项</el-button>
|
|
<el-button size="mini" @click="addDataItem" style="float: right;width: 100px;margin-top: 4px;">添加数据项</el-button>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-tag size="mini" v-if="chooseItemDataView" class="cy-item-tag">已选择({{ chooseItemDataList.length }})项</el-tag>
|
|
|
|
|
|
+ <el-tag size="mini" v-if="chooseItemDataView" class="cy-item-tag">已选择({{ chooseItemDataListByTree.length }})项</el-tag>
|
|
</div>
|
|
</div>
|
|
<!-- <el-button size="mini" style="float: right;margin-top: 15px;margin-right: 14px;">添加数据项</el-button>-->
|
|
<!-- <el-button size="mini" style="float: right;margin-top: 15px;margin-right: 14px;">添加数据项</el-button>-->
|
|
</el-form>
|
|
</el-form>
|
|
@@ -172,7 +172,7 @@
|
|
<svg-icon v-if="!data.children" icon-class="file"/>
|
|
<svg-icon v-if="!data.children" icon-class="file"/>
|
|
<svg-icon v-else-if="node.expanded" icon-class="folder-open"/>
|
|
<svg-icon v-else-if="node.expanded" icon-class="folder-open"/>
|
|
<svg-icon v-else icon-class="folder"/>
|
|
<svg-icon v-else icon-class="folder"/>
|
|
- <span :title='node.label || "-"' style="margin-left: 2px;">{{node.label}}</span>
|
|
|
|
|
|
+ <span :title='node.label || "-"' style="margin-left: 2px;">{{ node.label }}</span>
|
|
</span>
|
|
</span>
|
|
</el-tree>
|
|
</el-tree>
|
|
</div>
|
|
</div>
|
|
@@ -205,7 +205,7 @@
|
|
<svg-icon v-if="!data.children" icon-class="file"/>
|
|
<svg-icon v-if="!data.children" icon-class="file"/>
|
|
<svg-icon v-else-if="node.expanded" icon-class="folder-open"/>
|
|
<svg-icon v-else-if="node.expanded" icon-class="folder-open"/>
|
|
<svg-icon v-else icon-class="folder"/>
|
|
<svg-icon v-else icon-class="folder"/>
|
|
- <span :title='node.label || "-"' style="margin-left: 2px;">{{node.label}}</span>
|
|
|
|
|
|
+ <span :title='node.label || data.itemName' style="margin-left: 2px;">{{ node.label || data.itemName }}</span>
|
|
</span>
|
|
</span>
|
|
</el-tree>
|
|
</el-tree>
|
|
</div>
|
|
</div>
|
|
@@ -271,6 +271,7 @@ export default {
|
|
chooseItemDataListByTree: [],
|
|
chooseItemDataListByTree: [],
|
|
chooseItemDataView: false,
|
|
chooseItemDataView: false,
|
|
groupBasicForm: {
|
|
groupBasicForm: {
|
|
|
|
+ id: null,
|
|
groupName: '',
|
|
groupName: '',
|
|
groupDescribe: '',
|
|
groupDescribe: '',
|
|
dataSourceId: null,
|
|
dataSourceId: null,
|
|
@@ -280,6 +281,8 @@ export default {
|
|
readMode: null,
|
|
readMode: null,
|
|
modeValue: ''
|
|
modeValue: ''
|
|
},
|
|
},
|
|
|
|
+ updateGroupData: null,
|
|
|
|
+ tempItemList: [],
|
|
groupRules: {
|
|
groupRules: {
|
|
groupName: [
|
|
groupName: [
|
|
{ required: true, message: '组名称不能为空', trigger: 'blur' },
|
|
{ required: true, message: '组名称不能为空', trigger: 'blur' },
|
|
@@ -311,6 +314,7 @@ export default {
|
|
computed: {
|
|
computed: {
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
|
|
+ this.getReadMode()
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
/** 数据项搜索过滤 */
|
|
/** 数据项搜索过滤 */
|
|
@@ -321,6 +325,28 @@ export default {
|
|
/** 数据组组配置点击事件 */
|
|
/** 数据组组配置点击事件 */
|
|
handleNodeClick(data, node, target) {
|
|
handleNodeClick(data, node, target) {
|
|
this.closeMenu()
|
|
this.closeMenu()
|
|
|
|
+ if (data.id != -1 && !data.itemName) {
|
|
|
|
+ sessionStorage.setItem('GROUP_ID', data.id)
|
|
|
|
+ this.gotoPageByName('/groupItem')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /** 组菜单点击事件 */
|
|
|
|
+ navGroupItemEvent(e) {
|
|
|
|
+ sessionStorage.removeItem('GROUP_ITEM')
|
|
|
|
+ if (e.paneName == '1') {
|
|
|
|
+ this.gotoPageByName('/groupItem')
|
|
|
|
+ } else {
|
|
|
|
+ this.gotoPageByName('/index')
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ /** 页面跳转 */
|
|
|
|
+ gotoPageByName(path) {
|
|
|
|
+ this.$router.push({
|
|
|
|
+ path: path,
|
|
|
|
+ query: {
|
|
|
|
+ t: new Date().getTime()
|
|
|
|
+ }
|
|
|
|
+ })
|
|
},
|
|
},
|
|
/** 懒加载查询组配置文件 */
|
|
/** 懒加载查询组配置文件 */
|
|
loadGroupNode(node, resolve) {
|
|
loadGroupNode(node, resolve) {
|
|
@@ -330,6 +356,7 @@ export default {
|
|
if (node.data.id == -1) {
|
|
if (node.data.id == -1) {
|
|
getAllItemGroup().then(res => {
|
|
getAllItemGroup().then(res => {
|
|
resolve(res.data)
|
|
resolve(res.data)
|
|
|
|
+ sessionStorage.setItem('GROUP_LIST', JSON.stringify(res.data))
|
|
}).catch((e) => {
|
|
}).catch((e) => {
|
|
resolve([])
|
|
resolve([])
|
|
})
|
|
})
|
|
@@ -354,6 +381,7 @@ export default {
|
|
this.closeMenu()
|
|
this.closeMenu()
|
|
// 判断是否最后一级菜单
|
|
// 判断是否最后一级菜单
|
|
this.menuLeft = 80
|
|
this.menuLeft = 80
|
|
|
|
+ this.updateGroupData = null
|
|
if (data.id == -1) {
|
|
if (data.id == -1) {
|
|
this.menuTop = 30
|
|
this.menuTop = 30
|
|
this.visibleGroupMenu = true
|
|
this.visibleGroupMenu = true
|
|
@@ -368,8 +396,19 @@ export default {
|
|
/** 添加数据组事件 */
|
|
/** 添加数据组事件 */
|
|
createGroupEvent() {
|
|
createGroupEvent() {
|
|
this.closeMenu()
|
|
this.closeMenu()
|
|
|
|
+ this.groupBasicForm = {
|
|
|
|
+ id: null,
|
|
|
|
+ groupName: '',
|
|
|
|
+ groupDescribe: '',
|
|
|
|
+ dataSourceId: null,
|
|
|
|
+ itemList: []
|
|
|
|
+ }
|
|
|
|
+ this.groupRateForm = {
|
|
|
|
+ readMode: null,
|
|
|
|
+ modeValue: ''
|
|
|
|
+ }
|
|
|
|
+ this.chooseItemDataView = false
|
|
this.getDataSourceList()
|
|
this.getDataSourceList()
|
|
- this.getReadMode()
|
|
|
|
this.groupDialogVisible = true
|
|
this.groupDialogVisible = true
|
|
},
|
|
},
|
|
/** 保存数据组 */
|
|
/** 保存数据组 */
|
|
@@ -380,17 +419,21 @@ export default {
|
|
let params = JSON.parse(JSON.stringify(this.groupBasicForm))
|
|
let params = JSON.parse(JSON.stringify(this.groupBasicForm))
|
|
params.readMode = this.groupRateForm.readMode
|
|
params.readMode = this.groupRateForm.readMode
|
|
params.modeValue = this.groupRateForm.modeValue
|
|
params.modeValue = this.groupRateForm.modeValue
|
|
- this.addGroupItem(params)
|
|
|
|
|
|
+ if (params.id) {
|
|
|
|
+ this.addGroupItem(params, '修改')
|
|
|
|
+ } else {
|
|
|
|
+ this.addGroupItem(params, '保存')
|
|
|
|
+ }
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
/** 保存组配置 */
|
|
/** 保存组配置 */
|
|
- addGroupItem(params) {
|
|
|
|
- const loading = showLoading(this, '保存中,请稍候···')
|
|
|
|
|
|
+ addGroupItem(params, type) {
|
|
|
|
+ const loading = showLoading(this, type + '中,请稍候···')
|
|
saveOrUpdateItemGroup(params).then(res => {
|
|
saveOrUpdateItemGroup(params).then(res => {
|
|
loading.close()
|
|
loading.close()
|
|
if (res.data) {
|
|
if (res.data) {
|
|
- this.$alert('保存成功!', '温馨提示', {
|
|
|
|
|
|
+ this.$alert(type + '成功!', '温馨提示', {
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
callback: action => {
|
|
callback: action => {
|
|
this.handleCancel()
|
|
this.handleCancel()
|
|
@@ -403,20 +446,53 @@ export default {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
this.$message({
|
|
this.$message({
|
|
- message: '保存失败!',
|
|
|
|
|
|
+ message: type + '失败!',
|
|
type: 'error'
|
|
type: 'error'
|
|
})
|
|
})
|
|
}).catch((e) => {
|
|
}).catch((e) => {
|
|
loading.close()
|
|
loading.close()
|
|
this.$message({
|
|
this.$message({
|
|
- message: '保存失败!',
|
|
|
|
|
|
+ message: type + '失败!',
|
|
type: 'error'
|
|
type: 'error'
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},
|
|
},
|
|
/** 更新组信息 */
|
|
/** 更新组信息 */
|
|
updateGroup() {
|
|
updateGroup() {
|
|
- console.log(this.chooseGroupData)
|
|
|
|
|
|
+ let id = this.chooseGroupData.id
|
|
|
|
+ if (!id) {
|
|
|
|
+ this.$message({
|
|
|
|
+ message: '修改失败!',
|
|
|
|
+ type: 'error'
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ getItemGroupById(id).then(res => {
|
|
|
|
+ this.createGroupEvent()
|
|
|
|
+ let item = res.data
|
|
|
|
+ this.updateGroupData = item
|
|
|
|
+ this.groupBasicForm.id = item.id
|
|
|
|
+ this.groupBasicForm.groupName = item.groupName
|
|
|
|
+ this.groupBasicForm.groupDescribe = item.groupDescribe
|
|
|
|
+ this.groupBasicForm.dataSourceId = item.dataSourceId
|
|
|
|
+ this.groupBasicForm.itemList = item.itemList
|
|
|
|
+ this.getChooseItemData(item)
|
|
|
|
+ this.chooseItemDataView = true
|
|
|
|
+ this.groupRateForm.readMode = item.readMode + ''
|
|
|
|
+ this.groupRateForm.modeValue = item.modeValue
|
|
|
|
+ }).catch((e) => {
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ /** 选择的数据项值初始化 */
|
|
|
|
+ getChooseItemData(item) {
|
|
|
|
+ let arr = []
|
|
|
|
+ for (let i in item.itemList) {
|
|
|
|
+ arr.push({
|
|
|
|
+ 'label': item.itemList[i].itemName
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ this.chooseItemDataListByTree = arr
|
|
|
|
+ this.chooseItemDataList = arr
|
|
},
|
|
},
|
|
/** 删除组信息 */
|
|
/** 删除组信息 */
|
|
delGroup() {
|
|
delGroup() {
|
|
@@ -464,9 +540,14 @@ export default {
|
|
/** 选择数据源值改变事件 */
|
|
/** 选择数据源值改变事件 */
|
|
dataSourceChange(val) {
|
|
dataSourceChange(val) {
|
|
this.groupBasicForm.dataSourceId = val
|
|
this.groupBasicForm.dataSourceId = val
|
|
- this.chooseItemDataList = []
|
|
|
|
- this.chooseItemDataListByTree = []
|
|
|
|
- this.chooseItemDataView = false
|
|
|
|
|
|
+ if (this.groupBasicForm.id && this.updateGroupData.dataSourceId == val) {
|
|
|
|
+ this.chooseItemDataView = true
|
|
|
|
+ this.getChooseItemData(this.updateGroupData)
|
|
|
|
+ } else {
|
|
|
|
+ this.chooseItemDataView = false
|
|
|
|
+ this.chooseItemDataList = []
|
|
|
|
+ this.chooseItemDataListByTree = []
|
|
|
|
+ }
|
|
},
|
|
},
|
|
/** 读取模式值改变事件 */
|
|
/** 读取模式值改变事件 */
|
|
readModeChange(val) {
|
|
readModeChange(val) {
|
|
@@ -500,6 +581,7 @@ export default {
|
|
})
|
|
})
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ this.tempItemList = JSON.parse(JSON.stringify(this.groupBasicForm.itemList))
|
|
// const loading = showLoading(this, '加载中,请稍候···')
|
|
// const loading = showLoading(this, '加载中,请稍候···')
|
|
// getDataSourceItemTree(id).then(res => {
|
|
// getDataSourceItemTree(id).then(res => {
|
|
// loading.close()
|
|
// loading.close()
|
|
@@ -727,8 +809,14 @@ export default {
|
|
},
|
|
},
|
|
/** 选择数据项弹出层关闭事件 */
|
|
/** 选择数据项弹出层关闭事件 */
|
|
itemDialogClose(done) {
|
|
itemDialogClose(done) {
|
|
|
|
+ if ((!this.groupBasicForm.id && !this.chooseItemDataView) || !this.chooseItemDataView) {
|
|
|
|
+ this.chooseItemDataListByTree = []
|
|
|
|
+ }
|
|
|
|
+ if (this.groupBasicForm.id && this.groupBasicForm.dataSourceId == this.updateGroupData.dataSourceId) {
|
|
|
|
+ this.chooseItemDataListByTree = this.tempItemList
|
|
|
|
+ this.groupBasicForm.itemList = this.tempItemList
|
|
|
|
+ }
|
|
this.itemDataListByTree = []
|
|
this.itemDataListByTree = []
|
|
- this.chooseItemDataListByTree = []
|
|
|
|
if (typeof(done) === 'function') {
|
|
if (typeof(done) === 'function') {
|
|
done()
|
|
done()
|
|
} else {
|
|
} else {
|