|
@@ -94,6 +94,7 @@
|
|
|
queryInfo: [],
|
|
|
// 查询参数,多个页面的查询参数用 code 作为键来区分
|
|
|
queryParamsMap: {},
|
|
|
+ mapCol: {},
|
|
|
selfParam:{
|
|
|
},
|
|
|
sorter: {
|
|
@@ -136,11 +137,13 @@
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ this.queryReportByTable()
|
|
|
this.initParamsInfo()
|
|
|
this.initQueryInfo();
|
|
|
},
|
|
|
watch: {
|
|
|
'$route'() {
|
|
|
+ this.queryReportByTable()
|
|
|
// 刷新参数放到这里去触发,就可以刷新相同界面了
|
|
|
this.initParamsInfo()
|
|
|
this.initQueryInfo();
|
|
@@ -170,6 +173,7 @@
|
|
|
this.selfParam={}
|
|
|
getAction(`${this.url.getParamsInfo}${this.reportCode}`).then((res) => {
|
|
|
if (res.success) {
|
|
|
+
|
|
|
if(res.result && res.result.length>0){
|
|
|
for(let i of res.result){
|
|
|
this.selfParam['self_'+i.paramName]=(!this.$route.query[i.paramName])?"":this.$route.query[i.paramName]
|
|
@@ -188,13 +192,27 @@
|
|
|
getAction(`${this.url.getQueryInfo}${this.reportCode}`).then((res) => {
|
|
|
console.log("获取查询条件", res);
|
|
|
if (res.success) {
|
|
|
+
|
|
|
this.queryInfo = res.result
|
|
|
} else {
|
|
|
this.$message.warning(res.message)
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ queryReportByTable(){
|
|
|
+
|
|
|
+ let that = this;
|
|
|
+ let mapCol = null;
|
|
|
+ that.getAction('/sys/dict/queryReportByTable',{tableName:this.$route.params.code}).then(res => {
|
|
|
+ if(res !=null && res !=''){
|
|
|
+ that.mapCol = res;
|
|
|
+ console.log('aaaaaaaaaaaaaaa : ' + res['员工姓名']);
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
loadData(arg) {
|
|
|
+ // console.log('aaaaaaaaa222222aaaaaa : ' + this.mapCol['员工姓名']);
|
|
|
if(!this.reportCode){
|
|
|
return false
|
|
|
}
|
|
@@ -202,26 +220,47 @@
|
|
|
this.table.pagination.current = 1
|
|
|
}
|
|
|
let params = this.getQueryParams();//查询条件
|
|
|
- console.log(params)
|
|
|
+ // console.log(params)
|
|
|
|
|
|
//获取报表ID
|
|
|
- console.log(' 动态报表 reportCode : ' + this.reportCode);
|
|
|
+ // console.log(' 动态报表 reportCode : ' + this.reportCode);
|
|
|
+ // console.log(' 动态报表 reportCode : ' + `${this.url.getColumnsAndData}${this.reportCode}`);
|
|
|
this.table.loading = true
|
|
|
-
|
|
|
+ let that = this;
|
|
|
getAction(`${this.url.getColumnsAndData}${this.reportCode}`, params).then(res => {
|
|
|
if (res.success) {
|
|
|
+
|
|
|
+ // let tet = [{title: '预计请假时分', align: 'center', sorter: 'true',with:'20px', dataIndex: '预计请假时分'}
|
|
|
+ // ,{title: "员工姓名", align: "center", sorter: "true", dataIndex: "员工姓名"}
|
|
|
+ // ,{title: "员工姓名", align: "center", sorter: "true", dataIndex: "员工姓名"}
|
|
|
+ // ,{title: "员工姓名", align: "center", sorter: "true", dataIndex: "员工姓名"}
|
|
|
+ // ,{title: "员工姓名", align: "center", sorter: "true", dataIndex: "员工姓名"}
|
|
|
+ // ]
|
|
|
+
|
|
|
let { data, columns, cgreportHeadName, dictOptions, fieldHrefSlots } = res.result
|
|
|
-
|
|
|
- let columnWidth = 230
|
|
|
+ let columnWidth = 0
|
|
|
this.dictOptions = dictOptions
|
|
|
for(let a=0;a<columns.length;a++){
|
|
|
+
|
|
|
if(columns[a].customRender){
|
|
|
let field_name = columns[a].customRender;
|
|
|
columns[a].customRender = (t => t ? filterMultiDictText(this.dictOptions[field_name], t + '') : t)
|
|
|
}
|
|
|
- columns.width = columnWidth
|
|
|
+ if(that.mapCol[columns[a].title] != null && that.mapCol[columns[a].title] != undefined && that.mapCol[columns[a].title] != '' ){
|
|
|
+ columns[a].width = that.mapCol[columns[a].title]
|
|
|
+ }else{
|
|
|
+ columns[a].width = columnWidth
|
|
|
+ }
|
|
|
+ columnWidth += columns[a].width;
|
|
|
+ }
|
|
|
+ if(columnWidth < window.innerWidth * 0.8){
|
|
|
+ columns[columns.length-1].width = window.innerWidth * 0.78 - columnWidth + columns[columns.length-1].width
|
|
|
}
|
|
|
- this.table.scroll.x = columns.length * columnWidth
|
|
|
+ // console.log(window.innerWidth);
|
|
|
+ // console.log(window.innerWidth * 0.8);
|
|
|
+ // console.log("=================="+columnWidth);
|
|
|
+ this.table.scroll.x = columns.length * (columnWidth/columns.length)
|
|
|
+ // this.table.scroll.x = 1100
|
|
|
this.table.columns = [...columns]
|
|
|
this.cgreportHeadName = cgreportHeadName
|
|
|
this.fieldHrefSlots = fieldHrefSlots
|