index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <div id="index">
  3. <el-row>
  4. <el-col :span="24" class="info">
  5. <el-col :span="24" class="top">
  6. <topInfo :topTitle="topTitle"></topInfo>
  7. </el-col>
  8. <el-col :span="24" class="search">
  9. <el-col :span="8" class="left">
  10. <span>查询身份证:</span>
  11. <el-input v-model="input" placeholder="请输入身份证"></el-input>
  12. </el-col>
  13. <el-col :span="8" class="left">
  14. <span>查询名称:</span>
  15. <el-input v-model="input" placeholder="请输入名称"></el-input>
  16. </el-col>
  17. <el-col :span="8" class="right">
  18. <el-button size="mini" type="primary" icon="el-icon-search">查询</el-button>
  19. <el-button size="mini" type="success" icon="el-icon-check" @click="addData()">添加用户</el-button>
  20. </el-col>
  21. </el-col>
  22. <el-col :span="24" class="main">
  23. <el-table :data="tableData" style="width: 100%" border>
  24. <el-table-column label="序号" type="index" width="50" align="left"> </el-table-column>
  25. <el-table-column prop="name" label="名称" width="80" align="left"> </el-table-column>
  26. <el-table-column prop="sfzh" label="身份证号" width="180" align="left"> </el-table-column>
  27. <el-table-column prop="loginName" label="登录名称" width="80" align="left"> </el-table-column>
  28. <el-table-column prop="tel" label="联系电话" width="120" align="left"> </el-table-column>
  29. <el-table-column prop="email" label="电子邮箱" width="205" align="left"> </el-table-column>
  30. <el-table-column prop="date" label="创建时间" width="100" align="left"> </el-table-column>
  31. <el-table-column label="操作" width="180" align="left">
  32. <template slot-scope="scoped">
  33. <el-button size="mini" type="primary" icon="el-icon-view" @click="openDialog(scoped.$index)"></el-button>
  34. <el-button size="mini" type="primary" icon="el-icon-edit" @click="addData(scoped.$index)"></el-button>
  35. <el-button size="mini" type="danger" icon="el-icon-delete" @click.native.prevent="deleteRow(scoped.$index, tableData)"></el-button>
  36. </template>
  37. </el-table-column>
  38. </el-table>
  39. <el-col :span="24" class="page">
  40. <el-pagination
  41. @size-change="handleSizeChange"
  42. @current-change="handleCurrentChange"
  43. :current-page="currentPage"
  44. layout="total, prev, pager, next, jumper"
  45. :total="1"
  46. >
  47. </el-pagination>
  48. </el-col>
  49. </el-col>
  50. </el-col>
  51. </el-row>
  52. <el-dialog title="详细信息" :visible.sync="dialog">
  53. <el-col :span="24" class="dataInfo">
  54. <el-col :span="24"> 姓名:{{ info.name }} </el-col>
  55. <el-col :span="24"> 身份证号:{{ info.sfzh }} </el-col>
  56. <el-col :span="24"> 登录名称:{{ info.loginName }} </el-col>
  57. <el-col :span="24"> 联系电话:{{ info.tel }} </el-col>
  58. <el-col :span="24"> 邮箱:{{ info.email }} </el-col>
  59. <el-col :span="24"> 创建时间:{{ info.date }} </el-col>
  60. </el-col>
  61. </el-dialog>
  62. </div>
  63. </template>
  64. <script>
  65. import topInfo from '@/layout/top.vue';
  66. export default {
  67. name: 'index',
  68. props: {},
  69. components: {
  70. topInfo, //头部标题
  71. },
  72. data: () => ({
  73. topTitle: '用户管理',
  74. input: '',
  75. tableData: [
  76. {
  77. name: '测试人员',
  78. sfzh: '220182199603257019',
  79. loginName: '测试人员',
  80. tel: '17319450324',
  81. email: '17319450324@163.com',
  82. date: '2019-01-10',
  83. },
  84. {
  85. name: '十条数据',
  86. sfzh: '220182199603257019',
  87. loginName: '测试人员',
  88. tel: '17319450324',
  89. email: '17319450324@163.com',
  90. date: '2019-01-10',
  91. },
  92. ],
  93. currentPage: 1,
  94. dialog: false,
  95. info: {},
  96. }),
  97. created() {},
  98. computed: {},
  99. methods: {
  100. handleSizeChange(val) {
  101. console.log(`每页 ${val} 条`);
  102. },
  103. handleCurrentChange(val) {
  104. console.log(`当前页: ${val}`);
  105. },
  106. addData(index) {
  107. if (index !== undefined) {
  108. let data = this.tableData[index];
  109. } else {
  110. this.form = {};
  111. }
  112. this.$router.push({ path: './detail' });
  113. },
  114. deleteRow(index, rows) {
  115. rows.splice(index, 1);
  116. },
  117. openDialog(index) {
  118. if (index !== undefined) {
  119. let data = JSON.parse(JSON.stringify(this.tableData[index]));
  120. data[`index`] = index;
  121. this.$set(this, `info`, data);
  122. }
  123. this.dialog = true;
  124. },
  125. },
  126. };
  127. </script>
  128. <style lang="less" scoped>
  129. .top {
  130. height: 40px;
  131. background-color: #f5f5f5;
  132. }
  133. .search {
  134. height: 40px;
  135. line-height: 40px;
  136. padding: 0 15px;
  137. }
  138. .search .left span {
  139. font-size: 13px;
  140. color: #393939;
  141. }
  142. .search .left .el-input {
  143. width: 50%;
  144. }
  145. /deep/.search .left .el-input .el-input__inner {
  146. height: 28px;
  147. }
  148. .main {
  149. width: 97%;
  150. margin: 0 15px;
  151. }
  152. /deep/.el-table th {
  153. padding: 5px 0;
  154. background: #f2f2f2;
  155. }
  156. /deep/.el-table td {
  157. padding: 5px 0;
  158. }
  159. /deep/.el-table tr {
  160. background: #f9f9f9;
  161. }
  162. /deep/.el-table tr:nth-child(2n) {
  163. background: #fff;
  164. }
  165. .page {
  166. text-align: center;
  167. padding: 30px 0;
  168. }
  169. /deep/ .el-dialog__body {
  170. min-height: 300px;
  171. }
  172. .dataInfo .el-col {
  173. font-size: 18px;
  174. padding: 0 0 20px 0;
  175. }
  176. </style>