浏览代码

出入库提交第一版

AlanWong 2 年之前
父节点
当前提交
1c902709a7

+ 1 - 0
.gitignore

@@ -21,3 +21,4 @@ pnpm-debug.log*
 *.njsproj
 *.sln
 *.sw?
+vue.config.js

+ 22 - 3
src/api/order.ts

@@ -25,6 +25,7 @@ function saveList(data : any, url : any) {
 		data: data
 	})
 }
+// 出库
 function outbound(data : any, url : any) {
 	return request({
 		url: '/supply/' + url + '/outbound',
@@ -62,7 +63,7 @@ function deleteList(data : any, url : any) {
 	return request({
 		url: '/supply/' + url + '/delete',
 		method: 'POST',
-		data: data
+		params: data
 	})
 }
 // 回收站数据
@@ -95,7 +96,7 @@ function stoporder(data : any, url : any) {
 	return request({
 		url: '/supply/' + url + '/stoporder',
 		method: 'POST',
-		data: data
+		params: data
 	})
 }
 // 业务类型
@@ -105,6 +106,22 @@ function getbusinessType(url : any) {
 		method: 'GET'
 	})
 }
+// 根据仓位id、物料SKUid获取库存
+function getInventoryByStoridAndSkuid(data : any) {
+	return request({
+		url: '/supply/supplyInventory/getInventoryByStoridAndSkuid',
+		method: 'GET',
+		params: data
+	})
+}
+// 详情
+function single(data:any, url : any) {
+	return request({
+		url: '/supply/' + url + '/single',
+		method: 'GET',
+		params: data
+	})
+}
 export default {
 	treeList,
 	pageList,
@@ -118,5 +135,7 @@ export default {
 	stoporder,
 	submitTo,
 	cancelSubmission,
-	getbusinessType
+	getbusinessType,
+	getInventoryByStoridAndSkuid,
+	single
 }

+ 22 - 10
src/benyun/components/byBill/byBill.vue

@@ -13,6 +13,8 @@
 				<div class="bill-nav" v-if="allConfig" :class="{'onBill':showTab == 'all'}" @click="tabChange('all')">综合查询</div>
 				<div class="bill-nav" v-if="recycleBinConfig" :class="{'onBill':showTab == 'recycleBin'}"
 					@click="tabChange('recycleBin')">回收站</div>
+				<div class="bill-nav" v-if="returnOrderConfig" :class="{'onBill':showTab == 'returnOrder'}"
+					@click="tabChange('returnOrder')">终止订单</div>
 				<div class="bill-nav" v-for="(item,index) of customs" :class="{'onBill':showTab == item.name}"
 					@click="tabChange(item.name)" :key="index">{{item.label}}</div>
 			</div>
@@ -61,7 +63,8 @@
 						<i v-else class="el-icon-s-unfold"></i>
 					</div>
 				</div>
-				<el-drawer v-if="billConfig && billConfig.log" class="log-drawer" :size="600" append-to-body title="操作日志" :visible.sync="drawer" direction="rtl">
+				<el-drawer v-if="billConfig && billConfig.log" class="log-drawer" :size="600" append-to-body title="操作日志"
+					:visible.sync="drawer" direction="rtl">
 					<byLog :propConfig="billConfig && billConfig.log" :parentValue="billValue" ref="log" />
 				</el-drawer>
 			</div>
@@ -89,6 +92,11 @@
 					@search="search($event,'recycleBin')" @resert="resert('recycleBin')"
 					@pagination="paginationChange($event,'recycleBin')" @detail="detail($event,'recycleBin')" />
 			</div>
+			<!-- 终止订单 -->
+			<div class="bill-box" v-if="returnOrderConfig" :class="{'on-show':showTab == 'returnOrder'}">
+			  <bill-module :propConfig="returnOrderConfig" ref="returnOrder" @clickHandle="clickHandle($event,'returnOrder')" @search="search($event,'returnOrder')" 
+			  @resert="resert('returnOrder')" @pagination="paginationChange($event,'returnOrder')" @detail="detail($event,'returnOrder')" />
+			</div>
 			<!-- 插槽 -->
 			<div class="bill-box" v-for="(item,index) of customs" :key="index" :class="{'on-show':showTab == item.name}">
 				<slot :name='item.name'></slot>
@@ -170,6 +178,10 @@
 		get recycleBinConfig() {
 			return this.config?.recycleBin ? this.config.recycleBin : null;
 		}
+		// 终止订单
+		get returnOrderConfig(){
+			return this.config?.returnOrder ? this.config.returnOrder : null;
+		}
 		//自定义插槽
 		get customs() {
 			return this.config?.customs ? this.config.customs : []
@@ -182,15 +194,15 @@
 		}
 		//日志弹窗
 		showLog() {
-      this.$nextTick(()=>{
-        if (this.$refs.billForm) {
-          this.billValue = (this.$refs.billForm as any).getValue();
-          this.drawer = true;
-        }
-        if (this.$refs.log) {
-          (this.$refs.log as any).request();
-        }
-      })
+			this.$nextTick(() => {
+				if (this.$refs.billForm) {
+					this.billValue = (this.$refs.billForm as any).getValue();
+					this.drawer = true;
+				}
+				if (this.$refs.log) {
+					(this.$refs.log as any).request();
+				}
+			})
 		}
 
 		setConfigAfter() {

+ 11 - 7
src/views/audit/order/index.vue

@@ -393,12 +393,16 @@
 		// 打开编辑
 		openEdit(e : any) {
 			e = e.row ? e.row : e;
-			// let readonly = (this as any).$lodash.cloneDeep(this.config.bill);
-			// console.log(this.config.bill);
-			// (this.$refs.bill as any).setBillConfig(readonly);
-			(this.$refs.bill as any).setBillFormValue(e); // 设置单据表单数据
-			(this.$refs.bill as any).setBillTableValue(e.suborderList, 0);// 设置第1张单据表格数据
-			(this.$refs.bill as any).showTab = 'bill';
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
+				if (res.code === 200) {
+					let parentData = res.data ? res.data : e;
+					(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();
+			});
 		}
 		// 搜索
 		search(parames : any) {
@@ -433,7 +437,7 @@
 		}
 		// 刷新/重置
 		resert(e : any) {
-			let data:any = e.type ? e.type : e;
+			let data : any = e.type ? e.type : e;
 			(this as any).$refs.bill.$refs[data].clearSearch();
 			if (data === 'all') this.getPageList({}, 'all'); // 综合数据
 		}

+ 2 - 0
src/views/audit/orderTask/components/focus.vue

@@ -27,7 +27,9 @@
 		// 确定机构名称
 		confirm(e : any) {
 			this.value = e[0].name;
+			delete e[0].remark;
 			this.$emit('getSupplierModal', e[0])
+			// console.log(e[0]);
 			// this.$emit('onChange', e[0])
 			
 		}

+ 51 - 40
src/views/audit/orderTask/index.vue

@@ -920,47 +920,58 @@
 		// 打开编辑
 		openEdit(e : any) {
 			e = e.row ? e.row : e;
-			this.baseInfo = e;
 			console.log('编辑tabType ==>', this.tabType);
 			console.log('编辑 ==>', e);
-			if (this.tabType != 'smt' && e.sourceType == '手工输入' || this.tabType === 'draftsBox') {
-				if (this.tabType === 'all' && e.submitState === 1) return this.setReadonly(e);
-				let data = e.suborderList
-				data.map((v : any, i : any) => {
-					v.dataIndex = i;
-					if (!v.prePrice) v.prePrice = '0';
-				});
-				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
-				if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
-					billConfig.tableConfig[0].table.columns.push({
-						width: 90,
-						title: '操作',
-						action: true,
-						plugins: [{
-							icon: 'el-icon-delete',
-							name: '删除',
-							audit: '',
-							event: {
-								click: (item : any) => {
-									(this as any).changeTable(item)
-								}
-							}
-						}]
-					})
-				};
-				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);
-			};
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
+				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) {
+							loading.close();
+							return this.setReadonly(parentData)
+						};
+						let data = parentData.suborderList
+						data.map((v : any, i : any) => {
+							v.dataIndex = i;
+							if (!v.prePrice) v.prePrice = '0';
+						});
+						let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+						if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
+							billConfig.tableConfig[0].table.columns.push({
+								width: 90,
+								title: '操作',
+								action: true,
+								plugins: [{
+									icon: 'el-icon-delete',
+									name: '删除',
+									audit: '',
+									event: {
+										click: (item : any) => {
+											(this as any).changeTable(item)
+										}
+									}
+								}]
+							})
+						};
+						billConfig.form.attr.readonly = false; // 设置只读
+						billConfig.tool.tools = { save: true, };
+						if (this.tabType === 'draftsBox' || 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);
+						(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
+						(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
+						this.isAdd = false;
+						(this.$refs.bill as any).showTab = 'bill';
+						loading.close();
+					} else {
+						loading.close();
+						this.setReadonly(parentData);
+					};
+				}
+			})
 		}
 		// 设置只读
 		setReadonly(e : any) {
@@ -1250,7 +1261,7 @@
 		}
 		// 刷新/重置
 		resert(e : any) {
-			let data:any = e.type ? e.type : e;
+			let data : any = e.type ? e.type : e;
 			(this as any).$refs.bill.$refs[data].clearSearch();
 			if (data === 'all') this.getPageList({}, 'all'); // 综合数据
 			if (data === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据

+ 333 - 294
src/views/audit/outbound/index.vue

@@ -1,8 +1,8 @@
 <template>
 	<div>
-		<by-bill ref="bill" :propConfig="config" @search="search" @onDelete="onDelete" @onRefresh="resert" @resert="resert"
-			@detail="openEdit" @onSave="onSave" @clickTab="clickTab" @onChangeRow="onChangeRow" @pagination="pagination"
-			@getSupplierModal="getSupplierModal">
+		<by-bill ref="bill" :propConfig="config" @search="search" @onSmt="onSmt" @onDelete="onDelete" @onRefresh="resert"
+			@resert="resert" @detail="openEdit" @onSave="onSave" @clickTab="clickTab" @onChangeRow="onChangeRow"
+			@pagination="pagination" @onReturnSmt="onReturnSmt2" @getSupplierModal="getSupplierModal">
 		</by-bill>
 		<!-- 选择物料 -->
 		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
@@ -13,18 +13,20 @@
 	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
 	import api from "@/api/order";
 	import productModal from "../orderTask/components/productModal.vue";
-	import Focus from "../orderTask/components/focus.vue";
+	import BusinessType from "../warehousing/components/businessType.vue";
 	import towInOne from "../warehousing/components/towInOne.vue";
 	@Component({ components: { productModal } })
 	export default class OrderTask extends Vue {
 		// 左边
 		tabType : any = 'all';
-		isAdd : any = false
+		isAdd : any = false;
+		baseInfo : any = {};
+		isSubmit : any = false
+		isChange : any = false
 		// 右边
 		supplierInfo : any = {} // 机构信息
+		businessType : any = '' // 业务类型
 		tableData : any = []
-		mergeObj : any = []
-		setStatusData : any = ''
 		timeNum = 0;
 		timer : any = null
 		config : any = {
@@ -53,18 +55,6 @@
 										}
 									}
 								},
-								{
-									span: 6,
-									label: '机构名称',
-									prop: 'organizationName',
-									component: 'by-input',
-									compConfig: {
-										attr: {
-											placeholder: '请输入机构名称',
-											clearable: true
-										},
-									},
-								},
 								{
 									span: 6,
 									label: '退单编号',
@@ -101,7 +91,7 @@
 							size: 'mini',
 							seq: true,
 							align: 'left',
-							checkbox: true
+							radio: true
 						},
 						columns: [
 							{
@@ -109,15 +99,6 @@
 								title: '单据编号',
 								field: 'orderNumber',
 							},
-							// {
-							// 	width: 50,
-							// 	component: OrderType,
-							// },
-							{
-								width: 180,
-								title: '机构名称',
-								field: 'organizationName',
-							},
 							{
 								width: 178,
 								title: '退单编号',
@@ -161,13 +142,13 @@
 				},
 				form: {
 					attr: {
-						size: 'small',
+						size: 'medium',
 						readonly: false,
-						// rules: {
-						// 	outOrderNo: [{
-						// 		required: true, message: '请输入单据编号', trigger: 'blur'
-						// 	}]
-						// }
+						rules: {
+							operator: [{
+								required: true, message: '请输入经办人', trigger: 'blur'
+							}],
+						}
 					},
 					columns: [
 						[
@@ -184,21 +165,27 @@
 							},
 							{
 								span: 8,
-								label: '机构名称',
-								prop: 'organizationName',
-								component: Focus,
+								label: '经办人',
+								prop: 'operator',
+								component: 'by-input',
 							},
 							{
 								span: 8,
-								label: '经办人',
-								prop: 'operator',
+								label: '收货人',
+								prop: 'receive',
 								component: 'by-input',
 							},
 							{
 								span: 8,
-								label: '业务类型',
-								prop: 'businessType',
-								component: 'by-select',
+								label: '收获地址',
+								prop: 'receiveAddress',
+								component: 'by-input',
+							},
+							{
+								span: 8,
+								label: '联系方式',
+								prop: 'receivePhone',
+								component: 'by-input',
 							},
 							{
 								span: 8,
@@ -206,6 +193,12 @@
 								prop: 'wmsId',
 								component: 'by-input',
 							},
+							{
+								span: 8,
+								label: '业务类型',
+								prop: 'businessType',
+								component: BusinessType,
+							},
 						],
 						[
 							{
@@ -256,7 +249,7 @@
 								{
 									width: 100,
 									title: '库存',
-									field: 'unit2',
+									field: 'inventory',
 								},
 								{
 									width: 100,
@@ -288,24 +281,6 @@
 										},
 									}
 								},
-								{
-									width: 100,
-									title: '实际金额',
-									field: 'realityPrice',
-								},
-								{
-									width: 100,
-									title: '优惠金额',
-									field: 'prePrice',
-									component: 'by-input',
-									compConfig: {
-										attr: {
-											size: 'mini',
-											type: 'number',
-											defaultValue: '0',
-										},
-									}
-								},
 								{
 									width: 100,
 									title: '合计金额',
@@ -351,18 +326,6 @@
 									}
 								}
 							},
-							{
-								span: 6,
-								label: '机构名称',
-								prop: 'organizationName',
-								component: 'by-input',
-								compConfig: {
-									attr: {
-										placeholder: '请输入机构名称',
-										clearable: true
-									},
-								},
-							},
 							{
 								span: 6,
 								label: '财务系统单据',
@@ -401,15 +364,6 @@
 							isDetail: true,
 							fixed: 'left'
 						},
-						{
-							width: 200,
-							title: '仓库,仓位',
-							field: 'towInOne',
-							component: towInOne,
-							compConfig: {
-								isSelect: false
-							}
-						},
 						{
 							width: 150,
 							title: '财务系统单据',
@@ -440,6 +394,11 @@
 							title: '联系方式',
 							field: 'receivePhone',
 						},
+						{
+							width: 120,
+							title: '业务类型',
+							field: 'businessType',
+						},
 						{
 							width: 110,
 							title: '操作',
@@ -454,9 +413,9 @@
 									}
 								}
 							}, {
-								name: '删除',
+								name: '反提交',
 								event: {
-									click: (item : any) => (this as any).doDelete2(item)
+									click: (item : any) => (this as any).onReturnSmt(item)
 								}
 							}]
 						}
