You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

717 lines
24 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 month ago
1 year ago
1 month ago
1 year ago
12 months ago
12 months ago
1 month ago
12 months ago
1 year ago
1 year ago
1 year ago
1 month ago
1 year ago
12 months ago
1 month ago
12 months ago
1 year ago
1 month ago
1 year ago
1 month ago
1 year ago
1 month ago
1 year ago
1 month ago
1 year ago
1 month ago
1 year ago
7 months ago
1 month ago
1 year ago
7 months ago
1 month ago
1 year ago
1 month ago
1 year ago
4 weeks ago
1 year ago
4 weeks ago
1 year ago
12 months ago
1 year ago
4 weeks ago
12 months ago
1 year ago
12 months ago
7 months ago
1 year ago
1 month ago
1 year ago
12 months ago
1 year ago
12 months ago
4 weeks ago
1 year ago
4 weeks ago
1 year ago
4 weeks ago
1 year ago
4 weeks ago
1 year ago
4 weeks ago
1 year ago
4 weeks ago
1 year ago
4 weeks ago
1 year ago
4 weeks ago
1 year ago
12 months ago
1 month ago
12 months ago
1 month ago
12 months ago
1 year ago
1 month ago
1 year ago
1 month ago
1 year ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 month ago
7 months ago
1 year ago
1 month ago
1 year ago
  1. <template>
  2. <div class="mod-user">
  3. <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
  4. <el-form-item>
  5. <el-input v-model="dataForm.userName" :placeholder="this.$t('user.table.userNameplaceholder')" clearable></el-input>
  6. </el-form-item>
  7. <el-form-item>
  8. <el-button @click="getDataList()" type="primary">{{ $t('user.table.search') }}</el-button>
  9. <el-button type="primary" @click="addOrUpdateHandle()">
  10. {{ $t('user.table.add') }}
  11. </el-button>
  12. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary"
  13. @click="specialAuthorize()"
  14. >{{ buttons.specialCompetencies || $t('sys.user.specialPermissions') }}
  15. </el-button>
  16. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary"
  17. @click="siteAuthorize()"
  18. > {{ buttons.factoryAuthorization || $t('sys.user.factoryAuthorization') }}
  19. </el-button>
  20. <el-button type="primary" :disabled="this.showButton"
  21. @click="warehouseAuthorize()"
  22. > {{ buttons.warehouseAuthorization || $t('sys.user.warehouseAuthorization') }}
  23. </el-button>
  24. </el-form-item>
  25. </el-form>
  26. <el-table
  27. :data="dataList"
  28. border
  29. :height="height"
  30. v-loading="dataListLoading"
  31. @selection-change="selectionChangeHandle"
  32. highlight-current-row
  33. @current-change="handleCurrentChange"
  34. style="width: 100%;">
  35. <el-table-column
  36. prop="username"
  37. header-align="center"
  38. align="center"
  39. :label="this.$t('user.table.userNameplaceholder')">
  40. </el-table-column>
  41. <el-table-column
  42. prop="userDisplay"
  43. header-align="center"
  44. align="center"
  45. :label="buttons.userDisplay||$t('sys.user.userName')">
  46. </el-table-column>
  47. <el-table-column
  48. prop="domainAccount"
  49. header-align="center"
  50. align="center"
  51. :label="buttons.domainAccount||$t('sys.user.domainAccount')">
  52. </el-table-column>
  53. <el-table-column
  54. prop="email"
  55. header-align="center"
  56. align="center"
  57. :label="buttons.email||$t('sys.user.email')">
  58. </el-table-column>
  59. <el-table-column
  60. prop="mobile"
  61. header-align="center"
  62. align="center"
  63. :label="buttons.mobile||$t('sys.user.mobile')">
  64. </el-table-column>
  65. <el-table-column
  66. prop="status"
  67. header-align="center"
  68. align="center"
  69. :label="buttons.status||$t('sys.user.status')">
  70. <template slot-scope="scope">
  71. <el-link v-if="scope.row.status === 0" type="success">{{ buttons.disable || $t('sys.user.disabled') }}</el-link>
  72. <el-link v-else type="danger">{{ buttons.normal || $t('sys.user.normal') }}</el-link>
  73. </template>
  74. </el-table-column>
  75. <el-table-column
  76. prop="createTime"
  77. header-align="center"
  78. align="center"
  79. width="180"
  80. :label="buttons.createTime||$t('sys.common.createTime')">
  81. </el-table-column>
  82. <el-table-column
  83. fixed="right"
  84. header-align="center"
  85. align="center"
  86. width="200"
  87. :label="buttons.cz||$t('sys.common.operation')">
  88. <template slot-scope="scope">
  89. <!-- <a type="text" @click="generateData(scope.row)">{{ buttons.auth || '审核' }}</a>-->
  90. <a type="text" v-if="scope.row.username!=='sys_wms'" @click="addOrUpdateHandle(scope.row.userId)">{{ buttons.edit || $t('sys.common.edit') }}</a>
  91. <a type="text" v-if="scope.row.username!=='sys_wms'&&scope.row.username!=='admin'" @click="deleteHandle(scope.row.userId)">{{ buttons.delete || $t('sys.common.delete') }}</a>
  92. <a type="text" v-if="scope.row.username!=='sys_wms'" @click="forceLogoutHandle(scope.row)" style="color: #F56C6C;">{{ buttons.forceLogout || $t('sys.user.kickout') }}</a>
  93. </template>
  94. </el-table-column>
  95. </el-table>
  96. <el-pagination
  97. @size-change="sizeChangeHandle"
  98. @current-change="currentChangeHandle"
  99. :current-page="pageIndex"
  100. :page-sizes="[20, 50, 100, 200,500]"
  101. :page-size="pageSize"
  102. :total="totalPage"
  103. layout="total, sizes, prev, pager, next, jumper">
  104. </el-pagination>
  105. <!-- 弹窗, 新增 / 修改 -->
  106. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList"></add-or-update>
  107. <!-- 审核权限 -->
  108. <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag :title="inputSearch1"
  109. :visible.sync="setUp.reviewFlag" width="518px">
  110. <template>
  111. <el-transfer v-model="checked" :data="transferData"
  112. :titles="[buttons.allAuth || $t('sys.user.allPermissions'), buttons.currentAuth || $t('sys.user.currentPermissions')]"></el-transfer>
  113. </template>
  114. <span slot="footer" class="dialog-footer">
  115. <div style="margin-top: 5px">
  116. <el-button type="primary" :disabled="setUp.saveButton" @click="saveUserRoleFlag()">确定</el-button>
  117. <el-button type="primary" @click="setUp.reviewFlag = false">取消</el-button>
  118. </div>
  119. </span>
  120. </el-dialog>
  121. <!-- 特殊权限 -->
  122. <el-dialog
  123. v-drag
  124. :title="'特殊性权限'"
  125. :visible.sync="specialVisible"
  126. width="820px"
  127. :append-to-body="true">
  128. <el-table
  129. :data="securityList"
  130. border
  131. :height="securityHeight"
  132. v-loading="dataListLoading"
  133. style="width: 100%;">
  134. <el-table-column
  135. v-for="(item,index) in columnList" :key="index"
  136. :sortable="item.columnSortable"
  137. :prop="item.columnProp"
  138. :header-align="item.headerAlign"
  139. :show-overflow-tooltip="item.showOverflowTooltip"
  140. :align="item.align"
  141. :fixed="item.fixed==''?false:item.fixed"
  142. :min-width="item.columnWidth"
  143. :label="item.columnLabel">
  144. <template slot-scope="scope">
  145. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  146. <span v-if="item.columnHidden">
  147. <el-checkbox v-model="scope.row[item.columnProp] "></el-checkbox>
  148. </span>
  149. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
  150. style="width: 100px; height: 80px"/></span>
  151. </template>
  152. </el-table-column>
  153. </el-table>
  154. <span slot="footer" class="dialog-footer">
  155. <el-button type="primary" @click="saveUserSecurity()">确定</el-button>
  156. <el-button @click="specialVisible = false" type="primary">取消</el-button>
  157. </span>
  158. </el-dialog>
  159. <!-- 工厂授权 -->
  160. <el-dialog
  161. style="font-size: 12px"
  162. v-drag
  163. :title="'工厂/子site授权'"
  164. :visible.sync="siteVisible"
  165. width="518px"
  166. :append-to-body="true">
  167. <el-transfer v-model="selectSitList" :data="siteList" :titles="['未授权子site', '已授权子site']"></el-transfer>
  168. <span slot="footer" class="dialog-footer">
  169. <div style="margin-top: 5px">
  170. <el-button type="primary" @click="saveUserAssessSite()">确定</el-button>
  171. <el-button @click="siteVisible = false" type="primary">取消</el-button>
  172. </div>
  173. </span>
  174. </el-dialog>
  175. <!-- 仓库授权 -->
  176. <el-dialog
  177. style="font-size: 12px"
  178. v-drag
  179. :title="'仓库授权'"
  180. :visible.sync="warehouseVisible"
  181. width="518px"
  182. :append-to-body="true">
  183. <el-transfer v-model="selectWarehouseList" :data="warehouseList" :titles="['未授权仓库', '已授权仓库']"></el-transfer>
  184. <span slot="footer" class="dialog-footer">
  185. <div style="margin-top: 5px">
  186. <el-button type="primary" @click="saveUserAccessWarehouse()">确定</el-button>
  187. <el-button @click="warehouseVisible = false" type="primary">取消</el-button>
  188. </div>
  189. </span>
  190. </el-dialog>
  191. </div>
  192. </template>
  193. <script>
  194. import {getActiveSubSiteOptions, getUserAuthorizedSiteAccess, saveUserAccessSiteList} from '@/api/factory/accessSite.js'
  195. import {getUserAccessWarehouseList, saveUserAccessWarehouseList, getWarehouseListForAuth} from '@/api/warehouse/warehouse.js'
  196. import AddOrUpdate from './user-add-or-update'
  197. import {getUserBusinessRoleList, saveUserBusinessRole,} from '@/api/auditManagement/auditType.js'
  198. import {
  199. getUserSpecialSecurity,
  200. saveUserSpecialSecurity,
  201. updateUserSpecialSecurity
  202. } from '@/api/factory/userSpecialSecurity.js'
  203. import {debounce, throttle} from "../../../utils/common";
  204. import {
  205. searchFunctionButtonList,
  206. } from "@/api/sysLanguage.js"
  207. export default {
  208. data() {
  209. return {
  210. showButton: true,
  211. height: 200,
  212. securityHeight: 300,
  213. specialVisible: false,
  214. siteVisible: false,
  215. warehouseVisible: false,
  216. forceLogoutLoading: false,
  217. currentData: {},
  218. userId: this.$store.state.user.name,
  219. transferData: [],
  220. checked: [],
  221. inputSearch1: '审核权限',
  222. //设置
  223. setUp: {
  224. reviewFlag: false,
  225. saveButton: false,
  226. },
  227. dataForm: {
  228. userName: ''
  229. },
  230. columnList: [
  231. {
  232. userId: this.$store.state.user.name,
  233. serialNumber: 'security' + this.$route.meta.menuId + 'securitydesc',
  234. tableId: this.$route.meta.menuId + 'security',
  235. tableName: "securityTable",
  236. columnProp: "securitydesc",
  237. headerAlign: "center",
  238. align: "left",
  239. columnLabel: "参数描述",
  240. columnHidden: false,
  241. columnImage: false,
  242. columnWidth: 70,
  243. columnSortable: false,
  244. sortLv: 0,
  245. status: true,
  246. fixed: '',
  247. },
  248. {
  249. userId: this.$store.state.user.name,
  250. serialNumber: 'security' + this.$route.meta.menuId + 'securitydesc',
  251. tableId: this.$route.meta.menuId + 'security',
  252. tableName: "securityTable",
  253. columnProp: "module",
  254. headerAlign: "center",
  255. align: "left",
  256. columnLabel: "模块",
  257. columnHidden: false,
  258. columnImage: false,
  259. columnSortable: false,
  260. columnWidth: 20,
  261. sortLv: 0,
  262. status: true,
  263. fixed: '',
  264. },
  265. {
  266. userId: this.$store.state.user.name,
  267. serialNumber: 'security' + this.$route.meta.menuId + 'securitydesc',
  268. tableId: this.$route.meta.menuId + 'security',
  269. tableName: "securityTable",
  270. columnProp: "itemvalue",
  271. headerAlign: "center",
  272. align: "center",
  273. columnLabel: "参数值",
  274. columnHidden: true,
  275. columnImage: false,
  276. columnSortable: false,
  277. columnWidth: 10,
  278. sortLv: 0,
  279. status: true,
  280. fixed: '',
  281. },
  282. ],
  283. buttons: {
  284. cz: this.$t('sys.common.operation'), search: this.$t('sys.common.search'), add: this.$t('sys.common.add'), edit: this.$t('sys.common.edit'), delete: this.$t('sys.common.delete'),
  285. forceLogout: this.$t('sys.user.kickout'), specialCompetencies: this.$t('sys.user.specialPermissions'), factoryAuthorization: this.$t('sys.user.factoryAuthorization'), warehouseAuthorization: this.$t('sys.user.warehouseAuthorization'),
  286. createTime: this.$t('sys.common.createTime'), username: this.$t('sys.user.account'), userDisplay: this.$t('sys.user.userName'), domainAccount: this.$t('sys.user.domainAccount'), email: this.$t('sys.user.email'), mobile: this.$t('sys.user.mobile'),
  287. status: this.$t('sys.user.status'), disable: this.$t('sys.user.disabled'), normal: this.$t('sys.user.normal'), auth: this.$t('sys.user.review'), allAuth: this.$t('sys.user.allPermissions'), currentAuth: this.$t('sys.user.currentPermissions')
  288. },
  289. dataList: [],
  290. securityList: [],
  291. selectSpecialList: [],
  292. siteList: [],
  293. selectSitList: [],
  294. warehouseList: [],
  295. selectWarehouseList: [],
  296. selectUser: {},
  297. pageIndex: 1,
  298. pageSize: 20,
  299. totalPage: 0,
  300. dataListLoading: false,
  301. dataListSelections: [],
  302. addOrUpdateVisible: false
  303. }
  304. },
  305. components: {
  306. AddOrUpdate
  307. },
  308. activated() {
  309. this.getDataList()
  310. },
  311. mounted() {
  312. this.$nextTick(() => {
  313. this.securityHeight = window.innerHeight - 300;
  314. this.height = window.innerHeight - 200;
  315. })
  316. },
  317. methods: {
  318. // 获取button的词典
  319. getFunctionButtonList() {
  320. let queryButton = {
  321. functionId: this.$route.meta.menuId,
  322. tableId: '*',
  323. languageCode: this.$i18n.locale,
  324. objectType: 'button'
  325. }
  326. searchFunctionButtonList(queryButton).then(({data}) => {
  327. if (data.code == 0 && data.data) {
  328. this.buttons = data.data
  329. }
  330. })
  331. },
  332. // 特殊权限
  333. specialAuthorize() {
  334. this.specialVisible = true
  335. this.searchUserSpecialSecurity()
  336. },
  337. // 获取特殊权限
  338. searchUserSpecialSecurity() {
  339. saveUserSpecialSecurity({userid: this.selectUser.username}).then(({data}) => {
  340. if (data.code === 0) {
  341. getUserSpecialSecurity(this.selectUser.username).then(({data}) => {
  342. if (data.code === 0) {
  343. this.securityList = data.dataList.map(item => {
  344. item.itemvalue = item.itemvalue == 'Y' ? true : false;
  345. return item;
  346. })
  347. }
  348. })
  349. }
  350. })
  351. },
  352. // 保存用户权限
  353. saveUserSecurity() {
  354. let securityList = JSON.parse(JSON.stringify(this.securityList)).map(item => {
  355. item.itemvalue = item.itemvalue === true ? 'Y' : 'N';
  356. return item;
  357. })
  358. updateUserSpecialSecurity(securityList).then(({data}) => {
  359. if (data.code === 0) {
  360. this.$message.success(data.msg)
  361. this.specialVisible = false
  362. } else {
  363. this.$message.success(data.msg)
  364. }
  365. })
  366. },
  367. // 授权工厂
  368. siteAuthorize() {
  369. this.siteVisible = true
  370. this.searchSiteList()
  371. },
  372. // 授权仓库
  373. warehouseAuthorize() {
  374. this.warehouseVisible = true
  375. this.searchWarehouseList()
  376. },
  377. buildSiteAuthKey(siteId, subSiteId) {
  378. if (!siteId) {
  379. return ''
  380. }
  381. const keySubSiteId = subSiteId || '__NO_SUBSITE__'
  382. return `${siteId}::${keySubSiteId}`
  383. },
  384. parseSiteAuthKey(key) {
  385. const tokens = (key || '').split('::')
  386. const rawSubSiteId = tokens[1] || ''
  387. return {
  388. site: tokens[0] || '',
  389. subSiteId: rawSubSiteId === '__NO_SUBSITE__' ? '' : rawSubSiteId
  390. }
  391. },
  392. // 保存选中的授权子site
  393. saveUserAssessSite() {
  394. let accessSiteList = this.selectSitList.map(item => {
  395. const siteInfo = this.parseSiteAuthKey(item)
  396. let itemSite = {
  397. userid: this.selectUser.username,
  398. site: siteInfo.site,
  399. subSiteId: siteInfo.subSiteId
  400. }
  401. return itemSite;
  402. }).filter(item => item.site)
  403. let accessSite = {
  404. userid: this.selectUser.username,
  405. accessSiteList: accessSiteList
  406. }
  407. saveUserAccessSiteList(accessSite).then(({data}) => {
  408. if (data.code === 0) {
  409. this.$message.success(data.msg)
  410. this.siteList = []
  411. this.selectSitList = []
  412. this.siteVisible = false
  413. } else {
  414. this.$message.warning(data.msg)
  415. }
  416. })
  417. },
  418. // 获取用户已授权的子site列表
  419. searchUserAccessSiteList() {
  420. getUserAuthorizedSiteAccess({userName: this.selectUser.username}).then(({data}) => {
  421. if (data && data.code === 0) {
  422. this.selectSitList = (data.data || []).map(item => {
  423. return this.buildSiteAuthKey(item.siteId || item.siteCode, item.subSiteId)
  424. }).filter(item => !!item)
  425. }
  426. })
  427. },
  428. // 获取所有可用工厂-子site选项
  429. searchSiteList() {
  430. getActiveSubSiteOptions({}).then(({data}) => {
  431. if (data && data.code === 0) {
  432. const optionMap = {}
  433. ;(data.data || []).forEach(item => {
  434. if (!item.siteId) {
  435. return
  436. }
  437. const key = this.buildSiteAuthKey(item.siteId, item.subSiteId)
  438. optionMap[key] = {
  439. key: key,
  440. label: item.subSiteId
  441. ? `${item.siteId} - ${item.siteName || item.siteId} - ${item.subSiteId}`
  442. : `${item.siteId} - ${item.siteName || item.siteId}`
  443. }
  444. })
  445. this.siteList = Object.keys(optionMap).map(key => optionMap[key])
  446. this.searchUserAccessSiteList()
  447. }
  448. })
  449. },
  450. // 保存选中的授权仓库
  451. saveUserAccessWarehouse() {
  452. let accessWarehouseData = {
  453. userid: this.selectUser.username,
  454. accessWarehouseList: this.selectWarehouseList // selectWarehouseList已经是仓库ID数组
  455. }
  456. saveUserAccessWarehouseList(accessWarehouseData).then(({data}) => {
  457. if (data.code === 0) {
  458. this.$message.success(data.msg || '操作成功')
  459. this.warehouseList = []
  460. this.selectWarehouseList = []
  461. this.warehouseVisible = false
  462. } else {
  463. this.$message.warning(data.msg || '操作失败')
  464. }
  465. }).catch(() => {
  466. this.$message.error(this.$t('sys.user.saveWarehouseFailed'))
  467. })
  468. },
  469. // 获取用户已授权的仓库列表
  470. searchUserAccessWarehouseList() {
  471. getUserAccessWarehouseList({userid: this.selectUser.username}).then(({data}) => {
  472. if (data.code === 0) {
  473. this.selectWarehouseList = data.dataList || []
  474. }
  475. }).catch(() => {
  476. this.$message.error(this.$t('sys.user.getWarehouseFailed'))
  477. })
  478. },
  479. // 获取所有可用仓库
  480. searchWarehouseList() {
  481. getWarehouseListForAuth({active: 'Y',site:localStorage.getItem('site')}).then(({data}) => {
  482. if (data.code === 0) {
  483. // 转换为el-transfer需要的数据格式
  484. this.warehouseList = (data.dataList || []).map(item => ({
  485. key: item.wareHouseId,
  486. label: `${item.wareHouseId} - ${item.wareHouseName || item.wareHouseId}`
  487. }))
  488. this.searchUserAccessWarehouseList()
  489. }
  490. }).catch(() => {
  491. this.$message.error('获取仓库列表失败')
  492. })
  493. },
  494. // 选中行
  495. handleCurrentChange(val) {
  496. this.selectUser = val
  497. this.showButton = false
  498. },
  499. saveUserRoleFlag() {
  500. let saveList = []
  501. let currentList = this.checked
  502. // 当前未选择记录
  503. if (currentList.length == 0) {
  504. this.$confirm(this.$t('sys.common.confirm'), this.$t('sys.common.tip'), {
  505. confirmButtonText: this.$t('sys.common.confirm'),
  506. cancelButtonText: this.$t('sys.common.cancel'),
  507. }).then(() => {
  508. let data = {
  509. userId: this.currentData.userId,
  510. }
  511. saveList.push(data);
  512. this.saveUserBusinessRole(saveList)
  513. }).catch(() => {
  514. return
  515. })
  516. } else {
  517. for (let i = 0; i < currentList.length; i++) {
  518. let data = {
  519. userId: this.currentData.userId,
  520. roleItemNo: currentList[i],
  521. selectFlag: 'Y',
  522. }
  523. saveList.push(data);
  524. }
  525. this.saveUserBusinessRole(saveList)
  526. }
  527. },
  528. saveUserBusinessRole(saveList) {
  529. saveUserBusinessRole(saveList).then(({data}) => {
  530. this.$alert(data.msg, '操作提示', {
  531. confirmButtonText: '确定',
  532. callback: action => {
  533. if (data.code == 0) {
  534. this.setUp.reviewFlag = false
  535. }
  536. this.setUp.saveButton = false
  537. }
  538. });
  539. })
  540. },
  541. generateData(row) {
  542. this.currentData = row
  543. let queryData = {
  544. active: 'Y',
  545. userId: this.currentData.userId,
  546. }
  547. getUserBusinessRoleList(queryData).then(({data}) => {
  548. let rows1Data = data.map.rows1
  549. let rows2Data = data.map.rows2
  550. let forData = []
  551. let checkedList = []
  552. for (let i = 0; i < rows1Data.length; i++) {
  553. forData.push({
  554. key: rows1Data[i].roleItemNo,
  555. label: rows1Data[i].roleDesc,
  556. });
  557. }
  558. for (let j = 0; j < rows2Data.length; j++) {
  559. checkedList.push(rows2Data[j].roleItemNo)
  560. }
  561. this.transferData = forData;
  562. this.checked = checkedList
  563. this.setUp.reviewFlag = true
  564. })
  565. },
  566. // 获取数据列表
  567. getDataList: throttle(function () {
  568. this.dataListLoading = true
  569. this.$http({
  570. url: this.$http.adornUrl('/sys/user/list'),
  571. method: 'get',
  572. params: this.$http.adornParams({
  573. 'page': this.pageIndex,
  574. 'limit': this.pageSize,
  575. 'username': this.dataForm.userName
  576. })
  577. }).then(({data}) => {
  578. if (data && data.code === 0) {
  579. this.dataList = data.page.list
  580. this.totalPage = data.page.totalCount
  581. } else {
  582. this.dataList = []
  583. this.totalPage = 0
  584. }
  585. this.dataListLoading = false
  586. })
  587. }, 1000),
  588. // 每页数
  589. sizeChangeHandle(val) {
  590. this.pageSize = val
  591. this.pageIndex = 1
  592. this.getDataList()
  593. },
  594. // 当前页
  595. currentChangeHandle(val) {
  596. this.pageIndex = val
  597. this.getDataList()
  598. },
  599. // 多选
  600. selectionChangeHandle(val) {
  601. this.dataListSelections = val
  602. },
  603. // 新增 / 修改
  604. addOrUpdateHandle(id) {
  605. this.addOrUpdateVisible = true
  606. this.$nextTick(() => {
  607. this.$refs.addOrUpdate.init(id)
  608. })
  609. },
  610. // 删除
  611. deleteHandle(id) {
  612. var userIds = id ? [id] : this.dataListSelections.map(item => {
  613. return item.userId
  614. })
  615. this.$confirm(`确定对[id=${userIds.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  616. confirmButtonText: '确定',
  617. cancelButtonText: '取消',
  618. type: 'warning'
  619. }).then(() => {
  620. this.$http({
  621. url: this.$http.adornUrl('/sys/user/delete'),
  622. method: 'post',
  623. data: this.$http.adornData(userIds, false)
  624. }).then(({data}) => {
  625. if (data && data.code === 0) {
  626. this.$message.success(this.$t('sys.common.success'))
  627. this.getDataList()
  628. } else {
  629. this.$message.error(data.msg)
  630. }
  631. })
  632. }).catch(() => {
  633. })
  634. },
  635. // 踢出登录 - rqrq
  636. forceLogoutHandle(row) {
  637. this.$confirm(this.$t('sys.user.kickoutConfirm'), this.$t('sys.user.kickout'), {
  638. confirmButtonText: this.$t('sys.common.confirm'),
  639. cancelButtonText: this.$t('sys.common.cancel'),
  640. type: 'warning'
  641. }).then(() => {
  642. this.forceLogoutLoading = true
  643. this.$http({
  644. url: this.$http.adornUrl('/sys/user/forceLogout'),
  645. method: 'post',
  646. data: this.$http.adornData({
  647. userId: row.userId
  648. })
  649. }).then(({data}) => {
  650. if (data && data.code === 0) {
  651. this.$message.success(this.$t('sys.user.kickoutSuccess'))
  652. this.getDataList()
  653. } else {
  654. this.$alert(data.msg || '踢出登录失败', '错误')
  655. }
  656. }).catch(() => {
  657. this.$message.error(this.$t('warehouse.message.operationFailed'))
  658. }).finally(() => {
  659. this.forceLogoutLoading = false
  660. })
  661. }).catch(() => {
  662. })
  663. }
  664. },
  665. created() {
  666. //this.getFunctionButtonList()
  667. }
  668. }
  669. </script>
  670. <style>
  671. .el-transfer-panel {
  672. border: 2px solid #17b3a3;
  673. border-radius: 4px;
  674. overflow: hidden;
  675. background: #fff;
  676. display: inline-block;
  677. vertical-align: middle;
  678. width: 200px;
  679. max-height: 100%;
  680. -webkit-box-sizing: border-box;
  681. box-sizing: border-box;
  682. position: relative;
  683. }
  684. .el-transfer-panel .el-transfer-panel__header {
  685. height: 40px;
  686. line-height: 40px;
  687. background: #17b3a3;
  688. margin: 0;
  689. padding-left: 15px;
  690. border-bottom: 1px solid #17b3a3;
  691. -webkit-box-sizing: border-box;
  692. box-sizing: border-box;
  693. color: #000;
  694. }
  695. .el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label {
  696. font-size: 14px;
  697. color: #303133;
  698. font-weight: 400;
  699. }
  700. .el-dialog__title {
  701. line-height: 24px;
  702. font-size: 16px;
  703. color: #303133;
  704. }
  705. </style>