fix(order): 解决订单信息列表数据处理和权限控制问题

- 移除开始生产、更新数量、完工提报按钮的权限控制指令
- 优化listOrderInfo接口响应数据处理逻辑,支持数组和对象两种格式
- 添加对response.data和response.rows的数据兼容性处理
- 统一错误处理逻辑,设置默认空数组和总数为0
- 使用finally确保loading状态正确重置
- 修复import语句中的多余斜杠路径问题
master
zangch@mesnac.com 2 weeks ago
parent a25e72e95b
commit c71bfa5b83

@ -50,21 +50,18 @@
size="mini" size="mini"
type="primary" type="primary"
@click="handleStart(scope.row)" @click="handleStart(scope.row)"
v-hasPermi="['base:orderInfo:start']"
>开始生产</el-button> >开始生产</el-button>
<el-button <el-button
v-if="scope.row.executionStatus === 'RUNNING'" v-if="scope.row.executionStatus === 'RUNNING'"
size="mini" size="mini"
type="warning" type="warning"
@click="handleUpdateQty(scope.row)" @click="handleUpdateQty(scope.row)"
v-hasPermi="['base:orderInfo:updateQty']"
>更新数量</el-button> >更新数量</el-button>
<el-button <el-button
v-if="scope.row.executionStatus === 'RUNNING'" v-if="scope.row.executionStatus === 'RUNNING'"
size="mini" size="mini"
type="success" type="success"
@click="handleComplete(scope.row)" @click="handleComplete(scope.row)"
v-hasPermi="['base:orderInfo:complete']"
>完工提报</el-button> >完工提报</el-button>
<el-button <el-button
size="mini" size="mini"
@ -219,11 +216,22 @@ export default {
methods: { methods: {
getList() { getList() {
this.loading = true; this.loading = true;
listOrderInfo(this.queryParams).then(response => { listOrderInfo(this.queryParams)
this.orderList = response.rows; .then(response => {
this.total = response.total; const data = response && response.data ? response.data : response;
this.loading = false; if (Array.isArray(data)) {
}).catch(() => { this.orderList = data;
this.total = data.length;
} else {
this.orderList = (data && data.rows) ? data.rows : [];
this.total = (data && data.total) ? data.total : this.orderList.length;
}
})
.catch(() => {
this.orderList = [];
this.total = 0;
})
.finally(() => {
this.loading = false; this.loading = false;
}); });
}, },

@ -382,8 +382,8 @@ import {
updateOrderInfo, updateOrderInfo,
releaseOrderPlan, replaceProductionLine releaseOrderPlan, replaceProductionLine
} from '@/api/base/orderInfo' } from '@/api/base/orderInfo'
import { findProductLineList } from '@//api/base/productLine' import { findProductLineList } from '@/api/base/productLine'
import { addSAPCalendar } from '@//api/production/calendarInfo' import { addSAPCalendar } from '@/api/production/calendarInfo'
export default { export default {
name: 'OrderInfo', name: 'OrderInfo',
@ -482,9 +482,22 @@ export default {
this.queryParams.params['beginEndTime'] = this.daterangeEndTime[0] this.queryParams.params['beginEndTime'] = this.daterangeEndTime[0]
this.queryParams.params['endEndTime'] = this.daterangeEndTime[1] this.queryParams.params['endEndTime'] = this.daterangeEndTime[1]
} }
listOrderInfo(this.queryParams).then(response => { listOrderInfo(this.queryParams)
this.orderInfoList = response.rows .then(response => {
this.total = response.total const data = response && response.data ? response.data : response
if (Array.isArray(data)) {
this.orderInfoList = data
this.total = data.length
} else {
this.orderInfoList = (data && data.rows) ? data.rows : []
this.total = (data && data.total) ? data.total : this.orderInfoList.length
}
})
.catch(() => {
this.orderInfoList = []
this.total = 0
})
.finally(() => {
this.loading = false this.loading = false
}) })
findProductLineList({ productLineType: 1 }).then(response => { findProductLineList({ productLineType: 1 }).then(response => {

Loading…
Cancel
Save