@@ -483,18 +442,6 @@
 									}
 								}
 							},
-							{
-								span: 6,
-								label: '机构名称',
-								prop: 'organizationName',
-								component: 'by-input',
-								compConfig: {
-									attr: {
-										placeholder: '请输入机构名称',
-										clearable: true
-									},
-								},
-							},
 							{
 								span: 6,
 								label: '财务系统单据',
@@ -534,15 +481,6 @@
 							isDetail: true,
 							fixed: 'left'
 						},
-						{
-							width: 200,
-							title: '仓库,仓位',
-							field: 'towInOne',
-							component: towInOne,
-							compConfig: {
-								isSelect: false
-							}
-						},
 						{
 							width: 150,
 							title: '财务系统单据',
@@ -573,6 +511,11 @@
 							title: '联系方式',
 							field: 'receivePhone',
 						},
+						{
+							width: 120,
+							title: '业务类型',
+							field: 'businessType',
+						},
 						{
 							width: 110,
 							title: '操作',
@@ -616,18 +559,6 @@
 									}
 								}
 							},
-							{
-								span: 6,
-								label: '机构名称',
-								prop: 'organizationName',
-								component: 'by-input',
-								compConfig: {
-									attr: {
-										placeholder: '请输入机构名称',
-										clearable: true
-									},
-								},
-							},
 							{
 								span: 6,
 								label: '财务系统单据',
@@ -652,7 +583,7 @@
 						{
 							name: '出库', icon: 'el-icon-top', audit: [''], event: {
 								click: () => {
-									(this as any).outbound('all')
+									(this as any).outbound()
 								}
 							}
 						},
@@ -681,15 +612,6 @@
 							isDetail: true,
 							fixed: 'left'
 						},
-						{
-							width: 200,
-							title: '仓库,仓位',
-							field: 'towInOne',
-							component: towInOne,
-							compConfig: {
-								isSelect: false
-							}
-						},
 						{
 							width: 150,
 							title: '财务系统单据',
@@ -720,12 +642,16 @@
 							title: '联系方式',
 							field: 'receivePhone',
 						},
+						{
+							width: 120,
+							title: '业务类型',
+							field: 'businessType',
+						},
 						{
 							width: 120,
 							title: '操作',
 							action: true,
 							plugins: [{
-								// icon: 'el-icon-edit',
 								name: '查看',
 								audit: '',
 								event: {
@@ -763,18 +689,6 @@
 									}
 								}
 							},
-							{
-								span: 6,
-								label: '机构名称',
-								prop: 'organizationName',
-								component: 'by-input',
-								compConfig: {
-									attr: {
-										placeholder: '请输入机构名称',
-										clearable: true
-									},
-								},
-							},
 							{
 								span: 6,
 								label: '财务系统单据',
@@ -812,15 +726,6 @@
 							isDetail: true,
 							fixed: 'left'
 						},
-						{
-							width: 200,
-							title: '仓库,仓位',
-							field: 'towInOne',
-							component: towInOne,
-							compConfig: {
-								isSelect: false
-							}
-						},
 						{
 							width: 150,
 							title: '财务系统单据',
@@ -851,24 +756,27 @@
 							title: '联系方式',
 							field: 'receivePhone',
 						},
+						{
+							width: 120,
+							title: '业务类型',
+							field: 'businessType',
+						},
 						{
 							width: 110,
 							title: '操作',
 							action: true,
 							plugins: [{
-								// icon: 'el-icon-edit',
 								name: '查看',
 								audit: '',
 								event: {
 									click: (e : any) => {
-										(this as any).setReadonly(e)
+										(this as any).openEdit(e)
 									}
 								}
 							}]
 						}
 					]
 				}
