index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <script lang="ts" setup>
  2. /**
  3. * @Name: index.vue
  4. * @Description: 市场店铺
  5. * @Author: Cheney
  6. */
  7. import VerticalDivider from '/src/components/VerticalDivider/index.vue';
  8. import { RefreshRight, Search } from '@element-plus/icons-vue';
  9. import { useTableHeight } from '/@/utils/useTableHeight';
  10. import DataTable from './component/DataTable.vue';
  11. import { DictionaryStore } from '/@/stores/dictionary';
  12. import { useTemplateRef } from 'vue';
  13. import { useCountryInfoStore } from '/@/stores/countryInfo';
  14. const { data: staticData } = DictionaryStore();
  15. const countryInfoStore = useCountryInfoStore();
  16. const titleContainer: Ref<HTMLElement | null> = useTemplateRef('titleContainer');
  17. const queryContainer: Ref<HTMLElement | null> = useTemplateRef('queryContainer');
  18. const { tableHeight } = useTableHeight(titleContainer, queryContainer);
  19. const tableRef: Ref<any> = useTemplateRef('table');
  20. const btnLoading = ref(false);
  21. const formInline = reactive<any>({
  22. country: '',
  23. region: '',
  24. shop: ''
  25. });
  26. provide('query-parameter', formInline);
  27. async function handleQuery() {
  28. btnLoading.value = true;
  29. await tableRef.value?.fetchList();
  30. btnLoading.value = false;
  31. }
  32. function resetParameter() {
  33. for (const key in formInline) {
  34. formInline[key] = '';
  35. }
  36. }
  37. </script>
  38. <template>
  39. <div class="p-5 flex-grow">
  40. <el-card class="h-full" style="color: rgba(0, 0, 0, 0.88);">
  41. <div ref="titleContainer" class="text-xl font-semibold pb-5">市场店铺</div>
  42. <!-- 查询条件 -->
  43. <div ref="queryContainer" class="flex justify-between">
  44. <div class="flex flex-1">
  45. <div class="w-full whitespace-nowrap">
  46. <el-row :gutter="20" style="margin-bottom: 16px;">
  47. <el-col :span="6">
  48. <div class="flex items-center">
  49. <span class="mr-2">国 家</span>
  50. <el-select v-model="formInline.country" clearable placeholder="请选择国家">
  51. <el-option v-for="item in staticData.country_code" :key="item.value" :label="item.label"
  52. :value="item.value" />
  53. </el-select>
  54. </div>
  55. </el-col>
  56. <el-col :span="6">
  57. <div class="flex items-center">
  58. <span class="mr-2">站 点</span>
  59. <el-select v-model="formInline.region" clearable placeholder="请选择品牌">
  60. <el-option v-for="item in countryInfoStore.Region" :label="item.name" :value="item.code" />
  61. </el-select>
  62. </div>
  63. </el-col>
  64. <el-col :span="6">
  65. <div class="flex items-center">
  66. <span class="mr-2">店 铺</span>
  67. <el-input v-model="formInline.shop" clearable placeholder="请输入店铺名称" />
  68. </div>
  69. </el-col>
  70. </el-row>
  71. </div>
  72. </div>
  73. <VerticalDivider />
  74. <div class="flex flex-col gap-1.5 items-end">
  75. <el-button :icon="Search" :loading="btnLoading" class="mb-4" type="primary" @click="handleQuery">
  76. 查 询
  77. </el-button>
  78. <el-button :icon="RefreshRight" color="#ECECF1C9" style="width: 88px; color: #3c3c3c;"
  79. @click="resetParameter">
  80. 重 置
  81. </el-button>
  82. </div>
  83. </div>
  84. <el-divider ref="dividerContainer" style="margin: 20px 0 12px 0;" />
  85. <div :style="{ height: tableHeight + 'px' }">
  86. <DataTable ref="table" />
  87. </div>
  88. </el-card>
  89. </div>
  90. </template>
  91. <style scoped>
  92. </style>