Kaynağa Gözat

仓库仓位、销售订单

AlanWong 2 yıl önce
ebeveyn
işleme
a22cab428f

+ 4 - 1
src/components/supplierModal/supplierModal.vue

@@ -1,6 +1,6 @@
 <template>
   <vxe-modal v-model="value" id="supplierModal" :width="width?width+'px':'60%'" @show="show" :height="height?height+'px':'80%'" min-width="500" min-height="400" 
-  show-zoom resize transfer show-footer  @confirm="confirm">
+  show-zoom resize transfer show-footer  @confirm="confirm" :zIndex="zIndex">
     <template #title>
       <span>{{title?title:'选择供应商'}}</span>
     </template>
@@ -30,6 +30,9 @@ export default class SupplierModal extends Vue {
 
   @Prop()
   mulit?:boolean
+	
+	@Prop()
+	zIndex?:number
 
   config:any={
     search:{

+ 110 - 65
src/views/audit/depots/index.vue

@@ -3,7 +3,7 @@
 		<transition-group name="fade" style="position: relative;width: 100%;display: flex;">
 			<div class="bill-main" v-show="isShow==='ckb'" key="item">
 				<module-view :propConfig="config" ref="moduleView" @pagination="getDataList" @search="getDataList"
-					@resert="getDataList" @clickHandle="clickHandle" @detail="openEdit">
+					@resert="getDataList" @clickHandle="clickHandle" @detail="openEdit" @onRefresh="onRefresh">
 				</module-view>
 				<!-- 新增/编辑弹窗 -->
 				<el-dialog :title="popTitle+'仓库'" :visible.sync="dialogFormVisible" width="30%">
@@ -19,7 +19,14 @@
 				</module-view>
 				<!-- 新增/编辑弹窗 -->
 				<el-dialog :title="popTitle+'仓位'" :visible.sync="dialogFormVisible2" width="30%">
-					<by-form :propConfig="addConfig2" ref="addFormId2"></by-form>
+					<by-form :propConfig="addConfig2" ref="addFormId2">
+						<template v-slot:organizationName="{value}">
+							<el-input placeholder="请选择所属机构名称" v-model="value.organizationName" class="input-organizationName"
+								:readonly="true">
+								<el-button slot="append" icon="el-icon-more" @click="handleSupplier"></el-button>
+							</el-input>
+						</template>
+					</by-form>
 					<div slot="footer" class="dialog-footer">
 						<el-button @click="dialogFormVisible2 = false">取 消</el-button>
 						<el-button type="primary" @click="confirm2">确 定</el-button>
@@ -27,6 +34,7 @@
 				</el-dialog>
 			</div>
 		</transition-group>
+		<supplier-modal ref="supplierModal" @confirm="confirmSupplier" :zIndex="9999" />
 	</div>
 </template>
 <script lang="ts">
@@ -38,7 +46,7 @@
 		timeNum = 0;
 		timer : any = null
 		popTitle : any = ''
-		tableData : any = ''
+		tableData : any = {}
 		dialogFormVisible : boolean = false
 		dialogFormVisible2 : boolean = false
 		config : any = {
@@ -277,7 +285,7 @@
 					}, {
 						name: '删除',
 						event: {
-							click: (item : any) => (this as any).doDelete2(item)
+							click: (item : any) => (this as any).doDelete2(item, 'maindataStorehouse')
 						}
 					}]
 				}]
@@ -320,42 +328,52 @@
 				rules: {
 					name: [{
 						required: true, message: '请输入名称', trigger: 'blur'
+					}],
+					organizationName: [{
+						required: true, message: '请输入所属机构名称', trigger: 'blur'
 					}]
 				}
 			},
 			columns: [
 				[
 					{
+						labelWidth: '110px',
 						span: 23,
 						label: '名称',
 						prop: 'name',
 						component: 'by-input',
 					},
 					{
+						labelWidth: '110px',
 						span: 23,
 						label: '所属机构名称',
 						prop: 'organizationName',
-						component: 'by-input',
+						slot: true,
+						// component: 'by-input',
 					},
 					{
+						labelWidth: '110px',
 						span: 23,
 						label: '库存',
 						prop: 'stock',
 						component: 'by-input',
 					},
 					{
+						labelWidth: '110px',
 						span: 23,
 						label: '库存体积',
 						prop: 'stockVolume',
 						component: 'by-input',
 					},
 					{
+						labelWidth: '110px',
 						span: 23,
 						label: '库存数量上限',
 						prop: 'maxStockNumber',
 						component: 'by-input',
 					},
 					{
+						labelWidth: '110px',
 						span: 23,
 						label: '库存体积上限',
 						prop: 'maxStockVolume',
@@ -369,10 +387,26 @@
 				this.getDataList()
 			}, 500)
 		}
