index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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. :isAdd="true"
  18. @add="openPopup"
  19. >
  20. </table-list>
  21. <popup-edit
  22. :isShow="isDtlShow"
  23. :curObj="curObj"
  24. @close="closePopup"
  25. />
  26. <index-record
  27. :isShow="isQShow"
  28. :curObj="curObj"
  29. @close="closeQPopup"
  30. />
  31. <index-record
  32. :isShow="isQShow"
  33. :curObj="curObj"
  34. @close="closeQPopup"
  35. />
  36. <state-edit
  37. :isShow="isStateShow"
  38. :curObj="curObj"
  39. @close="closeStatePopup"
  40. />
  41. </div>
  42. </template>
  43. <script>
  44. import { arrToObj } from '@/utils'
  45. import SearchForm from './components/searchForm/Index'
  46. import IndexRecord from './components/popup/IndexRecord'
  47. import PopupEdit from './components/popup/IndexEdit'
  48. import StateEdit from './components/popup/StateEdit'
  49. import baseTable from '_m/baseTable.js'
  50. export default {
  51. name: 'index',
  52. components: {
  53. SearchForm,
  54. PopupEdit,
  55. StateEdit,
  56. IndexRecord,
  57. },
  58. provide() {
  59. return {
  60. parentData: this
  61. }
  62. },
  63. mixins: [baseTable],
  64. data() {
  65. return {
  66. apiStr: 'cust.admtradelist',
  67. searchForm: null,
  68. isDtlShow: false,
  69. curObj: {},
  70. isQShow: false,
  71. isAShow: false,
  72. isStateShow: false,
  73. }
  74. },
  75. computed: {
  76. tableData2() {
  77. const arr = [...this.tableData]
  78. arr.map(item => {
  79. item.createBy = item.create_user ? item.create_user.nickname : '-'
  80. 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 : ''}`
  81. })
  82. return arr
  83. }
  84. },
  85. created() {},
  86. mounted() {
  87. this.listConfig = {
  88. rows: [
  89. { label: '状态', prop: 'trade_state', type: 'tag', tags: arrToObj(this.$dictData.trade_state), tagTypeObj: {'1': 'success', '2': 'danger'} },
  90. { label: '状态描述', prop: 'trade_state_des'},
  91. { label: '房屋类型', prop: 'house_type', fullShow: true, type: 'flag', flags: arrToObj(this.$dictData.trade_house_type) },
  92. { label: '成交店员', prop: 'deal_clerk' },
  93. { label: '成交楼盘', prop: 'deal_item' },
  94. { label: '房号', prop: 'house_no' },
  95. { label: '成交类型', prop: 'deal_type', fullShow: true, type: 'flag', flags: arrToObj(this.$dictData.trade_deal_type) },
  96. { label: '成交类型', prop: 'check_state', fullShow: true, type: 'flag', flags: arrToObj(this.$dictData.check_state) },
  97. { label: '成交日期', prop: 'deal_at' },
  98. { label: '客户姓名', prop: 'customer_name' },
  99. { label: '客户电话', prop: 'customer_phone' },
  100. { label: '报备渠道', prop: 'report_dept' },
  101. { label: '面积(㎡)', prop: 'area' },
  102. { label: '总价(元)', prop: 'price' },
  103. { label: '创建时间', prop: 'create_at' },
  104. { label: '操作', width: 230, type: 'handle2', operations:
  105. [
  106. { label: '维护', func: this.openStatePopup, btnType: 'info' },
  107. { label: '编辑', func: this.openPopup, btnType: 'success' },
  108. { label: '详情', func: this.openQPopup, btnType: 'primary' },
  109. { label: '删除', func: this.delHandle, btnType: 'danger' },
  110. ]
  111. }
  112. ]
  113. }
  114. },
  115. methods: {
  116. openQPopup (row) {
  117. if (row && row.id) {
  118. this.curObj = row
  119. } else {
  120. this.curObj = {}
  121. }
  122. this.isQShow = true
  123. },
  124. closeQPopup (obj) {
  125. this.isQShow = false
  126. if (obj) {
  127. this.fetchData()
  128. }
  129. },
  130. openStatePopup (row) {
  131. if (row && row.id) {
  132. this.curObj = row
  133. } else {
  134. this.curObj = {}
  135. }
  136. this.isStateShow = true
  137. },
  138. closeStatePopup (obj) {
  139. this.isStateShow = false
  140. if (obj) {
  141. this.fetchData()
  142. }
  143. },
  144. delHandle(row) {
  145. this.$msg(`您确定要删除该报备吗?`, 'confirm', () => {
  146. this.$api.cust.admtradedel({
  147. id: row.id
  148. }).then(data => {
  149. this.$msgs(`已删除!`)
  150. this.fetchData()
  151. })
  152. }, null, true)
  153. },
  154. openPopup(row) {
  155. if (row && row.id) {
  156. this.curObj = row
  157. } else {
  158. this.curObj = {}
  159. }
  160. this.isDtlShow = true
  161. },
  162. closePopup(obj) {
  163. this.isDtlShow = false
  164. if (obj) {
  165. this.fetchData()
  166. }
  167. }
  168. }
  169. }
  170. </script>