list.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. :isAdd="true"
  17. @add="openPopup"
  18. />
  19. <bigdata-edit
  20. :isShow="isDtlShow"
  21. :curObj="curObj"
  22. @close="closePopup"
  23. />
  24. </div>
  25. </template>
  26. <script>
  27. import { arrToObj } from '@/utils'
  28. import SearchForm from './components/searchForm/Bigdata'
  29. import BigdataEdit from './components/popup/BigdataEdit'
  30. import baseTable from '_m/baseTable.js'
  31. export default {
  32. name: 'list',
  33. components: {
  34. SearchForm,
  35. BigdataEdit
  36. },
  37. provide() {
  38. return {
  39. parentData: this
  40. }
  41. },
  42. mixins: [baseTable],
  43. data() {
  44. return {
  45. apiStr: 'facility.admbigdataquantitylist',
  46. searchForm: null,
  47. isDtlShow: false,
  48. curObj: {},
  49. noCreated: true,
  50. monthNum: 1,
  51. }
  52. },
  53. created() {
  54. this.searchForm = {
  55. big_data_type: 'xf',
  56. }
  57. this.fetchData()
  58. },
  59. computed: {
  60. tableData2() {
  61. const arr = [...this.tableData]
  62. arr.map(item => {
  63. // item.curRate = Number(item.month_integral / this.monthNum * 100).toFixed(2) + '%'
  64. })
  65. return arr
  66. }
  67. },
  68. mounted() {
  69. this.listConfig = {
  70. rows: [
  71. { label: '数据日期', prop: 'data_time' },
  72. { label: '数据类型', prop: 'big_data_type', type: 'flag', flags: arrToObj(this.$dictData.big_data_type ) },
  73. { label: '更新人', prop: 'update_by' },
  74. { label: '操作', width: 80, type: 'handle2', operations:
  75. [
  76. { label: '编辑', func: this.openPopup, btnType: 'primary' },
  77. ]
  78. }
  79. ]
  80. }
  81. const zone = this.$dictData.big_data_zone || []
  82. zone.forEach(item => {
  83. this.listConfig.rows.push({ label: item.key+'销售数量', prop: item.val+'_quantity' })
  84. this.listConfig.rows.push({ label: item.key+'销售面积', prop: item.val+'_area' })
  85. })
  86. },
  87. methods: {
  88. getMoreData (res) {
  89. this.monthNum = res.month_num || 1
  90. },
  91. delHandle(row) {
  92. this.$msg(`您确定要删除该规则吗?`, 'confirm', () => {
  93. this.$api.user.admsaleuserdel({
  94. id: row.id
  95. }).then(data => {
  96. this.$msgs(`已删除!`)
  97. this.fetchData()
  98. })
  99. }, null, true)
  100. },
  101. openPopup(row) {
  102. if (row && row.id) {
  103. this.curObj = row
  104. } else {
  105. this.curObj = {}
  106. }
  107. this.isDtlShow = true
  108. },
  109. closePopup(obj) {
  110. this.isDtlShow = false
  111. if (obj) {
  112. this.fetchData()
  113. }
  114. }
  115. }
  116. }
  117. </script>