1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105 |
- <template>
- <div>
- <by-bill :propConfig="config" @search="search" ref="bill" @resert="resert" @detail="openEdit" @onRefresh="resert"
- @pagination="pagination" @clickTab="clickTab" @onOrder="onOrder" @onSave="onSave">
- </by-bill>
- <vxe-modal v-model="vxeValue" width="90%" height="90%" show-zoom resize transfer show-footer>
- <template #title>
- <!-- <span>拆单</span> -->
- </template>
- <template #default>
- <div class="fl" style="width: 45%;margin-right: 10%;">
- <div style="margin-bottom: 20px;">主单销售数据</div>
- <by-table ref="leftTable" :propConfig="leftTableConfig"></by-table>
- </div>
- <!-- <div class="fl" style="font-size: 80px;margin: 10% 6% 0 6%;transform: rotate(90deg);"><i
- class="el-icon-sort"></i></div> -->
- <div class="fl" style="width: 45%;">
- <div style="margin-bottom: 20px;">拆单销售数据</div>
- <by-table ref="rightTable" :propConfig="rightTableConfig" @onChangeRow="rightChange"></by-table>
- </div>
- </template>
- <template #footer>
- <div class="btn">
- <el-button type="primary" size="small" @click="doConfirm">确定</el-button>
- </div>
- </template>
- </vxe-modal>
- </div>
- </template>
- <script lang="ts">
- 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 SaleOrder extends Vue {
- vxeValue = false
- isCitation = false
- timeNum = 0;
- timer : any = null
- baseInfo : any = {} // 订单数据
- regularData : any = [] // 固定值
- leftTableConfig : any = {
- attr: {
- size: 'mini',
- height: 490,
- align: 'center',
- },
- columns:
- [
- {
- width: 128,
- title: '物料名称',
- field: 'materialName',
- },
- {
- width: 128,
- title: '数量',
- field: 'number',
- },
- {
- width: 128,
- title: '已拆单数量',
- field: 'splitOrderNumber',
- },
- {
- width: 128,
- title: '可拆单数量',
- field: 'splitNumber',
- }
- ]
- }
- rightTableConfig : any = {
- attr: {
- size: 'mini',
- height: 490,
- align: 'center',
- },
- columns:
- [
- {
- width: 128,
- title: '物料名称',
- field: 'materialName',
- },
- {
- width: 128,
- title: '数量',
- field: 'number',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- type: 'integer',
- placeholder: '请输入数量'
- },
- }
- },
- ]
- }
- config : any = {
- attr: {
- activeName: 'all',
- calculateH: true
- },
- // 引单
- source: [
- {
- title: '订单任务',
- search: {
- attr: {
- size: 'medium',
- },
- 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: {
- attr: {
- 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: {
- size: 'mini',
- seq: true,
- align: 'left',
- radio: true,
- triggerRowCheck: 'row'
- },
- 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: {
- tools: {
- save: true
- },
- customTools: []
- },
- log: {
- request: {
- url: '/supply/supplyPurchaseOrderOperateLog/page',
- method: 'GET'
- }
- },
- form: {
- attr: {
- size: 'medium',
- rules: {
- planDeliveryData: [{
- required: true, message: '请选择交货时间', trigger: 'change'
- }],
- }
- },
- columns: [
- [
- {
- span: 8,
- label: '单据编号',
- prop: 'orderNumber',
- component: 'by-input',
- compConfig: {
- attr: {
- readonly: true,
- },
- }
- },
- {
- span: 8,
- label: '机构名称',
- prop: 'organizationName',
- component: 'by-input',
- compConfig: {
- attr: {
- readonly: true,
- },
- }
- },
- {
- span: 8,
- label: '联系方式',
- prop: 'phone',
- component: 'by-input',
- compConfig: {
- attr: {
- readonly: true,
- },
- }
- },
- {
- span: 8,
- label: '收货人',
- prop: 'consignee',
- component: 'by-input',
- compConfig: {
- attr: {
- readonly: true,
- },
- }
- },
- {
- span: 8,
- label: '交货时间',
- prop: 'planDeliveryData',
- component: 'by-date-picker',
- compConfig: {
- attr: {
- format: 'yyyy-MM-dd hh:ss:mm',
- type: 'datetime',
- readonly: true,
- },
- }
- },
- {
- span: 8,
- label: '确定时间',
- prop: 'affirmDeliveryData',
- component: 'by-input',
- compConfig: {
- attr: {
- readonly: true,
- },
- }
- },
- {
- span: 8,
- label: '交货地点',
- prop: 'address',
- component: 'by-input',
- compConfig: {
- attr: {
- readonly: true,
- },
- }
- },
- ],
- [
- {
- span: 28,
- label: '备注',
- slot: true,
- prop: 'remark',
- component: 'by-input',
- compConfig: {
- attr: {
- size: 'mini',
- placeholder: '请输入备注',
- type: 'textarea',
- readonly: false,
- },
- }
- },
- ]
- ]
- },
- tableConfig: [
- {
- table: {
- attr: {
- size: 'mini',
- align: 'left',
- readonly: true
- },
- columns:
- [{
- width: 250,
- title: '物料名称',
- field: 'materialName',
- },
- {
- width: 180,
- title: '财务编号',
- field: 'financeSuborderId',
- },
- {
- width: 120,
- title: '单位',
- field: 'unit',
- },
- {
- width: 120,
- title: '单位编码',
- field: 'unitCode',
- },
- {
- width: 120,
- title: '数量',
- field: 'number',
- },
- {
- width: 120,
- title: '已交付数量',
- field: 'outNumber',
- },
- {
- width: 120,
- title: '单价',
- field: 'unitPrice',
- },
- {
- width: 120,
- title: '实际金额',
- field: 'realityPrice',
- },
- {
- width: 120,
- title: '优惠金额',
- field: 'prePrice',
- },
- {
- width: 120,
- title: '合计金额',
- field: 'totalPrice',
- },
- ]
- }
- }
- ]
- },
- // 综合
- all: {
- 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
- },
- },
- },
- ],
- ]
- },
- tool: {
- tools: {
- search: true,
- refresh: true
- },
- customTools: [
- {
- name: '终止订单', icon: 'el-icon-close', audit: [''], event: {
- click: () => {
- (this as any).doBackOrder()
- }
- }
- },
- {
- name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
- click: () => {
- (this as any).syncSystem()
- }
- }
- },
- ]
- },
- table: {
- attr: {
- size: 'mini',
- triggerRowCheck: 'row',
- align: 'left',
- radio: true
- },
- columns: [
- {
- width: 144,
- title: '单据编号',
- field: 'orderNumber',
- isDetail: true,
- },
- {
- width: 50,
- component: OrderType,
- },
- {
- width: 180,
- title: '机构名称',
- field: 'organizationName',
- },
- {
- width: 150,
- title: '财务编号',
- field: 'financeOrderId',
- },
- {
- width: 90,
- title: '收货人',
- field: 'consignee',
- },
- {
- width: 120,
- title: '联系方式',
- field: 'phone',
- },
- {
- width: 130,
- title: '计划交货时间',
- field: 'planDeliveryData',
- },
- {
- width: 130,
- title: '确定交货时间',
- field: 'affirmDeliveryData',
- },
- {
- width: 150,
- title: '交货地点',
- field: 'address',
- },
- {
- width: 90,
- title: '状态',
- field: 'status',
- component: Assembly,
- },
- {
- width: 90,
- title: '操作',
- action: true,
- plugins: [
- {
- name: '查看',
- event: {
- show: (item : any) => {
- return item.status != 0
- },
- click: (item : any) => {
- (this as any).openEdit(item)
- }
- }
- },
- {
- name: '编辑',
- event: {
- show: (item : any) => {
- return item.status === 0
- },
- click: (item : any) => {
- (this as any).openEdit(item)
- }
- }
- },
- {
- name: '拆单',
- event: {
- show: (item : any) => {
- return item.isMaster === 1 && item.status === 0
- },
- click: (item : any) => (this as any).orderTaking(item)
- }
- },
- ]
- }
- ]
- }
- },
- // 终止订单
- returnOrder: {
- 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
- },
- },
- },
- ],
- ]
- },
- tool: {
- tools: {
- search: true,
- refresh: true
- },
- },
- table: {
- attr: {
- size: 'mini',
- align: 'left',
- },
- columns: [
- {
- width: 168,
- title: '单据编号',
- field: 'orderNumber',
- isDetail: true,
- fixed: 'left'
- },
- {
- width: 180,
- title: '机构名称',
- field: 'organizationName',
- },
- {
- width: 150,
- title: '财务编号',
- field: 'financeOrderId',
- },
- {
- width: 90,
- title: '收货人',
- field: 'consignee',
- },
- {
- width: 120,
- title: '联系方式',
- field: 'phone',
- },
- {
- width: 130,
- title: '计划交货时间',
- field: 'planDeliveryData',
- },
- {
- width: 130,
- title: '确定交货时间',
- field: 'affirmDeliveryData',
- },
- {
- width: 150,
- title: '交货地点',
- field: 'address',
- },
- {
- width: 100,
- title: '状态',
- field: 'status',
- component: Assembly,
- },
- {
- width: 90,
- title: '操作',
- action: true,
- plugins: [{
- icon: 'el-icon-edit',
- name: '查看',
- audit: '',
- event: {
- click: (item : any) => {
- (this as any).openEdit(item)
- }
- }
- },
- ]
- }
- ]
- }
- },
- }
- created() {
- this.timer = setInterval(() => {
- this.getDataList()
- }, 500)
- }
- // 引单
- citationOrder() {
- let parentData : any = (this as any).$refs.bill.getSourceTableSelectData(0);
- console.log(parentData);
- if (parentData.length <= 0) return this.$message.warning('请选择引单数据');
- let loading = this.$loading({ target: '.main-container' });
- api.single({ id: parentData[0].id }, 'supplyTaskOrder').then((res : any) => {
- if (res.code === 200) {
- parentData = res.data ? [res.data] : parentData;
- parentData = parentData.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 = { order: true };
- billConfig.tool.customTools = [];
- this.isCitation = true;
- (this.$refs.bill as any).showTab = 'bill';
- loading.close();
- setTimeout(() => {
- (this.$refs.bill as any).setBillConfig(billConfig);
- (this.$refs.bill as any).setBillFormValue(parentData[0]); // 设置单据表单数据
- (this.$refs.bill as any).setBillTableValue(parentData[0].suborderList, 0);// 设置第1张单据表格数据
- }, 0)
- } else loading.close();
- }).catch(() => loading.close());
- };
- // 接单
- onOrder() {
- this.$confirm('确定接单吗', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let data = (this.$refs.bill as any).getBillFormValue();
- let loading = this.$loading({ target: '.main-container' });
- api.ordersaccepting({ ids: data.id }, 'supplyTaskOrder').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.getDataList();
- this.$message.success('接单成功');
- (this.$refs.bill as any).showTab = 'all';
- } else this.$message.error(res.msg);
- }).catch(() => loading.close());
- }).catch(() => this.$message.info('已取消接单'));
- }
- // 右拆单数据变化
- rightChange(e : any) {
- if (0 <= e.number && e.number <= this.regularData[e.dataIndex].splitNumber) {
- let leftTableData = (this.$refs.leftTable as any).getValue();
- leftTableData[e.dataIndex].splitNumber = leftTableData[e.dataIndex].number - e.number;
- (this.$refs.leftTable as any).setValue(leftTableData);
- } else {
- let leftTableData = (this.$refs.leftTable as any).getValue();
- let rifhtTableData = (this.$refs.rightTable as any).getValue();
- rifhtTableData[e.dataIndex].number = '0';
- leftTableData[e.dataIndex].splitNumber = leftTableData[e.dataIndex].number - leftTableData[e.dataIndex].splitOrderNumber;
- (this.$refs.leftTable as any).setValue(leftTableData);
- (this.$refs.rightTable as any).setValue(rifhtTableData);
- this.$message.warning('输入值只能是自然数且不能大于可拆单数量');
- }
- }
- // 打开拆单
- orderTaking(item : any) {
- let loading = this.$loading({ target: '.main-container' });
- api.single({ id: item.id }, 'supplyPurchaseOrder').then((res : any) => {
- loading.close();
- console.log(res);
- if (res.code === 200) {
- this.vxeValue = true;
- this.baseInfo = res.data;
- this.regularData = (this as any).$lodash.cloneDeep(res.data.suborderList);
- let rightData = (this as any).$lodash.cloneDeep(res.data.suborderList);
- this.regularData.map((v : any) => {
- v.splitNumber = v.number - v.splitOrderNumber;
- })
- rightData.map((v : any, i : any) => {
- v.number = '0';
- v.dataIndex = i;
- v.splitNumber = v.number - v.splitOrderNumber;
- });
- setTimeout(() => {
- (this.$refs.leftTable as any).setValue(this.regularData);
- (this.$refs.rightTable as any).setValue(rightData);
- }, 0)
- }
- }).catch(() => loading.close());
- }
- // 确认拆单
- doConfirm() {
- let rifhtNewData : any = [];
- let rifhtTableData = (this.$refs.rightTable as any).getValue();
- rifhtTableData.map((v : any) => {
- rifhtNewData.push({
- id: v.id,
- inSplitOrderNumber: v.number
- })
- });
- let isTrue = rifhtNewData.filter((v : any) => v.inSplitOrderNumber != 0);
- let obj : any = {
- id: this.baseInfo.id,
- splitList: rifhtNewData,
- };
- if (isTrue.length > 0) {
- this.$confirm('确定拆单吗!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let loading = this.$loading({ target: '.main-container' });
- api.splitOrder(obj, 'supplyPurchaseOrder').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success('拆单成功');
- this.getPageList({}, 'all'); // 综合数据
- this.vxeValue = false;
- } else this.$message.error(res.msg);
- }).catch(() => loading.close());
- }).catch(() => this.$message.info('已取消拆单'));
- } else this.$message.warning('请输入拆单销售数据');
- }
- getDataList() {
- if (!this.$refs.bill) {
- if (this.timeNum > 5) {
- clearInterval(this.timer)
- }
- this.timeNum++;
- return
- }
- clearInterval(this.timer);
- this.getPageList({}, 'all'); // 综合数据
- }
- // 获取分页数据
- getPageList(query : any, type : any) {
- let data = (this.$refs.bill as any).getTablePage('all');
- query.pageNo = data.pageNo;
- query.pageSize = data.pageSize;
- let loading = this.$loading({ target: '.main-container' });
- api.pageList(query, 'supplyPurchaseOrder').then((res : any) => {
- loading.close();
- 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.$message.error(res.msg);
- }).catch(() => loading.close());
- }
- // 获取引单分页数据
- getCitationList(query : any) {
- let data = (this.$refs.bill as any).getTablePage('all');
- query.pageNo = data.pageNo;
- query.pageSize = data.pageSize;
- query.submitState = 1; // 已提交
- query.status = 0; // 未接单
- let loading = this.$loading({ target: '.main-container' });
- api.pageList(query, 'supplyTaskOrder').then((res : any) => {
- loading.close();
- 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 //总条数
- };
- (this.$refs.bill as any).setSourcePage(0, page);
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }
- // 保存
- onSave() {
- let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
- console.log('保存参数query ==> ', query);
- let loading = this.$loading({ target: '.main-container' });
- api.updateList(query, 'supplyPurchaseOrder').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success('保存成功');
- this.getPageList({}, 'all'); // 综合数据
- (this.$refs.bill as any).showTab = 'all';
- } else this.$message.error(res.msg);
- }).catch(() => loading.close());
- }
- // 打开编辑
- openEdit(e : any) {
- e = e.row ? e.row : e;
- let loading = this.$loading({ target: '.main-container' });
- api.single({ id: e.id }, 'supplyPurchaseOrder').then((res : any) => {
- if (res.code === 200) {
- let parentData = res.data ? res.data : e;
- console.log(parentData);
- let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
- if (parentData.status === 2) {
- billConfig.tool.customTools = [];
- } else {
- billConfig.tool.customTools = [
- {
- name: '终止订单', icon: 'el-icon-close', audit: [''], event: {
- click: () => {
- (this as any).doBackOrder2(parentData)
- }
- }
- }
- ];
- // 主单
- if (parentData.isMaster === 1) {
- billConfig.tool.customTools = [
- {
- name: '拆单', icon: 'el-icon-minus', audit: [''], event: {
- click: () => {
- (this as any).orderTaking(parentData)
- }
- }
- },
- {
- name: '终止订单', icon: 'el-icon-close', audit: [''], event: {
- click: () => {
- (this as any).doBackOrder2(parentData)
- }
- }
- },
- {
- name: '同步到财务系统', icon: 'el-icon-top', audit: [''], event: {
- click: () => {
- (this as any).syncSystem2(parentData)
- }
- }
- },
- ];
- }
- };
- billConfig.tool.tools = {};
- billConfig.form.columns[0].map((v : any) => {
- v.compConfig.attr.readonly = true;
- })
- console.log(billConfig.form.columns[0]);
- billConfig.form.columns[1][0].compConfig.attr.readonly = true;
- if (parentData.status === 0) {
- billConfig.form.columns[0][2].compConfig.attr.readonly = false;
- billConfig.form.columns[0][3].compConfig.attr.readonly = false;
- billConfig.form.columns[0][4].compConfig.attr.readonly = false;
- billConfig.form.columns[0][6].compConfig.attr.readonly = false;
- billConfig.form.columns[1][0].compConfig.attr.readonly = false;
- billConfig.tool.tools = { save: true };
- };
- (this.$refs.bill as any).setBillConfig(billConfig);
- (this.$refs.bill as any).setBillFormValue(parentData); // 设置单据表单数据
- (this.$refs.bill as any).setBillTableValue(parentData.suborderList, 0);// 设置第1张单据表格数据
- (this.$refs.bill as any).showTab = 'bill';
- loading.close();
- } else loading.close();
- }).catch(() => loading.close());
- }
- // 导航切换
- clickTab(e : any) {
- // console.log('导航切换 ==> ', e);
- // submitState: 提交状态
- if (e === 'source') {
- this.getCitationList({});
- }
- if (e === 'all') this.getDataList();
- if (e === 'returnOrder') this.getPageList({ status: 2 }, 'returnOrder');
- if (e === 'bill') {
- let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
- billConfig.tool.tools = {};
- billConfig.tool.customTools = [];
- (this.$refs.bill as any).setBillConfig(billConfig);
- }
- }
- // 同步销售订单到财务系统
- syncSystem() {
- let selectData = (this as any).$refs.bill.getTableSelectData('all');
- if (selectData.length > 0) {
- if (selectData[0].isMaster !== 1 || selectData[0].status !== 0) return this.$message.warning('只能同步未出库的主单');
- this.$confirm('确定同步订单吗', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let loading = this.$loading({ target: '.main-container' });
- api.addSaleOrder({ ids: selectData[0].id }).then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success('同步订单成功');
- this.getDataList();
- (this.$refs.bill as any).showTab = 'all';
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }).catch(() => this.$message.info('已取消同步订单'));
- } else this.$message.warning('请选择同步数据');
- }
- // 单据操作同步
- syncSystem2(e : any) {
- this.$confirm('确定同步订单吗', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let loading = this.$loading({ target: '.main-container' });
- api.addSaleOrder({ ids: e.id }).then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success('同步订单成功');
- this.getDataList();
- (this.$refs.bill as any).showTab = 'all';
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }).catch(() => this.$message.info('已取消同步订单'));
- }
- // 工具栏终止订单
- doBackOrder() {
- let selectData = (this as any).$refs.bill.getTableSelectData('all');
- console.log(selectData);
- // if (selectData.length > 1) return this.$message.warning('只能选择一条终止订单数据');
- let ids : any = [];
- if (selectData.length > 0) {
- selectData.map((v : any) => {
- ids.push(v.id);
- })
- } else return this.$message.warning('请选择终止订单数据');
- // console.log(ids);
- this.$confirm('确定终止订单吗!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let loading = this.$loading({ target: '.main-container' });
- api.stoporder({ ids: ids }, 'supplyPurchaseOrder').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success('终止订单成功');
- this.getDataList();
- (this.$refs.bill as any).showTab = 'all';
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }).catch(() => this.$message.info('已取消终止订单'));
- }
- // 单据操作终止订单
- doBackOrder2(e : any) {
- this.$confirm('确定终止订单吗!', '注意', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning',
- center: true
- }).then(() => {
- let loading = this.$loading({ target: '.main-container' });
- api.stoporder({ ids: e.id }, 'supplyPurchaseOrder').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- this.$message.success('终止订单成功');
- this.getDataList();
- (this.$refs.bill as any).showTab = 'all';
- } else this.$message.error(res.msg)
- }).catch(() => loading.close());
- }).catch(() => this.$message.info('已取消终止订单'));
- }
- // 分页
- pagination(e : any) {
- console.log('分页 ==> ', e);
- if (e.type === 'source_0') {
- let query : any = (this as any).$refs.bill.$refs.source_0[0].getSearchValue();
- query.pageNo = e.page.pageNum;
- query.pageSize = e.page.pageSize;
- this.getCitationList(query);
- } else {
- let query : any = (this as any).$refs.bill.getSearchValue(e.type);
- query.pageNo = e.page.pageNum;
- query.pageSize = e.page.pageSize;
- if (e.type === 'returnOrder') query.status = 2; // 终止订单数据
- let loading = this.$loading({ target: '.main-container' });
- api.pageList(query, 'supplyPurchaseOrder').then((res : any) => {
- loading.close();
- if (res.code === 200) {
- (this.$refs.bill as any).setTabTableValue(e.type, res.data.records);
- } else this.$message.error(res.msg);
- }).catch(() => loading.close());
- }
- }
- // 搜索
- search(parames : any) {
- let query = parames.value
- if (parames.type === 'source_0') {
- this.getCitationList(query); // 引单数据
- } else {
- if (query.type === 'returnOrder') query.status = 2; // 终止订单数据
- this.getPageList(query, parames.type) // 获取综合分页数据
- }
- }
- // 刷新/重置
- resert(e : any) {
- let data : any = e.type ? e.type : e;
- console.log('刷新/重置 ==> ', data);
- 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'); // 综合数据
- if (data === 'returnOrder') this.getPageList({ status: 2 }, 'returnOrder'); // 终止订单数据
- }
- }
- }
- </script>
|