wangyi
2026-01-19 7fb0a8f0ab16c149484bf043754cd10cfa94de2f
src/views/system/user/xtUserListEdit.vue
@@ -35,7 +35,7 @@
            <el-col :span="6">
              <el-form-item label="对应职员" prop="HEmpName">
                <el-input v-model="form.HEmpName" placeholder="请输入对应职员" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4, empType = '1')"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
@@ -84,7 +84,7 @@
            <el-col :span="6">
              <el-form-item label="对应保管" prop="HKeeper">
                <el-input v-model="form.HKeeper" placeholder="请输入对应保管" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4, empType = '2')"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
@@ -93,28 +93,28 @@
            <el-col :span="6">
              <el-form-item label="对应验收" prop="HSecManager">
                <el-input v-model="form.HSecManager" placeholder="请输入对应验收" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4, empType = '3')"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="对应生产资源" prop="HSourceName">
                <el-input v-model="form.HSourceName" placeholder="请输入对应生产资源" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(5)"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="对应业务员" prop="HSellMan">
                <el-input v-model="form.HSellMan" placeholder="请输入对应业务员" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4, empType = '4')"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="对应部门" prop="HDept">
                <el-input v-model="form.HDept" placeholder="请输入对应部门" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(1)"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
@@ -123,21 +123,21 @@
            <el-col :span="6">
              <el-form-item label="检验员" prop="HCheckEmpName">
                <el-input v-model="form.HCheckEmpName" placeholder="请输入检验员" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4, empType = '5')"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="对应仓库" prop="HWHName">
                <el-input v-model="form.HWHName" placeholder="请输入对应仓库" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(2, ckType = '1')"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="调入仓库" prop="HSCWHName">
                <el-input v-model="form.HSCWHName" placeholder="请输入调入仓库" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(2, ckType = '2')"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
@@ -153,7 +153,7 @@
            <el-col :span="6">
              <el-form-item label="对应供应商" prop="HSupName">
                <el-input v-model="form.HSupName" placeholder="请输入对应供应商" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(6)"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
@@ -167,7 +167,7 @@
            <el-col :span="6">
              <el-form-item label="客户" prop="HCusName">
                <el-input v-model="form.HCusName" placeholder="请输入客户" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(7)"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
@@ -198,10 +198,13 @@
    </el-form>
    <!-- 部门弹窗 -->
    <el-dialog :title="dialogTitle" :visible.sync="openData" width="1280px" append-to-body>
      <Dept @deptEmitDb="dbEmitData" @deptEmit="emitData" v-if="deptShow" />
      <Warehouse @deptEmitDb="dbEmitData" @deptEmit="emitData" v-if="warehouseShow" />
      <Material @deptEmitDb="dbEmitData" @deptEmit="emitData" v-if="materialShow" />
      <Dept @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="deptShow" />
      <Warehouse @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="warehouseShow" />
      <Material @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="materialShow" />
      <GyEmployee @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyEmployeeShow" />
      <GySource @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gySourceShow" />
      <GySupplier @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gySupplierShow" />
      <GyCustomer @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyCustomerShow" />
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="deptClickSub">确 定</el-button>
        <el-button @click="deptClose">取 消</el-button>
