user.vue 45 KB

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