Browse Source

【东阳主子表】主列表查看详情,是否带有主表信息、主表信列转义及数据回显封装暂存

faster_develop
安虹睿 2 years ago
parent
commit
5c61eb4133
  1. 7
      WinIn.FasterZ.Wms.Fe/README.md
  2. 52
      WinIn.FasterZ.Wms.Fe/src/components/commonTabel-drawer/index.vue
  3. 3
      WinIn.FasterZ.Wms.Fe/src/components/filterForDetailPage/index.vue
  4. 8
      WinIn.FasterZ.Wms.Fe/src/components/umyTable/index.vue
  5. 165
      WinIn.FasterZ.Wms.Fe/src/mixins/TableMixins.js
  6. 2
      WinIn.FasterZ.Wms.Fe/src/mixins/mixins.js
  7. 100
      WinIn.FasterZ.Wms.Fe/src/utils/index.js

7
WinIn.FasterZ.Wms.Fe/README.md

@ -137,10 +137,11 @@ export const TestSchool = {
// addURL:null,//新增特殊URL
// editURL:null,//编辑特殊URL
// exportURL:'exportURL',//导出特殊URL
//有主表的子表单页的主表信息接口,如果不填默认为当前的detailURL去掉‘-Detail’
<!-- 20231124 有主表的子列表 查看详情的主表信息处理 -->
//有主表的子表单页的主表信息接口,默认为当前的[detailURL]去掉[-Detail]
// mainShowMasterUrl:null,
//有主表的子表单页的主表链接参数,如果没有默认为‘masterId’
//有主表的子表单页的主表链接参数,默认为[masterId]
// mainShowMasterId:'masterId',
//有主表的子表单页的主表显示列转义路由,如果没有默认为当前路由去掉‘Detail’
//有主表的子表单页的主表路由[用于显示列转义],默认为[当前路由]去掉[Detail]
// masterRoute:null,
}

52
WinIn.FasterZ.Wms.Fe/src/components/commonTabel-drawer/index.vue