@@ -215,15 +218,18 @@
<script>
import axios from 'axios'
import Dept from '@/views/component/dept'
import Warehouse from '@/views/component/warehouse'
import Dept from '@/views/basic/gy/gyDepartment.vue'
import Warehouse from '@/views/basic/gyWarehouse/gyWarehouse.vue'
import Material from '@/views/component/material'
import RowSettings from '@/views/component/rowSettings'
import GyEmployee from '@/views/basic/gyEmployee/gyEmployee.vue'
import GySource from '@/views/basic/production/gySource.vue'
import GySupplier from '@/views/basic/gy/gySupplier.vue'
import GyCustomer from '@/views/GyCustomer'
export default {
  name: 'XtUserListEdit',
  components: { Dept, Warehouse, Material, RowSettings, GyEmployee },
  components: { Dept, Warehouse, Material, RowSettings, GyEmployee, GySource, GySupplier, GyCustomer },
  props: {
    OperationType: { type: Number, },
    linterid: {},
@@ -240,7 +246,7 @@
      }
    }
    const equalToHWHName = (rule, value, callback) => {
      if (this.form.HWHName&&this.form.HSCWHName&&(this.form.HWHName == this.form.HSCWHName)) {
      if (this.form.HWHName && this.form.HSCWHName && (this.form.HWHName == this.form.HSCWHName)) {
        callback(new Error("对应仓库和调入仓库不能相同!"))
      } else {
        callback()
@@ -248,6 +254,8 @@
    }
    return {
      HModName: "Xt_UserListEdit",
      empType: '',
      ckType: '',
      formShow: false,
      temp: undefined,
      formLoading: true,
@@ -261,7 +269,10 @@
      deptShow: false,//部门数据组件
      warehouseShow: false,//仓库数据组件
      materialShow: false,//物料数据组件
      gyEmployeeShow: false,//销售员数据组件
      gyEmployeeShow: false,//职员数据组件
      gySourceShow: false,
      gySupplierShow: false,
      gyCustomerShow: false,
      deptform: {},//弹窗选中数据
      openData: false,//数据弹窗
      dialogTitle: '',
@@ -316,15 +327,18 @@
        Czybm: [
          { required: true, message: "编码不能为空!", trigger: "blur" }
        ],
        Czybm: [
          { required: true, message: "编码不能为空!", trigger: "blur" }
        Czymc: [
          { required: true, message: "用户名不能为空!", trigger: "blur" }
        ],
        Czmm: [
          { required: true, message: "用户名不能为空!", trigger: "blur" }
          { required: true, message: "密码不能为空!", trigger: "blur" }
        ],
        Czyyz: [
          { required: true, message: "确认密码不能为空!", trigger: "blur" },
          { required: true, validator: equalToPassword, trigger: "blur" }
        ],
        HDept: [
          { required: true, message: "对应部门不能为空!", trigger: "blur" }
        ],
        HWHName: [
          { validator: equalToHWHName, trigger: "blur" }
@@ -353,7 +367,7 @@
    },
    getUserGroup() {
      //角色列表
      axios.get(this.baseURL + '/Xt_UserGroup/list', {
      axios.get(this.$baseUrl + '/Xt_UserGroup/list', {
        params: {
          sWhere: '',
        },
@@ -369,12 +383,11 @@
    },
    get_DisplayUserGroupInfoList() {
      var sWhere = "and UserId='" + this.linterid + "'";
      axios.get(this.baseURL + '/Xt_UserGroup/UserGroupInfoList', {
      axios.get(this.$baseUrl + '/Xt_UserGroup/UserGroupInfoList', {
        params: {
          sWhere: sWhere,
        },
      }).then(response => {
        console.log(response)
        let data1 = response.data
        if (data1.count == 1) {
          if (data1.data.length > 0)
@@ -387,7 +400,6 @@
            }
        }
      }).catch(error => {
        console.log(error)
        this.$modal.msgError("接口请求失败!");
      });
    },
@@ -401,7 +413,7 @@
    },
    //根据主内码与子内码获取源单销售订单数据
    getPushSourceBillInit(HSourceInterID, HSourceEntryID) {
      axios.get(this.baseURL + '/Xs_SeOrderBill/loadXs_SeOrderBill_Push', {
      axios.get(this.$baseUrl + '/Xs_SeOrderBill/loadXs_SeOrderBill_Push', {
        params: {
          "HInterID": HSourceInterID
          , "HSubID": HSourceEntryID
@@ -435,14 +447,18 @@
      // num=1部门 num=2出库仓库
      if (deptRow.HItemID) {
        if (num == 1) {
          this.form.HDeptName = deptRow.部门名称
          this.form.HDept = deptRow.部门名称
          this.form.HDeptID = deptRow.HItemID
          this.form.HManagerName = deptRow.负责人
          this.deptShow = false
          this.openData = false
        } else if (num == 2) {
          this.editData[this.zbIndex].HWHID = deptRow.HItemID;
          this.editData[this.zbIndex].发货仓库 = deptRow.仓库名称;
          if (this.ckType == '1') {
            this.form.HWHName = deptRow.仓库名称;
            this.form.HWhID = deptRow.HItemID;
          } else if (this.ckType == '2') {
            this.form.HSCWHName = deptRow.仓库名称;
            this.form.HSCWHID = deptRow.HItemID;
          }
          this.warehouseShow = false
          this.openData = false
        } else if (num == 3) {
@@ -457,9 +473,39 @@
          this.materialShow = false
          this.openData = false
        } else if (num == 4) {
          this.form.HEmpName = deptRow.职员名称
          this.form.HEmpID = deptRow.HItemID
          if (this.empType == '1') {
            this.form.HEmpName = deptRow.职员名称
            this.form.HEmpID = deptRow.HItemID
          } else if (this.empType == '2') {
            this.form.HKeeper = deptRow.职员名称
            this.form.HKeeperID = deptRow.HItemID
          } else if (this.empType == '3') {
            this.form.HSecManager = deptRow.职员名称
            this.form.HSecManagerID = deptRow.HItemID
          } else if (this.empType == '4') {
            this.form.HSellMan = deptRow.职员名称
            this.form.HSellManID = deptRow.HItemID
          } else if (this.empType == '5') {
            this.form.HCheckEmpName = deptRow.职员名称
            this.form.HCheckEmpID = deptRow.HItemID
          }
          this.gyEmployeeShow = false
          this.openData = false
        } else if (num == 5) {
          this.form.HSourceName = deptRow.生产资源名称
          this.form.HSourceID = deptRow.HItemID
          this.gySourceShow = false
          this.openData = false
        } else if (num == 6) {
          this.form.HSupName = deptRow.供应商名称
          this.form.HSupID = deptRow.HItemID
          this.gySupplierShow = false
          this.openData = false
        } else if (num == 7) {
          console.log(deptRow)
          this.form.HCusName = deptRow.客户名称
          this.form.HCusID = deptRow.HItemID
          this.gyCustomerShow = false
          this.openData = false
        }
      } else {
@@ -479,7 +525,6 @@
      this.deptform = {}
      this.openData = false
    },
    //销售出库单新增编辑表单初始化
    reset() {
      this.form = {
@@ -534,13 +579,8 @@
    //退出
    close() {
      this.reset()
      if (!this.OperationType && !this.copyType) {
        const obj = { path: "/system/user/xtUserListEdit", name: "xtUserListEdit" };
        this.$tab.closePage(obj);
      } else {
        this.formShow = false
        this.$emit('editClose', false)
      }
      this.formShow = false
      this.$emit('editClose', false)
    },
    /** 新增按钮操作 */
    handleAdd() {
@@ -553,7 +593,7 @@
    handleUpdate() {
      this.reset()
      let rowHmainid = this.linterid
      axios.get(this.baseURL + "/Xt_User/EditUser", {
      axios.get(this.$baseUrl + "/Xt_User/EditUser", {
        params: { 'HID': rowHmainid }
      }).then(response => {
        if (response.data.code == 1) {
@@ -610,7 +650,6 @@
    /** 编辑页子表复选框选中数据 */
    handleTableZbEdit(selection) {
      console.log(selection)
      this.checkedSysZb = selection
      // this.editData.forEach(row => {
      //   row.AuthorityHID = this.checkedSysZb.some(selectedRow => selectedRow.GroupId === row.HGroupID) ? 1 : 0;
@@ -618,51 +657,68 @@
    },
    // 编辑提交保存
    submitForm() {
      this.$refs["form"].validate(valid => {
          console.log(this.form)
        if (valid) {
          var num = [];
          var Sav = ''
          if (this.OperationType == 1) {
            Sav = 'Add'
          } else if (this.OperationType == 3) {
            Sav = "Update"
          }
      if (!this.form.Czybm) {
        this.$modal.msgError("编码不能为空!");
      } else if (!this.form.Czymc) {
        this.$modal.msgError("用户名不能为空!");
      } else if (!this.form.Czmm) {
        this.$modal.msgError("密码不能为空!");
      } else if (!this.form.Czyyz) {
        this.$modal.msgError("确认密码不能为空!");
      } else if (this.form.Czmm != this.form.Czyyz) {
        this.$modal.msgError("密码和确认密码不一样!");
      } else if (!this.form.HDept) {
        this.$modal.msgError("部门不能为空!");
      } else if (this.form.HWHName == this.form.HSCWHName) {
        this.$modal.msgError("对应仓库和调入仓库不能相同!");
      } else {
        this.$refs["form"].validate(valid => {
          if (valid) {
          for (var i = 0; i < this.checkedSysZb.length; i++) {
            num.push(this.checkedSysZb[i].HGroupID)
          }
           console.log(num,Sav)
          var sSubStr = num.toString() == "" ? "-1" : num.toString();
          var sMainStr = JSON.stringify(this.form) + ';' + Sav + ';' + sSubStr;
          axios({
            method: 'post',
            url: this.baseURL + "/Xt_User/SaveUser",
            data: {
              'msg': sMainStr
            },
          }).then(response => {
            if (response.data.count == 1) {
              this.formShow = false
              this.$emit('editClose', false)
              this.$modal.msgSuccess(response.data.Message);
            var num = [];
            var Sav = ''
            if (this.OperationType == 1) {
              Sav = 'Add'
            } else if (this.OperationType == 3) {
              Sav = "Update"
            }
          }).catch(error => {
            this.$modal.msgError("接口请求失败!");
          });
        }
      });
            for (var i = 0; i < this.checkedSysZb.length; i++) {
              num.push(this.checkedSysZb[i].HGroupID)
            }
            var sSubStr = num.toString() == "" ? "-1" : num.toString();
            var sMainStr = JSON.stringify(this.form) + ';' + Sav + ';' + sSubStr;
            axios({
              method: 'post',
              url: this.$baseUrl + "/Xt_User/SaveUser",
              data: {
                'msg': sMainStr
              },
            }).then(response => {
              if (response.data.count == 1) {
                this.formShow = false
                this.$emit('editClose', false)
                this.$modal.msgSuccess(response.data.Message);
              } else {
                this.$modal.msgError(response.data.Message)
              }
            }).catch(error => {
              this.$modal.msgError("接口请求失败!");
            });
          }
        });
      }
    },
    showReset() {
      this.deptShow = false
      this.warehouseShow = false
      this.materialShow = false
      this.gyEmployeeShow = false
      this.gySourceShow = false
      this.gySupplierShow = false
      this.gyCustomerShow = false
    },
    //  打开数据列表弹窗
    openDataDialog(num, row) {
      //num1部门,2出库仓库,3物料,4销售员
      if (row) {
        this.zbIndex = row.index - 1
      }
@@ -680,9 +736,21 @@
        this.materialShow = true
        this.openData = true
      } else if (num == 4) {
        this.dialogTitle = '销售员列表'
        this.dialogTitle = '职员列表'
        this.gyEmployeeShow = true
        this.openData = true
      } else if (num == 5) {
        this.dialogTitle = '生产资源列表'
        this.gySourceShow = true
        this.openData = true
      } else if (num == 6) {
        this.dialogTitle = '供应商列表'
        this.gySupplierShow = true
        this.openData = true
      } else if (num == 7) {
        this.dialogTitle = '客户列表'
        this.gyCustomerShow = true
        this.openData = true
      }
    },
  }