123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122 |
- <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>
- <SettingConfig ref="setForm" type="setXForm" title="销售订单" />
- </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 SettingConfig from "./components/settingConfig.vue";
- import Assembly from "@/components/Assembly/saleOrder.vue";
- @Component({ components: { SettingConfig } })
- 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: 'left',
- },
- columns:
- [
- {
- width: 300,
- title: '物料名称',
- field: 'materialName',
- },
- {
- width: 120,
- title: '数量',
- field: 'number',
- },
- {
- width: 120,
- title: '已拆单数量',
- field: 'splitOrderNumber',
- },
- {
- width: 120,
- title: '可拆单数量',
- field: 'splitNumber',
- }
- ]
- }
- rightTableConfig : any = {
- attr: {
- size: 'mini',
- height: 490,
- align: 'left',
- },
- columns:
- [
- {
- width: 300,
- title: '物料名称',
- field: 'materialName',
- },
- {
- width: 120,
- 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: 110,
- title: '单位',
- field: 'unit',
- },
- {
- width: 110,
- title: '单位编码',
- field: 'unitCode',
- },
- {
- width: 110,
- title: '数量',
- field: 'number',
- },
- {
- width: 110,
- title: '已交付数量',
- field: 'outNumber',
- },
- {
- width: 110,
- title: '单价',
- field: 'unitPrice',
- },
- {
- width: 110,
- title: '实际金额',
- field: 'realityPrice',
- },
- {
- width: 110,
- title: '优惠金额',
- field: 'prePrice',
- },
- {
- width: 110,
- 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()
- }
- }
- },
- {
- name: '参数配置', icon: 'el-icon-setting', audit: [''], event: {
- click: () => {
- (this as any).configuration()
- }
- }
- },
- ]
- },
- table: {
- attr: {
- size: 'mini',
- triggerRowCheck: 'row',
- align: 'left',
- radio: true,
- maxHeight: "620"
- },
- columns: [
- {
- width: 144,
- title: '单据编号',
- field: 'orderNumber',
- isDetail: true,
- fixed:'left'
- },
- {
- width: 50,
- component: OrderType,
- fixed:'left'
- },
- {
- width: 180,
- title: '机构名称',
- field: 'organizationName',
- },
- {
- width: 150,
- title: '财务编号',
- field: 'financeOrderId',
- },
- {
- width: 90,
- title: '收货人',
- field: 'consignee',
- },
- {
- width: 100,
- title: '联系方式',
- field: 'phone',
- },
- {
- width: 130,
- title: '计划交货时间',
- field: 'planDeliveryData',
- },
- {
- width: 130,
- title: '确定交货时间',
- field: 'affirmDeliveryData',
- },
- {
- width: 150,
- title: '交货地点',
- field: 'address',
- },
- {
- width: 80,
- 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)
- }
- // 参数配置
- configuration() {
- (this as any).$refs.setForm.openSetting();
- }
- // 引单
- citationOrder() {
- let parentData : any = (this as any).$refs.bill.getSourceTableSelectData(0);
- 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 = 10;
- 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>
|