Forráskód Böngészése

仓库表添加、编辑和表单修改

hcf 1 éve
szülő
commit
eeb2a6daf0

+ 11 - 1
src/api/omsOrder.ts

@@ -232,4 +232,14 @@ export const archive:any = (data:any) => {
 		method:'POST',
 		params:data
 	})
-}  
+}  
+
+
+//根据第三方系统查询记录
+export function queryBySys(params:any){
+	return request({
+		url: '/omsOrder/omsPartner/queryBySys',
+		params:params,
+		method: 'GET'
+	})
+}

+ 16 - 0
src/components/Assembly/yesno.vue

@@ -0,0 +1,16 @@
+<template>
+	<div>
+		<el-tag size='mini' :type="propValue===0||propValue===null?'danger':'primary'" disable-transitions>{{propValue===0||propValue===null?'否':'是'}}</el-tag>
+	</div>
+</template>
+<script lang="ts">
+	import { Component, Prop, Vue, Watch, Mixins } from "vue-property-decorator";
+	@Component
+	export default class yesno extends Vue {
+		@Prop()
+		propValue : any
+	}
+</script>
+
+<style>
+</style>

+ 290 - 0
src/views/audit/depots/components/ruleForm.vue

@@ -0,0 +1,290 @@
+<template>
+	<div>
+		<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="150px" class="demo-ruleForm">
+			<el-form-item label="名称:" prop="name">
+				<el-col :span="13">
+					<el-input v-model="ruleForm.name"></el-input>
+				</el-col>
+			</el-form-item>
+			<el-form-item label="金蝶仓库名称:" prop="financeStorehouseName">
+				<el-col :span="13">
+					<el-input v-model="ruleForm.financeStorehouseName"></el-input>
+				</el-col>
+			</el-form-item>
+			<el-form-item label="金蝶仓库编号:" prop="financeStorehouseNo">
+				<el-col :span="13">
+					<el-input v-model="ruleForm.financeStorehouseNo"></el-input>
+				</el-col>
+			</el-form-item>
+			<el-form-item label="绑定第三方系统:" prop="isThird">
+				<el-col :span="13">
+					<el-switch v-model="ruleForm.isThird" :active-value='1' :inactive-value='0'></el-switch>
+				</el-col>
+			</el-form-item>
+			<el-form-item label="第三方系统:" prop="thirdSysName" v-if="ruleForm.isThird">
+				<el-col :span="13">
+					<el-select v-model="ruleForm.thirdSysName" placeholder="请选择第三方系统" @change="selectChange">
+						<el-option label="极智嘉" value="GEEKPLUS"></el-option>
+					</el-select>
+				</el-col>
+			</el-form-item>
+			<el-form-item label="第三方货主:" prop="thirdPartnerId" v-if="ruleForm.isThird">
+				<el-col :span="8">
+					<el-select v-model="ruleForm.thirdPartnerId" placeholder="请选择第三方货主" @change="selectThirdPartner">
+						<el-option v-for="(item,index) in thirdPartnerList" :key="index" :label="item.wmsMemberName" :value="item.id"></el-option>
+					</el-select>
+				</el-col>
+				<el-col :span="6">
+					<el-button type="primary" icon="el-icon-s-custom" @click="toCargoOwner">货主管理</el-button>
+				</el-col>
+			</el-form-item>
+			<el-form-item label="第三方货仓库:" prop="thirdStorehouseName" v-if="ruleForm.isThird">
+				<el-col :span="13">
+					<el-select v-model="ruleForm.thirdStorehouseName" placeholder="请选择第三方货仓库">
+						<el-option v-for="(item,index) in thirdStorehouseList" :key="index" :label="item" :value="item"></el-option>
+					</el-select>
+				</el-col>
+			</el-form-item>
+			<el-form-item label="仓库地址:" class="laErrors">
+				<byArea ref="byArea" :class="byAreaSlot?'errors':''" :propConfig="compConfig" :parentValue="parentValue"  @onChange="byAreaOnChange"></byArea>
+				<div class="zerrors" v-if="byAreaSlot">请选择仓库地址</div>
+			</el-form-item>
+			<el-form-item label="详细地址:" prop="address">
+				<el-col>
+					<el-input v-model="ruleForm.address"></el-input>
+				</el-col>
+			</el-form-item>
+		</el-form>
+	</div>
+</template>
+
+<script lang="ts">
+	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
+	import { queryBySys } from "@/api/omsOrder";
+	import byArea from "../../../../benyun/components/byArea/byArea.vue";
+	@Component({ components: { byArea } })
+	export default class ruleForm extends Vue {
+		@Prop()
+		value : any;
+		propValue : any;
+		ruleForm: any = {
+			name: null, //名称
+			financeType: '金蝶', //金蝶财务系统名称
+			financeStorehouseName: null, //金蝶仓库名称
+			financeStorehouseNo: null, //金蝶仓库编号
+			isThird: 0, //是否绑定第三方仓库
+			thirdSysName: 'GEEKPLUS', //第三方系统名称
+			thirdPartnerId: null, //货主ID
+			thirdPartnerName: null, //货主名称
+			thirdStorehouseName: null, //云仓仓库名称
+			address: null, //详细地址
+			province: null, //仓库所在省
+			provinceCode: null, //省份编号
+			city: null, //仓库所在市
+			cityCode: null, //市编号
+			region: null, //仓库所在区
+			regionCode: null, //区县编号
+			street: null, //仓库所在街道
+			streetCode: null, //街道编码
+		};
+		rules: any = {
+			name: [{
+				required: true, message: '请输入名称', trigger: 'blur'
+			}],
+			financeStorehouseName: [{
+				required: true, message: '请输入金蝶仓库名称', trigger: 'blur'
+			}],
+			financeStorehouseNo: [{
+				required: true, message: '请输入金蝶仓库编号', trigger: 'blur'
+			}],
+			isThird: [{
+				required: true, message: '请选择是否绑定', trigger: 'change'
+			}],
+			thirdSysName: [{
+				required: true, message: '请选择第三方系统', trigger: 'change'
+			}],
+			thirdPartnerId: [{
+				required: true, message: '请选择第三方货主', trigger: 'change'
+			}],
+			thirdStorehouseName: [{
+				required: true, message: '请选择第三方货仓库', trigger: 'change'
+			}],
+			address: [{
+				required: true, message: '请输入详细地址', trigger: 'blur'
+			}]
+		};
+		parentValue: any = {
+			province: null,
+			provinceCode: null,
+			city: null,
+			cityCode: null,
+			region: null,
+			regionCode: null,
+			street: null,
+			streetCode: null,
+		}
+		compConfig: any = {
+			attr: {
+				province: 'province', //省
+				provinceCode: 'provinceCode', //省编码
+				city: 'city',   //市
+				cityCode: 'cityCode',  //市编码
+				county: 'region',  //县/区
+				countyCode: 'regionCode',   //县/区编码
+				town: 'street', //街道
+				townCode: 'streetCode', //街道编码
+			}
+		}
+		byAreaSlot: any = false;
+		thirdPartnerList: any = []; //第三方货主列表
+		thirdStorehouseList: any = [] //第三方货仓库列表
+		created() {
+			var wmsSys: any = {
+				wmsSys: (this as any).ruleForm.thirdSysName
+			};
+			queryBySys(wmsSys).then((res : any) => {
+				if (res.code === 200) {
+					(this as any).thirdPartnerList = res.data
+				}
+			});
+			(this as any).clearValue();
+		}
+		//表单验证
+		validate(parames?:any):Promise<any>{
+			return new Promise((resolve:Function, reject:Function) => {
+				if(!this.$refs.ruleForm){
+					resolve(true)
+				}
+				(this as any).$refs.ruleForm.validate((valid:any) => {
+					if (valid) {
+						resolve(true)
+					} else {
+						if(!parames || !parames.noMsg || !(this as any).parentValue.provinceCode){
+							(this as any).byAreaSlot = true;
+							(this as any).$message({
+								message: '验证未通过,请检查!',
+								type: 'warning',
+							})
+						}
+						reject()
+					}
+				});
+			})
+		}
+		setValue(e: any){
+			// console.log(e);
+			if(e.name){
+				(this as any).ruleForm = e;
+				if((this as any).ruleForm.isThird==null){
+					(this as any).ruleForm.isThird = 0
+				};
+				(this as any).$set((this as any).parentValue, 'province', (this as any).ruleForm.province);
+				(this as any).$set((this as any).parentValue, 'provinceCode', (this as any).ruleForm.provinceCode);
+				(this as any).$set((this as any).parentValue, 'city', (this as any).ruleForm.city);
+				(this as any).$set((this as any).parentValue, 'cityCode', (this as any).ruleForm.cityCode);
+				(this as any).$set((this as any).parentValue, 'region', (this as any).ruleForm.region);
+				(this as any).$set((this as any).parentValue, 'regionCode', (this as any).ruleForm.regionCode);
+				(this as any).$set((this as any).parentValue, 'street', (this as any).ruleForm.street);
+				(this as any).$set((this as any).parentValue, 'streetCode', (this as any).ruleForm.streetCode);
+				(this as any).$refs.byArea.setValue((this as any).parentValue);
+			}else{
+				(this as any).clearValue();
+			}
+		}
+		//获取数据
+		getValue(){
+			var data: any = {};
+			data = (this as any).ruleForm;
+			data.province = (this as any).parentValue.province;
+			data.provinceCode = (this as any).parentValue.provinceCode;
+			data.city = (this as any).parentValue.city;
+			data.cityCode = (this as any).parentValue.cityCode;
+			data.region = (this as any).parentValue.region;
+			data.regionCode = (this as any).parentValue.regionCode;
+			data.street = (this as any).parentValue.street;
+			data.streetCode = (this as any).parentValue.streetCode;
+			return data;
+		}
+		toCargoOwner(){
+			this.$emit('toCargoOwner')
+		}
+		selectThirdPartner(e: any){
+			(this as any).thirdStorehouseList = [];
+			for (var i = 0; i < (this as any).thirdPartnerList.length; i++) {
+				if((this as any).thirdPartnerList[i].id == e){
+					(this as any).ruleForm.thirdPartnerName = (this as any).thirdPartnerList[i].wmsMemberName;
+					(this as any).ruleForm.thirdStorehouseName = (this as any).thirdPartnerList[i].wmsWarehouseIdList;
+					(this as any).thirdStorehouseList.push((this as any).thirdPartnerList[i].wmsWarehouseIdList);
+				}
+			}
+		}
+		selectChange(e: any){
+			// console.log(e)
+		}
+		byAreaOnChange(v:any){
+			// console.log(v);
+			(this as any).parentValue = v
+			if(v.provinceCode){
+				(this as any).byAreaSlot = false;
+			}else{
+				(this as any).byAreaSlot = true;
+			}
+		}
+		clearValue(){
+			(this as any).ruleForm = {
+				name: null, //名称
+				financeType: '金蝶', //金蝶财务系统名称
+				financeStorehouseName: null, //金蝶仓库名称
+				financeStorehouseNo: null, //金蝶仓库编号
+				isThird: 0, //是否绑定第三方仓库
+				thirdSysName: 'GEEKPLUS', //第三方系统名称
+				thirdPartnerId: null, //货主ID
+				thirdPartnerName: null, //货主名称
+				thirdStorehouseName: null, //云仓仓库名称
+				address: null, //详细地址
+				province: null, //仓库所在省
+				provinceCode: null, //省份编号
+				city: null, //仓库所在市
+				cityCode: null, //市编号
+				region: null, //仓库所在区
+				regionCode: null, //区县编号
+				street: null, //仓库所在街道
+				streetCode: null, //街道编码
+			};
+			(this as any).parentValue = {
+				province: null,
+				provinceCode: null,
+				city: null,
+				cityCode: null,
+				region: null,
+				regionCode: null,
+				street: null,
+				streetCode: null,
+			};
+			(this as any).byAreaSlot = false;
+			(this as any).$nextTick(()=>{
+				(this as any).$refs.byArea.clearValue();
+			})
+		}
+	}
+</script>
+
+<style>
+	.laErrors .el-form-item__label::before{
+		content: "*";
+		color: #ff4949;
+		margin-right: 4px;
+	}
+	.errors .el-input__inner{
+		border-color: #ff4949;
+	}
+	.zerrors {
+	    color: #ff4949;
+	    font-size: 12px;
+	    line-height: 1;
+	    padding-top: 4px;
+	    position: absolute;
+	    top: 100%;
+	    left: 0;
+	}
+</style>