-
 			}
 		}
 		created() {
@@ -878,10 +786,18 @@
 		}
 		// 引单
 		citationOrder() {
-			console.log();
 			let data : any = (this as any).$refs.bill.getSourceTableSelectData(0);
 			console.log(data);
+			data = data.map((item : any) => {
+				item.receiveAddress = item.address
+				item.receive = item.consignee
+				item.receivePhone = item.phone
+				const { ...newData } = item
+				return newData
+			})
+			if (data.length <= 0) return this.$message.warning('请选择引单数据');
 			(this.$refs.bill as any).showTab = 'bill';
+			this.isAdd = true;
 			setTimeout(() => {
 				(this.$refs.bill as any).setBillFormValue(data[0]); // 设置单据表单数据
 				(this.$refs.bill as any).setBillTableValue(data[0].suborderList, 0);// 设置第1张单据表格数据
@@ -893,33 +809,26 @@
 		}
 		// 监听表格数据变化
 		onChangeRow(e : any) {
-			e.realityPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
-			e.totalPrice = e.realityPrice - e.prePrice;
+			e.totalPrice = parseFloat((e.number * e.unitPrice).toFixed(2));
 		}
 		// 确定商品新增
 		confirmProduct(e : any) {
 			let contents : any = [], goodsData = e, newArr : any = [], obj : any = {};
 			goodsData = goodsData.map((item : any) => {
 				item.materialName = item.skuTitle
-				item.prePrice = 0
-				// item.materialId = item.materialId
 				item.unitPrice = item.price
 				item.materialSku = item.id
 				const { id, ...newData } = item
-				// const { skuTitle, price, id, materialId, ...newData } = item
 				return newData
 			})
 			this.tableData = this.tableData.concat(goodsData);
 			newArr = this.tableData.reduce((prev : any, current : any) => {
-				// console.log('prev ==> ', prev);
-				// console.log('current ==> ', current);
 				obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
 				return prev
 			}, []);
 			this.tableData = newArr;
 			this.tableData.map((v : any, i : any) => {
 				v.dataIndex = i
-				if (!v.prePrice) v.prePrice = '0';
 			});
 			if (contents.length > 0) {
 				this.$alert('商品 “' + contents + '” 已存在!', '提示', {
@@ -934,33 +843,20 @@
 			(this as any).$refs.bill.$refs.billForm.validate().then(() => {
 				let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
 				console.log(query);
-				// 供应商数据
-				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;
 				query.purchaseOrderId = query.id;
 				query.suborderList = (this.$refs.bill as any).getBillTableData(0);
-				query.businessType = "销售类型";
 				if (query.suborderList.length > 0) {
 					for (let v of query.suborderList) {
-						console.log(v.prePrice);
-						if (!v.number || v.number <= 0) return this.$message.warning('请输入正确物料数量');
+						// if (!v.number || v.number <= 0) return this.$message.warning('请输入正确物料数量');
 						if (!v.unitPrice || v.unitPrice <= 0) return this.$message.warning('请输入正确物料单价');
-						if (v.prePrice.length <= 0 || v.prePrice < 0) return this.$message.warning('请输入正确优惠金额');
+						if (v.number > v.inventory) return this.$message.warning('出库数据不能大于库存数量');
 						v.taskOrderId = query.id;
 						v.purchaseSuborderId = v.id;
-						v.storehouseName = '三号仓库';
-						v.storehouseId = 3;
-						v.storingLocationName = '七号仓位';
-						v.storingLocationId = 7;
 					}
 				};
-				query.suborderList.map((v : any) => {
-					delete v.id;
-				});
-				delete query.id;
 				// 表格删除
 				query.suborderList.map((v : any, i : any) => {
 					if (v.isDeleted === 1 && !v.id) {
@@ -969,142 +865,260 @@
 				});
 				if (query.deliveryData) query.deliveryData = query.deliveryData + ' 00:00:00';
 				console.log('出库参数query ==> ', query);
-				api.outbound(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);
-				})
 				if (this.isAdd) {
-					// 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);
-					// })
+					query.suborderList.map((v : any) => {
+						delete v.id;
+					});
+					delete query.id;
+					api.outbound(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);
-					// })
+					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);
+					})
 				};
+
 			})
 		}
 		// 出库打开引单
-		outbound(e : any) {
-			console.log('出库 ==>', e);
+		outbound() {
+			this.clickTab('source');
 			(this.$refs.bill as any).showTab = 'source';
-			// 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张单据表格数据
-			// 	}
-			// 	this.isAdd = true;
-			// 	(this.$refs.bill as any).setBillConfig(billConfig);
-			// 	(this.$refs.bill as any).setBillFormValue({}); // 设置单据表单数据
-			// };
 		}
 		// 打开编辑
 		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;
-					if (!v.prePrice) v.prePrice = '0';
-					v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
-				});
-				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
-				if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
-					billConfig.tableConfig[0].table.columns.push({
-						width: 90,
-						title: '操作',
-						action: true,
-						plugins: [{
-							icon: 'el-icon-delete',
-							name: '删除',
-							audit: '',
-							event: {
-								click: (item : any) => {
-									(this as any).changeTable(item)
+			console.log('编辑 ==>', e);
+			e = e.row ? e.row : e;
+			api.single({ id: e.id }, 'supplyEntryOrder').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' });
+						let data = parentData.suborderList;
+						let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+						if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
+							billConfig.tableConfig[0].table.columns.push({
+								width: 90,
+								title: '操作',
+								action: true,
+								plugins: [{
+									icon: 'el-icon-delete',
+									name: '删除',
+									audit: '',
+									event: {
+										click: (item : any) => {
+											(this as any).changeTable(item)
+										}
+									}
+								}]
+							})
+						};
+						billConfig.form.attr.readonly = false; // 设置只读
+						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) => {
+							v.dataIndex = i;
+							v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
+							//  查库存
+							api.getInventoryByStoridAndSkuid({
+								storidId: v.storehouseId,
+								skuid: v.id,
+							}).then((res : any) => {
+								if (res.code === 200) {
+									v.inventory = res.data;
+									if (data.length === (i + 1)) {
+										this.tableData = data;
+										(this.$refs.bill as any).setBillConfig(billConfig);
+										(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
+										(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
+										this.isAdd = false;
+										(this.$refs.bill as any).showTab = 'bill';
+										loading.close();
+									}
 								}
-							}
-						}]
-					})
-				};
-				billConfig.form.attr.readonly = false; // 设置只读
-				billConfig.tool.tools = { save: true, };
-				if (this.tabType === 'draftsBox' || e.submitState === 0) billConfig.tool.tools = { save: true, smt: 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);
-			};
+							})
+						});
+					} else {
+						this.setReadonly(parentData);
+					};
+				}
+			})
 		}
 		// 设置只读
 		setReadonly(e : any) {
+			let loading = this.$loading({ target: '.main-container' });
 			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 != '操作');
