Commit fadc8bb2 by lixiaomin

修改经验值

parent df3d3d82
...@@ -129,8 +129,11 @@ export default { ...@@ -129,8 +129,11 @@ export default {
experienceSubmit(){ experienceSubmit(){
var regular=/(^[+]{0,1}([0-9]+)$)/; var regular=/(^[+]{0,1}([0-9]+)$)/;
let hang=0; let hang=0;
let list=[];
let milliSecond=0;
let quantity=0
for(let i=0;i<this.experienceList.length;i++){ for(let i=0;i<this.experienceList.length;i++){
// hang=i+1; hang=i+1;
// if(!regular.test(this.experienceList[i].milli_second)){ // if(!regular.test(this.experienceList[i].milli_second)){
// this.$message.error('第'+hang+'行,秒,请输入大于0的正数'); // this.$message.error('第'+hang+'行,秒,请输入大于0的正数');
// return; // return;
...@@ -144,16 +147,32 @@ export default { ...@@ -144,16 +147,32 @@ export default {
// this.experienceList[i].quantity=parseFloat(this.experienceList[i].quantity); // this.experienceList[i].quantity=parseFloat(this.experienceList[i].quantity);
// } // }
if(this.experienceList[i].milli_second){ if(this.experienceList[i].milli_second){
this.experienceList[i].milli_second=parseFloat(this.experienceList[i].milli_second); if(!regular.test(this.experienceList[i].milli_second)){
this.$message.error('第'+hang+'行,秒,请输入正数!');
return;
}
milliSecond=parseFloat(this.experienceList[i].milli_second);
}else{
milliSecond=0;
} }
if(this.experienceList[i].quantity){ if(this.experienceList[i].quantity){
this.experienceList[i].quantity=parseFloat(this.experienceList[i].quantity); if(!regular.test(this.experienceList[i].quantity)){
this.$message.error('第'+hang+'行,克,请输入正数!');
return;
}
quantity=parseFloat(this.experienceList[i].quantity);
}else{
quantity=0;
}
if((milliSecond==0&&quantity!=0)||(quantity==0&&milliSecond!=0)){
return this.$message.error("秒和克属性值只能同时为空或者同时不为空!");
} }
list.push({"milli_second":milliSecond,"quantity":quantity})
} }
let obj={ let obj={
"machine_id": this.machine_id, "machine_id": this.machine_id,
"property_id": this.property_id, "property_id": this.property_id,
"data":this.experienceList "data":list
} }
addProperty(obj).then((response) => { addProperty(obj).then((response) => {
if(response.code==0){ if(response.code==0){
......
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