AlanWong 2 жил өмнө
parent
commit
0db8c628ee

+ 17 - 0
src/components/Assembly/saleOrder.vue

@@ -0,0 +1,17 @@
+<template>
+	<div>
+		<el-tag size='mini' :type="propValue===0?'info':propValue===0?'primary':'danger'"
+			disable-transitions>{{propValue===0?'未出库':propValue===1?'已出库':'已终止'}}</el-tag>
+	</div>
+</template>
+<script lang="ts">
+	import { Component, Prop, Vue, Watch, Mixins } from "vue-property-decorator";
+	@Component
+	export default class SaleOrder extends Vue {
+		@Prop()
+		propValue : any
+	}
+</script>
+
+<style>
+</style>

+ 25 - 17
src/views/audit/orderTask/index.vue

@@ -286,7 +286,6 @@
 				},
 				tool: {
 					tools: {
-						// delete: true,
 						search: true,
 						refresh: true
 					}
@@ -358,7 +357,7 @@
 								audit: '',
 								event: {
 									click: (e : any) => {
-										(this as any).setReadonly(e)
+										(this as any).openEdit(e)
 									}
 								}
 							}, {
@@ -828,7 +827,7 @@
 								audit: '',
 								event: {
 									click: (e : any) => {
-										(this as any).setReadonly(e)
+										(this as any).openEdit(e)
 									}
 								}
 							}]
@@ -874,10 +873,12 @@
 				if (this.isAdd) {
 					api.saveList(query, 'supplyTaskOrder').then((res : any) => {
 						if (res.code === 200) {
-							this.$message.success('保存成功');
+							// this.isAdd = false;
+							// this.isChange = false;
+							// this.isSubmit = true;
 							this.getDataList();
+							this.$message.success('保存成功');
 							(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') {
@@ -905,11 +906,11 @@
 				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张单据表格数据
-				}
+				// 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);
@@ -927,10 +928,16 @@
 				if (res.code === 200) {
 					let parentData = res.data ? res.data : e;
 					this.baseInfo = parentData;
-					if (this.tabType != 'smt' && parentData.sourceType == '手工输入' || this.tabType === 'draftsBox') {
-						if (this.tabType === 'all' && parentData.submitState === 1) {
+					if (parentData.sourceType === '手工输入') {
+						// 已提交
+						if (parentData.submitState === 1) {
+							loading.close();
+							return this.setReadonly(parentData,true)
+						};
+						// 回收站
+						if(this.tabType === 'recycleBin' ){
 							loading.close();
-							return this.setReadonly(parentData)
+							return this.setReadonly(parentData,false)
 						};
 						let data = parentData.suborderList
 						data.map((v : any, i : any) => {
@@ -957,7 +964,7 @@
 						};
 						billConfig.form.attr.readonly = false; // 设置只读
 						billConfig.tool.tools = { save: true, };
-						if (this.tabType === 'draftsBox' || parentData.submitState === 0) billConfig.tool.tools = { save: true, smt: true };
+						if (parentData.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);
@@ -968,17 +975,17 @@
 						loading.close();
 					} else {
 						loading.close();
-						this.setReadonly(parentData);
+						this.setReadonly(parentData,false);
 					};
 				}
 			})
 		}
 		// 设置只读
-		setReadonly(e : any) {
+		setReadonly(e : any,isReturn:any) {
 			let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
 			readonly.form.attr.readonly = true; // 设置只读
 			readonly.tool.tools = {};
-			if (this.tabType === 'smt') readonly.tool.tools = { returnSmt: true };
+			if (isReturn) readonly.tool.tools = { returnSmt: true };
 			readonly.tableConfig[0].table.columns = readonly.tableConfig[0].table.columns.filter((v : any) => v.title != '操作');
 			readonly.tableConfig[0].tool.tools = {};
 			let data = e.suborderList;
@@ -1008,6 +1015,7 @@
 					})
 				}).catch(() => this.$message.info('已取消提交'));
 			} else {
+				if (this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
 				console.log('isChange ==> ', this.isChange);
 				console.log('isSubmit ==> ', this.isSubmit);
 				if (this.isSubmit) {

+ 41 - 38
src/views/audit/outbound/index.vue

@@ -55,18 +55,6 @@
 										}
 									}
 								},
-								{
-									span: 6,
-									label: '退单编号',
-									prop: 'chargebackNo',
-									component: 'by-input',
-									compConfig: {
-										attr: {
-											placeholder: '请输入退单编号',
-											clearable: true
-										}
-									}
-								},
 							],
 						]
 					},