-			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';
-
+			data.map((v : any, i : any) => {
+				v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
+				//  查库存
+				api.getInventoryByStoridAndSkuid({
+					storidId: v.storehouseId,
+					skuid: v.id,
+				}).then((res : any) => {
+					if (res.code === 200) {
+						v.inventory = res.data;
+						if (data.length === (i + 1)) {
+							(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';
+							loading.close();
+						}
+					}
+				})
+			});
+		}
+		// 工具栏提交
+		onSmt(e : any) {
+			if (e === 'draftsBox') {
+				let selectData = (this.$refs.bill as any).getTableSelectData('draftsBox'); // 获取表格选中数据
+				if (selectData.length <= 0) return this.$message.warning('请选择提交数据');
+				if (selectData.length > 1) return this.$message.warning('只能提交一条数据');
+				this.$confirm('确定提交吗!', '注意', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning',
+					center: true
+				}).then(() => {
+					api.submitTo({ id: selectData[0].id }, 'supplyEntryOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('提交成功');
+							this.clickTab('draftsBox');
+						} else this.$message.error(res.msg)
+					})
+				}).catch(() => this.$message.info('已取消提交'));
+			} else {
+				console.log('isChange ==> ', this.isChange);
+				console.log('isSubmit ==> ', this.isSubmit);
+				if (this.isSubmit) {
+					this.$confirm('确定提交吗!', '注意', {
+						confirmButtonText: '确定',
+						cancelButtonText: '取消',
+						type: 'warning',
+						center: true
+					}).then(() => {
+						api.submitTo({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+							if (res.code === 200) {
+								this.$message.success('提交成功');
+								this.clickTab(this.tabType);
+								this.isSubmit = false;
+								(this.$refs.bill as any).showTab = this.tabType;
+							} else this.$message.error(res.msg)
+						})
+					}).catch(() => this.$message.info('已取消提交'));
+				} else {
+					// 表单旧数据
+					let oldbillForm : any = (this as any).$lodash.cloneDeep(this.baseInfo);
+					if (oldbillForm.suborderList) delete oldbillForm.suborderList;
+					oldbillForm = JSON.stringify(oldbillForm);
+					// 表单新数据
+					let newBillForm : any = (this as any).$refs.bill.getBillFormValue();
+					if (newBillForm.suborderList) delete newBillForm.suborderList;
+					newBillForm = JSON.stringify(newBillForm);
+					// 表格旧数据
+					this.baseInfo.suborderList.map((v : any) => {
+						if (v._X_ROW_KEY) delete v._X_ROW_KEY;
+					});
+					let oldData : any = JSON.stringify(this.baseInfo.suborderList);
+					// 表格新数据
+					let newData : any = JSON.stringify((this as any).$refs.bill.getBillTableData(0));
+					// 数据有变进保存
+					if (this.isChange || oldbillForm != newBillForm || oldData != newData) {
+						return this.$message.warning('数据变更必须先保存再提交');
+					} else {
+						this.$confirm('确定提交吗!', '注意', {
+							confirmButtonText: '确定',
+							cancelButtonText: '取消',
+							type: 'warning',
+							center: true
+						}).then(() => {
+							// console.log(this.baseInfo.id);
+							api.submitTo({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+								if (res.code === 200) {
+									this.$message.success('提交成功');
+									this.clickTab(this.tabType);
+									(this.$refs.bill as any).showTab = this.tabType;
+								} else this.$message.error(res.msg)
+							})
+						}).catch(() => this.$message.info('已取消提交'));
+					}
+				}
+			}
+		}
+		// 操作反提交
+		onReturnSmt(e : any) {
+			console.log('反提交 ==>', e);
+			this.$confirm('确定反提交吗!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				if (this.tabType === 'smt') {
+					api.cancelSubmission({ id: e.id }, 'supplyEntryOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('反提交成功');
+							this.clickTab(this.tabType);
+						} else this.$message.error(res.msg)
+					})
+				}
+			}).catch(() => this.$message.info('已取消反提交'));
+		}
+		// 工具栏反提交
+		onReturnSmt2() {
+			console.log('工具栏反提交 ==>', this.baseInfo);
+			this.$confirm('确定反提交吗!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				if (this.tabType === 'smt') {
+					api.cancelSubmission({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('反提交成功');
+							this.clickTab(this.tabType);
+							(this.$refs.bill as any).showTab = 'smt';
+						} else this.$message.error(res.msg)
+					})
+				}
+			}).catch(() => this.$message.info('已取消反提交'));
 		}
 		// 切换tab栏
 		clickTab(e : any) {
 			console.log('切换tab ==> ', e);
 			this.tabType = e;
+			this.isAdd = false;
 			// submitState: 提交状态
 			if (e === 'source') {
-				api.pageList({}, 'supplyPurchaseOrder').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 //总条数
-						};
-						(this.$refs.bill as any).setSourcePage(0, page)
-					} else this.failHandle(res)
-				})
+				this.isAdd = true;
+				this.getCitationList({});
 			}
-			if (e === 'all') this.getPageList({ pageSize: 10, pageNo: 1 }, 'all'); // 草稿箱数据
+			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({ pageNo: 1, pageSize: 10 }); // 回收站数据
+			if (e === 'recycleBin') this.getSelectDeleteList({}); // 回收站数据
 		}
 		// 初始化
 		getDataList() {
@@ -1116,7 +1130,7 @@
 				return
 			}
 			clearInterval(this.timer)
-			this.getPageList({ pageSize: 10, pageNo: 1 }, 'all'); // 综合数据
+			this.getPageList({}, 'all'); // 综合数据
 		}
 		// 分页
 		pagination(e : any) {
@@ -1140,7 +1154,22 @@
 					} else this.failHandle(res)
 				})
 			}
-
+		}
+		// 获取引单分页数据
+		getCitationList(query : any) {
+			let loading = this.$loading({ target: '.main-container' });
+			api.pageList(query, 'supplyPurchaseOrder').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.failHandle(res)
+			})
 		}
 		// 获取分页数据
 		getPageList(query : any, type : any) {
@@ -1172,20 +1201,30 @@
 		}
 		// 搜索
 		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) // 获取分页数据
