陈婷婷
2025-11-18 f659780a2f0dfa01476536a42b1838319f9a14de
用户编辑,权限查询页面
2个文件已添加
4个文件已修改
1165 ■■■■■ 已修改文件
src/router/index.js 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/permission.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sell/sellOut/sellOutBillEdit.vue 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/user/xtUserList.vue 64 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/user/xtUserListEdit.vue 695 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/user/xtUserRightQuery.vue 342 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js
@@ -102,7 +102,7 @@
    children: [
      {
        path: "/sell/sellOut/sellOutBill",
        component: () => import("@/views/sell/sellOut/sellOutBill"),
        component: () => import("@/views/sell/sellOut/sellOutBill.vue"),
        name: "SellOutBill",
        meta: { title: "销售出库单", activeMenu: "sell/sellOut" },
      },
@@ -121,7 +121,7 @@
    children: [
      {
        path: "/sell/sellOut/sellOutBillEdit",
        component: () => import("@/views/sell/sellOutBill/edit"),
        component: () => import("@/views/sell/sellOut/sellOutBillEdit.vue"),
        name: "SellOutBillEdit",
        meta: { title: "销售出库单编辑", activeMenu: "sell/sellOut" },
      },
@@ -409,6 +409,25 @@
      },
    ],
  },
  //权限查询
  {
    path: "/system/user/xtUserRightQuery",
    component: Layout,
    hidden: true,
    redirect: "noredirect",
    meta: {
      breadcrumb: false, // 如果设置为false,则不会在breadcrumb面包屑中显示
      activeMenu: "/system/user/xtUserRightQuery", // 当路由设置了该属性,则会高亮相对应的侧边栏。
    },
    children: [
      {
        path: "/system/user/xtUserRightQuery",
        component: () => import("@/views/system/user/xtUserRightQuery.vue"),
        name: "XtUserRightQuery",
        meta: { title: "权限查询", activeMenu: "system/user" },
      },
    ],
  },
];
// 动态路由,基于用户权限动态去加载
src/store/modules/permission.js
@@ -123,7 +123,9 @@
                      title: "销售订单",
                    },
                    component: () =>
                      import("@/views/sell/xsSeOrderBill/xsSeOrderBillEdit.vue"),
                      import(
                        "@/views/sell/xsSeOrderBill/xsSeOrderBillEdit.vue"
                      ),
                    hidden: false,
                    name: "XsSeOrderBillEdit",
                    path: "xsSeOrderBillEdit",
@@ -468,6 +470,19 @@
                    name: "XtUserList",
                    path: "xtUserList",
                  },
                  {
                    meta: {
                      icon: "build",
                      link: null,
                      noCache: false,
                      title: "权限查询",
                    },
                    component: () =>
                      import("@/views/system/user/xtUserRightQuery.vue"),
                    hidden: false,
                    name: "XtUserRightQuery",
                    path: "xtUserRightQuery",
                  },
                ],
              },
            ],