+		// 打开机构选择
+		handleSupplier() {
+			(this.$refs.supplierModal as any).setShow(true);
+		}
+		// 确定机构选择
+		confirmSupplier(e : any) {
+			if (e.length == 0) return this.$message.warning('请选择供应商!');
+			let value : any = (this.$refs.addFormId2 as any).getValue();
+			value.organizationName = e[0].name;
+			value.organizationId = e[0].id;
+			(this.$refs.addFormId2 as any).setValue(value);
+		}
+		// 查看仓位
 		changeTab(item : any) {
-			console.log(item);
 			this.tableData = item;
-			(this.$refs.moduleView2 as any).setTableValue(item.subList);
+			this.tableData.subList.map((v : any, i : any) => {
+				v.dataIndex = i;
+			});
+			console.log('仓位表数据 ==> ', this.tableData);
+			(this.$refs.moduleView2 as any).setTableValue(this.tableData.subList);
 			this.isShow = 'cwb';
 		}
 		// 仓库确认新增/编辑
@@ -383,22 +417,16 @@
 				if (this.popTitle === '新增') {
 					api.saveList(query, 'maindataStorehouse').then((res : any) => {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
+							this.$message.success(this.popTitle + '成功!');
 							this.getDataList();
-						} else this.failHandle(res)
+						} else this.$message.error(res.msg)
 					})
 				} else if (this.popTitle === '编辑') {
 					api.updateList(query, 'maindataStorehouse').then((res : any) => {
 						if (res.code === 200) {
-							this.$message({
-								type: 'success',
-								message: this.popTitle + '成功!'
-							});
+							this.$message.success(this.popTitle + '成功!');
 							this.getDataList();
-						} else this.failHandle(res)
+						} else this.$message.error(res.msg)
 					})
 				}
 			})
@@ -408,17 +436,42 @@
 			(this as any).$refs.addFormId2.validate().then(() => {
 				let query = (this as any).$refs.addFormId2.getValue();
 				this.tableData.subList = [query];
-				console.log(this.tableData);
-				this.dialogFormVisible2 = false;
-				api.updateList(this.tableData, 'maindataStorehouse').then((res : any) => {
-					if (res.code === 200) {
-						this.$message({
-							type: 'success',
-							message: this.popTitle + '成功!'
-						});
-						this.getDataList();
-					} else this.failHandle(res)
+				let addId = this.tableData.id;
+				this.tableData.subList.map((v : any) => {
+					v.storehouseId = this.tableData.id;
+					v.idDelete = 0;
 				})
+				this.dialogFormVisible2 = false;
+				if (this.popTitle === '新增') {
+					delete this.tableData.id;
+					console.log(this.tableData);
+					api.saveList(this.tableData, 'maindataStorehouse').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success(this.popTitle + '成功!');
+							this.getOneself(addId);
+						} else this.$message.error(res.msg)
+					})
+				} else if (this.popTitle === '编辑') {
+					api.updateList(this.tableData, 'maindataStorehouse').then((res : any) => {
+						if (res.code === 200) {
+							this.$message.success(this.popTitle + '成功!');
+							this.getOneself(this.tableData.id);
+						} else this.$message.error(res.msg)
+					})
+				}
+
+			})
+		}
+		// 通过id拿到当条数据
+		getOneself(e : any) {
+			api.single({ id: e }, 'maindataStorehouse').then((res : any) => {
+				if (res.code === 200) {
+					this.tableData = res.data;
+					this.tableData.subList.map((v : any, i : any) => {
+						v.dataIndex = i
+					});
+					(this.$refs.moduleView2 as any).setTableValue(this.tableData.subList);
+				}
 			})
 		}
 		// 获取仓库列表数据
@@ -441,20 +494,17 @@
 						total: res.data.total //总条数
 					};
 					(this.$refs.moduleView as any).setPage(page)
