index.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <el-card class="content-z">
  3. <a-row :gutter="15">
  4. <a-col :span="4">
  5. <leftTree @selected="getTreeData" />
  6. </a-col>
  7. <a-col :span="20">
  8. <!-- 操作按钮区域 -->
  9. <div class="table-operator" style="margin: 5px 0;float: right">
  10. <a-button v-permission="['pc:system:user:add']" type="primary" icon="plus" @click="handleAdd">新增</a-button>
  11. <!-- <a-button ghost type="danger" icon="download" @click="handleExportXls('角色信息')">导出</a-button>-->
  12. <!-- <a-upload-->
  13. <!-- name="file"-->
  14. <!-- :show-upload-list="false"-->
  15. <!-- :multiple="false"-->
  16. <!-- :headers="tokenHeader"-->
  17. <!-- :action="url.importExcelUrl"-->
  18. <!-- @change="handleImportExcel"-->
  19. <!-- >-->
  20. <!-- <a-button ghost type="danger" icon="import">导入</a-button>-->
  21. <!-- </a-upload>-->
  22. <a-dropdown v-if="selectedRowKeys.length > 0">
  23. <a-menu slot="overlay">
  24. <a-menu-item key="1" v-permission="['pc:system:user:remove']" @click="batchDel">
  25. <a-icon type="delete" />
  26. 批量删除
  27. </a-menu-item>
  28. </a-menu>
  29. <a-button style="margin-left: 8px">
  30. 批量操作
  31. <a-icon type="down" />
  32. </a-button>
  33. </a-dropdown>
  34. </div>
  35. <!-- 查询区域 -->
  36. <div class="table-page-search-wrapper">
  37. <a-form layout="inline" @keyup.enter.native="searchQuery">
  38. <a-form-item>
  39. <a-input
  40. v-model="queryParam.value"
  41. style="width: 150px"
  42. placeholder="姓名/部门/手机号"
  43. />
  44. </a-form-item>
  45. <a-form-item>
  46. <sys-list-select-tag
  47. v-model="queryParam.roleId"
  48. dict-code="role"
  49. placeholder="选择职务"
  50. style="width: 150px"
  51. />
  52. </a-form-item>
  53. <a-form-item>
  54. <j-dict-select-tag
  55. v-model="queryParam.status"
  56. style="width: 150px"
  57. placeholder="状态选项"
  58. dict-code="sys_normal_disable"
  59. />
  60. </a-form-item>
  61. <a-form-item>
  62. <a-button type="primary" @click="searchQuery">查询</a-button>
  63. <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
  64. </a-form-item>
  65. </a-form>
  66. </div>
  67. <!-- table区域-begin -->
  68. <div>
  69. <div class="ant-alert ant-alert-info" style="margin: 16px 0;">
  70. <i class="anticon anticon-info-circle ant-alert-icon" /> 已选择&nbsp;<a style="font-weight: 600">{{
  71. selectedRowKeys.length }}</a>项&nbsp;&nbsp;
  72. <a style="margin-left: 24px" @click="onClearSelected">清空</a>
  73. </div>
  74. <a-table
  75. ref="table"
  76. size="middle"
  77. bordered
  78. row-key="userId"
  79. :columns="columns"
  80. :data-source="dataSource"
  81. :pagination="ipagination"
  82. :loading="loading"
  83. :row-selection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
  84. @change="handleTableChange"
  85. >
  86. <template slot="dept" slot-scope="text, record">
  87. {{ record['dept'].deptName }}
  88. </template>
  89. <!-- <template slot="leader" slot-scope="text, record">-->
  90. <!-- {{ record['dept'].leader }}-->
  91. <!-- </template>-->
  92. <template slot="status" slot-scope="text, record">
  93. <a-switch
  94. v-if="JSPermission(['pc:system:user:edit'])"
  95. :checked="record.status==='1'?false:true"
  96. checked-children="启用"
  97. un-checked-children="停用"
  98. @change="changeStatus({$event,record})"
  99. />
  100. <span v-else>{{ record.status==='1'?'停用':'启用' }}</span>
  101. </template>
  102. <span slot="action" slot-scope="text, record">
  103. <a-button v-permission="['pc:system:user:edit']" size="small" type="primary" @click="handleEdit(record)">
  104. 编辑
  105. </a-button>
  106. <a-divider type="vertical" />
  107. <a-dropdown>
  108. <a-button size="small" class="ant-dropdown-link" type="primary">
  109. 更多 <a-icon type="down" />
  110. </a-button>
  111. <a-menu slot="overlay">
  112. <a-menu-item>
  113. <a-popconfirm title="确认重置密码吗?重置后的密码是 123456" @confirm="() => rePwd(record)">
  114. <a v-permission="['pc:system:user:resetPwd']" href="javascript:;">重置密码</a>
  115. </a-popconfirm>
  116. </a-menu-item>
  117. <!-- <a-menu-item>-->
  118. <!-- <a href="javascript:;" @click="loginLog(record)">登录日志</a>-->
  119. <!-- </a-menu-item>-->
  120. <!-- <a-menu-item>-->
  121. <!-- <a href="javascript:;" @click="handleLog(record)">操作记录</a>-->
  122. <!-- </a-menu-item>-->
  123. </a-menu>
  124. </a-dropdown>
  125. <a-divider type="vertical" />
  126. <a-popconfirm
  127. v-permission="['pc:system:user:remove']"
  128. title="确定删除吗?"
  129. @confirm="() => handleDelete(record.userId)"
  130. >
  131. <a-button size="small" type="danger">
  132. 删除
  133. </a-button>
  134. </a-popconfirm>
  135. </span>
  136. </a-table>
  137. <check-and-edit-model ref="modalForm" @ok="modalFormOk" />
  138. </div>
  139. <!-- table区域-end -->
  140. <!-- 表单区域 -->
  141. </a-col>
  142. </a-row>
  143. </el-card>
  144. </template>
  145. <script>
  146. import { listMixin } from '@/mixin/listMixin'
  147. import columns from './indexColumns'
  148. import CheckAndEditModel from './CheckAndEditModel'
  149. import leftTree from '@/components/leftTree'
  150. import { httpAction } from '@/api/request'
  151. import JSPermission from '@/utils/JSPermission'
  152. export default {
  153. components: {
  154. CheckAndEditModel,
  155. leftTree
  156. },
  157. mixins: [listMixin],
  158. data() {
  159. return {
  160. // 查询条件
  161. queryParam: {},
  162. // 表头
  163. columns: columns(this),
  164. url: {
  165. list: '/system/user/list',
  166. delete: '/system/user/',
  167. exportXlsUrl: '/exportXlsUrl',
  168. importExcelUrl: `${process.env.VUE_APP_BASE_API}/importExcelUrl`
  169. }
  170. }
  171. },
  172. created() {
  173. },
  174. methods: {
  175. JSPermission,
  176. getTreeData(data) {
  177. this.queryParam.deptId = data.id
  178. this.loadData()
  179. },
  180. rePwd(record) {
  181. httpAction('/system/user/resetPwd', record, 'put').then((res) => {
  182. if (res.code === 200) {
  183. this.$message.success(res.msg)
  184. } else {
  185. console.log(res)
  186. }
  187. })
  188. },
  189. changeStatus({ $event, record }) {
  190. console.log($event, record)
  191. record.status = $event ? '0' : '1'
  192. httpAction('/system/user/changeStatus', record, 'put').then((res) => {
  193. if (res.code === 200) {
  194. this.$message.success(res.msg)
  195. } else {
  196. console.log(res)
  197. }
  198. })
  199. },
  200. handleLog() {
  201. },
  202. loginLog() {
  203. },
  204. updateQueryParam(data) {
  205. this.queryParam.unit = data.id
  206. this.queryParam.unitName = data.departName
  207. }
  208. }
  209. }
  210. </script>
  211. <style scoped>
  212. @import '~@/assets/less/common.less'
  213. </style>