|
@@ -45,6 +45,10 @@
|
|
|
:commonData="commonData"
|
|
|
@on-sort="handleSort"
|
|
|
@option="handleOption"
|
|
|
+
|
|
|
+ :groupBy='groupingValue'
|
|
|
+ :groupingOption="groupingOption"
|
|
|
+ :searchOption="searchOption"
|
|
|
></component>
|
|
|
</div>
|
|
|
</el-main>
|
|
@@ -118,7 +122,7 @@ export default {
|
|
|
//显示视图
|
|
|
showView: false,
|
|
|
//场景
|
|
|
- scene:[],
|
|
|
+ scene: [],
|
|
|
};
|
|
|
},
|
|
|
watch: {},
|
|
@@ -126,9 +130,9 @@ export default {
|
|
|
created() { },
|
|
|
async mounted() {
|
|
|
await this.getCommonData()
|
|
|
+ //获取table栏位及分组字段
|
|
|
+ await this.getColumn()
|
|
|
this.getList()
|
|
|
- //获取table栏位及分组字段v
|
|
|
- this.getColumn()
|
|
|
},
|
|
|
methods: {
|
|
|
// 请求应用场景(是通过字典还是接口待定)
|
|
@@ -153,21 +157,25 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
//获取table栏位及分组字段、检索字段
|
|
|
- getColumn() {
|
|
|
+ async getColumn() {
|
|
|
let params = ['event']
|
|
|
- this.$api.getParamsCommon(params).then(res => {
|
|
|
+ await this.$api.getParamsCommon(params).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- this.columnList = res.data[0].conditionDTOList
|
|
|
- this.groupingOption=res.data[0].conditionDTOList.filter(item => {
|
|
|
+ // 显示栏位
|
|
|
+ this.columnList = res.data[0].conditionDTOList.filter(item => {
|
|
|
+ return item.name != 'Id' && item.ifShow == true
|
|
|
+ })
|
|
|
+ // 分组字段
|
|
|
+ let conditionDTOList= JSON.parse(JSON.stringify(res.data[0].conditionDTOList))
|
|
|
+ this.groupingOption = conditionDTOList.filter(item => {
|
|
|
+ var reg = /时间/;
|
|
|
+ if (item.name.indexOf('时间') != -1) {
|
|
|
+ let a = item.name.replace(reg, '月份')
|
|
|
+ item.name=a
|
|
|
+ }
|
|
|
return item.ifGroup == true
|
|
|
})
|
|
|
- // {
|
|
|
- // label: '事件名称',
|
|
|
- // value: 'name',
|
|
|
- // type: 3,
|
|
|
- // placeholder: '请输入事件名称',
|
|
|
- // options: [{value: 1,label:2}],
|
|
|
- // },
|
|
|
+ // 搜索字段
|
|
|
this.searchFiled = res.data[0].conditionDTOList.filter(item => {
|
|
|
item.label = item.name
|
|
|
if (['createTime','eventDate'].includes(item.value)) {
|
|
@@ -205,8 +213,7 @@ export default {
|
|
|
this.queryParams.current=1
|
|
|
this.isGrouping()
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
// 分页
|
|
|
handleCurrentChange(val) {
|
|
|
this.queryParams.current = val;
|
|
@@ -218,10 +225,9 @@ export default {
|
|
|
let params = {
|
|
|
...this.queryParams,//分页信息
|
|
|
...this.searchOption,//检索条件
|
|
|
- orderDTOList:this.sort,//排序
|
|
|
+ orderDTOList: this.sort,//排序
|
|
|
}
|
|
|
this.$api.queryEvent(params).then(res => {
|
|
|
-
|
|
|
if (res.code == 200) {
|
|
|
this.tableData = res.data.data
|
|
|
this.total=res.data.total
|
|
@@ -249,19 +255,24 @@ export default {
|
|
|
...this.queryParams,//分页信息
|
|
|
...this.searchOption,//检索信息
|
|
|
orderDTOList:this.sort,//排序
|
|
|
- grouping:this.groupingValue,//分组信息
|
|
|
+ groupBy:this.groupingValue,//分组信息
|
|
|
}
|
|
|
- // this.$api.query(params).then(res => {
|
|
|
- // if (res.code == 200) {
|
|
|
- // this.tableData = rea.data
|
|
|
- // }
|
|
|
- // })
|
|
|
+ this.$api.groupEvent(params).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.commonData=res.data.data.values
|
|
|
+ this.total=res.data.total
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ this.commonData = []
|
|
|
+ this.total=0
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
//切换视图
|
|
|
onChange2(type) {
|
|
|
this.viewSelected = type
|
|
|
- // this.getList()
|
|
|
+ this.queryParams.current=1
|
|
|
+ this.getList()
|
|
|
},
|
|
|
|
|
|
//新增事件的选项(1是添加单个事件,2是批量添加)
|
|
@@ -270,17 +281,27 @@ export default {
|
|
|
},
|
|
|
|
|
|
//获取排序字段// 子组件table排序
|
|
|
- handleSort({ column, prop, order ,str}) {
|
|
|
- let params = {
|
|
|
- orderBy:prop,
|
|
|
+ handleSort({ column, prop, order, str }) {
|
|
|
+ if (order == 'null') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ var orderType = {
|
|
|
+ ascending: 0,
|
|
|
+ descending:1
|
|
|
}
|
|
|
- if (order == 'ascending') {
|
|
|
- params.orderType = 0
|
|
|
+ var params = this.sort.find(item => {
|
|
|
+ return item.orderBy == prop
|
|
|
+ })
|
|
|
+ if (params) {
|
|
|
+ params.orderType = orderType[order]
|
|
|
} else {
|
|
|
- params.orderType=1
|
|
|
+ params = {}
|
|
|
+ params.orderBy = prop
|
|
|
+ params.orderType = orderType[order]
|
|
|
+ this.sort.push(params)
|
|
|
}
|
|
|
- this.sort.push(params)
|
|
|
- if (str == '展开行排序') {
|
|
|
+ //1表示展开行2表示基础表格
|
|
|
+ if (str == '1') {
|
|
|
this.getGrouping()
|
|
|
} else {//table排序
|
|
|
this.getList()
|
|
@@ -308,7 +329,7 @@ export default {
|
|
|
case 'cancel'://取消关联
|
|
|
break;
|
|
|
case 'edit'://编辑事件,打开单件事件弹窗
|
|
|
- this.$refs.addEvent.open(row,1)
|
|
|
+ this.$refs.addEvent.open(row, 1)
|
|
|
break;
|
|
|
}
|
|
|
},
|