Browse Source

枚举暂存

noToken
安虹睿 1 year ago
parent
commit
71a16cc3c6
  1. 4
      PC/InterFace.Dash/public/config.js
  2. 17
      PC/InterFace.Dash/src/api/wms-interface.js
  3. 46
      PC/InterFace.Dash/src/mixins/TableMixins.js
  4. 23
      PC/InterFace.Dash/src/store/modules/definition.js
  5. 25
      PC/InterFace.Dash/src/store/modules/dto.js
  6. 2
      PC/InterFace.Dash/src/store/modules/user.js
  7. 15
      PC/InterFace.Dash/src/utils/index.js

4
PC/InterFace.Dash/public/config.js

@ -1,6 +1,6 @@
// dev_win
window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:60068'
// window.SITE_CONFIG['base'] = 'http://192.168.0.180:60068'
// window.SITE_CONFIG['base'] = 'http://dev.ccwin-in.com:60068'
window.SITE_CONFIG['base'] = 'http://192.168.0.180:60068'
window.SITE_CONFIG['businessApi'] = 'http://dev.ccwin-in.com:10097'
window.SITE_CONFIG['columnsApiNames'] = '/api/abp/application-localization'
// window.SITE_CONFIG['columnsApiNames'] = '/api/abp/application-configuration'

17
PC/InterFace.Dash/src/api/wms-interface.js

@ -20,4 +20,21 @@ export function getDefinitionMenu(IncludeTypes) {
url: base_api + '/api/abp/application-configuration',
params:{IncludeLocalizationResources:true}
})
}
// 获取枚举数据
export async function getApiEnumList() {
return request({
method:'get',
url: base_api + '/api/abp/api-definition',
params:{IncludeTypes:true}
})
}
// 获取dto列数据
export async function getDtoColumnType(api) {
return request({
method:'post',
url: base_api + '/api/'+ api +'/base/get-dto-column-type',
})
}

46
PC/InterFace.Dash/src/mixins/TableMixins.js

@ -3,7 +3,9 @@ import {
getDetailed,
postDelete
} from '@/api/wms-api'
import { initFromApiColumnsLable,firstWordSizeChange } from '@/utils/index'
import * as allUrlOption from '@/utils/baseData/urlOption'
import { getDtoColumnType } from '@/api/wms-interface'
export const tableMixins = {
data() {
return {
@ -56,7 +58,7 @@ export const tableMixins = {
// 获取通过api的表头数据,不可以在初始化处理,因为接口返回问题
initApiColumns(table,des,detailsTable,detailsPage){
// 赋值表头数据
if(table && table[this.$route.name])this.apiColumns_Table = this.initTableColumns(table[this.$route.name])
// 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')
@ -65,13 +67,47 @@ export const tableMixins = {
paging(callback) {
this.Loading.tableLoading = true;
this.PageListParams.SkipCount = (this.oldSkipCount - 1) * this.PageListParams.MaxResultCount
getPageList(this.PageListParams, this.URLOption_base).then(res => {
this.tableData = res.items
this.totalCount = res.totalCount
Promise.all([
getDtoColumnType(this.$route.name),
getPageList(this.PageListParams, this.URLOption_base)
]).then((allData) => {
// 表头处理
if(allData[0]){
let _coloums = allData[0].filter(item=>{
return item.dtoType == 'S'
})
let _Columns_Table = []
if(_coloums && _coloums.length > 0){
let _data = _coloums[0].columnsTypes
_data.forEach(item=>{
let _item = {
label:initFromApiColumnsLable(this.$route.name + item.z_ColumnName) || item.z_ColumnName,
prop:firstWordSizeChange(item.z_ColumnName),
apiType:item.z_ColumnType,
isEnum:item.isEnum
}
_Columns_Table.push(_item)
})
}
this.apiColumns_Table = this.initTableColumns(_Columns_Table)
}
// 页面数据处理
if(allData[1]){
this.tableData = allData[1].items
this.totalCount = allData[1].totalCount
}
this.pagingCallback(callback)
}).catch(err => {
console.log(111,this.apiColumns_Table,this.tableData)
}).catch(()=>{
this.Loading.tableLoading = false
})
// getPageList(this.PageListParams, this.URLOption_base).then(res => {
// this.tableData = res.items
// this.totalCount = res.totalCount
// this.pagingCallback(callback)
// }).catch(err => {
// this.Loading.tableLoading = false
// })
},
//接受排序信息并改变视图
sortChange(val) {

23
PC/InterFace.Dash/src/store/modules/definition.js

@ -0,0 +1,23 @@
const state = {
enumList: []
}
const mutations = {
GET_ENUM_LIST: (state, log) => {
state.logs.push(log)
},
}
const actions = {
getEnumList({ commit }, log) {
commit('GET_ENUM_LIST', log)
},
}
export default {
namespaced: true,
state,
mutations,
actions
}

25
PC/InterFace.Dash/src/store/modules/dto.js

@ -1,25 +0,0 @@
import { getDtoColumnType } from '@/api/wms-auth'
const state = {
dtos: null
}
const mutations = {
INIT_DTOS: (state, data) => {
state.dtos=data
},
}
const actions = {
initDtos({ commit }, data) {
commit('INIT_DTOS', data)
},
}
export default {
namespaced: true,
state,
mutations,
actions
}

2
PC/InterFace.Dash/src/store/modules/user.js

@ -220,7 +220,7 @@ const actions = {
commit('SET_USERINFO', res)
resolve(res)
}else{
reject('获取用户信息失败,请重试111')
reject('获取用户信息失败,请重试')
}
})
.catch(err => {

15
PC/InterFace.Dash/src/utils/index.js

@ -557,7 +557,8 @@ export function createNewTabs (url) {
window.open(url, "_blank")
}
// 转义及读取api接口返回的表头信息
// faster-new
// 转义及读取api接口返回的表头信息
export function initFromApiColumnsLable (data) {
//todo:待定:重新获取全局从接口缓存的表头(如:接口监控看板)
// import { getInterfaceBoard } from "@/api/wms-interface"
@ -577,3 +578,15 @@ export function initFromApiColumnsLable (data) {
}
return _Dashboard ? _Dashboard[data] : null
}
// 首字母转换 type='Lower'(小写,默认) Upper(大写)
export function firstWordSizeChange (str,type='Lower') {
switch(type){
case 'Lower':
return str.substring(0,1).toLowerCase() + str.substring(1,str.length);
case 'Upper':
return str.substring(0,1).toUpperCase() + str.substring(1,str.length);
}
}
Loading…
Cancel
Save