|
|
@ -1,11 +1,13 @@ |
|
|
|
import i18n from "@/lang" |
|
|
|
import { |
|
|
|
getPageList, |
|
|
|
getDetailed, |
|
|
|
postDelete, |
|
|
|
ApiTypeDelete |
|
|
|
} from '@/api/wms-api' |
|
|
|
import { zhApiColumnsLable,firstWordSizeChange } from '@/utils/index' |
|
|
|
import { |
|
|
|
initApiColumnsForDto, |
|
|
|
sliceStrEndDelete |
|
|
|
} from '@/utils/index' |
|
|
|
export const tableMixins = { |
|
|
|
data() { |
|
|
|
return { |
|
|
@ -171,95 +173,6 @@ export const tableMixins = { |
|
|
|
// 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 |
|
|
|
let _Columns_Table = [] |
|
|
|
if(_coloums){ |
|
|
|
let _data = _coloums.dtoList |
|
|
|
_data.forEach(item=>{ |
|
|
|
// 如果list接口存在数据 ,与list接口返回字段比较处理,list接口存在的话则追加
|
|
|
|
let _if = firstWordSizeChange(item.name) != 'details' |
|
|
|
if(list){ |
|
|
|
_if = firstWordSizeChange(item.name) in list && firstWordSizeChange(item.name) != 'details' |
|
|
|
} |
|
|
|
if(_if){ |
|
|
|
_Columns_Table.push(item) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if(list){ |
|
|
|
_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') || i18n.t('columNames.CreationTime'), |
|
|
|
"prop": "creationTime", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
// creatorId
|
|
|
|
if('creatorId' in list){ |
|
|
|
_special_list.push( |
|
|
|
{ |
|
|
|
"name": "CreatorId", |
|
|
|
"apiBaseType": "string", |
|
|
|
"baseApiName": _apiName + 'CreatorId', |
|
|
|
"label": zhApiColumnsLable(_apiName + 'CreatorId') || i18n.t('columNames.CreatorId'), |
|
|
|
"prop": "creatorId", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
// lastModificationTime
|
|
|
|
if('lastModificationTime' in list){ |
|
|
|
_special_list.push( |
|
|
|
{ |
|
|
|
"name": "LastModificationTime", |
|
|
|
"apiBaseType": "datetime", |
|
|
|
"baseApiName": _apiName + 'LastModificationTime', |
|
|
|
"label": zhApiColumnsLable(_apiName + 'LastModificationTime') || i18n.t('columNames.LastModificationTime'), |
|
|
|
"prop": "lastModificationTime", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
// lastModifierId
|
|
|
|
if('lastModifierId' in list){ |
|
|
|
_special_list.push( |
|
|
|
{ |
|
|
|
"name": "LastModifierId", |
|
|
|
"apiBaseType": "string", |
|
|
|
"baseApiName": _apiName + 'LastModifierId', |
|
|
|
"label": zhApiColumnsLable(_apiName + 'LastModifierId') || i18n.t('columNames.LastModifierId'), |
|
|
|
"prop": "lastModifierId", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
// tenantId
|
|
|
|
if('tenantId' in list){ |
|
|
|
_special_list.push( |
|
|
|
{ |
|
|
|
"name": "TenantId", |
|
|
|
"apiBaseType": "string", |
|
|
|
"baseApiName": _apiName + 'TenantId', |
|
|
|
"label": zhApiColumnsLable(_apiName + 'TenantId') || i18n.t('columNames.TenantId'), |
|
|
|
"prop": "tenantId", |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
|
return _special_list |
|
|
|
}, |
|
|
|
//渲染数据
|
|
|
|
paging(callback,repeat) { |
|
|
|
this.Loading.tableLoading = true; |
|
|
@ -268,7 +181,7 @@ export const tableMixins = { |
|
|
|
.then(res=>{ |
|
|
|
// 表头处理
|
|
|
|
let _list = res.items && res.items.length > 0 ? res.items[0] : null |
|
|
|
let _Columns = this.initApiColumnsForDto(_list,this.$route.name) |
|
|
|
let _Columns = initApiColumnsForDto(_list,this.$route.name,this) |
|
|
|
this.apiColumns_Table = this.initTableColumns(_Columns) |
|
|
|
this.apiColumns_DesTions = _Columns |
|
|
|
// 页面数据处理
|
|
|
@ -325,8 +238,36 @@ export const tableMixins = { |
|
|
|
this.Loading.DrawerLoading = true |
|
|
|
this.displayDialog.detailsDialog = true; |
|
|
|
let _url = this.URLOption_detail ? this.URLOption_detail : this.URLOption_base |
|
|
|
// 有主表信息子表(表头处理)
|
|
|
|
if(!this.URLOption.isMaster && this.URLOption.hasDetail){ |
|
|
|
let _showMasterUrl = this.URLOption.mainShowMasterUrl |
|
|
|
if(!this.URLOption.mainShowMasterUrl){ |
|
|
|
_showMasterUrl = sliceStrEndDelete(this.URLOption_detail,'-Detail') |
|
|
|
} |
|
|
|
Promise.all([ |
|
|
|
getDetailed(val.id, _url), |
|
|
|
getDetailed(val[this.URLOption.mainShowMasterId || 'masterId'], _showMasterUrl) |
|
|
|
]).then((res) => { |
|
|
|
let _allRes = JSON.parse(JSON.stringify(res[0])) |
|
|
|
_allRes.masterInfo = res[1] |
|
|
|
this.initInlineHttpBack(_allRes) |
|
|
|
}).catch(()=>{ |
|
|
|
this.Loading.DrawerLoading = false |
|
|
|
}) |
|
|
|
} |
|
|
|
// 没有主表信息
|
|
|
|
else{ |
|
|
|
getDetailed(val.id, _url) |
|
|
|
.then(res=>{ |
|
|
|
this.initInlineHttpBack(res) |
|
|
|
}) |
|
|
|
.catch(err=>{ |
|
|
|
this.Loading.DrawerLoading = false |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 查看详情获取返回值后处理
|
|
|
|
initInlineHttpBack(res){ |
|
|
|
// 打印使用的全部数据存储
|
|
|
|
this.tableDataDetails = JSON.parse(JSON.stringify(res)) |
|
|
|
// 数据处理
|
|
|
@ -334,7 +275,7 @@ export const tableMixins = { |
|
|
|
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') |
|
|
|
this.apiColumns_DetailsTable = this.initTableColumns(initApiColumnsForDto(res.details[0],_parentName,this),'detail_api') |
|
|
|
if(this.$refs.currenDrawer_Ref){ |
|
|
|
this.$refs.currenDrawer_Ref.getDetailList(res,()=>{ |
|
|
|
this.inlineDialogCallback() |
|
|
@ -345,10 +286,6 @@ export const tableMixins = { |
|
|
|
}else{ |
|
|
|
this.Loading.DrawerLoading = false |
|
|
|
} |
|
|
|
}) |
|
|
|
.catch(err=>{ |
|
|
|
this.Loading.DrawerLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 前端分页处理
|
|
|
|
// detailListPageFromFE(data){
|
|
|
|