Jelajahi Sumber

新增机构名称

AlanWong 2 tahun lalu
induk
melakukan
5cacea769b

+ 21 - 2
src/api/order.ts

@@ -17,7 +17,7 @@ function pageList(data : any, url : any) {
 	})
 }
 
-// 新增数据
+// 保存数据
 function saveList(data : any, url : any) {
 	return request({
 		url: '/supply/' + url + '/save',
@@ -25,6 +25,23 @@ function saveList(data : any, url : any) {
 		data: data
 	})
 }
+// 提交数据
+function submitTo(data : any, url : any) {
+	return request({
+		url: '/supply/' + url + '/submitTo',
+		method: 'POST',
+		data: data
+	})
+}
+// 反提交数据
+function cancelSubmission(data : any, url : any) {
+	return request({
+		url: '/supply/' + url + '/cancelSubmission',
+		method: 'POST',
+		data: data
+	})
+}
+
 // 修改数据
 function updateList(data : any, url : any) {
 	return request({
@@ -83,5 +100,7 @@ export default {
 	selectDeleteList,
 	ordersaccepting,
 	splitOrder,
-	backOrder
+	backOrder,
+	submitTo,
+	cancelSubmission
 }

+ 1 - 1
src/benyun/components/byInput/byInput.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-input v-if="attrs.type == 'textarea'" v-model="value" @input="onChange" :rows="attrs.rows" :show-word-limit="attrs.showWordLimit" :show-password="attrs.showPassword" :placeholder="placeholder"
+  <el-input v-if="attrs.type == 'textarea'" :type="attrs.type" v-model="value" @input="onChange" :rows="attrs.rows" :show-word-limit="attrs.showWordLimit" :show-password="attrs.showPassword" :placeholder="placeholder"
   :maxlength="attrs.maxlength" :minlength="attrs.minlength" :clearable="attrs.clearable" :disabled="attrs.disabled" :prefix-icon="attrs.prefixIcon"
   :suffix-icon="attrs.suffixIcon" :readonly="attrs.readonly"></el-input>
   <vxe-input 

+ 1 - 3
src/views/audit/brand/index.vue

@@ -108,12 +108,10 @@
 					field: 'name',
 					isDetail: true,
 					width: 300,
-					// align: 'left'
 				}, {
 					title: '简称',
 					field: 'shortName',
 					width: 300,
-					// align: 'left'
 				},
 				{
 					width: 80,
@@ -121,9 +119,9 @@
 					field: 'status',
 					component: Assembly,
 				}, {
+					width: 500,
 					title: '备注',
 					field: 'remark',
-					// align: 'left'
 				}, {
 					width: 120,
 					title: '操作',

+ 106 - 61
src/views/audit/orderTask/index.vue

@@ -81,7 +81,7 @@
 								component: 'by-date-picker',
 								compConfig: {
 									format: 'yyyy-MM-dd hh:ss:mm',
-									type: 'datetime'
+									type: 'datetime',
 								}
 							},
 							{
@@ -184,7 +184,7 @@
 										attr: {
 											size: 'mini',
 											type: 'number',
-											defaultValue: '0',
+											defaultValue: 0,
 										},
 									}
 								},
@@ -357,7 +357,7 @@
 							}, {
 								name: '反提交',
 								event: {
-									click: (item : any) => (this as any).doDelete2(item)
+									click: (item : any) => (this as any).returnSmt(item)
 								}
 							}]
 						}
@@ -821,63 +821,45 @@
 				this.getDataList()
 			}, 500)
 		}
-		// 获取机构数据
-		getSupplierModal(e : any) {
-			console.log('获取机构数据 ==> ', e);
-			this.supplierInfo = e;
-		}
-		// 监听表格数据变化
-		onChangeRow(e : any) {
-			e.realityPrice = e.number * e.unitPrice;
-			e.totalPrice = e.realityPrice - e.prePrice;
-		}
-		// 确定商品新增
-		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 (contents.length > 0) {
-				this.$alert('商品 “' + contents + '” 已存在!', '提示', {
-					confirmButtonText: '确定',
-				});
-			};
-			(this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
-		}
-		// 提交
+		// 工具栏提交
 		onSmt(e : any) {
 			console.log('提交 ==>', e);
-			(this as any).$refs.bill.$refs.billForm.validate().then(() => {
-				let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
-				if (this.tabType === 'all') {
-					// api.saveList(query, 'supplyTaskOrder').then((res : any) => {
-					// 	if (res.code === 200) {
-					// 		this.$message.success('提交成功');
-					// 		this.getDataList();
-					// 		(this.$refs.bill as any).showTab = 'all';
-					// 		(this.$refs.bill as any).setBillFormValue({});
-					// 	} else this.failHandle(res)
-					// })
+			let selectData = (this.$refs.bill as any).getTableSelectData(this.tabType); // 获取表格选中数据
+			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 }, 'supplyTaskOrder').then((res : any) => {
+					if (res.code === 200) {
+						this.$message.success('提交成功');
+						this.clickTab(this.tabType);
+					} else this.failHandle(res)
+				})
+			}).catch(() => this.$message.info('已取消提交'));
+		}
+		// 操作反提交
+		returnSmt(e : any) {
+			console.log('反提交 ==>', e);
+			this.$confirm('确定反提交吗!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				// let query = (this.$refs.bill as any).getBillFormValue(); // 获取单据数据
+				if (this.tabType === 'smt') {
+					api.cancelSubmission({ id: e.id }, 'supplyTaskOrder').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success('反提交成功');
+							this.clickTab(this.tabType);
+						} else this.failHandle(res)
+					})
 				}
