user.vue 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663
  1. <template>
  2. <el-row class="user h-100p">
  3. <el-col :span="5" class="h-100p">
  4. <div class="h-100p">
  5. <el-scrollbar>
  6. <basic-container class="my-basic-con">
  7. <avue-tree
  8. :option="treeOption"
  9. :data="treeData"
  10. @node-click="nodeClick"
  11. />
  12. </basic-container>
  13. </el-scrollbar>
  14. </div>
  15. </el-col>
  16. <el-col :span="19">
  17. <basic-container>
  18. <avue-crud
  19. :option="option"
  20. :search.sync="search"
  21. :table-loading="loading"
  22. :data="data"
  23. ref="crud"
  24. :before-close="beforeClose"
  25. v-model="form"
  26. :permission="permissionList"
  27. @row-del="rowDel"
  28. @row-update="rowUpdate"
  29. @row-save="rowSave"
  30. :before-open="beforeOpen"
  31. :page.sync="page"
  32. @search-change="searchChange"
  33. @search-reset="searchReset"
  34. @selection-change="selectionChange"
  35. @current-change="currentChange"
  36. @size-change="sizeChange"
  37. @refresh-change="refreshChange"
  38. @on-load="onLoad"
  39. >
  40. <!-- 自 定义按钮 -->
  41. <template
  42. slot-scope="{row,index}"
  43. slot="menu"
  44. >
  45. <el-link
  46. class="marleft10"
  47. :underline="false"
  48. type="primary"
  49. icon="el-icon-edit"
  50. size="small"
  51. @click="editKJ(row, index)"
  52. >编辑
  53. </el-link>
  54. <el-link
  55. class="marleft10"
  56. :underline="false"
  57. type="primary"
  58. icon="el-icon-delete"
  59. size="small"
  60. @click="$refs.crud.rowDel(row,index)"
  61. >删除
  62. </el-link>
  63. </template>
  64. <!-- 参建项目 -->
  65. <template
  66. slot-scope="{type}"
  67. slot="projectAndUserListForm"
  68. >
  69. <div
  70. class="flexStar martop10"
  71. v-for="(item,key) in fromss.projectAndUserList"
  72. :key='key'
  73. >
  74. <el-input
  75. v-model="fromss.projectAndUserList[key].projectName"
  76. :disabled="true"
  77. ></el-input>
  78. <el-select
  79. class="marleft10"
  80. v-model="fromss.projectAndUserList[key].contractName"
  81. placeholder="请选择"
  82. @change="hetongChange(key)"
  83. >
  84. <el-option
  85. v-for="(item,index) in fromss.projectAndUserList[key].dataInfo"
  86. :key="item.id"
  87. :label="item.contractName"
  88. :value="item.id"
  89. >
  90. <span style="float: left">{{ item.contractName }}</span>
  91. <el-button
  92. @click.stop="deleteProject(key,type,index)"
  93. style="float: right;margin-right:5px;margin-top:3px;"
  94. type="danger"
  95. size="mini"
  96. icon="el-icon-delete"
  97. circle
  98. ></el-button>
  99. </el-option>
  100. </el-select>
  101. <el-input
  102. class="marleft10"
  103. v-model="fromss.projectAndUserList[key].roleName"
  104. :disabled="true"
  105. ></el-input>
  106. <el-button
  107. @click="deleteProject2(key,type)"
  108. class="marleft10"
  109. type="danger"
  110. icon="el-icon-delete"
  111. :disabled='deletexiangmu'
  112. circle
  113. ></el-button>
  114. </div>
  115. </template>
  116. <!-- 参与项目自定义表单 -->
  117. <template
  118. slot="projectIdForm"
  119. slot-scope="{type}"
  120. >
  121. <el-select
  122. v-model="fromss.projectId"
  123. :disabled="type=='view'"
  124. placeholder="请选择"
  125. >
  126. <el-option
  127. v-for="item in projectData"
  128. :key="item.id"
  129. :label="item.projectName"
  130. :value="item.id"
  131. >
  132. </el-option>
  133. </el-select>
  134. </template>
  135. <!-- 合同段自定义表单 -->
  136. <template
  137. slot="contractIdForm"
  138. slot-scope="{type}"
  139. >
  140. <el-select
  141. :disabled="type=='view'"
  142. v-model="fromss.contractId"
  143. placeholder="请选择"
  144. >
  145. <el-option
  146. v-for="item in contractData"
  147. :key="item.id"
  148. :label="item.contractName"
  149. :value="item.id"
  150. >
  151. </el-option>
  152. </el-select>
  153. </template>
  154. <!-- 用户类型自定义表单 -->
  155. <template
  156. slot-scope="{type}"
  157. slot="roleIdsForm"
  158. >
  159. <div class="flexStar">
  160. <el-select
  161. :disabled="type=='view'"
  162. v-model="fromss.roleIds"
  163. filterable
  164. placeholder="请选择"
  165. >
  166. <el-option
  167. v-for="item in roleIdsData"
  168. :key="item.roleId"
  169. :label="item.roleName"
  170. :value="item.roleId"
  171. >
  172. </el-option>
  173. </el-select>
  174. <el-button
  175. v-show="type!=='view'"
  176. class="marleft10"
  177. type="warning"
  178. size="mini"
  179. @click="addProject(type)"
  180. >确认添加
  181. </el-button>
  182. </div>
  183. </template>
  184. <template slot="menuLeft">
  185. <el-button
  186. type="primary"
  187. size="small"
  188. icon="el-icon-plus"
  189. @click="addKJ()"
  190. >新 增
  191. </el-button>
  192. <el-button
  193. type="danger"
  194. size="small"
  195. plain
  196. icon="el-icon-delete"
  197. v-if="permission.user_delete"
  198. @click="handleDelete"
  199. >删 除
  200. </el-button>
  201. <el-button
  202. type="info"
  203. size="small"
  204. plain
  205. v-if="permission.user_role"
  206. icon="el-icon-user"
  207. @click="handleGrant"
  208. >角色配置
  209. </el-button>
  210. <el-button
  211. type="info"
  212. size="small"
  213. plain
  214. v-if="permission.user_reset"
  215. icon="el-icon-refresh"
  216. @click="handleReset"
  217. >密码重置
  218. </el-button>
  219. <el-button
  220. type="info"
  221. size="small"
  222. plain
  223. v-if="userInfo.role_name.includes('admin')"
  224. icon="el-icon-setting"
  225. @click="handlePlatform"
  226. >平台配置
  227. </el-button>
  228. <el-button
  229. type="info"
  230. size="small"
  231. plain
  232. v-if="userInfo.role_name.includes('admin')"
  233. icon="el-icon-coordinate"
  234. @click="handLock"
  235. >账号封禁
  236. </el-button>
  237. <el-button
  238. type="info"
  239. size="small"
  240. plain
  241. v-if="userInfo.role_name.includes('admin')"
  242. icon="el-icon-coordinate"
  243. @click="handleLock"
  244. >账号解封
  245. </el-button>
  246. <el-button
  247. type="success"
  248. size="small"
  249. plain
  250. v-if="userInfo.role_name.includes('admin')"
  251. icon="el-icon-upload2"
  252. @click="handleImport"
  253. >导入
  254. </el-button>
  255. <el-button
  256. type="warning"
  257. size="small"
  258. plain
  259. v-if="userInfo.role_name.includes('admin')"
  260. icon="el-icon-download"
  261. @click="handleExport"
  262. >导出
  263. </el-button>
  264. </template>
  265. <template
  266. slot-scope="{row}"
  267. slot="tenantName"
  268. >
  269. <el-tag>{{ row.tenantName }}</el-tag>
  270. </template>
  271. <template
  272. slot-scope="{row}"
  273. slot="roleName"
  274. >
  275. <el-tag>{{ row.roleName }}</el-tag>
  276. </template>
  277. <template
  278. slot-scope="{row}"
  279. slot="deptName"
  280. >
  281. <el-tag>{{ row.deptName }}</el-tag>
  282. </template>
  283. <template
  284. slot-scope="{row}"
  285. slot="userTypeName"
  286. >
  287. <el-tag>{{ row.userTypeName }}</el-tag>
  288. </template>
  289. </avue-crud>
  290. <el-dialog
  291. title="用户角色配置"
  292. append-to-body
  293. :visible.sync="roleBox"
  294. width="345px"
  295. >
  296. <el-tree
  297. :data="roleGrantList"
  298. show-checkbox
  299. check-strictly
  300. default-expand-all
  301. node-key="id"
  302. ref="treeRole"
  303. :default-checked-keys="roleTreeObj"
  304. :props="props"
  305. >
  306. </el-tree>
  307. <span
  308. slot="footer"
  309. class="dialog-footer"
  310. >
  311. <el-button @click="roleBox = false">取 消</el-button>
  312. <el-button
  313. type="primary"
  314. @click="submitRole"
  315. >确 定</el-button>
  316. </span>
  317. </el-dialog>
  318. <el-dialog
  319. title="用户数据导入"
  320. append-to-body
  321. :visible.sync="excelBox"
  322. width="555px"
  323. >
  324. <avue-form
  325. :option="excelOption"
  326. v-model="excelForm"
  327. :upload-after="uploadAfter"
  328. >
  329. <template slot="excelTemplate">
  330. <el-button
  331. type="primary"
  332. @click="handleTemplate"
  333. >
  334. 点击下载<i class="el-icon-download el-icon--right"></i>
  335. </el-button>
  336. </template>
  337. </avue-form>
  338. </el-dialog>
  339. <el-dialog
  340. title="用户平台配置"
  341. append-to-body
  342. :visible.sync="platformBox"
  343. >
  344. <avue-crud
  345. :option="platformOption"
  346. :table-loading="platformLoading"
  347. :data="platformData"
  348. ref="platformCrud"
  349. v-model="platformForm"
  350. :before-open="platformBeforeOpen"
  351. :page.sync="platformPage"
  352. :permission="platformPermissionList"
  353. @row-update="platformRowUpdate"
  354. @search-change="platformSearchChange"
  355. @search-reset="platformSearchReset"
  356. @selection-change="platformSelectionChange"
  357. @current-change="platformCurrentChange"
  358. @size-change="platformSizeChange"
  359. @refresh-change="platformRefreshChange"
  360. @on-load="platformOnLoad"
  361. >
  362. <template
  363. slot-scope="{row}"
  364. slot="tenantName"
  365. >
  366. <el-tag>{{ row.tenantName }}</el-tag>
  367. </template>
  368. <template
  369. slot-scope="{row}"
  370. slot="userTypeName"
  371. >
  372. <el-tag>{{ row.userTypeName }}</el-tag>
  373. </template>
  374. </avue-crud>
  375. </el-dialog>
  376. </basic-container>
  377. </el-col>
  378. </el-row>
  379. </template>
  380. <script>
  381. import {
  382. getList,
  383. getUser,
  384. getUserPlatform,
  385. remove,
  386. update,
  387. updatePlatform,
  388. add,
  389. grant,
  390. resetPassword, lock, unlock, removeUserProjectInfoAndRoleById
  391. } from "@/api/system/user";
  392. import {getProjectList} from "@/api/manager/projectinfo";
  393. import {findContractByProjectId, removeUsersByIds} from "@/api/manager/contractinfo";
  394. import {exportBlob} from "@/api/common";
  395. import {getDeptTree, getDeptLazyTree} from "@/api/system/dept";
  396. import {roletree, treeUser, findProjectAndContractList, saveUserInfoByProjectTow} from "@/api/system/role";
  397. // import { getPostList } from "@/api/system/post";
  398. import {mapGetters} from "vuex";
  399. import website from '@/config/website';
  400. import {getToken} from '@/util/auth';
  401. import {downloadXls} from "@/util/util";
  402. import {dateNow} from "@/util/date";
  403. import NProgress from 'nprogress';
  404. import 'nprogress/nprogress.css';
  405. export default {
  406. data() {
  407. const validatePass = (rule, value, callback) => {
  408. if (value === '') {
  409. callback(new Error('请输入密码'));
  410. } else {
  411. callback();
  412. }
  413. };
  414. const validatePass2 = (rule, value, callback) => {
  415. if (value === '') {
  416. callback(new Error('请再次输入密码'));
  417. } else if (value !== this.form.password) {
  418. callback(new Error('两次输入密码不一致!'));
  419. } else {
  420. callback();
  421. }
  422. };
  423. const phoneRules = (rule, value, callback) => {
  424. // if (!/^1[345789]\d{9}$/.test(value)) {
  425. // if (!/^(13[0-9]|14[579]|15[0-3,5-9]|16[6]|17[0135678]|18[0-9]|19[89])\d{8}$/.test(value)) {
  426. if(!/^1[3-9]\d{9}$/.test(value)){
  427. callback(new Error('请输入正确的手机号'));
  428. } else {
  429. callback();
  430. }
  431. };
  432. const idNumberRules = (rule, value, callback) => {
  433. if (!value) {
  434. callback();
  435. } else {
  436. // if (!/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(value)) {
  437. // /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)
  438. if (! /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(value)) {
  439. callback(new Error('请输入正确的身份证号'));
  440. } else {
  441. callback();
  442. }
  443. }
  444. };
  445. const projectAndUserListRules = (rule, value, callback) => {
  446. if (this.fromss.projectAndUserList.length > 0) {
  447. callback();
  448. } else {
  449. callback(new Error('请设置参建项目'));
  450. }
  451. };
  452. return {
  453. deletexiangmu: false,
  454. addData: {
  455. tenantId: '',
  456. deptId: ''
  457. },
  458. form: {},
  459. search: {},
  460. roleBox: false,
  461. excelBox: false,
  462. platformBox: false,
  463. initFlag: true,
  464. selectionList: [],
  465. query: {},
  466. loading: true,
  467. platformLoading: false,
  468. page: {
  469. pageSize: 20,
  470. currentPage: 1,
  471. total: 0
  472. },
  473. platformPage: {
  474. pageSize: 10,
  475. currentPage: 1,
  476. total: 0
  477. },
  478. init: {
  479. roleTree: [],
  480. deptTree: [],
  481. },
  482. props: {
  483. label: "title",
  484. value: "key"
  485. },
  486. roleGrantList: [],
  487. roleTreeObj: [],
  488. treeDeptId: '',
  489. treeData: [],
  490. treeOption: {
  491. nodeKey: 'id',
  492. lazy: true,
  493. treeLoad: function (node, resolve) {
  494. const parentId = (node.level === 0) ? 0 : node.data.id;
  495. getDeptLazyTree(parentId).then(res => {
  496. resolve(res.data.data.map(item => {
  497. return {
  498. ...item,
  499. leaf: !item.hasChildren
  500. }
  501. }))
  502. });
  503. },
  504. addBtn: false,
  505. menu: false,
  506. size: 'small',
  507. props: {
  508. labelText: '标题',
  509. label: 'title',
  510. value: 'value',
  511. children: 'children'
  512. }
  513. },
  514. fromss: {
  515. userId: '',//
  516. projectAndUserList: [],
  517. projectId: '',//参与项项目
  518. contractId: '',//合同段
  519. roleIds: '',//用户类型
  520. },
  521. projectData: [],//参与项项目
  522. contractData: [],//合同段
  523. roleIdsData: [],//用户类型
  524. option: {
  525. height: 'auto',
  526. calcHeight: 80,
  527. tip: false,
  528. searchShow: true,
  529. searchMenuSpan: 6,
  530. border: true,
  531. index: true,
  532. selection: true,
  533. addBtn: false,
  534. // viewBtn: true,
  535. editBtn: false,
  536. delBtn: false,
  537. dialogType: 'drawer',
  538. dialogClickModal: false,
  539. column: [
  540. {
  541. label: "登录账号",
  542. prop: "account",
  543. search: true,
  544. display: false
  545. },
  546. {
  547. label: "所属租户",
  548. prop: "tenantName",
  549. slot: true,
  550. display: false
  551. },
  552. {
  553. label: "用户姓名",
  554. prop: "realName",
  555. search: true,
  556. display: false
  557. },
  558. {
  559. label: "所属角色",
  560. prop: "roleName",
  561. slot: true,
  562. display: false,
  563. },
  564. {
  565. label: "所属部门",
  566. prop: "deptName",
  567. slot: true,
  568. display: false,
  569. value: '',
  570. },
  571. {
  572. label: "用户平台",
  573. prop: "userTypeName",
  574. slot: true,
  575. display: false
  576. },
  577. {
  578. label: "密码",
  579. prop: "plaintextPassword",
  580. slot: true,
  581. display: false
  582. },
  583. {
  584. label: "用户平台",
  585. type: "checkbox",
  586. dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
  587. props: {
  588. label: "dictValue",
  589. value: "dictKey"
  590. },
  591. dataType: "number",
  592. search: true,
  593. hide: true,
  594. display: false,
  595. prop: "userType",
  596. rules: [{
  597. required: true,
  598. message: "请选择用户平台",
  599. trigger: "blur"
  600. }]
  601. },
  602. ],
  603. group: [
  604. {
  605. label: '基础信息',
  606. prop: 'baseInfo',
  607. icon: 'el-icon-user-solid',
  608. column: [
  609. {
  610. label: "所属租户",
  611. prop: "tenantId",
  612. type: "tree",
  613. dicUrl: "/api/blade-system/tenant/select",
  614. props: {
  615. label: "tenantName",
  616. value: "tenantId"
  617. },
  618. hide: !website.tenantMode,
  619. addDisplay: website.tenantMode,
  620. editDisplay: website.tenantMode,
  621. viewDisplay: website.tenantMode,
  622. rules: [{
  623. required: true,
  624. message: "请输入所属租户",
  625. trigger: "change"
  626. }],
  627. span: 24,
  628. },
  629. {
  630. label: "登录账号",
  631. prop: "account",
  632. rules: [{
  633. required: true,
  634. message: "请输入登录账号",
  635. trigger: "blur"
  636. }],
  637. },
  638. {
  639. label: '密码',
  640. prop: 'password',
  641. hide: true,
  642. editDisplay: false,
  643. viewDisplay: false,
  644. rules: [{required: true, validator: validatePass, trigger: 'blur'}]
  645. },
  646. {
  647. label: '确认密码',
  648. prop: 'password2',
  649. hide: true,
  650. editDisplay: false,
  651. viewDisplay: false,
  652. rules: [{required: true, validator: validatePass2, trigger: 'blur'}]
  653. },
  654. {
  655. label: "用户平台",
  656. type: "checkbox",
  657. dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
  658. props: {
  659. label: "dictValue",
  660. value: "dictKey"
  661. },
  662. dataType: "number",
  663. hide: false,
  664. prop: "userType",
  665. rules: [{
  666. required: true,
  667. message: "请选择用户平台",
  668. trigger: "blur"
  669. }]
  670. }
  671. ]
  672. },
  673. {
  674. label: '详细信息',
  675. prop: 'detailInfo',
  676. icon: 'el-icon-s-order',
  677. column: [
  678. {
  679. label: "用户姓名",
  680. prop: "realName",
  681. rules: [{
  682. required: true,
  683. message: "请输入用户姓名",
  684. trigger: "blur"
  685. }, {
  686. min: 2,
  687. max: 20,
  688. message: '姓名长度在2到5个字符'
  689. }]
  690. },
  691. {
  692. label: "手机号码",
  693. prop: "phone",
  694. rules: [{
  695. required: true,
  696. validator: phoneRules,
  697. trigger: "blur",
  698. }],
  699. },
  700. {
  701. label: "身份证号",
  702. prop: "idNumber",
  703. rules: [{
  704. required: false,
  705. validator: idNumberRules,
  706. trigger: "blur",
  707. }],
  708. },
  709. {
  710. label: "所属部门",
  711. prop: "deptId",
  712. type: "tree",
  713. // multiple: true,
  714. dicData: [],
  715. value: '',
  716. typeslot: true,
  717. props: {
  718. label: "title",
  719. value: 'value',
  720. },
  721. checkStrictly: false,
  722. // slot: true,
  723. rules: [{
  724. required: true,
  725. message: "请选择所属部门",
  726. trigger: "change"
  727. }]
  728. },
  729. {
  730. label: "证书编号",
  731. prop: "accCode",
  732. placeholder:"仅用于第三方便签",
  733. rules: [{
  734. required: false,
  735. message: "仅用于第三方便签",
  736. trigger: "blur",
  737. }],
  738. },
  739. ]
  740. },
  741. {
  742. label: '职能描述',
  743. prop: 'dutyInfo',
  744. icon: 'el-icon-s-custom',
  745. column: [
  746. {
  747. label: "参建项目",
  748. prop: "projectAndUserList",
  749. span: 24,
  750. addDisplay: false, // 新增时不显示
  751. // rules: [{
  752. // required: true,
  753. // validator: projectAndUserListRules,
  754. // trigger: "change"
  755. // }],
  756. },
  757. {
  758. label: "参与项目",
  759. prop: "projectId",
  760. span: 16,
  761. addDisplay: false, // 新增时不显示
  762. },
  763. {
  764. label: "合同段",
  765. prop: "contractId",
  766. span: 16,
  767. addDisplay: false, // 新增时不显示
  768. }, {
  769. label: "用户类型",
  770. prop: "roleIds",
  771. span: 16,
  772. addDisplay: false, // 新增时不显示
  773. }, {
  774. label: "单位名称",
  775. prop: "companyName",
  776. span: 16,
  777. addDisplay: false, // 新增时不显示
  778. }, {
  779. label: "职位",
  780. prop: "position",
  781. span: 16,
  782. addDisplay: false, // 新增时不显示
  783. },
  784. {
  785. label: "允许登录",
  786. type: "select",
  787. span: 16,
  788. prop: "status",
  789. dicData: [
  790. {value: 1, label: '是'},
  791. {value: 0, label: '否'}],
  792. rules: [{
  793. required: true,
  794. message: "请选择是否允许登录",
  795. trigger: "change"
  796. }],
  797. },
  798. ]
  799. },
  800. ]
  801. },
  802. data: [],
  803. platformQuery: {},
  804. platformSelectionList: [],
  805. platformData: [],
  806. platformForm: {},
  807. platformOption: {
  808. tip: false,
  809. searchShow: true,
  810. searchMenuSpan: 6,
  811. border: true,
  812. index: true,
  813. selection: true,
  814. viewBtn: true,
  815. dialogClickModal: false,
  816. menuWidth: 120,
  817. editBtnText: '配置',
  818. column: [
  819. {
  820. label: "登录账号",
  821. prop: "account",
  822. search: true,
  823. display: false
  824. },
  825. {
  826. label: "所属租户",
  827. prop: "tenantName",
  828. slot: true,
  829. display: false
  830. },
  831. {
  832. label: "用户姓名",
  833. prop: "realName",
  834. search: true,
  835. display: false
  836. },
  837. {
  838. label: "用户平台",
  839. prop: "userTypeName",
  840. slot: true,
  841. display: false
  842. },
  843. {
  844. label: "用户平台",
  845. type: "checkbox",
  846. dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
  847. props: {
  848. label: "dictValue",
  849. value: "dictKey"
  850. },
  851. dataType: "number",
  852. search: true,
  853. hide: true,
  854. display: false,
  855. prop: "userType",
  856. rules: [{
  857. required: true,
  858. message: "请选择用户平台",
  859. trigger: "blur"
  860. }]
  861. },
  862. {
  863. label: "用户拓展",
  864. prop: "userExt",
  865. type: "textarea",
  866. minRows: 8,
  867. span: 24,
  868. overHidden: true,
  869. row: true,
  870. hide: true,
  871. },
  872. ],
  873. },
  874. excelForm: {},
  875. excelOption: {
  876. submitBtn: false,
  877. emptyBtn: false,
  878. column: [
  879. {
  880. label: '模板上传',
  881. prop: 'excelFile',
  882. type: 'upload',
  883. drag: true,
  884. loadText: '模板上传中,请稍等',
  885. span: 24,
  886. propsHttp: {
  887. res: 'data'
  888. },
  889. tip: '请上传 .xls,.xlsx 标准格式文件',
  890. action: "/api/blade-user/import-user"
  891. },
  892. {
  893. label: "数据覆盖",
  894. prop: "isCovered",
  895. type: "switch",
  896. align: "center",
  897. width: 80,
  898. dicData: [
  899. {
  900. label: "否",
  901. value: 0
  902. },
  903. {
  904. label: "是",
  905. value: 1
  906. }
  907. ],
  908. value: 0,
  909. slot: true,
  910. rules: [
  911. {
  912. required: true,
  913. message: "请选择是否覆盖",
  914. trigger: "blur"
  915. }
  916. ]
  917. },
  918. {
  919. label: '模板下载',
  920. prop: 'excelTemplate',
  921. formslot: true,
  922. span: 24,
  923. }
  924. ]
  925. }
  926. };
  927. },
  928. watch: {
  929. 'form.tenantId'() {
  930. if (this.form.tenantId !== '' && this.initFlag) {
  931. this.initData(this.form.tenantId);
  932. }
  933. },
  934. 'excelForm.isCovered'() {
  935. if (this.excelForm.isCovered !== '') {
  936. const column = this.findObject(this.excelOption.column, "excelFile");
  937. column.action = `/api/blade-user/import-user?isCovered=${this.excelForm.isCovered}`;
  938. }
  939. },
  940. 'fromss.projectId': function () {
  941. this.fromss.contractId = ''
  942. if (this.fromss.projectId) {
  943. this.findContractByProjectId(this.fromss.projectId)
  944. } else {
  945. this.contractData = []
  946. }
  947. },
  948. },
  949. computed: {
  950. ...mapGetters(["userInfo", "permission"]),
  951. permissionList() {
  952. return {
  953. addBtn: this.vaildData(this.permission.user_add, false),
  954. viewBtn: this.vaildData(this.permission.user_view, false),
  955. delBtn: this.vaildData(this.permission.user_delete, false),
  956. editBtn: this.vaildData(this.permission.user_edit, false)
  957. };
  958. },
  959. platformPermissionList() {
  960. return {
  961. addBtn: false,
  962. viewBtn: false,
  963. delBtn: false,
  964. editBtn: this.vaildData(this.permission.user_edit, false)
  965. };
  966. },
  967. ids() {
  968. let ids = [];
  969. this.selectionList.forEach(ele => {
  970. ids.push(ele.id);
  971. });
  972. return ids.join(",");
  973. },
  974. },
  975. mounted() {
  976. // 非租户模式默认加载管理组数据
  977. if (!website.tenantMode) {
  978. this.initData(website.tenantId);
  979. }
  980. if (this.$route.query.tankai) {
  981. this.$refs.crud.rowAdd()
  982. this.getProjectList()
  983. this.initData(website.tenantId);
  984. }
  985. },
  986. methods: {
  987. //#region 弹框事件及方法
  988. addKJ() {
  989. this.getProjectList()//项目类型
  990. this.treeUser() //获取用户类型枚举
  991. this.fromss.projectAndUserList = []
  992. this.fromss.projectId = ''
  993. this.fromss.userId = ''
  994. this.fromss.contractId = ''
  995. this.fromss.roleIds = '' //合同段Id
  996. this.contractData = [] //合同段枚举
  997. this.form.deptName = this.addData.deptId
  998. const column = this.findObject(this.option.group, 'deptId')
  999. column.value = this.addData.deptId
  1000. this.$refs.crud.rowAdd()
  1001. },
  1002. addProject(type) {//确定添加参建项目
  1003. if (type == 'add') {
  1004. this.addfangfa()
  1005. } else {
  1006. const tag = true
  1007. if (!this.fromss.projectId) {
  1008. this.$message({
  1009. type: "error",
  1010. message: "请选择参与项目!"
  1011. })
  1012. return
  1013. }
  1014. if (!this.fromss.contractId) {
  1015. this.$message({
  1016. type: "error",
  1017. message: "请选择合同段!"
  1018. })
  1019. return
  1020. }
  1021. if (!this.fromss.roleIds) {
  1022. this.$message({
  1023. type: "error",
  1024. message: "请选择用户类型!"
  1025. })
  1026. return
  1027. }
  1028. if (tag) {
  1029. this.saveUserInfoByProjectTow([{
  1030. projectId: this.fromss.projectId,
  1031. contractId: this.fromss.contractId,
  1032. roleId: this.fromss.roleIds,
  1033. userId: this.fromss.userId
  1034. }])
  1035. }
  1036. }
  1037. },
  1038. addfangfa() {//添加时确定添加按钮方法处理
  1039. if (!this.fromss.projectId) {
  1040. this.$message({
  1041. type: "error",
  1042. message: "请选择参与项目!"
  1043. })
  1044. return
  1045. }
  1046. if (!this.fromss.contractId) {
  1047. this.$message({
  1048. type: "error",
  1049. message: "请选择合同段!"
  1050. })
  1051. return
  1052. }
  1053. if (!this.fromss.roleIds) {
  1054. this.$message({
  1055. type: "error",
  1056. message: "请选择用户类型!"
  1057. })
  1058. return
  1059. }
  1060. let tag = true, index = ''
  1061. if (this.fromss.projectAndUserList.length > 0) {
  1062. this.fromss.projectAndUserList.forEach((val, k) => {
  1063. if (val.projectId == this.fromss.projectId) {
  1064. index = k
  1065. tag = false
  1066. }
  1067. })
  1068. }
  1069. let das
  1070. if (tag) {
  1071. das = {
  1072. projectId: this.fromss.projectId,
  1073. contractId: this.fromss.contractId,
  1074. roleIds: this.fromss.roleIds,
  1075. roleName: '',
  1076. dataInfo: [{
  1077. contractName: '',
  1078. id: this.fromss.contractId,
  1079. roleIds: this.fromss.roleIds,
  1080. roleName: '',
  1081. roleType: '',
  1082. }],
  1083. contractName: this.fromss.contractId,
  1084. }
  1085. // 参与项目
  1086. this.projectData.forEach(vas => {
  1087. if (vas.id == this.fromss.projectId) {
  1088. das.projectName = vas.projectName
  1089. }
  1090. })
  1091. // 合同段
  1092. this.contractData.forEach(vas => {
  1093. if (vas.id == this.fromss.contractId) {
  1094. das.dataInfo[0].contractName = vas.contractName
  1095. }
  1096. })
  1097. // 用户类型
  1098. this.roleIdsData.forEach(vas => {
  1099. if (vas.roleId == this.fromss.roleIds) {
  1100. das.roleName = vas.roleName
  1101. }
  1102. })
  1103. // 添加进去
  1104. this.fromss.projectAndUserList.push(das)
  1105. this.$message({
  1106. type: "success",
  1107. message: "添加成功"
  1108. })
  1109. } else {
  1110. let tags = true
  1111. this.fromss.projectAndUserList[index].dataInfo.forEach((val) => {
  1112. if (val.id == this.fromss.contractId) {
  1113. tags = false
  1114. }
  1115. })
  1116. if (tags) {
  1117. das = {
  1118. contractName: '',
  1119. id: this.fromss.contractId,
  1120. roleIds: this.fromss.roleIds,
  1121. roleName: '',
  1122. roleType: '',
  1123. }
  1124. // 参与项目
  1125. this.projectData.forEach(vas => {
  1126. if (vas.id == this.fromss.projectId) {
  1127. das.projectName = vas.projectName
  1128. }
  1129. })
  1130. // 合同段
  1131. this.contractData.forEach(vas => {
  1132. if (vas.id == this.fromss.contractId) {
  1133. das.contractName = vas.contractName
  1134. }
  1135. })
  1136. // 用户类型
  1137. this.roleIdsData.forEach(vas => {
  1138. if (vas.roleId == this.fromss.roleIds) {
  1139. das.roleName = vas.roleName
  1140. }
  1141. })
  1142. // 添加进去
  1143. this.fromss.projectAndUserList[index].dataInfo.push(das)
  1144. this.$message({
  1145. type: "success",
  1146. message: "添加成功"
  1147. })
  1148. } else {
  1149. this.$message({
  1150. type: "error",
  1151. message: "当前合同段已添加,无法继续添加"
  1152. })
  1153. }
  1154. }
  1155. },
  1156. hetongChange(key) {//合同段changge事件
  1157. this.fromss.projectAndUserList[key].dataInfo.forEach(val => {
  1158. if (this.fromss.projectAndUserList[key].contractName == val.id) {
  1159. this.fromss.projectAndUserList[key].roleName = val.roleType + '|' + val.roleName
  1160. }
  1161. })
  1162. },
  1163. async editKJ(row, index) {//编辑用户
  1164. console.log(row);
  1165. this.fromss.userId = row.id //用户ID
  1166. this.fromss.contractId = '' //合同段Id
  1167. this.contractData = [] //合同段枚举
  1168. this.getProjectList() //项目类型
  1169. this.treeUser() //用户类型枚举
  1170. this.findProjectAndContractList(row.id) //编辑获取参建项目
  1171. this.$refs.crud.rowEdit(row, index)
  1172. },
  1173. deleteProject2(key, type) {//删除参建项目一条项目
  1174. if (type == 'add') {
  1175. this.fromss.projectAndUserList.splice(this.fromss.projectAndUserList[key], 1)
  1176. } else {
  1177. this.removeUserProjectInfoAndRoleById(this.fromss.projectAndUserList[key].dataInfo[0].id)
  1178. }
  1179. },
  1180. deleteProject(key, type, index) {//删除参建项目按钮
  1181. if (type == 'add') {
  1182. if (this.fromss.projectAndUserList[key].dataInfo.length == 1) {
  1183. this.fromss.projectAndUserList.splice(this.fromss.projectAndUserList[key], 1)
  1184. } else {
  1185. this.fromss.projectAndUserList[key].dataInfo.splice(this.fromss.projectAndUserList[key].dataInfo[index], 1)
  1186. this.fromss.projectAndUserList[key].roleName = this.fromss.projectAndUserList[key].dataInfo[0].roleName
  1187. this.fromss.projectAndUserList[key].contractName = this.fromss.projectAndUserList[key].dataInfo[0].id
  1188. this.fromss.projectAndUserList[key].contractId = this.fromss.projectAndUserList[key].dataInfo[0].id
  1189. }
  1190. } else {
  1191. this.removeUsersByIds(this.fromss.projectAndUserList[key].dataInfo[index].id)
  1192. }
  1193. },
  1194. async removeUserProjectInfoAndRoleById(id) {//参建项目删除一条项目
  1195. this.deletexiangmu = true
  1196. try {
  1197. const {data: res} = await removeUserProjectInfoAndRoleById({id})
  1198. console.log(res);
  1199. if (res.code == 200) {
  1200. await this.findProjectAndContractList(this.fromss.userId)
  1201. }
  1202. this.deletexiangmu = false
  1203. } catch (error) {
  1204. this.deletexiangmu = false
  1205. }
  1206. },
  1207. async beforeClose(done) {//弹框关闭事件
  1208. this.fromss = {
  1209. userId: '',//
  1210. projectAndUserList: [],
  1211. projectId: '',//参与项项目
  1212. contractId: '',//合同段
  1213. roleIds: '',//用户类型
  1214. },
  1215. await this.onLoad(this.page);
  1216. done()
  1217. },
  1218. async removeUsersByIds(ids) {//删除参建项目
  1219. this.deletexiangmu = true
  1220. try {
  1221. const {data: res} = await removeUsersByIds(ids)
  1222. console.log(res);
  1223. if (res.code == 200) {
  1224. this.$message({
  1225. type: 'success',
  1226. message: '删除成功'
  1227. })
  1228. await this.findProjectAndContractList(this.fromss.userId)
  1229. }
  1230. this.deletexiangmu = false
  1231. } catch (error) {
  1232. this.deletexiangmu = false
  1233. }
  1234. },
  1235. async getProjectList() {//项目类型
  1236. const {data: res} = await getProjectList(1, 999)
  1237. console.log(res);
  1238. if (res.code === 200) {
  1239. this.projectData = res.data.records
  1240. }
  1241. },
  1242. async findContractByProjectId(pId) {//合同段
  1243. const {data: res} = await findContractByProjectId(pId)
  1244. console.log(res);
  1245. if (res.code === 200) {
  1246. this.contractData = res.data
  1247. }
  1248. },
  1249. async treeUser() {//获取用户类型枚举
  1250. const {data: res} = await treeUser()
  1251. console.log(res);
  1252. if (res.code === 200) {
  1253. this.roleIdsData = res.data
  1254. }
  1255. },
  1256. async findProjectAndContractList(userId) {//编辑获取参建项目
  1257. const {data: res} = await findProjectAndContractList({userId})
  1258. console.log(res);
  1259. if (res.code === 200) {
  1260. res.data.forEach(val => {
  1261. val.contractName = val.dataInfo[0].id
  1262. if(val.dataInfo[0].roleType){
  1263. val.roleName = val.dataInfo[0].roleType + '|' + val.dataInfo[0].roleName
  1264. }else{
  1265. val.roleName = val.dataInfo[0].roleName
  1266. }
  1267. })
  1268. this.fromss.projectAndUserList = res.data
  1269. }
  1270. },
  1271. async saveUserInfoByProjectTow(da) {//编辑添加参建项目
  1272. const {data: res} = await saveUserInfoByProjectTow(da)
  1273. console.log(res);
  1274. if (res.code == 200) {
  1275. // this.fromss.projectId = '' //参与项项目
  1276. // this.fromss.contractId = '' //合同段
  1277. // this.fromss.roleIds = '' //用户类型
  1278. this.findProjectAndContractList(this.fromss.userId)
  1279. }
  1280. this.$message({
  1281. type: 'success',
  1282. message: '添加成功'
  1283. })
  1284. },
  1285. //#endregion
  1286. //#region 甘云杰
  1287. nodeClick(data) {
  1288. this.addData = {
  1289. tenantId: data.tenantId,
  1290. deptId: data.id
  1291. }
  1292. this.treeDeptId = data.id;
  1293. this.page.currentPage = 1;
  1294. this.onLoad(this.page);
  1295. },
  1296. initData(tenantId) {
  1297. //所属部门
  1298. getDeptTree(tenantId).then(res => {
  1299. const column = this.findObject(this.option.group, "deptId");
  1300. column.dicData = res.data.data;
  1301. });
  1302. },
  1303. submitRole() {
  1304. const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
  1305. grant(this.ids, roleList).then(() => {
  1306. this.roleBox = false;
  1307. this.$message({
  1308. type: "success",
  1309. message: "操作成功!"
  1310. });
  1311. this.onLoad(this.page);
  1312. });
  1313. },
  1314. rowSave(row, done, loading) { //新增保存
  1315. console.log('保存',this.fromss.projectAndUserList);
  1316. let projectAndUserList = []
  1317. this.fromss.projectAndUserList.forEach(val => {
  1318. if (val.dataInfo.length > 0) {
  1319. val.dataInfo.forEach(item => {
  1320. projectAndUserList.push({
  1321. projectId: val.projectId,
  1322. contractId: item.id,
  1323. roleId: item.roleIds,
  1324. })
  1325. })
  1326. }
  1327. })
  1328. add({...row, projectAndUserList}).then(() => {
  1329. this.initFlag = false;
  1330. this.onLoad(this.page);
  1331. this.$message({
  1332. type: "success",
  1333. message: "操作成功!"
  1334. });
  1335. done();
  1336. }, () => {
  1337. loading();
  1338. });
  1339. },
  1340. rowUpdate(row, index, done, loading) {//修改按钮
  1341. // row.roleId = row.roleId.join(",");
  1342. console.log(row,'row');
  1343. if(row.postId){
  1344. row.postId = row.postId.join(",");
  1345. }
  1346. let ks = {...row}
  1347. delete ks.projectAndUserList
  1348. delete ks.roleId
  1349. console.log(ks.userType,'userType');
  1350. let userTypeArry=ks.userType.split(',');
  1351. //正序排列
  1352. userTypeArry.sort((a,b)=>{return a-b}).toString();
  1353. ks.userType=userTypeArry.toString();
  1354. update({...ks}).then(() => {
  1355. this.initFlag = false;
  1356. this.onLoad(this.page);
  1357. this.$message({
  1358. type: "success",
  1359. message: "操作成功!"
  1360. });
  1361. done();
  1362. }, () => {
  1363. loading();
  1364. });
  1365. },
  1366. rowDel(row) {
  1367. this.$confirm("确定将选择数据删除?", {
  1368. confirmButtonText: "确定",
  1369. cancelButtonText: "取消",
  1370. type: "warning"
  1371. })
  1372. .then(() => {
  1373. return remove(row.id);
  1374. })
  1375. .then(() => {
  1376. this.onLoad(this.page);
  1377. this.$message({
  1378. type: "success",
  1379. message: "操作成功!"
  1380. });
  1381. });
  1382. },
  1383. searchReset() {
  1384. this.query = {};
  1385. this.treeDeptId = '';
  1386. this.onLoad(this.page);
  1387. },
  1388. searchChange(params, done) {
  1389. this.query = params;
  1390. this.page.currentPage = 1;
  1391. this.onLoad(this.page, params);
  1392. done();
  1393. },
  1394. selectionChange(list) {
  1395. this.selectionList = list;
  1396. },
  1397. selectionClear() {
  1398. this.selectionList = [];
  1399. this.$refs.crud.toggleSelection();
  1400. },
  1401. handleDelete() {
  1402. if (this.selectionList.length === 0) {
  1403. this.$message.warning("请选择至少一条数据");
  1404. return;
  1405. }
  1406. this.$confirm("确定将选择数据删除?", {
  1407. confirmButtonText: "确定",
  1408. cancelButtonText: "取消",
  1409. type: "warning"
  1410. })
  1411. .then(() => {
  1412. return remove(this.ids);
  1413. })
  1414. .then(() => {
  1415. this.onLoad(this.page);
  1416. this.$message({
  1417. type: "success",
  1418. message: "操作成功!"
  1419. });
  1420. this.$refs.crud.toggleSelection();
  1421. });
  1422. },
  1423. handleReset() {
  1424. if (this.selectionList.length === 0) {
  1425. this.$message.warning("请选择至少一条数据");
  1426. return;
  1427. }
  1428. this.$confirm("确定将选择账号密码重置为123456?", {
  1429. confirmButtonText: "确定",
  1430. cancelButtonText: "取消",
  1431. type: "warning"
  1432. })
  1433. .then(() => {
  1434. return resetPassword(this.ids);
  1435. })
  1436. .then(() => {
  1437. this.$message({
  1438. type: "success",
  1439. message: "操作成功!"
  1440. });
  1441. this.$refs.crud.toggleSelection();
  1442. });
  1443. },
  1444. handleGrant() {
  1445. if (this.selectionList.length === 0) {
  1446. this.$message.warning("请选择至少一条数据");
  1447. return;
  1448. }
  1449. this.roleTreeObj = [];
  1450. if (this.selectionList.length === 1) {
  1451. this.roleTreeObj = this.selectionList[0].roleId.split(",");
  1452. }
  1453. roletree().then(res => {
  1454. this.roleGrantList = res.data.data;
  1455. this.roleBox = true;
  1456. });
  1457. },
  1458. handlePlatform() {
  1459. this.platformBox = true;
  1460. },
  1461. handLock() {
  1462. if (this.selectionList.length === 0) {
  1463. this.$message.warning("请选择至少一条数据");
  1464. return;
  1465. }
  1466. this.$confirm("确定将选择账号封禁?", {
  1467. confirmButtonText: "确定",
  1468. cancelButtonText: "取消",
  1469. type: "warning"
  1470. })
  1471. .then(() => {
  1472. return lock(this.ids);
  1473. })
  1474. .then(() => {
  1475. this.$message({
  1476. type: "success",
  1477. message: "操作成功!"
  1478. });
  1479. });
  1480. },
  1481. handleLock() {
  1482. if (this.selectionList.length === 0) {
  1483. this.$message.warning("请选择至少一条数据");
  1484. return;
  1485. }
  1486. this.$confirm("确定将选择账号解封?", {
  1487. confirmButtonText: "确定",
  1488. cancelButtonText: "取消",
  1489. type: "warning"
  1490. })
  1491. .then(() => {
  1492. return unlock(this.ids);
  1493. })
  1494. .then(() => {
  1495. this.$message({
  1496. type: "success",
  1497. message: "操作成功!"
  1498. });
  1499. });
  1500. },
  1501. handleImport() {
  1502. this.excelBox = true;
  1503. },
  1504. uploadAfter(res, done, loading, column) {
  1505. window.console.log(column);
  1506. this.excelBox = false;
  1507. this.refreshChange();
  1508. done();
  1509. },
  1510. handleExport() {
  1511. this.$confirm("是否导出用户数据?", "提示", {
  1512. confirmButtonText: "确定",
  1513. cancelButtonText: "取消",
  1514. type: "warning"
  1515. }).then(() => {
  1516. NProgress.start();
  1517. exportBlob(`/api/blade-user/export-user?${this.website.tokenHeader}=${getToken()}&account=${this.search.account}&realName=${this.search.realName}`).then(res => {
  1518. downloadXls(res.data, `用户数据表${dateNow()}.xlsx`);
  1519. NProgress.done();
  1520. })
  1521. });
  1522. },
  1523. handleTemplate() {
  1524. exportBlob(`/api/blade-user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
  1525. downloadXls(res.data, "用户数据模板.xlsx");
  1526. })
  1527. },
  1528. beforeOpen(done, type) {
  1529. if (["edit", "view"].includes(type)) {
  1530. getUser(this.form.id).then(res => {
  1531. this.form = res.data.data;
  1532. if (this.form.hasOwnProperty("roleId")) {
  1533. this.form.roleId = this.form.roleId.split(",");
  1534. }
  1535. if (this.form.hasOwnProperty("postId")&&this.form.postId) {
  1536. this.form.postId = this.form.postId.split(",");
  1537. }
  1538. });
  1539. } else {
  1540. this.form.tenantId = this.addData.tenantId
  1541. }
  1542. this.initFlag = true;
  1543. done();
  1544. },
  1545. currentChange(currentPage) {
  1546. this.page.currentPage = currentPage;
  1547. },
  1548. sizeChange(pageSize) {
  1549. this.page.pageSize = pageSize;
  1550. },
  1551. refreshChange() {
  1552. this.onLoad(this.page, this.query);
  1553. },
  1554. onLoad(page, params = {}) {
  1555. this.loading = true;
  1556. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1557. const data = res.data.data;
  1558. this.page.total = data.total;
  1559. this.data = data.records;
  1560. this.loading = false;
  1561. this.selectionClear();
  1562. });
  1563. },
  1564. platformRowUpdate(row, index, done, loading) {
  1565. updatePlatform(row.id, row.userType, row.userExt).then(() => {
  1566. this.platformOnLoad(this.platformPage);
  1567. this.$message({
  1568. type: "success",
  1569. message: "操作成功!"
  1570. });
  1571. done();
  1572. }, error => {
  1573. window.console.log(error);
  1574. loading();
  1575. });
  1576. },
  1577. platformBeforeOpen(done, type) {
  1578. if (["edit", "view"].includes(type)) {
  1579. getUserPlatform(this.platformForm.id).then(res => {
  1580. this.platformForm = res.data.data;
  1581. });
  1582. }
  1583. done();
  1584. },
  1585. platformSearchReset() {
  1586. this.platformQuery = {};
  1587. this.platformOnLoad(this.platformPage);
  1588. },
  1589. platformSearchChange(params, done) {
  1590. this.platformQuery = params;
  1591. this.platformPage.currentPage = 1;
  1592. this.platformOnLoad(this.platformPage, params);
  1593. done();
  1594. },
  1595. platformSelectionChange(list) {
  1596. this.platformSelectionList = list;
  1597. },
  1598. platformSelectionClear() {
  1599. this.platformSelectionList = [];
  1600. this.$refs.platformCrud.toggleSelection();
  1601. },
  1602. platformCurrentChange(currentPage) {
  1603. this.platformPage.currentPage = currentPage;
  1604. },
  1605. platformSizeChange(pageSize) {
  1606. this.platformPage.pageSize = pageSize;
  1607. },
  1608. platformRefreshChange() {
  1609. this.platformOnLoad(this.platformPage, this.platformQuery);
  1610. },
  1611. platformOnLoad(page, params = {}) {
  1612. this.platformLoading = true;
  1613. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1614. const data = res.data.data;
  1615. this.platformPage.total = data.total;
  1616. this.platformData = data.records;
  1617. this.platformLoading = false;
  1618. this.selectionClear();
  1619. });
  1620. },
  1621. //#endregion
  1622. },
  1623. };
  1624. </script>
  1625. <style lang="scss">
  1626. .box {
  1627. height: 800px;
  1628. }
  1629. .el-scrollbar {
  1630. height: 100%;
  1631. }
  1632. .box .el-scrollbar__wrap {
  1633. overflow: scroll;
  1634. }
  1635. .my-basic-con {
  1636. padding: 6px 6px;
  1637. }
  1638. </style>