Browse Source

整理api-definition,使用本地化整理,替换掉get-dto-column-type接口

master
安虹睿 1 year ago
parent
commit
804439bd2b
  1. 31
      Code/Fe/public/config.js
  2. 1
      Code/Fe/src/App.vue
  3. 26
      Code/Fe/src/api/wms-interface.js
  4. 90
      Code/Fe/src/components/filterForDetailPage/index.vue
  5. 5
      Code/Fe/src/components/tablePagination/index.vue
  6. 25
      Code/Fe/src/components/umyTable/index.vue
  7. 83
      Code/Fe/src/mixins/TableMixins.js
  8. 2
      Code/Fe/src/permission-0725.js
  9. 2
      Code/Fe/src/permission.js
  10. 1
      Code/Fe/src/store/getters.js
  11. 95
      Code/Fe/src/store/modules/definition.js
  12. 6
      Code/Fe/src/utils/detailsPageColumns_api/index.js
  13. 6
      Code/Fe/src/utils/detailsTableColumns_api/index.js
  14. 2
      Code/Fe/src/utils/index.js
  15. 6
      Code/Fe/src/utils/tableColumns_api/index.js
  16. 6
      Code/Fe/src/utils/tabsDesTions_api/index.js
  17. 14
      Code/Fe/src/views/basicConfig/ExportCustomUserSetting.vue

31
Code/Fe/public/config.js

@ -1,37 +1,8 @@
// dev_win // dev_win
window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:60069' window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:60069'
window.SITE_CONFIG['columnsApiNames'] = '/api/abp/application-localization'
// window.SITE_CONFIG['columnsApiNames'] = '/api/abp/application-configuration'
window.SITE_CONFIG['columnsApiNamesZh'] = 'Winin' window.SITE_CONFIG['columnsApiNamesZh'] = 'Winin'
window.SITE_CONFIG['isAutoLogin'] = true window.SITE_CONFIG['isAutoLogin'] = true
window.SITE_CONFIG['isSinglePage'] = false window.SITE_CONFIG['isSinglePage'] = false
window.SITE_CONFIG['userNameOrEmailAddress'] = 'admin' window.SITE_CONFIG['userNameOrEmailAddress'] = 'admin'
window.SITE_CONFIG['client_secret'] = '1q2w3E*' window.SITE_CONFIG['client_secret'] = '1q2w3E*'
window.SITE_CONFIG['menuHiddenConfig'] = ['AsnDet','PoDet','ReceiptDet','ReturnDet','SodDet'] window.SITE_CONFIG['menuHiddenConfig'] = ['AsnDet','PoDet','ReceiptDet','ReturnDet','SodDet']
// window.SITE_CONFIG['user'] = 'http://dev.ccwin-in.com:60069/api'
// // window.SITE_CONFIG['print'] = 'print'21384
// window.SITE_CONFIG['print'] = 'http://dev.ccwin-in.com:60074'
// window.SITE_CONFIG['largeScreen'] = 'http://dev.ccwin-in.com:60073'
// window.SITE_CONFIG['warehouseCode'] = 'T8'
// window.SITE_CONFIG['company'] = 'DongYang'
// window.SITE_CONFIG['client_secret'] = '1q2w3E*'
// window.SITE_CONFIG['reportsUrl'] = 'http://dev.ccwin-in.com:60074/#/reports/'
// window.SITE_CONFIG['versionUrl'] = 'http://dev.ccwin-in.com:60070'
// window.SITE_CONFIG['companyName'] = '长春一汽富维东阳汽车塑料零部件(安徽)有限公司'
// 接口看板地址
// window.SITE_CONFIG['interfaceBoardUrl'] = 'http://dev.ccwin-in.com:60090/'
// window.SITE_CONFIG['interfaceBoardUrl'] = 'http://dev.ccwin-in.com:60069/'
// 接口看板表头获取地址
// window.SITE_CONFIG['interfaceBoardColumnsApi'] = 'api/abp/application-configuration'
// mock
// window.SITE_CONFIG['apifoxToken'] = 'NXHNi5mp0dnUHGt0wkCrjvfcidsFKV33'
// window.SITE_CONFIG['base'] = 'https://mock.apifox.cn/m1/1773588-0-default'
// window.SITE_CONFIG['user'] = 'http://dev.ccwin-in.com:60099/api/auth'
// window.SITE_CONFIG['print'] = 'print'
// window.SITE_CONFIG['largeScreen'] = 'http://dev.ccwin-in.com:60073'
// window.SITE_CONFIG['warehouseCode'] = 'T8'
// window.SITE_CONFIG['company'] = 'DongYang'
// window.SITE_CONFIG['client_secret'] = '1q2w3E*'
// window.SITE_CONFIG['reportsUrl'] = 'http://10.164.0.227:59091/#/reports/'

