index.vue 46 KB

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