deb0b5f50125e9e9d76aca9b26c71ee00f5196fa.svn-base 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <!-- 搜索区域 -->
  6. <a-form layout="inline">
  7. <a-row :gutter="10">
  8. <a-col :md="10" :sm="12">
  9. <a-form-item label="部门角色名称" style="margin-left:8px">
  10. <a-input placeholder="请输入部门角色" v-model="queryParam.roleName"></a-input>
  11. </a-form-item>
  12. </a-col>
  13. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  14. <a-col :md="6" :sm="24">
  15. <a-button type="primary" @click="searchQuery" icon="search" style="margin-left: 18px">查询</a-button>
  16. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  17. </a-col>
  18. </span>
  19. </a-row>
  20. </a-form>
  21. </div>
  22. <!-- 操作按钮区域 -->
  23. <div class="table-operator" :md="24" :sm="24">
  24. <a-button @click="handleAdd" type="primary" icon="plus">新建部门角色</a-button>
  25. <a-dropdown v-if="selectedRowKeys.length > 0">
  26. <a-menu slot="overlay">
  27. <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
  28. </a-menu>
  29. <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
  30. </a-dropdown>
  31. </div>
  32. <!-- table区域-begin -->
  33. <div>
  34. <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
  35. <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">
  36. {{selectedRowKeys.length }}</a>项
  37. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  38. </div>
  39. <a-table
  40. ref="table"
  41. size="middle"
  42. bordered
  43. rowKey="id"
  44. :columns="columns"
  45. :dataSource="dataSource"
  46. :pagination="ipagination"
  47. :loading="loading"
  48. :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  49. @change="handleTableChange">
  50. <span slot="action" slot-scope="text, record">
  51. <a @click="handleEdit(record)">编辑</a>
  52. <a-divider type="vertical"/>
  53. <a-dropdown>
  54. <a class="ant-dropdown-link">
  55. 更多 <a-icon type="down"/>
  56. </a>
  57. <a-menu slot="overlay">
  58. <a-menu-item>
  59. <a @click="handlePerssion(record)">授权</a>
  60. </a-menu-item>
  61. <a-menu-item>
  62. <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
  63. <a>删除</a>
  64. </a-popconfirm>
  65. </a-menu-item>
  66. </a-menu>
  67. </a-dropdown>
  68. </span>
  69. </a-table>
  70. </div>
  71. <!-- table区域-end -->
  72. <!-- 表单区域 -->
  73. <sys-depart-role-modal ref="modalForm" @ok="modalFormOk"/>
  74. <dept-role-auth-modal ref="modalDeptRole" />
  75. </a-card>
  76. </template>
  77. <script>
  78. import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  79. import {getAction} from '@/api/manage'
  80. import SysDepartRoleModal from './SysDepartRoleModal'
  81. import DeptRoleAuthModal from './DeptRoleAuthModal'
  82. export default {
  83. name: 'DeptRoleInfo',
  84. components: { DeptRoleAuthModal, SysDepartRoleModal },
  85. mixins: [JeecgListMixin],
  86. data() {
  87. return {
  88. description: '部门角色信息',
  89. currentDeptId: '',
  90. // 表头
  91. columns: [{
  92. title: '部门角色名称',
  93. align: "center",
  94. dataIndex: 'roleName'
  95. },
  96. {
  97. title: '部门角色编码',
  98. align: "center",
  99. dataIndex: 'roleCode'
  100. },
  101. {
  102. title: '部门',
  103. align: "center",
  104. dataIndex: 'departId_dictText'
  105. },
  106. {
  107. title: '备注',
  108. align: "center",
  109. dataIndex: 'description'
  110. },
  111. {
  112. title: '操作',
  113. dataIndex: 'action',
  114. scopedSlots: {customRender: 'action'},
  115. align: "center",
  116. width: 170
  117. }],
  118. url: {
  119. list: "/sys/sysDepartRole/list",
  120. delete: "/sys/sysDepartRole/delete",
  121. deleteBatch: "/sys/sysDepartRole/deleteBatch",
  122. }
  123. }
  124. },
  125. created() {
  126. },
  127. methods: {
  128. searchReset() {
  129. this.queryParam = {}
  130. this.loadData(1);
  131. },
  132. loadData(arg) {
  133. if (!this.url.list) {
  134. this.$message.error("请设置url.list属性!")
  135. return
  136. }
  137. //加载数据 若传入参数1则加载第一页的内容
  138. if (arg === 1) {
  139. this.ipagination.current = 1;
  140. }
  141. let params = this.getQueryParams();//查询条件
  142. params.deptId = this.currentDeptId;
  143. getAction(this.url.list, params).then((res) => {
  144. if (res.success && res.result) {
  145. this.dataSource = res.result.records;
  146. this.ipagination.total = Number(res.result.total);
  147. }
  148. })
  149. },
  150. open(record) {
  151. this.currentDeptId = record.id;
  152. this.loadData(1);
  153. },
  154. clearList() {
  155. this.currentDeptId = '';
  156. this.dataSource = [];
  157. },
  158. hasSelectDept() {
  159. if (this.currentDeptId == '') {
  160. this.$message.error("请选择一个部门!")
  161. return false;
  162. }
  163. return true;
  164. },
  165. handleEdit: function (record) {
  166. this.$refs.modalForm.title = "编辑";
  167. this.$refs.modalForm.departDisabled = true;
  168. this.$refs.modalForm.disableSubmit = false;
  169. this.$refs.modalForm.edit(record,record.departId);
  170. },
  171. handleAdd: function () {
  172. if (this.currentDeptId == '') {
  173. this.$message.error("请选择一个部门!")
  174. } else {
  175. this.$refs.modalForm.departDisabled = true;
  176. this.$refs.modalForm.add(this.currentDeptId);
  177. this.$refs.modalForm.title = "新增";
  178. }
  179. },
  180. handlePerssion: function(record){
  181. this.$refs.modalDeptRole.show(record.id,record.departId);
  182. },
  183. }
  184. }
  185. </script>
  186. <style scoped>
  187. </style>