+			console.log('搜索 ==> ', parames);
+			let query = parames.value;
+			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 === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
-			if (data === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
-			if (data === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
+			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 === 'draftsBox') this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
+				if (data === 'smt') this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
+				if (data === 'recycleBin') this.getSelectDeleteList({}) // 回收站数据
+			}
 		}
 		// 单据表格删除
 		changeTable(item : any) {

+ 0 - 134
src/views/audit/saleOrder/components/byBill/billModule.vue

@@ -1,134 +0,0 @@
-<template>
-	<div class="bill-module-box">
-		<div class="bill-module-form" v-if="searchConfig" v-show="!hideSearch">
-			<by-form :propConfig="searchConfig" ref="search" />
-			<div class="search-btn">
-				<el-button type="primary" size="mini" icon="el-icon-search" @click="search">搜索</el-button>
-				<el-button size="mini" icon="el-icon-refresh" @click="resert">重置</el-button>
-			</div>
-		</div>
-		<div class="bill-tool" v-if="toolConfig">
-			<by-tool :propConfig="toolConfig" ref="tool" @clickHandle="clickHandle" />
-		</div>
-		<div class="table" v-if="tableConfig">
-			<by-table :propConfig="tableConfig" ref="table" v-on="$listeners" />
-		</div>
-	</div>
-</template>
-
-<script lang="ts">
-	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
-	@Component
-	export default class BillModule extends Vue {
-		config : any = {}
-		hideSearch = false
-
-		@Prop()
-		propConfig : any
-
-		get searchConfig() {
-			return this.config?.search ? this.config.search : null
-		}
-
-		get toolConfig() {
-			return this.config?.tool ? this.config.tool : null
-		}
-
-		get tableConfig() {
-			return this.config?.table ? this.config.table : null
-		}
-
-		created() {
-			if (this.propConfig) {
-				this.setConfig(this.propConfig)
-			}
-		}
-
-		setConfig(c : any) {
-			this.config = c ? c : {}
-		}
-
-		getConfig() {
-			return (this as any).$lodash.cloneDeep(this.config)
-		}
-		//工具栏按钮点击操作
-		clickHandle(n : string) {
-			if (n == 'toggleSearch') {
-				this.hideSearch = !this.hideSearch
-			} else {
-				this.$emit('clickHandle', n)
-			}
-		}
-
-		//获取搜索值
-		getSearchValue() {
-			let value : any = {}
-			if (this.$refs.search) {
-				value = (this.$refs.search as any).getValue()
-			}
-			return value
-		}
-		//获取表格数据
-		getTableValue() {
-			let data : Array<any> = [];
-			if (this.$refs.table) {
-				data = (this.$refs.table as any).getValue();
-			}
-			return data;
-		}
-		//获取已选中表格数据
-		getSelectTable() {
-			let data : Array<any> = [];
-			if (this.$refs.table) {
-				data = (this.$refs.table as any).getSelectData();
-			}
-			return data;
-		}
-		//清除搜索条件
-		clearSearch() {
-			(this.$refs.search as any).clearValue();
-		}
-		search() {
-			this.$emit('search', this.getSearchValue());
-		}
-		resert() {
-			if (this.$refs.search) {
-				(this.$refs.search as any).setValue({})
-			}
-			this.$emit('resert');
-		}
-		//设置表格数据
-		setTableValue(data : Array<any>) {
-			if (this.$refs.table) {
-				(this.$refs.table as any).setValue(data)
-			}
-		}
-		setPage(page : any) {
-			if (this.$refs.table) {
-				(this.$refs.table as any).setPage(page)
-			}
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.bill-module-box {
-		width: 100%;
-
-		.bill-tool {
-			width: 100%;
-			padding-bottom: 16px;
-		}
-
-		.bill-module-form {
-			padding-bottom: 8px;
-
-			.search-btn {
-				width: 100%;
-				display: flex;
-				justify-content: flex-end;
-			}
-		}
-
-	}
-</style>

+ 0 - 473
src/views/audit/saleOrder/components/byBill/byBill.vue

@@ -1,473 +0,0 @@
-<template>
-  <div class="bill">
-    <div class="bill-left">
-      <div class="bill-tab" :style="{width:closeTab?0:'200px'}">
-        <div class="bill-title">导航</div>
-        <div class="bill-nav" v-if="sourceConfig" :class="{'onBill':showTab == 'source'}" @click="tabChange('source')">引单</div>
-        <div class="bill-nav" v-if="billConfig" :class="{'onBill':showTab == 'bill'}" @click="tabChange('bill')">单据</div>
-        <div class="bill-nav" v-if="smtConfig" :class="{'onBill':showTab == 'smt'}" @click="tabChange('smt')">已提交</div>
-        <div class="bill-nav" v-if="draftsBoxConfig" :class="{'onBill':showTab == 'draftsBox'}" @click="tabChange('draftsBox')">草稿箱</div>
-        <div class="bill-nav" v-if="allConfig" :class="{'onBill':showTab == 'all'}" @click="tabChange('all')">综合查询</div>
-        <div class="bill-nav" v-if="recycleBinConfig" :class="{'onBill':showTab == 'recycleBin'}" @click="tabChange('recycleBin')">回收站</div>
-        <div class="bill-nav" v-if="returnOrderConfig" :class="{'onBill':showTab == 'returnOrder'}" @click="tabChange('returnOrder')">退单</div>
-        <div class="bill-nav" v-for="(item,index) of customs" :class="{'onBill':showTab == item.name}" @click="tabChange(item.name)" :key="index">{{item.label}}</div>
-      </div>
-      <div class="close" @click="closeTab = !closeTab">
-        <i class="el-icon-back" v-if="!closeTab"></i>
-        <i class="el-icon-right" v-if="closeTab"></i>
-      </div>
-    </div>
-    <div class="bill-main">
-      <!-- 引单 -->
-      <div class="bill-box" v-if="sourceConfig" :class="{'on-show':showTab == 'source'}">
-        <el-tabs v-model="activeSource">
-          <el-tab-pane v-for="(item,index) of sourceConfig" :key="index" :label="item.title" :name="'source'+index">
-            <bill-module :propConfig="item" :ref="'source_'+index" @clickHandle="clickHandle($event,'source_'+index)" @search="search($event,'source_'+index)"  
-            @resert="resert('source_'+index)" @pagination="paginationChange($event,'source_'+index)" @detail="detail($event,'source_'+index)" />
-          </el-tab-pane>
-        </el-tabs>
-      </div>
-      <!-- 单据 -->
-      <div class="bill-box" v-if="billConfig" :class="{'on-show':showTab == 'bill'}">
-        <div class="bill-tool" v-if="billConfig.tool">
-          <by-tool ref="billTool" :propConfig="billConfig.tool" @clickHandle="clickHandle($event,'bill')" />
-        </div>
-        <div class="form" v-if="billConfig.form">
-          <by-form ref="billForm" :propConfig="billConfig.form" @getSupplierModal="getSupplierModal" />
-        </div>
-        <template v-if="billConfig.tableConfig && billConfig.tableConfig.length > 0">
-          <div class="bill-table" v-for="(item,index) of billConfig.tableConfig" :key="index">
-            <div class="table-title" v-if="item.title">{{ item.title }}</div>
-            <div class="table-tool" v-if="item.tool">
-              <by-tool :ref="'tableTool_'+index" :propConfig="item.tool" @clickHandle="clickHandle($event,'billTable_'+index)" />
-            </div>
-            <div class="table" v-if="item.table">
-              <by-table :propConfig="item.table" :ref="'billTable_'+index" @onChangeRow="onChangeRow" />
-            </div>
-          </div>
-        </template>
-        
-      </div>
-      <!-- 已提交 -->
-      <div class="bill-box" v-if="smtConfig" :class="{'on-show':showTab == 'smt'}">
-        <bill-module :propConfig="smtConfig" ref="smt" @clickHandle="clickHandle($event,'smt')" @search="search($event,'smt')" 
-        @resert="resert('smt')" @pagination="paginationChange($event,'smt')" @detail="detail($event,'smt')" />
-      </div>
-      <!-- 草稿箱 -->
-      <div class="bill-box" v-if="draftsBoxConfig" :class="{'on-show':showTab == 'draftsBox'}">
-        <bill-module :propConfig="draftsBoxConfig" ref="draftsBox" @clickHandle="clickHandle($event,'draftsBox')" @search="search($event,'draftsBox')" 
-        @resert="resert('draftsBox')" @pagination="paginationChange($event,'draftsBox')" @detail="detail($event,'draftsBox')" />
-      </div>
-      <!-- 综合查询 -->
-      <div class="bill-box" v-if="allConfig" :class="{'on-show':showTab == 'all'}">
-        <bill-module :propConfig="allConfig" ref="all" @clickHandle="clickHandle($event,'all')" @search="search($event,'all')" 
-        @resert="resert('all')" @pagination="paginationChange($event,'all')" @detail="detail($event,'all')" />
-      </div>
-      <!-- 回收站 -->
-      <div class="bill-box" v-if="recycleBinConfig" :class="{'on-show':showTab == 'recycleBin'}">
-        <bill-module :propConfig="recycleBinConfig" ref="recycleBin" @clickHandle="clickHandle($event,'recycleBin')" @search="search($event,'recycleBin')" 
-        @resert="resert('recycleBin')" @pagination="paginationChange($event,'recycleBin')" @detail="detail($event,'recycleBin')" />
-      </div>
-			<!-- 退单 -->
-			<div class="bill-box" v-if="returnOrderConfig" :class="{'on-show':showTab == 'returnOrder'}">
-			  <bill-module :propConfig="returnOrderConfig" ref="returnOrder" @clickHandle="clickHandle($event,'returnOrder')" @search="search($event,'returnOrder')" 
-			  @resert="resert('returnOrder')" @pagination="paginationChange($event,'returnOrder')" @detail="detail($event,'returnOrder')" />
-			</div>
-      <!-- 插槽 -->
-      <div class="bill-box" v-for="(item,index) of customs" :key="index" :class="{'on-show':showTab == item.name}">
-        <slot :name='item.name'></slot>
-      </div>
-    </div>
-  </div>
-</template>
-<script lang="ts">
-/**
- config:{
-  attr:{
-    activeName:'' //tabs标签值
-  },
-  source:[ //引单
-    {
-      title:'', //标题
-      search:{}, //表单配置
-      tool:{},  //工具栏配置
-      table:{} //表格配置
-    }
-  ],
-  bill:{ //单据
-    form:{}, //表单配置
-    tool:{},  //工具栏配置
-    tableConfig:[ //表格配置
-      {
-        title:'',
-        tool:{} //表格工具栏
-        table:{}
-      }
-    ] 
-  },
-  smt:{ //已提交
-    search:{}, //表单配置
-    tool:{},  //工具栏配置
-    table:{} //表格配置
-  },
-  draftsBox:{ //草稿箱
-    search:{}, //表单配置
-    tool:{},  //工具栏配置
-    table:{} //表格配置
-  },
-  all:{}, //综合查询(配置同上)
-  recycleBin:{} //回收站(配置同上)
- }
- */
-import { Component, Prop, Vue, Watch } from "vue-property-decorator";
-import VueViews from '@/benyun/compVue/VueViews'
-import billModule from "./billModule.vue";
-@Component({components:{billModule}})
-export default class ByBill extends VueViews {
-  showTab="bill"
-  closeTab = false
-  activeSource='source0'
-  //引单
-  get sourceConfig(){
-    return this.config?.source ? this.config.source : null;
-  }
-  //单据配置
-  get billConfig(){
-    return this.config?.bill ? this.config.bill : null;
-  }
-  //已提交配置
-  get smtConfig(){
-    return this.config?.smt ? this.config.smt : null;
-  }
-  //草稿箱配置
-  get draftsBoxConfig(){
-    return this.config?.draftsBox ? this.config.draftsBox : null;
-  }
-  //综合查询配置
-  get allConfig(){
-    return this.config?.all ? this.config.all : null;
-  }
-  //回收站配置
-  get recycleBinConfig(){
-    return this.config?.recycleBin ? this.config.recycleBin : null;
-  }
-	// 退单
-	get returnOrderConfig(){
-		return this.config?.returnOrder ? this.config.returnOrder : null;
-	}
-  //自定义插槽
-  get customs(){
-    return this.config?.customs ? this.config.customs : []
-  }
-
-  created(){
-    if(this.propConfig){
-      this.setConfig(this.propConfig)
-    }
-  }
-
-  setConfigAfter(){
-    if(this.attrs.activeName){
-      this.showTab = this.attrs.activeName
-    }
-  }
-
-  //设置单据内表单和表格配置
-  setBillConfig(c:any){
-    if(c){
-      this.config.bill = c;
-			this.$nextTick(()=>{
-				if(c.form){
-				  (this.$refs.billForm as any).setConfig(c.form)
-				}
-				if(this.$refs.billTool){
-				  (this.$refs.billTool as any).initTools()
-				}
-				
-				if(c?.tableConfig?.length > 0){
-				  let n = 0;
-				  for(const item of c.tableConfig){
-				    if(this.$refs['tableTool_'+n]){
-				      (this.$refs['tableTool_'+n] as any)[0].initTools();
-				    }
-				    if(item.table && this.$refs['billTable_'+n]){
-				      (this.$refs['billTable_'+n] as any)[0].setConfig(item.table)
-				    }
-				    n++;
-				  }
-				}
-			})
-    }
-  }
-
-  //左侧tab切换
-  tabChange(t:string){
-    this.showTab = t;
-		this.$emit('clickTab',t)
-  }
-
-  //工具栏
-  /**
-   * 
-   * @param n1 方法
-   * @param n2 表示哪个表格的操作
-   */
-  clickHandle(n1:string,n2:string){
-    this.$emit(n1,n2)
-  }
-  search(v:any,n:string){
-    this.$emit('search',{
-      type:n,
-      value:v
-    })
-  }
-
-  resert(n:string){
-    this.$emit('resert',{
-      type:n
-    })
-  }
-
-  //设置引单表格数据
-  setSourceTableData(n:any,data:Array<any>){
-    const code = 'source_'+n;
-    if(this.$refs[code]){
-      (this.$refs[code] as any)[0]?.setTableValue(data)
-    }
-  }
-
-  //获取引单表格数据
-  getSourceTableData(n:any){
-    let d:Array<any>=[];
-    const code = 'source_'+n;
-    if(this.$refs[code]){
-      d = (this.$refs[code] as any)[0]?.getTableValue()
-    }
-  }
-
-  //获取引单表格选中数据
-  getSourceTableSelectData(n:any){
-    let d:Array<any>=[];
-    const code = 'source_'+n;
-    if(this.$refs[code]){
-      d = (this.$refs[code] as any)[0]?.getTableValue()
-    }  
-    return d;
-  }
-  //获取引单搜索数据
-  getSourceSearchData(n:any){
-    let d:any = {};
-    const code = 'source_'+n;
-    if(this.$refs[code]){
-      d = (this.$refs[code] as any)[0]?.getSearchValue()
-    }  
-    return d;
-  }
-  //设置引单分页
-  setSourcePage(n:any,page:any){
-    const code = 'source_'+n;
-    if(this.$refs[code]){
-      (this.$refs[code] as any)[0]?.setPage(page)
-    }
-  }
-
-  //获取表格数据
-  getTableData(n:string){
-    let d:Array<any> = [];
-    if(this.$refs[n]){
-      d = (this.$refs[n] as any).getTableValue()
-    }  
-    return d;
-  }
-  //获取表格选中数据
-  getTableSelectData(n:string){
-    let d:Array<any> = [];
-    if(this.$refs[n]){
-      d = (this.$refs[n] as any).getSelectTable()
-    }  
-    return d;
-  }
-  //获取搜索数据
-  getSearchValue(n:string){
-    let d:any = {};
-    if(this.$refs[n]){
-      d = (this.$refs[n] as any).getSearchValue()
-    }  
-    return d;
-  }
-
-  //获取单据数据
-  getBillFormValue(){
-    let v = (this.$refs.billForm as any).getValue();
-    return v;
-  }
-
-  onChangeRow(row:any){
-    this.$emit('onChangeRow',row);
-  }
-
-  //获取单据表格已选数据
-  /**
-   * 
-   * @param n 表示第几个单据表格,用下标表示
-   */
-  getBillTableSelect(n:any){
-    let d:Array<any>=[];
-    const code = 'billTable_'+n;
-    if(this.$refs[code]){
-      d = (this.$refs[code] as any)[0].getSelectData();
-    }
-    return d;
-  }
-
-  //设置单据表单数据
-  setBillFormValue(value:any){
-    if(this.$refs['billForm']){
-      (this.$refs['billForm'] as any).setValue(value)
-    }
-  }
-  //设置单据表格数据
-  /**
-   * 
-   * @param value 表格值
-   * @param n 表示第几个表格,一般是下标值
-   */
-  setBillTableValue(value:any,n:number){
-    let code = 'billTable_'+n;
-    if(this.$refs[code]){
-      (this.$refs[code] as any)[0].setValue(value);
-    }
-  }
-  //设置tab表格数据
-  /**
-   * 
-   * @param n 
-   * @param data 
-   */
-  setTabTableValue(n:string,data:Array<any>){
-    if(this.$refs[n]){
-      (this.$refs[n] as any).setTableValue(data);
-    }
-  }
-
-  /**
-   * 
-   * @param n 
-   * @param page 
-   */
-  //设置tab表格分页
-  setTablePage(n:string,page:any){
-    if(this.$refs[n]){
-      (this.$refs[n] as any).setPage(page);
-    }
-  }
-
-  //分页变化
-  paginationChange(page:any,n:string){
-    this.$emit('pagination',{page,type:n})
-  }
-
-  detail(row:any,n:string){
-    this.$emit('detail',{row,type:n})
-  }
-	
-	getSupplierModal(e:any){
-		this.$emit('getSupplierModal',e);
-	}
-}
-</script>
-
-<style lang="scss" scoped>
-.bill{
-  width: 100%;
-  box-sizing: border-box;
-  display: flex;
-  padding: 16px;
-  .bill-left {
-    position: relative;
-    border-right: solid #EEE 1px;
-    padding-right:16px;
-    flex-shrink: 0;
-		min-height: 820px;
-    .bill-tab{
-      width: 200px;
-      height: 100%;
-      transition: all .5s;
-      overflow: hidden;
-    }
-    .bill-title{
-      font-size: 16px;
-      padding-bottom: 16px;
-      width: 200px;
-    }
-    .bill-nav{
-      font-size: 14px;
-      height: 30px;
-      line-height: 30px;
-      width: 200px;
-      box-sizing: border-box;
-      padding: 0 8px;
-      cursor: pointer;
-      margin-bottom: 2px;
-      border-radius: 5px;
-    }
-    .onBill{
-      background-color: #bde3f7;
-    }
-    .bill-nav:hover{
-      background-color: #bde3f7;
-    }
-    .close{
-      height: 22px;
-      width: 22px;
-      border-radius: 50%;
-      border: solid #EEE 1px;
-      position: absolute;
-      top: 30px;
-      right: -11px;
-      background-color: #FFF;
-      display: flex;
-      justify-content: center;
-      align-items: center;
-      cursor: pointer;
-    }
-  }
-  .bill-main{
-    width: calc(100% - 16px);
-    box-sizing: border-box;
-    margin-left: 16px;
-    position: relative;
-    .bill-box{
-      width: 100%;
-      position: absolute;
-      left: 0;
-      top: 0;
-      opacity: 0;
-      z-index: -1;
-      transition: all .5s;
-      .bill-table{
-        padding-bottom: 16px;
-        width: 100%;
-        .table-title{
-          font-size: 14px;
-          padding-bottom: 8px;
-        }
-      }
-      .bill-table:last-child{
-        padding: 0;
-      }
-      .bill-tool,.table-tool{
-        width: 100%;
-        padding-bottom: 16px;
-      }
-      .form{
-        margin-bottom: 8px;
-      }
-    }
-    .on-show{
-      opacity: 1;
-      z-index: 1;
-    }
-  }
-}
-</style>

+ 60 - 96
src/views/audit/saleOrder/index.vue

@@ -1,8 +1,8 @@
 <template>
 	<div>
-		<byBill :propConfig="config" @search="search" @onSmt="doSave" ref="bill" @resert="resert" @detail="openEdit"
+		<by-bill :propConfig="config" @search="search" @onSmt="doSave" ref="bill" @resert="resert" @detail="openEdit"
 			@onRefresh="resert" @pagination="pagination" @clickTab="clickTab">
-		</byBill>
+		</by-bill>
 		<vxe-modal v-model="vxeValue" width="70%" height="70%" min-width="800" min-height="600" show-zoom resize transfer
 			show-footer>
 			<template #title>
@@ -33,8 +33,7 @@
 	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
 	import api from "@/api/order";
 	import OrderType from "./components/orderType.vue";
-	import byBill from "./components/byBill/byBill.vue";
-	@Component({ components: { byBill } })
+	@Component
 	export default class OrderTask extends Vue {
 		vxeValue = false
 		timeNum = 0;
@@ -127,16 +126,10 @@
 								prop: 'organizationName',
 								component: 'by-input',
 							},
-							{
-								span: 8,
-								label: '退单编号',
-								prop: 'chargebackNo',
-								component: 'by-input',
-							},
 							{
 								span: 8,
 								label: '联系方式',
-								prop: 'deliveryPhone',
+								prop: 'phone',
 								component: 'by-input',
 							},
 							{
@@ -147,20 +140,20 @@
 							},
 							{
 								span: 8,
-								label: '交货时间',
-								prop: 'deliveryData',
+								label: '计划交货时间',
+								prop: 'planDeliveryData',
 								component: 'by-input',
 							},
 							{
 								span: 8,
-								label: '交货地点',
-								prop: 'deliveryAddress',
+								label: '确定交货时间',
+								prop: 'affirmDeliveryData',
 								component: 'by-input',
 							},
 							{
 								span: 8,
-								label: '交货方式',
-								prop: 'deliveryWay',
+								label: '交货地点',
+								prop: 'address',
 								component: 'by-input',
 							},
 						],
@@ -269,18 +262,6 @@
 									},
 								},
 							},
