|
@@ -1,8 +1,983 @@
|
|
|
<template>
|
|
|
+ <div>
|
|
|
+ <by-bill ref="bill" :propConfig="config" @search="search" @onAdd="onAdd" @onDelete="onDelete" @onRefresh="onRefresh"
|
|
|
+ @detail="openEdit" @onSave="onSave" @clickTab="clickTab" @onChangeRow="onChangeRow" @pagination="pagination"
|
|
|
+ @getSupplierModal="getSupplierModal">
|
|
|
+ </by-bill>
|
|
|
+ <!-- 选择物料 -->
|
|
|
+ <productModal ref="product" :mulit="true" />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
-<script>
|
|
|
-</script>
|
|
|
+<script lang="ts">
|
|
|
+ import { Component, Prop, Vue, Watch } from "vue-property-decorator";
|
|
|
+ import api from "@/api/order";
|
|
|
+ import productModal from "./components/productModal.vue";
|
|
|
+ import Focus from "./components/focus.vue";
|
|
|
+ @Component({ components: { productModal } })
|
|
|
+ export default class OrderTask extends Vue {
|
|
|
+ // 左边
|
|
|
+ tabType : any = 'all';
|
|
|
+ isAdd : any = false
|
|
|
+ // 右边
|
|
|
+ supplierInfo : any = {} // 机构信息
|
|
|
+ tableData : any = []
|
|
|
+ mergeObj : any = []
|
|
|
+ setStatusData : any = ''
|
|
|
+ timeNum = 0;
|
|
|
+ timer : any = null
|
|
|
+ config : any = {
|
|
|
+ attr: {
|
|
|
+ activeName: 'all'
|
|
|
+ },
|
|
|
+ // 单据
|
|
|
+ bill: {
|
|
|
+ tool: {
|
|
|
+ tools: {
|
|
|
+ save: true,
|
|
|
+ }
|
|
|
+ },
|
|
|
+ form: {
|
|
|
+ attr: {
|
|
|
+ size: 'small',
|
|
|
+ readonly: false,
|
|
|
+ rules: {
|
|
|
+ outOrderNo: [{
|
|
|
+ required: true, message: '请输入单据编号', trigger: 'blur'
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '单据编号',
|
|
|
+ prop: 'outOrderNo',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '机构名称',
|
|
|
+ prop: 'organizationName',
|
|
|
+ component: Focus,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: '经办人',
|
|
|
+ prop: 'operator',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ span: 8,
|
|
|
+ label: 'WMS编号',
|
|
|
+ prop: 'wmsId',
|
|
|
+ component: 'by-input',
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 28,
|
|
|
+ label: '备注',
|
|
|
+ slot: true,
|
|
|
+ prop: 'remark',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ placeholder: '请输入备注',
|
|
|
+ type: 'textarea'
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ tableConfig: [
|
|
|
+ {
|
|
|
+ tool: {
|
|
|
+ tools: {
|
|
|
+ add: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ height: 500,
|
|
|
+ align: 'center',
|
|
|
+ readonly: true
|
|
|
+ },
|
|
|
+ columns:
|
|
|
+ [{
|
|
|
+ width: 300,
|
|
|
+ title: '物料名称',
|
|
|
+ field: 'materialName',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 140,
|
|
|
+ title: '单位',
|
|
|
+ field: 'unit',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 140,
|
|
|
+ title: '数量',
|
|
|
+ field: 'number',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ type: 'number',
|
|
|
+ defaultValue: 1,
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 140,
|
|
|
+ title: '已交付数量',
|
|
|
+ field: 'deliveryNumber',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 140,
|
|
|
+ title: '单价',
|
|
|
+ field: 'unitPrice',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ type: 'number',
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 140,
|
|
|
+ title: '实际金额',
|
|
|
+ field: 'realityPrice',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 140,
|
|
|
+ title: '优惠金额',
|
|
|
+ field: 'prePrice',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ type: 'number',
|
|
|
+ defaultValue: '0',
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 140,
|
|
|
+ title: '合计金额',
|
|
|
+ field: 'totalPrice',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 90,
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ icon: 'el-icon-delete',
|
|
|
+ name: '删除',
|
|
|
+ audit: '',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => {
|
|
|
+ (this as any).changeTable(item)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ // 已提交
|
|
|
+ smt: {
|
|
|
+ search: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '单据编号',
|
|
|
+ prop: 'outOrderNo',
|
|
|
+ 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: 'financeOrderId',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入财务系统单据',
|
|
|
+ clearable: true
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ tool: {
|
|
|
+ tools: {
|
|
|
+ delete: true,
|
|
|
+ search: true,
|
|
|
+ refresh: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ attr: {
|
|
|
+ height: 620,
|
|
|
+ size: 'mini',
|
|
|
+ seq: true,
|
|
|
+ align: 'center',
|
|
|
+ checkbox: true
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '单据编号',
|
|
|
+ field: 'outOrderNo',
|
|
|
+ isDetail: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 200,
|
|
|
+ title: '机构名称',
|
|
|
+ field: 'organizationName',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '财务系统单据',
|
|
|
+ field: 'financeOrderId',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: 'WMS编号',
|
|
|
+ field: 'wmsId',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '经办人',
|
|
|
+ field: 'operator',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '收货人',
|
|
|
+ field: 'receive',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '收货地址',
|
|
|
+ field: 'receiveAddress',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '联系方式',
|
|
|
+ field: 'receivePhone',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 110,
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ icon: 'el-icon-edit',
|
|
|
+ name: '编辑',
|
|
|
+ audit: '',
|
|
|
+ event: {
|
|
|
+ click: (e : any) => {
|
|
|
+ (this as any).setReadonly(e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ name: '删除',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => (this as any).doDelete2(item)
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 草稿箱
|
|
|
+ draftsBox: {
|
|
|
+ search: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '单据编号',
|
|
|
+ prop: 'outOrderNo',
|
|
|
+ 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: 'financeOrderId',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入财务系统单据',
|
|
|
+ clearable: true
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ tool: {
|
|
|
+ tools: {
|
|
|
+ smt: true,
|
|
|
+ delete: true,
|
|
|
+ search: true,
|
|
|
+ refresh: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ attr: {
|
|
|
+ height: 620,
|
|
|
+ size: 'mini',
|
|
|
+ seq: true,
|
|
|
+ align: 'center',
|
|
|
+ checkbox: true
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '单据编号',
|
|
|
+ field: 'outOrderNo',
|
|
|
+ isDetail: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 200,
|
|
|
+ title: '机构名称',
|
|
|
+ field: 'organizationName',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '财务系统单据',
|
|
|
+ field: 'financeOrderId',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: 'WMS编号',
|
|
|
+ field: 'wmsId',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '经办人',
|
|
|
+ field: 'operator',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '收货人',
|
|
|
+ field: 'receive',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '收货地址',
|
|
|
+ field: 'receiveAddress',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '联系方式',
|
|
|
+ field: 'receivePhone',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 110,
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ icon: 'el-icon-edit',
|
|
|
+ name: '编辑',
|
|
|
+ audit: '',
|
|
|
+ event: {
|
|
|
+ click: (e : any) => {
|
|
|
+ (this as any).openEdit(e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ name: '删除',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => (this as any).doDelete2(item)
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 综合
|
|
|
+ all: {
|
|
|
+ search: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '单据编号',
|
|
|
+ prop: 'outOrderNo',
|
|
|
+ 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: 'financeOrderId',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入财务系统单据',
|
|
|
+ clearable: true
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ tool: {
|
|
|
+ tools: {
|
|
|
+ delete: true,
|
|
|
+ search: true,
|
|
|
+ refresh: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ attr: {
|
|
|
+ height: 620,
|
|
|
+ size: 'mini',
|
|
|
+ seq: true,
|
|
|
+ align: 'center',
|
|
|
+ checkbox: true
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '单据编号',
|
|
|
+ field: 'outOrderNo',
|
|
|
+ isDetail: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 200,
|
|
|
+ title: '机构名称',
|
|
|
+ field: 'organizationName',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '财务系统单据',
|
|
|
+ field: 'financeOrderId',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: 'WMS编号',
|
|
|
+ field: 'wmsId',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '经办人',
|
|
|
+ field: 'operator',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '收货人',
|
|
|
+ field: 'receive',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '收货地址',
|
|
|
+ field: 'receiveAddress',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '联系方式',
|
|
|
+ field: 'receivePhone',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ icon: 'el-icon-edit',
|
|
|
+ name: '编辑',
|
|
|
+ audit: '',
|
|
|
+ event: {
|
|
|
+ click: (e : any) => {
|
|
|
+ (this as any).openEdit(e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, {
|
|
|
+ name: '删除',
|
|
|
+ event: {
|
|
|
+ click: (item : any) => (this as any).doDelete2(item)
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 回收站
|
|
|
+ recycleBin: {
|
|
|
+ search: {
|
|
|
+ attr: {
|
|
|
+ size: 'mini',
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ [
|
|
|
+ {
|
|
|
+ span: 6,
|
|
|
+ label: '单据编号',
|
|
|
+ prop: 'outOrderNo',
|
|
|
+ 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: 'financeOrderId',
|
|
|
+ component: 'by-input',
|
|
|
+ compConfig: {
|
|
|
+ attr: {
|
|
|
+ placeholder: '请输入财务系统单据',
|
|
|
+ clearable: true
|
|
|
+ },
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ],
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ tool: {
|
|
|
+ tools: {
|
|
|
+ search: true,
|
|
|
+ refresh: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ attr: {
|
|
|
+ height: 620,
|
|
|
+ size: 'mini',
|
|
|
+ seq: true,
|
|
|
+ align: 'center',
|
|
|
+ checkbox: true
|
|
|
+ },
|
|
|
+ columns: [
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '单据编号',
|
|
|
+ field: 'outOrderNo',
|
|
|
+ isDetail: true,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 200,
|
|
|
+ title: '机构名称',
|
|
|
+ field: 'organizationName',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: '财务系统单据',
|
|
|
+ field: 'financeOrderId',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 150,
|
|
|
+ title: 'WMS编号',
|
|
|
+ field: 'wmsId',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '经办人',
|
|
|
+ field: 'operator',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '收货人',
|
|
|
+ field: 'receive',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '收货地址',
|
|
|
+ field: 'receiveAddress',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 120,
|
|
|
+ title: '联系方式',
|
|
|
+ field: 'receivePhone',
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 110,
|
|
|
+ title: '操作',
|
|
|
+ action: true,
|
|
|
+ plugins: [{
|
|
|
+ // icon: 'el-icon-edit',
|
|
|
+ name: '查看',
|
|
|
+ audit: '',
|
|
|
+ event: {
|
|
|
+ click: (e : any) => {
|
|
|
+ (this as any).setReadonly(e)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
|
|
|
-<style>
|
|
|
-</style>
|
|
|
+ }
|
|
|
+ }
|
|
|
+ created() {
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ this.getDataList()
|
|
|
+ }, 500)
|
|
|
+ }
|
|
|
+ // 获取机构数据
|
|
|
+ getSupplierModal(e : any) {
|
|
|
+ this.supplierInfo = e;
|
|
|
+ }
|
|
|
+ // 监听表格数据变化
|
|
|
+ onChangeRow(e : any) {
|
|
|
+ console.log(e);
|
|
|
+ }
|
|
|
+ // 保存
|
|
|
+ onSave(e : any) {
|
|
|
+ console.log('保存 ==>', this.tabType);
|
|
|
+ (this as any).$refs.bill.$refs.billForm.validate().then(() => {
|
|
|
+ let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
|
|
|
+ // 供应商数据
|
|
|
+ if (!query.organizationName) query.organizationName = this.supplierInfo.name;
|
|
|
+ if (!query.organizationId) query.organizationId = this.supplierInfo.id;
|
|
|
+ if (!query.organizationName) return this.$message.warning('请选择机构名称');
|
|
|
+ // 子表数据
|
|
|
+ query.suborderList = this.tableData;
|
|
|
+ if (query.suborderList.length > 0) {
|
|
|
+ query.suborderList.map((v : any) => {
|
|
|
+ v.taskOrderId = query.id
|
|
|
+ })
|
|
|
+ };
|
|
|
+ // 表格删除
|
|
|
+ query.suborderList.map((v : any, i : any) => {
|
|
|
+ if (v.isDeleted === 1 && !v.id) {
|
|
|
+ v.splice(i, 1)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (query.deliveryData) query.deliveryData = query.deliveryData + ' 00:00:00';
|
|
|
+ console.log('保存参数query ==> ', query);
|
|
|
+
|
|
|
+ if (this.isAdd) {
|
|
|
+ query.submitState = 0
|
|
|
+ console.log('保存进草稿箱 ==>', query);
|
|
|
+ api.saveList(query, 'supplyOutOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(res.msg);
|
|
|
+ this.getDataList();
|
|
|
+ (this.$refs.bill as any).showTab = 'all';
|
|
|
+ (this.$refs.bill as any).setBillFormValue({});
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
+ })
|
|
|
+ } else if (this.tabType === 'all' || this.tabType === 'draftsBox') {
|
|
|
+ if (this.tabType === 'draftsBox') query.submitState = 0;
|
|
|
+ console.log('保存 ==>', query);
|
|
|
+ api.updateList(query, 'supplyOutOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.$message.success(res.msg);
|
|
|
+ this.getDataList();
|
|
|
+ (this.$refs.bill as any).showTab = 'all';
|
|
|
+ (this.$refs.bill as any).setBillFormValue({});
|
|
|
+ } else this.$message.error(res.msg);
|
|
|
+ })
|
|
|
+ };
|
|
|
+ })
|
|
|
+ }
|
|
|
+ // 打开新增
|
|
|
+ onAdd(e : any) {
|
|
|
+ console.log('新增 ==>', e);
|
|
|
+ if (e === 'billTable_0') {
|
|
|
+ (this.$refs.product as any).setShow(true); // 打开sku弹窗
|
|
|
+ let obj = (this.$refs.bill as any).getBillFormValue();
|
|
|
+ if (!this.tableData) this.tableData = obj.suborderList;
|
|
|
+ console.log('this.tableData ==> ', this.tableData);
|
|
|
+ (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
|
|
|
+ } else {
|
|
|
+ let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
+ billConfig.form.attr.readonly = false; // 设置只读
|
|
|
+ billConfig.tool.tools = { save: true, };
|
|
|
+ if (e === 'all') {
|
|
|
+ billConfig.tool.tools = { save: true, smt: true };
|
|
|
+ this.tableData = [];
|
|
|
+ (this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
|
|
|
+ }
|
|
|
+ billConfig.tableConfig[0].tool.tools = { add: true };
|
|
|
+ this.isAdd = true;
|
|
|
+ (this.$refs.bill as any).setBillConfig(billConfig);
|
|
|
+ (this.$refs.bill as any).setBillFormValue({}); // 设置单据表单数据
|
|
|
+ };
|
|
|
+ (this.$refs.bill as any).showTab = 'bill';
|
|
|
+ }
|
|
|
+ // 打开编辑
|
|
|
+ openEdit(e : any) {
|
|
|
+ console.log('编辑this.tabType ==>', this.tabType);
|
|
|
+ if (this.tabType === 'all' || this.tabType === 'draftsBox') {
|
|
|
+ e = e.row ? e.row : e;
|
|
|
+ console.log('编辑 ==>', e);
|
|
|
+ if (this.tabType === 'all' && e.submitState === 1) return this.setReadonly(e);
|
|
|
+ let data = e.suborderList
|
|
|
+ data.map((v : any, i : any) => {
|
|
|
+ v.dataIndex = i
|
|
|
+ });
|
|
|
+ let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
+ billConfig.form.attr.readonly = false; // 设置只读
|
|
|
+ billConfig.tool.tools = { save: true, };
|
|
|
+ if (this.tabType === 'draftsBox' || e.submitState === 0) billConfig.tool.tools = { save: true, smt: true };
|
|
|
+ billConfig.tableConfig[0].tool.tools = { add: true };
|
|
|
+ this.tableData = data;
|
|
|
+ (this.$refs.bill as any).setBillConfig(billConfig);
|
|
|
+ (this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
|
|
|
+ (this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
|
|
|
+ this.isAdd = false;
|
|
|
+ (this.$refs.bill as any).showTab = 'bill';
|
|
|
+ } else {
|
|
|
+ this.setReadonly(e.row ? e.row : e);
|
|
|
+ };
|
|
|
+ }
|
|
|
+ // 设置只读
|
|
|
+ setReadonly(e : any) {
|
|
|
+ let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
|
|
|
+ readonly.form.attr.readonly = true; // 设置只读
|
|
|
+ readonly.tool.tools = {};
|
|
|
+ readonly.tableConfig[0].table.columns = readonly.tableConfig[0].table.columns.filter((v : any) => v.title != '操作');
|
|
|
+ readonly.tableConfig[0].tool.tools = {};
|
|
|
+ console.log(readonly.tableConfig[0].table.columns.slice(0, -1));
|
|
|
+ let data = e.suborderList;
|
|
|
+ (this.$refs.bill as any).setBillConfig(readonly);
|
|
|
+ (this.$refs.bill as any).setBillFormValue(e);// 设置单据表单数据
|
|
|
+ (this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
|
|
|
+ this.isAdd = false;
|
|
|
+ (this.$refs.bill as any).showTab = 'bill';
|
|
|
+
|
|
|
+ }
|
|
|
+ // 切换tab栏
|
|
|
+ clickTab(e : any) {
|
|
|
+ console.log('切换tab ==> ', e);
|
|
|
+ this.tabType = e;
|
|
|
+ // submitState: 提交状态
|
|
|
+ if (e === 'all') this.getPageList({ pageSize: 10, pageNo: 1 }, 'all'); // 草稿箱数据
|
|
|
+ if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
|
|
|
+ if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
|
|
|
+ if (e === 'recycleBin') this.getSelectDeleteList({ pageNo: 1, pageSize: 10 }); // 回收站数据
|
|
|
+ }
|
|
|
+ // 初始化
|
|
|
+ getDataList() {
|
|
|
+ if (!this.$refs.bill) {
|
|
|
+ if (this.timeNum > 5) {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ }
|
|
|
+ this.timeNum++;
|
|
|
+ return
|
|
|
+ }
|
|
|
+ clearInterval(this.timer)
|
|
|
+ this.getPageList({ pageSize: 10, pageNo: 1 }, 'all'); // 综合数据
|
|
|
+ }
|
|
|
+ // 分页
|
|
|
+ pagination(e : any) {
|
|
|
+ console.log('分页 ==> ', e);
|
|
|
+ let query = {
|
|
|
+ pageNo: e.page.pageNum,
|
|
|
+ pageSize: e.page.pageSize,
|
|
|
+ };
|
|
|
+ let loading = this.$loading({ target: '.main-container' });
|
|
|
+ if (e.type === 'recycleBin') {
|
|
|
+ api.selectDeleteList(query, 'supplyOutOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ (this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
|
|
|
+ loading.close()
|
|
|
+ } else this.failHandle(res)
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ api.pageList(query, 'supplyOutOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ (this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
|
|
|
+ loading.close()
|
|
|
+ } else this.failHandle(res)
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ // 获取分页数据
|
|
|
+ getPageList(query : any, type : any) {
|
|
|
+ api.pageList(query, 'supplyOutOrder').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(query : any) {
|
|
|
+ api.selectDeleteList(query, 'supplyOutOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ (this.$refs.bill as any).setTabTableValue('recycleBin', res.data.records);
|
|
|
+ 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)
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 搜索
|
|
|
+ search(parames : any) {
|
|
|
+ let query = parames.value
|
|
|
+ if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
|
|
|
+ if (parames.type === 'smt') query.submitState = 1 // 已提交数据
|
|
|
+ console.log('搜索 ==> ', query);
|
|
|
+ this.getPageList(query, parames.type) // 获取分页数据
|
|
|
+ }
|
|
|
+ // 刷新
|
|
|
+ onRefresh(e : any) {
|
|
|
+ console.log('刷新 ==>', e);
|
|
|
+ (this as any).$refs.bill.$refs[e].resert();
|
|
|
+ if (e === 'all') this.getPageList({}, 'all'); // 综合查询
|
|
|
+ if (e === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
|
|
|
+ if (e === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
|
|
|
+ if (e === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
|
|
|
+ }
|
|
|
+ // 单据表格删除
|
|
|
+ changeTable(item : any) {
|
|
|
+ this.$confirm('确定删除吗!', '注意', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ this.tableData[item.dataIndex].isDeleted = 1;
|
|
|
+ let newData = this.tableData.filter((res : any) => res.isDeleted === 0);
|
|
|
+ console.log('原表格数据 ==> ', this.tableData);
|
|
|
+ console.log('新表格数据 ==> ', newData);
|
|
|
+ (this.$refs.bill as any).setBillTableValue(newData, 0);// 设置第1张单据表格数据
|
|
|
+ this.$message.success('删除成功');
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
+ }
|
|
|
+ // 工具栏删除
|
|
|
+ onDelete(e : any) {
|
|
|
+ console.log('工具栏删除 ==> ', e);
|
|
|
+ let selectData = (this.$refs.bill as any).getTableSelectData(e)
|
|
|
+ let ids = '';
|
|
|
+ if (selectData.length > 0) {
|
|
|
+ selectData.map((v : any) => {
|
|
|
+ ids += v.id + ','
|
|
|
+ })
|
|
|
+ } else return this.$message({ type: 'warning', message: '请选择删除数据' })
|
|
|
+ ids = ids.slice(0, ids.length - 1);
|
|
|
+ this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ api.deleteList({ ids: ids }, 'supplyOutOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.clickTab(this.tabType);
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ } else this.failHandle(res)
|
|
|
+ })
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
+ }
|
|
|
+ // 操作删除
|
|
|
+ doDelete2(item : any) {
|
|
|
+ this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ center: true
|
|
|
+ }).then(() => {
|
|
|
+ api.deleteList({ ids: item.id }, 'supplyOutOrder').then((res : any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ this.clickTab(this.tabType);
|
|
|
+ this.$message.success('删除成功!');
|
|
|
+ } else this.failHandle(res)
|
|
|
+ })
|
|
|
+ }).catch(() => this.$message.info('已取消删除'));
|
|
|
+ }
|
|
|
+ // 运行错误
|
|
|
+ failHandle(err : any) {
|
|
|
+ let msg = err.msg ? err.msg : '运行错误!';
|
|
|
+ this.$message.error(msg)
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|