src/views/sell/sellOut/sellOutBillEdit.vue
@@ -468,9 +468,6 @@
    this.fetchData()
    this.getdata()
  },
  beforeDestroy() {
    this.$destroy()
  },
  methods: {
    fetchData() {
      axios.get(this.baseURL + "/Web/GetOrganizations", {
@@ -634,10 +631,8 @@
      this.openRowHide = true
    },
    rowSetClose(val) {
      this.rowHideShow = false
      this.openRowHide = val
      this.$destroy()
    },
    organizationChange(val) {
@@ -775,10 +770,23 @@
    //退出
    close() {
      this.reset()
      console.log(1111)
      console.log(this.$route.path)
      if (!this.OperationType && !this.copyType) {
        const obj = { path: "/sell/sellOut/sellOutBillEdit", name: "SellOutBillEdit" };
        this.$tab.closePage(obj);
        console.log(this.$route.path)
        const obj = { fullPath: this.$route.path, path: this.$route.path, name: this.$route.name, };
        this.$tab.closePage(obj).then(res => {
          const latestView = res.visitedViews.slice(-1)[0]
          if (latestView) {
            this.$router.push(latestView.fullPath)
          } else {
            if (obj.name === 'Dashboard') {
              this.$router.replace({ path: '/redirect' + obj.fullPath })
            } else {
              this.$router.push('/')
            }
          }
        });
      } else {
        this.formShow = false
        this.$emit('editClose', false)
src/views/system/user/xtUserList.vue
@@ -96,7 +96,7 @@
      </el-collapse>
    </el-form>
    <el-row :gutter="10" class="mb8" style="margin-top: 10px;">
      <!-- <el-col :span="1.5">
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddEdit(OperationType = 1)"
          id="btn-Add">新增</el-button>
      </el-col>
@@ -106,8 +106,8 @@
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-share" size="mini" :disabled="single"
          @click="handleEdit(row = rowForm, OperationType = 2)">权限</el-button>
      </el-col> -->
          @click="openQuery = true">权限</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-delete" size="mini" :disabled="single" @click="handleDelete">删除
        </el-button>
@@ -142,9 +142,12 @@
        <RowSettings :colName="btResList" :HModName="HModName" @rowEditClose="rowSetClose" v-if="rowHideShow" />
      </el-dialog>
      <!-- 编辑 -->
      <el-dialog title="新增/b编辑用户" :visible.sync="openEdit" width="1480px" append-to-body class="xsckdBox" @close="close">
        <edit :OperationType=OperationType :linterid=this.rowForm.HEmpID :HSouceBillType=this.rowForm.HSourceBillType
          :copyType="copyType" @editCloseGy="editGyClose" v-if="editShow" />
      <el-dialog title="新增/编辑用户" :visible.sync="openEdit" width="1480px" append-to-body class="xsckdBox" @close="close">
        <edit :OperationType=OperationType :linterid=this.rowForm.用户编码 :HSouceBillType=this.rowForm.HSourceBillType
          :copyType="copyType" @editClose="editClose" v-if="editShow" />
      </el-dialog>
      <el-dialog title="用户权限" :visible.sync="openQuery" width="1480px" append-to-body class="xsckdBox">
        <Query />
      </el-dialog>
    </div>
  </div>
@@ -153,16 +156,19 @@
<script>
import axios from 'axios'
import RowSettings from '@/views/component/rowSettings'
import Edit from '@/views/basic/production/gySourceEdit.vue'
import Edit from '@/views/system/user/xtUserListEdit.vue'
import Query from '@/views/system/user/xtUserRightQuery.vue'
export default {
  name: 'XtUserList',
  components: { RowSettings, Edit },
  components: { RowSettings, Edit, Query },
  props: {
    openPage: { type: String, },
  },
  data() {
    return {
      openQuery: false,
      activeSeach: '',
      HModName: 'Xt_UserList',
      editShow: false,
@@ -360,7 +366,7 @@
        if (data1.code == 1) {
          this.total = data1.data.length;
          for (var i = 1; i < this.btList.length; i++) {
            this.btResList.push({ ColmCols: this.btList[i].field})
            this.btResList.push({ ColmCols: this.btList[i].field })
          }
          var col = [];
          col = this.btList
@@ -501,7 +507,7 @@
          this.tableData = this.getPage(this.page, this.allTableData)//无分页接口分页
          this.tableShow = true
          this.loading = false
        }
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
      });
@@ -535,7 +541,7 @@
    // 多选框选中数据
    handleSelectionChange(selection) {
      // this.rowForm = {}
      this.ids = selection.map(item => item.HEmpID)
      this.ids = selection.map(item => item.用户编码)
      this.single = selection.length != 1
      this.multiple = !selection.length
      if (!this.single) {
@@ -699,28 +705,28 @@
      })
    },
    //关闭编辑页面
    editGyClose(val) {
    editClose(val) {
      this.editShow = false
      this.openEdit = false
      this.multiple = true,
        this.getList()
      this.multiple = true
      this.getList()
    },
    /** 删除按钮操作 */
    handleDelete() {
      this.$modal.confirm('确认要删除吗,删除后不能恢复').then(() => {
         var HCzybm = this.rowForm.用户编码.toString();
          axios.get(this.baseURL + "/Xt_User/DeltetUser", {
            params: { "HCzybm": HCzybm }
          }).then(response => {
            if (response.data.count == 1) {
              this.getList()
              this.$modal.msgSuccess("删除成功")
            } else {
              this.$modal.msgError("错误:" + result.code + result.Message);
            }
          }).catch(error => {
            this.$modal.msgError("接口请求失败!");
          });
        var HCzybm = this.rowForm.用户编码.toString();
        axios.get(this.baseURL + "/Xt_User/DeltetUser", {
          params: { "HCzybm": HCzybm }
        }).then(response => {
          if (response.data.count == 1) {
            this.getList()
            this.$modal.msgSuccess("删除成功")
          } else {
            this.$modal.msgError("错误:" + result.code + result.Message);
          }
        }).catch(error => {
          this.$modal.msgError("接口请求失败!");
        });
      }).catch(() => { })
    },
    //导出
@@ -729,16 +735,14 @@
      const wb = this.$XLSX.utils.book_new(); // 创建一个新的工作簿
      this.$XLSX.utils.book_append_sheet(wb, ws, "Sheet1"); // 将工作表添加到工作簿中,并命名为"Sheet1"
      this.$XLSX.writeFile(wb, `xtUsetList_${new Date().getTime()}.xlsx`); // 导出文件      
    },
    },
    getPage(page, list) {
      let sindex = (parseInt(page) - 1) * this.pageSize
      let eindex = parseInt(page) * this.pageSize
      let newList = list.slice(sindex, eindex)
      console.log(newList)
      return newList
    },
    currentPage(val) {
      console.log(val)
      this.page = val.page
      setTimeout(() => {
        this.tableData = this.getPage(this.page, this.allTableData)
src/views/system/user/xtUserListEdit.vue
New file
@@ -0,0 +1,695 @@
<template>
  <div v-loading="formLoading" v-if="formShow">
    <div style=" margin-bottom: 10px; border-bottom: 1px solid #f6f6f6;">
      <el-button type="primary" @click="submitForm">保 存</el-button>
      <el-button type="primary" @click="close">退 出</el-button>
      <!-- <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-tabs v-model="activeName" type="card">
        <el-tab-pane label="基本信息" name="first">
          <el-row>
            <el-col :span="6">
              <el-form-item label="编码" prop="Czybm">
                <el-input v-model="form.Czybm" placeholder="请输入编码" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="用户名" prop="Czymc">
                <el-input v-model="form.Czymc" placeholder="请输入用户名" autocomplete="new-Czymc" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="密码" prop="Czmm">
                <el-input type="password" v-model="form.Czmm" placeholder="请输入密码" autocomplete="new-password" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="确认密码" prop="Czyyz">
                <el-input type="password" v-model="form.Czyyz" placeholder="请确认密码" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <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-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="钉钉ID号" prop="HDingDingUserID">
                <el-input v-model="form.HDingDingUserID" placeholder="请输入钉钉ID号" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="IC卡号" prop="HICNumber">
                <el-input v-model="form.HICNumber" placeholder="请输入IC卡号" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-form-item label="说明" prop="Explain">
              <el-input type="textarea" v-model="form.Explain" placeholder="请输入说明" />
            </el-form-item>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="对应金蝶信息" name="second">
          <el-row>
            <el-col :span="6">
              <el-form-item label="对应组织" prop="HOrgID">
                <el-select v-model="form.HOrgID" placeholder="请选择对应组织" @change="organizationChange"
                  :disabled="zzSelDis">
                  <el-option v-for="(item, index) in organizationList" :key="index" :label="item.Name" :value="item.ID">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="对应K3用户" prop="HK3UserName">
                <el-input v-model="form.HK3UserName" placeholder="请输入对应K3用户" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="对应班组" prop="HGroupName">
                <el-input v-model="form.HGroupName" placeholder="请输入对应班组" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <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-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <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-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-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-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-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <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-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-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-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="工作中心" prop="HWorkCenterName">
                <el-input v-model="form.HWorkCenterName" placeholder="请输入工作中心" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <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-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="对应工序" prop="HProcName">
                <el-input v-model="form.HProcName" placeholder="请输入对应工序" disabled>
                  <el-button slot="append" icon="el-icon-search" @click="openDataDialog(4)"></el-button>
                </el-input>
              </el-form-item>
            </el-col>
            <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-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
        <el-tab-pane label="CLOUD账号设置" name="third">
          <el-row>
            <el-col :span="6">
              <el-form-item label="对应CLOUD账号" prop="HCloudUserName">
                <el-input v-model="form.HCloudUserName" placeholder="请输入对应CLOUD账号" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="对应CLOUD密码" prop="HCloudUserPsd">
                <el-input type="password" v-model="form.HCloudUserPsd" placeholder="请输入对应CLOUD密码" />
              </el-form-item>
            </el-col>
          </el-row>
        </el-tab-pane>
      </el-tabs>
      <el-table :data="editData" ref="editData" style="width: 100%" height="300" width="100%"
        @selection-change="handleTableZbEdit" border>
        <el-table-column type="selection" width="55" align="center" />
        <el-table-column align="center" label="角色" prop="角色" />
        <el-table-column align="center" label="级别" prop="级别" />
        <el-table-column align="center" label="说明" prop="说明" />
      </el-table>
    </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" />
      <GyEmployee @deptEmitDb="dbEmitData" @deptEmit="emitData" :openPage="HModName" v-if="gyEmployeeShow" />
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="deptClickSub">确 定</el-button>
        <el-button @click="deptClose">取 消</el-button>
      </div>
    </el-dialog>
    <el-dialog title="隐藏列设置" :visible.sync="openRowHide" width="816px" append-to-body>
      <RowSettings :colName="btResList" :HModName="HModName" @rowEditClose="rowSetClose" v-if="rowHideShow" />
    </el-dialog>
  </div>
</template>
<script>
import axios from 'axios'
import Dept from '@/views/component/dept'
import Warehouse from '@/views/component/warehouse'
import Material from '@/views/component/material'
import RowSettings from '@/views/component/rowSettings'
import GyEmployee from '@/views/basic/gyEmployee/gyEmployee.vue'
export default {
  name: 'XtUserListEdit',
  components: { Dept, Warehouse, Material, RowSettings, GyEmployee },
  props: {
    OperationType: { type: Number, },
    linterid: {},
    HSouceBillType: { type: String, },
    propsData: { type: String, },
    copyType: { type: Number, },
  },
  data() {
    const equalToPassword = (rule, value, callback) => {
      if (this.form.Czmm !== value) {
        callback(new Error("两次密码不一样!"))
      } else {
        callback()
      }
    }
    const equalToHWHName = (rule, value, callback) => {
      if (this.form.HWHName&&this.form.HSCWHName&&(this.form.HWHName == this.form.HSCWHName)) {
        callback(new Error("对应仓库和调入仓库不能相同!"))
      } else {
        callback()
      }
    }
    return {
      HModName: "Xt_UserListEdit",
      formShow: false,
      temp: undefined,
      formLoading: true,
      zzSelDis: false,
      rowHideShow: false,
      openRowHide: false,
      hPriceTypeList: ['成本价', '结算价'],
      zbIndex: null,
      zbSelForm: {},//子表选中数据
      dialogTypeNum: null,//部门弹窗1,仓库弹窗2
      deptShow: false,//部门数据组件
      warehouseShow: false,//仓库数据组件
      materialShow: false,//物料数据组件
      gyEmployeeShow: false,//销售员数据组件
      deptform: {},//弹窗选中数据
      openData: false,//数据弹窗
      dialogTitle: '',
      organizationList: JSON.parse(sessionStorage.getItem('organizationList')),//组织列表
      subDisabled: false,//编辑页面保存按钮是否禁用(true禁用,false可用)
      // OperationType: this.$route.query.OperationType,//保存类型(新增1修改3)
      HInterID: null,
      baseURL: process.env.VUE_APP_BASE_API,
      checkedSysZb: [],
      editData: [],//角色子表
      editBtData: [],//子表表头
      activeName: 'first',
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 日期范围
      dateRange: [],
      // 查询参数
      queryParams: {
        HBillNo: '',
        HInitTimeCycle: 29,
        HProjectNumber: '',
        HCusID: null,
        HMaterNumber: '',
        HMaterName: '',
        ColName1: '',
        ColName2: '',
        ColName: '',
        Comparator1: '',
        Comparator2: '',
        Comparator: '',
        ColContent1: '',
        ColContent2: '',
        ColContent: '',
      },
      // 显示搜索条件
      showSearch: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 遮罩层
      loading: true,
      btResList: [],
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        Czybm: [
          { required: true, message: "编码不能为空!", trigger: "blur" }
        ],
        Czybm: [
          { required: true, message: "编码不能为空!", trigger: "blur" }
        ],
        Czmm: [
          { required: true, message: "用户名不能为空!", trigger: "blur" }
        ],
        Czyyz: [
          { required: true, message: "确认密码不能为空!", trigger: "blur" },
          { required: true, validator: equalToPassword, trigger: "blur" }
        ],
        HWHName: [
          { validator: equalToHWHName, trigger: "blur" }
        ],
        HSCWHName: [
          { validator: equalToHWHName, trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getdata()
  },
  methods: {
    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()
        })
      }
    },
    getUserGroup() {
      //角色列表
      axios.get(this.baseURL + '/Xt_UserGroup/list', {
        params: {
          sWhere: '',
        },
      }).then(response => {
        let data1 = response.data
        if (data1.code == 1) {
          this.editData = data1.data
          this.total = data1.data.length;
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
      });
    },
    get_DisplayUserGroupInfoList() {
      var sWhere = "and UserId='" + this.linterid + "'";
      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)
            if (this.editData.length > 0) {
              this.editData.forEach(row => {
                if (data1.data.some(selectedRow => selectedRow.GroupId === row.HGroupID)) {
                  this.$refs.editData.toggleRowSelection(row)
                }
              })
            }
        }
      }).catch(error => {
        console.log(error)
        this.$modal.msgError("接口请求失败!");
      });
    },
    // 获取参数_传递的JSON格式参数
    getUrlVars_JSON() {
      var datajson;
      var str = this.propsData; //获取链接中传递的参数
      var arr = str.substring(str.lastIndexOf("=") + 1);
      datajson = JSON.parse(decodeURI(arr));
      return datajson;
    },
    //根据主内码与子内码获取源单销售订单数据
    getPushSourceBillInit(HSourceInterID, HSourceEntryID) {
      axios.get(this.baseURL + '/Xs_SeOrderBill/loadXs_SeOrderBill_Push', {
        params: {
          "HInterID": HSourceInterID
          , "HSubID": HSourceEntryID
        },
      }).then(response => {
        let result = response.data
        if (result.code == 1) { // 说明验证成功了,
          this.temp = result.data[0];
        } else {
          this.temp = result.data;
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
      });
    },
    handleRowHide() {
      this.rowHideShow = true
      this.openRowHide = true
    },
    rowSetClose(val) {
      this.rowHideShow = false
      this.openRowHide = val
    },
    organizationChange(val) {
      // let options=undefined
      //  this.form=this.organizationList.find(option => option.ID === val)?.Name || '';
    },
    //部门弹窗赋值
    dbEmitData(deptRow, num) {
      // num=1部门 num=2出库仓库
      if (deptRow.HItemID) {
        if (num == 1) {
          this.form.HDeptName = 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.仓库名称;
          this.warehouseShow = false
          this.openData = false
        } else if (num == 3) {
          this.editData[this.zbIndex].HMaterID = deptRow.HItemID;
          this.editData[this.zbIndex].物料代码 = deptRow.物料代码;
          this.editData[this.zbIndex].物料名称 = deptRow.物料名称;
          this.editData[this.zbIndex].HUnitID = deptRow.HUnitID;
          this.editData[this.zbIndex].规格型号 = deptRow.规格型号
          this.editData[this.zbIndex].计量单位 = deptRow.计量单位名称
          this.editData[this.zbIndex].HTaxPrice = deptRow.含税成本价
          this.editData[this.zbIndex].HTaxRate = deptRow.默认税率
          this.materialShow = false
          this.openData = false
        } else if (num == 4) {
          this.form.HEmpName = deptRow.职员名称
          this.form.HEmpID = deptRow.HItemID
          this.gyEmployeeShow = false
          this.openData = false
        }
      } else {
        this.$modal.msgError("请选择单条数据!");
      }
    },
    emitData(deptRow, num) {
      this.dialogTypeNum = num
      this.deptform = deptRow
    },
    deptClickSub() {
      this.dbEmitData(this.deptform, this.dialogTypeNum)
      this.deptform = {}
    },
    deptClose() {
      this.deptform = {}
      this.openData = false
    },
    //销售出库单新增编辑表单初始化
    reset() {
      this.form = {
        Czybm: '',
        Czymc: '',
        Czmm: '',
        Czyyz: '',
        Explain: '',
        HEmpID: 0,
        HEmpName: '',
        HK3UserName: '',
        HK3UserID: 0,
        HKeeper: '',
        HKeeperID: 0,
        HSecManager: '',
        HSecManagerID: 0,
        HSellManID: 0,
        HSellMan: '',
        HDept: '',
        HDeptID: 0,
        HWHName: '',
        HWhID: 0,
        HSCWHName: '',
        HSCWHID: 0,
        HSupName: '',
        HSupID: 0,
        HCloudUserName: '',
        HCloudUserPsd: '',
        HOrgID: sessionStorage["OrganizationID"] - 0,
        HProcID: 0,
        HProcName: '',
        HCusID: 0,
        HCusName: '',
        HGroupID: 0,
        HGroupName: '',
        HSourceID: 0,
        HSourceName: '',
        HCheckEmpID: 0,
        HCheckEmpName: '',
        HWorkCenterID: 0,
        HWorkCenterName: '',
        HICNumber: '',
        HDingDingUserID: 0,
      }
      this.editData = []
      this.editBtData = []
      this.ids = []
      this.subDisabled = false
      this.activeName = 'first'
      this.resetForm("form");
    },
    //退出
    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)
      }
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset()
      this.formShow = true
      this.formLoading = false
    },
    /** 修改按钮操作 */
    handleUpdate() {
      this.reset()
      let rowHmainid = this.linterid
      axios.get(this.baseURL + "/Xt_User/EditUser", {
        params: { 'HID': rowHmainid }
      }).then(response => {
        if (response.data.code == 1) {
          var result = response.data
          var data = result.data.h_v_IF_UserList_Edit[0]
          this.form.Czybm = data.用户编码
          this.form.Czymc = data.用户名称
          this.form.Czmm = data.密码
          this.form.Czyyz = data.密码
          this.form.Explain = data.说明
          this.form.HEmpID = data.HEmpID
          this.form.HEmpName = data.对应职员
          this.form.HK3UserName = data.HK3UserID
          this.form.HK3UserID = data.HK3UserID
          this.form.HKeeper = data.HKeeper
          this.form.HKeeperID = data.HKeeperID
          this.form.HSecManager = data.HSecManager
          this.form.HSecManagerID = data.HSecManagerID
          this.form.HSellManID = data.HSellManID
          this.form.HSellMan = data.HSellMan
          this.form.HDept = data.HDept
          this.form.HDeptID = data.HDeptID
          this.form.HWHName = data.HWHName
          this.form.HWhID = data.HWhID
          this.form.HSCWHName = data.HSCWHName
          this.form.HSCWHID = data.HSCWHID
          this.form.HSupName = data.HSupName
          this.form.HSupID = data.HSupID
          this.form.HCloudUserName = data.对应CLOUD账号
          this.form.HCloudUserPsd = data.HCloudUserPsd
          this.form.HOrgID = data.HUSEORGID
          this.form.HProcID = data.HProcID
          this.form.HProcName = data.工序
          this.form.HCusID = data.HCusID
          this.form.HCusName = data.客户
          this.form.HGroupID = data.HGroupID
          this.form.HGroupName = data.班组
          this.form.HSourceID = data.HSourceID
          this.form.HSourceName = data.生产资源
          this.form.HCheckEmpID = data.HCheckEmpID
          this.form.HCheckEmpName = data.检验员
          this.form.HWorkCenterID = data.HWorkCenterID
          this.form.HWorkCenterName = data.工作中心
          this.form.HICNumber = data.IC卡号
          this.form.HDingDingUserID = data.钉钉ID号
          this.formShow = true
          this.get_DisplayUserGroupInfoList()
          this.formLoading = false
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
      });
    },
    /** 编辑页子表复选框选中数据 */
    handleTableZbEdit(selection) {
      console.log(selection)
      this.checkedSysZb = selection
      // this.editData.forEach(row => {
      //   row.AuthorityHID = this.checkedSysZb.some(selectedRow => selectedRow.GroupId === row.HGroupID) ? 1 : 0;
      // });
    },
    // 编辑提交保存
    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"
          }
          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);
            }
          }).catch(error => {
            this.$modal.msgError("接口请求失败!");
          });
        }
      });
    },
    showReset() {
      this.deptShow = false
      this.warehouseShow = false
      this.materialShow = false
      this.gyEmployeeShow = false
    },
    //  打开数据列表弹窗
    openDataDialog(num, row) {
      //num1部门,2出库仓库,3物料,4销售员
      if (row) {
        this.zbIndex = row.index - 1
      }
      this.showReset()
      if (num == 1) {
        this.dialogTitle = '部门列表'
        this.deptShow = true
        this.openData = true
      } else if (num == 2) {
        this.dialogTitle = '出库仓库列表'
        this.warehouseShow = true
        this.openData = true
      } else if (num == 3) {
        this.dialogTitle = '物料列表'
        this.materialShow = true
        this.openData = true
      } else if (num == 4) {
        this.dialogTitle = '销售员列表'
        this.gyEmployeeShow = true
        this.openData = true
      }
    },
  }
};
</script>
<style>
.xsckdBox .el-date-editor.el-input {
  width: 100%;
}
</style>
src/views/system/user/xtUserRightQuery.vue
New file
@@ -0,0 +1,342 @@
<template>
  <div style="padding: 10px;">
    <el-row>
      <el-button type="primary" @click="handleSaver">保存</el-button>
      <el-button type="primary" @click="close">退出</el-button>
    </el-row>
    <el-row>
      <el-col :span="8" style="padding-right:5px ;">
        <el-tree :data="treeOptions" :props="defaultProps" :expand-on-click-node="false"
          :filter-node-method="filterNode" ref="tree" node-key="id" :default-expand-all="false" highlight-current
          @node-click="handleNodeClick" />
      </el-col>
      <el-col :span="8" style="box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04)">
        <el-row style="margin-top: 10px;">
          <el-radio-group v-model="HSouceBillType" @input="typeInput">
            <el-radio-button label="yh">用户</el-radio-button>
            <el-radio-button label="js">角色</el-radio-button>
          </el-radio-group>
        </el-row>
        <div class="btnQueryBox">
          <div style="flex: 1;">
            <el-button type="success" size="mini" icon="refresh" @click="getList">刷新</el-button>
            <el-button type="success" size="mini" icon="search" @click="handleNodeClick">查看</el-button>
          </div>
          <div>
            <el-button icon="el-icon-download" size="mini" title="导出" @click="handleExport"></el-button>
          </div>
        </div>
        <div class="tableBox" v-loading="loading">
          <el-table :data="tableData" ref="tableData" max-height="750" @selection-change="handleSelectionChange" border
            v-if="tableShow">
            <template v-for="(item, index) in btList">
              <el-table-column type="selection" width="55" align="center" :fixed="item.fixed"
                v-if="item.type == 'checkbox'" :key="index" />
              <el-table-column :align="item.align" :prop="item.field" :label="item.title" :width="item.width"
                :key="item.sorderid" v-else-if="!item.hide && item.type != 'checkbox'" :sortable="item.sort"
                show-overflow-tooltip :fixed="item.fixed">
                <template slot-scope="{row,  column }">
                  <el-checkbox v-model="checked" v-if="item.type == 'checkbox'"></el-checkbox>
                  <div :style="item.style">{{ row[column.label] }}</div>
                </template>
              </el-table-column>
            </template>
          </el-table>
          <pagination v-show="total > 0" :total="total" :page.sync="page" :limit.sync="pageSize" :pageSizes="pageSizes"
            @pagination="currentPage" />
        </div>
      </el-col>
      <el-col :span="8" style="padding-left: 10px;">
        <el-table :data="queryData" ref="queryMultipleTable" max-height="800" @selection-change="handleQueryChange"
          border v-if="tableQueryShow">
          <el-table-column type="selection" width="55" prop="AuthorityID" align="center" />
          <el-table-column align="center" prop="AuthorityID" label="是否权限" show-overflow-tooltip>
            <template slot-scope="scope">
              <span style="color: green;" v-if="scope.row.AuthorityID == 1">是</span>
              <span v-else-if="scope.row.AuthorityID == 0">否</span>
            </template>
          </el-table-column>
          <el-table-column align="center" prop="gnms" label="功能说明" show-overflow-tooltip />
        </el-table>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import axios from 'axios'
