user.vue 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636
  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. callback(new Error('请输入正确的手机号'));
  426. } else {
  427. callback();
  428. }
  429. };
  430. const idNumberRules = (rule, value, callback) => {
  431. if (!value) {
  432. callback();
  433. } else {
  434. 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)) {
  435. callback(new Error('请输入正确的身份证号'));
  436. } else {
  437. callback();
  438. }
  439. }
  440. };
  441. const projectAndUserListRules = (rule, value, callback) => {
  442. if (this.fromss.projectAndUserList.length > 0) {
  443. callback();
  444. } else {
  445. callback(new Error('请设置参建项目'));
  446. }
  447. };
  448. return {
  449. deletexiangmu: false,
  450. addData: {
  451. tenantId: '',
  452. deptId: ''
  453. },
  454. form: {},
  455. search: {},
  456. roleBox: false,
  457. excelBox: false,
  458. platformBox: false,
  459. initFlag: true,
  460. selectionList: [],
  461. query: {},
  462. loading: true,
  463. platformLoading: false,
  464. page: {
  465. pageSize: 20,
  466. currentPage: 1,
  467. total: 0
  468. },
  469. platformPage: {
  470. pageSize: 10,
  471. currentPage: 1,
  472. total: 0
  473. },
  474. init: {
  475. roleTree: [],
  476. deptTree: [],
  477. },
  478. props: {
  479. label: "title",
  480. value: "key"
  481. },
  482. roleGrantList: [],
  483. roleTreeObj: [],
  484. treeDeptId: '',
  485. treeData: [],
  486. treeOption: {
  487. nodeKey: 'id',
  488. lazy: true,
  489. treeLoad: function (node, resolve) {
  490. const parentId = (node.level === 0) ? 0 : node.data.id;
  491. getDeptLazyTree(parentId).then(res => {
  492. resolve(res.data.data.map(item => {
  493. return {
  494. ...item,
  495. leaf: !item.hasChildren
  496. }
  497. }))
  498. });
  499. },
  500. addBtn: false,
  501. menu: false,
  502. size: 'small',
  503. props: {
  504. labelText: '标题',
  505. label: 'title',
  506. value: 'value',
  507. children: 'children'
  508. }
  509. },
  510. fromss: {
  511. userId: '',//
  512. projectAndUserList: [],
  513. projectId: '',//参与项项目
  514. contractId: '',//合同段
  515. roleIds: '',//用户类型
  516. },
  517. projectData: [],//参与项项目
  518. contractData: [],//合同段
  519. roleIdsData: [],//用户类型
  520. option: {
  521. height: 'auto',
  522. calcHeight: 80,
  523. tip: false,
  524. searchShow: true,
  525. searchMenuSpan: 6,
  526. border: true,
  527. index: true,
  528. selection: true,
  529. addBtn: false,
  530. // viewBtn: true,
  531. editBtn: false,
  532. delBtn: false,
  533. dialogType: 'drawer',
  534. dialogClickModal: false,
  535. column: [
  536. {
  537. label: "登录账号",
  538. prop: "account",
  539. search: true,
  540. display: false
  541. },
  542. {
  543. label: "所属租户",
  544. prop: "tenantName",
  545. slot: true,
  546. display: false
  547. },
  548. {
  549. label: "用户姓名",
  550. prop: "realName",
  551. search: true,
  552. display: false
  553. },
  554. {
  555. label: "所属角色",
  556. prop: "roleName",
  557. slot: true,
  558. display: false,
  559. },
  560. {
  561. label: "所属部门",
  562. prop: "deptName",
  563. slot: true,
  564. display: false,
  565. value: '',
  566. },
  567. {
  568. label: "用户平台",
  569. prop: "userTypeName",
  570. slot: true,
  571. display: false
  572. },
  573. {
  574. label: "用户平台",
  575. type: "checkbox",
  576. dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
  577. props: {
  578. label: "dictValue",
  579. value: "dictKey"
  580. },
  581. dataType: "number",
  582. search: true,
  583. hide: true,
  584. display: false,
  585. prop: "userType",
  586. rules: [{
  587. required: true,
  588. message: "请选择用户平台",
  589. trigger: "blur"
  590. }]
  591. },
  592. ],
  593. group: [
  594. {
  595. label: '基础信息',
  596. prop: 'baseInfo',
  597. icon: 'el-icon-user-solid',
  598. column: [
  599. {
  600. label: "所属租户",
  601. prop: "tenantId",
  602. type: "tree",
  603. dicUrl: "/api/blade-system/tenant/select",
  604. props: {
  605. label: "tenantName",
  606. value: "tenantId"
  607. },
  608. hide: !website.tenantMode,
  609. addDisplay: website.tenantMode,
  610. editDisplay: website.tenantMode,
  611. viewDisplay: website.tenantMode,
  612. rules: [{
  613. required: true,
  614. message: "请输入所属租户",
  615. trigger: "change"
  616. }],
  617. span: 24,
  618. },
  619. {
  620. label: "登录账号",
  621. prop: "account",
  622. rules: [{
  623. required: true,
  624. message: "请输入登录账号",
  625. trigger: "blur"
  626. }],
  627. },
  628. {
  629. label: '密码',
  630. prop: 'password',
  631. hide: true,
  632. editDisplay: false,
  633. viewDisplay: false,
  634. rules: [{required: true, validator: validatePass, trigger: 'blur'}]
  635. },
  636. {
  637. label: '确认密码',
  638. prop: 'password2',
  639. hide: true,
  640. editDisplay: false,
  641. viewDisplay: false,
  642. rules: [{required: true, validator: validatePass2, trigger: 'blur'}]
  643. },
  644. {
  645. label: "用户平台",
  646. type: "checkbox",
  647. dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
  648. props: {
  649. label: "dictValue",
  650. value: "dictKey"
  651. },
  652. dataType: "number",
  653. hide: false,
  654. prop: "userType",
  655. rules: [{
  656. required: true,
  657. message: "请选择用户平台",
  658. trigger: "blur"
  659. }]
  660. }
  661. ]
  662. },
  663. {
  664. label: '详细信息',
  665. prop: 'detailInfo',
  666. icon: 'el-icon-s-order',
  667. column: [
  668. {
  669. label: "用户姓名",
  670. prop: "realName",
  671. rules: [{
  672. required: true,
  673. message: "请输入用户姓名",
  674. trigger: "blur"
  675. }, {
  676. min: 2,
  677. max: 5,
  678. message: '姓名长度在2到5个字符'
  679. }]
  680. },
  681. {
  682. label: "手机号码",
  683. prop: "phone",
  684. rules: [{
  685. required: true,
  686. validator: phoneRules,
  687. trigger: "blur",
  688. }],
  689. },
  690. {
  691. label: "身份证号",
  692. prop: "idNumber",
  693. rules: [{
  694. required: false,
  695. validator: idNumberRules,
  696. trigger: "blur",
  697. }],
  698. },
  699. {
  700. label: "所属部门",
  701. prop: "deptId",
  702. type: "tree",
  703. // multiple: true,
  704. dicData: [],
  705. value: '',
  706. typeslot: true,
  707. props: {
  708. label: "title",
  709. value: 'value',
  710. },
  711. checkStrictly: false,
  712. // slot: true,
  713. rules: [{
  714. required: true,
  715. message: "请选择所属部门",
  716. trigger: "change"
  717. }]
  718. },
  719. {
  720. label: "证书编号",
  721. prop: "accCode",
  722. placeholder:"仅用于第三方便签",
  723. rules: [{
  724. required: false,
  725. message: "仅用于第三方便签",
  726. trigger: "blur",
  727. }],
  728. },
  729. ]
  730. },
  731. {
  732. label: '职能描述',
  733. prop: 'dutyInfo',
  734. icon: 'el-icon-s-custom',
  735. column: [
  736. {
  737. label: "参建项目",
  738. prop: "projectAndUserList",
  739. span: 24,
  740. rules: [{
  741. required: true,
  742. validator: projectAndUserListRules,
  743. trigger: "change"
  744. }],
  745. },
  746. {
  747. label: "参与项目",
  748. prop: "projectId",
  749. span: 16,
  750. },
  751. {
  752. label: "合同段",
  753. prop: "contractId",
  754. span: 16,
  755. }, {
  756. label: "用户类型",
  757. prop: "roleIds",
  758. span: 16,
  759. }, {
  760. label: "单位名称",
  761. prop: "companyName",
  762. span: 16,
  763. }, {
  764. label: "职位",
  765. prop: "position",
  766. span: 16,
  767. },
  768. {
  769. label: "允许登录",
  770. type: "select",
  771. span: 16,
  772. prop: "status",
  773. dicData: [
  774. {value: 1, label: '是'},
  775. {value: 0, label: '否'}],
  776. rules: [{
  777. required: true,
  778. message: "请选择是否允许登录",
  779. trigger: "change"
  780. }],
  781. },
  782. ]
  783. },
  784. ]
  785. },
  786. data: [],
  787. platformQuery: {},
  788. platformSelectionList: [],
  789. platformData: [],
  790. platformForm: {},
  791. platformOption: {
  792. tip: false,
  793. searchShow: true,
  794. searchMenuSpan: 6,
  795. border: true,
  796. index: true,
  797. selection: true,
  798. viewBtn: true,
  799. dialogClickModal: false,
  800. menuWidth: 120,
  801. editBtnText: '配置',
  802. column: [
  803. {
  804. label: "登录账号",
  805. prop: "account",
  806. search: true,
  807. display: false
  808. },
  809. {
  810. label: "所属租户",
  811. prop: "tenantName",
  812. slot: true,
  813. display: false
  814. },
  815. {
  816. label: "用户姓名",
  817. prop: "realName",
  818. search: true,
  819. display: false
  820. },
  821. {
  822. label: "用户平台",
  823. prop: "userTypeName",
  824. slot: true,
  825. display: false
  826. },
  827. {
  828. label: "用户平台",
  829. type: "checkbox",
  830. dicUrl: "/api/blade-system/dict/dictionary?code=user_type",
  831. props: {
  832. label: "dictValue",
  833. value: "dictKey"
  834. },
  835. dataType: "number",
  836. search: true,
  837. hide: true,
  838. display: false,
  839. prop: "userType",
  840. rules: [{
  841. required: true,
  842. message: "请选择用户平台",
  843. trigger: "blur"
  844. }]
  845. },
  846. {
  847. label: "用户拓展",
  848. prop: "userExt",
  849. type: "textarea",
  850. minRows: 8,
  851. span: 24,
  852. overHidden: true,
  853. row: true,
  854. hide: true,
  855. },
  856. ],
  857. },
  858. excelForm: {},
  859. excelOption: {
  860. submitBtn: false,
  861. emptyBtn: false,
  862. column: [
  863. {
  864. label: '模板上传',
  865. prop: 'excelFile',
  866. type: 'upload',
  867. drag: true,
  868. loadText: '模板上传中,请稍等',
  869. span: 24,
  870. propsHttp: {
  871. res: 'data'
  872. },
  873. tip: '请上传 .xls,.xlsx 标准格式文件',
  874. action: "/api/blade-user/import-user"
  875. },
  876. {
  877. label: "数据覆盖",
  878. prop: "isCovered",
  879. type: "switch",
  880. align: "center",
  881. width: 80,
  882. dicData: [
  883. {
  884. label: "否",
  885. value: 0
  886. },
  887. {
  888. label: "是",
  889. value: 1
  890. }
  891. ],
  892. value: 0,
  893. slot: true,
  894. rules: [
  895. {
  896. required: true,
  897. message: "请选择是否覆盖",
  898. trigger: "blur"
  899. }
  900. ]
  901. },
  902. {
  903. label: '模板下载',
  904. prop: 'excelTemplate',
  905. formslot: true,
  906. span: 24,
  907. }
  908. ]
  909. }
  910. };
  911. },
  912. watch: {
  913. 'form.tenantId'() {
  914. if (this.form.tenantId !== '' && this.initFlag) {
  915. this.initData(this.form.tenantId);
  916. }
  917. },
  918. 'excelForm.isCovered'() {
  919. if (this.excelForm.isCovered !== '') {
  920. const column = this.findObject(this.excelOption.column, "excelFile");
  921. column.action = `/api/blade-user/import-user?isCovered=${this.excelForm.isCovered}`;
  922. }
  923. },
  924. 'fromss.projectId': function () {
  925. this.fromss.contractId = ''
  926. if (this.fromss.projectId) {
  927. this.findContractByProjectId(this.fromss.projectId)
  928. } else {
  929. this.contractData = []
  930. }
  931. },
  932. },
  933. computed: {
  934. ...mapGetters(["userInfo", "permission"]),
  935. permissionList() {
  936. return {
  937. addBtn: this.vaildData(this.permission.user_add, false),
  938. viewBtn: this.vaildData(this.permission.user_view, false),
  939. delBtn: this.vaildData(this.permission.user_delete, false),
  940. editBtn: this.vaildData(this.permission.user_edit, false)
  941. };
  942. },
  943. platformPermissionList() {
  944. return {
  945. addBtn: false,
  946. viewBtn: false,
  947. delBtn: false,
  948. editBtn: this.vaildData(this.permission.user_edit, false)
  949. };
  950. },
  951. ids() {
  952. let ids = [];
  953. this.selectionList.forEach(ele => {
  954. ids.push(ele.id);
  955. });
  956. return ids.join(",");
  957. },
  958. },
  959. mounted() {
  960. // 非租户模式默认加载管理组数据
  961. if (!website.tenantMode) {
  962. this.initData(website.tenantId);
  963. }
  964. if (this.$route.query.tankai) {
  965. this.$refs.crud.rowAdd()
  966. }
  967. },
  968. methods: {
  969. //#region 弹框事件及方法
  970. addKJ() {
  971. this.getProjectList()//项目类型
  972. this.treeUser() //获取用户类型枚举
  973. this.fromss.projectAndUserList = []
  974. this.fromss.projectId = ''
  975. this.fromss.userId = ''
  976. this.fromss.contractId = ''
  977. this.fromss.roleIds = '' //合同段Id
  978. this.contractData = [] //合同段枚举
  979. this.form.deptName = this.addData.deptId
  980. const column = this.findObject(this.option.group, 'deptId')
  981. column.value = this.addData.deptId
  982. this.$refs.crud.rowAdd()
  983. },
  984. addProject(type) {//确定添加参建项目
  985. if (type == 'add') {
  986. this.addfangfa()
  987. } else {
  988. const tag = true
  989. if (!this.fromss.projectId) {
  990. this.$message({
  991. type: "error",
  992. message: "请选择参与项目!"
  993. })
  994. return
  995. }
  996. if (!this.fromss.contractId) {
  997. this.$message({
  998. type: "error",
  999. message: "请选择合同段!"
  1000. })
  1001. return
  1002. }
  1003. if (!this.fromss.roleIds) {
  1004. this.$message({
  1005. type: "error",
  1006. message: "请选择用户类型!"
  1007. })
  1008. return
  1009. }
  1010. if (tag) {
  1011. this.saveUserInfoByProjectTow([{
  1012. projectId: this.fromss.projectId,
  1013. contractId: this.fromss.contractId,
  1014. roleId: this.fromss.roleIds,
  1015. userId: this.fromss.userId
  1016. }])
  1017. }
  1018. }
  1019. },
  1020. addfangfa() {//添加时确定添加按钮方法处理
  1021. if (!this.fromss.projectId) {
  1022. this.$message({
  1023. type: "error",
  1024. message: "请选择参与项目!"
  1025. })
  1026. return
  1027. }
  1028. if (!this.fromss.contractId) {
  1029. this.$message({
  1030. type: "error",
  1031. message: "请选择合同段!"
  1032. })
  1033. return
  1034. }
  1035. if (!this.fromss.roleIds) {
  1036. this.$message({
  1037. type: "error",
  1038. message: "请选择用户类型!"
  1039. })
  1040. return
  1041. }
  1042. let tag = true, index = ''
  1043. if (this.fromss.projectAndUserList.length > 0) {
  1044. this.fromss.projectAndUserList.forEach((val, k) => {
  1045. if (val.projectId == this.fromss.projectId) {
  1046. index = k
  1047. tag = false
  1048. }
  1049. })
  1050. }
  1051. let das
  1052. if (tag) {
  1053. das = {
  1054. projectId: this.fromss.projectId,
  1055. contractId: this.fromss.contractId,
  1056. roleIds: this.fromss.roleIds,
  1057. roleName: '',
  1058. dataInfo: [{
  1059. contractName: '',
  1060. id: this.fromss.contractId,
  1061. roleIds: this.fromss.roleIds,
  1062. roleName: '',
  1063. roleType: '',
  1064. }],
  1065. contractName: this.fromss.contractId,
  1066. }
  1067. // 参与项目
  1068. this.projectData.forEach(vas => {
  1069. if (vas.id == this.fromss.projectId) {
  1070. das.projectName = vas.projectName
  1071. }
  1072. })
  1073. // 合同段
  1074. this.contractData.forEach(vas => {
  1075. if (vas.id == this.fromss.contractId) {
  1076. das.dataInfo[0].contractName = vas.contractName
  1077. }
  1078. })
  1079. // 用户类型
  1080. this.roleIdsData.forEach(vas => {
  1081. if (vas.roleId == this.fromss.roleIds) {
  1082. das.roleName = vas.roleName
  1083. }
  1084. })
  1085. // 添加进去
  1086. this.fromss.projectAndUserList.push(das)
  1087. this.$message({
  1088. type: "success",
  1089. message: "添加成功"
  1090. })
  1091. } else {
  1092. let tags = true
  1093. this.fromss.projectAndUserList[index].dataInfo.forEach((val) => {
  1094. if (val.id == this.fromss.contractId) {
  1095. tags = false
  1096. }
  1097. })
  1098. if (tags) {
  1099. das = {
  1100. contractName: '',
  1101. id: this.fromss.contractId,
  1102. roleIds: this.fromss.roleIds,
  1103. roleName: '',
  1104. roleType: '',
  1105. }
  1106. // 参与项目
  1107. this.projectData.forEach(vas => {
  1108. if (vas.id == this.fromss.projectId) {
  1109. das.projectName = vas.projectName
  1110. }
  1111. })
  1112. // 合同段
  1113. this.contractData.forEach(vas => {
  1114. if (vas.id == this.fromss.contractId) {
  1115. das.contractName = vas.contractName
  1116. }
  1117. })
  1118. // 用户类型
  1119. this.roleIdsData.forEach(vas => {
  1120. if (vas.roleId == this.fromss.roleIds) {
  1121. das.roleName = vas.roleName
  1122. }
  1123. })
  1124. // 添加进去
  1125. this.fromss.projectAndUserList[index].dataInfo.push(das)
  1126. this.$message({
  1127. type: "success",
  1128. message: "添加成功"
  1129. })
  1130. } else {
  1131. this.$message({
  1132. type: "error",
  1133. message: "当前合同段已添加,无法继续添加"
  1134. })
  1135. }
  1136. }
  1137. },
  1138. hetongChange(key) {//合同段changge事件
  1139. this.fromss.projectAndUserList[key].dataInfo.forEach(val => {
  1140. if (this.fromss.projectAndUserList[key].contractName == val.id) {
  1141. this.fromss.projectAndUserList[key].roleName = val.roleType + '|' + val.roleName
  1142. }
  1143. })
  1144. },
  1145. async editKJ(row, index) {//编辑用户
  1146. console.log(row);
  1147. this.fromss.userId = row.id //用户ID
  1148. this.fromss.contractId = '' //合同段Id
  1149. this.contractData = [] //合同段枚举
  1150. this.getProjectList() //项目类型
  1151. this.treeUser() //用户类型枚举
  1152. this.findProjectAndContractList(row.id) //编辑获取参建项目
  1153. this.$refs.crud.rowEdit(row, index)
  1154. },
  1155. deleteProject2(key, type) {//删除参建项目一条项目
  1156. if (type == 'add') {
  1157. this.fromss.projectAndUserList.splice(this.fromss.projectAndUserList[key], 1)
  1158. } else {
  1159. this.removeUserProjectInfoAndRoleById(this.fromss.projectAndUserList[key].dataInfo[0].id)
  1160. }
  1161. },
  1162. deleteProject(key, type, index) {//删除参建项目按钮
  1163. if (type == 'add') {
  1164. if (this.fromss.projectAndUserList[key].dataInfo.length == 1) {
  1165. this.fromss.projectAndUserList.splice(this.fromss.projectAndUserList[key], 1)
  1166. } else {
  1167. this.fromss.projectAndUserList[key].dataInfo.splice(this.fromss.projectAndUserList[key].dataInfo[index], 1)
  1168. this.fromss.projectAndUserList[key].roleName = this.fromss.projectAndUserList[key].dataInfo[0].roleName
  1169. this.fromss.projectAndUserList[key].contractName = this.fromss.projectAndUserList[key].dataInfo[0].id
  1170. this.fromss.projectAndUserList[key].contractId = this.fromss.projectAndUserList[key].dataInfo[0].id
  1171. }
  1172. } else {
  1173. this.removeUsersByIds(this.fromss.projectAndUserList[key].dataInfo[index].id)
  1174. }
  1175. },
  1176. async removeUserProjectInfoAndRoleById(id) {//参建项目删除一条项目
  1177. this.deletexiangmu = true
  1178. try {
  1179. const {data: res} = await removeUserProjectInfoAndRoleById({id})
  1180. console.log(res);
  1181. if (res.code == 200) {
  1182. await this.findProjectAndContractList(this.fromss.userId)
  1183. }
  1184. this.deletexiangmu = false
  1185. } catch (error) {
  1186. this.deletexiangmu = false
  1187. }
  1188. },
  1189. async beforeClose(done) {//弹框关闭事件
  1190. this.fromss = {
  1191. userId: '',//
  1192. projectAndUserList: [],
  1193. projectId: '',//参与项项目
  1194. contractId: '',//合同段
  1195. roleIds: '',//用户类型
  1196. },
  1197. await this.onLoad(this.page);
  1198. done()
  1199. },
  1200. async removeUsersByIds(ids) {//删除参建项目
  1201. this.deletexiangmu = true
  1202. try {
  1203. const {data: res} = await removeUsersByIds(ids)
  1204. console.log(res);
  1205. if (res.code == 200) {
  1206. this.$message({
  1207. type: 'success',
  1208. message: '删除成功'
  1209. })
  1210. await this.findProjectAndContractList(this.fromss.userId)
  1211. }
  1212. this.deletexiangmu = false
  1213. } catch (error) {
  1214. this.deletexiangmu = false
  1215. }
  1216. },
  1217. async getProjectList() {//项目类型
  1218. const {data: res} = await getProjectList(1, 999)
  1219. console.log(res);
  1220. if (res.code === 200) {
  1221. this.projectData = res.data.records
  1222. }
  1223. },
  1224. async findContractByProjectId(pId) {//合同段
  1225. const {data: res} = await findContractByProjectId(pId)
  1226. console.log(res);
  1227. if (res.code === 200) {
  1228. this.contractData = res.data
  1229. }
  1230. },
  1231. async treeUser() {//获取用户类型枚举
  1232. const {data: res} = await treeUser()
  1233. console.log(res);
  1234. if (res.code === 200) {
  1235. this.roleIdsData = res.data
  1236. }
  1237. },
  1238. async findProjectAndContractList(userId) {//编辑获取参建项目
  1239. const {data: res} = await findProjectAndContractList({userId})
  1240. console.log(res);
  1241. if (res.code === 200) {
  1242. res.data.forEach(val => {
  1243. val.contractName = val.dataInfo[0].id
  1244. if(val.dataInfo[0].roleType){
  1245. val.roleName = val.dataInfo[0].roleType + '|' + val.dataInfo[0].roleName
  1246. }else{
  1247. val.roleName = val.dataInfo[0].roleName
  1248. }
  1249. })
  1250. this.fromss.projectAndUserList = res.data
  1251. }
  1252. },
  1253. async saveUserInfoByProjectTow(da) {//编辑添加参建项目
  1254. const {data: res} = await saveUserInfoByProjectTow(da)
  1255. console.log(res);
  1256. if (res.code == 200) {
  1257. // this.fromss.projectId = '' //参与项项目
  1258. // this.fromss.contractId = '' //合同段
  1259. // this.fromss.roleIds = '' //用户类型
  1260. this.findProjectAndContractList(this.fromss.userId)
  1261. }
  1262. this.$message({
  1263. type: 'success',
  1264. message: '添加成功'
  1265. })
  1266. },
  1267. //#endregion
  1268. //#region 甘云杰
  1269. nodeClick(data) {
  1270. this.addData = {
  1271. tenantId: data.tenantId,
  1272. deptId: data.id
  1273. }
  1274. this.treeDeptId = data.id;
  1275. this.page.currentPage = 1;
  1276. this.onLoad(this.page);
  1277. },
  1278. initData(tenantId) {
  1279. //所属部门
  1280. getDeptTree(tenantId).then(res => {
  1281. const column = this.findObject(this.option.group, "deptId");
  1282. column.dicData = res.data.data;
  1283. });
  1284. },
  1285. submitRole() {
  1286. const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
  1287. grant(this.ids, roleList).then(() => {
  1288. this.roleBox = false;
  1289. this.$message({
  1290. type: "success",
  1291. message: "操作成功!"
  1292. });
  1293. this.onLoad(this.page);
  1294. });
  1295. },
  1296. rowSave(row, done, loading) { //新增保存
  1297. if (this.fromss.projectAndUserList.length > 0) {
  1298. let projectAndUserList = []
  1299. this.fromss.projectAndUserList.forEach(val => {
  1300. if (val.dataInfo.length > 0) {
  1301. val.dataInfo.forEach(item => {
  1302. projectAndUserList.push({
  1303. projectId: val.projectId,
  1304. contractId: item.id,
  1305. roleId: item.roleIds,
  1306. })
  1307. })
  1308. }
  1309. })
  1310. add({...row, projectAndUserList}).then(() => {
  1311. this.initFlag = false;
  1312. this.onLoad(this.page);
  1313. this.$message({
  1314. type: "success",
  1315. message: "操作成功!"
  1316. });
  1317. done();
  1318. }, () => {
  1319. loading();
  1320. });
  1321. } else {
  1322. loading()
  1323. }
  1324. },
  1325. rowUpdate(row, index, done, loading) {//修改按钮
  1326. // row.roleId = row.roleId.join(",");
  1327. row.postId = row.postId.join(",");
  1328. let ks = {...row}
  1329. delete ks.projectAndUserList
  1330. delete ks.roleId
  1331. console.log(ks,'ks');
  1332. update({...ks}).then(() => {
  1333. this.initFlag = false;
  1334. this.onLoad(this.page);
  1335. this.$message({
  1336. type: "success",
  1337. message: "操作成功!"
  1338. });
  1339. done();
  1340. }, () => {
  1341. loading();
  1342. });
  1343. },
  1344. rowDel(row) {
  1345. this.$confirm("确定将选择数据删除?", {
  1346. confirmButtonText: "确定",
  1347. cancelButtonText: "取消",
  1348. type: "warning"
  1349. })
  1350. .then(() => {
  1351. return remove(row.id);
  1352. })
  1353. .then(() => {
  1354. this.onLoad(this.page);
  1355. this.$message({
  1356. type: "success",
  1357. message: "操作成功!"
  1358. });
  1359. });
  1360. },
  1361. searchReset() {
  1362. this.query = {};
  1363. this.treeDeptId = '';
  1364. this.onLoad(this.page);
  1365. },
  1366. searchChange(params, done) {
  1367. this.query = params;
  1368. this.page.currentPage = 1;
  1369. this.onLoad(this.page, params);
  1370. done();
  1371. },
  1372. selectionChange(list) {
  1373. this.selectionList = list;
  1374. },
  1375. selectionClear() {
  1376. this.selectionList = [];
  1377. this.$refs.crud.toggleSelection();
  1378. },
  1379. handleDelete() {
  1380. if (this.selectionList.length === 0) {
  1381. this.$message.warning("请选择至少一条数据");
  1382. return;
  1383. }
  1384. this.$confirm("确定将选择数据删除?", {
  1385. confirmButtonText: "确定",
  1386. cancelButtonText: "取消",
  1387. type: "warning"
  1388. })
  1389. .then(() => {
  1390. return remove(this.ids);
  1391. })
  1392. .then(() => {
  1393. this.onLoad(this.page);
  1394. this.$message({
  1395. type: "success",
  1396. message: "操作成功!"
  1397. });
  1398. this.$refs.crud.toggleSelection();
  1399. });
  1400. },
  1401. handleReset() {
  1402. if (this.selectionList.length === 0) {
  1403. this.$message.warning("请选择至少一条数据");
  1404. return;
  1405. }
  1406. this.$confirm("确定将选择账号密码重置为123456?", {
  1407. confirmButtonText: "确定",
  1408. cancelButtonText: "取消",
  1409. type: "warning"
  1410. })
  1411. .then(() => {
  1412. return resetPassword(this.ids);
  1413. })
  1414. .then(() => {
  1415. this.$message({
  1416. type: "success",
  1417. message: "操作成功!"
  1418. });
  1419. this.$refs.crud.toggleSelection();
  1420. });
  1421. },
  1422. handleGrant() {
  1423. if (this.selectionList.length === 0) {
  1424. this.$message.warning("请选择至少一条数据");
  1425. return;
  1426. }
  1427. this.roleTreeObj = [];
  1428. if (this.selectionList.length === 1) {
  1429. this.roleTreeObj = this.selectionList[0].roleId.split(",");
  1430. }
  1431. roletree().then(res => {
  1432. this.roleGrantList = res.data.data;
  1433. this.roleBox = true;
  1434. });
  1435. },
  1436. handlePlatform() {
  1437. this.platformBox = true;
  1438. },
  1439. handLock() {
  1440. if (this.selectionList.length === 0) {
  1441. this.$message.warning("请选择至少一条数据");
  1442. return;
  1443. }
  1444. this.$confirm("确定将选择账号封禁?", {
  1445. confirmButtonText: "确定",
  1446. cancelButtonText: "取消",
  1447. type: "warning"
  1448. })
  1449. .then(() => {
  1450. return lock(this.ids);
  1451. })
  1452. .then(() => {
  1453. this.$message({
  1454. type: "success",
  1455. message: "操作成功!"
  1456. });
  1457. });
  1458. },
  1459. handleLock() {
  1460. if (this.selectionList.length === 0) {
  1461. this.$message.warning("请选择至少一条数据");
  1462. return;
  1463. }
  1464. this.$confirm("确定将选择账号解封?", {
  1465. confirmButtonText: "确定",
  1466. cancelButtonText: "取消",
  1467. type: "warning"
  1468. })
  1469. .then(() => {
  1470. return unlock(this.ids);
  1471. })
  1472. .then(() => {
  1473. this.$message({
  1474. type: "success",
  1475. message: "操作成功!"
  1476. });
  1477. });
  1478. },
  1479. handleImport() {
  1480. this.excelBox = true;
  1481. },
  1482. uploadAfter(res, done, loading, column) {
  1483. window.console.log(column);
  1484. this.excelBox = false;
  1485. this.refreshChange();
  1486. done();
  1487. },
  1488. handleExport() {
  1489. this.$confirm("是否导出用户数据?", "提示", {
  1490. confirmButtonText: "确定",
  1491. cancelButtonText: "取消",
  1492. type: "warning"
  1493. }).then(() => {
  1494. NProgress.start();
  1495. exportBlob(`/api/blade-user/export-user?${this.website.tokenHeader}=${getToken()}&account=${this.search.account}&realName=${this.search.realName}`).then(res => {
  1496. downloadXls(res.data, `用户数据表${dateNow()}.xlsx`);
  1497. NProgress.done();
  1498. })
  1499. });
  1500. },
  1501. handleTemplate() {
  1502. exportBlob(`/api/blade-user/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
  1503. downloadXls(res.data, "用户数据模板.xlsx");
  1504. })
  1505. },
  1506. beforeOpen(done, type) {
  1507. if (["edit", "view"].includes(type)) {
  1508. getUser(this.form.id).then(res => {
  1509. this.form = res.data.data;
  1510. if (this.form.hasOwnProperty("roleId")) {
  1511. this.form.roleId = this.form.roleId.split(",");
  1512. }
  1513. if (this.form.hasOwnProperty("postId")) {
  1514. this.form.postId = this.form.postId.split(",");
  1515. }
  1516. });
  1517. } else {
  1518. this.form.tenantId = this.addData.tenantId
  1519. }
  1520. this.initFlag = true;
  1521. done();
  1522. },
  1523. currentChange(currentPage) {
  1524. this.page.currentPage = currentPage;
  1525. },
  1526. sizeChange(pageSize) {
  1527. this.page.pageSize = pageSize;
  1528. },
  1529. refreshChange() {
  1530. this.onLoad(this.page, this.query);
  1531. },
  1532. onLoad(page, params = {}) {
  1533. this.loading = true;
  1534. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1535. const data = res.data.data;
  1536. this.page.total = data.total;
  1537. this.data = data.records;
  1538. this.loading = false;
  1539. this.selectionClear();
  1540. });
  1541. },
  1542. platformRowUpdate(row, index, done, loading) {
  1543. updatePlatform(row.id, row.userType, row.userExt).then(() => {
  1544. this.platformOnLoad(this.platformPage);
  1545. this.$message({
  1546. type: "success",
  1547. message: "操作成功!"
  1548. });
  1549. done();
  1550. }, error => {
  1551. window.console.log(error);
  1552. loading();
  1553. });
  1554. },
  1555. platformBeforeOpen(done, type) {
  1556. if (["edit", "view"].includes(type)) {
  1557. getUserPlatform(this.platformForm.id).then(res => {
  1558. this.platformForm = res.data.data;
  1559. });
  1560. }
  1561. done();
  1562. },
  1563. platformSearchReset() {
  1564. this.platformQuery = {};
  1565. this.platformOnLoad(this.platformPage);
  1566. },
  1567. platformSearchChange(params, done) {
  1568. this.platformQuery = params;
  1569. this.platformPage.currentPage = 1;
  1570. this.platformOnLoad(this.platformPage, params);
  1571. done();
  1572. },
  1573. platformSelectionChange(list) {
  1574. this.platformSelectionList = list;
  1575. },
  1576. platformSelectionClear() {
  1577. this.platformSelectionList = [];
  1578. this.$refs.platformCrud.toggleSelection();
  1579. },
  1580. platformCurrentChange(currentPage) {
  1581. this.platformPage.currentPage = currentPage;
  1582. },
  1583. platformSizeChange(pageSize) {
  1584. this.platformPage.pageSize = pageSize;
  1585. },
  1586. platformRefreshChange() {
  1587. this.platformOnLoad(this.platformPage, this.platformQuery);
  1588. },
  1589. platformOnLoad(page, params = {}) {
  1590. this.platformLoading = true;
  1591. getList(page.currentPage, page.pageSize, Object.assign(params, this.query), this.treeDeptId).then(res => {
  1592. const data = res.data.data;
  1593. this.platformPage.total = data.total;
  1594. this.platformData = data.records;
  1595. this.platformLoading = false;
  1596. this.selectionClear();
  1597. });
  1598. },
  1599. //#endregion
  1600. },
  1601. };
  1602. </script>
  1603. <style lang="scss">
  1604. .box {
  1605. height: 800px;
  1606. }
  1607. .el-scrollbar {
  1608. height: 100%;
  1609. }
  1610. .box .el-scrollbar__wrap {
  1611. overflow: scroll;
  1612. }
  1613. .my-basic-con {
  1614. padding: 6px 6px;
  1615. }
  1616. </style>