index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div class="app-container">
  3. <!-- 筛选start -->
  4. <div class="filter-container mb-10">
  5. <div class="left">
  6. <div>
  7. <span class="" style="margin-right: 30px">用户管理列表</span>
  8. <el-button icon="el-icon-plus" type="success" @click="addItem()"
  9. >新增</el-button
  10. >
  11. </div>
  12. <div style="margin-top: 20px">
  13. <div class="filter-item" >
  14. 姓名:
  15. <el-input
  16. v-model="userName"
  17. placeholder="请输入内容"
  18. style="width: 180px"
  19. ></el-input>
  20. </div>
  21. <div class="filter-item" >
  22. 手机号:
  23. <el-input
  24. v-model="phone"
  25. placeholder="请输入内容"
  26. style="width: 180px"
  27. ></el-input>
  28. </div>
  29. <div class="filter-item">
  30. 所属企业:
  31. <el-select
  32. v-model="region"
  33. placeholder="请选择"
  34. style="width: 150px"
  35. >
  36. <el-option label="企业一" value="1"></el-option>
  37. <el-option label="企业二" value="2"></el-option>
  38. </el-select>
  39. </div>
  40. <div class="filter-item">
  41. 角色:
  42. <el-select
  43. v-model="role"
  44. placeholder="请选择"
  45. style="width: 200px"
  46. >
  47. <el-option label="角色1" value="1"></el-option>
  48. <el-option label="角色2" value="2"></el-option>
  49. </el-select>
  50. </div>
  51. <el-button type="primary" icon="el-icon-search" class="search-button"
  52. >查询</el-button
  53. >
  54. </div>
  55. </div>
  56. <div class="right">
  57. <el-button type="primary">导出</el-button>
  58. </div>
  59. </div>
  60. <!-- 筛选end -->
  61. <!-- 表格start -->
  62. <el-table
  63. :data="tableData"
  64. border
  65. stripe
  66. :header-cell-style="headClass"
  67. >
  68. <el-table-column prop="xh" label="序号" width="70">
  69. </el-table-column>
  70. <el-table-column prop="userName" label="姓名" width="">
  71. </el-table-column>
  72. <el-table-column prop="sex" label="性别" width="">
  73. </el-table-column>
  74. <el-table-column prop="contact" label="联系方式" width="">
  75. </el-table-column>
  76. <el-table-column prop="password" label="密码" width="">
  77. </el-table-column>
  78. <el-table-column prop="ownerCompany" label="所属企业" width="">
  79. </el-table-column>
  80. <el-table-column prop="role" label="角色" width="">
  81. </el-table-column>
  82. <el-table-column fixed="right" label="操作" width="180">
  83. <template #default="scope">
  84. <el-button
  85. @click="checkItem(scope.$index, scope.row)"
  86. type="text"
  87. size="small"
  88. class="delete-text"
  89. >查看</el-button
  90. >
  91. <el-button
  92. type="text"
  93. size="small"
  94. @click.prevent="editRow(scope.row)"
  95. >编辑</el-button
  96. >
  97. </template>
  98. </el-table-column>
  99. </el-table>
  100. <!-- 表格end -->
  101. <!-- 分页start -->
  102. <div class="paginationBlock">
  103. <el-pagination
  104. @size-change="handleSizeChange"
  105. @current-change="handleCurrentChange"
  106. :current-page="currentPage4"
  107. :page-sizes="[100, 200, 300, 400]"
  108. :page-size="100"
  109. layout="total, sizes, prev, pager, next, jumper"
  110. :total="400"
  111. >
  112. </el-pagination>
  113. </div>
  114. <!-- 分页end -->
  115. <!--弹框组件开始-----------------------start-->
  116. <dialog-component
  117. :dialogTitle="dialogTitle"
  118. :itemInfo="tableItem"
  119. @closeDialog="closeDialog"
  120. :flag="showDialog"
  121. ></dialog-component>
  122. <!--弹框组件开始-----------------------end-->
  123. </div>
  124. </template>
  125. <script>
  126. import { defineComponent, ref,reactive} from 'vue'
  127. import DialogComponent from "./dialogComponent";
  128. export default defineComponent({
  129. components: { DialogComponent},
  130. setup() {
  131. const userName = ref('')
  132. const phone = ref('')
  133. const region = ref('')
  134. const role = ref('')
  135. const currentPage4 = ref(4)
  136. const dialogTitle = ref('')
  137. const showDialog = ref(false)
  138. const tableData = ref([
  139. {
  140. xh: "1",
  141. userName: "张三",
  142. sex: "男",
  143. contact: "12345678989 ",
  144. password: "123456",
  145. role: "维保 ",
  146. ownerCompany: "伍继",
  147. },
  148. {
  149. xh: "1",
  150. userName: "张三",
  151. sex: "男",
  152. contact: "12345678989 ",
  153. password: "123456",
  154. ownerCompany: "伍继",
  155. role: "维保 ",
  156. }
  157. ])
  158. const handleSizeChange=(val)=> {
  159. console.log(`每页 ${val} 条`);
  160. }
  161. const handleCurrentChange=(val)=> {
  162. console.log(`当前页: ${val}`);
  163. }
  164. // // 表头样式设置
  165. const headClass=()=> {
  166. return "background:#FAFAFA;";
  167. }
  168. const tableItem = reactive([])
  169. // 添加操作
  170. const addItem=()=> {
  171. tableItem.value = {
  172. id: "",
  173. stationName: "",
  174. xh: "",
  175. userName: "",
  176. siteList: [],
  177. done: "",
  178. guaZai: "",
  179. checked: true,
  180. };
  181. dialogTitle.value = "新增";
  182. showDialog.value = true;
  183. }
  184. // 查看
  185. const checkItem=(row)=> {
  186. console.log(row)
  187. tableItem.value = row
  188. dialogTitle.value = '查看'
  189. showDialog.value = true
  190. }
  191. // 编辑操作
  192. const editRow = (row) => {
  193. console.log(row)
  194. tableItem.value = row
  195. dialogTitle.value = '编辑'
  196. showDialog.value = true
  197. }
  198. // 关闭操作
  199. const closeDialog = () => {
  200. showDialog.value = false
  201. }
  202. return {
  203. userName,
  204. phone,
  205. region,
  206. role,
  207. tableItem,
  208. currentPage4,
  209. dialogTitle,
  210. showDialog,
  211. tableData,
  212. handleSizeChange,
  213. handleCurrentChange,
  214. headClass,
  215. checkItem,
  216. addItem,
  217. editRow,
  218. closeDialog,
  219. }
  220. },
  221. })
  222. </script>
  223. <style lang="scss" scoped>
  224. </style>