87 lines
2.4 KiB
Plaintext
87 lines
2.4 KiB
Plaintext
<template>
|
|
<!-- wms到货单物料单价 -->
|
|
<div class="app-container" style="width:100%">
|
|
<el-row>
|
|
<el-col :span="24" style="font-size:16px;margin-bottom: 10px;">
|
|
请将物料单价复制到方框中
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="24">
|
|
<el-input type="textarea" :rows="4" v-model="batchMaterials"></el-input>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row style="margin-top:20px">
|
|
<el-col :span="24">
|
|
<div style="text-align-last: center;">
|
|
<el-button type="primary" @click="submit" v-loading="loading">确 定</el-button>
|
|
<el-button @click="cancel">取 消</el-button>
|
|
</div>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
name: 'arriveBillMaterialsPrice',
|
|
props: {
|
|
layerid: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
detailsNum: {
|
|
type: Number,
|
|
default: 0
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
batchMaterials: "",
|
|
loading: false
|
|
}
|
|
},
|
|
watch: {
|
|
|
|
},
|
|
created() {
|
|
|
|
},
|
|
methods: {
|
|
//获取字符串
|
|
submit(){
|
|
var list = this.batchMaterials.split("\n");
|
|
list=list.map(item=>{return this.g_method.Trim(item)})
|
|
list=list.filter(item=>{return this.g_method.checkData(item)})
|
|
var prices = []
|
|
var isStop = false
|
|
list.forEach(item =>{
|
|
if(item != ""){
|
|
if(!/^-?(([0-9]*(\.[0-9]{1,3})$)|([0-9]+$))/.test(item)){
|
|
this.$message.error("请输入正确的单价")
|
|
isStop = true
|
|
return false;
|
|
}
|
|
prices.push(item)
|
|
}
|
|
})
|
|
if(isStop){
|
|
return;
|
|
}
|
|
//判断条数是否相等,再返回给父组件
|
|
if(this.detailsNum != prices.length){
|
|
this.$message.error("物料种类和单价不匹配")
|
|
}else{
|
|
this.$parent.batchSaveMaterialPriceRet(prices)
|
|
this.cancel()
|
|
}
|
|
},
|
|
//关闭弹窗
|
|
cancel(){
|
|
this.$layer.close(this.layerid)
|
|
}
|
|
|
|
}
|
|
}
|
|
</script>
|