@ -49,6 +49,7 @@
@handleClick="handleClick"
>
<template slot-scope="scope">
<!-- 详情 -->
<curren-descriptions
border
v-if="scope.value == 'xq'"
@ -59,6 +60,17 @@
:propsData="propsData"
>
</curren-descriptions>
<!-- 主表信息 -->
<curren-descriptions
border
v-if="scope.value == 'masterInfo'"
:column="column"
:direction="direction"
:colon="false"
:tabsDesTions="masterColums"
:propsData="propsData.masterInfo"
>
</curren-descriptions>
<!-- 明细 包含分页 头部按钮等 -->
<tablePagination
ref="tablePaginationForMX_Ref"
@ -104,11 +116,12 @@
</template>
</umyTable>
<!-- 自定义扩展 -->
<umyTable
<!-- <umyTable
v-if="
scope.value == zdyValue &&
scope.value != 'xq' &&
scope.value != 'mx' &&
scope.value != 'masterInfo' &&
scope.value != 'hz' &&
scope.value != 'zwlcj'
"
@ -127,7 +140,7 @@
<template>
<slot></slot>
</template>
</umyTable>
</umyTable> -->
</template>
</curren-tabs>
</div>
@ -171,6 +184,10 @@ import pagination from "@/components/Pagination"
import rowDrop from "@/components/rowDrop/index.vue"
import * as allUrlOption from '@/utils/baseData/urlOption'
import { LoadingMixins } from "@/mixins/LoadingMixins";
import {
initApiColumnsForDto,
sliceStrEndDelete
} from '@/utils/index'
export default {
name: 'currenTabel-drawer',
components: {
@ -309,7 +326,8 @@ export default {
// tabs
if (this.dropdownTabsData.length !== 0) {
return this.dropdownTabsData
} else {
}
else {
//
// if (Object.keys(this.propsData).length != 0) {
if (Object.keys(this.propsData)) {
@ -317,6 +335,14 @@ export default {
label: "详情",
name: 'xq'
}]
if(this.propsData.masterInfo && this.propsData.masterInfo){
this.initDropdownTabsData.push({
label: "主表信息",
name: 'masterInfo'
})
let _master_name = this.URLOption.masterRoute || sliceStrEndDelete(this.$route.name,'Detail')
this.masterColums = initApiColumnsForDto(this.propsData.masterInfo,_master_name,this)
}
// 使
if(this.propsData.details){
this.initDropdownTabsData.push({
@ -343,9 +369,9 @@ export default {
detailHeaderButton:null,//-
detailInfoTableData:null,//-
detailInfoTitle:null,//-title
otherData:[], // tabs
zdyTableColumns:[], //
zdyValue:'', //
// otherData:[], // tabs
// zdyTableColumns:[], //
// zdyValue:'', //
// firstTabs:'xq',
initDropdownTabsData:[
{
@ -375,10 +401,14 @@ export default {
MaxResultCount: 20,
},
totalCountForDetail:0,
//-id
URLOption:allUrlOption[this.$route.name],
//-id
URLOption_masterId:allUrlOption[this.$route.name].masterId || 'masterId',
//-
URLOption_detailList:allUrlOption[this.$route.name].detailListURL,
//
masterColums:null
}
},
methods: {
@ -574,7 +604,7 @@ export default {
// tabs
handleClick (val) {
this.$emit("currenTabsChange", val);//tab
this.zdyValue = val.name
// this.zdyValue = val.name
this.dropdownTabsData.forEach( item => {
if (item.name == val.name) {
let parent = this.$parent
@ -582,12 +612,12 @@ export default {
//
parent.firstTabs = val.name
if (val.name == 'xq' || val.name == 'mx' || val.name == 'hz') {
this.zdyTableColumns = []
this.otherData = []
// this.zdyTableColumns = []
// this.otherData = []
parent.tableLoading = false
} else {
this.zdyTableColumns = []
this.otherData = []
// this.zdyTableColumns = []
// this.otherData = []
// this.firstTabs = val.name
// tab
// if (item.functionName == 'getListByItemcode') {

3
WinIn.FasterZ.Wms.Fe/src/components/filterForDetailPage/index.vue

@ -129,6 +129,7 @@ import { LoadingMixins } from "@/mixins/LoadingMixins";
import { mixins } from "@/mixins/mixins";
import { filterSelectMixins } from '@/mixins/filter-Select'
import {getListDesById,getPageListForDetail} from "@/api/wms-api"
import { initApiColumnsForDto } from '@/utils/index'
export default {
name: 'filterForDetailPage',
mixins: [
@ -263,7 +264,7 @@ export default {
.then(res=>{
//
let _parentName = this.URLOption_detailList.substr(0,this.URLOption_detailList.indexOf('/'))
let _Columns = this.initApiColumnsForDto(res.items[0],_parentName)
let _Columns = initApiColumnsForDto(res.items[0],_parentName,this)
this.listColumns = this.initTableColumns(_Columns,'detailPage_api')
//
if(res){

8
WinIn.FasterZ.Wms.Fe/src/components/umyTable/index.vue

@ -130,7 +130,7 @@
<u-table-column
v-if="buttonOperationList_left"
:fixed="'left'"
width="auto"
:width="operationLeftColumnWidth()"
min-width="120px"
:align="'center'"
:header-align="'center'"
@ -144,6 +144,7 @@
:key="indexButton"
type="text"
size="mini"
:style="{color:itemButton.color || '#409EFF'}"
@click="buttonOperationClick_left(scope.row, itemButton, indexButton)"
>{{itemButton.label}}</el-button>
</template>
@ -398,6 +399,11 @@ export default {
this.setTableHeightHandle()
},
methods: {
//
operationLeftColumnWidth(){
if(this.buttonOperationList_left.length == 1){return 120}
else{return this.buttonOperationList_left.length * 100}
},
//
doFreshLayout(){
if (this.$refs.multipleTable && this.$refs.multipleTable.doLayout) {

165
WinIn.FasterZ.Wms.Fe/src/mixins/TableMixins.js

@ -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,30 +238,54 @@ export const tableMixins = {
this.Loading.DrawerLoading = true
this.displayDialog.detailsDialog = true;
let _url = this.URLOption_detail ? this.URLOption_detail : this.URLOption_base
getDetailed(val.id, _url)
.then(res=>{
// 打印使用的全部数据存储
this.tableDataDetails = JSON.parse(JSON.stringify(res))
// 数据处理
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){
this.$refs.currenDrawer_Ref.getDetailList(res,()=>{
this.inlineDialogCallback()
},()=>{
this.Loading.DrawerLoading = false
})
}
}else{
this.Loading.DrawerLoading = false
}
})
.catch(err=>{
// 有主表信息子表(表头处理)
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))
// 数据处理
this.propsData = res
if (res.details) {
// 表头处理
let _parentName = this.URLOption_detailList.substr(0,this.URLOption_detailList.indexOf('/'))
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()
},()=>{
this.Loading.DrawerLoading = false
})
}
}else{
this.Loading.DrawerLoading = false
}
},
// 前端分页处理
// detailListPageFromFE(data){

2
WinIn.FasterZ.Wms.Fe/src/mixins/mixins.js

@ -8,6 +8,8 @@ import { getLoginName } from "@/utils/auth"
export const mixins = {
data() {
return {
// 当前路由配置
URLOption:allUrlOption[this.$route.name],
//主表-列表
URLOption_base:allUrlOption[this.$route.name].baseURL,
//主表-明细

100
WinIn.FasterZ.Wms.Fe/src/utils/index.js

@ -3,6 +3,7 @@
*/
import {fileStorage, getPageList } from '@/api/wms-api'
import store from '@/store'
import i18n from "@/lang"
/**
* @param {string} url
@ -428,4 +429,101 @@
return str.substring(0,1).toUpperCase() + str.substring(1,str.length);
}
}
}
// get-dto-column-type接口表头类型初始化
export function initApiColumnsForDto (list,titleName,that) {
let data = that.$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(specialAddColumns(list,titleName))
}
return _Columns_Table
}
// 特殊字段转义处理(api中没有的字段特殊处理)
export function 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
}
// 从字段中删除最后某字段
export function sliceStrEndDelete(str,deleteStr){
let _d_l = str.length - deleteStr.length
return str.slice(0,_d_l)
}
Loading…
Cancel
Save