list.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <div class="container normal-panel">
  3. <!-- 表格搜索 -->
  4. <div class="flex-align-center search-panel" style="margin-bottom: 16px">
  5. <div class="flex-align-center">
  6. <p>搜索:</p>
  7. <el-input prefix-icon="el-icon-search" style="width:200px" placeholder="账号,系统名称,联系电话" v-model="param.content.where.condition" class="input-with-select" size="small" @clear="listData('search')" @keyup.native.enter="listData('search')" clearable></el-input>
  8. </div>
  9. <div class="flex-align-center" style="margin-left: 30px">
  10. <p>状态:</p>
  11. <el-select
  12. style="width: 120px"
  13. size="small"
  14. v-model="status"
  15. placeholder="请选择"
  16. @change="listData('search')"
  17. >
  18. <el-option
  19. v-for="item in select"
  20. :label="item.remarks"
  21. :value="item.value"
  22. :key="item.index"
  23. ></el-option>
  24. </el-select>
  25. </div>
  26. <div class="flex-align-center" style="margin-left: 30px">
  27. <p style="width:70px">用户类型:</p>
  28. <el-select
  29. style="width: 120px"
  30. size="small"
  31. v-model="userType"
  32. placeholder="请选择"
  33. @change="listData('search')"
  34. clearable
  35. >
  36. <el-option
  37. v-for="item in userTypeArr"
  38. :label="item.remarks"
  39. :value="item.value"
  40. :key="item.rowindex"
  41. ></el-option>
  42. </el-select>
  43. </div>
  44. </div>
  45. <!-- 表格主题 -->
  46. <tableLayout
  47. :layout="tablecols"
  48. :data="list"
  49. :opwidth="200"
  50. :custom="true"
  51. :height="tableHieght"
  52. >
  53. <template v-slot:customcol="scope">
  54. <p v-if="scope.column.columnname === 'status'">
  55. <span
  56. :style="
  57. scope.column.data.status === 'ACTIVE'
  58. ? 'color:#52C41A'
  59. : 'color:#FF3B30'
  60. "
  61. >{{
  62. scope.column.data.status === "ACTIVE"
  63. ? "启用"
  64. : scope.column.data.status === "INACTIVE"
  65. ? "停用"
  66. : "其他"
  67. }}</span
  68. >
  69. </p>
  70. <p v-else>{{ scope.column.data[scope.column.columnname] }}</p>
  71. </template>
  72. <template v-slot:opreation="scope">
  73. <slot name="detail" :data="scope.data"></slot>
  74. <slot name="edit" :data="scope.data"></slot>
  75. <slot name="use" :data="scope.data"></slot>
  76. <!-- <el-button size="mini" type="text" @click="onDelete(scope)">删 除</el-button> -->
  77. <slot name="del" :data="scope.data"></slot>
  78. </template>
  79. </tableLayout>
  80. <div style="margin-top: 16px; text-align: right">
  81. <el-pagination
  82. background
  83. small
  84. @size-change="handleSizeChange"
  85. @current-change="handleCurrentChange"
  86. :current-page="currentPage"
  87. :page-size="param.content.pageSize"
  88. layout="total, prev, pager, next, jumper"
  89. :total="total"
  90. >
  91. </el-pagination>
  92. </div>
  93. </div>
  94. </template>
  95. <script>
  96. import tableLayout from "../../../components/dynamic-table";
  97. export default {
  98. components: {
  99. tableLayout,
  100. },
  101. data() {
  102. return {
  103. param: {
  104. classname: "webmanage.users.users",
  105. method: "query_userList",
  106. content: {
  107. pageNumber: 1,
  108. pageSize: 20,
  109. where: {
  110. condition: "",
  111. status: "",
  112. },
  113. },
  114. },
  115. status: "ALL",
  116. select: [],
  117. tablecols: [],
  118. list: [],
  119. total: 0,
  120. currentPage: 0,
  121. value: "",
  122. userType: '',
  123. userTypeArr: ''
  124. };
  125. },
  126. methods: {
  127. listData(issearch) {
  128. issearch === "search" ? (this.param.content.pageNumber = 1) : "";
  129. this.param.content.where.usertype = this.userType
  130. this.param.content.where.status =
  131. this.status === "ALL" ? "" : this.status;
  132. this.$api.requested(this.param).then((res) => {
  133. this.list = res.data;
  134. this.total = res.total;
  135. console.log(this.total);
  136. this.currentPage = res.pageNumber;
  137. });
  138. },
  139. //获取用户类型
  140. async getRoleData() {
  141. let param = {
  142. "accesstoken": "4a6559d45d2a4c6e0ebac2c803344106",
  143. "classname": "sysmanage.develop.optiontype.optiontype",
  144. "method": "optiontypeselect",
  145. "content": {
  146. "pageNumber": 1,
  147. "pageSize": 20,
  148. "typename": "usertype",
  149. "parameter": {
  150. }
  151. }
  152. }
  153. let res = await this.$api.requested(param)
  154. res.data.unshift({
  155. remarks:'全部',
  156. rowindex:100,
  157. value: ''
  158. })
  159. this.userTypeArr = res.data
  160. },
  161. async userstatus() {
  162. let param = {
  163. classname: "sysmanage.develop.optiontype.optiontype",
  164. method: "optiontypeselect",
  165. content: {
  166. pageNumber: 1,
  167. pageSize: 20,
  168. typename: "userstatus",
  169. parameter: {},
  170. },
  171. };
  172. const res = await this.$api.requested(param);
  173. this.select = res.data;
  174. console.log(this.select);
  175. },
  176. handleSizeChange(val) {
  177. // console.log(`每页 ${val} 条`);
  178. this.param.content.pageSize = val;
  179. this.listData();
  180. },
  181. handleCurrentChange(val) {
  182. // console.log(`当前页: ${val}`);
  183. this.param.content.pageNumber = val;
  184. this.listData();
  185. },
  186. handleSelectionChange(selecttion) {
  187. this.$emit("handleSelectionChange", selecttion);
  188. },
  189. },
  190. created() {
  191. this.getRoleData()
  192. },
  193. mounted() {
  194. this.listData();
  195. this.userstatus();
  196. this.tablecols = this.tool.tabelCol(
  197. this.$route.name
  198. ).accountTable.tablecols;
  199. },
  200. };
  201. </script>
  202. <style>
  203. .el-input-group__append,
  204. .el-input-group__prepend {
  205. background-color: #4f7bfd;
  206. color: #fff;
  207. border: 1px solid #4f7bfd;
  208. cursor: pointer;
  209. }
  210. </style>
  211. <style scoped>
  212. .search-panel p {
  213. flex: 1 0 auto;
  214. width: 40px;
  215. font-size: 14px;
  216. }
  217. </style>