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