|
@@ -0,0 +1,531 @@
|
|
|
+<template>
|
|
|
+ <div>
|
|
|
+ <by-bill :propConfig="config" @search="search" @onSmt="doSave" ref="bill" @onAdd="onAdd" @onOrder="onOrder"
|
|
|
+ @resert="resert" @clickHandle="clickHandle" @detail="openEdit">
|
|
|
+ </by-bill>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script lang="ts">
|
|
|
+ import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
|
+ import api from "@/api/order";
|
|
|
+ import Assembly from "@/benyun/components/Assembly/order.vue";
|
|
|
+ @Component
|
|
|
+ export default class OrderTask extends Vue {
|
|
|
+ // 右边
|
|
|
+ baseURL : any = process.env.VUE_APP_BASE_API
|
|
|
+ setStatusData : any = ''
|
|
|
+ timeNum = 0;
|
|
|
+ timer : any = null
|
|
|
+ config : any = {
|
|
|
+ attr: {
|
|
|
+ activeName: 'all'
|
|
|
+ },
|
|
|
+ // 单据
|
|
|
+ bill: {
|
|
|
+ tool: {
|
|
|
+ // tools: {
|
|
|
+ // smt: true,
|
|
|
+ // },
|
|
|
+ customTools: [
|
|
|
+ {
|
|
|
+ name: '拆单', icon: 'el-icon-plus', audit: [''], event: {
|
|
|
+ click: () => {
|
|
|
+ // (this as any).orderTaking()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ form: {
|
|
|
+ attr: {
|
|
|
+ size: 'small',
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '机构名称',
|
|
|
+ prop: 'organizationName',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '单据编号',
|
|
|
+ slot: true,
|
|
|
+ prop: 'orderNumber',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '机构',
|
|
|
+ slot: true,
|
|
|
+ prop: 'organizationId',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '交货地点',
|
|
|
+ slot: true,
|
|
|
+ prop: 'deliveryAddress',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '交货时间',
|
|
|
+ slot: true,
|
|
|
+ prop: 'deliveryData',
|
|
|
+ component: 'by-date-picker',
|
|
|
+ compConfig: {
|
|
|
+ format: 'yyyy-MM-dd',
|
|
|
+ type: 'datetime'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '交货人',
|
|
|
+ slot: true,
|
|
|
+ prop: 'delivery',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '联系方式',
|
|
|
+ slot: true,
|
|
|
+ prop: 'deliveryPhone',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '交货方式',
|
|
|
+ slot: true,
|
|
|
+ prop: 'deliveryWay',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '备注',
|
|
|
+ slot: true,
|
|
|
+ prop: 'remark',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 综合
|
|
|
+ all: {
|
|
|
+ search: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '机构名称',
|
|
|
+ prop: 'organizationName',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入机构名称',
|
|
|
+ clearable: true
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '单据编号',
|
|
|
+ prop: 'orderNumber',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入单据编号',
|
|
|
+ clearable: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '交货地点',
|
|
|
+ prop: 'deliveryAddress',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入交货地点',
|
|
|
+ clearable: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '交货人',
|
|
|
+ prop: 'delivery',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入交货人',
|
|
|
+ clearable: true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '交货时间',
|
|
|
+ prop: 'deliveryData',
|
|
|
+ component: 'by-date-picker',
|
|
|
+ compConfig: {
|
|
|
+ format: 'yyyy-MM-dd',
|
|
|
+ type: 'datetime'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ tool: {
|
|
|
+ tools: {
|
|
|
+ // export: true,
|
|
|
+ search: true,
|
|
|
+ refresh: true
|
|
|
+ },
|
|
|
+ customTools: [
|
|
|
+ {
|
|
|
+ name: '拆单', icon: 'el-icon-plus', audit: [''], event: {
|
|
|
+ click: () => {
|
|
|
+ // (this as any).orderTaking()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ attr: {
|
|
|
+ height: 600,
|
|
|
+ size: 'mini',
|
|
|
+ seq: true,
|
|
|
+ align: 'center',
|
|
|
+ checkbox: true
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 200,
|
|
|
+ title: '机构名称',
|
|
|
+ field: 'organizationName',
|
|
|
+ isDetail: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 180,
|
|
|
+ title: '单据编号',
|
|
|
+ field: 'orderNumber',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 200,
|
|
|
+ title: '交货地点',
|
|
|
+ field: 'deliveryAddress',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '交货时间',
|
|
|
+ field: 'deliveryData',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '交货人',
|
|
|
+ field: 'delivery',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '交货人联系方式',
|
|
|
+ field: 'deliveryPhone',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '交货方式',
|
|
|
+ field: 'deliveryWay',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: '备注',
|
|
|
+ field: 'remark',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 110,
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ icon: 'el-icon-edit',
|
|
|
+ name: '查看',
|
|
|
+ audit: '',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => {
|
|
|
+ (this as any).openEdit(item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ name: '拆单',
|
|
|
+ event: {
|
|
|
+ // click: (item : any) => (this as any).getOrder(item)
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 回收站
|
|
|
+ // recycleBin: {
|
|
|
+ // search: {
|
|
|
+ // attr: {
|
|
|
+ // size: 'mini',
|
|
|
+ // },
|
|
|
+ // columns: [
|
|
|
+ // [
|
|
|
+ // {
|
|
|
+ // span: 6,
|
|
|
+ // label: '机构名称',
|
|
|
+ // prop: 'organizationName',
|
|
|
+ // component: 'by-input',
|
|
|
+ // compConfig: {
|
|
|
+ // attr: {
|
|
|
+ // placeholder: '请输入机构名称',
|
|
|
+ // clearable: true
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // span: 6,
|
|
|
+ // label: '单据编号',
|
|
|
+ // prop: 'orderNumber',
|
|
|
+ // component: 'by-input',
|
|
|
+ // compConfig: {
|
|
|
+ // attr: {
|
|
|
+ // placeholder: '请输入单据编号',
|
|
|
+ // clearable: true
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // span: 6,
|
|
|
+ // label: '交货地点',
|
|
|
+ // prop: 'deliveryAddress',
|
|
|
+ // component: 'by-input',
|
|
|
+ // compConfig: {
|
|
|
+ // attr: {
|
|
|
+ // placeholder: '请输入交货地点',
|
|
|
+ // clearable: true
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
+ // [
|
|
|
+ // {
|
|
|
+ // span: 6,
|
|
|
+ // label: '交货人',
|
|
|
+ // prop: 'delivery',
|
|
|
+ // 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'
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // ]
|
|
|
+ // ]
|
|
|
+ // },
|
|
|
+ // table: {
|
|
|
+ // attr: {
|
|
|
+ // height: 600,
|
|
|
+ // size: 'mini',
|
|
|
+ // seq: true,
|
|
|
+ // align: 'center',
|
|
|
+ // checkbox: true
|
|
|
+ // },
|
|
|
+ // columns: [
|
|
|
+ // {
|
|
|
+ // width: 70,
|
|
|
+ // title: '单据编号',
|
|
|
+ // field: 'orderNumber',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // width: 200,
|
|
|
+ // title: '机构名称',
|
|
|
+ // field: 'organizationName',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // width: 200,
|
|
|
+ // title: '交货地点',
|
|
|
+ // field: 'deliveryAddress',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // width: 150,
|
|
|
+ // title: '交货时间',
|
|
|
+ // field: 'deliveryData',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // title: '交货人',
|
|
|
+ // field: 'delivery',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // title: '交货人联系方式',
|
|
|
+ // field: 'deliveryPhone',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // title: '交货方式',
|
|
|
+ // field: 'deliveryWay',
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // title: '备注',
|
|
|
+ // field: 'remark',
|
|
|
+ // },
|
|
|
+ // ]
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ created() {
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ this.getDataList()
|
|
|
+ }, 500)
|
|
|
+ }
|
|
|
+ // 工具栏方法
|
|
|
+ clickHandle(e : any) {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ // 保存新增
|
|
|
+ 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();
|
|
|
+ // query.suborderList = [] // 子表单数据
|
|
|
+ query.status = 0; // 默认未接单
|
|
|
+ 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.failHandle(res)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 保存修改
|
|
|
+ orderTaking() {
|
|
|
+ let query : any = (this as any).$refs.bill.$refs.billForm.getValue();
|
|
|
+ api.updateList(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.failHandle(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ getDataList() {
|
|
|
+ if (!this.$refs.bill) {
|
|
|
+ if (this.timeNum > 5) {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ }
|
|
|
+ this.timeNum++;
|
|
|
+ return
|
|
|
+ }
|
|
|
+ clearInterval(this.timer)
|
|
|
+ // submitState: 提交状态
|
|
|
+ this.getPageList({}, 'all'); // 综合数据
|
|
|
+ // recycleBin
|
|
|
+ // this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
|
|
|
+ // this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
|
|
|
+ // this.getSelectDeleteList('supplyPurchaseOrder') // 回收站数据
|
|
|
+ }
|
|
|
+ // 获取分页数据
|
|
|
+ getPageList(query : any, type : any) {
|
|
|
+ api.pageList(query, 'supplyPurchaseOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ (this.$refs.bill as any).setTabTableValue(type, res.data.records);
|
|
|
+ let page = {
|
|
|
+ pageNo: res.data.current, //当前页
|
|
|
+ pageSize: res.data.size, //每页条数
|
|
|
+ total: res.data.total //总条数
|
|
|
+ };
|
|
|
+ (this.$refs.bill as any).setTablePage(type, page)
|
|
|
+ } else this.failHandle(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 回收站数据
|
|
|
+ getSelectDeleteList(url:any){
|
|
|
+ api.selectDeleteList(url).then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ (this.$refs.bill as any).setTabTableValue('recycleBin', res.data);
|
|
|
+ let page = {
|
|
|
+ pageNo: res.data.current, //当前页
|
|
|
+ pageSize: res.data.size, //每页条数
|
|
|
+ total: res.data.total //总条数
|
|
|
+ };
|
|
|
+ (this.$refs.bill as any).setTablePage('recycleBin', page)
|
|
|
+ } else this.failHandle(res)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 打开新增
|
|
|
+ onAdd(e : any) {
|
|
|
+ console.log(e);
|
|
|
+ // this.orderType = '新增';
|
|
|
+ (this.$refs.bill as any).setBillFormValue({}); // 设置单据表单数据
|
|
|
+ (this.$refs.bill as any).showTab = 'bill';
|
|
|
+ }
|
|
|
+ // 打开编辑
|
|
|
+ openEdit(e : any) {
|
|
|
+ console.log(e);
|
|
|
+ e = e.row ? e.row : e;
|
|
|
+ // this.orderType = '编辑';
|
|
|
+ (this.$refs.bill as any).setBillFormValue(e); // 设置单据表单数据
|
|
|
+ (this.$refs.bill as any).showTab = 'bill';
|
|
|
+ }
|
|
|
+ // 搜索
|
|
|
+ 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) // 获取分页数据
|
|
|
+ }
|
|
|
+ // 接单
|
|
|
+ getOrder(item : any) {
|
|
|
+ api.ordersaccepting({ ids: item.id }, 'supplyPurchaseOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ // 是否跳转销售订单 this.$router.push()
|
|
|
+ this.getDataList();
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '接单成功!'
|
|
|
+ });
|
|
|
+ } else this.failHandle(res)
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+ resert(parames : any) {
|
|
|
+ console.log('重置回传参数', parames);
|
|
|
+ }
|
|
|
+ // 工具栏接单
|
|
|
+ onOrder(n : string) {
|
|
|
+ console.log(n + ':工具栏执行操作onOrder')
|
|
|
+ }
|
|
|
+ // 运行错误
|
|
|
+ failHandle(err : any) {
|
|
|
+ let msg = err.msg ? err.msg : '运行错误!';
|
|
|
+ this.$message.error(msg)
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|