阜外华中心血管医院6.0vue版

index.vue 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. <template>
  2. <div class="app-container customer">
  3. <div class="filter-container">
  4. <el-date-picker
  5. v-model="searchDate"
  6. :picker-options="pickerOptions"
  7. class="filter-item"
  8. type="daterange"
  9. format="yyyy年MM月dd日"
  10. value-format="yyyy-MM-dd"
  11. align="left"
  12. unlink-panels
  13. range-separator="至"
  14. start-placeholder="开始日期"
  15. end-placeholder="结束日期"/>
  16. <el-input v-model="keyword" placeholder="请输入姓名,手机号码,固话" class="filter-item"/>
  17. <el-button type="primary" class="filter-item" icon="el-icon-search" @click="btn_search">搜索</el-button>
  18. <el-button type="primary" class="filter-item" icon="el-icon-plus" @click="btn_add">添加</el-button>
  19. <el-button v-permission="'HY_deletes'" type="primary" class="filter-item" icon="el-icon-delete" @click="btn_deletes">批量删除</el-button>
  20. </div>
  21. <el-table v-loading="loading" :data="dataLists" border stripe @selection-change="changeSelects">
  22. <el-table-column type="selection" width="40"/>
  23. <el-table-column type="index" label="编号" align="center" fixed width="80"/>
  24. <el-table-column prop="name" label="姓名" align="center" min-width=""/>
  25. <el-table-column prop="mobilephone" label="手机号码" align="center" min-width="110"/>
  26. <el-table-column prop="telephone" label="固话" align="center" min-width="110"/>
  27. <!-- <el-table-column prop="manager" label="转接经理" align="center" min-width="80"/> -->
  28. <el-table-column prop="provincename" label="所在省" align="center" min-width=""/>
  29. <el-table-column prop="cityname" label="所在市" align="center" min-width=""/>
  30. <el-table-column prop="address" label="具体地址" align="center" min-width=""/>
  31. <el-table-column label="创建人" align="center" min-width="110">
  32. <template slot-scope="scope">
  33. {{ scope.row.createuser + '-' + scope.row.createusername }}
  34. </template>
  35. </el-table-column>
  36. <el-table-column prop="createtime" label="创建时间" align="center" min-width="130"/>
  37. <el-table-column label="操作" width="240" align="center" class-name="oparate_btn" fixed="right">
  38. <template slot-scope="scope">
  39. <el-button v-show="scope.row.usercode !== null && scope.row.usercode !=='' " size="mini" plain type="primary" @click="btn_transfer(scope.row.id)">转移</el-button>
  40. <el-button size="mini" plain type="primary" @click="btn_edit(scope.row.id)">编辑</el-button>
  41. <el-button size="mini" plain type="danger" @click="btn_delete(scope.row.id)">删除</el-button>
  42. </template>
  43. </el-table-column>
  44. </el-table>
  45. <pagination
  46. v-show="pageParams.total > 0"
  47. :total="pageParams.total"
  48. :pageindex.sync="pageParams.pageindex"
  49. :pagesize.sync="pageParams.pagesize"
  50. class="pagination"
  51. @pagination="getList" />
  52. </div>
  53. </template>
  54. <script>
  55. import { getCusUserLists, deleteCusUser } from '@/api/customer/customerManage'
  56. import addOrEdit from './addOrEdit'
  57. import transfer from './transfer'
  58. import { pickerOptions } from '@/utils'
  59. import Pagination from '@/components/Pagination' // 对el-pagination 二次封装
  60. export default {
  61. name: 'CustomerManage',
  62. components: {
  63. Pagination
  64. },
  65. data() {
  66. return {
  67. loading: false,
  68. keyword: '',
  69. searchDate: '',
  70. pickerOptions,
  71. pageParams: {
  72. pageindex: 1, // 当前第几页
  73. pagesize: Number(this.$store.getters.serverConfig.PAGESIZE), // 每页几条数据
  74. total: 0// 总共多少数据
  75. },
  76. multipleSelection: [], // 选中的数据
  77. dataLists: []// 列表数据
  78. }
  79. },
  80. created() {
  81. this.getList()
  82. document.onkeyup = (e) => {
  83. if (e.keyCode === 13) {
  84. this.getList()
  85. }
  86. }
  87. },
  88. methods: {
  89. getList() {
  90. this.loading = true
  91. return new Promise(resolve => {
  92. const params = {
  93. pageindex: this.pageParams.pageindex, // 第几页
  94. pagesize: this.pageParams.pagesize, // 每页几条信息
  95. key: this.keyword, // 否 string 模糊查询(姓名,手机号码,固话)
  96. stime: this.searchDate && this.searchDate[0], // 开始时间
  97. etime: this.searchDate && this.searchDate[1]// 结束时间
  98. }
  99. getCusUserLists(params).then(response => {
  100. this.loading = false
  101. if (response.state.toLowerCase() === 'success') {
  102. this.pageParams.total = response.data.total
  103. this.dataLists = response.data.rows
  104. }
  105. })
  106. resolve()
  107. })
  108. },
  109. // 复选框状态改变
  110. changeSelects(val) {
  111. this.multipleSelection = val
  112. },
  113. btn_search() {
  114. this.pageParams.pageindex = 1
  115. this.getList()
  116. },
  117. btn_add() {
  118. this.$layer.iframe({
  119. content: {
  120. content: addOrEdit, // 传递的组件对象
  121. parent: this, // 当前的vue对象
  122. data: { 'rowid': '' }// props//该方法会自动添加一个key为layerid的值, 该值为创建层的id, 可以直接使用
  123. },
  124. area: ['60%', '90%'],
  125. title: '添加客户信息'
  126. })
  127. },
  128. btn_edit(editId) {
  129. this.$layer.iframe({
  130. content: {
  131. content: addOrEdit, // 传递的组件对象
  132. parent: this, // 当前的vue对象
  133. data: { 'rowid': editId }// props
  134. },
  135. area: ['60%', '90%'],
  136. title: '编辑客户信息'
  137. })
  138. },
  139. btn_delete(editId) {
  140. this.$confirm('您确定要将此客户信息删除吗?', '提示', {
  141. confirmButtonText: '确定',
  142. cancelButtonText: '取消',
  143. type: 'warning'
  144. }).then(() => {
  145. deleteCusUser(editId).then(response => {
  146. if (response.state.toLowerCase() === 'success') {
  147. this.getList()
  148. this.$message.success('删除成功!')
  149. }
  150. })
  151. }).catch(() => {
  152. this.$message.info('已取消删除')
  153. })
  154. },
  155. btn_transfer(editId) {
  156. this.$layer.iframe({
  157. content: {
  158. content: transfer, // 传递的组件对象
  159. parent: this, // 当前的vue对象
  160. data: { 'rowid': editId }// props
  161. },
  162. area: ['30%', '30%'],
  163. title: '编辑客户信息'
  164. })
  165. },
  166. btn_deletes() {
  167. const ids = []
  168. for (let i = 0, len = this.multipleSelection.length; i < len; i++) {
  169. ids.push(this.multipleSelection[i].id)
  170. }
  171. if (ids.length <= 0) {
  172. this.$message.warning('没有可删除的选项')
  173. return
  174. }
  175. this.btn_delete(ids)
  176. }
  177. }
  178. }
  179. </script>
  180. <style rel="stylesheet/scss" lang="scss">
  181. .customer .filter-item.el-input{
  182. width: 260px;
  183. }
  184. </style>