index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <div class="customer-view">
  3. <div class="headline">
  4. <span>客户资料管理</span>
  5. <div class="search_time">
  6. <el-input style="width:400px" placeholder="请输入客户名称进行查询" v-model="key" @keyup.native.enter='searchSheet'>
  7. <el-button slot="append" @click.native="searchSheet">搜索</el-button>
  8. </el-input>
  9. <!--<el-input style="width:400px" placeholder="请输入客户名称进行查询" v-model="key" @keyup.native.enter='searchSheet'>-->
  10. <!--<el-button slot="append" @click.native="searchSheet">搜索</el-button>-->
  11. <!--</el-input>-->
  12. <a @click="updateItem()"><i class="border_radius">+</i>客户资料新增</a>
  13. </div>
  14. </div>
  15. <ctable
  16. :headArr="headArr"
  17. :StyleWidth="StyleWidth"
  18. :data="tableData"
  19. :totalElements="totalElements"
  20. @handleCurrentChange="handleCurrentChange"
  21. :currentPage="currentPage"
  22. :controlArray="controlArray"
  23. @updateItem="updateItem"
  24. @lookItem="lookItem"
  25. >
  26. </ctable>
  27. </div>
  28. </template>
  29. <script>
  30. import { clone, Vuehttp } from '@/utils/tools'
  31. import { Ctable } from '@/components/base/table'
  32. import { CtableClass } from '@/utils/CtableClass'
  33. export default {
  34. name: 'CustomerView',
  35. data() {
  36. return {
  37. key: '',
  38. currentPage: 1
  39. }
  40. },
  41. components: {
  42. Ctable
  43. },
  44. fetch({store}) {
  45. return Promise.all([
  46. store.dispatch('loadcustomerInfo', {count: 10, page: 1})
  47. ])
  48. },
  49. computed: {
  50. headArr() {
  51. return ['客户名称', '成交方式', '发票类型', '发票地址', '发票电话', '操作']
  52. },
  53. StyleWidth() {
  54. return [180, 120, 158, 358, 148, 200]
  55. },
  56. tableData() {
  57. return CtableClass(this.getHttpResource, ['companyName', 'transactionMode', 'billType', 'address', 'telephone', '操作'])
  58. },
  59. getHttpResource() {
  60. return this.$store.state.customer.list.data.content.content || []
  61. },
  62. totalElements() {
  63. return this.$store.state.customer.list.data.content.totalElements || 0
  64. },
  65. controlArray() {
  66. return [['编辑', 'updateItem'],['查看', 'lookItem']]
  67. }
  68. },
  69. methods: {
  70. // 分页调整数据
  71. handleCurrentChange (page) {
  72. this.currentPage = page
  73. this.$store.dispatch('loadcustomerInfo', {count: 10, page: this.currentPage, keyword: this.key})
  74. },
  75. updateItem(item) {
  76. if (item === undefined) {
  77. this.$store.commit('customer/REQUEST_DETAILS_ERROR')
  78. this.$router.push('/severPage/customer/-1')
  79. } else {
  80. item = this.getHttpResource[item]
  81. this.$router.push(`/severPage/customer/${item.id}?type=update`)
  82. }
  83. },
  84. lookItem(item) {
  85. item = this.getHttpResource[item]
  86. this.$router.push(`/severPage/customer/${item.id}?type=look`)
  87. },
  88. searchSheet() {
  89. this.handleCurrentChange(1)
  90. }
  91. },
  92. mounted() {
  93. // this.addItem()
  94. }
  95. }
  96. </script>
  97. <style type="text/scss" lang="scss">
  98. .el-input .el-input-group__append {
  99. width: 100px;
  100. color: #fff;
  101. background: #1890ff;
  102. text-align: center;
  103. }
  104. </style>