-			})
+			}).catch(() => this.$message.info('已取消反提交'));
 		}
 		// 保存
 		onSave(e : any) {
@@ -891,9 +873,12 @@
 				// 子表数据
 				query.suborderList = this.tableData;
 				if (query.suborderList.length > 0) {
-					query.suborderList.map((v : any) => {
-						v.taskOrderId = query.id
-					})
+					for (let v of query.suborderList) {
+						if (!v.number || v.number <= 0) return this.$message.warning('请输入正确物料数量');
+						if (!v.unitPrice || v.unitPrice <= 0) return this.$message.warning('请输入正确物料单价');
+						if (!v.prePrice || v.prePrice < 0) return this.$message.warning('请输入正确优惠金额');
+						v.taskOrderId = query.id;
+					}
 				};
 				// 表格删除
 				query.suborderList.map((v : any, i : any) => {
@@ -964,9 +949,27 @@
 				if (this.tabType === 'all' && e.submitState === 1) return this.setReadonly(e);
 				let data = e.suborderList
 				data.map((v : any, i : any) => {
-					v.dataIndex = i
+					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 };
@@ -997,6 +1000,48 @@
 			(this.$refs.bill as any).showTab = 'bill';
 
 		}
+		// 获取机构数据
+		getSupplierModal(e : any) {
+			console.log('获取机构数据 ==> ', e);
+			this.supplierInfo = e;
+		}
+		// 监听表格数据变化
+		onChangeRow(e : any) {
+			e.realityPrice = e.number * e.unitPrice;
+			e.totalPrice = e.realityPrice - e.prePrice;
+		}
+		// 确定商品新增
+		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 + '” 已存在!', '提示', {
+					confirmButtonText: '确定',
+				});
+			};
+			(this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
+		}
 		// 派单
 		onDispatch(e : any) {
 			console.log('派单 ==>', e);

+ 146 - 30
src/views/audit/outbound/index.vue

@@ -5,7 +5,7 @@
 			@getSupplierModal="getSupplierModal">
 		</by-bill>
 		<!-- 选择物料 -->
-		<productModal ref="product" :mulit="true" />
+		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
 	</div>
 </template>
 
@@ -14,6 +14,7 @@
 	import api from "@/api/order";
 	import productModal from "../orderTask/components/productModal.vue";
 	import Focus from "../orderTask/components/focus.vue";
+	import towInOne from "../warehousing/components/towInOne.vue";
 	@Component({ components: { productModal } })
 	export default class OrderTask extends Vue {
 		// 左边
@@ -56,7 +57,7 @@
 								component: 'by-input',
 								compConfig: {
 									attr: {
-										readonly:true
+										readonly: true
 									},
 								}
 							},
@@ -72,6 +73,12 @@
 								prop: 'operator',
 								component: 'by-input',
 							},
+							{
+								span: 8,
+								label: '业务类型',
+								prop: 'businessType',
+								component: 'by-select',
+							},
 							{
 								span: 8,
 								label: 'WMS编号',
@@ -112,17 +119,31 @@
 							},
 							columns:
 								[{
-									width: 300,
+									width: 278,
 									title: '物料名称',
 									field: 'materialName',
 								},
 								{
-									width: 140,
+									width: 200,
+									title: '仓库,仓位',
+									field: 'towInOne',
+									component: towInOne,
+									compConfig: {
+										isSelect: true
+									}
+								},
+								{
+									width: 100,
 									title: '单位',
 									field: 'unit',
 								},
 								{
-									width: 140,
+									width: 100,
+									title: '库存',
+									field: 'unit2',
+								},
+								{
+									width: 100,
 									title: '数量',
 									field: 'number',
 									component: 'by-input',
@@ -135,12 +156,12 @@
 									}
 								},
 								{
-									width: 140,
+									width: 110,
 									title: '已交付数量',
 									field: 'deliveryNumber',
 								},
 								{
-									width: 140,
+									width: 100,
 									title: '单价',
 									field: 'unitPrice',
 									component: 'by-input',
@@ -152,12 +173,12 @@
 									}
 								},
 								{
-									width: 140,
+									width: 100,
 									title: '实际金额',
 									field: 'realityPrice',
 								},
 								{
-									width: 140,
+									width: 100,
 									title: '优惠金额',
 									field: 'prePrice',
 									component: 'by-input',
@@ -170,7 +191,7 @@
 									}
 								},
 								{
-									width: 140,
+									width: 100,
 									title: '合计金额',
 									field: 'totalPrice',
 								},
