opt:优化前后端交互后端返回不统一问题

This commit is contained in:
zhangzq
2026-07-08 17:17:52 +08:00
parent c4b1e9d1d2
commit b2d542ed24
134 changed files with 553 additions and 636 deletions

View File

@@ -189,7 +189,7 @@ module.exports = {
'yield-star-spacing': [2, 'both'],
'yoda': [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'no- ': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [2, 'always', {
objectsInObjects: false
}],

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -147,7 +147,7 @@ function CRUD(options) {
table.store.states.lazyTreeNodeMap = {}
}
crud.page.total = data.totalElements
crud.data = data.content
crud.data = data.data
crud.resetDataStatus()
// time 毫秒后显示表格
setTimeout(() => {

View File

@@ -16,8 +16,8 @@ export default class Dict {
Vue.set(this.dict.label, n, {})
Vue.set(this.dict, n, [])
ps.push(getDictDetail(n).then(data => {
this.dict[n].splice(0, 0, ...data.content)
data.content.forEach(d => {
this.dict[n].splice(0, 0, ... data.data)
data.data.forEach(d => {
Vue.set(this.dict.dict[n], d.value, d)
Vue.set(this.dict.label[n], d.value, d.label)
})

View File

@@ -62,7 +62,7 @@ export default {
// 请求数据
initData(this.url, this.getQueryParame()).then(data => {
this.total = data.totalElements
this.data = data.content
this.data = data.data
// time 毫秒后显示表格
setTimeout(() => {
this.loading = false

View File

@@ -53,8 +53,8 @@ router.beforeEach((to, from, next) => {
export const loadMenus = (next, to) => {
buildMenus(1).then(res => {
const sdata = JSON.parse(JSON.stringify(res))
const rdata = JSON.parse(JSON.stringify(res))
const sdata = JSON.parse(JSON.stringify(res.data))
const rdata = JSON.parse(JSON.stringify(res.data))
const sidebarRoutes = filterAsyncRouter(sdata)
const rewriteRoutes = filterAsyncRouter(rdata, false, true)
rewriteRoutes.push({ path: '*', redirect: '/404', hidden: true })

View File

@@ -31,12 +31,15 @@ const user = {
const rememberMe = userInfo.rememberMe
return new Promise((resolve, reject) => {
login(userInfo.username, userInfo.password, userInfo.code, userInfo.uuid).then(res => {
setToken(res.token, rememberMe)
commit('SET_TOKEN', res.token)
setUserInfo(res.user, commit)
// 第一次加载菜单时用到, 具体见 src 目录下的 permission.js
commit('SET_LOAD_MENUS', true)
resolve()
if (res.code === 200) {
setToken(res.data.token, rememberMe)
commit('SET_TOKEN', res.data.token)
setUserInfo(res.data.user, commit)
// 第一次加载菜单时用到, 具体见 src 目录下的 permission.js
commit('SET_LOAD_MENUS', true)
resolve()
}
}).catch(error => {
reject(error)
})
@@ -46,9 +49,9 @@ const user = {
// 获取用户信息
GetInfo({ commit }) {
return new Promise((resolve, reject) => {
getInfo().then(res => {
setUserInfo(res, commit)
resolve(res)
getInfo().then(res=> {
setUserInfo(res.data, commit)
resolve(res.data)
}).catch(error => {
reject(error)
})

View File

@@ -32,9 +32,18 @@ service.interceptors.request.use(
// response 拦截器
service.interceptors.response.use(
response => {
return response.data
let res = response.data
if (res.code === 200){
return res
}else {
Notification.error({
title: res.message,
duration: 3000
})
}
},
error => {
// 兼容blob下载出错json提示
if (error.response.data instanceof Blob && error.response.data.type.toLowerCase().indexOf('json') !== -1) {
const reader = new FileReader()

View File

@@ -213,7 +213,7 @@ export default {
this.$nextTick(() => {
// 获取设备类型字典
get('device_type').then(data => {
this.device_types = data.content
this.device_types = data.data
})
})
},

View File

@@ -371,7 +371,7 @@ export default {
}
const dafult = this.$el.getElementsByClassName('dafult')
for (let a = 0; a < dafult.length; a++) {
debugger
dafult[a].click()
}
}

View File

@@ -230,15 +230,15 @@ export default {
}
},
materialChoose(row) {
debugger
// 对新增的行进行校验不能存在相同物料批次
row.forEach((item) => {
debugger
let same_mater = true
this.form.tableData.forEach((row) => {
debugger
if (row.material_code === item.material_code && row.pcsn === item.pcsn) {
debugger
same_mater = false
}
})

View File

@@ -291,7 +291,7 @@ export default {
},
created() {
crudStorattr.getStor().then(res => {
this.stors = res
this.stors = res.data
})
},
methods: {

View File

@@ -185,7 +185,7 @@ export default {
this.inventoryLoading = true
queryInventory(row.skuCode).then(res => {
// const demandQty = Number(row.qty) || 0
this.inventoryList = (res || []).map(item => ({
this.inventoryList = (res.data || []).map(item => ({
...item,
_selected: false,
allocQty: row.qty

View File

@@ -403,7 +403,7 @@ export default {
this.materOptCode = material_code
},
setMaterValue(row) {
debugger
this.form.material_code = row.material_code
this.form.material_name = row.material_name
this.form.material_spec = row.material_spec

View File

@@ -284,7 +284,7 @@ export default {
},
openDetailDialog(order) {
crudWorkOrder.getItem(order).then(result => {
this.bomList = result.content || []
this.bomList = result.data || []
this.detailVisible = true
}).catch(error => {
this.bomList = []

View File

@@ -150,7 +150,7 @@ export default {
},
open() {
crudSectattr.getSect({ 'stor_id': this.storId }).then(res => {
this.sects = res.content
this.sects = res.data
})
this.query.is_lock = '0'
this.query.lock_type = this.lock

View File

@@ -492,7 +492,7 @@ export default {
},
getRegionList() {
crudSchBaseRegion.getRegionList().then(res => {
this.regionList = res
this.regionList = res.data
})
},
getPointStatusAndTypeList(id, flag) {
@@ -506,7 +506,7 @@ export default {
getPointStatusList(id, flag) {
crudSchBaseRegion.getPointStatusSelectById(id).then(res => {
if (flag === 1) {
this.pointStatusList = res
this.pointStatusList = res.data
} else {
this.pointStatusDialogList = res
}

View File

@@ -193,7 +193,7 @@ export default {
open() {
// 查询原材料库的仓库
crudStorattr.getStor({}).then(res => {
this.storlist = res
this.storlist = res.data
})
},
close() {
@@ -201,7 +201,7 @@ export default {
},
[CRUD.HOOK.afterToEdit]() {
check.getDtl({ 'check_id': this.form.check_id }).then(res => {
this.form.tableData = res
this.form.tableData = res.data
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
@@ -212,7 +212,7 @@ export default {
},
[CRUD.HOOK.afterToView]() {
check.getDtl({ 'check_id': this.form.check_id }).then(res => {
this.form.tableData = res
this.form.tableData = res.data
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]

View File

@@ -146,7 +146,7 @@ export default {
open() {
this.crud.resetQuery(false)
crudSectattr.getSect({ 'stor_id': this.defaultList[0] }).then(res => {
this.sects = res.content
this.sects = res.data
})
if (this.sect) {
this.query.sect = this.sect

View File

@@ -175,10 +175,10 @@ export default {
open() {
// 查询原材料库的仓库
crudStorattr.getStor({}).then(res => {
this.storlist = res
this.storlist = res.data
})
check.getDtl({ 'check_id': this.form1.check_id }).then(res => {
this.form1.tableData = res
this.form1.tableData = res.data
// 将明细变成不可编辑
for (let i = 0; i < this.form1.tableData.length; i++) {
const row = this.form1.tableData[i]

View File

@@ -241,7 +241,7 @@ export default {
},
created() {
crudStorattr.getStor({}).then(res => {
this.storlist = res
this.storlist = res.data
})
},
methods: {

View File

@@ -227,7 +227,7 @@ export default {
methods: {
open() {
crudBsrealstorattr.getStor().then(res => {
this.storlist = res
this.storlist = res.data
})
},
close() {
@@ -236,7 +236,7 @@ export default {
[CRUD.HOOK.afterToEdit]() {
// 获取入库单明细
crudRawAssist.getIODtl({ 'bill_code': this.form.bill_code }).then(res => {
this.form.tableData = res
this.form.tableData = res.data
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
@@ -252,7 +252,7 @@ export default {
this.bill_btn = true
this.mater_btn = true
crudRawAssist.getIODtl({ 'bill_code': this.form.bill_code }).then(res => {
this.form.tableData = res
this.form.tableData = res.data
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]

View File

@@ -151,7 +151,7 @@ export default {
}
this.$emit('update:dialogShow', false)
group.getAllGroupInfo(selection).then(res => {
this.rows = res.content || []
this.rows = res.data || []
this.$emit('tableChanged', this.rows)
})
// this.form = this.$options.data().form

View File

@@ -274,13 +274,13 @@ export default {
methods: {
open() {
crudSectattr.getSectCode({ 'stor_code': this.storCode }).then(res => {
this.sects = res.content
this.sects = res.data
})
const area_type = 'RKQ'
crudPoint.getPointList({ 'region_code': area_type }).then(res => {
this.pointlist = res
this.pointlist = res.data
})
},
toDelete(data) {
@@ -299,12 +299,12 @@ export default {
clcikRow(row, column, event) {
this.form.dtl_row = row
crudRawAssist.getIODtl({ 'bill_code': this.form.dtl_row.bill_code }).then(res => {
this.openParam = res
this.form.dtl_row = res[row.index]
this.openParam = res.data
this.form.dtl_row = res.data[row.index]
this.form.dis_row = null
})
crudRawAssist.getDisDtl(row).then(res => {
this.form.tableMater = res
this.form.tableMater = res.data
})
},
clcikDisRow(row, column, event) {
@@ -318,10 +318,10 @@ export default {
if (rows[index].status !== '01') {
crudRawAssist.deleteDisDtl(rows[index]).then(res => {
crudRawAssist.getIODtl({ 'bill_code': this.form.dtl_row.bill_code, 'open_flag': '1' }).then(res => {
this.openParam = res
this.openParam = res.data
})
crudRawAssist.getDisDtl(this.form.dtl_row).then(res => {
this.form.tableMater = res
this.form.tableMater = res.data
})
rows[index].pop = false
}).catch(err => {
@@ -362,7 +362,7 @@ export default {
}
crudRawAssist.divStruct(this.form).then(res => {
crudRawAssist.getIODtl({ 'bill_code': this.form.dtl_row.bill_code, 'open_flag': '1' }).then(res => {
this.openParam = res
this.openParam = res.data
})
this.form.tableMater = []
})
@@ -378,10 +378,10 @@ export default {
}
crudRawAssist.divPoint(this.form).then(res => {
crudRawAssist.getIODtl({ 'bill_code': this.form.dtl_row.bill_code, 'open_flag': '1' }).then(res => {
this.openParam = res
this.openParam = res.data
})
crudRawAssist.getDisDtl(this.form.dtl_row).then(res => {
this.form.tableMater = res
this.form.tableMater = res.data
this.crud.notify('设置起点成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
})
})
@@ -406,10 +406,10 @@ export default {
this.form.stor_code = this.stor_code
crudRawAssist.divStruct(this.form).then(res => {
crudRawAssist.getIODtl({ 'bill_code': this.form.dtl_row.bill_code, 'open_flag': '1' }).then(res => {
this.openParam = res
this.openParam = res.data
})
crudRawAssist.getDisDtl(this.form.dtl_row).then(res => {
this.form.tableMater = res
this.form.tableMater = res.data
this.divBtn = false
this.form.dis_row = null
this.crud.notify('分配货位成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
@@ -437,10 +437,10 @@ export default {
// 如果勾选了,直接跳后台
crudRawAssist.unDivStruct(this.form).then(res => {
crudRawAssist.getIODtl({ 'bill_code': this.form.dtl_row.bill_code, 'open_flag': '1' }).then(res => {
this.openParam = res
this.openParam = res.data
})
crudRawAssist.getDisDtl(this.form.dtl_row).then(res => {
this.form.tableMater = res
this.form.tableMater = res.data
this.form.dis_row = null
this.crud.notify('取消分配成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
})

View File

@@ -195,7 +195,7 @@ export default {
},
created() {
crudBsrealstorattr.getStor().then(res => {
this.storlist = res
this.storlist = res.data
})
},
methods: {
@@ -240,13 +240,13 @@ export default {
// this.tableDtl = res
// })
rawassist.getIODtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {
this.tableDtl = res
this.tableDtl = res.data
})
},
queryTableDdis() {
if (this.currentdtl !== null) {
rawassist.getInBillTaskDtl({ 'iostorinvdtl_id': this.currentdtl.iostorinvdtl_id }).then(res => {
this.tabledis = res
this.tabledis = res.data
}).catch(() => {
this.tabledis = []
})

View File

@@ -277,7 +277,7 @@ export default {
},
created() {
crudBsrealstorattr.getStor().then(res => {
this.storlist = res
this.storlist = res.data
})
this.initQuery()
},
@@ -378,7 +378,7 @@ export default {
},
divOpen() {
crudRawAssist.getIODtl({ 'bill_code': this.currentRow.bill_code, 'open_flag': '1' }).then(res => {
this.openParam = res
this.openParam = res.data
this.storCode = this.currentRow.stor_code
this.billType = this.currentRow.bill_type
this.divShow = true

View File

@@ -239,7 +239,7 @@ export default {
open() {
// 查询原材料库的仓库
crudStorattr.getStor({}).then(res => {
this.storlist = res
this.storlist = res.data
})
},
[CRUD.HOOK.afterToEdit]() {

View File

@@ -149,7 +149,7 @@ export default {
open() {
this.crud.resetQuery(false)
crudSectattr.getSect({ 'stor_id': this.defaultList[0] }).then(res => {
this.sects = res.content
this.sects = res.data
})
if (this.sect) {
this.query.sect = this.sect

View File

@@ -245,7 +245,7 @@ export default {
},
created() {
crudStorattr.getStor({}).then(res => {
this.storlist = res
this.storlist = res.data
})
},
methods: {

View File

@@ -280,7 +280,7 @@ export default {
methods: {
open() {
crudUserStor.getStor().then(res => {
this.storlist = res
this.storlist = res.data
})
},
close() {
@@ -288,7 +288,7 @@ export default {
},
[CRUD.HOOK.afterToEdit]() {
movestor.getMoveDtl({ 'moveinv_id': this.form.moveinv_id }).then(res => {
this.form.tableData = res
this.form.tableData = res.data
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
@@ -299,7 +299,7 @@ export default {
},
[CRUD.HOOK.afterToView]() {
movestor.getMoveDtl({ 'moveinv_id': this.form.moveinv_id }).then(res => {
this.form.tableData = res
this.form.tableData = res.data
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]

View File

@@ -169,7 +169,7 @@ export default {
},
open() {
crudSectattr.getSect({ 'stor_id': this.storId }).then(res => {
this.sects = res.content
this.sects = res.data
})
this.crud.toQuery()
},

View File

@@ -231,7 +231,7 @@ export default {
},
created() {
crudStorattr.getStor({}).then(res => {
this.storlist = res
this.storlist = res.data
})
this.initQuery()
this.crud.toQuery()

View File

@@ -255,7 +255,7 @@ export default {
methods: {
open() {
crudBsrealstorattr.getStor().then(res => {
this.storlist = res
this.storlist = res.data
})
},
close() {
@@ -278,7 +278,7 @@ export default {
},
[CRUD.HOOK.afterToEdit]() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {
this.form.tableData = res
this.form.tableData = res.data
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]
@@ -289,7 +289,7 @@ export default {
},
[CRUD.HOOK.afterToView]() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {
this.form.tableData = res
this.form.tableData = res.data
// 将明细变成不可编辑
for (let i = 0; i < this.form.tableData.length; i++) {
const row = this.form.tableData[i]

View File

@@ -319,10 +319,10 @@ export default {
methods: {
open() {
crudSectattr.getSectCode({ 'stor_code': this.storCode }).then(res => {
this.sects = res.content
this.sects = res.data
})
crudPoint.getRegionPoints({ 'regionCode': 'CKQ' }).then(res => {
this.outBoundRegion = res.content
this.outBoundRegion = res.data
})
},
close() {
@@ -343,7 +343,7 @@ export default {
this.currentRow.stor_code = this.storCode
this.loadingAlldiv = true
checkoutbill.getStructIvt(this.currentRow).then(res => {
this.openParam = res
this.openParam = res.data
this.structshow = true
this.openRow = this.currentRow
this.loadingAlldiv = false
@@ -498,12 +498,12 @@ export default {
},
queryTableDtl() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.mstrow.iostorinv_id }).then(res => {
this.tableDtl = res
this.tableDtl = res.data
})
},
queryTableDdis(iostorinvdtl_id) {
checkoutbill.getOutBillDis({ 'iostorinvdtl_id': iostorinvdtl_id, 'bill_status': '01' }).then(res => {
this.tabledis = res
this.tabledis = res.data
this.outBoundRegion
}).catch(() => {
this.tabledis = []

View File

@@ -173,7 +173,7 @@ export default {
methods: {
open() {
crudSectattr.getSect({ 'stor_id': this.storId }).then(res => {
this.sects = res.content
this.sects = res.data
})
this.query.source_bill_code = this.queryrow.source_bill_code
this.query.material_id = this.queryrow.material_id
@@ -182,7 +182,7 @@ export default {
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(this.queryrow.assign_qty)
this.queryrow.assign_qty = 0
checkoutbill.getStructIvt(this.queryrow).then(res => {
this.tableDtl = res
this.tableDtl = res.data
})
},
sectQueryChange(val) {

View File

@@ -217,7 +217,7 @@ export default {
},
created() {
crudBsrealstorattr.getStor().then(res => {
this.storlist = res
this.storlist = res.data
})
},
methods: {
@@ -262,13 +262,13 @@ export default {
},
queryTableDtl() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {
this.tableDtl = res
this.tableDtl = res.data
})
},
queryTableDdis() {
if (this.currentdtl !== null) {
checkoutbill.getOutBillTask({ 'iostorinvdtl_id': this.currentdtl.iostorinvdtl_id }).then(res => {
this.tabledis = res
this.tabledis = res.data
}).catch(() => {
this.tabledis = []
})

View File

@@ -273,7 +273,7 @@ export default {
},
created() {
crudBsrealstorattr.getStor().then(res => {
this.storlist = res
this.storlist = res.data
})
this.initQuery()
},
@@ -381,7 +381,7 @@ export default {
},
divOpen() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.currentRow.iostorinv_id }).then(res => {
this.openParam = res
this.openParam = res.data
this.storCode = this.currentRow.stor_code
this.divShow = true
this.mstrow = this.currentRow

View File

@@ -211,15 +211,15 @@ export default {
},
[CRUD.HOOK.afterToEdit]() {
crudPurchase.get(this.form.id).then(res => {
if (res && res.tableData) {
this.form.tableData = res.tableData
if (res.data && res.data.tableData) {
this.form.tableData = res.data.tableData
}
})
},
[CRUD.HOOK.afterToView]() {
crudPurchase.get(this.form.id).then(res => {
if (res && res.tableData) {
this.form.tableData = res.tableData
if (res.data && res.data.tableData) {
this.form.tableData = res.data.tableData
}
})
},

View File

@@ -120,7 +120,7 @@ export default {
open() {
if (this.form && this.form.id) {
crudPurchase.get(this.form.id).then(res => {
this.tableDtl = (res && res.tableData) || []
this.tableDtl = (res && res.data.tableData) || []
})
}
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long