1
陈婷婷
2025-11-12 532ff11cc85e0a577ea0a102748861ebe17ed6d0
1
1个文件已删除
1个文件已添加
4个文件已修改
889 ■■■■■ 已修改文件
src/layout/components/Sidebar/MenuItemRecursive.vue 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Sidebar/index.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/index.js 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/permission.js 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/sell/sellOut/sellOutBill.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/system/user/xtUserList.vue 754 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/layout/components/Sidebar/MenuItemRecursive.vue
File was deleted
src/layout/components/Sidebar/index.vue
@@ -7,23 +7,12 @@
                :background-color="settings.sideTheme === 'theme-dark' ? variables.menuBackground : variables.menuLightBackground"
                :text-color="settings.sideTheme === 'theme-dark' ? variables.menuColor : variables.menuLightColor"
                :unique-opened="true" :active-text-color="settings.theme" :collapse-transition="false" mode="vertical">
                <!-- <el-submenu index="1">
                    <template slot="title">
                        <i class="el-icon-location"></i>
                        <span>导航一</span>
                    </template>
<el-menu-item-group>
    <el-menu-item index="1-1">选项1</el-menu-item>
    <el-menu-item index="1-2">选项2</el-menu-item>
</el-menu-item-group>
</el-submenu> -->
                <sidebar-item
                    v-for="(route, index) in sidebarRouters"
                    :key="route.path  + index"
                    :item="route"
                    :base-path="route.path"
                />
                <!-- <menu-item-recursive :menu-list="menuData" /> -->
            </el-menu>
        </el-scrollbar>
    </div>
