| | |
| | | close() { |
| | | this.$emit('close') |
| | | }, |
| | | toNumber(str) { |
| | | const num = parseInt(str); |
| | | return isNaN(num) ? "0" : num; |
| | | }, |
| | | save() { |
| | | // 验证编号是不是0开头 |
| | | let code = this.formData.code; |
| | | let tempCode = this.toNumber(code) |
| | | console.log("拿到的code "+ code) |
| | | console.log("拿到返回的的code "+ tempCode) |
| | | if(this.toNumber(code) === "0"){ |
| | | this.$message.error('编号必须为数字且不以0开头') |
| | | return; |
| | | } |
| | | if(tempCode != code){ |
| | | this.$message.error('编号必须为数字且不以0开头') |
| | | return; |
| | | } |
| | | if(code.startsWith("0")){ |
| | | this.$message.error('编号必须为数字且不以0开头') |
| | | return; |
| | | } |
| | | this.$refs.ruleForm.validate((valid) => { |
| | | if (valid) { |
| | | const params = Object.assign({}, this.formData) |