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.

1598 lines
50 KiB

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