|
@@ -1,6 +1,6 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
- <by-bill :propConfig="config" @search="search" @onSmt="doSave" ref="bill" @resert="resert" @detail="openEdit"
|
|
|
+ <by-bill :propConfig="config" @search="search" ref="bill" @resert="resert" @detail="openEdit"
|
|
|
@onRefresh="resert" @pagination="pagination" @clickTab="clickTab">
|
|
|
</by-bill>
|
|
|
<vxe-modal v-model="vxeValue" width="70%" height="70%" min-width="800" min-height="600" show-zoom resize transfer
|
|
@@ -33,9 +33,11 @@
|
|
|
import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
|
import api from "@/api/order";
|
|
|
import OrderType from "./components/orderType.vue";
|
|
|
+ import Assembly from "@/components/Assembly/saleOrder.vue";
|
|
|
@Component
|
|
|
export default class OrderTask extends Vue {
|
|
|
vxeValue = false
|
|
|
+ isCitation = false
|
|
|
timeNum = 0;
|
|
|
timer : any = null
|
|
|
baseInfo : any = {} // 订单数据
|
|
@@ -102,6 +104,122 @@
|
|
|
attr: {
|
|
|
activeName: 'all'
|
|
|
},
|
|
|
+ // 引单
|
|
|
+ source: [
|
|
|
+ {
|
|
|
+ title: '订单任务',
|
|
|
+ search: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '单据编号',
|
|
|
+ prop: 'orderNumber',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入单据编号',
|
|
|
+ clearable: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '机构名称',
|
|
|
+ prop: 'organizationName',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入机构名称',
|
|
|
+ clearable: true
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '交货时间',
|
|
|
+ prop: 'deliveryData',
|
|
|
+ component: 'by-date-picker',
|
|
|
+ compConfig: {
|
|
|
+ format: 'yyyy-MM-dd hh:ss:mm',
|
|
|
+ type: 'datetime'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ tool: {
|
|
|
+ tools: {
|
|
|
+ search: true,
|
|
|
+ refresh: true
|
|
|
+ },
|
|
|
+ customTools: [
|
|
|
+ {
|
|
|
+ name: '引单', icon: 'el-icon-bottom', audit: [''], event: {
|
|
|
+ click: () => {
|
|
|
+ (this as any).citationOrder()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ attr: {
|
|
|
+ height: 620,
|
|
|
+ size: 'mini',
|
|
|
+ seq: true,
|
|
|
+ align: 'left',
|
|
|
+ radio: true
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 160,
|
|
|
+ title: '单据编号',
|
|
|
+ field: 'orderNumber',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '机构名称',
|
|
|
+ field: 'organizationName',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 80,
|
|
|
+ title: '来源类型',
|
|
|
+ field: 'sourceType',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '交货人',
|
|
|
+ field: 'delivery',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '交货时间',
|
|
|
+ field: 'deliveryData',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 200,
|
|
|
+ title: '交货地点',
|
|
|
+ field: 'deliveryAddress',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 130,
|
|
|
+ title: '联系方式',
|
|
|
+ field: 'deliveryPhone',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 130,
|
|
|
+ title: '交货方式',
|
|
|
+ field: 'deliveryWay',
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ],
|
|
|
// 单据
|
|
|
bill: {
|
|
|
tool: {
|
|
@@ -329,6 +447,12 @@
|
|
|
title: '交货地点',
|
|
|
field: 'address',
|
|
|
},
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '状态',
|
|
|
+ field: 'status',
|
|
|
+ component: Assembly,
|
|
|
+ },
|
|
|
{
|
|
|
width: 110,
|
|
|
title: '操作',
|
|
@@ -445,6 +569,12 @@
|
|
|
title: '交货地点',
|
|
|
field: 'address',
|
|
|
},
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '状态',
|
|
|
+ field: 'status',
|
|
|
+ component: Assembly,
|
|
|
+ },
|
|
|
{
|
|
|
width: 110,
|
|
|
title: '操作',
|
|
@@ -470,6 +600,30 @@
|
|
|
this.getDataList()
|
|
|
}, 500)
|
|
|
}
|
|
|
+ // 引单
|
|
|
+ citationOrder() {
|
|
|
+ let data : any = (this as any).$refs.bill.getSourceTableSelectData(0);
|
|
|
+ console.log(data);
|
|
|
+ if (data.length <= 0) return this.$message.warning('请选择引单数据');
|
|
|
+ data = data.map((item : any) => {
|
|
|
+ item.address = item.deliveryAddress
|
|
|
+ item.consignee = item.delivery
|
|
|
+ item.phone = item.deliveryPhone
|
|
|
+ item.planDeliveryData = item.deliveryData
|
|
|
+ const { ...newData } = item
|
|
|
+ return newData
|
|
|
+ })
|
|
|
+ let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
+ billConfig.tool.tools = { save: true };
|
|
|
+ billConfig.tool.customTools = [];
|
|
|
+ this.isCitation = true;
|
|
|
+ (this.$refs.bill as any).showTab = 'bill';
|
|
|
+ setTimeout(() => {
|
|
|
+ (this.$refs.bill as any).setBillConfig(billConfig);
|
|
|
+ (this.$refs.bill as any).setBillFormValue(data[0]); // 设置单据表单数据
|
|
|
+ (this.$refs.bill as any).setBillTableValue(data[0].suborderList, 0);// 设置第1张单据表格数据
|
|
|
+ }, 0)
|
|
|
+ };
|
|
|
// 右拆单数据变化
|
|
|
rightChange(e : any) {
|
|
|
console.log(e.number);
|
|
@@ -522,33 +676,22 @@
|
|
|
splitList: rifhtNewData,
|
|
|
};
|
|
|
if (isTrue.length > 0) {
|
|
|
- api.splitOrder(obj, 'supplyPurchaseOrder').then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$message.success('拆单成功!');
|
|
|
- this.getPageList({}, 'all'); // 综合数据
|
|
|
- this.vxeValue = false;
|
|
|
- } else this.$message.error(res.msg);
|
|
|
- })
|
|
|
+ this.$confirm('确定拆单吗!', '注意', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ api.splitOrder(obj, 'supplyPurchaseOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success('拆单成功!');
|
|
|
+ this.getPageList({}, 'all'); // 综合数据
|
|
|
+ this.vxeValue = false;
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
+ })
|
|
|
+ }).catch(() => this.$message.info('已取消拆单'));
|
|
|
} else this.$message.warning('请输入拆单销售数据');
|
|
|
}
|
|
|
- // 保存新增
|
|
|
- doSave() {
|
|
|
- // (this.$refs.product as any).setShow(true)
|
|
|
- (this as any).$refs.bill.$refs.billForm.validate().then(() => {
|
|
|
- let query = (this as any).$refs.bill.$refs.billForm.getValue();
|
|
|
- api.saveList(query, 'supplyPurchaseOrder').then((res : any) => {
|
|
|
- if (res.code === 200) {
|
|
|
- this.$message({
|
|
|
- type: 'success',
|
|
|
- message: '提交成功!'
|
|
|
- });
|
|
|
- this.getDataList();
|
|
|
- (this.$refs.bill as any).showTab = 'all';
|
|
|
- (this.$refs.bill as any).setBillFormValue({});
|
|
|
- } else this.$message.error(res.msg);
|
|
|
- })
|
|
|
- })
|
|
|
- }
|
|
|
getDataList() {
|
|
|
if (!this.$refs.bill) {
|
|
|
if (this.timeNum > 5) {
|
|
@@ -574,11 +717,29 @@
|
|
|
} else this.$message.error(res.msg);
|
|
|
})
|
|
|
}
|
|
|
+ // 获取引单分页数据
|
|
|
+ getCitationList(query : any) {
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
+ query.submitState = 1; // 已提交
|
|
|
+ query.status = 0; // 未接单
|
|
|
+ api.pageList(query, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ (this.$refs.bill as any).setSourceTableData(0, res.data.records);
|
|
|
+ let page = {
|
|
|
+ pageNo: res.data.current, //当前页
|
|
|
+ pageSize: res.data.size, //每页条数
|
|
|
+ total: res.data.total //总条数
|
|
|
+ };
|
|
|
+ loading.close();
|
|
|
+ (this.$refs.bill as any).setSourcePage(0, page);
|
|
|
+ } else this.$message.error(res.msg)
|
|
|
+ })
|
|
|
+ }
|
|
|
// 打开编辑
|
|
|
openEdit(e : any) {
|
|
|
e = e.row ? e.row : e;
|
|
|
let loading = this.$loading({ target: '.main-container' });
|
|
|
- api.single({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
|
|
|
+ api.single({ id: e.id }, 'supplyPurchaseOrder').then((res : any) => {
|
|
|
if (res.code === 200) {
|
|
|
let parentData = res.data ? res.data : e;
|
|
|
let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
@@ -592,7 +753,7 @@
|
|
|
}
|
|
|
},
|
|
|
];
|
|
|
- } else {
|
|
|
+ } else if (parentData.status != 2) {
|
|
|
billConfig.tool.customTools = [
|
|
|
{
|
|
|
name: '终止订单', icon: 'el-icon-bottom', audit: [''], event: {
|
|
@@ -643,6 +804,10 @@
|
|
|
// 导航切换
|
|
|
clickTab(e : any) {
|
|
|
console.log('导航切换 ==> ', e);
|
|
|
+ // submitState: 提交状态
|
|
|
+ if (e === 'source') {
|
|
|
+ this.getCitationList({});
|
|
|
+ }
|
|
|
if (e === 'all') this.getDataList();
|
|
|
if (e === 'bill') {
|
|
|
let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
@@ -688,15 +853,24 @@
|
|
|
// 搜索
|
|
|
search(parames : any) {
|
|
|
let query = parames.value
|
|
|
- if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
|
|
|
- if (parames.type === 'smt') query.submitState = 1 // 已提交数据
|
|
|
- this.getPageList(query, parames.type) // 获取综合分页数据
|
|
|
+ if (parames.type === 'source_0') {
|
|
|
+ this.getCitationList(query);
|
|
|
+ } else {
|
|
|
+ if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
|
|
|
+ if (parames.type === 'smt') query.submitState = 1 // 已提交数据
|
|
|
+ this.getPageList(query, parames.type) // 获取综合分页数据
|
|
|
+ }
|
|
|
}
|
|
|
// 刷新/重置
|
|
|
resert(e : any) {
|
|
|
let data : any = e.type ? e.type : e;
|
|
|
- (this as any).$refs.bill.$refs[data].clearSearch();
|
|
|
- if (data === 'all') this.getPageList({}, 'all'); // 综合数据
|
|
|
+ if (data === 'source_0') {
|
|
|
+ (this as any).$refs.bill.$refs.source_0[0].clearSearch();
|
|
|
+ this.getCitationList({});
|
|
|
+ } else {
|
|
|
+ (this as any).$refs.bill.$refs[data].clearSearch();
|
|
|
+ if (data === 'all') this.getPageList({}, 'all'); // 综合数据
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|