admin_operate.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <section class="content">
  3. <div class="box box-info">
  4. <div
  5. v-loading.body="loading"
  6. v-loading.fullscreen="loading"
  7. class="box-body"
  8. element-loading-text="请稍后..."
  9. >
  10. <!-- 表单 -->
  11. <el-form inline :model="searchForm">
  12. <el-form-item label="登录名">
  13. <el-input
  14. v-model="searchForm.loginName"
  15. placeholder="请输入登录名"
  16. style="width: 180px"
  17. />
  18. </el-form-item>
  19. <el-form-item label="角色">
  20. <el-select
  21. v-model="searchForm.roleId"
  22. clearable
  23. placeholder="请选择"
  24. class="input_width"
  25. >
  26. <el-option
  27. v-for="item in roleList4Search"
  28. :key="item.roleId"
  29. :label="item.roleName"
  30. :value="item.roleId"
  31. />
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="操作时间">
  35. <el-date-picker
  36. v-model="timeRange"
  37. class="input"
  38. type="datetimerange"
  39. start-placeholder="开始日期"
  40. range-separator="至"
  41. end-placeholder="结束日期"
  42. value-format="yyyy-MM-dd HH:mm:ss"
  43. :clearable="false"
  44. size="small"
  45. @change="changeTimeRange"
  46. ></el-date-picker>
  47. </el-form-item>
  48. <el-form-item>
  49. <el-button
  50. size="small"
  51. type="primary"
  52. icon="el-icon-search"
  53. @click="handleSearchBtn"
  54. >
  55. 查询
  56. </el-button>
  57. </el-form-item>
  58. </el-form>
  59. <div class="block-seperator"></div>
  60. <!-- 页面列表 -->
  61. <el-table :data="tableData" border resizable stripe style="width: 100%">
  62. <el-table-column width="120" prop="loginName" label="登录名">
  63. </el-table-column>
  64. <el-table-column width="120" prop="name" label="姓名">
  65. </el-table-column>
  66. <el-table-column prop="roles" label="用户角色"> </el-table-column>
  67. <el-table-column width="120" prop="operateIp" label="IP地址">
  68. </el-table-column>
  69. <el-table-column width="200" prop="operate" label="操作">
  70. </el-table-column>
  71. <el-table-column width="150" prop="operateTime" label="操作时间">
  72. </el-table-column>
  73. </el-table>
  74. <div class="page pull-right">
  75. <el-pagination
  76. v-if="paginationShow"
  77. :current-page="currentPage"
  78. :page-size="pageSize"
  79. :page-sizes="[10, 20, 50, 100, 200, 300]"
  80. layout="total, sizes, prev, pager, next, jumper"
  81. :total="total"
  82. @current-change="handleCurrentChange"
  83. @size-change="handleSizeChange"
  84. />
  85. </div>
  86. </div>
  87. </div>
  88. </section>
  89. </template>
  90. <script>
  91. import { CORE_API } from "@/constants/constants.js";
  92. import { mapState } from "vuex";
  93. export default {
  94. name: "Project",
  95. data() {
  96. return {
  97. examList: [],
  98. loading: false,
  99. paginationShow: false,
  100. roleList4Search: [],
  101. timeRange: [],
  102. searchForm: {
  103. startTime: null,
  104. endTime: null,
  105. loginName: "",
  106. roleId: "",
  107. },
  108. tableData: [],
  109. currentPage: 1,
  110. pageSize: 10,
  111. total: 10,
  112. };
  113. },
  114. computed: {
  115. ...mapState({ user: (state) => state.user }),
  116. },
  117. //初始化查询
  118. created() {
  119. this.init();
  120. },
  121. methods: {
  122. changeTimeRange(e) {
  123. if (e && e.length > 0) {
  124. this.searchForm.startTime = e[0];
  125. this.searchForm.endTime = e[1];
  126. } else {
  127. this.searchForm.startTime = "";
  128. this.searchForm.endTime = "";
  129. }
  130. },
  131. handleSearchBtn() {
  132. this.currentPage = 1;
  133. this.search();
  134. },
  135. handleSizeChange(val) {
  136. this.pageSize = val;
  137. this.currentPage = 1;
  138. this.search();
  139. },
  140. handleCurrentChange(val) {
  141. this.currentPage = val;
  142. this.search();
  143. },
  144. //查询
  145. search() {
  146. this.loading = true;
  147. var url =
  148. CORE_API +
  149. "/adminOperate/page/" +
  150. this.currentPage +
  151. "/" +
  152. this.pageSize;
  153. this.$httpWithMsg
  154. .get(url, { params: this.searchForm })
  155. .then((response) => {
  156. this.tableData = response.data.list;
  157. this.total = response.data.total;
  158. this.loading = false;
  159. this.$nextTick(function () {
  160. this.paginationShow = true;
  161. });
  162. })
  163. .finally(() => (this.loading = false));
  164. },
  165. init() {
  166. this.search();
  167. var url =
  168. CORE_API +
  169. "/rolePrivilege/getRoles?includeSuperAdmin=true&rootOrgId=" +
  170. this.user.rootOrgId;
  171. Promise.all([this.$httpWithMsg.post(url)]).then(([resp]) => {
  172. this.roleList4Search = resp.data;
  173. });
  174. },
  175. },
  176. };
  177. </script>
  178. <style scoped>
  179. .page {
  180. margin-top: 10px;
  181. }
  182. .pull-length {
  183. width: 300px;
  184. }
  185. .pull-center {
  186. margin-top: 20px;
  187. }
  188. .editForm .el-form-item {
  189. margin-bottom: 12px;
  190. }
  191. </style>