Commit 8e35ce4f authored by Mac's avatar Mac

1

parent c3a19d58
This diff is collapsed.
......@@ -78,13 +78,69 @@
<el-input v-model="scope.row.InStockNum" type="number" :min='0'
:max="scope.row.Number -(scope.row.StockInNum!=null?scope.row.StockInNum:0)"
:disabled="(scope.row.Number -(scope.row.StockInNum!=null?scope.row.StockInNum:0))==0? true:false"
@input='validation(scope.row.Number -(scope.row.StockInNum!=null?scope.row.StockInNum:0),scope.row,$event)'
@input='validation(scope.row.Number -(scope.row.StockInNum!=null?scope.row.StockInNum:0),scope.row,$event,scope.$index)'
placeholder="请输入"></el-input>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 10px">
入库商品 <span style="color: #666666">(如果入库数量改变下列的有效日期会全清空)</span>
</div>
<div v-for="(x,y) in Warehousinglist" :key="y">
<div style="display: flex;align-items: flex-start;justify-content: space-between;margin-top: 15px;" >
<div style="width: 50%;">{{x.name}}</div>
<div style="display: flex;align-items: flex-start;">
<el-date-picker
v-model="x.time"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
<el-button @click="setupTime(y)" type="primary" size="small" style="margin-left: 15px" >设置日期</el-button>
</div>
</div>
<el-table :data="x.list" border style="width: 100%;margin-Top:20px" @selection-change="handleSelectionChange($event,y)">
<el-table-column
type="selection"
width="55">
</el-table-column>
<el-table-column label="序号" width="60">
<template slot-scope="scope">
{{y+1}}-{{scope.$index+1}}
</template>
</el-table-column>
<el-table-column prop="ImageList" label="封面图" width="80" align='center'>
<template slot-scope="scope">
<img :src="scope.row.MaterialModel.ImageList[0]" alt="" style="width: 50px; height: 50px;">
</template>
</el-table-column>
<el-table-column prop="Name" label="商品名称" >
<template slot-scope="scope">
<span>{{scope.row.MaterialModel.Name}}</span>
</template>
</el-table-column>
<el-table-column prop="GoodsSpecificationList" label="规格" >
<template slot-scope="scope">
<span v-for="(x,y) in scope.row.MaterialModel.GoodsSpecificationList" :key="y">{{x}} <span v-if="scope.row.MaterialModel.GoodsSpecificationList.length !== y+1"> , </span></span>
</template>
</el-table-column>
<el-table-column prop="" label="有效时间" width="200">
<template slot-scope="scope">
<el-date-picker
v-model="scope.row.time"
type="date"
value-format="yyyy-MM-dd"
placeholder="选择日期">
</el-date-picker>
</template>
</el-table-column>
</el-table>
</div>
</div>
<el-button size="small" type="primary" @click="submitForm()" :disabled = 'ISoperation' :loading="rukuloading">入库</el-button
>
</div>
......@@ -97,6 +153,7 @@ export default {
WareHouseId:0,
ISoperation:false,
rukuloading:false,
Warehousinglist:[],
};
},
created() {},
......@@ -107,8 +164,16 @@ export default {
this.assetsApipost("/api/property/GetProcurementInfo", {ProcurementId:data.ID}, res => {
if (res.data.resultCode == 1) {
let data = res.data.data
data.DetailList.forEach(x => {
x.InStockNum = 0
data.DetailList.forEach((x,y) => {
x.InStockNum = 0;
let obj = {
Id:y+1,
name:x.MaterialModel.Name,
list:[],
time:'',
multipleSelection:[]
}
this.Warehousinglist.push(obj)
});
this.Detaildata = data
} else {
......@@ -141,8 +206,32 @@ export default {
};
msg.Id = this.Detaildata.Id;
msg.WareHouseId = this.Detaildata.WareHouseId;
let showtis = false
this.Detaildata.DetailList.forEach(x=>{
let showtime=false;
let zonglist = [];
this.Warehousinglist.map((x,xi)=>{
if(x.list.length>0){
let list = [];
x.list.map((j,ji)=>{
if(j.time==''){
showtime= true
}else{
let obj ={ExpirationDate:j.time}
list.push(obj)
}
})
let objlist ={ValidityList:list}
zonglist.push(objlist)
if(showtime==true){
this.Error(x.name+'的有效日期没选择,请选择');
return
}
}
})
if(showtime==true){
return
}
let showtis = false;
this.Detaildata.DetailList.forEach((x,y)=>{
if(x.InStockNum.length== 0){
showtis=true
}
......@@ -150,14 +239,16 @@ export default {
obj.GoodsId = x.MaterialModel.GoodsId;
obj.SpecificationKey = x.MaterialModel.SpecificationKey;
obj.InStockNum = x.InStockNum;
//2021-4-1加的日期列表
obj.ValidityList = zonglist[y].ValidityList
msg.DetailList.push(obj)
})
if(showtis == true){
this.Error('请输入入库数量');
return
}
this.rukuloading=true
this.assetsApipost("/api/property/SetProcurementStockIn", msg, res => {
this.rukuloading=true
this.assetsApipost("/api/property/SetProcurementStockIn", msg, res => {
this.rukuloading=false
if (res.data.resultCode == 1) {
this.Success(res.data.message);
......@@ -169,7 +260,7 @@ export default {
})
},
validation(v,row,value){
validation(v,row,value,index){
let that = this
if(value>v){
......@@ -179,7 +270,48 @@ export default {
x.InStockNum=0
}
})
}else{
this.Warehousinglist[index].list=[]
for(let i= 0;i<value;i++){
let obj ={
CostMoney:row.CostMoney,
Id:row.Id,
InStockNum:row.InStockNum,
MaterialId:row.MaterialId,
MaterialModel:row.MaterialModel,
Number:row.Number,
StockInNum:row.StockInNum,
time:'',
xuhao:i+1,
}
this.Warehousinglist[index].list.push(obj)
}
}
},
handleSelectionChange(val,y){
this.Warehousinglist[y].multipleSelection= val
},
setupTime(y){//全体设置
if(this.Warehousinglist[y].multipleSelection.length==0){
this.Error('请选择要设置的对象');
return
}
if(this.Warehousinglist[y].time==''){
this.Error('请选择有效日期');
return
}
this.Warehousinglist[y].multipleSelection.map(x=>{
this.Warehousinglist[y].list.map((j,yi)=>{
if(x.xuhao==j.xuhao){
this.Warehousinglist[y].list[yi].time= this.Warehousinglist[y].time;
return
}
})
})
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment