|
|
|
@ -1,32 +1,39 @@
|
|
|
|
|
<template> |
|
|
|
|
<div> |
|
|
|
|
<el-steps :active="active" finish-status="success"> |
|
|
|
|
<el-step title="步骤 1"></el-step> |
|
|
|
|
<el-step title="步骤 2"></el-step> |
|
|
|
|
</el-steps> |
|
|
|
|
|
|
|
|
|
<el-form ref="addSupplier" :inline="true" :model="addSupplier" :rules="rules" class="demo-form-inline" label-width="100px" title="供应商基本信息" v-if="active==0"> |
|
|
|
|
<el-form ref="addSupply" :inline="true" :model="addSupply" :rules="rules" class="demo-form-inline" label-width="100px" title="货物基本信息"> |
|
|
|
|
<el-row style="padding-right:100px;" > |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商编码" prop="supplierNum" > |
|
|
|
|
<el-input v-model="addSupplier.supplierNum" disabled ></el-input> |
|
|
|
|
<el-form-item label="货物编码" prop="goodsNum" > |
|
|
|
|
<el-input v-model="addSupply.goodsNum" disabled ></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
|
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商名称" prop="supplierName"> |
|
|
|
|
<el-input v-model="addSupplier.supplierName" ></el-input> |
|
|
|
|
<el-form-item label="货物名称" prop="goodsName"> |
|
|
|
|
<el-input v-model="addSupply.goodsName" ></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商" prop="supplierName"> |
|
|
|
|
<el-select v-model="addSupply.supplierName" > |
|
|
|
|
<el-option v-for="item in supplierNames" :key="item.supplierName" :value="item.supplierName"></el-option> |
|
|
|
|
{{item}} |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
|
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商品牌" prop="supplierBrands"> |
|
|
|
|
<el-select v-model="addSupplier.supplierBrands" > |
|
|
|
|
<el-option v-for="item in addbrandslist" :key="item.brands" :value="item.brands"></el-option> |
|
|
|
|
<el-form-item label="类型" prop="goodsType"> |
|
|
|
|
<el-select v-model="addSupply.goodsType" > |
|
|
|
|
<el-option v-for="item in addtypelist" :key="item.type" :value="item.type"></el-option> |
|
|
|
|
{{item}} |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
@ -35,212 +42,140 @@
|
|
|
|
|
|
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商联系人" prop="supplierContact"> |
|
|
|
|
<el-input v-model="addSupplier.supplierContact" ></el-input> |
|
|
|
|
<el-form-item label="规格" prop="goodsSize"> |
|
|
|
|
<el-input v-model="addSupply.goodsSize" ></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
|
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="联系电话" prop="supplierNumber"> |
|
|
|
|
<el-input v-model="addSupplier.supplierNumber"></el-input> |
|
|
|
|
<el-form-item label="价格" prop="goodsPrice"> |
|
|
|
|
<el-input v-model="addSupply.goodsPrice"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-form ref="addSupplier2" :inline="true" :model="addSupplier2" :rules="rules2" class="demo-form-inline" label-width="100px" title="供应商基本信息" v-if="active==1"> |
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商收件人" prop="supplierReceiver"> |
|
|
|
|
<el-input v-model="addSupplier2.supplierReceiver"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商邮箱号" prop="supplierEmail"> |
|
|
|
|
<el-input v-model="addSupplier2.supplierEmail"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商起始日" prop="supplierStartDate"> |
|
|
|
|
<el-date-picker v-model="addSupplier2.supplierStartDate" type="date" placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="备注" prop="goodsEffect"> |
|
|
|
|
<el-input v-model="addSupply.goodsEffect"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
|
|
|
|
|
<el-row style="padding-right:100px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商终止日" prop="supplierTerminationDate"> |
|
|
|
|
<el-date-picker v-model="addSupplier2.supplierTerminationDate" type="date" placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd"></el-date-picker> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<el-row style="padding-left:85px;"> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="供应商地址" prop="supplierAddress"> |
|
|
|
|
<el-input v-model="addSupplier2.supplierAddress" style="width:400px"></el-input> |
|
|
|
|
</el-form-item> |
|
|
|
|
<el-col span="24"> |
|
|
|
|
<el-form-item label="状态" prop="goodsState"> |
|
|
|
|
<el-select v-model="addSupply.goodsState" > |
|
|
|
|
<el-option label="是" value='1'></el-option> |
|
|
|
|
<el-option label="否" value='0'></el-option> |
|
|
|
|
</el-select> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
|
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-button style="margin-top: 12px;" @click="next" v-if="active==0">下一步</el-button> |
|
|
|
|
<el-button style="margin-top: 12px;" @click="back" v-if="active==1">上一步</el-button> |
|
|
|
|
<el-button style="margin-top: 12px;" @click="sure" v-if="active==1">添加</el-button> |
|
|
|
|
<el-button style="margin-top: 12px;" @click="keep" v-if="active==2">返回</el-button> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<el-row style="padding-left:250px"> |
|
|
|
|
<el-col span="2"> |
|
|
|
|
<el-form-item> |
|
|
|
|
<el-button type="primary" @click="sure">添加</el-button> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
</el-form> |
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import {onAddSupplier} from'@/api/supplier.js' |
|
|
|
|
import {onbrandslist} from '@/api/prouduct.js' |
|
|
|
|
import {onAddSupply} from'@/api/supplier.js' |
|
|
|
|
import {ontypelist}from '@/api/prouduct.js' |
|
|
|
|
import {SupplierNum} from '@/api/supplier.js' |
|
|
|
|
import {goodsNum,supplierNames} from '@/api/supplier.js' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default { |
|
|
|
|
data(){ |
|
|
|
|
const sureBrands=(rules,value,callback)=>{ |
|
|
|
|
const supplierName=(rules,value,callback)=>{ |
|
|
|
|
if(!value){ |
|
|
|
|
return callback(new Error('请选择品牌')) |
|
|
|
|
return callback(new Error('请选择供应商')) |
|
|
|
|
}else{ |
|
|
|
|
callback(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
const sureNumber=(rules,value,callback)=>{ |
|
|
|
|
var checkNumber=/^(13[0-9]|14[5|7]|15[0|1|2|3|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\d{8}$/ |
|
|
|
|
const goodsState=(rules2,value,callback)=>{ |
|
|
|
|
if(!value){ |
|
|
|
|
return callback(new Error('联系电话不能为空')) |
|
|
|
|
}else if(checkNumber.test(value)){ |
|
|
|
|
return callback() |
|
|
|
|
return callback(new Error('请选择有无货物')) |
|
|
|
|
}else{ |
|
|
|
|
callback(new Error('手机号格式不正确')); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
const sureEmail=(rules2,value,callback)=>{ |
|
|
|
|
var checkEmail=/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/ |
|
|
|
|
if(!value){ |
|
|
|
|
return callback(new Error('邮箱不能为空')) |
|
|
|
|
}else if(checkEmail.test(value)){ |
|
|
|
|
return callback(); |
|
|
|
|
}else{ |
|
|
|
|
callback(new Error('邮箱格式不正确')); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
const sureDate=(rules2,value,callback)=>{ |
|
|
|
|
const goodsType=(rules2,value,callback)=>{ |
|
|
|
|
if(!value){ |
|
|
|
|
return callback(new Error('日期不能为空')) |
|
|
|
|
return callback(new Error('请选择品牌')) |
|
|
|
|
}else{ |
|
|
|
|
return callback(); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
return{ |
|
|
|
|
active:0, |
|
|
|
|
addSupplier:{ |
|
|
|
|
}, |
|
|
|
|
addSupplier2:{ |
|
|
|
|
|
|
|
|
|
addSupply:{ |
|
|
|
|
goodsNum:0, |
|
|
|
|
goodsName:'', |
|
|
|
|
supplierName:'', |
|
|
|
|
goodsType:'', |
|
|
|
|
goodsSize:'', |
|
|
|
|
goodsPrice:'', |
|
|
|
|
goodsEffect:'', |
|
|
|
|
goodsState:'' |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
addbrandslist:[], |
|
|
|
|
addchannellist:[], |
|
|
|
|
addtypelist:[], |
|
|
|
|
supplierNames:[], |
|
|
|
|
rules:{ |
|
|
|
|
supplierName:[ |
|
|
|
|
{required:true,message:'产品名称不能为空',trigger:'blur'}, |
|
|
|
|
goodsName:[ |
|
|
|
|
{required:true,message:'货物名称不能为空',trigger:'blur'}, |
|
|
|
|
{ min: 3, max: 30, message: '长度在 3 到 30 个字符', trigger: 'blur' } |
|
|
|
|
], |
|
|
|
|
supplierBrands:[ |
|
|
|
|
{required:true,validator:sureBrands,trigger:'change'} |
|
|
|
|
goodsPrice:[ |
|
|
|
|
{required:true,message:'价格不能为空',trigger:'change'} |
|
|
|
|
], |
|
|
|
|
supplierContact:[ |
|
|
|
|
{ required: true,message:'联系人不能为空', trigger: "change"} |
|
|
|
|
goodsSize:[ |
|
|
|
|
{ required: true,message:'规格不能为空', trigger: "change"} |
|
|
|
|
], |
|
|
|
|
supplierNumber:[ |
|
|
|
|
{required:true,validator:sureNumber, trigger:'blur'} |
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
rules2:{ |
|
|
|
|
supplierReceiver:[ |
|
|
|
|
{required:true,message:'收件人不能为空', trigger:'blur'} |
|
|
|
|
], |
|
|
|
|
supplierEmail:[ |
|
|
|
|
{required:true,validator:sureEmail, trigger:'blur'} |
|
|
|
|
], |
|
|
|
|
supplierStartDate:[ |
|
|
|
|
{required:true,validator:sureDate, trigger:'blur'} |
|
|
|
|
supplierName:[ |
|
|
|
|
{required:true,validator:supplierName, trigger:'blur'} |
|
|
|
|
], |
|
|
|
|
supplierTerminationDate:[ |
|
|
|
|
{required:true,validator:sureDate, trigger:'blur'} |
|
|
|
|
goodsType:[ |
|
|
|
|
{required:true,validator:goodsType, trigger:'blur'} |
|
|
|
|
], |
|
|
|
|
supplierAddress:[ |
|
|
|
|
{required:true,message:'供应商地址不能为空',trigger:'blur'} |
|
|
|
|
] |
|
|
|
|
} |
|
|
|
|
goodsEffect:[ |
|
|
|
|
{required:true,message:'货物效果不能为空',trigger:'blur'} |
|
|
|
|
], |
|
|
|
|
goodsState:[ |
|
|
|
|
{required:true,validator:goodsState,trigger:'blur'} |
|
|
|
|
] |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
methods:{ |
|
|
|
|
next() { |
|
|
|
|
this.$refs.addSupplier.validate((valid)=>{ |
|
|
|
|
if(valid){ |
|
|
|
|
if (this.active++ > 2) this.active = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
back(){ |
|
|
|
|
if (this.active-- > 2) this.active = 0; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
keep(){ |
|
|
|
|
location.reload(true) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sure(){ |
|
|
|
|
let Supplier={} |
|
|
|
|
Supplier.supplierNum=this.addSupplier.supplierNum |
|
|
|
|
Supplier.supplierName=this.addSupplier.supplierName |
|
|
|
|
Supplier.supplierBrands=this.addSupplier.supplierBrands |
|
|
|
|
Supplier.supplierContact=this.addSupplier.supplierContact |
|
|
|
|
Supplier.supplierNumber=this.addSupplier.supplierNumber |
|
|
|
|
Supplier.supplierReceiver=this.addSupplier2.supplierReceiver |
|
|
|
|
Supplier.supplierEmail=this.addSupplier2.supplierEmail |
|
|
|
|
Supplier.supplierStartDate=this.addSupplier2.supplierStartDate |
|
|
|
|
Supplier.supplierTerminationDate=this.addSupplier2.supplierTerminationDate |
|
|
|
|
Supplier.supplierAddress=this.addSupplier2.supplierAddress |
|
|
|
|
this.$refs.addSupplier2.validate((valid)=>{ |
|
|
|
|
this.$refs.addSupply.validate((valid)=>{ |
|
|
|
|
if(valid){ |
|
|
|
|
onAddSupplier(Supplier).then((response)=>{ |
|
|
|
|
onAddSupply(this.addSupply).then((response)=>{ |
|
|
|
|
if(response.code !==200)return this.$message.error("添加失败") |
|
|
|
|
this.$message.success("添加成功") |
|
|
|
|
this.active=2; |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
this.$refs.addSupply.resetFields(); |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//下拉框brandslist |
|
|
|
|
onbrandslist(){ |
|
|
|
|
onbrandslist().then((response)=>{ |
|
|
|
|
// console.log(response) |
|
|
|
|
this.addbrandslist=response.data |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//下拉框typelist |
|
|
|
@ -250,13 +185,22 @@ export default {
|
|
|
|
|
this.addtypelist=response.data |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
//下拉框supplierNames |
|
|
|
|
|
|
|
|
|
onsupplierNames(){ |
|
|
|
|
supplierNames().then((response=>{ |
|
|
|
|
console.log(response) |
|
|
|
|
this.supplierNames=response.data |
|
|
|
|
})) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//拿到添加供应商编码 |
|
|
|
|
SupplierNum(){ |
|
|
|
|
SupplierNum().then((response)=>{ |
|
|
|
|
console.log(response) |
|
|
|
|
this.addSupplier.supplierNum=response.data |
|
|
|
|
goodsNum(){ |
|
|
|
|
goodsNum().then((response)=>{ |
|
|
|
|
//console.log(response) |
|
|
|
|
this.addSupply.goodsNum=response.data |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -272,9 +216,11 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
created() { |
|
|
|
|
this.onbrandslist(); |
|
|
|
|
|
|
|
|
|
this.ontypelist(); |
|
|
|
|
this.SupplierNum(); |
|
|
|
|
this.goodsNum(); |
|
|
|
|
this.onsupplierNames(); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|