1
Code/Fe/src/App.vue

@ -9,7 +9,6 @@ export default {
name: 'App' name: 'App'
} }
localStorage.setItem('base',window.SITE_CONFIG['base']) localStorage.setItem('base',window.SITE_CONFIG['base'])
localStorage.setItem('columnsApiNames',window.SITE_CONFIG['columnsApiNames'])
localStorage.setItem('columnsApiNamesZh',window.SITE_CONFIG['columnsApiNamesZh']) localStorage.setItem('columnsApiNamesZh',window.SITE_CONFIG['columnsApiNamesZh'])
localStorage.setItem('isAutoLogin',window.SITE_CONFIG['isAutoLogin']) localStorage.setItem('isAutoLogin',window.SITE_CONFIG['isAutoLogin'])
localStorage.setItem('isSinglePage',window.SITE_CONFIG['isSinglePage']) localStorage.setItem('isSinglePage',window.SITE_CONFIG['isSinglePage'])

26
Code/Fe/src/api/wms-interface.js

@ -1,13 +1,12 @@
// 接口监控看板相关api // 接口监控看板相关api
import request from '@/utils/request' import request from '@/utils/request'
let base_api = localStorage.getItem('base') let base_api = localStorage.getItem('base')
let colum_url = localStorage.getItem('columnsApiNames')
// 获取表头数据 // 获取表头zh转义数据
export function getInterfaceBoard() { export function getInterfaceBoard() {
return request({ return request({
method:'get', method:'get',
url: base_api + colum_url, url: base_api + '/api/abp/application-localization',
params:{ params:{
CultureName:localStorage.getItem('browserLanguage'), CultureName:localStorage.getItem('browserLanguage'),
OnlyDynamics:false OnlyDynamics:false
@ -25,8 +24,8 @@ export function getDefinitionMenu(IncludeTypes) {
}) })
} }
// 获取枚举数据 // 获取枚举数据/dto列类型等所有配置
export async function getApiEnumList() { export async function getApiDefinition() {
return request({ return request({
method:'get', method:'get',
url: base_api + '/api/abp/api-definition', url: base_api + '/api/abp/api-definition',
@ -34,23 +33,6 @@ export async function getApiEnumList() {
}) })
} }
// 获取dto列数据
export async function getDtoColumnType(api) {
if(!api)return
return request({
method:'post',
url: base_api + '/api/'+ api +'/get-dto-column-type',
})
}
// 获取dto列数据
export async function getDtoColumnType(api) {
return request({
method:'post',
url: base_api + '/api/'+ api +'/base/get-dto-column-type',
})
}
// // 测试数据-明细-删除 // // 测试数据-明细-删除
// export function TestSchoolDetailList_delete(id) { // export function TestSchoolDetailList_delete(id) {
// return request({ // return request({

90
Code/Fe/src/components/filterForDetailPage/index.vue

@ -16,12 +16,13 @@
> >
<!-- 列表 --> <!-- 列表 -->
<tablePagination <tablePagination
v-if="dialogShow" v-if="dialogShow && listColumns && listColumns.length > 0"
:currenButtonData="currenButtonData" :currenButtonData="currenButtonData"
:tableData="tableData" :tableData="tableData"
:tableLoading="Loading.tableLoading" :tableLoading="Loading.tableLoading"
@rowDrop="rowDropForDetail" @rowDrop="rowDropForDetail"
:rowSource="'detailPage_api'" :rowSource="'detailPage_api'"
:rowMaxHeight="rowMaxHeight"
:tableColumns="listColumns" :tableColumns="listColumns"
:totalCount="totalCount" :totalCount="totalCount"
:multipleSelection="multipleSelection" :multipleSelection="multipleSelection"
@ -127,7 +128,6 @@ import { filterSelectMixins } from '@/mixins/filter-Select'
// import { TestSchoolDetailList,TestSchoolDetailList_delete } from "@/api/wms-interface" // import { TestSchoolDetailList,TestSchoolDetailList_delete } from "@/api/wms-interface"
import * as interfaceApi from "@/api/wms-interface" import * as interfaceApi from "@/api/wms-interface"
import {getListDesById,getPageListForDetail} from "@/api/wms-api" import {getListDesById,getPageListForDetail} from "@/api/wms-api"
import { getDtoColumnType } from "@/api/wms-interface"
import * as allUrlOption from '@/utils/baseData/urlOption' import * as allUrlOption from '@/utils/baseData/urlOption'
export default { export default {
name: 'filterForDetailPage', name: 'filterForDetailPage',
@ -202,6 +202,10 @@ props: {
type: String, type: String,
default: 'horizontal' default: 'horizontal'
}, },
rowMaxHeight:{
type:String,
default:'calc(90vh - 450px)'
},
}, },
data () { data () {
return { return {
@ -251,55 +255,31 @@ methods: {
}, },
// //
paging(callback){ paging(callback){
this.Loading.tableLoading = true this.Loading.tableLoading = true;
this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount
Promise.all([ getPageListForDetail(this.PageListParams,this.URLOption_detailList)
getDtoColumnType(this.URLOption_detailList), .then(res=>{
getPageListForDetail(this.PageListParams,this.URLOption_detailList) //
]).then((allData) => {
//
if(allData[0]){
let _parentName = this.URLOption_detailList.substr(0,this.URLOption_detailList.indexOf('/')) let _parentName = this.URLOption_detailList.substr(0,this.URLOption_detailList.indexOf('/'))
let _Columns = this.initApiColumnsForDto(allData[0],allData[1].items[0],_parentName) let _Columns = this.initApiColumnsForDto(res.items[0],_parentName)
this.listColumns = this.initTableColumns(_Columns) this.listColumns = this.initTableColumns(_Columns)
} //
// if(res){
if(allData[1]){ this.Loading.tableLoading = false
this.Loading.tableLoading = false this.tableData = []
this.tableData = [] res.items.forEach(item=>{
allData[1].items.forEach(item=>{ item.deleteTipVisible = false
item.deleteTipVisible = false this.tableData.push(item)
this.tableData.push(item) })
}) this.totalCount = res.totalCount
}
this.pagingCallback(callback) this.pagingCallback(callback)
this.totalCount = allData[1].totalCount })
} .catch(err=>{
this.pagingCallback(callback) this.Loading.tableLoading = false
}).catch(()=>{ this.$message.error("数据获取失败")
this.Loading.tableLoading = false })
this.$message.error("数据获取失败")
})
}, },
// paging(callback){
// this.Loading.tableLoading = true
// this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount
// getPageListForDetail(this.PageListParams,this.URLOption_detailList)
// // interfaceApi[this.URLOption_detailList](this.PageListParams)
// .then(result => {
// this.Loading.tableLoading = false
// this.tableData = []
// result.items.forEach(item=>{
// item.deleteTipVisible = false
// this.tableData.push(item)
// })
// this.totalCount = result.totalCount
// this.pagingCallback(callback)
// })
// .catch(err => {
// this.Loading.tableLoading = false
// this.$message.error("")
// })
// },
// //
showParentHandleForDetail(data){ showParentHandleForDetail(data){
this.showParentTitle = `${data[this.URLOption_masterName] || ''} 主表信息` this.showParentTitle = `${data[this.URLOption_masterName] || ''} 主表信息`
@ -338,15 +318,15 @@ methods: {
</script> </script>
<style lang="scss"> <style lang="scss">
.filterForDetailPage { .filterForDetailPage {
.el-dialog__body{ .el-dialog{
padding-bottom: 20px !important; height: calc(100% - 100px);
} }
.fullPageCover{ .el-dialog__body{
height: calc(100% - 380px) !important; padding-bottom: 20px !important;
} }
} }
.filterForDetailPage-list{ .filterForDetailPage-list{
height: calc(100% - 320px); height: calc(100%);
overflow: auto; overflow: auto;
} }
</style> </style>

5
Code/Fe/src/components/tablePagination/index.vue

@ -36,6 +36,7 @@
:visible="rowDropVisible" :visible="rowDropVisible"
@closeRowDrop="closeRowDrop" @closeRowDrop="closeRowDrop"
:source="rowSource" :source="rowSource"
:innerMaxHeight="rowMaxHeight"
></rowDrop> ></rowDrop>
<!-- 列表 --> <!-- 列表 -->
<div class="uTableOuter" ref="uTableOuterRef" :style="{height:uTableOuterHeight + 'px',overflow:'hidden'}"> <div class="uTableOuter" ref="uTableOuterRef" :style="{height:uTableOuterHeight + 'px',overflow:'hidden'}">
@ -90,6 +91,10 @@ export default {
rowDrop rowDrop
}, },
props: { props: {
rowMaxHeight:{
type:String,
default:'calc(90vh - 280px)'
},
// //
searchOverallCoverHeight:{ searchOverallCoverHeight:{
type: String, type: String,

25
Code/Fe/src/components/umyTable/index.vue

@ -86,7 +86,7 @@
</template> </template>
<template slot-scope="scope"> <template slot-scope="scope">
<!-- 时间转换 --> <!-- 时间转换 -->
<span v-if="item.apiBaseType == 'System.DateTime'" <span v-if="item.apiBaseType == 'datetime'"
@click="showDetailInfo(scope.row[item.prop],'time')" @click="showDetailInfo(scope.row[item.prop],'time')"
style="cursor: pointer;" style="cursor: pointer;"
:title="'点击查看详情'" :title="'点击查看详情'"
@ -95,15 +95,15 @@
{{ scope.row[item.prop] | formatDate }} {{ scope.row[item.prop] | formatDate }}
</span> </span>
<!-- 枚举 --> <!-- 枚举 -->
<span v-else-if="item.apiIsEnum"> <span v-else-if="item.isEnums">
{{ initApiEnumList(item,scope.row[item.prop]) }} {{ initApiEnumList(item,scope.row[item.prop]) }}
</span> </span>
<!-- 布尔 --> <!-- 布尔 -->
<span v-else-if="item.apiBaseType == 'System.Boolean'"> <span v-else-if="item.apiBaseType == 'boolean'">
{{ scope.row[item.prop] ? '是' : '否' }} {{ scope.row[item.prop] ? '是' : '否' }}
</span> </span>
<!-- 数值 --> <!-- 数值 -->
<span v-else-if="initTypeList.indexOf(item.apiBaseType.toLowerCase()) >= 0"> <span v-else-if="item.apiBaseType == 'number'">
{{ scope.row[item.prop] }} {{ scope.row[item.prop] }}
</span> </span>
<!-- 点击可出详情 | 点击可点出json 目前已知String|Guid--> <!-- 点击可出详情 | 点击可点出json 目前已知String|Guid-->
@ -329,7 +329,6 @@ export default {
showJsonData:null,//Json showJsonData:null,//Json
showJsonData_str:null,//Json showJsonData_str:null,//Json
showJsonCopy:false,//jsonDialog showJsonCopy:false,//jsonDialog
initTypeList:['system.decimal','system.int64','system.int32','system.long']
}; };
}, },
computed: { computed: {
@ -604,7 +603,6 @@ export default {
// jsontable // jsontable
showJsonTable(row){ showJsonTable(row){
this.showJsonDialog = true this.showJsonDialog = true
console.log(606,_json)
let _json = eval('(' + row + ')') let _json = eval('(' + row + ')')
let _arr = [] let _arr = []
let __initJson = (data) => { let __initJson = (data) => {
@ -640,24 +638,24 @@ export default {
} }
} }
} }
console.log(666,this.showJsonData)
this.showJsonData = _arr this.showJsonData = _arr
this.showJsonData_str = JSON.stringify(JSON.parse(JSON.stringify(this.showJsonData)), null, '\t') this.showJsonData_str = JSON.stringify(JSON.parse(JSON.stringify(this.showJsonData)), null, '\t')
this.$emit("showJsonTable", row); this.$emit("showJsonTable", row);
}, },
// Json // Json
copyJsonHandle(){ copyJsonHandle(){
console.log(651,window.isSecureContext)
this.showJsonCopy = true this.showJsonCopy = true
if (navigator.clipboard && window.isSecureContext) { if (navigator.clipboard && window.isSecureContext) {
navigator.clipboard.writeText(this.showJsonData_str) navigator.clipboard.writeText(this.showJsonData_str)
.then(() => { .then(() => {
this.$message.success('复制成功'); this.$message.success('复制成功');
this.$refs.copyJsonTextarea_ref.focus()
document.getElementById('copyJsonTextarea_dialog_ref').scrollTop = 0
}) })
.catch(err => { .catch(err => {
this.$message.error('复制失败'); this.$message.error('复制失败');
this.$refs.copyJsonTextarea_ref.focus()
document.getElementById('copyJsonTextarea_dialog_ref').scrollTop = 0
}); });
}else { }else {
// text area // text area
@ -681,6 +679,8 @@ export default {
}) })
},() => { },() => {
this.$message.error('复制失败'); this.$message.error('复制失败');
this.$refs.copyJsonTextarea_ref.focus()
document.getElementById('copyJsonTextarea_dialog_ref').scrollTop = 0
}) })
} }
@ -699,10 +699,9 @@ export default {
}, },
// //
initApiEnumList(item,data){ initApiEnumList(item,data){
let _enumListOp = this.$store.getters.enumList[item.apiBaseType]
let _item_enumList = {} let _item_enumList = {}
_enumListOp.enumValues.forEach((item,key)=>{ item.enums_list.forEach((item,key)=>{
_item_enumList[item] = _enumListOp.enumNames[key] _item_enumList[item.value] = item.label
}) })
return _item_enumList[data] || '未定义' return _item_enumList[data] || '未定义'
}, },

83
Code/Fe/src/mixins/TableMixins.js

@ -3,9 +3,8 @@ import {
getDetailed, getDetailed,
postDelete postDelete
} from '@/api/wms-api' } from '@/api/wms-api'
import { initFromApiColumnsLable,firstWordSizeChange } from '@/utils/index' import { zhApiColumnsLable,firstWordSizeChange } from '@/utils/index'
import * as allUrlOption from '@/utils/baseData/urlOption' import * as allUrlOption from '@/utils/baseData/urlOption'
import { getDtoColumnType } from '@/api/wms-interface'
export const tableMixins = { export const tableMixins = {
data() { data() {
return { return {
@ -113,25 +112,20 @@ export const tableMixins = {
// if(detailsPage && detailsPage[this.$route.name])this.apiColumns_DetailsPage = this.initTableColumns(detailsPage[this.$route.name],'detailPage_api') // if(detailsPage && detailsPage[this.$route.name])this.apiColumns_DetailsPage = this.initTableColumns(detailsPage[this.$route.name],'detailPage_api')
// }, // },
// get-dto-column-type接口表头类型初始化 // get-dto-column-type接口表头类型初始化
initApiColumnsForDto(data,list,titleName){ initApiColumnsForDto(list,titleName){
let _coloums = data.filter(item=>{ let data = this.$store.getters.dtoColumnTypes
return item.dtoType == 'S' let _coloums = data[titleName].S
})
let _Columns_Table = [] let _Columns_Table = []
if(_coloums && _coloums.length > 0){ if(_coloums){
let _data = _coloums[0].columnsTypes let _data = _coloums.dtoList
_data.forEach(item=>{ _data.forEach(item=>{
let _item = { let _item = item
label:initFromApiColumnsLable(titleName + item.z_ColumnName) || item.z_ColumnName, _item.label = zhApiColumnsLable(titleName + item.name) || item.name
prop:firstWordSizeChange(item.z_ColumnName), _item.prop = firstWordSizeChange(item.name)
apiType:item.z_ColumnType,
apiBaseType:item.z_ColumnBaseType,
apiIsEnum:item.isEnum
}
// 如果list接口存在数据 ,与list接口返回字段比较处理,list接口存在的话则追加 // 如果list接口存在数据 ,与list接口返回字段比较处理,list接口存在的话则追加
let _if = firstWordSizeChange(item.z_ColumnName) != 'details' let _if = firstWordSizeChange(item.name) != 'details'
if(list && list.length > 0){ if(list && list.length > 0){
_if = firstWordSizeChange(item.z_ColumnName) in list && firstWordSizeChange(item.z_ColumnName) != 'details' _if = firstWordSizeChange(item.name) in list && firstWordSizeChange(item.name) != 'details'
} }
if(_if){ if(_if){
_Columns_Table.push(_item) _Columns_Table.push(_item)
@ -144,25 +138,22 @@ export const tableMixins = {
paging(callback) { paging(callback) {
this.Loading.tableLoading = true; this.Loading.tableLoading = true;
this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount
Promise.all([ getPageList(this.PageListParams, this.URLOption_base)
getDtoColumnType(this.URLOption_base), .then(res=>{
getPageList(this.PageListParams, this.URLOption_base) // 表头处理
]).then((allData) => { let _Columns = this.initApiColumnsForDto(res,this.$route.name)
// 表头处理
if(allData[0]){
let _Columns = this.initApiColumnsForDto(allData[0],allData[1].items[0] ,this.$route.name)
this.apiColumns_Table = this.initTableColumns(_Columns) this.apiColumns_Table = this.initTableColumns(_Columns)
this.apiColumns_DesTions = _Columns this.apiColumns_DesTions = _Columns
} // 页面数据处理
// 页面数据处理 if(res){
if(allData[1]){ this.tableData = res.items
this.tableData = allData[1].items this.totalCount = res.totalCount
this.totalCount = allData[1].totalCount }
} this.pagingCallback(callback)
this.pagingCallback(callback) })
}).catch((err)=>{ .catch(err=>{
this.Loading.tableLoading = false this.Loading.tableLoading = false
}) })
}, },
//接受排序信息并改变视图 //接受排序信息并改变视图
sortChange(val) { sortChange(val) {
@ -202,19 +193,11 @@ export const tableMixins = {
this.Loading.DrawerLoading = true this.Loading.DrawerLoading = true
this.displayDialog.detailsDialog = true; this.displayDialog.detailsDialog = true;
let _url = this.URLOption_detail ? this.URLOption_detail : this.URLOption_base let _url = this.URLOption_detail ? this.URLOption_detail : this.URLOption_base
Promise.all([ getDetailed(val.id, _url)
getDtoColumnType(this.URLOption_detailList), .then(res=>{
getDetailed(val.id, _url) // 表头处理
]).then((allData) => {
// 表头处理
if(allData[0]){
let _parentName = this.URLOption_detailList.substr(0,this.URLOption_detailList.indexOf('/')) let _parentName = this.URLOption_detailList.substr(0,this.URLOption_detailList.indexOf('/'))
this.initApiColumnsForDto(allData[0],allData[1].details[0],_parentName) this.apiColumns_DetailsTable = this.initTableColumns(this.initApiColumnsForDto(res.details[0],_parentName))
this.apiColumns_DetailsTable = this.initTableColumns(this.initApiColumnsForDto(allData[0],allData[1].details[0],_parentName))
}
// 页面数据处理
if(allData[1]){
let res = allData[1]
// 打印使用的全部数据存储 // 打印使用的全部数据存储
this.tableDataDetails = JSON.parse(JSON.stringify(res)) this.tableDataDetails = JSON.parse(JSON.stringify(res))
this.propsData = res this.propsData = res
@ -229,10 +212,10 @@ export const tableMixins = {
}else{ }else{
this.Loading.DrawerLoading = false this.Loading.DrawerLoading = false
} }
} })
}).catch(()=>{ .catch(err=>{
this.Loading.DrawerLoading = false this.Loading.DrawerLoading = false
}) })
}, },
// 前端分页处理 // 前端分页处理
// detailListPageFromFE(data){ // detailListPageFromFE(data){

2
Code/Fe/src/permission-0725.js

@ -20,7 +20,7 @@ router.beforeEach(async (to, from, next) => {
// 获取枚举数据 // 获取枚举数据
if(!store.getters.enumList || store.getters.enumList.length <= 0){ if(!store.getters.enumList || store.getters.enumList.length <= 0){
await store.dispatch('definition/getEnumList') await store.dispatch('definition/getDefinitionConfig')
} }
// // 获取表头转义 // // 获取表头转义

2
Code/Fe/src/permission.js

@ -31,7 +31,7 @@ router.beforeEach(async (to, from, next) => {
// 获取枚举数据 // 获取枚举数据
if(!store.getters.enumList || store.getters.enumList.length <= 0){ if(!store.getters.enumList || store.getters.enumList.length <= 0){
await store.dispatch('definition/getEnumList') await store.dispatch('definition/getDefinitionConfig')
} }
// 是否有用户信息: // 是否有用户信息:

1
Code/Fe/src/store/getters.js

@ -16,5 +16,6 @@ const getters = {
dictionaries: state => state.dictionaries.dict, dictionaries: state => state.dictionaries.dict,
enumList: state => state.definition.enumList,//接口获取的枚举 enumList: state => state.definition.enumList,//接口获取的枚举
columZHList: state => state.definition.columZHList,//接口转义的表头 columZHList: state => state.definition.columZHList,//接口转义的表头
dtoColumnTypes: state => state.definition.dtoColumnTypes,//所有页面的dto类型
} }
export default getters export default getters

95
Code/Fe/src/store/modules/definition.js

@ -1,25 +1,104 @@
import { getInterfaceBoard,getApiEnumList } from "@/api/wms-interface" import { getInterfaceBoard,getApiDefinition } from "@/api/wms-interface"
const state = { const state = {
enumList: [],//枚举 enumList: [],//枚举
columZHList:null,//表头转义 columZHList:null,//表头转义
dtoColumnTypes:[],//所有页面的dto类型
} }
const mutations = { const mutations = {
GET_ENUM_LIST: (state, data) => { // 设置枚举
SET_ENUM_LIST: (state, data) => {
state.enumList=data state.enumList=data
}, },
GET_COLUMZH_LIST: (state, data) => { // 设置表头转义
SET_COLUMZH_LIST: (state, data) => {
state.columZHList=data state.columZHList=data
}, },
// 所有页面的dto类型
SET_DTOCOLUMN_TYPES: (state, data) => {
state.dtoColumnTypes=data
},
}
// 通过url做方法处理转换(S/C/U/G等)目前只做了S查询。如果有需要在丰富
export function initDtoTypeByUrl(url){
if(url.indexOf('get-list-page-by-filter') >= 0){
return "S"
}else{
return url
}
}
// DTO类型转义
export function initDtoColumnTypes(res) {
// modules>app>controller>这里是所有的接口
let _controller = res.modules.app.controllers
let _allData = {}
for(let item in _controller){
let _com = 'AppService'
// 获取简单的api(路由,如:IncomingData)
let _api = item.substring(item.lastIndexOf('.') + 1,item.length - _com.length)
let _item = {
S:{
dtoList:[],
dtoType: 'S',
dtoName:item.substring(0,item.length - _com.length),
columnsType:null
}
}
for(let ac in _controller[item].actions){
let _actions = _controller[item].actions[ac]
// actions下通过URL匹配 做特殊处理
// 查询处理
if(initDtoTypeByUrl(_actions.url) == 'S'){
let _type = _actions.returnValue.type
let _type_value = _type.substring(_type.indexOf('<') + 1,_type.indexOf('>'))
_item.S.columnsType=_type_value
// 通过returnValue.type 在 res.types 中获取全部的dto
let _dtos = res.types[_type_value].properties
_dtos.forEach(d=>{
// 如果是枚举做处理(目前枚举只根据Enums做处理,todo:是否需要其他处理)
if(d.type.indexOf('Enums') >= 0){
d.apiBaseType = 'enums'
d.isEnums = true
// -1 是去掉最后的'?'(todo:是否每个Enums类型都有?)
let enums_type = d.type.substring(0,d.type.length - 1)
// 通过type包含Enums的全字段-'?'匹配res.types中的值
let enums_list = res.types[enums_type]
if(enums_list){
d.enums_list = []
enums_list.enumValues.forEach((e,key)=>{
d.enums_list.push({value:e,label:enums_list.enumNames[key]})
})
}
}else{
if(d.typeSimple == 'number' || d.typeSimple == 'number?'){
d.apiBaseType='number'
}else{
let _end_index = d.type.lastIndexOf('?') >= 0 ? d.type.lastIndexOf('?') : d.type.length
d.apiBaseType = d.type.substring(d.type.lastIndexOf('.') + 1, _end_index).toLowerCase()
}
if(d.type.indexOf('Guid') >= 0){
d.apiBaseType='string'
}
}
})
_item.S.dtoList=_dtos
}
}
_allData[_api] = _item
}
return _allData
} }
const actions = { const actions = {
// 获取枚举 // 获取枚举
getEnumList({ commit }) { getDefinitionConfig({ commit }) {
return new Promise(resolve => { return new Promise(resolve => {
getApiEnumList().then(res=>{ getApiDefinition().then(res=>{
commit('GET_ENUM_LIST', res.types) commit('SET_DTOCOLUMN_TYPES', initDtoColumnTypes(res))
commit('SET_ENUM_LIST', res.types)
resolve(res) resolve(res)
}) })
}) })
@ -29,11 +108,11 @@ const actions = {
return new Promise(resolve => { return new Promise(resolve => {
getInterfaceBoard().then(res=>{ getInterfaceBoard().then(res=>{
let _zh = res.resources[localStorage.getItem('columnsApiNamesZh')].texts; let _zh = res.resources[localStorage.getItem('columnsApiNamesZh')].texts;
commit('GET_COLUMZH_LIST', _zh) commit('SET_COLUMZH_LIST', _zh)
resolve(res) resolve(res)
}) })
}) })
}, }
} }
export default { export default {

6
Code/Fe/src/utils/detailsPageColumns_api/index.js

@ -1,9 +1,9 @@
// 此文件为【明细 - 列表】表头从接口缓存的表头 // 此文件为【明细 - 列表】表头从接口缓存的表头
import { initFromApiColumnsLable } from '@/utils/index' import { zhApiColumnsLable } from '@/utils/index'
// 测试数据 // 测试数据
// export const TestSchool = [ // export const TestSchool = [
// { label: initFromApiColumnsLable('TestStudentDetailStudentName'), prop: "studentName" }, // { label: zhApiColumnsLable('TestStudentDetailStudentName'), prop: "studentName" },
// { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, // { label: zhApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" },
// ] // ]

6
Code/Fe/src/utils/detailsTableColumns_api/index.js

@ -1,10 +1,10 @@
// 此文件为【明细 - 列表】表头从接口缓存的表头 // 此文件为【明细 - 列表】表头从接口缓存的表头
// 如果有父级id字段,请设置showProp,避免明细列表内可查询其他主表的明细 // 如果有父级id字段,请设置showProp,避免明细列表内可查询其他主表的明细
import { initFromApiColumnsLable } from '@/utils/index' import { zhApiColumnsLable } from '@/utils/index'
// 测试数据 // 测试数据
// export const TestSchool = [ // export const TestSchool = [
// { label: initFromApiColumnsLable('TestStudentDetailStudentName'), prop: "studentName" }, // { label: zhApiColumnsLable('TestStudentDetailStudentName'), prop: "studentName" },
// { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, // { label: zhApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" },
// ] // ]

2
Code/Fe/src/utils/index.js

@ -560,7 +560,7 @@ export function createNewTabs (url) {
// faster-new // faster-new
// 转义及读取api接口返回的表头信息 // 转义及读取api接口返回的表头信息
export function initFromApiColumnsLable (data) { export function zhApiColumnsLable (data) {
let _list = store.getters.columZHList let _list = store.getters.columZHList
return _list ? _list[data] : data return _list ? _list[data] : data
} }

6
Code/Fe/src/utils/tableColumns_api/index.js

@ -1,9 +1,9 @@
// 此文件为【主表-列表】表头从接口缓存的表头 // 此文件为【主表-列表】表头从接口缓存的表头
import { initFromApiColumnsLable } from '@/utils/index' import { zhApiColumnsLable } from '@/utils/index'
// 测试数据 // 测试数据
// export const TestSchool = [ // export const TestSchool = [
// { label: initFromApiColumnsLable('TestSchoolSchoolName'), prop: "schoolName", fixed: "left" }, // { label: zhApiColumnsLable('TestSchoolSchoolName'), prop: "schoolName", fixed: "left" },
// { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, // { label: zhApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" },
// ] // ]

6
Code/Fe/src/utils/tabsDesTions_api/index.js

@ -1,9 +1,9 @@
// 此文件为【主表-明细】表头从接口缓存的表头 // 此文件为【主表-明细】表头从接口缓存的表头
import { initFromApiColumnsLable } from '@/utils/index' import { zhApiColumnsLable } from '@/utils/index'
// 测试数据 // 测试数据
// export const TestSchool = [ // export const TestSchool = [
// { label: initFromApiColumnsLable('TestSchoolSchoolName'), prop: "schoolName", fixed: "left", type: "name" }, // { label: zhApiColumnsLable('TestSchoolSchoolName'), prop: "schoolName", fixed: "left", type: "name" },
// { label: initFromApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" }, // { label: zhApiColumnsLable('TestStudentDetailOrderType'), prop: "orderType" },
// ] // ]

14
Code/Fe/src/views/basicConfig/ExportCustomUserSetting.vue

@ -108,7 +108,7 @@ import { filterSelectMixins } from '@/mixins/filter-Select'
import * as tableColumns_api from "@/utils/tableColumns_api/index" // import * as tableColumns_api from "@/utils/tableColumns_api/index" //
import * as tabsDesTions_api from "@/utils/tabsDesTions_api/index" // import * as tabsDesTions_api from "@/utils/tabsDesTions_api/index" //
import * as detailsTableColumns_api from "@/utils/detailsTableColumns_api/index" // import * as detailsTableColumns_api from "@/utils/detailsTableColumns_api/index" //
import { initFromApiColumnsLable } from '@/utils/index' import { zhApiColumnsLable } from '@/utils/index'
// import { getExportConfigList } from '@/api/wms-interface' // import { getExportConfigList } from '@/api/wms-interface'
export default { export default {
@ -157,14 +157,14 @@ export default {
}, },
editOptions: {}, editOptions: {},
CreateForm: [ CreateForm: [
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 }, { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 },
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 }, { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 },
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 }, { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 },
], ],
editForm: [ editForm: [
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 }, { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingCustomUserSetting'), prop: "customUserSetting", colSpan: 12 },
{ type: "input", label:initFromApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 }, { type: "input", label:zhApiColumnsLable('ExportCustomUserSettingExportColumnName'), prop: "exportColumnName", colSpan: 12 },
{ type: "input", label: initFromApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 }, { type: "input", label: zhApiColumnsLable('ExportCustomUserSettingExportTableName'), prop: "exportTableName", colSpan: 12 },
], ],
editRules: { editRules: {
cerateRule: { cerateRule: {

Loading…
Cancel
Save