订单管理
This commit is contained in:
437
src/views/order/base/orderGroup/index.vue
Normal file
437
src/views/order/base/orderGroup/index.vue
Normal file
@@ -0,0 +1,437 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!-- 搜索工作栏 -->
|
||||
<search-bar
|
||||
:formConfigs="formConfig"
|
||||
ref="searchBarForm"
|
||||
@headBtnClick="buttonClick"
|
||||
/>
|
||||
<!-- 列表 -->
|
||||
<base-table
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:table-props="tableProps"
|
||||
:table-data="list"
|
||||
:max-height="tableH"
|
||||
>
|
||||
<method-btn
|
||||
v-if="tableBtn.length"
|
||||
slot="handleBtn"
|
||||
:width="240"
|
||||
label="操作"
|
||||
:method-list="tableBtn"
|
||||
@clickBtn="handleClick"
|
||||
/>
|
||||
</base-table>
|
||||
<pagination
|
||||
:page.sync="queryParams.pageNo"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
:total="total"
|
||||
@pagination="getList"
|
||||
/>
|
||||
<!-- 新增&编辑 -->
|
||||
<base-dialog
|
||||
:dialogTitle="addOrEditTitle"
|
||||
:dialogVisible="centervisible"
|
||||
@cancel="handleCancel"
|
||||
@confirm="handleConfirm"
|
||||
:before-close="handleCancel"
|
||||
width='60%'
|
||||
>
|
||||
<order-group-add ref="orderGroupAdd" @successSubmit="successSubmit" />
|
||||
</base-dialog>
|
||||
<!-- 查看详情 -->
|
||||
<!-- 新增工单 -->
|
||||
<base-dialog
|
||||
:dialogTitle="workIssueTitle"
|
||||
:dialogVisible="addWorkOrdervisible"
|
||||
@cancel="addWorkOrderCancel"
|
||||
@confirm="addWorkOrderConfirm"
|
||||
:before-close="addWorkOrderCancel"
|
||||
width='70%'
|
||||
>
|
||||
<add-work-order ref="bindOrder" @addWorkOrderSubmit="addWorkOrderSubmit" />
|
||||
</base-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { parseTime } from '@/utils/ruoyi'
|
||||
import { getOrderGroupPage, groupOrderStatusSet } from '@/api/base/orderGroup'
|
||||
import { orderDelete, customerList, orderFinish } from '@/api/base/orderManage'
|
||||
import OrderGroupAdd from './components/orderGroupAdd'
|
||||
import BindOrder from './components/bindOrder'
|
||||
import { publicFormatter } from '@/utils/dict'
|
||||
const tableProps = [
|
||||
{
|
||||
prop: 'createTime',
|
||||
label: '添加时间',
|
||||
filter: parseTime,
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'name',
|
||||
label: '订单名称',
|
||||
minWidth: 120,
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'code',
|
||||
label: '订单编码',
|
||||
minWidth: 180
|
||||
},
|
||||
{
|
||||
prop: 'customerId',
|
||||
label: '客户',
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '订单状态',
|
||||
filter: publicFormatter('order_status')
|
||||
},{
|
||||
prop: 'specifications',
|
||||
label: '产品规格',
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'unit',
|
||||
label: '单位',
|
||||
filter: publicFormatter('unit_dict')
|
||||
},
|
||||
{
|
||||
prop: 'planQuantity',
|
||||
label: '计划加工量',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'actualquantity',
|
||||
label: '实际加工量',
|
||||
width: 100
|
||||
},
|
||||
{
|
||||
prop: 'finishProduceTime',
|
||||
label: '交货时间',
|
||||
filter: parseTime,
|
||||
minWidth: 160
|
||||
},
|
||||
{
|
||||
prop: 'productName2',
|
||||
label: '包装要求',
|
||||
showOverflowtooltip: true
|
||||
},
|
||||
{
|
||||
prop: 'orderIdNum',
|
||||
label: '订单数量'
|
||||
}
|
||||
]
|
||||
export default {
|
||||
name: 'OrderGroup',
|
||||
data() {
|
||||
return {
|
||||
formConfig: [
|
||||
{
|
||||
type: 'input',
|
||||
label: '订单名称',
|
||||
placeholder: '订单名称',
|
||||
param: 'name'
|
||||
},
|
||||
{
|
||||
type: 'select',
|
||||
label: '状态',
|
||||
selectOptions: this.getDictDatas(this.DICT_TYPE.ORDER_STATUS),
|
||||
labelField: 'label',
|
||||
valueField: 'value',
|
||||
param: 'status'
|
||||
},
|
||||
{
|
||||
type: 'datePicker',
|
||||
label: '时间段',
|
||||
dateType: 'daterange',
|
||||
format: 'yyyy-MM-dd',
|
||||
valueFormat: "yyyy-MM-dd",
|
||||
rangeSeparator: '-',
|
||||
startPlaceholder: '开始时间',
|
||||
endPlaceholder: '结束时间',
|
||||
param: 'timeVal',
|
||||
defaultSelect: [],
|
||||
width: 250
|
||||
},
|
||||
{
|
||||
type: 'button',
|
||||
btnName: '查询',
|
||||
name: 'search',
|
||||
color: 'primary'
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:order-manage:create') ? 'separate' : '',
|
||||
},
|
||||
{
|
||||
type: this.$auth.hasPermi('base:order-manage:create') ? 'button' : '',
|
||||
btnName: '新增',
|
||||
name: 'add',
|
||||
color: 'success',
|
||||
plain: true
|
||||
}
|
||||
],
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNo: 1,
|
||||
pageSize: 20,
|
||||
name: null,
|
||||
status: null,
|
||||
lastIssuedTime: []
|
||||
},
|
||||
total: 0,
|
||||
tableProps,
|
||||
list: [],
|
||||
tableH: this.tableHeight(260),
|
||||
tableBtn: [
|
||||
this.$auth.hasPermi('base:order-manage:bindWorkOrder')
|
||||
? {
|
||||
type: 'bind',
|
||||
btnName: '绑定',
|
||||
showTip: '绑定工单',
|
||||
// showParam: {
|
||||
// type: '|',
|
||||
// data: [
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 1
|
||||
// },
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 2
|
||||
// },
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 3
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:order-manage:bindWorkOrder')
|
||||
? {
|
||||
type: 'complete',
|
||||
btnName: '完成',
|
||||
showTip: '完成订单',
|
||||
// showParam: {
|
||||
// type: '|',
|
||||
// data: [
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 2
|
||||
// },
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 3
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:order-manage:bindWorkOrder')
|
||||
? {
|
||||
type: 'termination',
|
||||
btnName: '终止',
|
||||
showTip: '终止',
|
||||
// showParam: {
|
||||
// type: '|',
|
||||
// data: [
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 2
|
||||
// },
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 3
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:order-manage:bindWorkOrder')
|
||||
? {
|
||||
type: 'cancel',
|
||||
btnName: '作废',
|
||||
showTip: '作废',
|
||||
// showParam: {
|
||||
// type: '|',
|
||||
// data: [
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 2
|
||||
// },
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 3
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:order-manage:detail')
|
||||
? {
|
||||
type: 'detail',
|
||||
btnName: '详情'
|
||||
}
|
||||
: undefined,
|
||||
this.$auth.hasPermi('base:order-manage:edit')
|
||||
? {
|
||||
type: 'edit',
|
||||
btnName: '编辑',
|
||||
// showParam: {
|
||||
// type: '&',
|
||||
// data: [
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'triggerOrigin',
|
||||
// value: 1
|
||||
// },
|
||||
// {
|
||||
// type: 'equal',
|
||||
// name: 'status',
|
||||
// value: 1
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
}
|
||||
: undefined
|
||||
].filter((v) => v),
|
||||
addOrEditTitle: '',
|
||||
centervisible: false,
|
||||
priorityList: this.getDictDatas(this.DICT_TYPE.ORDER_PRIORITY),
|
||||
workIssueTitle: '',
|
||||
addWorkOrdervisible: false,
|
||||
orderDetailVisible: false
|
||||
}
|
||||
},
|
||||
components: { OrderGroupAdd, BindOrder },
|
||||
created() {
|
||||
window.addEventListener('resize', () => {
|
||||
this.tableH = this.tableHeight(260)
|
||||
})
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
getOrderGroupPage({...this.queryParams}).then(res => {
|
||||
let arr = res.data.list || []
|
||||
this.total = res.data.total || 0
|
||||
if (arr.length > 0) {
|
||||
customerList().then(result => {
|
||||
let tempData = result.data || []
|
||||
if (tempData.length > 0) {
|
||||
arr.map(item => {
|
||||
for (let i of tempData) {
|
||||
if (item.customerId === i.id) {
|
||||
item.customerId = i.name
|
||||
}
|
||||
}
|
||||
item.price = item.price?.toFixed(2)
|
||||
})
|
||||
this.list = arr
|
||||
}
|
||||
})
|
||||
}else {
|
||||
this.list = arr
|
||||
}
|
||||
})
|
||||
},
|
||||
buttonClick(val) {
|
||||
console.log(val)
|
||||
if (val.btnName === 'search') {
|
||||
this.queryParams.name = val.name
|
||||
this.queryParams.status = val.status
|
||||
if (val.timeVal && val.timeVal.length > 0) {
|
||||
this.queryParams.lastIssuedTime[0] = val.timeVal[0] + ' 00:00:00'
|
||||
this.queryParams.lastIssuedTime[1] = val.timeVal[1] + ' 23:59:59'
|
||||
} else {
|
||||
this.queryParams.lastIssuedTime = []
|
||||
}
|
||||
this.getList()
|
||||
} else {
|
||||
this.addOrEditTitle = '新增'
|
||||
this.centervisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.orderGroupAdd.init()
|
||||
})
|
||||
}
|
||||
},
|
||||
handleClick(val) {
|
||||
console.log(val)
|
||||
switch (val.type) {
|
||||
case 'edit':
|
||||
this.addOrEditTitle = '编辑'
|
||||
this.centervisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.orderGroupAdd.init(val.data.id)
|
||||
})
|
||||
break
|
||||
case 'cancel':
|
||||
this.handleEditStatus(val.data, '作废', '6')
|
||||
break
|
||||
case 'detail':
|
||||
this.$router.push({path: '/order/base/order-group/order-group-detail-data?orderGroupId='+ val.data.id})
|
||||
break
|
||||
case 'termination':
|
||||
this.handleEditStatus(val.data, '终止', '5')
|
||||
break
|
||||
case 'bind':
|
||||
this.workIssueTitle = '绑定工单'
|
||||
this.addWorkOrdervisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.bindOrder.init(val.data, 'bind')
|
||||
})
|
||||
break
|
||||
case 'complete':
|
||||
this.handleEditStatus(val.data, '完成', '4')
|
||||
break
|
||||
default:
|
||||
}
|
||||
},
|
||||
// 完成,终止,作废
|
||||
handleEditStatus(val, tip, status) {
|
||||
this.$modal.confirm('是否确认'+tip+'"' + val.name + '"?').then(function() {
|
||||
return groupOrderStatusSet({ id: val.id, status: status})
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("操作成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
handleCancel() {
|
||||
this.$refs.orderGroupAdd.formClear()
|
||||
this.centervisible = false
|
||||
this.addOrEditTitle = ''
|
||||
},
|
||||
handleConfirm() {
|
||||
this.$refs.orderGroupAdd.submitForm()
|
||||
},
|
||||
successSubmit() {
|
||||
this.handleCancel()
|
||||
this.getList()
|
||||
},
|
||||
// 下发新增
|
||||
addWorkOrderCancel() {
|
||||
this.$refs.bindOrder.formClear()
|
||||
this.addWorkOrdervisible = false
|
||||
},
|
||||
addWorkOrderConfirm() {
|
||||
this.$refs.bindOrder.addWorkOrderSubmit()
|
||||
},
|
||||
addWorkOrderSubmit() {
|
||||
this.addWorkOrderCancel()
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user