index.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryForm" inline size="small">
  4. <el-form-item label="点位类型">
  5. <el-select v-model="queryForm.dataType" placeholder="请选择" clearable @change="onDataTypeChange">
  6. <el-option label="场馆" value="VENUE"/>
  7. <el-option label="景区" value="SCENERY"/>
  8. <el-option label="度假村" value="HOLIDAY_VILLAGE"/>
  9. <el-option label="酒店" value="HOTEL"/>
  10. <el-option label="民宿" value="HOME_STAY"/>
  11. <el-option label="旅行社" value="TOURIST"/>
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="点位分布">
  15. <select-base-bz-data v-model="queryForm.bzId" :multiple="false" :data-type="queryForm.dataType" :disabled="disabledSelectBz"/>
  16. </el-form-item>
  17. <el-form-item label="时间维度">
  18. <el-date-picker
  19. v-model="queryForm.serviceBeginTime"
  20. type="daterange"
  21. range-separator="至"
  22. start-placeholder="开始日期"
  23. end-placeholder="结束日期"
  24. value-format="yyyy-MM-dd"
  25. />
  26. </el-form-item>
  27. </el-form>
  28. <el-row class="action-bar-container" type="flex" justify="end">
  29. <el-button type="primary" size="small" @click.native="fetchData">查询</el-button>
  30. <el-button-group>
  31. <el-button v-permission="['bz.passenger.equipment.add']" size="small" @click.native="$refs.dialogForm.open({})">
  32. 新建
  33. </el-button>
  34. </el-button-group>
  35. </el-row>
  36. <el-card
  37. v-for="item in pageData.records"
  38. :key="item.id"
  39. :style="{ padding: '0px',float:'left',margin:'0 10px 10px 0' }"
  40. shadow="hover"
  41. >
  42. <img :src="item.litpic" class="image" style="width: 200px;height: 150px;" :alt="item.brief">
  43. <div style="font-size: 14px;text-overflow: ellipsis;overflow: hidden;white-space: nowrap;width:200px ">
  44. {{ item.brief }}
  45. </div>
  46. <div class="clearfix">
  47. <el-row :gutter="16">
  48. <el-col :span="12">
  49. <p>
  50. {{ item.inPeopleCount || 0 }}
  51. <span style="color: gray;font-size: 12px;display: block">流入数量</span>
  52. </p>
  53. </el-col>
  54. <el-col :span="12">
  55. <p>
  56. {{ item.outPeopleCount || 0 }}
  57. <span style="color: gray;font-size: 12px;display: block">流出数量</span>
  58. </p>
  59. </el-col>
  60. </el-row>
  61. </div>
  62. <div class="clearfix action-btns">
  63. <el-button v-permission="['bz.passenger.equipment.edit']" type="text" href="javascript:;" @click="$refs.dialogForm.open(item)">编辑</el-button>
  64. <el-button v-permission="['bz.passenger.equipment.delete']" type="text" href="javascript:;" @click="deleteByIds([item.id])">删除</el-button>
  65. <el-button type="text" href="javascript:;">详情</el-button>
  66. </div>
  67. </el-card>
  68. <div style="clear: both"/>
  69. <el-pagination
  70. class="pagination-container"
  71. background
  72. layout="prev, pager, next"
  73. :total="pageData.total"
  74. :page-size="pageData.pageSize"
  75. @current-change="paginationChange"
  76. />
  77. <dialog-form ref="dialogForm" @ok="fetchData"/>
  78. </div>
  79. </template>
  80. <style type="text/css">
  81. .action-btns {
  82. text-align: right;
  83. }
  84. </style>
  85. <script>
  86. import { deleteByIds, findPage } from '@/api/bz/equipment'
  87. import { dateTimeFormatter } from '@/utils/formater'
  88. import DialogForm from './DialogForm'
  89. import SelectBaseBzData from '@/components/SelectBaseBzData'
  90. export default {
  91. components: { DialogForm, SelectBaseBzData },
  92. data() {
  93. return {
  94. queryForm: {},
  95. isLoading: true,
  96. pageData: {
  97. records: []
  98. },
  99. currentPage: 1,
  100. multipleSelection: []
  101. }
  102. },
  103. computed: {
  104. disabledSelectBz: function() {
  105. return !this.queryForm || !this.queryForm.dataType || this.queryForm.dataType === ''
  106. }
  107. },
  108. created() {
  109. this.fetchData()
  110. },
  111. methods: {
  112. dateTimeFormatter,
  113. onDataTypeChange() {
  114. this.queryForm.bzId = ''
  115. },
  116. selectionChange(val) {
  117. const temp = []
  118. val.forEach(o => {
  119. temp.push(o.id)
  120. })
  121. this.multipleSelection = temp
  122. },
  123. deleteByIds(ids) {
  124. this.$confirm('确认要删除吗?', '提示', {
  125. confirmButtonText: '确定',
  126. cancelButtonText: '取消',
  127. type: 'warning'
  128. }).then(() => {
  129. deleteByIds(ids).then(() => {
  130. this.fetchData()
  131. })
  132. })
  133. },
  134. paginationChange(val) {
  135. this.currentPage = val
  136. this.fetchData()
  137. },
  138. fetchData() {
  139. this.isLoading = true
  140. findPage({ ...this.queryForm, current: this.currentPage })
  141. .then((response) => {
  142. this.pageData = response
  143. })
  144. .finally(() => (this.isLoading = false))
  145. }
  146. }
  147. }
  148. </script>