index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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 { RefreshLeft, Search } from '@element-plus/icons-vue';
  9. import { useResponse } from '/@/utils/useResponse';
  10. import { useTemplateRef } from 'vue';
  11. import * as api from './api';
  12. import DataTable from '/@/views/price-approval/approval-review-supply/components/DataTable.vue';
  13. import { useTableHeight } from '/@/utils/useTableHeight';
  14. const titleContainer: Ref<HTMLElement | null> = useTemplateRef('titleContainer');
  15. const queryContainer: Ref<HTMLElement | null> = useTemplateRef('queryContainer');
  16. const { tableHeight } = useTableHeight(titleContainer, queryContainer);
  17. const tableRef: Ref<any> = useTemplateRef('table');
  18. const btnLoading = ref(false);
  19. const resetLoading = ref(false);
  20. const formInline = reactive<any>({
  21. sku: '',
  22. platform: '',
  23. country_code: '',
  24. sales_mode: '',
  25. });
  26. provide('query-parameter', formInline);
  27. const countryOptions = <any>ref([]);
  28. const platformOptions = <any>ref([]);
  29. onBeforeMount(() => {
  30. fetchOptions();
  31. });
  32. async function fetchOptions() {
  33. const resp = (await useResponse(api.getOptions)).data;
  34. platformOptions.value = resp.platform;
  35. countryOptions.value = resp.country_code;
  36. }
  37. async function handleQuery() {
  38. btnLoading.value = true;
  39. await tableRef.value?.fetchList(true);
  40. btnLoading.value = false;
  41. }
  42. async function resetParameter() {
  43. for (const key in formInline) {
  44. formInline[key] = '';
  45. }
  46. resetLoading.value = true;
  47. await tableRef.value?.fetchList(true);
  48. resetLoading.value = false;
  49. }
  50. </script>
  51. <template>
  52. <div class="p-5">
  53. <el-card class="h-full" style="color: rgba(0, 0, 0, 0.88);">
  54. <div ref="titleContainer" class="text-xl font-semibold pb-5">审批查看(供货)</div>
  55. <!-- 查询条件 -->
  56. <div ref="queryContainer" class="flex justify-between">
  57. <div class="flex flex-1">
  58. <div class="w-full whitespace-nowrap">
  59. <el-row :gutter="20" style="margin-bottom: 5px">
  60. <el-col :span="5">
  61. <div class="flex items-center">
  62. <span class="mr-2">SKU</span>
  63. <el-input v-model="formInline.sku" clearable placeholder="请输入SKU" />
  64. </div>
  65. </el-col>
  66. <el-col :span="5">
  67. <div class="flex items-center">
  68. <span class="mr-2">平 台</span>
  69. <el-select v-model="formInline.platform" placeholder="请选择平台">
  70. <el-option v-for="item in platformOptions" :key="item" :label="item" :value="item"> </el-option>
  71. </el-select>
  72. </div>
  73. </el-col>
  74. <el-col :span="5" class="flex">
  75. <div class="flex items-center">
  76. <span class="mr-2">国 家</span>
  77. <el-select v-model="formInline.country_code" clearable placeholder="请选择国家">
  78. <el-option v-for="item in countryOptions" :key="item" :label="item" :value="item"></el-option>
  79. </el-select>
  80. </div>
  81. </el-col>
  82. <el-col :span="5">
  83. <div class="flex items-center">
  84. <span class="mr-2">销售模式</span>
  85. <el-select v-model="formInline.sales_mode" clearable placeholder="请选择销售模式">
  86. <el-option label="线上" value="线上"></el-option>
  87. <el-option label="线下" value="线下"></el-option>
  88. </el-select>
  89. </div>
  90. </el-col>
  91. </el-row>
  92. </div>
  93. </div>
  94. <VerticalDivider />
  95. <div class="flex gap-1.5 ml-5">
  96. <el-button :icon="Search" :loading="btnLoading" type="primary" @click="handleQuery">
  97. 查 询
  98. </el-button>
  99. <el-button :icon="RefreshLeft" :loading="resetLoading" color="#ECECF1C9" style="width: 88px; color: #3c3c3c;"
  100. @click="resetParameter">
  101. 重 置
  102. </el-button>
  103. </div>
  104. </div>
  105. <el-divider ref="dividerContainer" style="margin: 20px 0 12px 0;" />
  106. <div :style="{ height: tableHeight + 'px' }">
  107. <DataTable ref="table" />
  108. </div>
  109. </el-card>
  110. </div>
  111. </template>
  112. <style scoped>
  113. </style>