+ 88 - 56
src/views/audit/depots/index.vue

@@ -6,7 +6,8 @@
 			</module-view>
 			<!-- 注册/编辑弹窗 -->
 			<el-dialog :title="popTitle+'仓库'" :visible.sync="dialogFormVisible" width="960px" height="450px">
-				<by-form :propConfig="addConfig" ref="addFormId"></by-form>
+				<!-- <by-form :propConfig="addConfig" ref="addFormId"></by-form> -->
+				<ruleForm ref='addFormId' @toCargoOwner="toCargoOwner"></ruleForm>
 				<div slot="footer" class="dialog-footer">
 					<el-button @click="dialogFormVisible = false">取 消</el-button>
 					<el-button type="primary" @click="confirm">确 定</el-button>
@@ -39,7 +40,9 @@
 <script lang="ts">
 	import { Component, Prop, Vue, Watch } from "vue-property-decorator";
 	import api from "@/api/currency";
-	@Component
+	import ruleForm from "./components/ruleForm.vue";
+	import Assembly from "@/components/Assembly/yesno.vue";
+	@Component({ components: { ruleForm } })
 	export default class Depots extends Vue {
 		isShow : any = 'ckb'
 		timeNum = 0;
@@ -117,19 +120,40 @@
 				},
 				{
 					width: 120,
-					title: '第三方仓库名称',
+					title: '金蝶仓库名称',
 					field: 'financeStorehouseName',
 				},
 				{
 					width: 120,
-					title: '第三方系统名称',
-					field: 'financeType',
+					title: '金蝶仓库编号',
+					field: 'financeStorehouseNo',
 				},
