index.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <template>
  2. <div>
  3. <template v-if="AddSet">
  4. <div class="search">
  5. <Search :SearchForm="SetMealSearchForm" @query="initData" @reset="reset"></Search>
  6. </div>
  7. <div class="table">
  8. <a-table row-key="id" :data="tableData" :columns="columnsSetMeal" :pagination="pagination"
  9. :scroll="{ x: 'auto' }" @page-change="evChangePage">
  10. <template #status="{ record }">
  11. <a-tag :color="record.status == 1 ? '#7bc616' : '#86909c'">{{ record.status == 1 ? '上架' : '下架' }}</a-tag>
  12. </template>
  13. <template #Controls="{ record }">
  14. <a-space>
  15. <a-button type="text" @click="SetUpPackage(record)">查看套餐</a-button>
  16. </a-space>
  17. </template>
  18. <template #isRecharge="{ record }">
  19. {{ filterDict(SetMealList, record.isRecharge) }}
  20. </template>
  21. </a-table>
  22. </div>
  23. </template>
  24. <!-- 新增套餐计划 -->
  25. <AddSetMeal v-if="!AddSet" :id="pid" @break="AddSet=true"/>
  26. </div>
  27. </template>
  28. <script setup>
  29. import { ref, onMounted, toRefs } from 'vue';
  30. import Search from '@/components/Search/index.vue'
  31. import { SetMealSearchForm, columnsSetMeal } from './config.js'
  32. import { PackageSchedule } from '@/api/path/tariffManagement.api.js'
  33. import { Getdictionary, tableFunction, filterDict } from '@/mixins/index.js'
  34. import AddSetMeal from './addSetMeal.vue'
  35. const state = ref({
  36. pagination: {
  37. total: 0,
  38. pageSize: 10,
  39. current: 1,
  40. },
  41. AddSet: true,
  42. pid: null,
  43. SetMealList: [],
  44. })
  45. const { pagination,AddSet, pid,SetMealList } = toRefs(state.value)
  46. const { tableData, evChangePage, initData, reset } = tableFunction(pagination.value, PackageSchedule)
  47. const SetUpPackage = (item) => {
  48. pid.value = item.id
  49. AddSet.value = false
  50. }
  51. onMounted(async () => {
  52. SetMealList.value = await Getdictionary('setMeal')
  53. initData()
  54. })
  55. </script>
  56. <style lang="less" scoped>
  57. .search,
  58. .table {
  59. margin-top: 1rem;
  60. }
  61. .code {
  62. justify-content: center;
  63. display: flex;
  64. }
  65. </style>