wuyouming666
2023-09-19 ccc3df0d565f52a4da17584a7ace4d43960e1ef3
修改 admin 设置电气密码
5个文件已修改
109 ■■■■■ 已修改文件
CanadaMes-ui/src/lang/locales/en-US.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/zh-CN.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Action.vue 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/views/Electrical/Parameter.vue 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springboot-vue3/src/main/java/com/example/springboot/controller/UserController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
CanadaMes-ui/src/lang/locales/en-US.json
@@ -278,6 +278,7 @@
  "No":"No",
  "Please enter the password":"Please enter the password",
  "Password error":"Password error",
  "DataBase Connection failed":"DataBase Connection failed"
  "DataBase Connection failed":"DataBase Connection failed",
  "Distribute parameters":"Distribute parameters"
}
CanadaMes-ui/src/lang/locales/zh-CN.json
@@ -282,6 +282,7 @@
  "Please enter the password":"请输入密码",
  "Password error":"密码错误",
  "DataBase Connection failed":"数据库连接失败"
  "DataBase Connection failed":"数据库连接失败",
  "Distribute parameters":"下发参数"
}
CanadaMes-ui/src/views/Electrical/Action.vue
@@ -17,7 +17,7 @@
      <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
        <el-input v-model="item.name" style="width: 240px;" class="in_mc" readonly></el-input>
        <el-switch v-model="item.value" active-value="1" inactive-value="0" @change="send()"></el-switch>
        <el-switch v-model="item.value" active-value="1" inactive-value="0"  @change="send()"></el-switch>
      </div>
    </el-form>
@@ -35,6 +35,7 @@
  data () {
    return {
      activeButton: '',
      record: {
        params: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
        canshu: [
@@ -109,28 +110,8 @@
  },
  created () {
    this.init();
    SelectPassword().then(res => {
 this.password = res.data.password;
});
    this.$prompt(this.$t('Are you sure to perform this operation?'), this.$t('prompt'), {
    inputType: 'password',
    inputPlaceholder: this.$t('Please enter the password'),
    confirmButtonText: this.$t('Yes'),
    cancelButtonText: this.$t('No'),
    type: 'warning'
  }).then(({ value }) => {
    if (this.password === value) {
      // 密码正确,执行相应操作
    } else {
      this.$message.success(this.$t('Password error')); // 密码错误
    }
  }).catch(() => {
    this.$message({
      type: 'info',
      message: this.$t('Operation canceled')
    });
  });
    this.isClickable = false;
  },
  methods: {
    setActiveButton(buttonName) {
@@ -189,9 +170,36 @@
    },
    send () {
      this.isClickable = true;
      SelectPassword().then(res => {
 this.password = res.data.password;
});
    this.$prompt(this.$t('Are you sure to perform this operation?'), this.$t('prompt'), {
    inputType: 'password',
    inputPlaceholder: this.$t('Please enter the password'),
    confirmButtonText: this.$t('Yes'),
    cancelButtonText: this.$t('No'),
    type: 'warning'
  }).then(({ value }) => {
    if (this.password === value) {
      // 密码正确,执行相应操作
      this.messagepack.data = this.record.xyData.map(item => parseInt(item.value)); // 转换为整数数组
      //console.log(this.messagepack);
      socket?.send(JSON.stringify(this.messagepack));
    } else {
      this.$message.success(this.$t('Password error')); // 密码错误
    }
  }).catch(() => {
    this.$message({
      type: 'info',
      message: this.$t('Operation canceled')
    });
  });
    }
  }
CanadaMes-ui/src/views/Electrical/Parameter.vue
@@ -13,7 +13,7 @@
    <el-form label-width="100px" style="display: flex; flex-wrap: wrap;" :model="messagepack.data">
      <div id="btn_div">
        <el-button type="primary" @click="send()" id="xiafa" :disabled="isButtonDisabled">下发参数</el-button>
        <el-button type="primary" @click="send()" id="xiafa" :disabled="isButtonDisabled">{{ $t('Distribute parameters') }}</el-button>
      </div>
      <div class="kuai_div" v-for="(item, index) in record.xyData" :key="index">
@@ -80,27 +80,7 @@
  created () {
    this.initWebSocket();
    this.isButtonDisabled = true;
    SelectPassword().then(res => {
 this.password = res.data.password;
});
    this.$prompt(this.$t('Are you sure to perform this operation?'), this.$t('prompt'), {
    inputType: 'password',
    inputPlaceholder: this.$t('Please enter the password'),
    confirmButtonText: this.$t('Yes'),
    cancelButtonText: this.$t('No'),
    type: 'warning'
  }).then(({ value }) => {
    if (this.password === value) {
      // 密码正确,执行相应操作
    } else {
      this.$message.success(this.$t('Password error')); // 密码错误
    }
  }).catch(() => {
    this.$message({
      type: 'info',
      message: this.$t('Operation canceled')
    });
  });
   
  },
  methods: {
@@ -181,9 +161,32 @@
      }
    },
    send () {
      SelectPassword().then(res => {
 this.password = res.data.password;
});
    this.$prompt(this.$t('Are you sure to perform this operation?'), this.$t('prompt'), {
    inputType: 'password',
    inputPlaceholder: this.$t('Please enter the password'),
    confirmButtonText: this.$t('Yes'),
    cancelButtonText: this.$t('No'),
    type: 'warning'
  }).then(({ value }) => {
    if (this.password === value) {
      // 密码正确,执行相应操作
      this.messagepack.data = this.record.xyData.map((item) => parseInt(item.value2)); // 转换为整数数组
      //console.log(this.messagepack);
      socket?.send(JSON.stringify(this.messagepack));
    } else {
      this.$message.success(this.$t('Password error')); // 密码错误
    }
  }).catch(() => {
    this.$message({
      type: 'info',
      message: this.$t('Operation canceled')
    });
  });
    },
    handleChange (index, value) {
      this.record.xyData[index].value = value;
springboot-vue3/src/main/java/com/example/springboot/controller/UserController.java
@@ -108,7 +108,7 @@
    @RequiresRoles({"admin"})
    @RequiresPermissions({"user:update", "user:add"})
    public Result saveOrUpdate(@RequestBody User user) {
        if ("admin".equals(user.getUsername())) {
        if ("admin".equals(user.getUsername()) && user.getState() == 0) {
            return Result.fail("管理员不可以被禁用");
        }
        Integer count = userService.lambdaQuery()