黎星凯
2024-04-15 62b6a7fac3f2acde70b578431147c4a01f19c182
admin-web/src/views/systemManger/org/edit.vue
@@ -78,7 +78,28 @@
    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)