|
|
@@ -1,13 +1,5 @@
|
|
|
<template>
|
|
|
- <ele-modal
|
|
|
- custom-class="ele-dialog-form long-dialog-form"
|
|
|
- :centered="true"
|
|
|
- :visible.sync="addOrEditDialogFlag"
|
|
|
- :title="title"
|
|
|
- :close-on-click-modal="false"
|
|
|
- width="80%"
|
|
|
- @close="cancel"
|
|
|
- >
|
|
|
+ <div>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
|
|
<headerTitle title="发货信息"></headerTitle>
|
|
|
|
|
|
@@ -120,27 +112,19 @@
|
|
|
ref="inventoryTableref"
|
|
|
:orderId="form.orderId"
|
|
|
></inventoryTable>
|
|
|
-
|
|
|
- <div slot="footer" class="footer">
|
|
|
- <el-button type="primary" @click="save">保存</el-button>
|
|
|
- <el-button type="primary" @click="save('sub')">提交</el-button>
|
|
|
-
|
|
|
- <el-button @click="cancel">返回</el-button>
|
|
|
- </div>
|
|
|
<!-- 采购订单 -->
|
|
|
<orderListDialog
|
|
|
:searchParams="orderSearchParams"
|
|
|
ref="orderListDialogRef"
|
|
|
@changeParent="changeOrder"
|
|
|
></orderListDialog>
|
|
|
- </ele-modal>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import fileUpload from '@/components/upload/fileUpload';
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
-// import parentList from '@/views/saleManage/contact/components/parentList.vue';
|
|
|
import {
|
|
|
savePurchaseOutSourceSendAPI,
|
|
|
updatePurchaseOutSourceSendAPI,
|
|
|
@@ -149,20 +133,21 @@ import {
|
|
|
} from '@/api/bpm/components/purchasingManage/outSourceSend';
|
|
|
// import {getcontactlink} from '@/api/saleManage/businessFollow';
|
|
|
import inventoryTable from './inventoryTable.vue';
|
|
|
-// import orderListDialog from '../../invoice/components/orderListDialog.vue';
|
|
|
+import orderListDialog from '../invoice/orderListDialog.vue';
|
|
|
import {copyObj} from '@/utils/util';
|
|
|
import {getpurchaseorderDetail} from "@/api/bpm/components/purchasingManage/purchaseOrder";
|
|
|
|
|
|
export default {
|
|
|
- props: {
|
|
|
- addOrEditDialogFlag: Boolean
|
|
|
- },
|
|
|
mixins: [dictMixins],
|
|
|
components: {
|
|
|
fileUpload,
|
|
|
inventoryTable,
|
|
|
- orderListDialog,
|
|
|
- parentList
|
|
|
+ orderListDialog
|
|
|
+ },
|
|
|
+ props: {
|
|
|
+ businessId: {
|
|
|
+ default: ''
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -173,7 +158,6 @@ export default {
|
|
|
payWayOptions: [],
|
|
|
delDetailIds: [],
|
|
|
linkNameOptions: [],
|
|
|
-
|
|
|
title: '',
|
|
|
row: {},
|
|
|
form: {
|
|
|
@@ -213,26 +197,12 @@ export default {
|
|
|
|
|
|
// 提交状态
|
|
|
loading: false,
|
|
|
- // 是否是修改
|
|
|
- isUpdate: false,
|
|
|
- businessId: ''
|
|
|
};
|
|
|
},
|
|
|
-
|
|
|
+ async created() {
|
|
|
+ await this.getSendSaleOrderDetail(this.businessId);
|
|
|
+ },
|
|
|
methods: {
|
|
|
- //打开新增编辑弹框
|
|
|
- async open(type, row, orderId) {
|
|
|
- this.title = type === 'add' ? '新增委外发货单' : '修改';
|
|
|
- this.row = row;
|
|
|
- if (orderId) {
|
|
|
- await this.getPurchaseOrderDetail(orderId);
|
|
|
- }
|
|
|
- if (row && row?.id) {
|
|
|
- await this.getSendSaleOrderDetail(row?.id);
|
|
|
- }
|
|
|
-
|
|
|
- this.isUpdate = type !== 'add';
|
|
|
- },
|
|
|
//选择订单弹框
|
|
|
handleOrderBtn(e) {
|
|
|
if (e.target.nodeName == 'I') {
|
|
|
@@ -316,32 +286,6 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
|
|
|
- //更新联系人数据
|
|
|
- async getLinkInfo(contactId) {
|
|
|
- const data = await getcontactlink({contactId});
|
|
|
- if (data && data?.length) {
|
|
|
- this.linkNameOptions = data;
|
|
|
- }
|
|
|
- },
|
|
|
- selectFocus() {
|
|
|
- if (this.linkNameOptions.length === 0) {
|
|
|
- return this.$message.error('请先选择名称');
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- handHead() {
|
|
|
- let item = {
|
|
|
- id: this.form.partbLinkId
|
|
|
- };
|
|
|
- this.$refs.headRef.open(item);
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
- salesmanChange(val, info) {
|
|
|
- this.otherForm.salesmanName = info.name;
|
|
|
- },
|
|
|
-
|
|
|
-
|
|
|
getValidate() {
|
|
|
return Promise.all([
|
|
|
new Promise((resolve, reject) => {
|
|
|
@@ -364,67 +308,23 @@ export default {
|
|
|
})
|
|
|
]);
|
|
|
},
|
|
|
- async save(type) {
|
|
|
- try {
|
|
|
- await this.getValidate();
|
|
|
- // 表单验证通过,执行保存操作
|
|
|
- this.loading = true;
|
|
|
- if (!this.isUpdate) {
|
|
|
- delete this.form.id;
|
|
|
- }
|
|
|
- this.form.files = this.form.files || [];
|
|
|
- // this.form.replied = this.form.repliedFiles.length > 0 ? 1 : 0;
|
|
|
- let commitData = Object.assign({}, this.form, {
|
|
|
- productList: this.$refs.inventoryTableref.getTableValue()
|
|
|
- });
|
|
|
+ async getTableValue() {
|
|
|
+ return new Promise(async (resolve, reject) => {
|
|
|
+ try {
|
|
|
+ await this.getValidate();
|
|
|
+ this.form.files = this.form.files || [];
|
|
|
+ let commitData = Object.assign({}, this.form, {
|
|
|
+ productList: this.$refs.inventoryTableref.getTableValue()
|
|
|
+ });
|
|
|
+ await updatePurchaseOutSourceSendAPI(commitData)
|
|
|
+ resolve(true)
|
|
|
|
|
|
- if (this.isUpdate) {
|
|
|
- updatePurchaseOutSourceSendAPI(commitData)
|
|
|
- .then((res) => {
|
|
|
- this.loading = false;
|
|
|
- this.$message.success('修改成功');
|
|
|
- if (type === 'sub') {
|
|
|
- this.sendSubmit(res);
|
|
|
- return;
|
|
|
- }
|
|
|
- this.cancel();
|
|
|
- this.$emit('done');
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- //this.loading = false;
|
|
|
- });
|
|
|
- } else {
|
|
|
- savePurchaseOutSourceSendAPI(commitData)
|
|
|
- .then((res) => {
|
|
|
- this.loading = false;
|
|
|
- this.$message.success('新增成功');
|
|
|
- if (type === 'sub') {
|
|
|
- this.sendSubmit(res);
|
|
|
- return;
|
|
|
- }
|
|
|
- this.cancel();
|
|
|
- this.$emit('done');
|
|
|
- })
|
|
|
- .catch((e) => {
|
|
|
- //this.loading = false;
|
|
|
- });
|
|
|
+ } catch (error) {
|
|
|
+ reject(false)
|
|
|
+ // 表单验证未通过,不执行保存操作
|
|
|
}
|
|
|
- } catch (error) {
|
|
|
- console.log(error);
|
|
|
- // 表单验证未通过,不执行保存操作
|
|
|
- }
|
|
|
- },
|
|
|
- sendSubmit(res) {
|
|
|
- submit({
|
|
|
- businessId: this.businessId || res
|
|
|
- // productionSupervisorId
|
|
|
- }).then((res) => {
|
|
|
- this.cancel();
|
|
|
- this.$emit('done');
|
|
|
- });
|
|
|
- },
|
|
|
- cancel() {
|
|
|
- this.$emit('update:addOrEditDialogFlag', false)
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
};
|