-							{
-								span: 6,
-								label: '退单编号',
-								prop: 'chargebackNo',
-								component: 'by-input',
-								compConfig: {
-									attr: {
-										placeholder: '请输入退单编号',
-										clearable: true
-									}
-								}
-							},
 						],
 					]
 				},
@@ -291,7 +272,7 @@
 					},
 					customTools: [
 						{
-							name: '退单', icon: 'el-icon-top', audit: [''], event: {
+							name: '终止订单', icon: 'el-icon-top', audit: [''], event: {
 								click: () => {
 									(this as any).doBackOrder()
 								}
@@ -323,11 +304,6 @@
 							title: '机构名称',
 							field: 'organizationName',
 						},
-						{
-							width: 178,
-							title: '退单编号',
-							field: 'chargebackNo',
-						},
 						{
 							width: 90,
 							title: '收货人',
@@ -382,7 +358,7 @@
 					]
 				}
 			},
-			// 退
+			// 终止订
 			returnOrder: {
 				search: {
 					attr: {
@@ -414,18 +390,6 @@
 									},
 								},
 							},
-							{
-								span: 6,
-								label: '退单编号',
-								prop: 'chargebackNo',
-								component: 'by-input',
-								compConfig: {
-									attr: {
-										placeholder: '请输入退单编号',
-										clearable: true
-									}
-								}
-							},
 						],
 					]
 				},
