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.

1647 lines
52 KiB

7 months ago
4 weeks ago
4 weeks ago
4 months ago
7 months ago
7 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
4 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
4 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months ago
7 months 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="用户账号" clearable></el-input>
  6. </el-form-item>
  7. <el-form-item>
  8. <el-input v-model="dataForm.userDisplay" placeholder="用户名" clearable></el-input>
  9. </el-form-item>
  10. <el-form-item>
  11. <el-button @click="getDataList" type="primary">{{ buttons.search || '查询' }}</el-button>
  12. <el-button v-if="isAuth('sys:user:save')" type="primary" @click="addOrUpdateHandle()">{{ buttons.add || '新增' }}</el-button>
  13. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="siteAuthorize()">{{ buttons.factoryAuthorization || '工厂授权' }}</el-button>
  14. <!-- <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="buAuthorize()">{{ buttons.buAuthorization || 'BU授权' }}</el-button>-->
  15. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="viewUserDept()">{{ buttons.viewUserDept || '查看部门' }}</el-button>
  16. <!-- <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="deptAuthorize()">{{ buttons.deptAuthorization || '部门授权' }}</el-button>-->
  17. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="businessRoleAuthorize()">{{ buttons.businessRoleAuthorization || '岗位' }}
  18. </el-button>
  19. <el-button v-if="isAuth('sys:user:save')" :disabled="this.showButton" type="primary" @click="specialAuthorize()">{{ buttons.specialCompetencies || '特殊权限' }}</el-button>
  20. </el-form-item>
  21. </el-form>
  22. <el-table
  23. :data="dataList"
  24. border
  25. :height="height"
  26. v-loading="dataListLoading"
  27. @selection-change="selectionChangeHandle"
  28. highlight-current-row
  29. @current-change="handleCurrentChange"
  30. style="width: 100%;">
  31. <el-table-column
  32. prop="username"
  33. header-align="center"
  34. align="center"
  35. :label="buttons.username||'用户账号'">
  36. </el-table-column>
  37. <el-table-column
  38. prop="userDisplay"
  39. header-align="center"
  40. align="center"
  41. :label="buttons.userDisplay||'用户名'">
  42. </el-table-column>
  43. <el-table-column
  44. prop="email"
  45. header-align="center"
  46. align="center"
  47. :label="buttons.email||'邮箱'">
  48. </el-table-column>
  49. <el-table-column
  50. prop="mobile"
  51. header-align="center"
  52. align="center"
  53. :label="buttons.mobile||'手机号'">
  54. </el-table-column>
  55. <el-table-column
  56. prop="status"
  57. header-align="center"
  58. align="center"
  59. :label="buttons.status||'状态'">
  60. <template slot-scope="scope">
  61. <el-link v-if="scope.row.status === 0" type="success">{{ buttons.disable || '禁用' }}</el-link>
  62. <el-link v-else type="danger">{{ buttons.normal || '正常' }}</el-link>
  63. </template>
  64. </el-table-column>
  65. <el-table-column
  66. prop="createTime"
  67. header-align="center"
  68. align="center"
  69. width="180"
  70. :label="buttons.createTime||'创建时间'">
  71. </el-table-column>
  72. <el-table-column
  73. prop="workShopName"
  74. header-align="center"
  75. align="center"
  76. :label="'车间'">
  77. </el-table-column>
  78. <el-table-column
  79. prop="supplierNo"
  80. header-align="center"
  81. align="left"
  82. :label="'供应商编码'">
  83. </el-table-column>
  84. <el-table-column
  85. fixed="right"
  86. header-align="center"
  87. align="center"
  88. width="150"
  89. :label="buttons.cz||'操作'">
  90. <template slot-scope="scope">
  91. <a v-if="!adminUser && scope.row.userId === 1" type="text" size="small" style="pointer-events:none;color: #8a979e">{{ buttons.edit || '修改' }}</a>
  92. <a v-if="!adminUser && scope.row.userId !== 1" type="text" size="small" @click="addOrUpdateHandle(scope.row.userId)">{{ buttons.edit || '修改' }}</a>
  93. <a v-if="adminUser" type="text" size="small" @click="addOrUpdateHandle(scope.row.userId)">{{ buttons.edit || '修改' }}</a>
  94. <a v-if="!adminUser && scope.row.userId === 1" type="text" size="small" style="pointer-events:none;color: #8a979e">{{ buttons.delete || '删除' }}</a>
  95. <a v-if="!adminUser && scope.row.userId !== 1" type="text" size="small" @click="deleteHandle(scope.row.userId)">{{ buttons.delete || '删除' }}</a>
  96. <a v-if="adminUser" type="text" size="small" @click="deleteHandle(scope.row.userId)">{{ buttons.delete || '删除' }}</a>
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <el-pagination
  101. @size-change="sizeChangeHandle"
  102. @current-change="currentChangeHandle"
  103. :current-page="pageIndex"
  104. :page-sizes="[20, 50, 100, 200,500]"
  105. :page-size="pageSize"
  106. :total="totalPage"
  107. layout="total, sizes, prev, pager, next, jumper">
  108. </el-pagination>
  109. <!-- 弹窗, 新增 / 修改 -->
  110. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" @close="closeDialog"></add-or-update>
  111. <!-- 审核权限 -->
  112. <el-dialog :close-on-click-modal="false" :close-on-press-escape="false" v-drag :title="inputSearch1" :visible.sync="setUp.reviewFlag" width="518px">
  113. <template>
  114. <el-transfer v-model="checked" :data="transferData" :titles="[buttons.allAuth || '所有权限', buttons.currentAuth || '当前权限']"></el-transfer>
  115. </template>
  116. <span slot="footer" class="dialog-footer">
  117. <div style="margin-top: 5px">
  118. <el-button type="primary" :disabled="setUp.saveButton" @click="saveUserRoleFlag()">确定</el-button>
  119. <el-button type="primary" @click="setUp.reviewFlag = false">取消</el-button>
  120. </div>
  121. </span>
  122. </el-dialog>
  123. <!-- 特殊权限 -->
  124. <el-dialog
  125. v-drag
  126. :title="'特殊性权限'"
  127. :visible.sync="specialVisible"
  128. width="820px"
  129. :append-to-body="true">
  130. <el-table
  131. :data="securityList"
  132. border
  133. :height="securityHeight"
  134. v-loading="dataListLoading"
  135. style="width: 100%;">
  136. <el-table-column
  137. v-for="(item,index) in columnList" :key="index"
  138. :sortable="item.columnSortable"
  139. :prop="item.columnProp"
  140. :header-align="item.headerAlign"
  141. :show-overflow-tooltip="item.showOverflowTooltip"
  142. :align="item.align"
  143. :fixed="item.fixed==''?false:item.fixed"
  144. :min-width="item.columnWidth"
  145. :label="item.columnLabel">
  146. <template slot-scope="scope">
  147. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  148. <span v-if="item.columnHidden">
  149. <el-checkbox v-model="scope.row[item.columnProp] "></el-checkbox>
  150. </span>
  151. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. <span slot="footer" class="dialog-footer">
  156. <el-button type="primary" @click="saveUserSecurity()">确定</el-button>
  157. <el-button @click="specialVisible = false" type="primary">取消</el-button>
  158. </span>
  159. </el-dialog>
  160. <!-- BU授权 -->
  161. <el-dialog
  162. style="font-size: 12px"
  163. v-drag
  164. :title="'BU授权'"
  165. :visible.sync="buVisible"
  166. width="518px"
  167. :append-to-body="true">
  168. <el-transfer
  169. class="rq"
  170. filterable
  171. v-model="selectBUList"
  172. :props="{key: 'buNo', label: 'buDesc'}" :data="buList" :titles="['未授权BU', '已授权BU']">
  173. </el-transfer>
  174. <span slot="footer" class="dialog-footer">
  175. <div style="margin-top: 5px">
  176. <el-button type="primary" @click="saveBuAssessSite()">确定</el-button>
  177. <el-button @click="buVisible = false" type="primary">取消</el-button>
  178. </div>
  179. </span>
  180. </el-dialog>
  181. <!-- 查看用户部门Access_dept -->
  182. <el-dialog
  183. :title="'用户部门 — ' + (selectUser && selectUser.username ? selectUser.username : '')"
  184. :close-on-click-modal="false"
  185. v-drag
  186. :visible.sync="userDeptModalVisible"
  187. width="900px"
  188. append-to-body>
  189. <el-table
  190. :data="userDeptList"
  191. border
  192. v-loading="userDeptLoading"
  193. height="400"
  194. style="width: 100%">
  195. <el-table-column prop="site" header-align="center" align="center" min-width="70" label="工厂"></el-table-column>
  196. <el-table-column prop="buNo" header-align="center" align="center" min-width="80" label="BU"></el-table-column>
  197. <el-table-column prop="buDesc" header-align="center" align="left" min-width="100" label="BU名称" show-overflow-tooltip></el-table-column>
  198. <el-table-column prop="departmentId" header-align="center" align="center" min-width="90" label="部门编码"></el-table-column>
  199. <el-table-column prop="departmentName" header-align="center" align="left" min-width="100" label="部门名称" show-overflow-tooltip></el-table-column>
  200. <el-table-column prop="jobTitle" header-align="center" align="left" min-width="90" label="职称" show-overflow-tooltip></el-table-column>
  201. <el-table-column prop="deptManagerFlag" header-align="center" align="center" width="90" label="部门经理"></el-table-column>
  202. <el-table-column prop="superiorUsername" header-align="center" align="center" min-width="90" label="上级"></el-table-column>
  203. </el-table>
  204. <el-footer style="height:40px;margin-top: 16px;text-align:center">
  205. <el-button type="primary" @click="userDeptModalVisible = false">关闭</el-button>
  206. </el-footer>
  207. </el-dialog>
  208. <!-- 岗位 -->
  209. <el-dialog
  210. style="font-size: 12px"
  211. v-drag
  212. :title="'岗位'"
  213. :visible.sync="businessRoleVisible"
  214. width="518px"
  215. :append-to-body="true">
  216. <el-transfer
  217. class="rq"
  218. filterable
  219. v-model="selectBusinessRoleList"
  220. :props="{key: 'roleNo', label: 'roleDesc'}" :data="businessRoleList" :titles="['未授权角色', '已授权角色']">
  221. </el-transfer>
  222. <span slot="footer" class="dialog-footer">
  223. <div style="margin-top: 5px">
  224. <el-button type="primary" @click="saveBusinessRoleSite()">确定</el-button>
  225. <el-button @click="businessRoleVisible = false" type="primary">取消</el-button>
  226. </div>
  227. </span>
  228. </el-dialog>
  229. <!-- 新增用户site -->
  230. <el-dialog title="工厂" :close-on-click-modal="false" v-drag :visible.sync="siteAddModal" width="900px">
  231. <div style="font-size: 12px">
  232. <el-form :inline="true" label-position="top" :model="siteData">
  233. <el-form-item :label="'工厂编码'">
  234. <el-input v-model="siteData.siteid" clearable style="width: 120px"></el-input>
  235. </el-form-item>
  236. <el-form-item :label="'工厂名称'">
  237. <el-input v-model="siteData.sitename" clearable style="width: 200px"></el-input>
  238. </el-form-item>
  239. <el-form-item :label="' '">
  240. <el-button type="primary" @click="getSite()">查询</el-button>
  241. </el-form-item>
  242. </el-form>
  243. </div>
  244. <el-container style="margin-top: 0px;">
  245. <el-main style="width: 400px; padding: 1px">
  246. <span style="font-size: 12px" >可选工厂</span>
  247. <el-table
  248. height="400px"
  249. :data="siteList1"
  250. border
  251. ref="siteTable1"
  252. @row-click="siteClickRow1"
  253. @selection-change="selectionSite1"
  254. highlight-current-row
  255. style="width: 100%">
  256. <el-table-column
  257. type="selection"
  258. header-align="center"
  259. align="center"
  260. :selectable="selectFlag"
  261. width="50">
  262. </el-table-column>
  263. <el-table-column
  264. prop="siteid"
  265. header-align="center"
  266. align="center"
  267. min-width="80"
  268. label="工厂编码">
  269. </el-table-column>
  270. <el-table-column
  271. prop="sitename"
  272. header-align="center"
  273. align="center"
  274. min-width="120"
  275. label="工厂名称">
  276. </el-table-column>
  277. </el-table>
  278. </el-main>
  279. <el-main style="width: 111px;padding: 1px">
  280. <div style="margin-top: 182px;margin-left: 18px">
  281. <el-button type="primary" @click="addSite()">添加>></el-button>
  282. </div>
  283. <div style="margin-top: 15px;margin-left: 18px">
  284. <el-button type="primary" @click="deleteSite()">删除<<</el-button>
  285. </div>
  286. </el-main>
  287. <el-main style="width: 400px;padding: 1px">
  288. <span style="font-size: 12px" >已有工厂</span>
  289. <el-table
  290. height="400px"
  291. :data="siteList2"
  292. border
  293. ref="siteTable2"
  294. @row-click="siteClickRow2"
  295. @selection-change="selectionSite2"
  296. highlight-current-row
  297. style="width: 100%">
  298. <el-table-column
  299. type="selection"
  300. header-align="center"
  301. align="center"
  302. :selectable="selectFlag"
  303. width="50">
  304. </el-table-column>
  305. <el-table-column
  306. prop="siteid"
  307. header-align="center"
  308. align="center"
  309. min-width="80"
  310. label="工厂编码">
  311. </el-table-column>
  312. <el-table-column
  313. prop="sitename"
  314. header-align="center"
  315. align="center"
  316. min-width="120"
  317. label="工厂名称">
  318. </el-table-column>
  319. </el-table>
  320. </el-main>
  321. </el-container>
  322. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  323. <el-button type="primary" @click="siteAddModal = false">关闭</el-button>
  324. </el-footer>
  325. </el-dialog>
  326. <!-- 新增用户bu -->
  327. <el-dialog title="BU" :close-on-click-modal="false" v-drag :visible.sync="buAddModal" width="900px">
  328. <div style="font-size: 12px">
  329. <el-form :inline="true" label-position="top" :model="buData">
  330. <el-form-item :label="'工厂编码'">
  331. <el-input v-model="buData.site" clearable style="width: 120px"></el-input>
  332. </el-form-item>
  333. <el-form-item :label="'BU编码'">
  334. <el-input v-model="buData.buNo" clearable style="width: 120px"></el-input>
  335. </el-form-item>
  336. <el-form-item :label="'BU名称'">
  337. <el-input v-model="buData.buDesc" clearable style="width: 200px"></el-input>
  338. </el-form-item>
  339. <el-form-item :label="' '">
  340. <el-button type="primary" @click="getBu()">查询</el-button>
  341. </el-form-item>
  342. </el-form>
  343. </div>
  344. <el-container style="margin-top: 0px;">
  345. <el-main style="width: 400px; padding: 1px">
  346. <span style="font-size: 12px" >可选BU</span>
  347. <el-table
  348. height="400px"
  349. :data="buList1"
  350. border
  351. ref="buTable1"
  352. @row-click="buClickRow1"
  353. @selection-change="selectionBu1"
  354. highlight-current-row
  355. style="width: 100%">
  356. <el-table-column
  357. type="selection"
  358. header-align="center"
  359. align="center"
  360. :selectable="selectFlag"
  361. width="50">
  362. </el-table-column>
  363. <el-table-column
  364. prop="site"
  365. header-align="center"
  366. align="center"
  367. min-width="80"
  368. label="工厂编码">
  369. </el-table-column>
  370. <el-table-column
  371. prop="buNo"
  372. header-align="center"
  373. align="center"
  374. min-width="80"
  375. label="BU编码">
  376. </el-table-column>
  377. <el-table-column
  378. prop="buDesc"
  379. header-align="center"
  380. align="center"
  381. min-width="120"
  382. label="BU名称">
  383. </el-table-column>
  384. </el-table>
  385. </el-main>
  386. <el-main style="width: 111px;padding: 1px">
  387. <div style="margin-top: 182px;margin-left: 18px">
  388. <el-button type="primary" @click="addBu()">添加>></el-button>
  389. </div>
  390. <div style="margin-top: 15px;margin-left: 18px">
  391. <el-button type="primary" @click="deleteBu()">删除<<</el-button>
  392. </div>
  393. </el-main>
  394. <el-main style="width: 400px;padding: 1px">
  395. <span style="font-size: 12px" >已有BU</span>
  396. <el-table
  397. height="400px"
  398. :data="buList2"
  399. border
  400. ref="buTable2"
  401. @row-click="buClickRow2"
  402. @selection-change="selectionBu2"
  403. highlight-current-row
  404. style="width: 100%">
  405. <el-table-column
  406. type="selection"
  407. header-align="center"
  408. align="center"
  409. :selectable="selectFlag"
  410. width="50">
  411. </el-table-column>
  412. <el-table-column
  413. prop="site"
  414. header-align="center"
  415. align="center"
  416. min-width="80"
  417. label="工厂编码">
  418. </el-table-column>
  419. <el-table-column
  420. prop="buNo"
  421. header-align="center"
  422. align="center"
  423. min-width="80"
  424. label="BU编码">
  425. </el-table-column>
  426. <el-table-column
  427. prop="buDesc"
  428. header-align="center"
  429. align="center"
  430. min-width="120"
  431. label="BU名称">
  432. </el-table-column>
  433. </el-table>
  434. </el-main>
  435. </el-container>
  436. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  437. <el-button type="primary" @click="buAddModal = false">关闭</el-button>
  438. </el-footer>
  439. </el-dialog>
  440. <!-- 新增用户部门 -->
  441. <el-dialog title="部门" :close-on-click-modal="false" v-drag :visible.sync="deptAddModal" width="900px">
  442. <div style="font-size: 12px">
  443. <el-form :inline="true" label-position="top" :model="deptData">
  444. <el-form-item :label="'部门编码'">
  445. <el-input v-model="deptData.departmentId" clearable style="width: 120px"></el-input>
  446. </el-form-item>
  447. <el-form-item :label="'部门名称'">
  448. <el-input v-model="deptData.departmentName" clearable style="width: 200px"></el-input>
  449. </el-form-item>
  450. <el-form-item :label="' '">
  451. <el-button type="primary" @click="getDept()">查询</el-button>
  452. </el-form-item>
  453. </el-form>
  454. </div>
  455. <el-container style="margin-top: 0px;">
  456. <el-main style="width: 400px; padding: 1px">
  457. <span style="font-size: 12px" >可选部门</span>
  458. <el-table
  459. height="400px"
  460. :data="deptList1"
  461. border
  462. ref="deptTable1"
  463. @row-click="deptClickRow1"
  464. @selection-change="selectionDept1"
  465. highlight-current-row
  466. style="width: 100%">
  467. <el-table-column
  468. type="selection"
  469. header-align="center"
  470. align="center"
  471. :selectable="selectFlag"
  472. width="50">
  473. </el-table-column>
  474. <el-table-column
  475. prop="buDesc"
  476. header-align="center"
  477. align="center"
  478. min-width="80"
  479. label="BU">
  480. </el-table-column>
  481. <el-table-column
  482. prop="departmentId"
  483. header-align="center"
  484. align="center"
  485. min-width="80"
  486. label="部门编码">
  487. </el-table-column>
  488. <el-table-column
  489. prop="departmentName"
  490. header-align="center"
  491. align="center"
  492. min-width="120"
  493. label="部门名称">
  494. </el-table-column>
  495. </el-table>
  496. </el-main>
  497. <el-main style="width: 111px;padding: 1px">
  498. <div style="margin-top: 182px;margin-left: 18px">
  499. <el-button type="primary" @click="addDept()">添加>></el-button>
  500. </div>
  501. <div style="margin-top: 15px;margin-left: 18px">
  502. <el-button type="primary" @click="deleteDept()">删除<<</el-button>
  503. </div>
  504. </el-main>
  505. <el-main style="width: 400px;padding: 1px">
  506. <span style="font-size: 12px" >已有部门</span>
  507. <el-table
  508. height="400px"
  509. :data="deptList2"
  510. border
  511. ref="deptTable2"
  512. @row-click="deptClickRow2"
  513. @selection-change="selectionDept2"
  514. highlight-current-row
  515. style="width: 100%">
  516. <el-table-column
  517. type="selection"
  518. header-align="center"
  519. align="center"
  520. :selectable="selectFlag"
  521. width="50">
  522. </el-table-column>
  523. <el-table-column
  524. prop="buDesc"
  525. header-align="center"
  526. align="center"
  527. min-width="80"
  528. label="BU">
  529. </el-table-column>
  530. <el-table-column
  531. prop="departmentId"
  532. header-align="center"
  533. align="center"
  534. min-width="80"
  535. label="部门编码">
  536. </el-table-column>
  537. <el-table-column
  538. prop="departmentName"
  539. header-align="center"
  540. align="center"
  541. min-width="120"
  542. label="部门名称">
  543. </el-table-column>
  544. </el-table>
  545. </el-main>
  546. </el-container>
  547. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  548. <el-button type="primary" @click="deptAddModal = false">关闭</el-button>
  549. </el-footer>
  550. </el-dialog>
  551. <!-- 新增用户角色 -->
  552. <el-dialog title="角色" :close-on-click-modal="false" v-drag :visible.sync="businessRoleAddModal" width="900px">
  553. <div style="font-size: 12px">
  554. <el-form :inline="true" label-position="top" :model="businessRoleData">
  555. <el-form-item :label="'角色编码'">
  556. <el-input v-model="businessRoleData.roleNo" clearable style="width: 120px"></el-input>
  557. </el-form-item>
  558. <el-form-item :label="'角色名称'">
  559. <el-input v-model="businessRoleData.roleDesc" clearable style="width: 200px"></el-input>
  560. </el-form-item>
  561. <el-form-item :label="' '">
  562. <el-button type="primary" @click="getBusinessRole()">查询</el-button>
  563. </el-form-item>
  564. </el-form>
  565. </div>
  566. <el-container style="margin-top: 0px;">
  567. <el-main style="width: 400px; padding: 1px">
  568. <span style="font-size: 12px" >可选角色</span>
  569. <el-table
  570. height="400px"
  571. :data="businessRoleList1"
  572. border
  573. ref="businessRoleTable1"
  574. @row-click="businessRoleClickRow1"
  575. @selection-change="selectionBusinessRole1"
  576. highlight-current-row
  577. style="width: 100%">
  578. <el-table-column
  579. type="selection"
  580. header-align="center"
  581. align="center"
  582. :selectable="selectFlag"
  583. width="50">
  584. </el-table-column>
  585. <el-table-column
  586. prop="roleNo"
  587. header-align="center"
  588. align="center"
  589. min-width="80"
  590. label="角色编码">
  591. </el-table-column>
  592. <el-table-column
  593. prop="roleDesc"
  594. header-align="center"
  595. align="center"
  596. min-width="120"
  597. label="角色名称">
  598. </el-table-column>
  599. </el-table>
  600. </el-main>
  601. <el-main style="width: 111px;padding: 1px">
  602. <div style="margin-top: 182px;margin-left: 18px">
  603. <el-button type="primary" @click="addBusinessRole()">添加>></el-button>
  604. </div>
  605. <div style="margin-top: 15px;margin-left: 18px">
  606. <el-button type="primary" @click="deleteBusinessRole()">删除<<</el-button>
  607. </div>
  608. </el-main>
  609. <el-main style="width: 400px;padding: 1px">
  610. <span style="font-size: 12px" >已有角色</span>
  611. <el-table
  612. height="400px"
  613. :data="businessRoleList2"
  614. border
  615. ref="businessRoleTable2"
  616. @row-click="businessRoleClickRow2"
  617. @selection-change="selectionBusinessRole2"
  618. highlight-current-row
  619. style="width: 100%">
  620. <el-table-column
  621. type="selection"
  622. header-align="center"
  623. align="center"
  624. :selectable="selectFlag"
  625. width="50">
  626. </el-table-column>
  627. <el-table-column
  628. prop="roleNo"
  629. header-align="center"
  630. align="center"
  631. min-width="80"
  632. label="角色编码">
  633. </el-table-column>
  634. <el-table-column
  635. prop="roleDesc"
  636. header-align="center"
  637. align="center"
  638. min-width="120"
  639. label="角色名称">
  640. </el-table-column>
  641. </el-table>
  642. </el-main>
  643. </el-container>
  644. <el-footer style="height:40px;margin-top: 20px;text-align:center">
  645. <el-button type="primary" @click="businessRoleAddModal = false">关闭</el-button>
  646. </el-footer>
  647. </el-dialog>
  648. </div>
  649. </template>
  650. <script>
  651. import {getSiteList, addUserSite, delUserSite, getSite, getBuList, addUserBu, delUserBu, getBu, getDeptList, addUserDept, delUserDept, getDept, getBusinessRole, getBusinessRoleList, addUserBusinessRole, delUserBusinessRole} from '@/api/factory/site.js'
  652. import { listAccessDeptByUsername } from '@/api/factory/accessDept.js'
  653. import {saveAccessBU, saveBusinessRole} from '@/api/base/site.js'
  654. import AddOrUpdate from './user-add-or-update'
  655. import {saveUserBusinessRole} from '@/api/auditManagement/auditType.js'
  656. import {getUserSpecialSecurity, updateUserSpecialSecurity} from '@/api/factory/userSpecialSecurity.js'
  657. import {throttle} from '../../../utils/common'
  658. import {searchFunctionButtonList} from '@/api/sysLanguage.js'
  659. import {userFavoriteList, saveUserFavorite, removeUserFavorite} from '@/api/userFavorite.js'
  660. export default {
  661. data () {
  662. return {
  663. // 是否收藏
  664. favorite: false,
  665. showButton: true,
  666. height: 200,
  667. securityHeight: 300,
  668. specialVisible: false,
  669. buVisible: false,
  670. businessRoleVisible: false,
  671. currentData: {},
  672. userId: this.$store.state.user.name,
  673. transferData: [],
  674. checked: [],
  675. inputSearch1: '审核权限',
  676. // 设置
  677. setUp: {
  678. reviewFlag: false,
  679. saveButton: false
  680. },
  681. dataForm: {
  682. userName: '',
  683. userDisplay: ''
  684. },
  685. columnList: [
  686. {
  687. userId: this.$store.state.user.name,
  688. serialNumber: 'security' + this.$route.meta.menuId + 'permissionCode',
  689. tableId: this.$route.meta.menuId + 'security',
  690. tableName: 'securityTable',
  691. columnProp: 'permissionCode',
  692. headerAlign: 'center',
  693. align: 'left',
  694. columnLabel: '权限号',
  695. columnHidden: false,
  696. columnImage: false,
  697. columnSortable: false,
  698. columnWidth: 28,
  699. sortLv: 0,
  700. status: true,
  701. fixed: ''
  702. },
  703. {
  704. userId: this.$store.state.user.name,
  705. serialNumber: 'security' + this.$route.meta.menuId + 'securitydesc',
  706. tableId: this.$route.meta.menuId + 'security',
  707. tableName: 'securityTable',
  708. columnProp: 'securitydesc',
  709. headerAlign: 'center',
  710. align: 'left',
  711. columnLabel: '参数描述',
  712. columnHidden: false,
  713. columnImage: false,
  714. columnWidth: 70,
  715. columnSortable: false,
  716. sortLv: 0,
  717. status: true,
  718. fixed: ''
  719. },
  720. {
  721. userId: this.$store.state.user.name,
  722. serialNumber: 'security' + this.$route.meta.menuId + 'securitydesc',
  723. tableId: this.$route.meta.menuId + 'security',
  724. tableName: 'securityTable',
  725. columnProp: 'module',
  726. headerAlign: 'center',
  727. align: 'left',
  728. columnLabel: '模块',
  729. columnHidden: false,
  730. columnImage: false,
  731. columnSortable: false,
  732. columnWidth: 20,
  733. sortLv: 0,
  734. status: true,
  735. fixed: ''
  736. },
  737. {
  738. userId: this.$store.state.user.name,
  739. serialNumber: 'security' + this.$route.meta.menuId + 'securitydesc',
  740. tableId: this.$route.meta.menuId + 'security',
  741. tableName: 'securityTable',
  742. columnProp: 'itemvalue',
  743. headerAlign: 'center',
  744. align: 'center',
  745. columnLabel: '参数值',
  746. columnHidden: true,
  747. columnImage: false,
  748. columnSortable: false,
  749. columnWidth: 10,
  750. sortLv: 0,
  751. status: true,
  752. fixed: ''
  753. }
  754. ],
  755. buttons: {
  756. cz: '操作',
  757. search: '查询',
  758. add: '添加',
  759. edit: '编辑',
  760. delete: '删除',
  761. specialCompetencies: '特殊权限',
  762. factoryAuthorization: '工厂授权',
  763. buAuthorization: 'BU授权',
  764. deptAuthorization: '部门授权',
  765. viewUserDept: '查看部门',
  766. businessRoleAuthorization: '岗位',
  767. createTime: '创建时间',
  768. username: '用户账号',
  769. userDisplay: '用户名',
  770. email: '邮箱',
  771. mobile: '手机号',
  772. status: '状态',
  773. disable: '禁用',
  774. normal: '正常',
  775. auth: '审核',
  776. allAuth: '所有权限',
  777. currentAuth: '当前权限'
  778. },
  779. dataList: [],
  780. securityList: [],
  781. selectSpecialList: [],
  782. siteList: [],
  783. selectSitList: [],
  784. selectUser: {},
  785. pageIndex: 1,
  786. pageSize: 20,
  787. totalPage: 0,
  788. dataListLoading: false,
  789. dataListSelections: [],
  790. addOrUpdateVisible: false,
  791. selectBUList: [],
  792. buList: [],
  793. siteList1: [],
  794. siteList2: [],
  795. siteSelections1: [],
  796. siteSelections2: [],
  797. siteAddModal: false,
  798. siteData: {
  799. username: '',
  800. siteid: '',
  801. sitename: '',
  802. active: ''
  803. },
  804. buList1: [],
  805. buList2: [],
  806. buSelections1: [],
  807. buSelections2: [],
  808. buAddModal: false,
  809. buData: {
  810. site: '',
  811. buNo: '',
  812. buDesc: '',
  813. active: '',
  814. username: ''
  815. },
  816. userDeptModalVisible: false,
  817. userDeptList: [],
  818. userDeptLoading: false,
  819. deptData: {
  820. site: '',
  821. buNo: '',
  822. departmentId: '',
  823. departmentName: '',
  824. active: '',
  825. username: ''
  826. },
  827. deptList1: [],
  828. deptList2: [],
  829. deptSelections1: [],
  830. deptSelections2: [],
  831. deptAddModal: false,
  832. selectBusinessRoleList: [],
  833. businessRoleList: [],
  834. businessRoleList1: [],
  835. businessRoleList2: [],
  836. businessRoleSelections1: [],
  837. businessRoleSelections2: [],
  838. businessRoleAddModal: false,
  839. businessRoleData: {
  840. site: '',
  841. buNo: '',
  842. roleNo: '',
  843. roleDesc: '',
  844. active: '',
  845. username: ''
  846. }
  847. }
  848. },
  849. components: {
  850. AddOrUpdate
  851. },
  852. activated () {
  853. this.getDataList()
  854. },
  855. mounted () {
  856. this.favoriteIsOk()
  857. this.$nextTick(() => {
  858. this.securityHeight = window.innerHeight - 300
  859. this.height = window.innerHeight - 200
  860. })
  861. },
  862. computed: {
  863. adminUser () {
  864. return this.$store.state.user.id === 1
  865. }
  866. },
  867. methods: {
  868. // 校验用户是否收藏
  869. favoriteIsOk () {
  870. let userFavorite = {
  871. userId: this.$store.state.user.id,
  872. languageCode: this.$i18n.locale
  873. }
  874. userFavoriteList(userFavorite).then(({data}) => {
  875. for (let i = 0; i < data.list.length; i++) {
  876. if (this.$route.meta.menuId == data.list[i].menuId) {
  877. this.favorite = true
  878. }
  879. }
  880. })
  881. },
  882. // 收藏 OR 取消收藏
  883. favoriteFunction () {
  884. let userFavorite = {
  885. userId: this.$store.state.user.id,
  886. functionId: this.$route.meta.menuId
  887. }
  888. if (this.favorite) {
  889. // 取消收藏
  890. this.$confirm(`确定取消收藏`, '提示', {
  891. confirmButtonText: '确定',
  892. cancelButtonText: '取消',
  893. type: 'warning'
  894. }).then(() => {
  895. removeUserFavorite(userFavorite).then(({data}) => {
  896. this.$message.success(data.msg)
  897. this.favorite = false
  898. })
  899. })
  900. } else {
  901. // 收藏
  902. saveUserFavorite(userFavorite).then(({data}) => {
  903. this.$message.success(data.msg)
  904. this.favorite = true
  905. })
  906. }
  907. },
  908. // 获取button的词典
  909. getFunctionButtonList () {
  910. let queryButton = {
  911. functionId: this.$route.meta.menuId,
  912. tableId: '*',
  913. languageCode: this.$i18n.locale,
  914. objectType: 'button'
  915. }
  916. searchFunctionButtonList(queryButton).then(({data}) => {
  917. if (data.code == 0 && data.data) {
  918. this.buttons = data.data
  919. }
  920. })
  921. },
  922. // 打开特殊权限
  923. specialAuthorize () {
  924. if (!this.selectUser || !this.selectUser.username) {
  925. this.$message.warning('请先在列表中选中用户')
  926. return
  927. }
  928. this.dataListLoading = true
  929. getUserSpecialSecurity(encodeURIComponent(this.selectUser.username)).then(({ data }) => {
  930. this.dataListLoading = false
  931. if (data && data.code === 0) {
  932. const list = data.list || []
  933. this.securityList = list.map(row => ({
  934. ...row,
  935. itemvalue: row.itemvalue === true || row.itemvalue === 'Y'
  936. }))
  937. this.specialVisible = true
  938. } else {
  939. this.$message.error((data && data.msg) || '加载失败')
  940. }
  941. }).catch(() => {
  942. this.dataListLoading = false
  943. })
  944. },
  945. // 保存用户权限
  946. saveUserSecurity () {
  947. if (!this.selectUser || !this.selectUser.username) {
  948. this.$message.warning('未选中用户')
  949. return
  950. }
  951. const items = this.securityList.map(item => ({
  952. permissionCode: item.permissionCode,
  953. itemvalue: item.itemvalue === true ? 'Y' : 'N'
  954. }))
  955. updateUserSpecialSecurity({
  956. username: this.selectUser.username,
  957. items
  958. }).then(({data}) => {
  959. if (data.code === 0) {
  960. this.$message.success(data.msg)
  961. this.specialVisible = false
  962. } else {
  963. this.$message.error(data.msg || '保存失败')
  964. }
  965. })
  966. },
  967. // 授权工厂
  968. siteAuthorize () {
  969. this.siteData = {
  970. siteid: '',
  971. sitename: '',
  972. active: ''
  973. }
  974. this.siteSelections1 = null
  975. this.siteSelections2 = null
  976. getSiteList(this.selectUser).then(({data}) => {
  977. this.siteList1 = data.row1
  978. this.siteList2 = data.row2
  979. })
  980. this.siteAddModal = true
  981. // this.searchSiteList()
  982. },
  983. /**
  984. * 查询可用site
  985. */
  986. getSite () {
  987. this.siteData.username = this.selectUser.username
  988. getSite(this.siteData).then(({data}) => {
  989. if (data.code === 0) {
  990. this.siteList1 = data.rows
  991. }
  992. })
  993. },
  994. selectFlag () {
  995. return true
  996. },
  997. // 可选site
  998. siteClickRow1 (row) {
  999. this.$refs.siteTable1.toggleRowSelection(row)
  1000. },
  1001. // 已有site
  1002. siteClickRow2 (row) {
  1003. this.$refs.siteTable2.toggleRowSelection(row)
  1004. },
  1005. selectionSite1 (val) {
  1006. this.siteSelections1 = val
  1007. },
  1008. selectionSite2 (val) {
  1009. this.siteSelections2 = val
  1010. },
  1011. // 添加site
  1012. addSite () {
  1013. if (this.siteSelections1 == null || this.siteSelections1.length === 0) {
  1014. this.$message.warning('请选择可选工厂!')
  1015. return
  1016. }
  1017. let inData = {
  1018. username: this.selectUser.username,
  1019. siteList: this.siteSelections1
  1020. }
  1021. addUserSite(inData).then(({data}) => {
  1022. if (data && data.code === 0) {
  1023. getSiteList(this.selectUser).then(({data}) => {
  1024. this.siteList1 = data.row1
  1025. this.siteList2 = data.row2
  1026. })
  1027. this.siteSelections1 = []
  1028. } else {
  1029. this.$alert(data.msg, '错误', {
  1030. confirmButtonText: '确定'
  1031. })
  1032. }
  1033. })
  1034. },
  1035. // 删除site
  1036. deleteSite () {
  1037. if (this.siteSelections2 == null || this.siteSelections2.length === 0) {
  1038. this.$message.warning('请选择已有工厂!')
  1039. return
  1040. }
  1041. let inData = {
  1042. username: this.selectUser.username,
  1043. siteList: this.siteSelections2
  1044. }
  1045. delUserSite(inData).then(({data}) => {
  1046. if (data && data.code === 0) {
  1047. getSiteList(this.selectUser).then(({data}) => {
  1048. this.siteList1 = data.row1
  1049. this.siteList2 = data.row2
  1050. })
  1051. this.siteSelections2 = []
  1052. } else {
  1053. this.$alert(data.msg, '错误', {
  1054. confirmButtonText: '确定'
  1055. })
  1056. }
  1057. })
  1058. },
  1059. // // 关闭后刷新列表
  1060. // refreshDetailList(){
  1061. // this.getDataList()
  1062. // },
  1063. // 授权BU
  1064. buAuthorize () {
  1065. this.buData = {
  1066. site: '',
  1067. buNo: '',
  1068. buDesc: '',
  1069. active: '',
  1070. username: ''
  1071. }
  1072. this.buSelections1 = null
  1073. this.buSelections2 = null
  1074. getBuList(this.selectUser).then(({data}) => {
  1075. this.buList1 = data.row1
  1076. this.buList2 = data.row2
  1077. })
  1078. this.buAddModal = true
  1079. // this.buVisible = true
  1080. // this.searchBuList()
  1081. },
  1082. /**
  1083. * 查询可用bu
  1084. */
  1085. getBu () {
  1086. this.buData.username = this.selectUser.username
  1087. getBu(this.buData).then(({data}) => {
  1088. if (data.code === 0) {
  1089. this.buList1 = data.rows
  1090. }
  1091. })
  1092. },
  1093. // 可选bu
  1094. buClickRow1 (row) {
  1095. this.$refs.buTable1.toggleRowSelection(row)
  1096. },
  1097. // 已有bu
  1098. buClickRow2 (row) {
  1099. this.$refs.buTable2.toggleRowSelection(row)
  1100. },
  1101. selectionBu1 (val) {
  1102. this.buSelections1 = val
  1103. },
  1104. selectionBu2 (val) {
  1105. this.buSelections2 = val
  1106. },
  1107. // 添加bu
  1108. addBu () {
  1109. if (this.buSelections1 == null || this.buSelections1.length === 0) {
  1110. this.$message.warning('请选择可选BU!')
  1111. return
  1112. }
  1113. let inData = {
  1114. username: this.selectUser.username,
  1115. buList: this.buSelections1
  1116. }
  1117. addUserBu(inData).then(({data}) => {
  1118. if (data && data.code === 0) {
  1119. getBuList(this.selectUser).then(({data}) => {
  1120. this.buList1 = data.row1
  1121. this.buList2 = data.row2
  1122. })
  1123. this.buSelections1 = []
  1124. } else {
  1125. this.$alert(data.msg, '错误', {
  1126. confirmButtonText: '确定'
  1127. })
  1128. }
  1129. })
  1130. },
  1131. // 删除bu
  1132. deleteBu () {
  1133. if (this.buSelections2 == null || this.buSelections2.length === 0) {
  1134. this.$message.warning('请选择已有BU!')
  1135. return
  1136. }
  1137. let inData = {
  1138. username: this.selectUser.username,
  1139. buList: this.buSelections2
  1140. }
  1141. delUserBu(inData).then(({data}) => {
  1142. if (data && data.code === 0) {
  1143. getBuList(this.selectUser).then(({data}) => {
  1144. this.buList1 = data.row1
  1145. this.buList2 = data.row2
  1146. })
  1147. this.buSelections2 = []
  1148. } else {
  1149. this.$alert(data.msg, '错误', {
  1150. confirmButtonText: '确定'
  1151. })
  1152. }
  1153. })
  1154. },
  1155. viewUserDept () {
  1156. if (!this.selectUser || !this.selectUser.username) {
  1157. this.$message.warning('请先在列表中选中用户')
  1158. return
  1159. }
  1160. this.userDeptLoading = true
  1161. this.userDeptList = []
  1162. this.userDeptModalVisible = true
  1163. listAccessDeptByUsername({ username: this.selectUser.username }).then(({ data }) => {
  1164. this.userDeptLoading = false
  1165. if (data && data.code === 0) {
  1166. this.userDeptList = data.list || []
  1167. } else {
  1168. this.userDeptList = []
  1169. if (data && data.msg) {
  1170. this.$message.error(data.msg)
  1171. }
  1172. }
  1173. }).catch(() => {
  1174. this.userDeptLoading = false
  1175. this.userDeptList = []
  1176. })
  1177. },
  1178. // 授权部门
  1179. deptAuthorize () {
  1180. this.deptData = {
  1181. site: '',
  1182. buNo: '',
  1183. departmentId: '',
  1184. departmentName: '',
  1185. active: '',
  1186. username: ''
  1187. }
  1188. this.deptSelections1 = null
  1189. this.deptSelections2 = null
  1190. getDeptList(this.selectUser).then(({data}) => {
  1191. this.deptList1 = data.row1
  1192. this.deptList2 = data.row2
  1193. })
  1194. this.deptAddModal = true
  1195. },
  1196. /**
  1197. * 查询可用部门
  1198. */
  1199. getDept () {
  1200. this.deptData.username = this.selectUser.username
  1201. getDept(this.deptData).then(({data}) => {
  1202. if (data.code === 0) {
  1203. this.deptList1 = data.rows
  1204. }
  1205. })
  1206. },
  1207. // 可选部门
  1208. deptClickRow1 (row) {
  1209. this.$refs.deptTable1.toggleRowSelection(row)
  1210. },
  1211. // 已有部门
  1212. deptClickRow2 (row) {
  1213. this.$refs.deptTable2.toggleRowSelection(row)
  1214. },
  1215. selectionDept1 (val) {
  1216. this.deptSelections1 = val
  1217. },
  1218. selectionDept2 (val) {
  1219. this.deptSelections2 = val
  1220. },
  1221. // 添加部门
  1222. addDept () {
  1223. if (this.deptSelections1 == null || this.deptSelections1.length === 0) {
  1224. this.$message.warning('请选择可选部门!')
  1225. return
  1226. }
  1227. let inData = {
  1228. username: this.selectUser.username,
  1229. deptList: this.deptSelections1
  1230. }
  1231. addUserDept(inData).then(({data}) => {
  1232. if (data && data.code === 0) {
  1233. getDeptList(this.selectUser).then(({data}) => {
  1234. this.deptList1 = data.row1
  1235. this.deptList2 = data.row2
  1236. })
  1237. this.deptSelections1 = []
  1238. } else {
  1239. this.$alert(data.msg, '错误', {
  1240. confirmButtonText: '确定'
  1241. })
  1242. }
  1243. })
  1244. },
  1245. // 删除部门
  1246. deleteDept () {
  1247. if (this.deptSelections2 == null || this.deptSelections2.length === 0) {
  1248. this.$message.warning('请选择已有部门!')
  1249. return
  1250. }
  1251. let inData = {
  1252. username: this.selectUser.username,
  1253. deptList: this.deptSelections2
  1254. }
  1255. delUserDept(inData).then(({data}) => {
  1256. if (data && data.code === 0) {
  1257. getDeptList(this.selectUser).then(({data}) => {
  1258. this.deptList1 = data.row1
  1259. this.deptList2 = data.row2
  1260. })
  1261. this.deptSelections2 = []
  1262. } else {
  1263. this.$alert(data.msg, '错误', {
  1264. confirmButtonText: '确定'
  1265. })
  1266. }
  1267. })
  1268. },
  1269. // 岗位
  1270. businessRoleAuthorize () {
  1271. this.businessRoleData = {
  1272. site: '',
  1273. roleNo: '',
  1274. roleDesc: '',
  1275. active: '',
  1276. username: ''
  1277. }
  1278. this.businessRoleSelections1 = null
  1279. this.businessRoleSelections2 = null
  1280. getBusinessRoleList(this.selectUser).then(({data}) => {
  1281. this.businessRoleList1 = data.row1
  1282. this.businessRoleList2 = data.row2
  1283. })
  1284. this.businessRoleAddModal = true
  1285. },
  1286. /**
  1287. * 查询可用角色
  1288. */
  1289. getBusinessRole () {
  1290. this.businessRoleData.username = this.selectUser.username
  1291. getBusinessRole(this.businessRoleData).then(({data}) => {
  1292. if (data.code === 0) {
  1293. this.businessRoleList1 = data.rows
  1294. }
  1295. })
  1296. },
  1297. // 可选角色
  1298. businessRoleClickRow1 (row) {
  1299. this.$refs.businessRoleTable1.toggleRowSelection(row)
  1300. },
  1301. // 已有角色
  1302. businessRoleClickRow2 (row) {
  1303. this.$refs.businessRoleTable2.toggleRowSelection(row)
  1304. },
  1305. selectionBusinessRole1 (val) {
  1306. this.businessRoleSelections1 = val
  1307. },
  1308. selectionBusinessRole2 (val) {
  1309. this.businessRoleSelections2 = val
  1310. },
  1311. // 添加角色
  1312. addBusinessRole () {
  1313. if (this.businessRoleSelections1 == null || this.businessRoleSelections1.length === 0) {
  1314. this.$message.warning('请选择可选角色!')
  1315. return
  1316. }
  1317. let inData = {
  1318. username: this.selectUser.username,
  1319. businessRoleList: this.businessRoleSelections1
  1320. }
  1321. addUserBusinessRole(inData).then(({data}) => {
  1322. if (data && data.code === 0) {
  1323. getBusinessRoleList(this.selectUser).then(({data}) => {
  1324. this.businessRoleList1 = data.row1
  1325. this.businessRoleList2 = data.row2
  1326. })
  1327. this.businessRoleSelections1 = []
  1328. } else {
  1329. this.$alert(data.msg, '错误', {
  1330. confirmButtonText: '确定'
  1331. })
  1332. }
  1333. })
  1334. },
  1335. // 删除角色
  1336. deleteBusinessRole () {
  1337. if (this.businessRoleSelections2 == null || this.businessRoleSelections2.length === 0) {
  1338. this.$message.warning('请选择已有角色!')
  1339. return
  1340. }
  1341. let inData = {
  1342. username: this.selectUser.username,
  1343. businessRoleList: this.businessRoleSelections2
  1344. }
  1345. delUserBusinessRole(inData).then(({data}) => {
  1346. if (data && data.code === 0) {
  1347. getBusinessRoleList(this.selectUser).then(({data}) => {
  1348. this.businessRoleList1 = data.row1
  1349. this.businessRoleList2 = data.row2
  1350. })
  1351. this.businessRoleSelections2 = []
  1352. } else {
  1353. this.$alert(data.msg, '错误', {
  1354. confirmButtonText: '确定'
  1355. })
  1356. }
  1357. })
  1358. },
  1359. saveBuAssessSite () {
  1360. if (this.selectBUList.length == 0) {
  1361. this.$message.warning('请选择BU')
  1362. return false
  1363. }
  1364. let inList = []
  1365. for (let i = 0; i < this.selectBUList.length; i++) {
  1366. let inData = {
  1367. site: this.$store.state.user.site,
  1368. username: this.selectUser.username,
  1369. buNo: this.selectBUList[i]
  1370. }
  1371. inList.push(inData)
  1372. }
  1373. saveAccessBU(inList).then(({data}) => {
  1374. if (data && data.code === 0) {
  1375. this.$message.success('操作成功')
  1376. this.buVisible = false
  1377. } else {
  1378. this.$message.error(data.msg)
  1379. }
  1380. })
  1381. },
  1382. // 保存选中的授权角色
  1383. saveBusinessRoleSite () {
  1384. if (this.selectBusinessRoleList.length == 0) {
  1385. this.$message.warning('请选择角色')
  1386. return false
  1387. }
  1388. let businessRole = []
  1389. for (let i = 0; i < this.selectBusinessRoleList.length; i++) {
  1390. let inData = {
  1391. site: this.$store.state.user.site,
  1392. username: this.selectUser.username,
  1393. roleNo: this.selectBusinessRoleList[i]
  1394. }
  1395. businessRole.push(inData)
  1396. }
  1397. saveBusinessRole(businessRole).then(({data}) => {
  1398. if (data && data.code === 0) {
  1399. this.$message.success('操作成功')
  1400. this.roleVisible = false
  1401. } else {
  1402. this.$message.error(data.msg)
  1403. }
  1404. })
  1405. },
  1406. // 选中行
  1407. handleCurrentChange (val) {
  1408. this.selectUser = val
  1409. this.showButton = false
  1410. },
  1411. saveUserRoleFlag () {
  1412. let saveList = []
  1413. let currentList = this.checked
  1414. // 当前未选择记录
  1415. if (currentList.length == 0) {
  1416. this.$confirm('当前未选择记录,是否继续?', '删除提示', {
  1417. confirmButtonText: '确定',
  1418. cancelButtonText: '取消'
  1419. }).then(() => {
  1420. let data = {
  1421. userId: this.currentData.userId
  1422. }
  1423. saveList.push(data)
  1424. this.saveUserBusinessRole(saveList)
  1425. }).catch(() => {
  1426. })
  1427. } else {
  1428. for (let i = 0; i < currentList.length; i++) {
  1429. let data = {
  1430. userId: this.currentData.userId,
  1431. roleItemNo: currentList[i],
  1432. selectFlag: 'Y'
  1433. }
  1434. saveList.push(data)
  1435. }
  1436. this.saveUserBusinessRole(saveList)
  1437. }
  1438. },
  1439. saveUserBusinessRole (saveList) {
  1440. saveUserBusinessRole(saveList).then(({data}) => {
  1441. this.$alert(data.msg, '操作提示', {
  1442. confirmButtonText: '确定',
  1443. callback: action => {
  1444. if (data.code == 0) {
  1445. this.setUp.reviewFlag = false
  1446. }
  1447. this.setUp.saveButton = false
  1448. }
  1449. })
  1450. })
  1451. },
  1452. // 获取数据列表
  1453. getDataList: throttle(function () {
  1454. this.dataListLoading = true
  1455. this.$http({
  1456. url: this.$http.adornUrl('/sys/user/list'),
  1457. method: 'get',
  1458. params: this.$http.adornParams({
  1459. 'page': this.pageIndex,
  1460. 'limit': this.pageSize,
  1461. 'username': this.dataForm.userName,
  1462. 'userDisplay': this.dataForm.userDisplay
  1463. })
  1464. }).then(({data}) => {
  1465. if (data && data.code === 0) {
  1466. this.dataList = data.page.list
  1467. this.totalPage = data.page.totalCount
  1468. } else {
  1469. this.dataList = []
  1470. this.totalPage = 0
  1471. }
  1472. this.dataListLoading = false
  1473. })
  1474. }, 1000),
  1475. // 每页数
  1476. sizeChangeHandle (val) {
  1477. this.pageSize = val
  1478. this.pageIndex = 1
  1479. this.getDataList()
  1480. },
  1481. // 当前页
  1482. currentChangeHandle (val) {
  1483. this.pageIndex = val
  1484. this.getDataList()
  1485. },
  1486. // 多选
  1487. selectionChangeHandle (val) {
  1488. this.dataListSelections = val
  1489. },
  1490. // 新增 / 修改
  1491. addOrUpdateHandle (id) {
  1492. this.addOrUpdateVisible = true
  1493. this.$nextTick(() => {
  1494. this.$refs.addOrUpdate.init(id)
  1495. })
  1496. },
  1497. // 删除
  1498. deleteHandle (id) {
  1499. let userIds = id ? [id] : this.dataListSelections.map(item => {
  1500. return item.userId
  1501. })
  1502. this.$confirm(`确定对[id=${userIds.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', {
  1503. confirmButtonText: '确定',
  1504. cancelButtonText: '取消',
  1505. type: 'warning'
  1506. }).then(() => {
  1507. this.$http({
  1508. url: this.$http.adornUrl('/sys/user/delete'),
  1509. method: 'post',
  1510. data: this.$http.adornData(userIds, false)
  1511. }).then(({data}) => {
  1512. if (data && data.code === 0) {
  1513. this.$message.success('操作成功')
  1514. this.getDataList()
  1515. } else {
  1516. this.$message.error(data.msg)
  1517. }
  1518. })
  1519. }).catch(() => {
  1520. })
  1521. },
  1522. test () {
  1523. let dto = {
  1524. qty: 100,
  1525. name: '张三'
  1526. }
  1527. this.$http({
  1528. url: this.$http.adornUrl('/pms/test/getTdo1'),
  1529. method: 'get'
  1530. }).then(({data}) => {
  1531. if (data && data.code === 0) {
  1532. } else {
  1533. this.$message.error(data.msg)
  1534. }
  1535. })
  1536. this.$http({
  1537. url: this.$http.adornUrl('/qm/test/list'),
  1538. method: 'get'
  1539. }).then(({data}) => {
  1540. if (data && data.code === 0) {
  1541. } else {
  1542. this.$message.error(data.msg)
  1543. }
  1544. })
  1545. },
  1546. closeDialog () {
  1547. this.$refs.addOrUpdate.closeDialog()
  1548. }
  1549. },
  1550. created () {
  1551. this.getFunctionButtonList()
  1552. }
  1553. }
  1554. </script>
  1555. <style>
  1556. .el-transfer-panel {
  1557. border: 2px solid #17b3a3;
  1558. border-radius: 4px;
  1559. overflow: hidden;
  1560. background: #fff;
  1561. display: inline-block;
  1562. vertical-align: middle;
  1563. width: 200px;
  1564. max-height: 100%;
  1565. -webkit-box-sizing: border-box;
  1566. box-sizing: border-box;
  1567. position: relative;
  1568. }
  1569. .el-transfer-panel .el-transfer-panel__header {
  1570. height: 40px;
  1571. line-height: 40px;
  1572. background: #17b3a3;
  1573. margin: 0;
  1574. padding-left: 15px;
  1575. border-bottom: 1px solid #17b3a3;
  1576. -webkit-box-sizing: border-box;
  1577. box-sizing: border-box;
  1578. color: #000;
  1579. }
  1580. .el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label {
  1581. font-size: 14px;
  1582. color: #303133;
  1583. font-weight: 400;
  1584. }
  1585. .el-dialog__title {
  1586. line-height: 24px;
  1587. font-size: 16px;
  1588. color: #303133;
  1589. }
  1590. </style>