-				} else this.failHandle(res)
+				} else this.$message.error(res.msg)
 			})
 		}
 		// 工具栏方法
 		clickHandle(e : any) {
-			console.log(e);
-			if (e === 'onRefresh') (this.$refs.moduleView as any).resert();
 			if (e === 'onAdd') this.onAdd();
 			if (e === 'onDelete') this.onDelete('moduleView', 'maindataStorehouse');
 			if (e === 'onExport') this.onExport();
 		}
+		// 工具栏方法
 		clickHandle2(e : any) {
-			console.log(e);
-			if (e === 'onRefresh') (this.$refs.moduleView2 as any).resert();
 			if (e === 'onAdd') this.onAdd2();
 			if (e === 'onExport') this.onExport();
 			if (e === 'onReturn') this.isShow = 'ckb';
@@ -467,13 +517,6 @@
 				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue({});
 			}, 0)
 		}
-		onAdd2() {
-			this.popTitle = '新增'
-			this.dialogFormVisible2 = true;
-			setTimeout(() => {
-				if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue({});
-			}, 0)
-		}
 		// 打开编辑
 		openEdit(e : any) {
 			this.popTitle = '编辑'
@@ -482,6 +525,14 @@
 				if ((this as any).$refs.addFormId) (this as any).$refs.addFormId.setValue(e);
 			}, 0)
 		}
+		// 打开新增
+		onAdd2() {
+			this.popTitle = '新增'
+			this.dialogFormVisible2 = true;
+			setTimeout(() => {
+				if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue({});
+			}, 0)
+		}
 		// 打开编辑
 		openEdit2(e : any) {
 			this.popTitle = '编辑'
@@ -490,6 +541,10 @@
 				if ((this as any).$refs.addFormId2) (this as any).$refs.addFormId2.setValue(e);
 			}, 0)
 		}
+		// 刷新
+		onRefresh(){
+			(this as any).$refs.moduleView.clearSearch();
+		}
 		// 工具栏删除
 		onDelete(moduleView : any, url : any) {
 			let selectData = (this.$refs[moduleView] as any).getSelectData()
@@ -498,7 +553,7 @@
 				selectData.map((v : any) => {
 					ids += v.id + ','
 				})
-			} else return this.$message({ type: 'warning', message: '请选择删除数据' })
+			} else return this.$message.warning('请选择删除数据');
 			ids = ids.slice(0, ids.length - 1);
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
@@ -509,35 +564,31 @@
 				api.deleteList({ ids: ids }, url).then((res : any) => {
 					if (res.code === 200) {
 						this.getDataList();
-						this.$message({
-							type: 'success',
-							message: '删除成功!'
-						});
-					} else this.failHandle(res)
+						this.$message.success('删除成功');
+					} else this.$message.error(res.msg)
 				})
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		// 操作删除
-		doDelete2(item : any) {
-			console.log(item);
+		doDelete2(item : any, url : any) {
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
 				type: 'warning',
 				center: true
 			}).then(() => {
+				console.log(item);
+				if (item.subList) {
+					api.deleteList({ ids: item.id }, url).then((res : any) => {
+						if (res.code === 200) {
+							this.getDataList();
+							this.$message.success('删除成功');
+						} else this.$message.error(res.msg)
+					})
+				} else {
 
-			}).catch(() => {
-				this.$message({
-					type: 'info',
-					message: '已取消删除'
-				});
-			});
+				}
+			}).catch(() => this.$message.info('已取消删除'));
 		}
 		//导出
 		onExport() {
@@ -547,12 +598,6 @@
 				...query
 			}, urlArr[urlArr.length - 1] + `_${new Date().getTime()}.xlsx`)
 		}
-		// 运行错误
-		failHandle(err : any) {
-			let msg = err.msg ? err.msg : '运行错误!';
-			this.$message.error(msg)
-		}
-
 	}
 </script>
 <style lang="scss" scoped>

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

@@ -4,14 +4,13 @@
 			<el-button slot="append" icon="el-icon-more" @click="handleSupplier"></el-button>
 		</el-input>
 		<!-- 选择机构名称 -->
-		<supplierModal ref="supplierModal" @confirm="confirm" />
+		<supplier-modal ref="supplierModal" @confirm="confirm" />
 	</div>
 </template>
 
 <script lang="ts">
 	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