@@ -456,11 +420,6 @@
 							title: '机构名称',
 							field: 'organizationName',
 						},
-						{
-							width: 178,
-							title: '退单编号',
-							field: 'chargebackNo',
-						},
 						{
 							width: 90,
 							title: '收货人',
@@ -499,12 +458,8 @@
 										(this as any).openEdit(item)
 									}
 								}
-							}, {
-								name: '拆单',
-								event: {
-									click: (item : any) => (this as any).orderTaking(item)
-								}
-							}]
+							},
+							]
 						}
 					]
 				}
@@ -622,60 +577,68 @@
 		// 打开编辑
 		openEdit(e : any) {
 			e = e.row ? e.row : e;
-			let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
-			if (e.isMaster === 1) {
-				billConfig.tool.customTools = [
-					{
-						name: '拆单', icon: 'el-icon-minus', audit: [''], event: {
-							click: () => {
-								(this as any).orderTaking(e)
-							}
-						}
-					},
-				];
-			} else {
-				billConfig.tool.customTools = [
-					{
-						name: '退单', icon: 'el-icon-bottom', audit: [''], event: {
-							click: () => {
-								(this as any).doBackOrder2(e)
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
+				if (res.code === 200) {
+					let parentData = res.data ? res.data : e;
+					let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+					if (parentData.isMaster === 1) {
+						billConfig.tool.customTools = [
+							{
+								name: '拆单', icon: 'el-icon-minus', audit: [''], event: {
+									click: () => {
+										(this as any).orderTaking(parentData)
+									}
+								}
+							},
+						];
+					} else {
+						billConfig.tool.customTools = [
+							{
+								name: '终止订单', icon: 'el-icon-bottom', audit: [''], event: {
+									click: () => {
+										(this as any).doBackOrder2(parentData)
+									}
+								}
 							}
-						}
-					}
-				];
-			};
-			(this.$refs.bill as any).setBillConfig(billConfig);
-			(this.$refs.bill as any).setBillFormValue(e); // 设置单据表单数据
-			(this.$refs.bill as any).setBillTableValue(e.suborderList, 0);// 设置第1张单据表格数据
-			(this.$refs.bill as any).showTab = 'bill';
+						];
+					};
+					(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();
+			});
+
 		}
-		// 工具栏退单
+		// 工具栏终止订
 		doBackOrder() {
 			let selectData = (this as any).$refs.bill.getTableSelectData('all');
-			if (selectData.length > 1) return this.$message.warning('只能选择一条退单数据')
-			let ids:any = [];
+			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({ type: 'warning', message: '请选择退单数据' })
+			} else return this.$message({ type: 'warning', message: '请选择终止订单数据' })
 			selectData[0].suborderList.map((v : any) => {
 				delete v.id;
 			})
-			this.$confirm('确定退单吗!', '注意', {
+			this.$confirm('确定终止订单吗!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
 				type: 'warning',
 				center: true
 			}).then(() => {
-				api.stoporder({ids:ids}, 'supplyPurchaseOrder').then((res : any) => {
+				api.stoporder({ ids: ids }, 'supplyPurchaseOrder').then((res : any) => {
 					if (res.code === 200) {
-						this.$message.success('退单成功!');
+						this.$message.success('终止订单成功!');
 						this.getDataList();
 						(this.$refs.bill as any).showTab = 'all';
 					} else this.$message.error(res.msg)
 				})
-			}).catch(() => this.$message.info('已取消退单'));
+			}).catch(() => this.$message.info('已取消终止订单'));
 		}
 		// 导航切换
 		clickTab(e : any) {
@@ -686,14 +649,15 @@
 				billConfig.tool.customTools = [];
 				(this.$refs.bill as any).setBillConfig(billConfig);
 			}
+			if (e === 'returnOrder') this.getPageList({ status: 2 }, 'returnOrder')
 		}
-		// 单据操作退
+		// 单据操作终止订
 		doBackOrder2(e : any) {
 			console.log(e);
 			e.suborderList.map((v : any) => {
 				delete v.id;
 			})
-			this.$confirm('确定退单吗!', '注意', {
+			this.$confirm('确定终止订单吗!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
 				type: 'warning',
@@ -701,12 +665,12 @@
 			}).then(() => {
 				api.stoporder([e.id], 'supplyPurchaseOrder').then((res : any) => {
 					if (res.code === 200) {
-						this.$message.success('退单成功!');
+						this.$message.success('终止订单成功!');
 						this.getDataList();
 						(this.$refs.bill as any).showTab = 'all';
 					} else this.$message.error(res.msg)
 				})
-			}).catch(() => this.$message.info('已取消退单'));
+			}).catch(() => this.$message.info('已取消终止订单'));
 		}
 		// 分页
 		pagination(e : any) {

+ 33 - 10
src/views/audit/warehousing/components/towInOne.vue

@@ -5,12 +5,12 @@
 			<div class="selectC" v-if="propValue" key="propValue1" @click="openModal">更换</div>
 			<div class="selectC" v-else key="propValue2" @click="vxeValue = true;">选择</div>
 		</div>
-		<vxe-modal v-model="vxeValue" width="800" show-zoom resize transfer show-footer>
+		<vxe-modal v-model="vxeValue" width="800" height="170" show-zoom resize transfer show-footer>
 			<template #title>
 				<span>选择仓库、仓位</span>
 			</template>
 			<template #default>
-				<by-form :propConfig="config" ref="form"></by-form>
+				<by-form :propConfig="config" ref="form" style="margin-top: 10px;"></by-form>
 			</template>
 			<template #footer>
 				<div class="btn">
@@ -23,12 +23,15 @@
 
 <script lang="ts">
 	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+	import api from "@/api/order";
 	@Component
 	export default class TowInOne extends Vue {
 		vxeValue : any = false
 		@Prop()
 		propValue : any;
 		@Prop()
+		parentValue : any;
+		@Prop()
 		propConfig : any;
 		get getPropConfig() {
 			return this.propConfig?.isSelect;
@@ -36,13 +39,13 @@
 		config = {
 			attr: {
 				size: 'small',
-				height: 200,
+				height: 43,
 			},
 			columns: [
 				[{
 					span: 11,
 					label: '仓库',
-					prop: 'warehouse',
+					prop: 'storehouseName',
 					component: 'warehouse',
 					compConfig: {
 						attr: {
@@ -56,7 +59,7 @@
 				}, {
 					span: 11,
 					label: '仓位',
-					prop: 'warehousePosition',
+					prop: 'storingLocationName',
 					component: 'warehouse-position',
 					compConfig: {
 						attr: {
@@ -75,10 +78,14 @@
 		openModal() {
 			let data = (this as any).$lodash.cloneDeep(this.propValue);
 			data = data.split(',');
+			console.log(data);
+			console.log(this.parentValue);
 			setTimeout(() => {
 				(this as any).$refs.form.setValue({
-					warehouse: data[0],
-					warehousePosition: data[1]
+					storehouseName: this.parentValue.storehouseName,
+					storehouseId: this.parentValue.storehouseId,
+					storingLocationName: this.parentValue.storingLocationName,
+					storingLocationId: this.parentValue.storingLocationId,
 				})
 			}, 0)
 			this.vxeValue = true;
@@ -86,10 +93,26 @@
 		// 确定仓库仓位
 		doConfirm() {
 			let data : any = (this as any).$refs.form.getValue();
-			data.towInOne = data.storehouseName + ',' + data.storingLocationName;
+			// console.log(data);
 			if (!data.storehouseId || !data.storingLocationId) return this.$message.warning('仓库仓位为必填项');
-			this.$emit('onChange', data);
-			this.vxeValue = false;
+			data.towInOne = data.storehouseName + ',' + data.storingLocationName;
+			if (this.parentValue.id) {
+				let loading = this.$loading({ target: '.main-container' });
+				api.getInventoryByStoridAndSkuid({
+					storidId: data.storehouseId,
+					skuid: this.parentValue.id,
+				}).then((res : any) => {
+					if (res.code === 200) {
+						data.inventory = res.data;
+						this.$emit('onChange', data);
+						loading.close();
+						this.vxeValue = false;
+					}
+				}).catch(() => loading.close())
+			} else {
+				this.$emit('onChange', data);
+				this.vxeValue = false;
+			}
 		}
 	}
 </script>

+ 183 - 57
src/views/audit/warehousing/index.vue

@@ -1,8 +1,9 @@
 <template>
 	<div>
-		<by-bill ref="bill" :propConfig="config" @search="search" @onAdd="onAdd" @onDelete="onDelete" @onRefresh="resert"
-			@resert="resert" @detail="openEdit" @onSave="onSave" @clickTab="clickTab" @onChangeRow="onChangeRow"
-			@pagination="pagination" @getSupplierModal="getSupplierModal">
+		<by-bill ref="bill" :propConfig="config" @search="search" @onSmt="onSmt" @onAdd="onAdd" @onDelete="onDelete"
+			@onRefresh="resert" @resert="resert" @detail="openEdit" @onSave="onSave" @clickTab="clickTab"
+			@onChangeRow="onChangeRow" @pagination="pagination" @onReturnSmt="onReturnSmt2"
+			@getSupplierModal="getSupplierModal">
 		</by-bill>
 		<!-- 选择物料 -->
 		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
@@ -20,7 +21,10 @@
 	export default class OrderTask extends Vue {
 		// 左边
 		tabType : any = 'all';
-		isAdd : any = false
+		isAdd : any = false;
+		baseInfo : any = {};
+		isSubmit : any = false
+		isChange : any = false
 		// 右边
 		supplierInfo : any = {} // 机构信息
 		businessType : any = '' // 业务类型
@@ -42,7 +46,7 @@
 				},
 				form: {
 					attr: {
-						size: 'small',
+						size: 'medium',
 						readonly: false,
 					},
 					columns: [
@@ -298,8 +302,7 @@
 							title: '操作',
 							action: true,
 							plugins: [{
-								icon: 'el-icon-edit',
-								name: '编辑',
+								name: '查看',
 								audit: '',
 								event: {
 									click: (e : any) => {
@@ -307,9 +310,9 @@
 									}
 								}
 							}, {
-								name: '删除',
+								name: '反提交',
 								event: {
-									click: (item : any) => (this as any).doDelete2(item)
+									click: (item : any) => (this as any).onReturnSmt(item)
 								}
 							}]
 						}
@@ -658,7 +661,7 @@
 								audit: '',
 								event: {
 									click: (e : any) => {
-										(this as any).setReadonly(e)
+										(this as any).openEdit(e)
 									}
 								}
 							}]
@@ -686,17 +689,13 @@
 			goodsData = goodsData.map((item : any) => {
 				item.materialName = item.skuTitle
 				item.prePrice = 0
-				// item.materialId = item.materialId
 				item.unitPrice = item.price
 				item.materialSku = item.id
 				const { id, ...newData } = item
-				// const { skuTitle, price, id, materialId, ...newData } = item
 				return newData
 			})
 			this.tableData = this.tableData.concat(goodsData);
 			newArr = this.tableData.reduce((prev : any, current : any) => {
-				// console.log('prev ==> ', prev);
-				// console.log('current ==> ', current);
 				obj[current.materialSku] ? contents.push(current.materialName) : (obj[current.materialSku] = true && prev.push(current))
 				return prev
 			}, []);
@@ -738,8 +737,6 @@
 						query.suborderList.splice(i, 1)
 					}
 				});
-
-
 				console.log('保存参数query ==> ', query);
 				if (this.isAdd) {
 					api.saveList(query, 'supplyEntryOrder').then((res : any) => {
@@ -793,47 +790,60 @@
 		// 打开编辑
 		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;
-					if (!v.prePrice) v.prePrice = '0';
-					v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
-				});
-				let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
-				if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
-					billConfig.tableConfig[0].table.columns.push({
-						width: 90,
-						title: '操作',
-						action: true,
-						plugins: [{
-							icon: 'el-icon-delete',
-							name: '删除',
-							audit: '',
-							event: {
-								click: (item : any) => {
-									(this as any).changeTable(item)
-								}
-							}
-						}]
-					})
-				};
-				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);
-			};
+			e = e.row ? e.row : e;
+			console.log('编辑 ==>', e);
+			let loading = this.$loading({ target: '.main-container' });
+			api.single({ id: e.id }, 'supplyEntryOrder').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) {
+							loading.close();
+							return this.setReadonly(parentData)
+						}
+						let data = parentData.suborderList
+						data.map((v : any, i : any) => {
+							v.dataIndex = i;
+							if (!v.prePrice) v.prePrice = '0';
+							v.towInOne = v.storehouseName + ',' + v.storingLocationName; // 仓库仓位
+							let billConfig = (this as any).$lodash.cloneDeep(this.config.bill);
+							if (billConfig.tableConfig[0].table.columns.at(-1).title != '操作') {
+								billConfig.tableConfig[0].table.columns.push({
+									width: 90,
+									title: '操作',
+									action: true,
+									plugins: [{
+										icon: 'el-icon-delete',
+										name: '删除',
+										audit: '',
+										event: {
+											click: (item : any) => {
+												(this as any).changeTable(item)
+											}
+										}
+									}]
+								})
+							};
+							billConfig.form.attr.readonly = false; // 设置只读
+							billConfig.tool.tools = { save: true, };
+							if (this.tabType === 'draftsBox' || 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);
+							(this.$refs.bill as any).setBillFormValue(parentData);// 设置单据表单数据
+							(this.$refs.bill as any).setBillTableValue(data, 0);// 设置第1张单据表格数据
+							this.isAdd = false;
+							(this.$refs.bill as any).showTab = 'bill';
+							loading.close();
+						});
+					} else {
+						loading.close();
+						this.setReadonly(parentData);
+					};
+				}
+			})
+
 		}
 		// 设置只读
 		setReadonly(e : any) {
@@ -855,6 +865,122 @@
 			(this.$refs.bill as any).showTab = 'bill';
 
 		}
