| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425 |
- <template>
- <div class="app-container zap-main">
- <el-row>
- <!--部门数据-->
- <el-col class="zap-bg zap-user-department">
- <div class="head-container">
- <el-input v-model="deptName" placeholder="请输入部门名称" clearable prefix-icon="el-icon-search" style="margin-bottom: 20px" />
- </div>
- <div class="head-container">
- <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" default-expand-all @node-click="handleNodeClick" />
- </div>
- </el-col>
- <!--//用户数据-->
- <el-col style="width: calc(100% - 273px);">
- <search-bar :checkList="checkList" :tableList="tableList" :selfDom="selfDom" :tableId="tableId" @query="handleQuery" @reset="resetQuery">
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="手机号" prop="userName">
- <el-input v-model="queryParams.userName" placeholder="请输入手机号" clearable size="small" style="width: 240px" maxlength="11" @keyup.enter.native="handleQuery" />
- </el-form-item>
- <el-form-item label="用户姓名" prop="nickName">
- <el-input v-model="queryParams.nickName" placeholder="请输入用户姓名" clearable size="small" style="width: 240px" maxlength="30" @keyup.enter.native="handleQuery" />
- </el-form-item>
- <el-form-item label="状态" prop="status">
- <el-select v-model="queryParams.status" placeholder="用户状态" clearable size="small" style="width: 240px">
- <el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
- </el-select>
- </el-form-item>
- <el-form-item label="创建时间">
- <el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd" type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
- </el-form-item>
- </el-form>
- </search-bar>
- <div class="zap-content">
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button type="primary" icon="el-icon-plus" size="medium " @click="handleAdd" v-hasPermi="['system:user:add']">新增</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button type="warning" icon="el-icon-download" size="medium " @click="handleExport" v-hasPermi="['system:ownUser:export']">导出</el-button>
- </el-col>
- </el-row>
- <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" stripe>
- <el-table-column label="序号" type="index" width="50" align="center">
- <template slot-scope="scope">
- <span>{{
- (queryParams.pageNum - 1) * queryParams.pageSize +
- scope.$index +
- 1
- }}</span>
- </template>
- </el-table-column>
- <el-table-column label="用户编号" align="center" prop="userId" v-if="uncheckList.userId" />
- <el-table-column label="手机号" align="center" prop="userName" :show-overflow-tooltip="true" v-if="uncheckList.userName" />
- <el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" v-if="uncheckList.nickName" />
- <el-table-column label="企业名称" align="center" prop="scyName" :show-overflow-tooltip="true" v-if="uncheckList.scyName" />
- <el-table-column label="部门名称" align="center" prop="deptName" :show-overflow-tooltip="true" v-if="uncheckList.deptName" />
- <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" :formatter="stateFormat" v-if="uncheckList.status" />
- <el-table-column label="创建时间" align="center" prop="createTime" width="155" v-if="uncheckList.createTime">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.createTime) }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right">
- <template slot-scope="scope">
- <el-button class="zap-button-success" size="mini" type="text" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']">修改</el-button>
- <el-button class="zap-button-primary" size="mini" type="text" @click="handleChange(scope.row)" v-hasPermi="['system:ownUser:adminChange']" v-if="
- scope.row.scyType == '03' &&
- company.scyId != '000000' &&
- scope.row.sucrHandler == '0'
- ">变更管理员</el-button>
- <el-button class="zap-button-primary" size="mini" type="text" @click="handleHandler(scope.row)" v-hasPermi="['system:ownUser:handlerChange']" v-if="
- scope.row.scyType != '03' &&
- qperator == '1' &&
- scope.row.sucrHandler == '0' &&
- handleCompany == '01' &&
- company.scyId != '000000'
- ">申请变更经办人</el-button>
- <el-button class="zap-button-primary" size="mini" type="text" @click="confirmHandler(scope.row)" v-hasPermi="['system:ownUser:confirmChange']" v-if="
- scope.row.scyType != '03' &&
- qperator == '1' &&
- scope.row.handleChange == '00' &&
- company.scyId == '000000'
- ">确认变更经办人</el-button>
- <el-button v-if="scope.row.userId !== 1" class="zap-button-confirmation" size="mini" type="text" @click="handleDelete(scope.row)" v-hasPermi="['system:user:remove']">删除</el-button>
- <el-button v-if="scope.row.status == '0'" class="zap-button-plain" size="mini" type="text" @click="handleResetPwd(scope.row)" v-hasPermi="['system:user:resetPwd']">重置</el-button>
- <el-button v-if="scope.row.status != '0'" class="zap-button-primary" size="mini" type="text" @click="handleStatusChange(scope.row)" v-hasPermi="['system:user:statusChange']">解冻</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
- </div>
- </el-col>
- </el-row>
- <!-- 添加或修改参数配置对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-row>
- <!-- <el-form-item label="公司名称" prop="payroll" v-show="companyId == '000000'">
- <el-select v-model="form.companyId" @change="getRodept">
- <el-option
- v-for="(item, index) in companyList"
- :key="index" :label="item.scyName"
- :value="item.scyId">
- </el-option>
- </el-select>
- </el-form-item> -->
- <el-row>
- <el-col :span="12">
- <el-form-item label="手机号" prop="userName">
- <el-input clearable v-model="form.userName" placeholder="请输入手机号" maxlength="11" :disabled="isUpdate" />
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="用户姓名" prop="nickName">
- <el-input clearable v-model="form.nickName" placeholder="请输入用户姓名" maxlength="50" :disabled="isName" />
- </el-form-item>
- </el-col>
- </el-row>
- <!-- <el-col :span="12" v-if="rodeptShow"> -->
- <el-col :span="12">
- <el-form-item label="归属部门" prop="deptId">
- <treeselect v-model="form.deptId" :options="rodeptOptions" :show-count="true" placeholder="请选择归属部门" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="邮箱" prop="email">
- <el-input clearable v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="角色" prop="roleIds">
- <el-select v-model="form.roleIds" multiple placeholder="请选择">
- <el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId" v-if="item.status == 0"></el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <el-form-item label="备注">
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" maxlength="300"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <!-- 申请变更经办人-->
- <el-dialog :title="titles" :visible.sync="imgs" width="800px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
- <el-form-item label="安心签开户及管理授权书(模板)" ><!-- style="display: inline-block;width: 50%;" -->
- <el-upload ref="upload" class="upload-demo" :class="{ uoloadSty: showBtnImg, disUoloadSty: noneBtnImg }" action="" accept=".jpg, .jpeg, .png" :http-request="sfzRequest" :on-preview="handlePictureCardPreview" :before-upload="beforeAvatarUpload" :on-remove="beforeRemove" :on-change="dealImgChange" multiple :limit="1" :on-exceed="handleExceed" list-type="picture-card" :file-list="sfzList" :auto-upload="true">
- <el-button slot="trigger" size="small" type="primary">点击选择</el-button>
- <div class="el-upload__tip" slot="tip">
- <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据 -->
- <el-link type="info" style="font-size: 12px" @click="authorizationTemplate">下载模板</el-link>
- </div>
- </el-upload>
- </el-form-item>
- <el-form-item label="安心签用户信息变更申请表" ><!-- style="display: inline-block;" -->
- <el-upload ref="upload" class="upload-demo" :class="{ uoloadAxq: showsBtnImg, disUoloadAxq: nonesBtnImg }" action="" accept=".jpg, .jpeg, .png" :http-request="sqsRequest" :on-preview="sqsPictureCardPreview" :before-upload="beforeAvatarUpload" :on-remove="sqsRemove" :on-change="dealImgChange" multiple :limit="1" :on-exceed="sqsExceed" list-type="picture-card" :file-list="sqsList" :auto-upload="true">
- <el-button slot="trigger" size="small" type="primary">点击选择</el-button>
- <div class="el-upload__tip" slot="tip">
- <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据 -->
- <el-link type="info" style="font-size: 12px" @click="applicationTemplate">下载模板</el-link>
- </div>
- </el-upload>
- </el-form-item>
- <el-row>
- <el-col>身份证号:</el-col>
- <el-input
- v-model="form.card"
- placeholder="请输入身份证号"
- maxlength="20"
- ></el-input>
- </el-row>
- <el-form-item>
- <el-row class="zap-idcard zap-margin">
- <div class="zap-certification-title">
- <div class="zap-certification-title__wrap">
- <span class="main-title">账号管理员身份证件</span>
- <span class="sub-title">(请按照要求上传经办人身份证证件图片)</span>
- <div class="warning"><i class="el-icon-warning-outline"></i>请核对系统识别结果是否正确</div>
- </div>
- </div>
- <el-row>
- <el-col :span="12" class="zap-idcard__wrap">
- <el-upload
- ref="jsfzzload"
- class="zap-idcard__upload"
- action=""
- :class="{
- uoloadjsfzz: showBtnImg,
- jsfzzUoloadSty: jsfzzBtnImg,
- }"
- :on-change="jsfzzImgChange"
- accept=".jpg, .jpeg, .png"
- :http-request="jsfzzRequest"
- :on-preview="jsfzzPictureCardPreview"
- :on-remove="jsfzzRemove"
- :before-upload="checkUpload"
- multiple
- :limit="1"
- :on-exceed="jsfzzExceed"
- list-type="picture-card"
- :file-list="jsfzzList"
- :auto-upload="true"
- >
- <img slot="trigger" src="../../../assets/images/certification/idcard_obverse.png" alt="">
- </el-upload>
- </el-col>
- <el-col :span="12" class="zap-idcard__wrap">
- <el-upload
- ref="jsfzfload"
- class="zap-idcard__upload"
- action=""
- :class="{
- uoloadjsfzf: showBtnImg,
- jsfzfUoloadSty: jsfzfBtnImg,
- }"
- :on-change="jsfzfImgChange"
- accept=".jpg, .jpeg, .png"
- :http-request="jsfzfRequest"
- :on-preview="jsfzfPictureCardPreview"
- :on-remove="jsfzfRemove"
- :before-upload="checkUpload"
- multiple
- :limit="1"
- :on-exceed="jsfzfExceed"
- list-type="picture-card"
- :file-list="jsfzfList"
- :auto-upload="true"
- >
- <img slot="trigger" src="../../../assets/images/certification/idcard_reverse.png" alt="">
- </el-upload>
- </el-col>
- </el-row>
- </el-row>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitImg">确 定</el-button>
- <el-button @click="cancelImg">取 消</el-button>
- </div>
- </el-dialog>
- <!-- 重置密码 -->
- <el-dialog :title="title" :visible.sync="openPassWord" width="700px" append-to-body>
- <el-form ref="form" :model="form" :rules="rulesPassWord" label-width="80px">
- <el-row>
- <el-col :span="24">
- <el-form-item label="密码" prop="password">
- <el-input v-model="form.password" placeholder="请输入密码" show-password maxlength="20"></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="rulesSubmitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- <!-- 用户导入对话框 -->
- <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
- <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">
- 将文件拖到此处,或
- <em>点击上传</em>
- </div>
- <div class="el-upload__tip" slot="tip">
- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
- <el-link type="info" style="font-size: 12px" @click="importTemplate">下载模板</el-link>
- </div>
- <div class="el-upload__tip" style="color: red" slot="tip">
- 提示:仅允许导入“xls”或“xlsx”格式文件!
- </div>
- </el-upload>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitFileForm">确 定</el-button>
- <el-button @click="upload.open = false">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- listUser,
- getUser,
- delUser,
- addUser,
- updateUser,
- resetUserPwd,
- changeUserStatus,
- getUserProfile,
- getNowUser,
- getRoleDept,
- companyList,
- adminChange,
- handlerChange,
- selectNormalUser,
- qperatorQuery,
- handlerDo,
- handleUser,
- } from "@/api/system/user";
- import {
- uploadFileNew
- } from "@/api/common/file";
- import {
- getToken
- } from "@/utils/auth";
- import {
- treeselect
- } from "@/api/system/dept";
- import Treeselect from "@riophae/vue-treeselect";
- import {
- getOwnCompany
- } from "@/api/common/company";
- import "@riophae/vue-treeselect/dist/vue-treeselect.css";
- import {
- columnQuery,
- columnfilter
- } from "@/api/common/columnSetting";
- import ColumnSetting from "../../../components/Table/columnSetting.vue";
- import Cookies from "js-cookie";
- import SearchBar from '@/components/SearchBar/index.vue';
- import {getCard} from "@/api/system/authentication";
- export default {
- name: "User",
- components: {
- Treeselect,
- ColumnSetting,
- SearchBar
- },
- data() {
- return {
- //图片预览
- sfzImageUrl: "",
- sfzVisible: false,
- sqsImageUrl: "",
- sqsVisible: false,
- showBtnImg: false,
- noneBtnImg: false,
- showsBtnImg: false,
- nonesBtnImg: false,
- sfzList: [],
- sqsList: [],
- limitCountImg: 1,
- handleCompany: null,
- company: null,
- qperator: null,
- //当前登录用户企业id
- signCompanyId: "",
- //姓名
- nameList: [],
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: true,
- rodeptShow: false,
- roleShow: false,
- // 总条数
- total: 0,
- // 用户表格数据
- userList: null,
- // 弹出层标题
- title: "",
- titles: "",
- // 部门树选项
- deptOptions: undefined,
- rodeptOptions: undefined,
- // 是否显示弹出层
- open: false,
- imgs: false,
- openPassWord: false,
- isName: false,
- //离职日期
- leave: false,
- // 部门名称
- deptName: undefined,
- // 默认密码
- initPassword: undefined,
- companyId: "",
- // 日期范围
- dateRange: [],
- // 状态数据字典
- statusOptions: [],
- // 性别状态字典
- sexOptions: [],
- //学历字典
- educationOptions: [],
- // 岗位选项
- postOptions: [],
- // 角色选项
- roleOptions: [],
- companyList: [],
- // 表单参数
- form: {},
- jsfzzBtnImg:false,
- jsfzfBtnImg:false,
- showBtnImg:false,
- jsfzzList : [],
- jsfzfList : [],
- //筛选按钮的数据列表,与table表头的数据一致 --显示隐藏列用
- tableList: [{
- label: "userId",
- value: "用户编号",
- },
- {
- label: "userName",
- value: "手机号",
- },
- {
- label: "nickName",
- value: "用户姓名",
- },
- {
- label: "scyName",
- value: "企业名称",
- },
- {
- label: "deptName",
- value: "部门",
- },
- {
- label: "status",
- value: "状态",
- },
- {
- label: "createTime",
- value: "创建时间",
- },
- ],
- checkList: [], //筛选列选中的数据列表--显示隐藏列用
- uncheckList: {}, //控制筛选列显示隐藏--显示隐藏列用
- selfDom: this,
- tableId: "/system/ownUser/list",
- defaultProps: {
- children: "children",
- label: "label",
- },
- // 用户导入参数
- upload: {
- // 是否显示弹出层(用户导入)
- open: false,
- // 弹出层标题(用户导入)
- title: "",
- // 是否禁用上传
- isUploading: false,
- // 是否更新已经存在的用户数据
- updateSupport: 0,
- // 设置上传的请求头部
- headers: {
- Authorization: "Bearer " + getToken()
- },
- // 上传的地址
- url: process.env.VUE_APP_BASE_API + "/system/user/importData",
- },
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- userName: undefined,
- phonenumber: undefined,
- status: undefined,
- deptId: undefined,
- },
- uinParams: {
- ssId: null,
- ssName: null,
- pageNum: 1,
- pageSize: 10,
- },
- // 表单校验
- rules: {
- roleIds: [{
- required: true,
- message: "角色不能为空",
- trigger: ["blur", "change"],
- }, ],
- userName: [{
- required: true,
- message: "手机号不能为空",
- trigger: "blur",
- },
- {
- pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
- message: "请输入正确的手机号码",
- trigger: ["blur", "change"],
- },
- ],
- nickName: [{
- required: true,
- message: "用户姓名不能为空",
- trigger: ["blur", "change"],
- },
- {
- pattern: /^[A-Za-z\u4e00-\u9fa5]+$/,
- message: "用户姓名不能带有特殊字符",
- trigger: ["blur", "change"],
- },
- ],
- deptId: [{
- required: true,
- message: "归属部门不能为空",
- trigger: ["blur", "change"],
- }, ],
- postIds: [{
- required: true,
- message: "用户职级不能为空",
- trigger: "blur",
- }, ],
- email: [
- /* {
- required: true,
- message: "邮箱地址不能为空",
- trigger: "blur",
- }, */
- {
- // type: "email",
- pattern: /^([a-z0-9A-Z]+[-|_|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$/,
- message: "邮箱格式不正确",
- trigger: ["blur", "change"],
- },
- ],
- phonenumber: [{
- required: true,
- message: "手机号码不能为空",
- trigger: "blur",
- },
- {
- pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
- message: "请输入正确的手机号码",
- trigger: ["blur", "change"],
- },
- ],
- },
- rulesPassWord: {
- password: [{
- required: true,
- message: "用户密码不能为空",
- trigger: "blur",
- },
- {
- pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/,
- message: "密码请包含数字,英文,字符中的两种以上,长度6-20位",
- trigger: ["blur", "change"],
- },
- ],
- },
- peoplpeName: false,
- isUpdate: false,
- };
- },
- watch: {
- // 根据名称筛选部门树
- deptName(val) {
- this.$refs.tree.filter(val);
- },
- "form.userName": "getLoginName",
- },
- created() {
- this.getList();
- this.getNowUser();
- this.getTreeselect();
- this.getUserProfile();
- this.getDicts("sys_normal_disable").then((response) => {
- this.statusOptions = response.data;
- });
- this.getDicts("sys_user_sex").then((response) => {
- this.sexOptions = response.data;
- });
- this.getConfigKey("sys.user.initPassword").then((response) => {
- this.initPassword = response.msg;
- });
- this.getDicts("education").then((response) => {
- this.educationOptions = response.data;
- });
- },
- mounted() {
- this.columnQuery();
- },
- methods: {
- jsfzzImgChange(file, jsfzzList) {
- this.jsfzzBtnImg = jsfzzList.length >= this.limitCountImg;
- },
- jsfzzRemove(file, jsfzzList) {
- for (let i = 0; i < this.jsfzzList.length; i++) {
- if (file.uid == thisjsfzzList[i].uid) {
- this.jsfzzList.splice(i, 1);
- break;
- }
- }
- this.jsfzzBtnImg = jsfzzList.length >= this.limitCountImg;
- },
- jsfzzExceed(file, jsfzzList) {
- this.$message.warning(`当前限制选择 1 个文件`);
- },
- jsfzfRemove(file, jsfzfList) {
- for (let i = 0; i < this.jsfzfList.length; i++) {
- if (file.uid == this.jsfzfList[i].uid) {
- this.jsfzfList.splice(i, 1);
- break;
- }
- }
- this.jsfzfBtnImg = jsfzfList.length >= this.limitCountImg;
- },
- jsfzfExceed(file, jsfzfList) {
- this.$message.warning(`当前限制选择 1 个文件`);
- },
- jsfzzPictureCardPreview(file) {
- this.jsfzzImageUrl = file.url;
- this.jsfzzVisible = true;
- },
- jsfzfPictureCardPreview(file) {
- this.jsfzfImageUrl = file.url;
- this.jsffzVisible = true;
- },
- jsfzfImgChange(file, jsfzfList) {
- this.jsfzfBtnImg = jsfzfList.length >= this.limitCountImg;
- },
- //经办人身份证正面
- jsfzzRequest(param) {
- let fileObj = param.file; // 相当于input里取得的files
- let fd = new FormData(); // FormData 对象
- fd.append("file", fileObj); // 文件对象
- fd.append("fileType", "01");
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- getCard(fd)
- .then((response) => {
- if (response) {
- this.$set(this.form, "card", response.data.handlerCard);
- this.$set(this.form, "jsfzzList", response.data.jsfzzList);
- setTimeout(() => {
- loading.close();
- }, 2000);
- }
- })
- .catch((response) => {
- let uid = fileObj.uid; // 关键作用代码,去除文件列表失败文件
- let idx = this.$refs.jsfzzload.uploadFiles.findIndex(
- (item) => item.uid === uid
- ); // 关键作用代码,去除文件列表失败文件(uploadFiles为el-upload中的ref值)
- this.$refs.jsfzzload.uploadFiles.splice(idx, 1); // 关键作用代码,去除文件列表失败文件
- this.jsfzzBtnImg = this.jsfzzList.length >= this.limitCountImg;
- loading.close();
- });
- },
- //经办人身份证反面
- jsfzfRequest(param) {
- let fileObj = param.file; // 相当于input里取得的files
- let fd = new FormData(); // FormData 对象
- fd.append("file", fileObj); // 文件对象
- fd.append("fileType", "03");
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- getCard(fd)
- .then((response) => {
- if (response) {
- this.$set(this.form, "jsfzfList", response.data.jsfzfList);
- setTimeout(() => {
- loading.close();
- }, 2000);
- }
- })
- .catch((response) => {
- let uid = fileObj.uid; // 关键作用代码,去除文件列表失败文件
- let idx = this.$refs.jsfzfload.uploadFiles.findIndex(
- (item) => item.uid === uid
- ); // 关键作用代码,去除文件列表失败文件(uploadFiles为el-upload中的ref值)
- this.$refs.jsfzfload.uploadFiles.splice(idx, 1); // 关键作用代码,去除文件列表失败文件
- this.jsfzfBtnImg = this.jsfzfList.length >= this.limitCountImg;
- loading.close();
- });
- },
- //上传前校验
- checkUpload(file) {
- const isJPG =
- file.type === "image/jpeg" ||
- file.type === "image/png";
- const isLt2M = file.size / 1024 / 1024 < 3;
- if (!isJPG) {
- this.$message.error("上传图片只能是 JPG/PNG/ 格式");
- }
- if (!isLt2M) {
- this.$message.error("上传图片大小不能超过 3MB");
- }
- return isJPG && isLt2M;
- },
- //获取当前客户是否之前设置过列展示隐藏
- columnQuery() {
- //获取页面路径
- var psfPagePath = window.location.pathname;
- //用请求后台的url作为唯一标识
- var psfTableName = this.tableId;
- var columnForm = {};
- columnForm.psfPagePath = psfPagePath;
- columnForm.psfTableName = psfTableName;
- columnQuery(columnForm).then((response) => {
- if (response.data && response.data.psfShowData) {
- this.checkList = response.data.psfShowData;
- }
- this.filter();
- });
- },
- //控制隐藏显示的函数
- filter(checkList) {
- if (!!checkList) {
- this.checkList = checkList;
- }
- columnfilter(this.selfDom);
- },
- getLoginName(item) {
- const userName = item;
- selectNormalUser(userName).then((response) => {
- console.log(response, "根据手机号获取用户姓名");
- if (response.data.length > 0) {
- this.$set(this.form, "nickName", response.data[0].nickName);
- this.isName = true;
- } else {
- this.$set(this.form, "nickName", "");
- this.isName = false;
- }
- });
- },
- //获取当前用户信息
- getNowUser() {
- getNowUser().then((response) => {
- this.signCompanyId = response.data.companyId;
- });
- },
- stateFormat(row, column) {
- return this.selectDictLabel(this.statusOptions, row.status);
- },
- //根据企业id查询部门和角色信息
- getRodept(item) {
- if (item) {
- this.rodeptShow = true;
- const companyId = item;
- getRoleDept(companyId).then((response) => {
- if (response.deptList.length > 0) {
- this.rodeptOptions = response.deptList;
- } else {
- this.rodeptOptions = undefined;
- }
- if (response.roleList.length > 0) {
- this.roleOptions = response.roleList;
- } else {
- this.roleOptions = [];
- }
- });
- }
- },
- getUserProfile() {
- var sscDomain = document.location.hostname;
- getUserProfile(sscDomain).then((response) => {
- this.companyId = response.data.companyId;
- });
- },
- /** 查询用户列表 */
- getList() {
- this.loading = true;
- listUser(this.addDateRange(this.queryParams, this.dateRange)).then(
- (response) => {
- let userList = response.rows;
- for (let i = 0; i < userList.length; i++) {
- handlerDo(userList[i]).then((response) => {
- userList[i].handleChange = response.data.handleChange;
- });
- }
- this.userList = userList;
- this.total = response.total;
- this.loading = false;
- }
- );
- handleUser().then((response) => {
- this.handleCompany = response.data.handleCompany;
- });
- getOwnCompany().then((response) => {
- this.company = response.data;
- });
- qperatorQuery().then((response) => {
- this.qperator = response.data[0].sucrHandler;
- });
- },
- /** 查询部门下拉树结构 */
- getTreeselect() {
- treeselect().then((response) => {
- this.deptOptions = response.data;
- });
- },
- /** 查询部门下拉树结构 */
- getFormTreeselect() {
- treeselect().then((response) => {
- this.rodeptOptions = response.data;
- });
- },
- // 筛选节点
- filterNode(value, data) {
- if (!value) return true;
- return data.label.indexOf(value) !== -1;
- },
- // 节点单击事件
- handleNodeClick(data) {
- this.queryParams.deptId = data.id;
- this.getList();
- },
- // 用户状态修改
- handleStatusChange(row) {
- const userId = row.userId || this.ids;
- const nickNames = row.nickName || this.ids;
- const status = "0";
- this.$confirm(
- '是否确认解冻用户姓名为"' + nickNames + '"的数据项?',
- "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- )
- .then(function () {
- return changeUserStatus(userId, status);
- })
- .then(() => {
- this.getList();
- this.msgSuccess("解冻成功");
- })
- .catch(() => {
- this.$message({
- type: "warning",
- message: "已取消解冻",
- });
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.openPassWord = false;
- this.reset();
- },
- // 取消按钮
- cancelImg() {
- this.imgs = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- userId: undefined,
- deptId: undefined,
- userName: undefined,
- nickName: undefined,
- password: undefined,
- phonenumber: null,
- email: undefined,
- sex: undefined,
- status: "0",
- remark: undefined,
- postIds: [],
- roleIds: [],
- nameList: [],
- jsfzzList :[],
- jsfzfList :[]
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.queryParams.pageSize = 10;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.dateRange = [];
- this.queryParams = {
- pageNum: 1,
- pageSize: 10,
- userName: undefined,
- phonenumber: undefined,
- status: undefined,
- deptId: undefined,
- };
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map((item) => item.userId);
- this.single = selection.length != 1;
- this.multiple = !selection.length;
- },
- //文件移除提示
- beforeRemove(file, sfzList) {
- for (let i = 0; i < this.sfzList.length; i++) {
- if (file.uid == this.sfzList[i].uid) {
- this.sfzList.splice(i, 1);
- break;
- }
- }
- this.noneBtnImg = sfzList.length >= this.limitCountImg;
- },
- sqsRemove(file, sqsList) {
- for (let i = 0; i < this.sqsList.length; i++) {
- if (file.uid == this.sqsList[i].uid) {
- this.sqsList.splice(i, 1);
- break;
- }
- }
- this.nonesBtnImg = sqsList.length >= this.limitCountImg;
- },
- handleExceed(file, sfzList) {
- this.$message.warning(`当前限制选择 1 个文件`);
- },
- sqsExceed(file, sqsList) {
- this.$message.warning(`当前限制选择 1 个文件`);
- },
- //图片预览
- handlePictureCardPreview(file) {
- this.sfzImageUrl = file.url;
- this.sfzVisible = true;
- },
- sqsPictureCardPreview(file) {
- this.sqsImageUrl = file.url;
- this.sqsVisible = true;
- },
- dealImgChange(file, sfzList) {
- this.noneBtnImg = sfzList.length >= this.limitCountImg;
- },
- dealImgChange(file, sqsList) {
- this.nonesBtnImg = sqsList.length >= this.limitCountImg;
- },
- //上传
- // submitUpload() {
- // this.$refs.upload.submit();
- // },
- // sqsUpload() {
- // this.$refs.upload.submit();
- // },
- //手动上传文件触发
- sfzRequest(param) {
- let fileObj = param.file; // 相当于input里取得的files
- let fd = new FormData(); // FormData 对象
- fd.append("file", fileObj); // 文件对象
- fd.append("fileType", "00"); //文件类型
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- uploadFileNew(fd)
- .then((response) => {
- if (response) {
- this.sfzList.push({
- uid: response.fileId,
- url: response.url + "/" + getToken(),
- });
- setTimeout(() => {
- loading.close();
- }, 2000);
- }
- })
- .catch((response) => {
- console.log(this.$refs.upload, "删除路径")
- let uid = fileObj.uid; // 关键作用代码,去除文件列表失败文件
- let idx = this.$refs.upload.uploadFiles.findIndex(
- (item) => item.uid === uid
- ); // 关键作用代码,去除文件列表失败文件(uploadFiles为el-upload中的ref值)
- this.$refs.upload.uploadFiles.splice(idx, 1); // 关键作用代码,去除文件列表失败文件
- this.showBtnImg = false;
- loading.close();
- });
- },
- sqsRequest(param) {
- let fileObj = param.file; // 相当于input里取得的files
- let fd = new FormData(); // FormData 对象
- fd.append("file", fileObj); // 文件对象
- fd.append("fileType", "00"); //文件类型
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- uploadFileNew(fd)
- .then((response) => {
- if (response) {
- this.sqsList.push({
- uid: response.fileId,
- url: response.url + "/" + getToken(),
- });
- setTimeout(() => {
- loading.close();
- }, 2000);
- }
- })
- .catch((response) => {
- loading.close();
- });
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.roleShow = true;
- if (this.signCompanyId == "000000") {
- this.rodeptShow = false;
- } else if (this.signCompanyId != "000000") {
- this.rodeptShow = true;
- }
- this.isUpdate = false;
- this.isName = false;
- this.reset();
- this.peoplpeName = false;
- this.getFormTreeselect();
- getUser().then((response) => {
- this.postOptions = response.posts;
- this.roleOptions = response.roles;
- this.open = true;
- this.leave = false;
- this.title = "添加用户";
- this.form.password = this.initPassword;
- });
- },
- /** 申请变更经办人 */
- handleHandler(row) {
- const userId = row.userId || this.ids;
- this.form.userIds = userId;
- this.imgs = true;
- this.titles = "申请变更经办人";
- },
- /** 确认变更经办人*/
- confirmHandler(row) {
- console.log(row);
- this.resetForm("queryForm");
- Cookies.set(
- "/user/detail/" + row.userId + "/" + row.scyId,
- this.$route.fullPath
- );
- this.$router.push({
- path: "/user/detail/" + row.userId + "/" + row.scyId,
- });
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- if (this.signCompanyId == "000000") {
- this.rodeptShow = false;
- } else if (this.signCompanyId != "000000") {
- this.rodeptShow = true;
- }
- this.isUpdate = true;
- this.isName = true;
- var self = this;
- this.reset();
- this.peoplpeName = true;
- this.getFormTreeselect();
- const userId = row.userId;
- const scyId = row.scyId;
- const remark = row.remark;
- const email = row.email;
- const deptId = row.deptId;
- const nickName = row.nickName;
- const userName = row.userName;
- if (remark) {
- this.$set(this.form, "remark", remark);
- }
- if (email) {
- this.$set(this.form, "email", email);
- }
- if (deptId) {
- this.$set(this.form, "deptId", deptId);
- }
- if (nickName) {
- this.$set(this.form, "nickName", nickName);
- }
- if (userName) {
- this.$set(this.form, "userName", userName);
- }
- if (userId) {
- this.$set(this.form, "userId", userId);
- }
- if (scyId) {
- this.$set(this.form, "scyId", scyId);
- }
- getUser(userId, scyId).then((response) => {
- this.uinParams.ssId = response.data.staffCode;
- this.getRodept(scyId);
- this.postOptions = response.posts;
- this.roleOptions = response.roles;
- this.form.postIds = response.postIds;
- this.$set(this.form, "roleIds", response.roleIds);
- this.open = true;
- this.leave = true;
- this.title = "修改用户";
- });
- },
- /** 重置密码按钮操作 */
- handleResetPwd(row) {
- this.reset();
- this.getTreeselect();
- const userId = row.userId || this.ids;
- getUser(userId).then((response) => {
- this.openPassWord = true;
- this.title = "重置密码";
- this.form.userId = userId;
- });
- },
- rulesSubmitForm: function () {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- var userId = this.form.userId;
- var password = this.form.password;
- resetUserPwd(userId, password)
- .then((response) => {
- this.openPassWord = false;
- loading.close();
- this.msgSuccess("修改成功,新密码是:" + password);
- })
- .catch((response) => {
- loading.close();
- });
- }
- });
- },
- /** 申请变更经办人 */
- submitImg() {
- //身份证号
- if(!this.form.card){
- this.$message({
- message: "身份证号不能为空",
- type: 'warning'
- });
- return false;
- }
- if(!this.form.jsfzzList){
- this.$message({
- message: "请上传身份证人像面",
- type: 'warning'
- });
- return false;
- }
- if(!this.form.jsfzfList){
- this.$message({
- message: "请上传身份证国徽面",
- type: 'warning'
- });
- return false;
- }
- this.form.sfzList = this.sfzList;
- this.form.sqsList = this.sqsList;
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- handlerChange(this.form)
- .then((response) => {
- loading.close();
- this.msgSuccess("申请成功");
- this.imgs = false;
- this.getList();
- })
- .catch((response) => {
- loading.close();
- });
- },
- /** 提交按钮 */
- submitForm: function () {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- if (this.form.userId != undefined) {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- this.$set(this.form, "createTime", null);
- this.$set(this.form, "companyId", this.form.scyId);
- updateUser(this.form)
- .then((response) => {
- loading.close();
- this.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- })
- .catch((response) => {
- loading.close();
- });
- } else {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- addUser(this.form)
- .then((response) => {
- loading.close();
- this.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- })
- .catch((response) => {
- loading.close();
- });
- }
- }
- });
- },
- /** 变更权限按钮操作 */
- handleChange(row) {
- const userIds = row.userId || this.ids;
- const nickNames = row.nickName || this.ids;
- this.$confirm(
- '是否确认将用户姓名为"' + nickNames + '"变更为管理员?',
- "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- )
- .then(function () {
- return adminChange(userIds);
- })
- .then(() => {
- this.msgSuccess("变更成功");
- this.$store.dispatch("LogOut").then(() => {
- location.href = "/login";
- });
- })
- .catch(() => {
- this.$message({
- type: "warning",
- message: "已取消变更",
- });
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const userIds = row.userId || this.ids;
- const nickNames = row.nickName || this.ids;
- this.$confirm(
- '是否确认删除用户姓名为"' + nickNames + '"的数据项?',
- "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- }
- )
- .then(function () {
- return delUser(userIds);
- })
- .then(() => {
- this.getList();
- this.msgSuccess("删除成功");
- })
- .catch(() => {
- this.$message({
- type: "warning",
- message: "已取消删除",
- });
- });
- },
- /** 导出按钮操作 */
- // handleExport() {
- // this.download('system/ownUser/export', {
- // ...this.queryParams
- // }, `用户数据_${new Date().getTime()}.xlsx`)
- // },
- handleExport() {
- console.log(this.queryParams);
- console.log(this.dateRange);
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- this.download(
- "system/ownUser/export", {
- ...this.queryParams,
- ...this.dateRange,
- },
- `用户数据_${new Date().getTime()}.xlsx`
- );
- loading.close();
- },
- /** 导入按钮操作 */
- handleImport() {
- this.upload.title = "用户导入";
- this.upload.open = true;
- },
- /** 下载模板操作 */
- importTemplate() {
- this.download(
- "system/user/importTemplate", {
- ...this.queryParams,
- },
- `user_${new Date().getTime()}.xlsx`
- );
- },
- /** 安心签开户及管理授权书(模板) */
- authorizationTemplate() {
- this.download(
- "system/ownUser/authorization", {},
- `安心签开户及管理授权书(模板).docx`
- );
- },
- /** 安心签用户信息变更申请表 */
- applicationTemplate() {
- this.download(
- "system/ownUser/apply", {},
- `安心签用户信息变更申请表.xlsx`
- );
- },
- //上传前校验
- beforeAvatarUpload(file) {
- var testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
- const extension = testmsg === "jpg";
- const extension2 = testmsg === "jpeg";
- const extension3 = testmsg === "png";
- const extension4 = testmsg === "JPG";
- const extension5 = testmsg === "JPEG";
- const extension6 = testmsg === "PNG";
- if (
- !extension &&
- !extension2 &&
- !extension3 &&
- !extension4 &&
- !extension5 &&
- !extension6
- ) {
- this.$message.warning(`请选择图片格式文件`);
- }
- return extension || extension2 || extension3;
- // const isJPG =
- // file.type === "image/jpeg" ||
- // file.type === "image/png" ||
- // file.type === "image/bmp";
- // const isLt2M = file.size / 1024 / 1024 < 3;
- // if (!isJPG) {
- // this.$message.error("上传图片只能是 JPG/PNG/BMP 格式");
- // }
- // if (!isLt2M) {
- // this.$message.error("上传图片大小不能超过 3MB");
- // }
- // return isJPG && isLt2M;
- },
- // 文件上传中处理
- handleFileUploadProgress(event, file, fileList) {
- this.upload.isUploading = true;
- },
- // 文件上传成功处理
- handleFileSuccess(response, file, fileList) {
- this.upload.open = false;
- this.upload.isUploading = false;
- this.$refs.upload.clearFiles();
- this.$alert(response.msg, "导入结果", {
- dangerouslyUseHTMLString: true,
- });
- this.getList();
- },
- // 提交上传文件
- submitFileForm() {
- this.$refs.upload.submit();
- },
- },
- };
- </script>
- <style lang="scss">
- .zap-user-department {
- width: 253px;
- min-height: calc(100vh - 200px);
- padding: 20px;
- margin-right: 20px;
- }
- .jsfzfUoloadSty .el-upload--picture-card {
- display: none;
- }
- .jsfzzUoloadSty .el-upload--picture-card {
- display: none;
- }
- </style>
|