index.vue 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425
  1. <template>
  2. <div class="app-container zap-main">
  3. <el-row>
  4. <!--部门数据-->
  5. <el-col class="zap-bg zap-user-department">
  6. <div class="head-container">
  7. <el-input v-model="deptName" placeholder="请输入部门名称" clearable prefix-icon="el-icon-search" style="margin-bottom: 20px" />
  8. </div>
  9. <div class="head-container">
  10. <el-tree :data="deptOptions" :props="defaultProps" :expand-on-click-node="false" :filter-node-method="filterNode" ref="tree" default-expand-all @node-click="handleNodeClick" />
  11. </div>
  12. </el-col>
  13. <!--//用户数据-->
  14. <el-col style="width: calc(100% - 273px);">
  15. <search-bar :checkList="checkList" :tableList="tableList" :selfDom="selfDom" :tableId="tableId" @query="handleQuery" @reset="resetQuery">
  16. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  17. <el-form-item label="手机号" prop="userName">
  18. <el-input v-model="queryParams.userName" placeholder="请输入手机号" clearable size="small" style="width: 240px" maxlength="11" @keyup.enter.native="handleQuery" />
  19. </el-form-item>
  20. <el-form-item label="用户姓名" prop="nickName">
  21. <el-input v-model="queryParams.nickName" placeholder="请输入用户姓名" clearable size="small" style="width: 240px" maxlength="30" @keyup.enter.native="handleQuery" />
  22. </el-form-item>
  23. <el-form-item label="状态" prop="status">
  24. <el-select v-model="queryParams.status" placeholder="用户状态" clearable size="small" style="width: 240px">
  25. <el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel" :value="dict.dictValue" />
  26. </el-select>
  27. </el-form-item>
  28. <el-form-item label="创建时间">
  29. <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>
  30. </el-form-item>
  31. </el-form>
  32. </search-bar>
  33. <div class="zap-content">
  34. <el-row :gutter="10" class="mb8">
  35. <el-col :span="1.5">
  36. <el-button type="primary" icon="el-icon-plus" size="medium " @click="handleAdd" v-hasPermi="['system:user:add']">新增</el-button>
  37. </el-col>
  38. <el-col :span="1.5">
  39. <el-button type="warning" icon="el-icon-download" size="medium " @click="handleExport" v-hasPermi="['system:ownUser:export']">导出</el-button>
  40. </el-col>
  41. </el-row>
  42. <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" stripe>
  43. <el-table-column label="序号" type="index" width="50" align="center">
  44. <template slot-scope="scope">
  45. <span>{{
  46. (queryParams.pageNum - 1) * queryParams.pageSize +
  47. scope.$index +
  48. 1
  49. }}</span>
  50. </template>
  51. </el-table-column>
  52. <el-table-column label="用户编号" align="center" prop="userId" v-if="uncheckList.userId" />
  53. <el-table-column label="手机号" align="center" prop="userName" :show-overflow-tooltip="true" v-if="uncheckList.userName" />
  54. <el-table-column label="用户姓名" align="center" prop="nickName" :show-overflow-tooltip="true" v-if="uncheckList.nickName" />
  55. <el-table-column label="企业名称" align="center" prop="scyName" :show-overflow-tooltip="true" v-if="uncheckList.scyName" />
  56. <el-table-column label="部门名称" align="center" prop="deptName" :show-overflow-tooltip="true" v-if="uncheckList.deptName" />
  57. <el-table-column label="状态" align="center" prop="status" :show-overflow-tooltip="true" :formatter="stateFormat" v-if="uncheckList.status" />
  58. <el-table-column label="创建时间" align="center" prop="createTime" width="155" v-if="uncheckList.createTime">
  59. <template slot-scope="scope">
  60. <span>{{ parseTime(scope.row.createTime) }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width='300' fixed="right">
  64. <template slot-scope="scope">
  65. <el-button class="zap-button-success" size="mini" type="text" @click="handleUpdate(scope.row)" v-hasPermi="['system:user:edit']">修改</el-button>
  66. <el-button class="zap-button-primary" size="mini" type="text" @click="handleChange(scope.row)" v-hasPermi="['system:ownUser:adminChange']" v-if="
  67. scope.row.scyType == '03' &&
  68. company.scyId != '000000' &&
  69. scope.row.sucrHandler == '0'
  70. ">变更管理员</el-button>
  71. <el-button class="zap-button-primary" size="mini" type="text" @click="handleHandler(scope.row)" v-hasPermi="['system:ownUser:handlerChange']" v-if="
  72. scope.row.scyType != '03' &&
  73. qperator == '1' &&
  74. scope.row.sucrHandler == '0' &&
  75. handleCompany == '01' &&
  76. company.scyId != '000000'
  77. ">申请变更经办人</el-button>
  78. <el-button class="zap-button-primary" size="mini" type="text" @click="confirmHandler(scope.row)" v-hasPermi="['system:ownUser:confirmChange']" v-if="
  79. scope.row.scyType != '03' &&
  80. qperator == '1' &&
  81. scope.row.handleChange == '00' &&
  82. company.scyId == '000000'
  83. ">确认变更经办人</el-button>
  84. <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>
  85. <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>
  86. <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>
  87. </template>
  88. </el-table-column>
  89. </el-table>
  90. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  91. </div>
  92. </el-col>
  93. </el-row>
  94. <!-- 添加或修改参数配置对话框 -->
  95. <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body>
  96. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  97. <el-row>
  98. <!-- <el-form-item label="公司名称" prop="payroll" v-show="companyId == '000000'">
  99. <el-select v-model="form.companyId" @change="getRodept">
  100. <el-option
  101. v-for="(item, index) in companyList"
  102. :key="index" :label="item.scyName"
  103. :value="item.scyId">
  104. </el-option>
  105. </el-select>
  106. </el-form-item> -->
  107. <el-row>
  108. <el-col :span="12">
  109. <el-form-item label="手机号" prop="userName">
  110. <el-input clearable v-model="form.userName" placeholder="请输入手机号" maxlength="11" :disabled="isUpdate" />
  111. </el-form-item>
  112. </el-col>
  113. <el-col :span="12">
  114. <el-form-item label="用户姓名" prop="nickName">
  115. <el-input clearable v-model="form.nickName" placeholder="请输入用户姓名" maxlength="50" :disabled="isName" />
  116. </el-form-item>
  117. </el-col>
  118. </el-row>
  119. <!-- <el-col :span="12" v-if="rodeptShow"> -->
  120. <el-col :span="12">
  121. <el-form-item label="归属部门" prop="deptId">
  122. <treeselect v-model="form.deptId" :options="rodeptOptions" :show-count="true" placeholder="请选择归属部门" />
  123. </el-form-item>
  124. </el-col>
  125. </el-row>
  126. <el-row>
  127. <el-col :span="12">
  128. <el-form-item label="邮箱" prop="email">
  129. <el-input clearable v-model="form.email" placeholder="请输入邮箱" maxlength="50" />
  130. </el-form-item>
  131. </el-col>
  132. </el-row>
  133. <el-row>
  134. <el-col :span="12">
  135. <el-form-item label="角色" prop="roleIds">
  136. <el-select v-model="form.roleIds" multiple placeholder="请选择">
  137. <el-option v-for="item in roleOptions" :key="item.roleId" :label="item.roleName" :value="item.roleId" v-if="item.status == 0"></el-option>
  138. </el-select>
  139. </el-form-item>
  140. </el-col>
  141. </el-row>
  142. <el-row>
  143. <el-col :span="24">
  144. <el-form-item label="备注">
  145. <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" maxlength="300"></el-input>
  146. </el-form-item>
  147. </el-col>
  148. </el-row>
  149. </el-form>
  150. <div slot="footer" class="dialog-footer">
  151. <el-button type="primary" @click="submitForm">确 定</el-button>
  152. <el-button @click="cancel">取 消</el-button>
  153. </div>
  154. </el-dialog>
  155. <!-- 申请变更经办人-->
  156. <el-dialog :title="titles" :visible.sync="imgs" width="800px" append-to-body>
  157. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  158. <el-form-item label="安心签开户及管理授权书(模板)" ><!-- style="display: inline-block;width: 50%;" -->
  159. <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">
  160. <el-button slot="trigger" size="small" type="primary">点击选择</el-button>
  161. <div class="el-upload__tip" slot="tip">
  162. <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据 -->
  163. <el-link type="info" style="font-size: 12px" @click="authorizationTemplate">下载模板</el-link>
  164. </div>
  165. </el-upload>
  166. </el-form-item>
  167. <el-form-item label="安心签用户信息变更申请表" ><!-- style="display: inline-block;" -->
  168. <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">
  169. <el-button slot="trigger" size="small" type="primary">点击选择</el-button>
  170. <div class="el-upload__tip" slot="tip">
  171. <!-- <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据 -->
  172. <el-link type="info" style="font-size: 12px" @click="applicationTemplate">下载模板</el-link>
  173. </div>
  174. </el-upload>
  175. </el-form-item>
  176. <el-row>
  177. <el-col>身份证号:</el-col>
  178. <el-input
  179. v-model="form.card"
  180. placeholder="请输入身份证号"
  181. maxlength="20"
  182. ></el-input>
  183. </el-row>
  184. <el-form-item>
  185. <el-row class="zap-idcard zap-margin">
  186. <div class="zap-certification-title">
  187. <div class="zap-certification-title__wrap">
  188. <span class="main-title">账号管理员身份证件</span>
  189. <span class="sub-title">(请按照要求上传经办人身份证证件图片)</span>
  190. <div class="warning"><i class="el-icon-warning-outline"></i>请核对系统识别结果是否正确</div>
  191. </div>
  192. </div>
  193. <el-row>
  194. <el-col :span="12" class="zap-idcard__wrap">
  195. <el-upload
  196. ref="jsfzzload"
  197. class="zap-idcard__upload"
  198. action=""
  199. :class="{
  200. uoloadjsfzz: showBtnImg,
  201. jsfzzUoloadSty: jsfzzBtnImg,
  202. }"
  203. :on-change="jsfzzImgChange"
  204. accept=".jpg, .jpeg, .png"
  205. :http-request="jsfzzRequest"
  206. :on-preview="jsfzzPictureCardPreview"
  207. :on-remove="jsfzzRemove"
  208. :before-upload="checkUpload"
  209. multiple
  210. :limit="1"
  211. :on-exceed="jsfzzExceed"
  212. list-type="picture-card"
  213. :file-list="jsfzzList"
  214. :auto-upload="true"
  215. >
  216. <img slot="trigger" src="../../../assets/images/certification/idcard_obverse.png" alt="">
  217. </el-upload>
  218. </el-col>
  219. <el-col :span="12" class="zap-idcard__wrap">
  220. <el-upload
  221. ref="jsfzfload"
  222. class="zap-idcard__upload"
  223. action=""
  224. :class="{
  225. uoloadjsfzf: showBtnImg,
  226. jsfzfUoloadSty: jsfzfBtnImg,
  227. }"
  228. :on-change="jsfzfImgChange"
  229. accept=".jpg, .jpeg, .png"
  230. :http-request="jsfzfRequest"
  231. :on-preview="jsfzfPictureCardPreview"
  232. :on-remove="jsfzfRemove"
  233. :before-upload="checkUpload"
  234. multiple
  235. :limit="1"
  236. :on-exceed="jsfzfExceed"
  237. list-type="picture-card"
  238. :file-list="jsfzfList"
  239. :auto-upload="true"
  240. >
  241. <img slot="trigger" src="../../../assets/images/certification/idcard_reverse.png" alt="">
  242. </el-upload>
  243. </el-col>
  244. </el-row>
  245. </el-row>
  246. </el-form-item>
  247. </el-form>
  248. <div slot="footer" class="dialog-footer">
  249. <el-button type="primary" @click="submitImg">确 定</el-button>
  250. <el-button @click="cancelImg">取 消</el-button>
  251. </div>
  252. </el-dialog>
  253. <!-- 重置密码 -->
  254. <el-dialog :title="title" :visible.sync="openPassWord" width="700px" append-to-body>
  255. <el-form ref="form" :model="form" :rules="rulesPassWord" label-width="80px">
  256. <el-row>
  257. <el-col :span="24">
  258. <el-form-item label="密码" prop="password">
  259. <el-input v-model="form.password" placeholder="请输入密码" show-password maxlength="20"></el-input>
  260. </el-form-item>
  261. </el-col>
  262. </el-row>
  263. </el-form>
  264. <div slot="footer" class="dialog-footer">
  265. <el-button type="primary" @click="rulesSubmitForm">确 定</el-button>
  266. <el-button @click="cancel">取 消</el-button>
  267. </div>
  268. </el-dialog>
  269. <!-- 用户导入对话框 -->
  270. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  271. <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>
  272. <i class="el-icon-upload"></i>
  273. <div class="el-upload__text">
  274. 将文件拖到此处,或
  275. <em>点击上传</em>
  276. </div>
  277. <div class="el-upload__tip" slot="tip">
  278. <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
  279. <el-link type="info" style="font-size: 12px" @click="importTemplate">下载模板</el-link>
  280. </div>
  281. <div class="el-upload__tip" style="color: red" slot="tip">
  282. 提示:仅允许导入“xls”或“xlsx”格式文件!
  283. </div>
  284. </el-upload>
  285. <div slot="footer" class="dialog-footer">
  286. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  287. <el-button @click="upload.open = false">取 消</el-button>
  288. </div>
  289. </el-dialog>
  290. </div>
  291. </template>
  292. <script>
  293. import {
  294. listUser,
  295. getUser,
  296. delUser,
  297. addUser,
  298. updateUser,
  299. resetUserPwd,
  300. changeUserStatus,
  301. getUserProfile,
  302. getNowUser,
  303. getRoleDept,
  304. companyList,
  305. adminChange,
  306. handlerChange,
  307. selectNormalUser,
  308. qperatorQuery,
  309. handlerDo,
  310. handleUser,
  311. } from "@/api/system/user";
  312. import {
  313. uploadFileNew
  314. } from "@/api/common/file";
  315. import {
  316. getToken
  317. } from "@/utils/auth";
  318. import {
  319. treeselect
  320. } from "@/api/system/dept";
  321. import Treeselect from "@riophae/vue-treeselect";
  322. import {
  323. getOwnCompany
  324. } from "@/api/common/company";
  325. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  326. import {
  327. columnQuery,
  328. columnfilter
  329. } from "@/api/common/columnSetting";
  330. import ColumnSetting from "../../../components/Table/columnSetting.vue";
  331. import Cookies from "js-cookie";
  332. import SearchBar from '@/components/SearchBar/index.vue';
  333. import {getCard} from "@/api/system/authentication";
  334. export default {
  335. name: "User",
  336. components: {
  337. Treeselect,
  338. ColumnSetting,
  339. SearchBar
  340. },
  341. data() {
  342. return {
  343. //图片预览
  344. sfzImageUrl: "",
  345. sfzVisible: false,
  346. sqsImageUrl: "",
  347. sqsVisible: false,
  348. showBtnImg: false,
  349. noneBtnImg: false,
  350. showsBtnImg: false,
  351. nonesBtnImg: false,
  352. sfzList: [],
  353. sqsList: [],
  354. limitCountImg: 1,
  355. handleCompany: null,
  356. company: null,
  357. qperator: null,
  358. //当前登录用户企业id
  359. signCompanyId: "",
  360. //姓名
  361. nameList: [],
  362. // 遮罩层
  363. loading: true,
  364. // 选中数组
  365. ids: [],
  366. // 非单个禁用
  367. single: true,
  368. // 非多个禁用
  369. multiple: true,
  370. // 显示搜索条件
  371. showSearch: true,
  372. rodeptShow: false,
  373. roleShow: false,
  374. // 总条数
  375. total: 0,
  376. // 用户表格数据
  377. userList: null,
  378. // 弹出层标题
  379. title: "",
  380. titles: "",
  381. // 部门树选项
  382. deptOptions: undefined,
  383. rodeptOptions: undefined,
  384. // 是否显示弹出层
  385. open: false,
  386. imgs: false,
  387. openPassWord: false,
  388. isName: false,
  389. //离职日期
  390. leave: false,
  391. // 部门名称
  392. deptName: undefined,
  393. // 默认密码
  394. initPassword: undefined,
  395. companyId: "",
  396. // 日期范围
  397. dateRange: [],
  398. // 状态数据字典
  399. statusOptions: [],
  400. // 性别状态字典
  401. sexOptions: [],
  402. //学历字典
  403. educationOptions: [],
  404. // 岗位选项
  405. postOptions: [],
  406. // 角色选项
  407. roleOptions: [],
  408. companyList: [],
  409. // 表单参数
  410. form: {},
  411. jsfzzBtnImg:false,
  412. jsfzfBtnImg:false,
  413. showBtnImg:false,
  414. jsfzzList : [],
  415. jsfzfList : [],
  416. //筛选按钮的数据列表,与table表头的数据一致 --显示隐藏列用
  417. tableList: [{
  418. label: "userId",
  419. value: "用户编号",
  420. },
  421. {
  422. label: "userName",
  423. value: "手机号",
  424. },
  425. {
  426. label: "nickName",
  427. value: "用户姓名",
  428. },
  429. {
  430. label: "scyName",
  431. value: "企业名称",
  432. },
  433. {
  434. label: "deptName",
  435. value: "部门",
  436. },
  437. {
  438. label: "status",
  439. value: "状态",
  440. },
  441. {
  442. label: "createTime",
  443. value: "创建时间",
  444. },
  445. ],
  446. checkList: [], //筛选列选中的数据列表--显示隐藏列用
  447. uncheckList: {}, //控制筛选列显示隐藏--显示隐藏列用
  448. selfDom: this,
  449. tableId: "/system/ownUser/list",
  450. defaultProps: {
  451. children: "children",
  452. label: "label",
  453. },
  454. // 用户导入参数
  455. upload: {
  456. // 是否显示弹出层(用户导入)
  457. open: false,
  458. // 弹出层标题(用户导入)
  459. title: "",
  460. // 是否禁用上传
  461. isUploading: false,
  462. // 是否更新已经存在的用户数据
  463. updateSupport: 0,
  464. // 设置上传的请求头部
  465. headers: {
  466. Authorization: "Bearer " + getToken()
  467. },
  468. // 上传的地址
  469. url: process.env.VUE_APP_BASE_API + "/system/user/importData",
  470. },
  471. // 查询参数
  472. queryParams: {
  473. pageNum: 1,
  474. pageSize: 10,
  475. userName: undefined,
  476. phonenumber: undefined,
  477. status: undefined,
  478. deptId: undefined,
  479. },
  480. uinParams: {
  481. ssId: null,
  482. ssName: null,
  483. pageNum: 1,
  484. pageSize: 10,
  485. },
  486. // 表单校验
  487. rules: {
  488. roleIds: [{
  489. required: true,
  490. message: "角色不能为空",
  491. trigger: ["blur", "change"],
  492. }, ],
  493. userName: [{
  494. required: true,
  495. message: "手机号不能为空",
  496. trigger: "blur",
  497. },
  498. {
  499. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  500. message: "请输入正确的手机号码",
  501. trigger: ["blur", "change"],
  502. },
  503. ],
  504. nickName: [{
  505. required: true,
  506. message: "用户姓名不能为空",
  507. trigger: ["blur", "change"],
  508. },
  509. {
  510. pattern: /^[A-Za-z\u4e00-\u9fa5]+$/,
  511. message: "用户姓名不能带有特殊字符",
  512. trigger: ["blur", "change"],
  513. },
  514. ],
  515. deptId: [{
  516. required: true,
  517. message: "归属部门不能为空",
  518. trigger: ["blur", "change"],
  519. }, ],
  520. postIds: [{
  521. required: true,
  522. message: "用户职级不能为空",
  523. trigger: "blur",
  524. }, ],
  525. email: [
  526. /* {
  527. required: true,
  528. message: "邮箱地址不能为空",
  529. trigger: "blur",
  530. }, */
  531. {
  532. // type: "email",
  533. pattern: /^([a-z0-9A-Z]+[-|_|\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\.)+[a-zA-Z]{2,}$/,
  534. message: "邮箱格式不正确",
  535. trigger: ["blur", "change"],
  536. },
  537. ],
  538. phonenumber: [{
  539. required: true,
  540. message: "手机号码不能为空",
  541. trigger: "blur",
  542. },
  543. {
  544. pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
  545. message: "请输入正确的手机号码",
  546. trigger: ["blur", "change"],
  547. },
  548. ],
  549. },
  550. rulesPassWord: {
  551. password: [{
  552. required: true,
  553. message: "用户密码不能为空",
  554. trigger: "blur",
  555. },
  556. {
  557. pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/,
  558. message: "密码请包含数字,英文,字符中的两种以上,长度6-20位",
  559. trigger: ["blur", "change"],
  560. },
  561. ],
  562. },
  563. peoplpeName: false,
  564. isUpdate: false,
  565. };
  566. },
  567. watch: {
  568. // 根据名称筛选部门树
  569. deptName(val) {
  570. this.$refs.tree.filter(val);
  571. },
  572. "form.userName": "getLoginName",
  573. },
  574. created() {
  575. this.getList();
  576. this.getNowUser();
  577. this.getTreeselect();
  578. this.getUserProfile();
  579. this.getDicts("sys_normal_disable").then((response) => {
  580. this.statusOptions = response.data;
  581. });
  582. this.getDicts("sys_user_sex").then((response) => {
  583. this.sexOptions = response.data;
  584. });
  585. this.getConfigKey("sys.user.initPassword").then((response) => {
  586. this.initPassword = response.msg;
  587. });
  588. this.getDicts("education").then((response) => {
  589. this.educationOptions = response.data;
  590. });
  591. },
  592. mounted() {
  593. this.columnQuery();
  594. },
  595. methods: {
  596. jsfzzImgChange(file, jsfzzList) {
  597. this.jsfzzBtnImg = jsfzzList.length >= this.limitCountImg;
  598. },
  599. jsfzzRemove(file, jsfzzList) {
  600. for (let i = 0; i < this.jsfzzList.length; i++) {
  601. if (file.uid == thisjsfzzList[i].uid) {
  602. this.jsfzzList.splice(i, 1);
  603. break;
  604. }
  605. }
  606. this.jsfzzBtnImg = jsfzzList.length >= this.limitCountImg;
  607. },
  608. jsfzzExceed(file, jsfzzList) {
  609. this.$message.warning(`当前限制选择 1 个文件`);
  610. },
  611. jsfzfRemove(file, jsfzfList) {
  612. for (let i = 0; i < this.jsfzfList.length; i++) {
  613. if (file.uid == this.jsfzfList[i].uid) {
  614. this.jsfzfList.splice(i, 1);
  615. break;
  616. }
  617. }
  618. this.jsfzfBtnImg = jsfzfList.length >= this.limitCountImg;
  619. },
  620. jsfzfExceed(file, jsfzfList) {
  621. this.$message.warning(`当前限制选择 1 个文件`);
  622. },
  623. jsfzzPictureCardPreview(file) {
  624. this.jsfzzImageUrl = file.url;
  625. this.jsfzzVisible = true;
  626. },
  627. jsfzfPictureCardPreview(file) {
  628. this.jsfzfImageUrl = file.url;
  629. this.jsffzVisible = true;
  630. },
  631. jsfzfImgChange(file, jsfzfList) {
  632. this.jsfzfBtnImg = jsfzfList.length >= this.limitCountImg;
  633. },
  634. //经办人身份证正面
  635. jsfzzRequest(param) {
  636. let fileObj = param.file; // 相当于input里取得的files
  637. let fd = new FormData(); // FormData 对象
  638. fd.append("file", fileObj); // 文件对象
  639. fd.append("fileType", "01");
  640. const loading = this.$loading({
  641. lock: true,
  642. text: "Loading",
  643. spinner: "el-icon-loading",
  644. background: "rgba(0, 0, 0, 0.7)",
  645. });
  646. getCard(fd)
  647. .then((response) => {
  648. if (response) {
  649. this.$set(this.form, "card", response.data.handlerCard);
  650. this.$set(this.form, "jsfzzList", response.data.jsfzzList);
  651. setTimeout(() => {
  652. loading.close();
  653. }, 2000);
  654. }
  655. })
  656. .catch((response) => {
  657. let uid = fileObj.uid; // 关键作用代码,去除文件列表失败文件
  658. let idx = this.$refs.jsfzzload.uploadFiles.findIndex(
  659. (item) => item.uid === uid
  660. ); // 关键作用代码,去除文件列表失败文件(uploadFiles为el-upload中的ref值)
  661. this.$refs.jsfzzload.uploadFiles.splice(idx, 1); // 关键作用代码,去除文件列表失败文件
  662. this.jsfzzBtnImg = this.jsfzzList.length >= this.limitCountImg;
  663. loading.close();
  664. });
  665. },
  666. //经办人身份证反面
  667. jsfzfRequest(param) {
  668. let fileObj = param.file; // 相当于input里取得的files
  669. let fd = new FormData(); // FormData 对象
  670. fd.append("file", fileObj); // 文件对象
  671. fd.append("fileType", "03");
  672. const loading = this.$loading({
  673. lock: true,
  674. text: "Loading",
  675. spinner: "el-icon-loading",
  676. background: "rgba(0, 0, 0, 0.7)",
  677. });
  678. getCard(fd)
  679. .then((response) => {
  680. if (response) {
  681. this.$set(this.form, "jsfzfList", response.data.jsfzfList);
  682. setTimeout(() => {
  683. loading.close();
  684. }, 2000);
  685. }
  686. })
  687. .catch((response) => {
  688. let uid = fileObj.uid; // 关键作用代码,去除文件列表失败文件
  689. let idx = this.$refs.jsfzfload.uploadFiles.findIndex(
  690. (item) => item.uid === uid
  691. ); // 关键作用代码,去除文件列表失败文件(uploadFiles为el-upload中的ref值)
  692. this.$refs.jsfzfload.uploadFiles.splice(idx, 1); // 关键作用代码,去除文件列表失败文件
  693. this.jsfzfBtnImg = this.jsfzfList.length >= this.limitCountImg;
  694. loading.close();
  695. });
  696. },
  697. //上传前校验
  698. checkUpload(file) {
  699. const isJPG =
  700. file.type === "image/jpeg" ||
  701. file.type === "image/png";
  702. const isLt2M = file.size / 1024 / 1024 < 3;
  703. if (!isJPG) {
  704. this.$message.error("上传图片只能是 JPG/PNG/ 格式");
  705. }
  706. if (!isLt2M) {
  707. this.$message.error("上传图片大小不能超过 3MB");
  708. }
  709. return isJPG && isLt2M;
  710. },
  711. //获取当前客户是否之前设置过列展示隐藏
  712. columnQuery() {
  713. //获取页面路径
  714. var psfPagePath = window.location.pathname;
  715. //用请求后台的url作为唯一标识
  716. var psfTableName = this.tableId;
  717. var columnForm = {};
  718. columnForm.psfPagePath = psfPagePath;
  719. columnForm.psfTableName = psfTableName;
  720. columnQuery(columnForm).then((response) => {
  721. if (response.data && response.data.psfShowData) {
  722. this.checkList = response.data.psfShowData;
  723. }
  724. this.filter();
  725. });
  726. },
  727. //控制隐藏显示的函数
  728. filter(checkList) {
  729. if (!!checkList) {
  730. this.checkList = checkList;
  731. }
  732. columnfilter(this.selfDom);
  733. },
  734. getLoginName(item) {
  735. const userName = item;
  736. selectNormalUser(userName).then((response) => {
  737. console.log(response, "根据手机号获取用户姓名");
  738. if (response.data.length > 0) {
  739. this.$set(this.form, "nickName", response.data[0].nickName);
  740. this.isName = true;
  741. } else {
  742. this.$set(this.form, "nickName", "");
  743. this.isName = false;
  744. }
  745. });
  746. },
  747. //获取当前用户信息
  748. getNowUser() {
  749. getNowUser().then((response) => {
  750. this.signCompanyId = response.data.companyId;
  751. });
  752. },
  753. stateFormat(row, column) {
  754. return this.selectDictLabel(this.statusOptions, row.status);
  755. },
  756. //根据企业id查询部门和角色信息
  757. getRodept(item) {
  758. if (item) {
  759. this.rodeptShow = true;
  760. const companyId = item;
  761. getRoleDept(companyId).then((response) => {
  762. if (response.deptList.length > 0) {
  763. this.rodeptOptions = response.deptList;
  764. } else {
  765. this.rodeptOptions = undefined;
  766. }
  767. if (response.roleList.length > 0) {
  768. this.roleOptions = response.roleList;
  769. } else {
  770. this.roleOptions = [];
  771. }
  772. });
  773. }
  774. },
  775. getUserProfile() {
  776. var sscDomain = document.location.hostname;
  777. getUserProfile(sscDomain).then((response) => {
  778. this.companyId = response.data.companyId;
  779. });
  780. },
  781. /** 查询用户列表 */
  782. getList() {
  783. this.loading = true;
  784. listUser(this.addDateRange(this.queryParams, this.dateRange)).then(
  785. (response) => {
  786. let userList = response.rows;
  787. for (let i = 0; i < userList.length; i++) {
  788. handlerDo(userList[i]).then((response) => {
  789. userList[i].handleChange = response.data.handleChange;
  790. });
  791. }
  792. this.userList = userList;
  793. this.total = response.total;
  794. this.loading = false;
  795. }
  796. );
  797. handleUser().then((response) => {
  798. this.handleCompany = response.data.handleCompany;
  799. });
  800. getOwnCompany().then((response) => {
  801. this.company = response.data;
  802. });
  803. qperatorQuery().then((response) => {
  804. this.qperator = response.data[0].sucrHandler;
  805. });
  806. },
  807. /** 查询部门下拉树结构 */
  808. getTreeselect() {
  809. treeselect().then((response) => {
  810. this.deptOptions = response.data;
  811. });
  812. },
  813. /** 查询部门下拉树结构 */
  814. getFormTreeselect() {
  815. treeselect().then((response) => {
  816. this.rodeptOptions = response.data;
  817. });
  818. },
  819. // 筛选节点
  820. filterNode(value, data) {
  821. if (!value) return true;
  822. return data.label.indexOf(value) !== -1;
  823. },
  824. // 节点单击事件
  825. handleNodeClick(data) {
  826. this.queryParams.deptId = data.id;
  827. this.getList();
  828. },
  829. // 用户状态修改
  830. handleStatusChange(row) {
  831. const userId = row.userId || this.ids;
  832. const nickNames = row.nickName || this.ids;
  833. const status = "0";
  834. this.$confirm(
  835. '是否确认解冻用户姓名为"' + nickNames + '"的数据项?',
  836. "警告", {
  837. confirmButtonText: "确定",
  838. cancelButtonText: "取消",
  839. type: "warning",
  840. }
  841. )
  842. .then(function () {
  843. return changeUserStatus(userId, status);
  844. })
  845. .then(() => {
  846. this.getList();
  847. this.msgSuccess("解冻成功");
  848. })
  849. .catch(() => {
  850. this.$message({
  851. type: "warning",
  852. message: "已取消解冻",
  853. });
  854. });
  855. },
  856. // 取消按钮
  857. cancel() {
  858. this.open = false;
  859. this.openPassWord = false;
  860. this.reset();
  861. },
  862. // 取消按钮
  863. cancelImg() {
  864. this.imgs = false;
  865. this.reset();
  866. },
  867. // 表单重置
  868. reset() {
  869. this.form = {
  870. userId: undefined,
  871. deptId: undefined,
  872. userName: undefined,
  873. nickName: undefined,
  874. password: undefined,
  875. phonenumber: null,
  876. email: undefined,
  877. sex: undefined,
  878. status: "0",
  879. remark: undefined,
  880. postIds: [],
  881. roleIds: [],
  882. nameList: [],
  883. jsfzzList :[],
  884. jsfzfList :[]
  885. };
  886. this.resetForm("form");
  887. },
  888. /** 搜索按钮操作 */
  889. handleQuery() {
  890. this.queryParams.pageNum = 1;
  891. this.queryParams.pageSize = 10;
  892. this.getList();
  893. },
  894. /** 重置按钮操作 */
  895. resetQuery() {
  896. this.dateRange = [];
  897. this.queryParams = {
  898. pageNum: 1,
  899. pageSize: 10,
  900. userName: undefined,
  901. phonenumber: undefined,
  902. status: undefined,
  903. deptId: undefined,
  904. };
  905. this.resetForm("queryForm");
  906. this.handleQuery();
  907. },
  908. // 多选框选中数据
  909. handleSelectionChange(selection) {
  910. this.ids = selection.map((item) => item.userId);
  911. this.single = selection.length != 1;
  912. this.multiple = !selection.length;
  913. },
  914. //文件移除提示
  915. beforeRemove(file, sfzList) {
  916. for (let i = 0; i < this.sfzList.length; i++) {
  917. if (file.uid == this.sfzList[i].uid) {
  918. this.sfzList.splice(i, 1);
  919. break;
  920. }
  921. }
  922. this.noneBtnImg = sfzList.length >= this.limitCountImg;
  923. },
  924. sqsRemove(file, sqsList) {
  925. for (let i = 0; i < this.sqsList.length; i++) {
  926. if (file.uid == this.sqsList[i].uid) {
  927. this.sqsList.splice(i, 1);
  928. break;
  929. }
  930. }
  931. this.nonesBtnImg = sqsList.length >= this.limitCountImg;
  932. },
  933. handleExceed(file, sfzList) {
  934. this.$message.warning(`当前限制选择 1 个文件`);
  935. },
  936. sqsExceed(file, sqsList) {
  937. this.$message.warning(`当前限制选择 1 个文件`);
  938. },
  939. //图片预览
  940. handlePictureCardPreview(file) {
  941. this.sfzImageUrl = file.url;
  942. this.sfzVisible = true;
  943. },
  944. sqsPictureCardPreview(file) {
  945. this.sqsImageUrl = file.url;
  946. this.sqsVisible = true;
  947. },
  948. dealImgChange(file, sfzList) {
  949. this.noneBtnImg = sfzList.length >= this.limitCountImg;
  950. },
  951. dealImgChange(file, sqsList) {
  952. this.nonesBtnImg = sqsList.length >= this.limitCountImg;
  953. },
  954. //上传
  955. // submitUpload() {
  956. // this.$refs.upload.submit();
  957. // },
  958. // sqsUpload() {
  959. // this.$refs.upload.submit();
  960. // },
  961. //手动上传文件触发
  962. sfzRequest(param) {
  963. let fileObj = param.file; // 相当于input里取得的files
  964. let fd = new FormData(); // FormData 对象
  965. fd.append("file", fileObj); // 文件对象
  966. fd.append("fileType", "00"); //文件类型
  967. const loading = this.$loading({
  968. lock: true,
  969. text: "Loading",
  970. spinner: "el-icon-loading",
  971. background: "rgba(0, 0, 0, 0.7)",
  972. });
  973. uploadFileNew(fd)
  974. .then((response) => {
  975. if (response) {
  976. this.sfzList.push({
  977. uid: response.fileId,
  978. url: response.url + "/" + getToken(),
  979. });
  980. setTimeout(() => {
  981. loading.close();
  982. }, 2000);
  983. }
  984. })
  985. .catch((response) => {
  986. console.log(this.$refs.upload, "删除路径")
  987. let uid = fileObj.uid; // 关键作用代码,去除文件列表失败文件
  988. let idx = this.$refs.upload.uploadFiles.findIndex(
  989. (item) => item.uid === uid
  990. ); // 关键作用代码,去除文件列表失败文件(uploadFiles为el-upload中的ref值)
  991. this.$refs.upload.uploadFiles.splice(idx, 1); // 关键作用代码,去除文件列表失败文件
  992. this.showBtnImg = false;
  993. loading.close();
  994. });
  995. },
  996. sqsRequest(param) {
  997. let fileObj = param.file; // 相当于input里取得的files
  998. let fd = new FormData(); // FormData 对象
  999. fd.append("file", fileObj); // 文件对象
  1000. fd.append("fileType", "00"); //文件类型
  1001. const loading = this.$loading({
  1002. lock: true,
  1003. text: "Loading",
  1004. spinner: "el-icon-loading",
  1005. background: "rgba(0, 0, 0, 0.7)",
  1006. });
  1007. uploadFileNew(fd)
  1008. .then((response) => {
  1009. if (response) {
  1010. this.sqsList.push({
  1011. uid: response.fileId,
  1012. url: response.url + "/" + getToken(),
  1013. });
  1014. setTimeout(() => {
  1015. loading.close();
  1016. }, 2000);
  1017. }
  1018. })
  1019. .catch((response) => {
  1020. loading.close();
  1021. });
  1022. },
  1023. /** 新增按钮操作 */
  1024. handleAdd() {
  1025. this.roleShow = true;
  1026. if (this.signCompanyId == "000000") {
  1027. this.rodeptShow = false;
  1028. } else if (this.signCompanyId != "000000") {
  1029. this.rodeptShow = true;
  1030. }
  1031. this.isUpdate = false;
  1032. this.isName = false;
  1033. this.reset();
  1034. this.peoplpeName = false;
  1035. this.getFormTreeselect();
  1036. getUser().then((response) => {
  1037. this.postOptions = response.posts;
  1038. this.roleOptions = response.roles;
  1039. this.open = true;
  1040. this.leave = false;
  1041. this.title = "添加用户";
  1042. this.form.password = this.initPassword;
  1043. });
  1044. },
  1045. /** 申请变更经办人 */
  1046. handleHandler(row) {
  1047. const userId = row.userId || this.ids;
  1048. this.form.userIds = userId;
  1049. this.imgs = true;
  1050. this.titles = "申请变更经办人";
  1051. },
  1052. /** 确认变更经办人*/
  1053. confirmHandler(row) {
  1054. console.log(row);
  1055. this.resetForm("queryForm");
  1056. Cookies.set(
  1057. "/user/detail/" + row.userId + "/" + row.scyId,
  1058. this.$route.fullPath
  1059. );
  1060. this.$router.push({
  1061. path: "/user/detail/" + row.userId + "/" + row.scyId,
  1062. });
  1063. },
  1064. /** 修改按钮操作 */
  1065. handleUpdate(row) {
  1066. if (this.signCompanyId == "000000") {
  1067. this.rodeptShow = false;
  1068. } else if (this.signCompanyId != "000000") {
  1069. this.rodeptShow = true;
  1070. }
  1071. this.isUpdate = true;
  1072. this.isName = true;
  1073. var self = this;
  1074. this.reset();
  1075. this.peoplpeName = true;
  1076. this.getFormTreeselect();
  1077. const userId = row.userId;
  1078. const scyId = row.scyId;
  1079. const remark = row.remark;
  1080. const email = row.email;
  1081. const deptId = row.deptId;
  1082. const nickName = row.nickName;
  1083. const userName = row.userName;
  1084. if (remark) {
  1085. this.$set(this.form, "remark", remark);
  1086. }
  1087. if (email) {
  1088. this.$set(this.form, "email", email);
  1089. }
  1090. if (deptId) {
  1091. this.$set(this.form, "deptId", deptId);
  1092. }
  1093. if (nickName) {
  1094. this.$set(this.form, "nickName", nickName);
  1095. }
  1096. if (userName) {
  1097. this.$set(this.form, "userName", userName);
  1098. }
  1099. if (userId) {
  1100. this.$set(this.form, "userId", userId);
  1101. }
  1102. if (scyId) {
  1103. this.$set(this.form, "scyId", scyId);
  1104. }
  1105. getUser(userId, scyId).then((response) => {
  1106. this.uinParams.ssId = response.data.staffCode;
  1107. this.getRodept(scyId);
  1108. this.postOptions = response.posts;
  1109. this.roleOptions = response.roles;
  1110. this.form.postIds = response.postIds;
  1111. this.$set(this.form, "roleIds", response.roleIds);
  1112. this.open = true;
  1113. this.leave = true;
  1114. this.title = "修改用户";
  1115. });
  1116. },
  1117. /** 重置密码按钮操作 */
  1118. handleResetPwd(row) {
  1119. this.reset();
  1120. this.getTreeselect();
  1121. const userId = row.userId || this.ids;
  1122. getUser(userId).then((response) => {
  1123. this.openPassWord = true;
  1124. this.title = "重置密码";
  1125. this.form.userId = userId;
  1126. });
  1127. },
  1128. rulesSubmitForm: function () {
  1129. this.$refs["form"].validate((valid) => {
  1130. if (valid) {
  1131. const loading = this.$loading({
  1132. lock: true,
  1133. text: "Loading",
  1134. spinner: "el-icon-loading",
  1135. background: "rgba(0, 0, 0, 0.7)",
  1136. });
  1137. var userId = this.form.userId;
  1138. var password = this.form.password;
  1139. resetUserPwd(userId, password)
  1140. .then((response) => {
  1141. this.openPassWord = false;
  1142. loading.close();
  1143. this.msgSuccess("修改成功,新密码是:" + password);
  1144. })
  1145. .catch((response) => {
  1146. loading.close();
  1147. });
  1148. }
  1149. });
  1150. },
  1151. /** 申请变更经办人 */
  1152. submitImg() {
  1153. //身份证号
  1154. if(!this.form.card){
  1155. this.$message({
  1156. message: "身份证号不能为空",
  1157. type: 'warning'
  1158. });
  1159. return false;
  1160. }
  1161. if(!this.form.jsfzzList){
  1162. this.$message({
  1163. message: "请上传身份证人像面",
  1164. type: 'warning'
  1165. });
  1166. return false;
  1167. }
  1168. if(!this.form.jsfzfList){
  1169. this.$message({
  1170. message: "请上传身份证国徽面",
  1171. type: 'warning'
  1172. });
  1173. return false;
  1174. }
  1175. this.form.sfzList = this.sfzList;
  1176. this.form.sqsList = this.sqsList;
  1177. const loading = this.$loading({
  1178. lock: true,
  1179. text: "Loading",
  1180. spinner: "el-icon-loading",
  1181. background: "rgba(0, 0, 0, 0.7)",
  1182. });
  1183. handlerChange(this.form)
  1184. .then((response) => {
  1185. loading.close();
  1186. this.msgSuccess("申请成功");
  1187. this.imgs = false;
  1188. this.getList();
  1189. })
  1190. .catch((response) => {
  1191. loading.close();
  1192. });
  1193. },
  1194. /** 提交按钮 */
  1195. submitForm: function () {
  1196. this.$refs["form"].validate((valid) => {
  1197. if (valid) {
  1198. if (this.form.userId != undefined) {
  1199. const loading = this.$loading({
  1200. lock: true,
  1201. text: "Loading",
  1202. spinner: "el-icon-loading",
  1203. background: "rgba(0, 0, 0, 0.7)",
  1204. });
  1205. this.$set(this.form, "createTime", null);
  1206. this.$set(this.form, "companyId", this.form.scyId);
  1207. updateUser(this.form)
  1208. .then((response) => {
  1209. loading.close();
  1210. this.msgSuccess("修改成功");
  1211. this.open = false;
  1212. this.getList();
  1213. })
  1214. .catch((response) => {
  1215. loading.close();
  1216. });
  1217. } else {
  1218. const loading = this.$loading({
  1219. lock: true,
  1220. text: "Loading",
  1221. spinner: "el-icon-loading",
  1222. background: "rgba(0, 0, 0, 0.7)",
  1223. });
  1224. addUser(this.form)
  1225. .then((response) => {
  1226. loading.close();
  1227. this.msgSuccess("新增成功");
  1228. this.open = false;
  1229. this.getList();
  1230. })
  1231. .catch((response) => {
  1232. loading.close();
  1233. });
  1234. }
  1235. }
  1236. });
  1237. },
  1238. /** 变更权限按钮操作 */
  1239. handleChange(row) {
  1240. const userIds = row.userId || this.ids;
  1241. const nickNames = row.nickName || this.ids;
  1242. this.$confirm(
  1243. '是否确认将用户姓名为"' + nickNames + '"变更为管理员?',
  1244. "警告", {
  1245. confirmButtonText: "确定",
  1246. cancelButtonText: "取消",
  1247. type: "warning",
  1248. }
  1249. )
  1250. .then(function () {
  1251. return adminChange(userIds);
  1252. })
  1253. .then(() => {
  1254. this.msgSuccess("变更成功");
  1255. this.$store.dispatch("LogOut").then(() => {
  1256. location.href = "/login";
  1257. });
  1258. })
  1259. .catch(() => {
  1260. this.$message({
  1261. type: "warning",
  1262. message: "已取消变更",
  1263. });
  1264. });
  1265. },
  1266. /** 删除按钮操作 */
  1267. handleDelete(row) {
  1268. const userIds = row.userId || this.ids;
  1269. const nickNames = row.nickName || this.ids;
  1270. this.$confirm(
  1271. '是否确认删除用户姓名为"' + nickNames + '"的数据项?',
  1272. "警告", {
  1273. confirmButtonText: "确定",
  1274. cancelButtonText: "取消",
  1275. type: "warning",
  1276. }
  1277. )
  1278. .then(function () {
  1279. return delUser(userIds);
  1280. })
  1281. .then(() => {
  1282. this.getList();
  1283. this.msgSuccess("删除成功");
  1284. })
  1285. .catch(() => {
  1286. this.$message({
  1287. type: "warning",
  1288. message: "已取消删除",
  1289. });
  1290. });
  1291. },
  1292. /** 导出按钮操作 */
  1293. // handleExport() {
  1294. // this.download('system/ownUser/export', {
  1295. // ...this.queryParams
  1296. // }, `用户数据_${new Date().getTime()}.xlsx`)
  1297. // },
  1298. handleExport() {
  1299. console.log(this.queryParams);
  1300. console.log(this.dateRange);
  1301. const loading = this.$loading({
  1302. lock: true,
  1303. text: "Loading",
  1304. spinner: "el-icon-loading",
  1305. background: "rgba(0, 0, 0, 0.7)",
  1306. });
  1307. this.download(
  1308. "system/ownUser/export", {
  1309. ...this.queryParams,
  1310. ...this.dateRange,
  1311. },
  1312. `用户数据_${new Date().getTime()}.xlsx`
  1313. );
  1314. loading.close();
  1315. },
  1316. /** 导入按钮操作 */
  1317. handleImport() {
  1318. this.upload.title = "用户导入";
  1319. this.upload.open = true;
  1320. },
  1321. /** 下载模板操作 */
  1322. importTemplate() {
  1323. this.download(
  1324. "system/user/importTemplate", {
  1325. ...this.queryParams,
  1326. },
  1327. `user_${new Date().getTime()}.xlsx`
  1328. );
  1329. },
  1330. /** 安心签开户及管理授权书(模板) */
  1331. authorizationTemplate() {
  1332. this.download(
  1333. "system/ownUser/authorization", {},
  1334. `安心签开户及管理授权书(模板).docx`
  1335. );
  1336. },
  1337. /** 安心签用户信息变更申请表 */
  1338. applicationTemplate() {
  1339. this.download(
  1340. "system/ownUser/apply", {},
  1341. `安心签用户信息变更申请表.xlsx`
  1342. );
  1343. },
  1344. //上传前校验
  1345. beforeAvatarUpload(file) {
  1346. var testmsg = file.name.substring(file.name.lastIndexOf(".") + 1);
  1347. const extension = testmsg === "jpg";
  1348. const extension2 = testmsg === "jpeg";
  1349. const extension3 = testmsg === "png";
  1350. const extension4 = testmsg === "JPG";
  1351. const extension5 = testmsg === "JPEG";
  1352. const extension6 = testmsg === "PNG";
  1353. if (
  1354. !extension &&
  1355. !extension2 &&
  1356. !extension3 &&
  1357. !extension4 &&
  1358. !extension5 &&
  1359. !extension6
  1360. ) {
  1361. this.$message.warning(`请选择图片格式文件`);
  1362. }
  1363. return extension || extension2 || extension3;
  1364. // const isJPG =
  1365. // file.type === "image/jpeg" ||
  1366. // file.type === "image/png" ||
  1367. // file.type === "image/bmp";
  1368. // const isLt2M = file.size / 1024 / 1024 < 3;
  1369. // if (!isJPG) {
  1370. // this.$message.error("上传图片只能是 JPG/PNG/BMP 格式");
  1371. // }
  1372. // if (!isLt2M) {
  1373. // this.$message.error("上传图片大小不能超过 3MB");
  1374. // }
  1375. // return isJPG && isLt2M;
  1376. },
  1377. // 文件上传中处理
  1378. handleFileUploadProgress(event, file, fileList) {
  1379. this.upload.isUploading = true;
  1380. },
  1381. // 文件上传成功处理
  1382. handleFileSuccess(response, file, fileList) {
  1383. this.upload.open = false;
  1384. this.upload.isUploading = false;
  1385. this.$refs.upload.clearFiles();
  1386. this.$alert(response.msg, "导入结果", {
  1387. dangerouslyUseHTMLString: true,
  1388. });
  1389. this.getList();
  1390. },
  1391. // 提交上传文件
  1392. submitFileForm() {
  1393. this.$refs.upload.submit();
  1394. },
  1395. },
  1396. };
  1397. </script>
  1398. <style lang="scss">
  1399. .zap-user-department {
  1400. width: 253px;
  1401. min-height: calc(100vh - 200px);
  1402. padding: 20px;
  1403. margin-right: 20px;
  1404. }
  1405. .jsfzfUoloadSty .el-upload--picture-card {
  1406. display: none;
  1407. }
  1408. .jsfzzUoloadSty .el-upload--picture-card {
  1409. display: none;
  1410. }
  1411. </style>