+				// {
+				// 	width: 120,
+				// 	title: '金蝶财务系统名称',
+				// 	field: 'financeType',
+				// },
 				{
 					width: 120,
-					title: '第三方仓库编码',
-					field: 'financeStorehouseNo',
+					title: '绑定第三方系统',
+					field: 'isThird',
+					component: Assembly,
+				},
+				{
+					width: 120,
+					title: '第三方系统',
+					field: 'thirdSysName',
 				},
+				{
+					width: 120,
+					title: '第三方货主',
+					field: 'thirdPartnerName',
+				},
+				{
+					width: 120,
+					title: '第三方货仓库',
+					field: 'thirdStorehouseName',
+				},			
 				{
 					width: 120,
 					title: '省',
@@ -454,57 +478,65 @@
 				this.getDataList()
 			}, 500)
 		}
+		
+		// 跳转货主管理
+		toCargoOwner(){
+			this.dialogFormVisible = false;
+			(this as any).$router.push('/oms/cargoOwner')
+		}
 		// 仓库确认注册/编辑
 		confirm() {
-			(this as any).$refs.addFormId.validate().then(() => {
-				let query = (this as any).$refs.addFormId.getValue();
-				console.log(query);
-				this.dialogFormVisible = false;
-				if (this.popTitle === '注册') {
-					let loading = this.$loading({ target: '.main-container' });
-					api.saveList(query, 'maindataStorehouse').then((res : any) => {
-						loading.close();
-						if (res.code === 200) {
-							this.$message.success(this.popTitle + '成功');
-							this.getDataList();
-							this.$confirm('是否注册仓位', '提示', {
-								confirmButtonText: '确定',
-								cancelButtonText: '取消',
-							}).then(() => {
-								api.single({ id: res.data }, 'maindataStorehouse').then((data : any) => {
-									this.changeTab(data.data);
-									this.onAdd2();
-								})
-							}).catch(() => {
-								let data = {
-									storehouseId: res.data,
-									idDelete: 0,
-									maxStockNumber: "100000",
-									maxStockVolume: "100000",
-									name: "默认仓位",
-									organizationId: 1,
-									organizationName: "供应商A",
-									stockVolume: "100000",
-								};
-								api.saveList(data, 'maindataStoringLocation').then((res : any) => {
-									if (res.code === 200) {
-										this.$alert('此仓库将新增一个默认仓位');
-									} else this.$message.error(res.msg)
-								})
-							});
-						} else this.$message.error(res.msg)
-					}).catch(() => loading.close());
-				} else if (this.popTitle === '编辑') {
-					let loading = this.$loading({ target: '.main-container' });
-					api.updateList(query, 'maindataStorehouse').then((res : any) => {
-						loading.close();
-						if (res.code === 200) {
-							this.$message.success(this.popTitle + '成功');
-							this.getDataList();
-						} else this.$message.error(res.msg)
-					}).catch(() => loading.close());
-				}
-			})
+			if(this.$refs.addFormId){
+				(this.$refs.addFormId as any).validate().then(()=>{
+					let query = (this as any).$refs.addFormId.getValue();
+					// console.log(query);
+					this.dialogFormVisible = false;
+					if (this.popTitle === '注册') {
+						let loading = this.$loading({ target: '.main-container' });
+						api.saveList(query, 'maindataStorehouse').then((res : any) => {
+							loading.close();
+							if (res.code === 200) {
+								this.$message.success(this.popTitle + '成功');
+								this.getDataList();
+								this.$confirm('是否注册仓位', '提示', {
+									confirmButtonText: '确定',
+									cancelButtonText: '取消',
+								}).then(() => {
+									api.single({ id: res.data }, 'maindataStorehouse').then((data : any) => {
+										this.changeTab(data.data);
+										this.onAdd2();
+									})
+								}).catch(() => {
+									let data = {
+										storehouseId: res.data,
+										idDelete: 0,
+										maxStockNumber: "100000",
+										maxStockVolume: "100000",
+										name: "默认仓位",
+										organizationId: 1,
+										organizationName: "供应商A",
+										stockVolume: "100000",
+									};
+									api.saveList(data, 'maindataStoringLocation').then((res : any) => {
+										if (res.code === 200) {
+											this.$alert('此仓库将新增一个默认仓位');
+										} else this.$message.error(res.msg)
+									})
+								});
+							} else this.$message.error(res.msg)
+						}).catch(() => loading.close());
+					} else if (this.popTitle === '编辑') {
+						let loading = this.$loading({ target: '.main-container' });
+						api.updateList(query, 'maindataStorehouse').then((res : any) => {
+							loading.close();
+							if (res.code === 200) {
+								this.$message.success(this.popTitle + '成功');
+								this.getDataList();
+							} else this.$message.error(res.msg)
+						}).catch(() => loading.close());
+					}
+				})
+			}
 		}
 		// 仓位确认注册/编辑
 		confirm2() {