index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <div class="app-container">
  3. <search-form
  4. :list-loading="listLoading"
  5. @change="searchHandle"
  6. />
  7. <table-list
  8. :list-loading="listLoading"
  9. :data="tableData2"
  10. :columns="listConfig"
  11. :current-page="currentPage"
  12. :page-size="pageSize"
  13. :total-records="totalRecords"
  14. @currentChange="pageHandle"
  15. @sizeChange="sizeChange"
  16. :operationsDefaultLength="6"
  17. :insertSlotArr="[7]"
  18. >
  19. <div slot="OI7">
  20. <el-table-column
  21. width="140"
  22. label="保护期止"
  23. align="center"
  24. >
  25. <template slot-scope="scope">
  26. <template v-if="scope.row.report_state === '1' && scope.row.report_step === '1'">
  27. <div v-if="+new Date() > +new Date(scope.row.lock_at)">
  28. <div style="color: #f00">{{scope.row.lock_at}}</div>
  29. <el-tag type="danger" size="mini">已过期</el-tag>
  30. </div>
  31. <div v-else-if="(+new Date(scope.row.lock_at) - +new Date()) < 86400000">
  32. <div style="color: #e6a23c">{{scope.row.lock_at}}</div>
  33. <el-tag type="warning" size="mini">1天内过期</el-tag>
  34. </div>
  35. <div v-else>
  36. <div>{{scope.row.lock_at}}</div>
  37. </div>
  38. </template>
  39. <template v-else>
  40. <div>{{scope.row.lock_at}}</div>
  41. </template>
  42. </template>
  43. </el-table-column>
  44. </div>
  45. </table-list>
  46. <!-- :isAdd="true"
  47. @add="openPopup" -->
  48. <popup-edit
  49. :isShow="isDtlShow"
  50. :curObj="curObj"
  51. @close="closePopup"
  52. />
  53. <index-record
  54. :isShow="isQShow"
  55. :curObj="curObj"
  56. @close="closeQPopup"
  57. />
  58. </div>
  59. </template>
  60. <script>
  61. import { arrToObj } from '@/utils'
  62. import SearchForm from './components/searchForm/Index'
  63. import IndexRecord from './components/popup/IndexRecord'
  64. import PopupEdit from './components/popup/IndexEdit'
  65. import baseTable from '_m/baseTable.js'
  66. export default {
  67. name: 'index',
  68. components: {
  69. SearchForm,
  70. PopupEdit,
  71. IndexRecord,
  72. },
  73. provide() {
  74. return {
  75. parentData: this
  76. }
  77. },
  78. mixins: [baseTable],
  79. data() {
  80. return {
  81. apiStr: 'cust.admreportlist',
  82. searchForm: null,
  83. isDtlShow: false,
  84. curObj: {},
  85. isQShow: false,
  86. isAShow: false,
  87. }
  88. },
  89. computed: {
  90. tableData2() {
  91. const arr = [...this.tableData]
  92. arr.map(item => {
  93. item.createBy = item.create_user ? item.create_user.nickname : '-'
  94. item.newRecord = `${item.record_estate_name ? item.record_estate_name : '-'}${item.record_protect_at && item.record_protect_at !== '1970-01-01' ? '(' + item.record_protect_at + ')' : ''}-${item.record_remark ? item.record_remark : ''}`
  95. })
  96. return arr
  97. }
  98. },
  99. created() {},
  100. mounted() {
  101. this.listConfig = {
  102. rows: [
  103. { label: '报备人', prop: 'createBy' },
  104. { label: '姓名', prop: 'name' },
  105. { label: '性别', prop: 'sex', type: 'tag', tags: arrToObj(this.$dictData.sex), tagTypeObj: {'male': 'primary', 'female': 'danger'} },
  106. { label: '电话', prop: 'phone' },
  107. { label: '客户状态', prop: 'report_state', type: 'tag', tags: arrToObj(this.$dictData.report_state ), tagTypeObj: {'1': 'success', '2': 'warning', '3': 'danger'}},
  108. { label: '报备进度', prop: 'report_step', type: 'tag', tags: arrToObj(this.$dictData.report_step ), tagTypeObj: {'1': 'info', '2': 'success', '3': 'success'} },
  109. { label: '报备楼盘', prop: 'estate_name'},
  110. { label: '报备时间', prop: 'report_at' },
  111. { label: '到访时间', prop: 'visit_at' },
  112. { label: '创建时间', prop: 'create_at' },
  113. { label: '备注', prop: 'remark', fullShow: true },
  114. { label: '操作', width: 90, type: 'handle2', operations:
  115. [
  116. { label: '报备详情', func: this.openQPopup, btnType: 'primary' },
  117. // { label: '修改状态', func: this.openPopup, btnType: 'warning' },
  118. // { label: '删除', func: this.delHandle, btnType: 'danger' },
  119. ]
  120. }
  121. ]
  122. }
  123. },
  124. methods: {
  125. openQPopup (row) {
  126. if (row && row.id) {
  127. this.curObj = row
  128. } else {
  129. this.curObj = {}
  130. }
  131. this.isQShow = true
  132. },
  133. closeQPopup (obj) {
  134. this.isQShow = false
  135. if (obj) {
  136. this.fetchData()
  137. }
  138. },
  139. delHandle(row) {
  140. this.$msg(`您确定要删除该客户吗?`, 'confirm', () => {
  141. this.$api.user.admcustomerdel({
  142. id: row.id
  143. }).then(data => {
  144. this.$msgs(`已删除!`)
  145. this.fetchData()
  146. })
  147. }, null, true)
  148. },
  149. openPopup(row) {
  150. if (row && row.id) {
  151. this.curObj = row
  152. } else {
  153. this.curObj = {}
  154. }
  155. this.isDtlShow = true
  156. },
  157. closePopup(obj) {
  158. this.isDtlShow = false
  159. if (obj) {
  160. this.fetchData()
  161. }
  162. }
  163. }
  164. }
  165. </script>