@@ -99,11 +87,6 @@
 								title: '单据编号',
 								field: 'orderNumber',
 							},
-							{
-								width: 178,
-								title: '退单编号',
-								field: 'chargebackNo',
-							},
 							{
 								width: 90,
 								title: '收货人',
@@ -281,6 +264,11 @@
 										},
 									}
 								},
+								{
+									width: 100,
+									title: '优惠金额',
+									field: 'prePrice',
+								},
 								{
 									width: 100,
 									title: '合计金额',
@@ -343,7 +331,6 @@
 				},
 				tool: {
 					tools: {
-						delete: true,
 						search: true,
 						refresh: true
 					}
@@ -788,6 +775,7 @@
 		citationOrder() {
 			let data : any = (this as any).$refs.bill.getSourceTableSelectData(0);
 			console.log(data);
+			if (data.length <= 0) return this.$message.warning('请选择引单数据');
 			data = data.map((item : any) => {
 				item.receiveAddress = item.address
 				item.receive = item.consignee
@@ -795,10 +783,13 @@
 				const { ...newData } = item
 				return newData
 			})
-			if (data.length <= 0) return this.$message.warning('请选择引单数据');
+			let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+			// billConfig.tool.tools = { save: true, smt: true };
+			// this.isAdd = true;
+			billConfig.tool.tools = { save: true};
 			(this.$refs.bill as any).showTab = 'bill';
-			this.isAdd = true;
 			setTimeout(() => {
+				(this.$refs.bill as any).setBillConfig(billConfig);
 				(this.$refs.bill as any).setBillFormValue(data[0]); // 设置单据表单数据
 				(this.$refs.bill as any).setBillTableValue(data[0].suborderList, 0);// 设置第1张单据表格数据
 			}, 0)
@@ -809,7 +800,12 @@
 		}
 		// 监听表格数据变化
 		onChangeRow(e : any) {
-			e.totalPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
+			this.isChange = true;
+			this.isSubmit = false;
+			e.prePrice = e.prePrice ? e.prePrice : 0;
+			e.realityPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
+			e.totalPrice = e.realityPrice - e.prePrice;
+
 		}
 		// 确定商品新增
 		confirmProduct(e : any) {
@@ -872,10 +868,12 @@
 					delete query.id;
 					api.outbound(query, 'supplyOutOrder').then((res : any) => {
 						if (res.code === 200) {
-							this.$message.success(res.msg);
+							// this.isAdd = false;
+							// this.isChange = false;
+							// this.isSubmit = true;
 							this.getDataList();
+							this.$message.success('保存成功');
 							(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') {
@@ -883,10 +881,9 @@
 					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({});
+							this.$message.success('保存成功');
+							this.isChange = false;
+							this.isSubmit = true;
 						} else this.$message.error(res.msg);
 					})
 				};
@@ -903,13 +900,16 @@
 			console.log('编辑this.tabType ==>', this.tabType);
 			console.log('编辑 ==>', e);
 			e = e.row ? e.row : e;
-			api.single({ id: e.id }, 'supplyEntryOrder').then((res : any) => {
+			api.single({ id: e.id }, 'supplyOutOrder').then((res : any) => {
 				if (res.code === 200) {
 					let parentData = res.data ? res.data : e;
 					this.baseInfo = parentData;
 					if (this.tabType === 'all' || this.tabType === 'draftsBox') {
-						if (this.tabType === 'all' && parentData.submitState === 1) return this.setReadonly(parentData);
 						let loading = this.$loading({ target: '.main-container' });
+						if (parentData.submitState === 1) {
+							loading.close();
+							return this.setReadonly(parentData)
+						}
 						let data = parentData.suborderList;
 						let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
 						if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
@@ -933,12 +933,13 @@
 						billConfig.tool.tools = { save: true, };
 						if (this.tabType === 'draftsBox' || parentData.submitState === 0) billConfig.tool.tools = { save: true, smt: true };
 						data.map((v : any, i : any) => {
+							console.log(v.materialSku);
 							v.dataIndex = i;
 							v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
 							//  查库存
 							api.getInventoryByStoridAndSkuid({
 								storidId: v.storehouseId,
-								skuid: v.id,
+								skuid: v.materialSku,
 							}).then((res : any) => {
 								if (res.code === 200) {
 									v.inventory = res.data;
@@ -966,6 +967,9 @@
 			let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
 			readonly.form.attr.readonly = true; // 设置只读
 			readonly.tool.tools = {};
+			if (this.tabType != 'recycleBin') {
+				if (e.submitState === 1) readonly.tool.tools = { returnSmt: true };
+			}
 			readonly.tableConfig[0].table.columns = readonly.tableConfig[0].table.columns.filter((v : any) => v.title != '操作');
 			let data = e.suborderList;
 			data.map((v : any, i : any) => {
@@ -973,7 +977,7 @@
 				//  查库存
 				api.getInventoryByStoridAndSkuid({
 					storidId: v.storehouseId,
-					skuid: v.id,
+					skuid: v.materialSku,
 				}).then((res : any) => {
 					if (res.code === 200) {
 						v.inventory = res.data;
@@ -1001,7 +1005,7 @@
 					type: 'warning',
 					center: true
 				}).then(() => {
-					api.submitTo({ id: selectData[0].id }, 'supplyEntryOrder').then((res : any) => {
+					api.submitTo({ id: selectData[0].id }, 'supplyOutOrder').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success('提交成功');
 							this.clickTab('draftsBox');
@@ -1009,6 +1013,7 @@
 					})
 				}).catch(() => this.$message.info('已取消提交'));
 			} else {
+				// if (this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
 				console.log('isChange ==> ', this.isChange);
 				console.log('isSubmit ==> ', this.isSubmit);
 				if (this.isSubmit) {
@@ -1018,7 +1023,7 @@
 						type: 'warning',
 						center: true
 					}).then(() => {
-						api.submitTo({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+						api.submitTo({ id: this.baseInfo.id }, 'supplyOutOrder').then((res : any) => {
 							if (res.code === 200) {
 								this.$message.success('提交成功');
 								this.clickTab(this.tabType);
@@ -1054,7 +1059,7 @@
 							center: true
 						}).then(() => {
 							// console.log(this.baseInfo.id);
-							api.submitTo({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+							api.submitTo({ id: this.baseInfo.id }, 'supplyOutOrder').then((res : any) => {
 								if (res.code === 200) {
 									this.$message.success('提交成功');
 									this.clickTab(this.tabType);
@@ -1076,7 +1081,7 @@
 				center: true
 			}).then(() => {
 				if (this.tabType === 'smt') {
-					api.cancelSubmission({ id: e.id }, 'supplyEntryOrder').then((res : any) => {
+					api.cancelSubmission({ id: e.id }, 'supplyOutOrder').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success('反提交成功');
 							this.clickTab(this.tabType);
@@ -1095,7 +1100,7 @@
 				center: true
 			}).then(() => {
 				if (this.tabType === 'smt') {
-					api.cancelSubmission({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+					api.cancelSubmission({ id: this.baseInfo.id }, 'supplyOutOrder').then((res : any) => {
 						if (res.code === 200) {
 							this.$message.success('反提交成功');
 							this.clickTab(this.tabType);
@@ -1109,10 +1114,8 @@
 		clickTab(e : any) {
 			console.log('切换tab ==> ', e);
 			this.tabType = e;
-			this.isAdd = false;
 			// submitState: 提交状态
 			if (e === 'source') {
-				this.isAdd = true;
 				this.getCitationList({});
 			}
 			if (e === 'all') this.getPageList({}, 'all'); // 草稿箱数据

+ 207 - 33
src/views/audit/saleOrder/index.vue

@@ -1,6 +1,6 @@
 <template>
 	<div>
-		<by-bill :propConfig="config" @search="search" @onSmt="doSave" ref="bill" @resert="resert" @detail="openEdit"
+		<by-bill :propConfig="config" @search="search" ref="bill" @resert="resert" @detail="openEdit"
 			@onRefresh="resert" @pagination="pagination" @clickTab="clickTab">
 		</by-bill>
 		<vxe-modal v-model="vxeValue" width="70%" height="70%" min-width="800" min-height="600" show-zoom resize transfer
@@ -33,9 +33,11 @@
 	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 OrderTask extends Vue {
 		vxeValue = false
+		isCitation = false
 		timeNum = 0;
 		timer : any = null
 		baseInfo : any = {} // 订单数据
@@ -102,6 +104,122 @@
 			attr: {
 				activeName: 'all'
 			},
+			// 引单
+			source: [
+				{
+					title: '订单任务',
+					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
+										},
+									},
+								},
+								{
+									span: 6,
+									label: '交货时间',
+									prop: 'deliveryData',
+									component: 'by-date-picker',
+									compConfig: {
+										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: {
+							height: 620,
+							size: 'mini',
+							seq: true,
+							align: 'left',
+							radio: true
+						},
+						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: {
@@ -329,6 +447,12 @@
 							title: '交货地点',
 							field: 'address',
 						},
+						{
+							width: 150,
+							title: '状态',
+							field: 'status',
+							component: Assembly,
+						},
 						{
 							width: 110,
 							title: '操作',
@@ -445,6 +569,12 @@
 							title: '交货地点',
 							field: 'address',
 						},
+						{
+							width: 150,
+							title: '状态',
+							field: 'status',
+							component: Assembly,
+						},
 						{
 							width: 110,
 							title: '操作',
@@ -470,6 +600,30 @@
 				this.getDataList()
 			}, 500)
 		}
+		// 引单
+		citationOrder() {
+			let data : any = (this as any).$refs.bill.getSourceTableSelectData(0);
+			console.log(data);
+			if (data.length <= 0) return this.$message.warning('请选择引单数据');
+			data = data.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 = { save: true };
+			billConfig.tool.customTools = [];
+			this.isCitation = true;
+			(this.$refs.bill as any).showTab = 'bill';
+			setTimeout(() => {
+				(this.$refs.bill as any).setBillConfig(billConfig);
+				(this.$refs.bill as any).setBillFormValue(data[0]); // 设置单据表单数据
+				(this.$refs.bill as any).setBillTableValue(data[0].suborderList, 0);// 设置第1张单据表格数据
+			}, 0)
+		};
 		// 右拆单数据变化
 		rightChange(e : any) {
 			console.log(e.number);
@@ -522,33 +676,22 @@
 				splitList: rifhtNewData,
 			};
 			if (isTrue.length > 0) {
-				api.splitOrder(obj, 'supplyPurchaseOrder').then((res : any) => {
-					if (res.code === 200) {
-						this.$message.success('拆单成功!');
-						this.getPageList({}, 'all'); // 综合数据
-						this.vxeValue = false;
-					} else this.$message.error(res.msg);
-				})
+				this.$confirm('确定拆单吗!', '注意', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning',
+					center: true
+				}).then(() => {
+					api.splitOrder(obj, 'supplyPurchaseOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('拆单成功!');
+							this.getPageList({}, 'all'); // 综合数据
+							this.vxeValue = false;
+						} else this.$message.error(res.msg);
+					})
+				}).catch(() => this.$message.info('已取消拆单'));
 			} else this.$message.warning('请输入拆单销售数据');
 		}
-		// 保存新增
-		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();
-				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.$message.error(res.msg);
-				})
-			})
-		}
 		getDataList() {
 			if (!this.$refs.bill) {
 				if (this.timeNum > 5) {
@@ -574,11 +717,29 @@
 				} else this.$message.error(res.msg);
 			})
 		}
+		// 获取引单分页数据
+		getCitationList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
+			query.submitState = 1; // 已提交
+			query.status = 0; // 未接单
+			api.pageList(query, 'supplyTaskOrder').then((res : any) => {
+				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 //总条数
+					};
+					loading.close();
+					(this.$refs.bill as any).setSourcePage(0, page);
+				} else this.$message.error(res.msg)
+			})
+		}
 		// 打开编辑
 		openEdit(e : any) {
 			e = e.row ? e.row : e;
 			let loading = this.$loading({ target: '.main-container' });
-			api.single({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
+			api.single({ id: e.id }, 'supplyPurchaseOrder').then((res : any) => {
 				if (res.code === 200) {
 					let parentData = res.data ? res.data : e;
 					let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
@@ -592,7 +753,7 @@
 								}
 							},
 						];
-					} else {
+					} else if (parentData.status != 2) {
 						billConfig.tool.customTools = [
 							{
 								name: '终止订单', icon: 'el-icon-bottom', audit: [''], event: {
@@ -643,6 +804,10 @@
 		// 导航切换
 		clickTab(e : any) {
 			console.log('导航切换 ==> ', e);
+			// submitState: 提交状态
+			if (e === 'source') {
+				this.getCitationList({});
+			}
 			if (e === 'all') this.getDataList();
 			if (e === 'bill') {
 				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
@@ -688,15 +853,24 @@
 		// 搜索
 		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) // 获取综合分页数据
+			if (parames.type === 'source_0') {
+				this.getCitationList(query);
+			} else {
+				if (parames.type === 'draftsBox') query.submitState = 0 // 草稿箱数据
+				if (parames.type === 'smt') query.submitState = 1 // 已提交数据
+				this.getPageList(query, parames.type) // 获取综合分页数据
+			}
 		}
 		// 刷新/重置
 		resert(e : any) {
 			let data : any = e.type ? e.type : e;
-			(this as any).$refs.bill.$refs[data].clearSearch();
-			if (data === 'all') this.getPageList({}, 'all'); // 综合数据
+			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'); // 综合数据
+			}
 		}
 	}
 </script>

+ 3 - 2
src/views/audit/warehousing/components/towInOne.vue

@@ -94,13 +94,14 @@
 		doConfirm() {
 			let data : any = (this as any).$refs.form.getValue();
 			// console.log(data);
+			// console.log(this.parentValue);
 			if (!data.storehouseId || !data.storingLocationId) return this.$message.warning('仓库仓位为必填项');
 			data.towInOne = data.storehouseName + ',' + data.storingLocationName;
-			if (this.parentValue.id) {
+			if (this.parentValue.materialSku) {
 				let loading = this.$loading({ target: '.main-container' });
 				api.getInventoryByStoridAndSkuid({
 					storidId: data.storehouseId,
-					skuid: this.parentValue.id,
+					skuid: this.parentValue.materialSku,
 				}).then((res : any) => {
 					if (res.code === 200) {
 						data.inventory = res.data;

+ 20 - 15
src/views/audit/warehousing/index.vue

@@ -251,7 +251,6 @@
 				},
 				tool: {
 					tools: {
-						delete: true,
 						search: true,
 						refresh: true
 					}
@@ -681,6 +680,8 @@
 		}
 		// 监听表格数据变化
 		onChangeRow(e : any) {
+			this.isChange = true;
+			this.isSubmit = false;
 			e.totalPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
 		}
 		// 确定商品新增
@@ -741,10 +742,12 @@
 				if (this.isAdd) {
 					api.saveList(query, 'supplyEntryOrder').then((res : any) => {
 						if (res.code === 200) {
-							this.$message.success(res.msg);
+							// this.isAdd = false;
+							// this.isChange = false;
+							// this.isSubmit = true;
 							this.getDataList();
+							this.$message.success('保存成功');
 							(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') {
@@ -752,10 +755,9 @@
 					console.log('保存 ==>', query);
 					api.updateList(query, 'supplyEntryOrder').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({});
+							this.$message.success('保存成功');
+							this.isChange = false;
+							this.isSubmit = true;
 						} else this.$message.error(res.msg);
 					})
 				};
@@ -775,11 +777,11 @@
 				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张单据表格数据
-				}
+				// 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);
@@ -798,7 +800,7 @@
 					let parentData = res.data ? res.data : e;
 					this.baseInfo = parentData;
 					if (this.tabType === 'all' || this.tabType === 'draftsBox') {
-						if (this.tabType === 'all' && parentData.submitState === 1) {
+						if (parentData.submitState === 1) {
 							loading.close();
 							return this.setReadonly(parentData)
 						}
@@ -850,11 +852,13 @@
 			let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
 			readonly.form.attr.readonly = true; // 设置只读
 			readonly.tool.tools = {};
+			if (this.tabType != 'recycleBin') {
+				if (e.submitState === 1) readonly.tool.tools = { returnSmt: true };
+			}
 			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;
-			data.map((v : any, i : any) => {
+			data.map((v : any) => {
 				if (!v.prePrice) v.prePrice = '0';
 				v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
 			});
@@ -885,6 +889,7 @@
 					})
 				}).catch(() => this.$message.info('已取消提交'));
 			} else {
+				// if(this.isAdd) return this.$message.warning('新增数据必须先保存才能提交');
 				console.log('isChange ==> ', this.isChange);
 				console.log('isSubmit ==> ', this.isSubmit);
 				if (this.isSubmit) {