export default {
  name: 'XtUserRightQuery',
  components: {},
  props: {
    openPage: { type: String, },
  },
  data() {
    return {
      HModName: 'Xt_UserRightQuery',
      selQueryRows: [],
      nodeData: {},
      linterid: '',
      HSouceBillType: 'yh',
      queryData: [],
      tableQueryShow: false,
      //树结构
      treeOptions: [],
      defaultProps: {
        children: "children",
        label: "title"
      },
      tableShow: true,
      sGnbm: '',
      organizationList: JSON.parse(sessionStorage.getItem('organizationList')),//组织列表
      baseURL: process.env.VUE_APP_BASE_API,
      rowForm: {},
      // 弹出层标题
      title: "",
      // 选中数组
      ids: [],
      // 遮罩层
      loading: true,
      tyResList: [],//列表(接口数据)
      btList: [],//表头列表显示
      btResList: [],
      tableData: [],//列表(分页显示)
      allTableData: [],
      pageSizes: [50, 100, 500, 5000, 50000],
      page: 1,
      pageSize: 0,
      total: 0,
    };
  },
  created() {
    this.getTreeselect()
    this.getList()
  },
  methods: {
    typeInput() {
      this.tableShow = false
      this.loading = true
      this.ids = []
      this.getList()
    },
    getTreeselect() {
      axios.get(this.baseURL + 'Gy_MaintenanceMode/PowerLoadTree').then(response => {
        let data1 = response.data
        if (data1.count == 1) {
          let map = {};
          let treeData = [];
          data1.data.forEach(it => {
            map[it.id.toUpperCase()] = it;    //ID为每个节点的id
          })
          //生成结果集
          data1.data.forEach(it => {
            const parent = map[it.ParentID.toUpperCase()];   //ParentID为父节点的id
            if (parent) {
              if (!Array.isArray(parent.children)) parent.children = [];
              parent.children.push(it);
            } else {
              treeData.push(it)
            }
          })
          this.treeOptions = treeData
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
      });
    },
    // 筛选节点
    filterNode(value, data) {
      if (!value) return true
      return data.label.indexOf(value) !== -1
    },
    // 节点单击事件
    handleNodeClick(data) {
      this.nodeData = data
      if (!data.id) {
        this.sGnbm = '权限管理-用户'
      } else {
        this.sGnbm = data.id
      }
      this.queryData = []
      this.linterid = ''
      let text = ''
      if (this.HSouceBillType == 'yh') {
        this.linterid = this.rowForm.用户编码
        text = '请选择一位用户!'
      } else if (this.HSouceBillType == 'js') {
        this.linterid = this.rowForm.HGroupID
        text = '请选择一个角色!'
      }
      if (this.linterid) {
        axios.get(this.baseURL + '/PublicPageMethod/PowerList', {
          params: {
            czybm: this.linterid,
            sGnbm: this.sGnbm,
            HSouceBillType: this.HSouceBillType,
          },
        }).then(response => {
          this.queryData = response.data.data
          this.tableQueryShow = true
          this.$nextTick(() => {
            if (this.queryData.length > 0) {
              this.queryData.forEach(row => {
                if (row.AuthorityID) {
                  this.$refs.queryMultipleTable.toggleRowSelection(row);
                }
              });
            } else {
              this.$refs.queryMultipleTable.clearSelection();
            }
          })
        }).catch(error => {
          this.$modal.msgError("接口请求失败!");
        });
      } else {
        this.$modal.msgError(text);
      }
    },
    //列表数据
    getList() {
      this.pageSize = 50
      this.tableShow = false
      this.loading = true
      let url = ''
      if (this.HSouceBillType == 'yh') {
        url = '/Xt_User/list'
        this.btList = [{ type: 'checkbox', fixed: 'left' }
          , { field: 'hmainid', title: '单据ID', hide: true }
          , { field: '用户编码', title: '用户编码' }
          , { field: '用户名称', title: '用户名称' }
          , { field: '用户类型', title: '用户类型' }
          , { field: '对应班组', title: '对应班组' }
          , { field: '对应职员', title: '对应职员' }
          , { field: '对应保管', title: '对应保管' }
          , { field: '对应验收', title: '对应验收' }
          , { field: '对应业务员', title: '对应业务员' }
          , { field: '对应部门', title: '对应部门' }
          , { field: '对应仓库', title: '对应仓库' }
          , { field: '对应调入仓库', title: '对应调入仓库' }
          , { field: '对应供应商', title: '对应供应商' }
          , { field: '对应CLOUD账号', title: '对应CLOUD账号' }
          , { field: '对应CLOUD组织', title: '对应CLOUD组织' }]
      } else if (this.HSouceBillType == 'js') {
        url = '/Xt_UserGroup/list'
        this.btList = [{ type: 'checkbox', fixed: 'left' }
          , { field: 'HGroupID', title: 'HGroupID', sort: true, hide: true }
          , { field: '角色', title: '角色' }
          , { field: '级别', title: '级别' }
          , { field: '说明', title: '说明' }]
      }
      //列表
      axios.get(this.baseURL + url, {
        params: {
          "sWhere": '',
          "user": sessionStorage["HUserName"],
        },
      }).then(response => {
        this.tyResList = response.data.data//总数据
        let data1 = response.data
        this.allTableData = data1.data
        if (data1.code == 1) {
          this.total = data1.data.length;
          for (var i = 1; i < this.btList.length; i++) {
            this.btResList.push({ ColmCols: this.btList[i].field })
          }
          this.tableData = this.getPage(this.page, this.allTableData)//无分页接口分页
          this.tableShow = true
          this.loading = false
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
      });
    },
    // 单选框选中数据
    handleSelectionChange(selection) {
      if (selection.length > 1) {
        const del_row = selection.shift()
        this.$refs.tableData.toggleRowSelection(del_row, false) //设置这一行取消选中
      }
      this.rowForm = {}
      if (this.HSouceBillType == 'yh') {
        this.ids = selection.map(item => item.用户编码)
      } else if (this.HSouceBillType == 'js') {
        this.ids = selection.map(item => item.HGroupID)
      }
      this.rowForm = selection[0]
    },
    handleQueryChange(selection) {
      this.selQueryRows = selection
      this.queryData.forEach(row => {
        row.AuthorityHID = this.selQueryRows.some(selectedRow => selectedRow.hgnbm === row.hgnbm) ? 1 : 0;
      });
    },
    //退出
    close() {
      const obj = { fullPath: this.$route.path, path: this.$route.path, name: this.$route.name, };
      this.$tab.closePage(obj).then(res => {
        const latestView = res.visitedViews.slice(-1)[0]
        if (latestView) {
          this.$router.push(latestView.fullPath)
        } else {
          if (obj.name === 'Dashboard') {
            this.$router.replace({ path: '/redirect' + obj.fullPath })
          } else {
            this.$router.push('/')
          }
        }
      });
    },
    handleSaver() {
      var sSubStr = JSON.stringify(this.queryData);
      var sMainSub = this.sGnbm + ';' + sSubStr + ';' + this.linterid + ";" + this.HSouceBillType;
      axios({
        method: 'post',
        url: this.baseURL + "/Gy_MaintenanceMode/SaverPower",
        data: {
          'msg': sMainSub
        },
      }).then(response => {
        if (response.data.count == 1) {
          this.subDisabled = true//设置保存按钮不可用
          this.$modal.msgSuccess(response.data.Message);
          this.handleNodeClick(this.nodeData)
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
      });
    },
    getPage(page, list) {
      let sindex = (parseInt(page) - 1) * this.pageSize
      let eindex = parseInt(page) * this.pageSize
      let newList = list.slice(sindex, eindex)
      return newList
    },
    currentPage(val) {
      this.page = val.page
      setTimeout(() => {
        this.tableData = this.getPage(this.page, this.allTableData)
      }, 100)
    },
    //导出
    handleExport() {
      const ws = this.$XLSX.utils.json_to_sheet(this.tyResList); // 将数据转换为工作表
      const wb = this.$XLSX.utils.book_new(); // 创建一个新的工作簿
      this.$XLSX.utils.book_append_sheet(wb, ws, "Sheet1"); // 将工作表添加到工作簿中,并命名为"Sheet1"
      this.$XLSX.writeFile(wb, this.HSouceBillType+`_${new Date().getTime()}.xlsx`); // 导出文件
    },
  }
};
</script>
<style>
.xsckdBox .el-date-editor.el-input {
  width: 100%;
}
.btnQueryBox {
  margin-top: 10px;
  padding: 5px;
  border-top: 1px solid #ebebeb;
  display: flex;
  justify-content: right;
}
</style>