-	import SupplierModal from "@/components/supplierModal/supplierModal.vue";
-	@Component({ components: { SupplierModal } })
+	@Component
 	export default class Focus extends Vue {
 		@Prop()
 		propValue : any

+ 0 - 3
src/views/audit/orderTask/index.vue

@@ -1103,7 +1103,6 @@
 			}).then(() => {
 				api.deleteList({ ids: ids }, 'supplyTaskOrder').then((res : any) => {
 					if (res.code === 200) {
-						// this.getDataList();
 						this.clickTab(this.tabType);
 						this.$message.success('删除成功!');
 					} else this.failHandle(res)
@@ -1112,7 +1111,6 @@
 		}
 		// 操作删除
 		doDelete2(item : any) {
-			// if (this.tabType === '') {// };
 			this.$confirm('确定删除吗,此操作不能撤销!', '注意', {
 				confirmButtonText: '确定',
 				cancelButtonText: '取消',
@@ -1121,7 +1119,6 @@
 			}).then(() => {
 				api.deleteList({ ids: item.id }, 'supplyTaskOrder').then((res : any) => {
 					if (res.code === 200) {
-						// this.getDataList();
 						this.clickTab(this.tabType);
 						this.$message.success('删除成功!');
 					} else this.failHandle(res)

+ 114 - 27
src/views/audit/saleOrder/index.vue

@@ -3,6 +3,23 @@
 		<by-bill :propConfig="config" @search="search" @onSmt="doSave" ref="bill" @onAdd="onAdd" @onOrder="onOrder"
 			@resert="resert" @detail="openEdit" @onRefresh="onRefresh" @pagination="pagination">
 		</by-bill>
+
+		<vxe-modal v-model="vxeValue" width="70%" height="70%" min-width="800" min-height="600" show-zoom resize transfer
+			show-footer @confirm="confirm">
+			<template #title>
+				<!-- <span>拆单</span> -->
+			</template>
+			<template #default>
+				<div class="fl" style="width: 40%; margin-right: 20%;">
+					<div style="margin-bottom: 20px;">主单销售数据</div>
+					<by-table ref="leftTable" :propConfig="leftTableConfig"></by-table>
+				</div>
+				<div class="fl" style="width: 40%;">
+					<div style="margin-bottom: 20px;">拆单销售数据</div>
+					<by-table ref="rightTable" :propConfig="rightTableConfig" @onChangeRow="rightChange"></by-table>
+				</div>
+			</template>
+		</vxe-modal>
 	</div>
 </template>
 
@@ -11,8 +28,52 @@
 	import api from "@/api/order";
 	@Component
 	export default class OrderTask extends Vue {
+		vxeValue = false
 		timeNum = 0;
 		timer : any = null
+		leftTableConfig : any = {
+			attr: {
+				size: 'mini',
+				height: 490,
+				align: 'center',
+			},
+			columns:
+				[
+					{
+						title: '物料名称',
+						field: 'materialName',
+					},
+					{
+						title: '数量',
+						field: 'number',
+					},
+				]
+		}
+		rightTableConfig : any = {
+			attr: {
+				size: 'mini',
+				height: 490,
+				align: 'center',
+			},
+			columns:
+				[
+					{
+						title: '物料名称',
+						field: 'materialName',
+					},
+					{
+						title: '数量',
+						field: 'number',
+						component: 'by-input',
+						compConfig: {
+							attr: {
+								size: 'mini',
+								type: 'number',
+							},
+						}
+					},
+				]
+		}
 		config : any = {
 			attr: {
 				activeName: 'all'
@@ -24,7 +85,7 @@
 						{
 							name: '拆单', icon: 'el-icon-plus', audit: [''], event: {
 								click: () => {
-									(this as any).orderTaking()
+									// (this as any).orderTaking()
 								}
 							}
 						}
@@ -225,14 +286,14 @@
 						{
 							name: '入库', icon: 'el-icon-plus', audit: [''], event: {
 								click: () => {
-									// (this as any).orderTaking()
+									// (this as any)
 								}
 							}
 						},
 						{
 							name: '退单', icon: 'el-icon-top', audit: [''], event: {
 								click: () => {
-									// (this as any).orderTaking()
+									// (this as any)
 								}
 							}
 						}
@@ -304,7 +365,7 @@
 							}, {
 								name: '拆单',
 								event: {
-									// click: (item : any) => (this as any).getOrder(item)
+									click: (item : any) => (this as any).orderTaking(item)
 								}
 							}]
 						}
@@ -317,16 +378,57 @@
 				this.getDataList()
 			}, 500)
 		}
-		onRefresh(n:string){
+		// 刷新
+		onRefresh(n : string) {
 			console.log(n)
 		}
+		// 右拆单数据变化
+		rightChange(e : any) {
+			console.log(e.number);
+			console.log(e.number >= 0);
+			if (e.number >= 0 && e.number) {
+
+			} else {
+				let rightForm = (this.$refs.rightTable as any).getValue();
+				rightForm[e.dataIndex].number = '0';
+				(this.$refs.rightTable as any).setValue(rightForm);
+				this.$message.warning('只能输入自然数');
+			}
+		}
+		// 拆单
+		orderTaking(item : any) {
+			this.vxeValue = true;
+			let rightData = (this as any).$lodash.cloneDeep(item.suborderList);
+			rightData.map((v : any, i : any) => {
+				v.number = '0';
+				v.dataIndex = i;
+			});
+			setTimeout(() => {
+				(this.$refs.leftTable as any).setValue(item.suborderList);
+				(this.$refs.rightTable as any).setValue(rightData);
+			}, 0)
+			// let query : any = (this as any).$refs.bill.$refs.billForm.getValue();
+			// api.updateList(query, 'supplyPurchaseOrder').then((res : any) => {
+			// 	if (res.code === 200) {
+			// 		this.$message({
+			// 			type: 'success',
+			// 			message: '保存成功!'
+			// 		});
+			// 		this.getDataList();
+			// 		(this.$refs.bill as any).showTab = 'all';
+			// 		(this.$refs.bill as any).setBillFormValue({});
+			// 	} else this.failHandle(res)
+			// })
+		}
+		// 确认拆单
+		confirm(e : any) {
+			console.log(e);
+		}
 		// 保存新增
 		doSave() {
 			// (this.$refs.product as any).setShow(true)
 			(this as any).$refs.bill.$refs.billForm.validate().then(() => {
 				let query = (this as any).$refs.bill.$refs.billForm.getValue();
-				// query.suborderList = [] // 子表单数据
-				query.status = 0; // 默认未接单
 				api.saveList(query, 'supplyPurchaseOrder').then((res : any) => {
 					if (res.code === 200) {
 						this.$message({
@@ -340,21 +442,6 @@
 				})
 			})
 		}
-		// 拆单
-		orderTaking() {
-			// let query : any = (this as any).$refs.bill.$refs.billForm.getValue();
-			// api.updateList(query, 'supplyPurchaseOrder').then((res : any) => {
-			// 	if (res.code === 200) {
-			// 		this.$message({
-			// 			type: 'success',
-			// 			message: '保存成功!'
-			// 		});
-			// 		this.getDataList();
-			// 		(this.$refs.bill as any).showTab = 'all';
-			// 		(this.$refs.bill as any).setBillFormValue({});
-			// 	} else this.failHandle(res)
-			// })
-		}
 		getDataList() {
 			if (!this.$refs.bill) {
 				if (this.timeNum > 5) {
@@ -365,17 +452,17 @@
 			}
 			clearInterval(this.timer)
 			// submitState: 提交状态
-			this.getPageList({pageSize:20,pageNo:1}, 'all'); // 综合数据
+			this.getPageList({ pageSize: 20, pageNo: 1 }, 'all'); // 综合数据
 			// recycleBin
 			// this.getPageList({ submitState: 0 }, 'draftsBox'); // 草稿箱数据
 			// this.getPageList({ submitState: 1 }, 'smt'); // 已提交数据
 			// this.getSelectDeleteList('supplyPurchaseOrder') // 回收站数据
 		}
-		pagination(e:any){
+		pagination(e : any) {
 			console.log(e);
 			let query = {
-				pageNo:e.page.pageNum,
-				pageSize:e.page.pageSize,
+				pageNo: e.page.pageNum,
+				pageSize: e.page.pageSize,
 			};
 			let loading = this.$loading({ target: '.main-container' })
 			api.pageList(query, 'supplyPurchaseOrder').then((res : any) => {
@@ -401,7 +488,7 @@
 		}
 		// 回收站数据
 		getSelectDeleteList(data : any) {
-			api.selectDeleteList(data,'supplyTaskOrder').then((res : any) => {
+			api.selectDeleteList(data, 'supplyTaskOrder').then((res : any) => {
 				if (res.code === 200) {
 					(this.$refs.bill as any).setTabTableValue('recycleBin', res.data);
 					let page = {