+		// 工具栏提交
+		onSmt(e : any) {
+			if (e === 'draftsBox') {
+				let selectData = (this.$refs.bill as any).getTableSelectData('draftsBox'); // 获取表格选中数据
+				if (selectData.length <= 0) return this.$message.warning('请选择提交数据');
+				if (selectData.length > 1) return this.$message.warning('只能提交一条数据');
+				this.$confirm('确定提交吗!', '注意', {
+					confirmButtonText: '确定',
+					cancelButtonText: '取消',
+					type: 'warning',
+					center: true
+				}).then(() => {
+					api.submitTo({ id: selectData[0].id }, 'supplyEntryOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('提交成功');
+							this.clickTab('draftsBox');
+						} else this.$message.error(res.msg)
+					})
+				}).catch(() => this.$message.info('已取消提交'));
+			} else {
+				console.log('isChange ==> ', this.isChange);
+				console.log('isSubmit ==> ', this.isSubmit);
+				if (this.isSubmit) {
+					this.$confirm('确定提交吗!', '注意', {
+						confirmButtonText: '确定',
+						cancelButtonText: '取消',
+						type: 'warning',
+						center: true
+					}).then(() => {
+						api.submitTo({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+							if (res.code === 200) {
+								this.$message.success('提交成功');
+								this.clickTab(this.tabType);
+								this.isSubmit = false;
+								(this.$refs.bill as any).showTab = this.tabType;
+							} else this.$message.error(res.msg)
+						})
+					}).catch(() => this.$message.info('已取消提交'));
+				} else {
+					// 表单旧数据
+					let oldbillForm : any = (this as any).$lodash.cloneDeep(this.baseInfo);
+					if (oldbillForm.suborderList) delete oldbillForm.suborderList;
+					oldbillForm = JSON.stringify(oldbillForm);
+					// 表单新数据
+					let newBillForm : any = (this as any).$refs.bill.getBillFormValue();
+					if (newBillForm.suborderList) delete newBillForm.suborderList;
+					newBillForm = JSON.stringify(newBillForm);
+					// 表格旧数据
+					this.baseInfo.suborderList.map((v : any) => {
+						if (v._X_ROW_KEY) delete v._X_ROW_KEY;
+					});
+					let oldData : any = JSON.stringify(this.baseInfo.suborderList);
+					// 表格新数据
+					let newData : any = JSON.stringify((this as any).$refs.bill.getBillTableData(0));
+					// 数据有变进保存
+					if (this.isChange || oldbillForm != newBillForm || oldData != newData) {
+						return this.$message.warning('数据变更必须先保存再提交');
+					} else {
+						this.$confirm('确定提交吗!', '注意', {
+							confirmButtonText: '确定',
+							cancelButtonText: '取消',
+							type: 'warning',
+							center: true
+						}).then(() => {
+							// console.log(this.baseInfo.id);
+							api.submitTo({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+								if (res.code === 200) {
+									this.$message.success('提交成功');
+									this.clickTab(this.tabType);
+									(this.$refs.bill as any).showTab = this.tabType;
+								} else this.$message.error(res.msg)
+							})
+						}).catch(() => this.$message.info('已取消提交'));
+					}
+				}
+			}
+		}
+		// 操作反提交
+		onReturnSmt(e : any) {
+			console.log('反提交 ==>', e);
+			this.$confirm('确定反提交吗!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				if (this.tabType === 'smt') {
+					api.cancelSubmission({ id: e.id }, 'supplyEntryOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('反提交成功');
+							this.clickTab(this.tabType);
+						} else this.$message.error(res.msg)
+					})
+				}
+			}).catch(() => this.$message.info('已取消反提交'));
+		}
+		// 工具栏反提交
+		onReturnSmt2() {
+			console.log('工具栏反提交 ==>', this.baseInfo);
+			this.$confirm('确定反提交吗!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				if (this.tabType === 'smt') {
+					api.cancelSubmission({ id: this.baseInfo.id }, 'supplyEntryOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('反提交成功');
+							this.clickTab(this.tabType);
+							(this.$refs.bill as any).showTab = 'smt';
+						} else this.$message.error(res.msg)
+					})
+				}
+			}).catch(() => this.$message.info('已取消反提交'));
+		}
 		// 切换tab栏
 		clickTab(e : any) {
 			console.log('切换tab ==> ', e);