@@ -34,9 +23,8 @@
import Logo from "./Logo"
import SidebarItem from "./SidebarItem"
import variables from "@/assets/styles/variables.scss"
import MenuItemRecursive from './MenuItemRecursive.vue'  // 导入递归组件
export default {
    components: { SidebarItem, Logo, MenuItemRecursive },
    components: { SidebarItem, Logo },
    computed: {
        ...mapState(["settings"]),
        ...mapGetters(["sidebarRouters", "sidebar"]),
@@ -45,6 +33,7 @@
            const { meta, path } = route
            // if set path, the sidebar will highlight the path you set
            if (meta.activeMenu) {
                console.log(meta.activeMenu)
                return meta.activeMenu
            }
            return path
src/router/index.js
@@ -116,7 +116,7 @@
    redirect: "noredirect",
    meta: {
      breadcrumb: false, // 如果设置为false,则不会在breadcrumb面包屑中显示
      activeMenu: "/sell/sellOut/sellOutBillEdit", // 当路由设置了该属性,则会高亮相对应的侧边栏。
      activeMenu: "/sell/sellOut", // 当路由设置了该属性,则会高亮相对应的侧边栏。
    },
    children: [
      {
@@ -127,7 +127,25 @@
      },
    ],
  },
  //用户列表
  {
    path: "/system/user/xtUserList",
    component: Layout,
    hidden: true,
    redirect: "noredirect",
    meta: {
      breadcrumb: false, // 如果设置为false,则不会在breadcrumb面包屑中显示
      activeMenu: "/system/user", // 当路由设置了该属性,则会高亮相对应的侧边栏。
    },
    children: [
      {
        path: "/system/user/xtUserList",
        component: () => import("@/views/system/user/xtUserList.vue"),
        name: "XtUserList",
        meta: { title: "用户列表", activeMenu: "system/user" },
      },
    ],
  },
  //生产资源
  {
    path: "/basic/production/gySource",
src/store/modules/permission.js
@@ -133,13 +133,57 @@
                  //     icon: "build",
                  //     link: null,
                  //     noCache: false,
                  //     title: "生产仓库列表",
                  //     title: "生产资料列表",
                  //   },
                  //   component: () => import('@/views/basic/gyWarehouse/index.vue'),
                  //   component: () =>
                  //     import("@/views/basic/production/gySource.vue"),
                  //   hidden: false,
                  //   name: "GyWarehouse",
                  //   path: "gyWarehouse",
                  // },
                  //   name: "GySource",
                  //   path: "gySource",
                  // }
                ],
              },
            ],
          },{
            alwaysShow: true,
            component: "Layout",
            meta: {
              icon: "build",
              link: null,
              noCache: false,
              title: "系统管理",
            },
            hidden: false,
            name: "System",
            path: "/system",
            redirect: "noRedirect",
            children: [
              {
                meta: {
                  icon: "build",
                  link: null,
                  noCache: false,
                  title: "用户管理",
                },
                hidden: false,
                name: "User",
                path: "user",
                redirect: "noRedirect",
                component: "Layout",
                children: [
                  {
                    meta: {
                      icon: "build",
                      link: null,
                      noCache: false,
                      title: "用户列表",
                    },
                    component: () =>
                      import("@/views/system/user/xtUserList.vue"),
                    hidden: false,
                    name: "XtUserList",
                    path: "xtUserList",
                  },
                ],
              },
            ],
@@ -154,7 +198,6 @@
        rewriteRoutes.push({ path: "*", redirect: "/404", hidden: true });
        router.addRoutes(asyncRoutes);
        commit("SET_ROUTES", rewriteRoutes);
        commit("SET_SIDEBAR_ROUTERS", constantRoutes.concat(sidebarRoutes));
        commit("SET_SIDEBAR_ROUTERS", constantRoutes.concat(sidebarRoutes));
        commit("SET_DEFAULT_ROUTES", sidebarRoutes);
        commit("SET_TOPBAR_ROUTES", sidebarRoutes);
src/views/sell/sellOut/sellOutBill.vue
@@ -170,7 +170,7 @@
          </el-table-column>
        </template>
      </el-table>
      <pagination v-show="total > 0" :total="total" :page.sync="page" :limit.sync="pageSize" @pagination="getList" />
      <pagination v-show="total > 0" :total="total" :page.sync="page" :limit.sync="pageSize" :pageSizes="pageSizes" @pagination="getList" />
      <el-dialog title="隐藏列设置" :visible.sync="openRowHide" width="816px" append-to-body>
        <RowSettings :colName="btResList" HModName="Kf_SellOutBillList" @rowEditClose="rowSetClose"
          v-if="rowHideShow" />
@@ -286,6 +286,7 @@
      tableData: [],//销售出库列表(分页显示)
      dataList: [],
      titleData: ["hmainid", "hsupid", "HEmpID", "hmanagerid", "hsecmanagerid", "发货人", "hkeeperid", "保管员", "HDeptID", "销售方式", "hsubid", "hmaterid", "hunitid", "HWHID"],//不需要显示的字段 可扩展
      pageSizes: [50, 100, 500, 5000, 50000],
      page: 1,
      pageSize: 0,
      total: 0,
@@ -438,6 +439,7 @@
      });
    },
    DisPlay_HideColumn(HModName, user, option, dataOption) {
      this.totalNameList = []
      axios.get(this.baseURL + '/Xt_grdAlignment_WMES/grdAlignmentWMESList', {
        params: {
src/views/system/user/xtUserList.vue
New file
@@ -0,0 +1,754 @@
<template>
  <div style="padding: 10px;">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="98px" class="searchBox">
      <el-row>
        <el-form-item label="用户编码" prop="HNumber" style="margin-left: 100px;">
          <el-input v-model="queryParams.HNumber" placeholder="请输入生产资源代码" @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="用户名称" prop="HName">
          <el-input v-model="queryParams.HName" placeholder="请输入用户名称" @keyup.enter.native="handleQuery" />
        </el-form-item>
        <el-form-item label="对应CLOUD组织" prop="HUSEORGID" label-width="128px">
          <el-select v-model="queryParams.HUSEORGID" placeholder="请选择">
            <el-option v-for="(item, index) in organizationList" :key="index" :label="item.Name" :value="item.ID">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label-width="78px">
          <el-button type="primary" icon="el-icon-search" @click="handleQuery">
            搜 索</el-button>
          <el-button type="primary" icon="el-icon-refresh" @click="resetQuery">重 置</el-button>
        </el-form-item>
      </el-row>
      <el-collapse v-model="activeSeach">
        <el-collapse-item title="更多" name="1">
          <el-card class="box-card">
            <div slot="header" class="clearfix"><span>过滤</span></div>
            <div>
              <el-form-item label-width="0">
                <el-row>
                  <el-col :span="7">
                    <el-select v-model="queryParams.ColName1" placeholder="请选择">
                      <span v-for="(item, index) in btList" :key="index">
                        <el-option :label="item.field" :value="item.field" v-if="!item.hide"></el-option>
                      </span>
                    </el-select>
                  </el-col>
                  <el-col :span="6" style="padding: 0 10px;">
                    <el-select v-model="queryParams.Comparator1" placeholder="请选择">
                      <el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
                        :value="item.value"></el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="11">
                    <el-input v-model="queryParams.ColContent1" placeholder="请输入" clearable
                      @keyup.enter.native="handleQuery" />
                  </el-col>
                </el-row>
              </el-form-item>
              <el-row>
                <el-form-item label-width="0">
                  <el-row>
                    <el-col :span="7">
                      <el-select v-model="queryParams.ColName2" placeholder="请选择">
                        <span v-for="(item, index) in btList" :key="index">
                          <el-option :label="item.field" :value="item.field" v-if="!item.hide"></el-option>
                        </span>
                      </el-select>
                    </el-col>
                    <el-col :span="6" style="padding: 0 10px;">
                      <el-select v-model="queryParams.Comparator2" placeholder="请选择">
                        <span v-for="(item, index) in btList" :key="index">
                          <el-option :label="item.field" :value="item.field" v-if="!item.hide"></el-option>
                        </span>
                      </el-select>
                    </el-col>
                    <el-col :span="11">
                      <el-input v-model="queryParams.ColContent2" placeholder="请输入" clearable
                        @keyup.enter.native="handleQuery" />
                    </el-col>
                  </el-row>
                </el-form-item>
              </el-row>
              <el-form-item label-width="0">
                <el-row>
                  <el-col :span="7">
                    <el-select v-model="queryParams.ColName" placeholder="请选择">
                      <el-option v-for="(item, index) in btList" :key="index" :label="item.field"
                        :value="item.field"></el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="6" style="padding: 0 10px;">
                    <el-select v-model="queryParams.Comparator" placeholder="请选择">
                      <el-option v-for="(item, index) in comparatorList" :key="index" :label="item.label"
                        :value="item.value"></el-option>
                    </el-select>
                  </el-col>
                  <el-col :span="11">
                    <el-input v-model="queryParams.ColContent" placeholder="请输入" clearable
                      @keyup.enter.native="handleQuery" />
                  </el-col>
                </el-row>
              </el-form-item>
            </div>
          </el-card>
        </el-collapse-item>
      </el-collapse>
    </el-form>
    <el-row :gutter="10" class="mb8" style="margin-top: 10px;">
      <!-- <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>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-edit" size="mini" :disabled="single"
          @click="handleEdit(row = rowForm, OperationType = 3)">编辑</el-button>
      </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> -->
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-delete" size="mini" :disabled="single" @click="handleDelete">删除
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-download" size="mini" @click="handleExport">导出</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="primary" icon="el-icon-download" size="mini" @click="handleRowHide">隐藏列设置</el-button>
      </el-col>
    </el-row>
    <div class="tableBox" v-loading="loading">
      <el-table :data="tableData" ref="tableData" max-height="750" :summary-method="getSummaries"
        @selection-change="handleSelectionChange" show-summary border @row-click="handleRowClick" :row-style="rowStyle"
        @cell-dblclick="handleDblclick" 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" />
      <el-dialog title="隐藏列设置" :visible.sync="openRowHide" width="816px" append-to-body>
        <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>
    </div>
  </div>
</template>
<script>
import axios from 'axios'
import RowSettings from '@/views/component/rowSettings'
import Edit from '@/views/basic/production/gySourceEdit.vue'
export default {
  name: 'XtUserList',
  components: { RowSettings, Edit },
  props: {
    openPage: { type: String, },
  },
  data() {
    return {
      activeSeach: '',
      HModName: 'Xt_UserList',
      editShow: false,
      openEdit: false,
      totalNameList: [],
      tableShow: true,
      openPrintList: false,
      printListShow: false,
      HBillType: '1205',
      openBtnHide: false,
      btnHideShow: false,
      rowHideShow: false,
      openRowHide: false,
      copyType: 0,
      comparatorList: [
        { label: '=', value: '=' },
        { label: '>=', value: '>=' },
        { label: '>', value: '>' },
        { label: '<=', value: '<=' },
        { label: '<', value: '<' },
        { label: '<>', value: '<>' },
        { label: '包含', value: '7' },
        { label: '左包含', value: '8' },
        { label: '右包含', value: '9' },
        { label: '不包含', value: '10' },
      ],
      sWhere: '',
      dialogTitle: '',
      organizationList: JSON.parse(sessionStorage.getItem('organizationList')),//组织列表
      OperationType: null,//保存类型(新增1修改3)
      HInterID: null,
      baseURL: process.env.VUE_APP_BASE_API,
      lastSelectedRowIndex: null, // 用于记录上次点击的行索引
      lastSelectedRow: null, // 上一次选中的行
      selectedRow: null, // 当前选中的行
      rowForm: {},
      activeName: 'first',
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        HUSEORGID: null,
        HName: null,
        HNumber: null,
        Comparator1: '',
        Comparator2: '',
        Comparator: '',
        ColContent1: '',
        ColContent2: '',
        ColContent: '',
      },
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 遮罩层
      loading: true,
      tyResList: [],//列表(接口数据)
      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组织' }
      ],//表头列表显示
      btResList: [],
      tableData: [],//列表(分页显示)
      allTableData: [],
      dataList: [],
      titleData: [],//不需要显示的字段可扩展
      pageSizes: [50, 100, 500, 5000, 50000],
      page: 1,
      pageSize: 0,
      total: 0,
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        HSupName: [
          { required: true, message: "客户不能为空", trigger: "blur" }
        ],
        HDate: [
          { required: true, message: "日期不能为空", trigger: "blur" }
        ],
        HExRate: [
          { required: true, message: "汇率不能为空", trigger: "blur" }
        ]
      },
      upload: {
        // 是否显示弹出层
        open: false,
        // 弹出层标题
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的数据
        updateSupport: 0,
        // 设置上传的请求头部
        // headers: { Authorization: "Bearer " + getToken() },
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/Gy_Source/Gy_Source_Excel"
      },
      uploadData: [],
      alluploadList: [],
      uploadTableLoading: false,
      uploadPageSizes: [50, 100, 500, 5000, 50000],
      uploadPage: 1,
      uploadPageSize: 50,
      uploadTotal: 0,
    };
  },
  created() {
    this.getList()
  },
  methods: {
    getSummaries(param) {
      const { columns, data } = param;
      const sums = [];
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计';
          return;
        }
        const values = data.map(item => Number(item[column.property]));
        if (this.totalNameList[index].totalRow) {
          if (!values.every(value => isNaN(value))) {
            sums[index] = values.reduce((prev, curr) => {
              const value = Number(curr);
              if (!isNaN(value)) {
                return prev + curr;
              } else {
                return prev;
              }
            }, 0)
          } else {
            sums[index] = '';
          }
        }
      }, 1000);
      return sums;
    },
    handleBtnHide() {
      this.btnHideShow = true
      this.openBtnHide = true
    },
    handleRowHide() {
      this.rowHideShow = true
      this.openRowHide = true
    },
    rowSetClose(val) {
      this.rowHideShow = false
      this.tableShow = true
      this.openRowHide = val
      this.getList()
    },
    //列表数据
    getList() {
      this.pageSize = 50
      this.tableShow = false
      this.loading = true
      if (this.pageSize == 0) {
        this.pageSize = 50
      }
      this.queryParams.HUSEORGID = sessionStorage["OrganizationID"] - 0
      // this.sWhere += " and HUSEORGID = '" + this.queryParams.HUSEORGID + "'"
      //列表
      axios.get(this.baseURL + '/Xt_User/list', {
        params: {
          "sWhere": this.sWhere,
          "user": sessionStorage["HUserName"],
        },
      }).then(response => {
        this.tyResList = response.data.data//总数据
        let data1 = response.data
        this.allTableData = data1.data
        let option = []
        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})
          }
          var col = [];
          col = this.btList
          option.cols = [col]
          this.dataList = option
          option.data = data1.data;
          var result = data1.data;
          option.data = result;
          this.DisPlay_HideColumn(this.HModName, sessionStorage["HUserName"], option, this.dataList);
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
      });
    },
    DisPlay_HideColumn(HModName, user, option, dataOption) {
      this.totalNameList = []
      axios.get(this.baseURL + '/Xt_grdAlignment_WMES/grdAlignmentWMESList', {
        params: {
          "HModName": HModName,
          "user": user,
        },
      }).then(res => {
        let data1 = res.data
        if (data1.data.length != 0) {
          var dataCol = [];//数据库查询出的列数据
          var newCols = [[]];//对应数据库列顺序col
          newCols[0].push(option.cols[0][0]);//放入第一个checkbox
          dataCol = data1.data[0].HGridString.split(',');
          //列设置列数与页面列数是否一致
          if (dataCol.length == option.cols[0].length - 1) {
            //遍历寻找列设置对应列按顺序插入
            for (var j = 0; j < option.cols[0].length - 1; j++) {
              for (var i = 0; i < option.cols[0].length - 1; i++) {
                var dataCols = dataCol[j].split('|');
                //选择与datacols相应列进行修改
                if (option.cols[0][i + 1]["field"] == dataCols[5]) {
                  //隐藏列
                  if (dataCols[1] == 1) {
                    option.cols[0][i + 1]["hide"] = true;
                  }
                  //设置列宽
                  if (dataCols[3] > 0) {
                    option.cols[0][i + 1]["width"] = dataCols[3];
                  }
                  //设置内容字体大小
                  if (data1.data[0].HFontSize != 0) {
                    option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
                  } else {
                    option.cols[0][i + 1]["style"] = "font-size:100%";
                  }
                  //显示列
                  if (dataCols[1] == 0 && this.titleData.indexOf(option.cols[0][i + 1]["title"]) == -1) {
                    option.cols[0][i + 1]["hide"] = false;
                  }
                  //统计列
                  if (dataCols[6] == 1) {
                    option.cols[0][i + 1]["totalRow"] = true;
                  } else {
                    option.cols[0][i + 1]["totalRow"] = false;
                  }
                  //字体所在位置(左 居中 右)
                  switch (dataCols[2]) {
                    case "L":
                      option.cols[0][i + 1]["align"] = "left";
                      break;
                    case "M":
                      option.cols[0][i + 1]["align"] = "center";
                      break;
                    case "R":
                      option.cols[0][i + 1]["align"] = "right";
                      break;
                  }
                  //设置表格title属性显示别名
                  if (dataCols[4] != null && dataCols[4] != "") {
                    option.cols[0][i + 1]["title"] = dataCols[4];
                  }
                  newCols[0].push(option.cols[0][i + 1]);
                  break;
                }
              }
            }
            //遍历循环后判断对应列数是否一致
            if (dataCol.length == newCols[0].length - 1) {
              option.cols = newCols;
              //取消冻结列
              for (var i = 1; i < option.cols[0].length - 1; i++) {
                if (option.cols[0][i + 1]["fixed"] != null) {
                  option.cols[0][i + 1]["fixed"] = null;
                }
                else {
                  break;
                }
              }
              //冻结列
              if (data1.data[0].HFixCols != 0) {
                for (var i = 0; i < data1.data[0].HFixCols; i++) {
                  if (dataOption.cols[0].indexOf(option.cols[0][i + 1]["title"]) != -1) {
                    data1.data[0].HFixCols += 1;
                  }
                  option.cols[0][i + 1]["fixed"] = "left";
                }
              }
              //设置列排序
              for (var i = 1; i < option.cols[0].length; i++) {
                if (data1.data[0].HSortFlag == "是") {
                  option.cols[0][i]["sort"] = true;
                }
                else {
                  option.cols[0][i]["sort"] = false;
                }
              }
            }
          }
          this.btList = option.cols[0]
          this.btList.map(item => {
            if (!item.hide) {
              this.totalNameList.push(item)
            }
          })
          if (data1.data[0].HPageSize == 0) {
            this.pageSize = 50
          } else {
            this.pageSize = data1.data[0].HPageSize
          }
          this.allTableData = option.data//无分页接口分页
          this.tableData = this.getPage(this.page, this.allTableData)//无分页接口分页
          this.tableShow = true
          this.loading = false
        } else {
          this.btList = dataOption.cols[0]
          this.btList.map(item => {
            if (!item.hide) {
              this.totalNameList.push(item)
            }
          })
          this.allTableData = dataOption.data//无分页接口分页
          this.tableData = this.getPage(this.page, this.allTableData)//无分页接口分页
          this.tableShow = true
          this.loading = false
        }
      }).catch(error => {
        this.$modal.msgError("接口请求失败!");
      });
    },
    renderHeader(h, { column, $index }) {// 新建一个 span
      let span = document.createElement(span)// 设置表头名称
      span.innerText = column.label
      //临时插入 document
      document.body.appendChild(span)// 重点:获取 span 最小宽度,设置当前列,注意这里加了 20,字段较多时column.minWidth=span.getBoundingClientRect().width + 50.//移除 document 中临时的 span
      document.body.removeChild(span)
      return h(span, column.label)
    },
    //点击行
    handleRowClick(row, column, event) {
      this.lastSelectedRow = this.selectedRow; // 记录上一次选中的行
      this.selectedRow = row; // 记录当前选中的行
      this.lastSelectedRowIndex = this.tableData.indexOf(row);
      this.$refs.tableData.toggleRowSelection(row);
    },
    //选中行高亮样式
    rowStyle({ row, rowIndex }) {
      if (this.ids.includes(row.HEmpID)) {
        return { "background": "#ecf5ff" }
      }
    },
    //双击行
    handleDblclick(row, column, cell, event) {
      this.OperationType = 3
      this.handleEdit()
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      // this.rowForm = {}
      this.ids = selection.map(item => item.HEmpID)
      this.single = selection.length != 1
      this.multiple = !selection.length
      if (!this.single) {
        this.rowForm = selection[0]
      }
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.sWhere = ''
      if (this.queryParams.ColName && this.queryParams.Comparator) {
        var com = "";
        switch (this.queryParams.Comparator) {
          case "7":
            com = "like'%" + this.queryParams.ColContent + "%'";
            break;
          case "8":
            com = "like'%" + this.queryParams.ColContent + "'";
            break;
          case "9":
            com = "like'" + this.queryParams.ColContent + "%'";
            break;
          case "10":
            com = "not like'%" + this.queryParams.ColContent + "%'";
            break;
          default:
            com = "" + this.queryParams.Comparator + "'" + this.queryParams.ColContent + "'";
            break;
        }
        this.sWhere += " and " + this.queryParams.ColName + " " + com;
      }
      if (this.queryParams.ColName1 && this.queryParams.Comparator1) {
        var com1 = "";
        switch (this.queryParams.Comparator1) {
          case "7":
            com1 = "like'%" + this.queryParams.ColContent1 + "%'";
            break;
          case "8":
            com1 = "like'%" + this.queryParams.ColContent1 + "'";
            break;
          case "9":
            com1 = "like'" + this.queryParams.ColContent1 + "%'";
            break;
          case "10":
            com1 = "not like'%" + this.queryParams.ColContent1 + "%'";
            break;
          default:
            com1 = "" + this.queryParams.Comparator1 + "'" + this.queryParams.ColContent1 + "'";
            break;
        }
        this.sWhere += " and " + this.queryParams.ColName1 + " " + com1;
      }
      if (this.queryParams.ColName2 && this.queryParams.Comparator2) {
        var com2 = "";
        switch (this.queryParams.Comparator2) {
          case "7":
            com2 = "like'%" + this.queryParams.ColContent2 + "%'";
            break;
          case "8":
            com2 = "like'%" + this.queryParams.ColContent2 + "'";
            break;
          case "9":
            com2 = "like'" + this.queryParams.ColContent2 + "%'";
            break;
          case "10":
            com2 = "not like'%" + this.queryParams.ColContent2 + "%'";
            break;
          default:
            com2 = "" + this.queryParams.Comparator + "'" + this.queryParams.ColContent + "'";
            break;
        }
        this.sWhere += " and " + this.queryParams.ColName2 + " " + com2;
      }
      if (this.queryParams.HNumber) {
        this.sWhere += " and 用户编码 like '%" + this.queryParams.HNumber + "%'";
      }
      if (this.queryParams.HName) {
        this.sWhere += " and 用户名称 like '%" + this.queryParams.HName + "%'";
      }
      // if (this.queryParams.HUSEORGID) {
      //   this.sWhere += " and HUSEORGID = '" + this.queryParams.HUSEORGID + "'"
      // }
      // this.sWhere += this.addSWhereByOpenType()
      // this.sWhere += this.getOrgIDByUser()
      this.getList()
    },
    // 判断是直接打开页面还是其它页面通过选择按钮打开,并显示相应数据
    addSWhereByOpenType() {
      //获取参数
      var sWhere = "";
      //this.openPage判断是否有值,有代表其它页面通过选择按钮打开
      if (this.openPage) {
        sWhere += " and 禁用标记 != 'Y' and ISNULL(审核人,'')  != ''"
        return sWhere;
      }
      return sWhere;
    },
    //根据用户获取用户关联组织的过滤条件
    getOrgIDByUser() {
      var res = "";
      axios.get(this.baseURL + '/Xt_User/getOrgIDListByUser', {
        params: {
          HModName: this.HModName,
          user: sessionStorage["HUserName"],
          HOrgID: sessionStorage["OrganizationID"]
        },
      }).then(response => {
        let result = response.data
        if (result.count == 1) {
          if (result.data[0].sWhere == "1") {
            res = " and HUSEORGID = '" + sessionStorage["OrganizationID"] + "'";
          } else {
            res = result.data[0].sWhere;
          }
        }
      }).catch(error => {
        res = " and 1 = 0";
        this.$modal.msgError("接口请求失败!");
      });
      return res;
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.sWhere = ''
      this.queryParams = {
        // HOrgID: null,
        HName: null,
        HNumber: null,
        Comparator1: '',
        Comparator2: '',
        Comparator: '',
        ColContent1: '',
        ColContent2: '',
        ColContent: '',
      }
      this.resetForm("queryForm")
      this.getList()
    },
    //退出
    close() {
      this.tableShow = true
      this.openEdit = false
      this.editShow = false
      this.getList()
    },
    //打开新增组件弹窗
    handleAddEdit() {
      this.rowForm.HEmpID = 0
      this.$nextTick(() => {
        this.openEdit = true
        this.editShow = true
      })
    },
    //打开修改组件弹窗
    handleEdit() {
      this.$nextTick(() => {
        this.openEdit = true
        this.editShow = true
      })
    },
    //关闭编辑页面
    editGyClose(val) {
      this.editShow = false
      this.openEdit = false
      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("接口请求失败!");
          });
      }).catch(() => { })
    },
    //导出
    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, `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)
      }, 100)
    },
  }
};
</script>
<style>
.xsckdBox .el-date-editor.el-input {
  width: 100%;
}
</style>