1.提交添加校验

2.添加默认规则按钮
master
x_z 3 years ago
parent 78a3cccc15
commit 4b60617b44

@ -154,6 +154,7 @@
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click.native.stop="cancelDialog" size="small">取消</el-button> <el-button @click.native.stop="cancelDialog" size="small">取消</el-button>
<el-button type="info" @click.native.stop="defaultSetting" size="small">默认</el-button>
<el-button type="primary" size="small" @click.native="submit()" <el-button type="primary" size="small" @click.native="submit()"
>提交 >提交
</el-button </el-button
@ -268,10 +269,38 @@ export default {
customerId: this.$store.getters.customerId customerId: this.$store.getters.customerId
} }
}, },
defaultSetting() {
this.formData.startNum = this.getDateStr() + "001";
this.formData.serialNum = 1;
this.formData.status = 1;
},
getDateStr() {
let date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (month >= 1 && month <= 9) {
month = "0" + month;
}
if (day >= 0 && day <= 9) {
day = "0" + day;
}
let dateStr = year.toString() + month.toString() + day.toString();
return dateStr;
},
// //
submit() { submit() {
if (isBlank(this.formData.name)) { if (isBlank(this.formData.name)) {
this.$message.error("请输入规则信息"); this.$message.error("请输入规则名称");
return;
}
if (isBlank(this.formData.startNum)) {
this.$message.error("请输入起始编号");
return;
}
if (isBlank(this.formData.serialNum)) {
this.$message.error("请输入顺序号码");
return; return;
} }
saveStackRules(this.formName, this.formData).then((res) => { saveStackRules(this.formName, this.formData).then((res) => {
@ -319,7 +348,22 @@ export default {
this.getList(); this.getList();
}, },
}, },
mounted() { watch: {
formData: {
handler(newValue, oldValue) {
this.previewStockNum = "DH";
if (!isBlank(newValue.prefix)) {
this.previewStockNum += newValue.prefix;
}
if (!isBlank(newValue.startNum)) {
this.previewStockNum += newValue.startNum;
}
if (!isBlank(newValue.serialNum)) {
this.previewStockNum += newValue.serialNum;
}
},
deep: true
}
}, },
created() { created() {
this.getList(); this.getList();
@ -327,6 +371,6 @@ export default {
}; };
</script> </script>
<style> <style scoped>
</style> </style>

Loading…
Cancel
Save