qq_41295110
2025-12-04 05fb7af4f0316fdae54f52076509e582ca5e1e4c
src/views/system/user/Xt_UserGroupEdit.vue
@@ -6,7 +6,7 @@
      <!-- <el-button @click="cancel">取 消</el-button> -->
    </div>
    <div style="margin: 10px; font-size: 28px; font-weight: bold; text-align: center;">新增/编辑用户信息</div>
    <el-form ref="form" :model="form" :rules="rules" label-width="128px">
    <el-form ref="form" :model="form"  label-width="128px">
      <el-tabs v-model="activeName" type="card">
        <el-tab-pane label="基本信息" name="first">
          <el-row>
@@ -74,7 +74,7 @@
  components: {},
  props: {
    OperationType: { type: Number, },
    linterid: {},
    linterid: {type: Number},
  },
  data() {
    return {
@@ -97,20 +97,25 @@
    };
  },
  created() {
    this.getdata()
  },
  methods: {
    //#region 页面初始化
    getdata() {
      this.formShow = false
      this.formLoading = true
      this.getUserGroup()
      if ((this.OperationType == 1 && this.copyType != 1) || (!this.OperationType && !this.copyType)) {
        this.handleAdd()
      } else if (this.OperationType == 3 || this.copyType == 1) {
        this.$nextTick(() => {
          this.handleUpdate()
        })
      try {
        this.formShow = false
        this.formLoading = true
        this.getUserGroup()
        if ((this.OperationType == 1 && this.copyType != 1) || (!this.OperationType && !this.copyType)) {
          this.handleAdd()
        } else if (this.OperationType == 3 || this.copyType == 1) {
          this.$nextTick(() => {
            this.handleUpdate()
          })
        }
      } catch (err) {
        console.error('Error ', err)
      }
    },
@@ -179,12 +184,20 @@
    handleUpdate() {
      this.reset()
      let rowHmainid = this.linterid
      axios.get(this.baseURL + "/Xt_User/EditUser", {
        params: { 'HID': rowHmainid }
      let sWhere = " and HGroupID=" + rowHmainid ;
      console.log("编辑用户ID",rowHmainid)
      ///Xt_User/EditUser
      axios.get(this.baseURL + "Xt_UserGroup/list", {
        params: { 'sWhere': sWhere }
      }).then(response => {
        if (response.data.code == 1) {
          var result = response.data
          var data = result.data.h_v_IF_UserList_Edit[0]
          // var data = result.data.h_v_IF_UserList_Edit[0]
          var data = result.data[0]
          console.log("编辑用户信息",data)
          this.form.HLev = data.级别
          this.form.HGroupName = data.角色
          this.form.HUSEORGID = sessionStorage["Organization"]
          this.form.Czybm = data.用户编码
          this.form.Czymc = data.用户名称
          this.form.Czmm = data.密码
@@ -216,7 +229,7 @@
          this.form.HCusID = data.HCusID
          this.form.HCusName = data.客户
          this.form.HGroupID = data.HGroupID
          this.form.HGroupName = data.班组
          // this.form.HGroupName = data.班组
          this.form.HSourceID = data.HSourceID
          this.form.HSourceName = data.生产资源
          this.form.HCheckEmpID = data.HCheckEmpID
@@ -238,16 +251,22 @@
    //#endregion
    
    //#region 获取子表数据
    getUserGroup() {
    async getUserGroup() {
      //角色列表
      axios.get(this.baseURL + '/Xt_UserGroup/list', {
      axios.get(this.baseURL + '/Xt_User/list', {
        params: {
          sWhere: '',
          user: sessionStorage["HUserName"],
        },
      }).then(response => {
        let data1 = response.data
        if (data1.code == 1) {
          console.log(data1)
          this.editData = data1.data
          this.form.Czybm = data1.data.用户编码
          console.log("zhiwei",this.editData)
          console.log("用户",this.form.Czybm)
          //this.get_DisplayUserGroupInfoList()
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
@@ -256,14 +275,15 @@
    //#endregion
    
    get_DisplayUserGroupInfoList() {
      var sWhere = "and UserId='" + this.linterid + "'";
    async get_DisplayUserGroupInfoList() {
      var sWhere = "and GroupId='" + this.linterid + "'";
      axios.get(this.baseURL + '/Xt_UserGroup/UserGroupInfoList', {
        params: {
          sWhere: sWhere,
        },
      }).then(response => {
        let data1 = response.data
        console.log(data1)
        if (data1.count == 1) {
          if (data1.data.length > 0)
            if (this.editData.length > 0) {