@@ -253,7 +274,7 @@
 						height: 620,
 						size: 'mini',
 						seq: true,
-						align: 'center',
+						align: 'left',
 						checkbox: true
 					},
 					columns: [
@@ -262,11 +283,16 @@
 							title: '单据编号',
 							field: 'outOrderNo',
 							isDetail: true,
+							fixed: 'left'
 						},
 						{
 							width: 200,
-							title: '机构名称',
-							field: 'organizationName',
+							title: '仓库,仓位',
+							field: 'towInOne',
+							component: towInOne,
+							compConfig: {
+								isSelect: false
+							}
 						},
 						{
 							width: 150,
@@ -381,7 +407,7 @@
 						height: 620,
 						size: 'mini',
 						seq: true,
-						align: 'center',
+						align: 'left',
 						checkbox: true
 					},
 					columns: [
@@ -390,11 +416,16 @@
 							title: '单据编号',
 							field: 'outOrderNo',
 							isDetail: true,
+							fixed: 'left'
 						},
 						{
 							width: 200,
-							title: '机构名称',
-							field: 'organizationName',
+							title: '仓库,仓位',
+							field: 'towInOne',
+							component: towInOne,
+							compConfig: {
+								isSelect: false
+							}
 						},
 						{
 							width: 150,
@@ -498,17 +529,32 @@
 				},
 				tool: {
 					tools: {
-						delete: true,
 						search: true,
 						refresh: true
-					}
+					},
+					customTools: [
+						{
+							name: '出库', icon: 'el-icon-top', audit: [''], event: {
+								click: () => {
+									(this as any).onAdd('all')
+								}
+							}
+						},
+						{
+							name: '删除', icon: 'el-icon-top', audit: [''], event: {
+								click: () => {
+									(this as any).onDelete('all')
+								}
+							}
+						}
+					]
 				},
 				table: {
 					attr: {
 						height: 620,
 						size: 'mini',
 						seq: true,
-						align: 'center',
+						align: 'left',
 						checkbox: true
 					},
 					columns: [
@@ -517,11 +563,16 @@
 							title: '单据编号',
 							field: 'outOrderNo',
 							isDetail: true,
+							fixed: 'left'
 						},
 						{
 							width: 200,
-							title: '机构名称',
-							field: 'organizationName',
+							title: '仓库,仓位',
+							field: 'towInOne',
+							component: towInOne,
+							compConfig: {
+								isSelect: false
+							}
 						},
 						{
 							width: 150,
@@ -634,7 +685,7 @@
 						height: 620,
 						size: 'mini',
 						seq: true,
-						align: 'center',
+						align: 'left',
 						checkbox: true
 					},
 					columns: [
@@ -643,11 +694,16 @@
 							title: '单据编号',
 							field: 'outOrderNo',
 							isDetail: true,
+							fixed: 'left'
 						},
 						{
 							width: 200,
-							title: '机构名称',
-							field: 'organizationName',
+							title: '仓库,仓位',
+							field: 'towInOne',
+							component: towInOne,
+							compConfig: {
+								isSelect: false
+							}
 						},
 						{
 							width: 150,
@@ -710,7 +766,40 @@
 		}
 		// 监听表格数据变化
 		onChangeRow(e : any) {
-			console.log(e);
+			e.realityPrice = e.number * e.unitPrice;
+			e.totalPrice = e.realityPrice - e.prePrice;
+		}
+		// 确定商品新增
+		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 + '” 已存在!', '提示', {
+					confirmButtonText: '确定',
+				});
+			};
+			(this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
 		}
 		// 保存
 		onSave(e : any) {
@@ -724,9 +813,17 @@
 				// 子表数据
 				query.suborderList = this.tableData;
 				if (query.suborderList.length > 0) {
-					query.suborderList.map((v : any) => {
-						v.taskOrderId = query.id
-					})
+					for (let v of query.suborderList) {
+						console.log(v.prePrice);
+						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('请输入正确优惠金额');
+						v.taskOrderId = query.id;
+						v.storehouseName = '我是仓库';
+						v.storehouseId = 2;
+						v.storingLocationName = '我是仓位';
+						v.storingLocationId = 4;
+					}
 				};
 				// 表格删除
 				query.suborderList.map((v : any, i : any) => {
@@ -764,7 +861,7 @@
 		}
 		// 打开新增
 		onAdd(e : any) {
-			console.log('新增 ==>', e);
+			console.log('出库 ==>', e);
 			if (e === 'billTable_0') {
 				(this.$refs.product as any).setShow(true); // 打开sku弹窗
 				let obj = (this.$refs.bill as any).getBillFormValue();
@@ -796,9 +893,28 @@
 				if (this.tabType === 'all' && e.submitState === 1) return this.setReadonly(e);
 				let data = e.suborderList
 				data.map((v : any, i : any) => {
-					v.dataIndex = i
+					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 };

+ 16 - 15
src/views/audit/productManagement/index.vue

@@ -624,61 +624,62 @@
 				[
 					{
 						span: 6,
-						label: '机构商品分类',
-						prop: 'organizationCategoryName',
+						label: '物料分类',
+						prop: 'categoryName',
 						component: 'select-tree',
 						compConfig: {
 							attr: {
 								label: 'name',
 								clearable: true,
 								retConfig: {
-									organizationCategoryName: 'name',
-									organizationCategoryId: 'id'
+									categoryName: 'name',
+									categoryId: 'id'
 								},
 								defaultExpandAll: true
 							},
 							request: {
-								url: '/maindata/maindataMaterialOrganizationCategory/treeList'
+								url: '/maindata/maindataMaterialCategory/treeList'
 							}
 						}
 					},
 					{
 						span: 6,
-						label: '物料分类',
-						prop: 'categoryName',
+						label: '虚拟分类',
+						prop: 'vmCategoryName',
 						component: 'select-tree',
 						compConfig: {
 							attr: {
 								label: 'name',
 								clearable: true,
 								retConfig: {
-									categoryName: 'name',
-									categoryId: 'id'
+									vmCategoryName: 'name',
+									vmCategoryId: 'id'
 								},
 								defaultExpandAll: true
 							},
 							request: {
-								url: '/maindata/maindataMaterialCategory/treeList'
+								url: '/maindata/maindataMaterialVmcategory/treeList'
 							}
 						}
 					},
 					{
+						labelWidth:'116px',
 						span: 6,
-						label: '虚拟分类',
-						prop: 'vmCategoryName',
+						label: '机构商品分类',
+						prop: 'organizationCategoryName',
 						component: 'select-tree',
 						compConfig: {
 							attr: {
 								label: 'name',
 								clearable: true,
 								retConfig: {
-									vmCategoryName: 'name',
-									vmCategoryId: 'id'
+									organizationCategoryName: 'name',
+									organizationCategoryId: 'id'
 								},
 								defaultExpandAll: true
 							},
 							request: {
-								url: '/maindata/maindataMaterialVmcategory/treeList'
+								url: '/maindata/maindataMaterialOrganizationCategory/treeList'
 							}
 						}
 					},

+ 3 - 2
src/views/audit/saleOrder/index.vue

@@ -92,7 +92,8 @@
 						compConfig: {
 							attr: {
 								size: 'mini',
-								type: 'number',
+								type: 'integer',
+								placeholder:'请输入数量'
 							},
 						}
 					},
@@ -540,7 +541,7 @@
 		// 右拆单数据变化
 		rightChange(e : any) {
 			console.log(e.number);
-			if (e.number && 0 <= e.number && e.number <= this.regularData[e.dataIndex].splitNumber) {
+			if (0 <= e.number && e.number <= this.regularData[e.dataIndex].splitNumber) {
 				let leftTableData = (this.$refs.leftTable as any).getValue();
 				leftTableData[e.dataIndex].splitNumber = leftTableData[e.dataIndex].number - e.number;
 				(this.$refs.leftTable as any).setValue(leftTableData);

+ 463 - 0
src/views/audit/supplier/index.vue

@@ -0,0 +1,463 @@
+<template>
+	<div class="my-container">
+		<div class="bill-main">
+			<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
+				@resert="getDataList" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
+			</module-view>
+		</div>
+		<!-- 新增/编辑弹窗 -->
+		<el-dialog :title="popTitle+'供应商'" :visible.sync="dialogFormVisible" width="30%">
+			<by-form :propConfig="addConfig" ref="addFormId">
+				<template v-slot:status class="clearfix">
+					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="0">正常</el-radio>
+					<el-radio class="fl" style="margin-top: 8px;" v-model="radio" :label="1">禁用</el-radio>
+				</template>
+			</by-form>
+			<div slot="footer" class="dialog-footer">
+				<el-button @click="dialogFormVisible = false">取 消</el-button>
+				<el-button type="primary" @click="confirm">确 定</el-button>
+			</div>
+		</el-dialog>
+	</div>
+</template>
+<script lang="ts">
+	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+	import api from "@/api/currency";
+	import Assembly from "@/components/Assembly/material.vue";
+	@Component
+	export default class Supplier extends Vue {
+		baseURL : any = process.env.VUE_APP_BASE_API
+		loading : any = null
+		timeNum = 0;
+		timer : any = null
+		popTitle : any = ''
+		radio : any = 0
+		dialogFormVisible : boolean = false
+		config : any = {
+			search: {
+				attr: {
+					size: 'mini'
+				},
+				columns: [
+					[{
+						span: 6,
+						label: '名称',
+						prop: 'name',
+						component: 'by-input',
+						labelWidth: '70px',
+						compConfig: {
+							attr: {
+								placeholder: '请输入名称',
+								clearable: true
+							},
+						},
+					}, {
+						span: 6,
+						label: '负责人',
+						prop: 'contacts',
+						component: 'by-input',
+						labelWidth: '70px',
+						compConfig: {
+							attr: {
+								placeholder: '请输入负责人',
+								clearable: true
+							}
+						}
+					},
+					{
+						span: 6,
+						label: '状态',
+						prop: 'status',
+						labelWidth: '70px',
+						component: 'by-select',
+						compConfig: {
+							attr: {
+								placeholder: '请选择状态',
+								clearable: true,
+								data: [{
+									value: 0,
+									label: '正常'
+								}, {
+									value: 1,
+									label: '禁用'
+								}]
+							}
+						}
+					},
+					]
+				]
+			},
+			tool: {
+				tools: {
+					add: true,
+					delete: true,
+					search: true,
+					refresh: true
+				}
+			},
+			table: {
+				attr: {
+					size: 'mini',
+					seq: true,
+					align: 'center',
+					checkbox: true,
+					height: 600
+				},
+				columns: [{
+					title: '名称',
+					field: 'name',
+					isDetail: true,
+					width: 300,
+				}, 
+				{
+					title: '负责人',
+					field: 'contacts',
+					width: 300,
+				},
+				{
+					width: 80,
+					title: '状态',
+					field: 'status',
+					component: Assembly,
+				}, {
+					width: 500,
+					title: '备注',
+					field: 'remark',
+				}, {
+					width: 120,
+					title: '操作',
+					action: true,
+					plugins: [{
+						icon: 'el-icon-edit',
+						name: '编辑',
+						audit: '',
+						event: {
+							click: (item : any) => {
+								(this as any).openEdit(item)
+							}
+						}
+					}, {
+						name: '删除',
+						event: {
+							click: (item : any) => (this as any).doDelete2(item)
+						}
+					}]
+				}]
+			},
+		}
+		addConfig = {
+			attr: {
+				size: 'small',
+				rules: {
+					name: [{
+						required: true, message: '请输入名称', trigger: 'blur'
+					}],
+					contacts: [{
+						required: true, message: '请输入负责人', trigger: 'blur'
+					}]
+				}
+			},
+			columns: [
+				[
+					{
+						span: 23,
+						labelWidth: '70px',
+						label: '名称',
+						prop: 'name',
+						component: 'by-input',
+					},
+					{
+						span: 23,
+						labelWidth: '70px',
+						label: '负责人',
+						prop: 'contacts',
+						component: 'by-input',
+					},
+					{
+						span: 23,
+						labelWidth: '70px',
+						label: '状态',
+						slot: true,
+						prop: 'status',
+					},
+				],
+				[
+					{
+						span: 23,
+						labelWidth: '70px',
+						label: '备注',
+						prop: 'remark',
+						component: 'by-input',
+						compConfig: {
+							attr: {
+								size: 'mini',
+								placeholder: '请输入备注',
+								type:'textarea'
+							},
+						}
+					},
+				]
+			]
+		}
+		mounted() {
+			this.timer = setInterval(() => {
+				this.getDataList()
+			}, 300)
+		}
+		// 确认新增/编辑
+		confirm() {
+			(this as any).$refs.addFormId.validate().then(() => {
+				let query = (this as any).$refs.addFormId.getValue();
+				console.log(query);
+				query.status = this.radio;
+				this.dialogFormVisible = false;
+				if (this.popTitle === '新增') {
+					api.saveList(query, 'maindataMaterialSupplier').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success(this.popTitle + '成功!');
+							this.getDataList();
+						} else this.$message.error(res.msg);
+					})
+				} else if (this.popTitle === '编辑') {
+					api.updateList(query, 'maindataMaterialSupplier').then((res : any) => {
+						if (res.code === 200) {
+							this.$message({
+								type: 'success',
+								message: this.popTitle + '成功!'
+							});
+							this.getDataList();
+						} else this.$message.error(res.msg);
+					})
+				}
+			})
+		}
+		// 获取列表数据
+		getDataList() {
+			if (!this.$refs.moduleView) {
+				if (this.timeNum > 5) {
+					clearInterval(this.timer)
+				}
+				this.timeNum++;
+				return
+			}
+			clearInterval(this.timer)
+			let query = (this.$refs.moduleView as any).getQuery();
+			api.pageList(query, 'maindataMaterialSupplier').then((res : any) => {
+				if (res.code === 200) {
+					(this.$refs.moduleView as any).setTableValue(res.data.records);
+					let page = {
+						pageNo: res.data.current, //当前页
+						pageSize: res.data.size, //每页条数
+						total: res.data.total //总条数
+					};
+					(this.$refs.moduleView as any).setPage(page)
+				} else this.$message.error(res.msg);
+			})
+		}
+		// 工具栏方法
+		clickHandle(e : any) {
+			if (e === 'onAdd') this.onAdd();
+			if (e === 'onDelete') this.onDelete();
+			if (e === 'onExport') this.onExport();
+		}
+		// 打开新增
+		onAdd() {
+			this.popTitle = '新增'
+			this.dialogFormVisible = true;
+			this.radio = 0
+			setTimeout(() => {
+				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue('');
+			}, 0)
+		}
+		// 打开编辑
+		openEdit(e : any) {
+			this.popTitle = '编辑'
+			this.dialogFormVisible = true;
+			this.radio = e.status
+			setTimeout(() => {
+				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
+			}, 0)
+		}
+		// 工具栏删除
+		onDelete() {
+			let selectData = (this.$refs.moduleView as any).getSelectData()
+			let ids = '';
+			if (selectData.length > 0) {
+				selectData.map((v : any) => {
+					ids += v.id + ','
+				})
+			} else return this.$message({ type: 'warning', message: '请选择删除数据' })
+			ids = ids.slice(0, ids.length - 1);
+			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				api.deleteList({ ids: ids }, 'maindataMaterialSupplier').then((res : any) => {
+					if (res.code === 200) {
+						this.getDataList();
+						this.$message({
+							type: 'success',
+							message: '删除成功!'
+						});
+					} else this.$message.error(res.msg);
+				})
+			}).catch(() => {
+				this.$message({
+					type: 'info',
+					message: '已取消删除'
+				});
+			});
+		}
+		// 操作删除
+		doDelete2(item : any) {
+			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
+				confirmButtonText: '确定',
+				cancelButtonText: '取消',
+				type: 'warning',
+				center: true
+			}).then(() => {
+				api.deleteList({ ids: item.id }, 'maindataMaterialSupplier').then((res : any) => {
+					if (res.code === 200) {
+						this.getDataList();
+						this.$message({
+							type: 'success',
+							message: '删除成功!'
+						});
+					} else this.$message.error(res.msg);
+				})
+			}).catch(() => {
+				this.$message.info('已取消删除');
+			});
+		}
+		// 刷新
+		onRefresh(){
+			this.loading = this.$loading({ target: '.main-container' });
+			(this as any).$refs.moduleView.clearSearch();
+			api.pageList({}, 'maindataMaterialSupplier').then((res : any) => {
+				if (res.code === 200) {
+					(this.$refs.moduleView as any).setTableValue(res.data.records);
+					let page = {
+						pageNo: res.data.current, //当前页
+						pageSize: res.data.size, //每页条数
+						total: res.data.total //总条数
+					};
+					(this.$refs.moduleView as any).setPage(page);
+					this.loading.close();
+				} else this.$message.error(res.msg);
+			})
+		}
+		//导出
+		onExport() {
+			let urlArr = '/maindata/maindataMaterial';
+			let query = (this.$refs.moduleView as any).getQuery();
+			(this as any).$download(urlArr + '/export', {
+				...query
+			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
+		}
+	}
+</script>
+<style lang="scss" scoped>
+	.my-container {
+		width: 100%;
+		box-sizing: border-box;
+		display: flex;
+		padding: 16px;
+
+		.search-btn {
+			width: 100%;
+			display: flex;
+			justify-content: flex-end;
+			margin-bottom: 20px;
+		}
+
+		.bill-left {
+			position: relative;
+			border-right: solid #EEE 1px;
+			padding-right: 16px;
+			flex-shrink: 0;
+
+			// box-sizing: border-box;
+			.bill-tab {
+				width: 150px;
+				height: 100%;
+				transition: all .5s;
+				overflow: hidden;
+			}
+
+			.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-tool,
+				.table-tool {
+					width: 100%;
+					padding-bottom: 16px;
+				}
+
+				.form {
+					margin-bottom: 8px;
+				}
+			}
+
+			.on-show {
+				opacity: 1;
+				z-index: 1;
+			}
+		}
+	}
+</style>

+ 52 - 0
src/views/audit/warehousing/components/towInOne.vue

@@ -0,0 +1,52 @@
+<template>
+	<div class="clearfix parentC">
+		<div class="inputC">{{propValue}}</div>
+		<div v-if="getPropConfig">
+			<div class="selectC" v-if="propValue" key="propValue1">更换</div>
+			<div class="selectC" v-else key="propValue2">选择</div>
+		</div>
+	</div>
+</template>
+
+<script lang="ts">
+	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+	@Component
+	export default class Focus extends Vue {
+		@Prop()
+		propValue : any;
+		@Prop()
+		propConfig : any;
+		get getPropConfig() {
+			return this.propConfig?.isSelect;
+		}
+		created() {
+			// console.log('propConfig', this.propConfig);
+		}
+		// 确定机构名称
+		confirm(e : any) {
+			this.$emit('getSupplierModal', e[0])
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	.parentC {
+		display: flex;
+		align-items: center;
+
+		.inputC {
+			float: left;
+			width: calc(100% - 54px);
+		}
+
+		.selectC {
+			float: left;
+			margin-left: 10px;
+			color: #fff;
+			background-color: #0089ff;
+			padding: 0 10px;
+			border-radius: 12px;
+			cursor: pointer;
+		}
+	}
+</style>

+ 170 - 88
src/views/audit/warehousing/index.vue

@@ -5,7 +5,7 @@
 			@getSupplierModal="getSupplierModal">
 		</by-bill>
 		<!-- 选择物料 -->
-		<productModal ref="product" :mulit="true" />
+		<productModal ref="product" :mulit="true" @confirm="confirmProduct" />
 	</div>
 </template>
 
@@ -14,6 +14,7 @@
 	import api from "@/api/order";
 	import productModal from "../orderTask/components/productModal.vue";
 	import Focus from "../orderTask/components/focus.vue";
+	import towInOne from "./components/towInOne.vue";
 	@Component({ components: { productModal } })
 	export default class OrderTask extends Vue {
 		// 左边
@@ -72,6 +73,12 @@
 								prop: 'operator',
 								component: 'by-input',
 							},
+							{
+								span: 8,
+								label: '业务类型',
+								prop: 'businessType',
+								component: 'by-select',
+							},
 							{
 								span: 8,
 								label: 'WMS编码',
@@ -112,84 +119,94 @@
 								readonly: true
 							},
 							columns:
-								[{
-									width: 300,
-									title: '物料名称',
-									field: 'materialName',
-								},
-								{
-									width: 140,
-									title: '单位',
-									field: 'unit',
-								},
-								{
-									width: 140,
-									title: '数量',
-									field: 'number',
-									component: 'by-input',
-									compConfig: {
-										attr: {
-											size: 'mini',
-											type: 'number',
-											defaultValue: 1,
-										},
-									}
-								},
-								{
-									width: 140,
-									title: '已交付数量',
-									field: 'deliveryNumber',
-								},
-								{
-									width: 140,
-									title: '单价',
-									field: 'unitPrice',
-									component: 'by-input',
-									compConfig: {
-										attr: {
-											size: 'mini',
-											type: 'number',
-										},
-									}
-								},
-								{
-									width: 140,
-									title: '实际金额',
-									field: 'realityPrice',
-								},
-								{
-									width: 140,
-									title: '优惠金额',
-									field: 'prePrice',
-									component: 'by-input',
-									compConfig: {
-										attr: {
-											size: 'mini',
-											type: 'number',
-											defaultValue: '0',
-										},
-									}
-								},
-								{
-									width: 140,
-									title: '合计金额',
-									field: 'totalPrice',
-								},
-								{
-									width: 90,
-									title: '操作',
-									action: true,
-									plugins: [{
-										icon: 'el-icon-delete',
-										name: '删除',
-										audit: '',
-										event: {
-											click: (item : any) => {
-												(this as any).changeTable(item)
-											}
+								[
+									{
+										width: 300,
+										title: '物料名称',
+										field: 'materialName',
+									},
+									{
+										width: 200,
+										title: '仓库,仓位',
+										field: 'towInOne',
+										component: towInOne,
+										compConfig: {
+											isSelect: true
 										}
-									}]
-								},
+									},
+									{
+										width: 110,
+										title: '单位',
+										field: 'unit',
+									},
+									{
+										width: 110,
+										title: '数量',
+										field: 'number',
+										component: 'by-input',
+										compConfig: {
+											attr: {
+												size: 'mini',
+												type: 'integer',
+												defaultValue: 1,
+											},
+										}
+									},
+									{
+										width: 110,
+										title: '已交付数量',
+										field: 'deliveryNumber',
+									},
+									{
+										width: 110,
+										title: '单价',
+										field: 'unitPrice',
+										component: 'by-input',
+										compConfig: {
+											attr: {
+												size: 'mini',
+												type: 'number',
+											},
+										}
+									},
+									{
+										width: 110,
+										title: '实际金额',
+										field: 'realityPrice',
+									},
+									{
+										width: 110,
+										title: '优惠金额',
+										field: 'prePrice',
+										component: 'by-input',
+										compConfig: {
+											attr: {
+												size: 'mini',
+												type: 'number',
+												defaultValue: 0,
+											},
+										}
+									},
+									{
+										width: 110,
+										title: '合计金额',
+										field: 'totalPrice',
+									},
+									{
+										width: 90,
+										title: '操作',
+										action: true,
+										plugins: [{
+											icon: 'el-icon-delete',
+											name: '删除',
+											audit: '',
+											event: {
+												click: (item : any) => {
+													(this as any).changeTable(item)
+												}
+											}
+										}]
+									},
 								]
 						}
 					}
@@ -254,7 +271,7 @@
 						height: 620,
 						size: 'mini',
 						seq: true,
-						align: 'center',
+						align: 'left',
 						checkbox: true
 					},
 					columns: [
@@ -263,6 +280,7 @@
 							title: '单据编号',
 							field: 'orderNumber',
 							isDetail: true,
+							fixed: 'left'
 						},
 						{
 							width: 200,
@@ -372,7 +390,7 @@
 						height: 620,
 						size: 'mini',
 						seq: true,
-						align: 'center',
+						align: 'left',
 						checkbox: true
 					},
 					columns: [
@@ -381,6 +399,7 @@
 							title: '单据编号',
 							field: 'orderNumber',
 							isDetail: true,
+							fixed: 'left'
 						},
 						{
 							width: 200,
@@ -490,7 +509,7 @@
 						height: 620,
 						size: 'mini',
 						seq: true,
-						align: 'center',
+						align: 'left',
 						checkbox: true
 					},
 					columns: [
@@ -499,6 +518,7 @@
 							title: '单据编号',
 							field: 'orderNumber',
 							isDetail: true,
+							fixed: 'left'
 						},
 						{
 							width: 200,
@@ -606,7 +626,7 @@
 						height: 620,
 						size: 'mini',
 						seq: true,
-						align: 'center',
+						align: 'left',
 						checkbox: true
 					},
 					columns: [
@@ -615,6 +635,7 @@
 							title: '单据编号',
 							field: 'orderNumber',
 							isDetail: true,
+							fixed: 'left'
 						},
 						{
 							width: 200,
@@ -672,7 +693,40 @@
 		}
 		// 监听表格数据变化
 		onChangeRow(e : any) {
-			console.log(e);
+			e.realityPrice = e.number * e.unitPrice;
+			e.totalPrice = e.realityPrice - e.prePrice;
+		}
+		// 确定商品新增
+		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 + '” 已存在!', '提示', {
+					confirmButtonText: '确定',
+				});
+			};
+			(this.$refs.bill as any).setBillTableValue(this.tableData, 0);// 设置第1张单据表格数据
 		}
 		// 保存
 		onSave(e : any) {
@@ -686,9 +740,17 @@
 				// 子表数据
 				query.suborderList = this.tableData;
 				if (query.suborderList.length > 0) {
-					query.suborderList.map((v : any) => {
-						v.taskOrderId = query.id
-					})
+					for (let v of query.suborderList) {
+						console.log(v.prePrice);
+						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('请输入正确优惠金额');
+						v.taskOrderId = query.id;
+						v.storehouseName = '我是仓库';
+						v.storehouseId = 2;
+						v.storingLocationName = '我是仓位';
+						v.storingLocationId = 4;
+					}
 				};
 				// 表格删除
 				query.suborderList.map((v : any, i : any) => {
@@ -696,7 +758,7 @@
 						v.splice(i, 1)
 					}
 				});
-				if (query.deliveryData) query.deliveryData = query.deliveryData + ' 00:00:00';
+
 				console.log('保存参数query ==> ', query);
 
 				if (this.isAdd) {
@@ -722,6 +784,7 @@
 						} else this.$message.error(res.msg);
 					})
 				};
+
 			})
 		}
 		// 打开新增
@@ -758,9 +821,28 @@
 				if (this.tabType === 'all' && e.submitState === 1) return this.setReadonly(e);
 				let data = e.suborderList
 				data.map((v : any, i : any) => {
-					v.dataIndex = i
+					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 };