user.vue 46 KB

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