|
|
@ -145,7 +145,15 @@ export const tableMixins = { |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 获取通过api的表头转义数据
|
|
|
|
// 获取通过api的表头数据,不可以在初始化处理,因为接口返回问题
|
|
|
|
// initApiColumns(table,des,detailsTable,detailsPage){
|
|
|
|
// // 赋值表头数据
|
|
|
|
// // if(table && table[this.$route.name])this.apiColumns_Table = this.initTableColumns(table[this.$route.name])
|
|
|
|
// if(des && des[this.$route.name])this.apiColumns_DesTions = des[this.$route.name]
|
|
|
|
// if(detailsTable && detailsTable[this.$route.name])this.apiColumns_DetailsTable = this.initTableColumns(detailsTable[this.$route.name],'detail_api')
|
|
|
|
// if(detailsPage && detailsPage[this.$route.name])this.apiColumns_DetailsPage = this.initTableColumns(detailsPage[this.$route.name],'detailPage_api')
|
|
|
|
// },
|
|
|
|
// get-dto-column-type接口表头类型初始化
|
|
|
|
initApiColumnsForDto(list,titleName){ |
|
|
|
let data = this.$store.getters.dtoColumnTypes |
|
|
|
let _coloums = data[titleName].S |
|
|
@ -155,7 +163,7 @@ export const tableMixins = { |
|
|
|
_data.forEach(item=>{ |
|
|
|
// 如果list接口存在数据 ,与list接口返回字段比较处理,list接口存在的话则追加
|
|
|
|
let _if = firstWordSizeChange(item.name) != 'details' |
|
|
|
if(list && list.length > 0){ |
|
|
|
if(list){ |
|
|
|
_if = firstWordSizeChange(item.name) in list && firstWordSizeChange(item.name) != 'details' |
|
|
|
} |
|
|
|
if(_if){ |
|
|
@ -163,16 +171,85 @@ export const tableMixins = { |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if(list && list.length > 0){ |
|
|
|
_Columns_Table = _Columns_Table.concat(this.specialAddColumns(list,titleName)) |
|
|
|
} |
|
|
|
return _Columns_Table |
|
|
|
}, |
|
|
|
// 添加特殊字段(api中没有的字段特殊处理)
|
|
|
|
specialAddColumns(list,titleName){ |
|
|
|
let _apiName = titleName |
|
|
|
let _special_list=[] |
|
|
|
// creationTime
|
|
|
|
if('creationTime' in list){ |
|
|
|
_special_list.push( |
|
|
|
{ |
|
|
|
"name": "CreationTime", |
|
|
|
"apiBaseType": "datetime", |
|
|
|
"baseApiName": _apiName + 'CreationTime', |
|
|
|
"label": zhApiColumnsLable(_apiName + 'CreationTime') || _apiName + 'CreationTime', |
|
|
|
"prop": "creationTime", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
// creatorId
|
|
|
|
if('creatorId' in list){ |
|
|
|
_special_list.push( |
|
|
|
{ |
|
|
|
"name": "CreatorId", |
|
|
|
"apiBaseType": "string", |
|
|
|
"baseApiName": _apiName + 'CreatorId', |
|
|
|
"label": zhApiColumnsLable(_apiName + 'CreatorId') || _apiName + 'CreatorId', |
|
|
|
"prop": "creatorId", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
// lastModificationTime
|
|
|
|
if('lastModificationTime' in list){ |
|
|
|
_special_list.push( |
|
|
|
{ |
|
|
|
"name": "LastModificationTime", |
|
|
|
"apiBaseType": "datetime", |
|
|
|
"baseApiName": _apiName + 'LastModificationTime', |
|
|
|
"label": zhApiColumnsLable(_apiName + 'LastModificationTime') || _apiName + 'LastModificationTime', |
|
|
|
"prop": "lastModificationTime", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
// lastModifierId
|
|
|
|
if('lastModifierId' in list){ |
|
|
|
_special_list.push( |
|
|
|
{ |
|
|
|
"name": "LastModifierId", |
|
|
|
"apiBaseType": "string", |
|
|
|
"baseApiName": _apiName + 'LastModifierId', |
|
|
|
"label": zhApiColumnsLable(_apiName + 'LastModifierId') || _apiName + 'LastModifierId', |
|
|
|
"prop": "lastModifierId", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
// tenantId
|
|
|
|
if('tenantId' in list){ |
|
|
|
_special_list.push( |
|
|
|
{ |
|
|
|
"name": "TenantId", |
|
|
|
"apiBaseType": "string", |
|
|
|
"baseApiName": _apiName + 'TenantId', |
|
|
|
"label": zhApiColumnsLable(_apiName + 'TenantId') || _apiName + 'TenantId', |
|
|
|
"prop": "tenantId", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
return _special_list |
|
|
|
}, |
|
|
|
//渲染数据
|
|
|
|
paging(callback) { |
|
|
|
paging(callback,repeat) { |
|
|
|
this.Loading.tableLoading = true; |
|
|
|
this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount |
|
|
|
getPageList(this.PageListParams, this.URLOption_base) |
|
|
|
.then(res=>{ |
|
|
|
// 表头处理
|
|
|
|
let _Columns = this.initApiColumnsForDto(res,this.$route.name) |
|
|
|
let _Columns = this.initApiColumnsForDto(res.items[0],this.$route.name) |
|
|
|
this.apiColumns_Table = this.initTableColumns(_Columns) |
|
|
|
this.apiColumns_DesTions = _Columns |
|
|
|
// 页面数据处理
|
|
|
@ -180,6 +257,11 @@ export const tableMixins = { |
|
|
|
this.tableData = res.items |
|
|
|
this.totalCount = res.totalCount |
|
|
|
} |
|
|
|
// 如果返回数据中有creationTime,则默认按时间段倒叙重新查一遍
|
|
|
|
// if('creationTime' in res.items[0] && !repeat){
|
|
|
|
// this.PageListParams.Sorting = "CreationTime DESC"
|
|
|
|
// this.paging(callback,true)
|
|
|
|
// }
|
|
|
|
this.pagingCallback(callback) |
|
|
|
}) |
|
|
|
.catch(err=>{ |
|
|
@ -231,7 +313,7 @@ export const tableMixins = { |
|
|
|
// 数据处理
|
|
|
|
this.propsData = res |
|
|
|
if (res.details) { |
|
|
|
// 表头处理
|
|
|
|
// 表头处理
|
|
|
|
let _parentName = this.URLOption_detailList.substr(0,this.URLOption_detailList.indexOf('/')) |
|
|
|
this.apiColumns_DetailsTable = this.initTableColumns(this.initApiColumnsForDto(res.details[0],_parentName),'detail_api') |
|
|
|
if(this.$refs.currenDrawer_Ref){ |
|
|
|