index.vue 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <script lang="ts" setup>
  2. /**
  3. * @Name: index.vue
  4. * @Description: 产品属性
  5. * @Author: Cheney
  6. */
  7. import { RefreshLeft, Search } from '@element-plus/icons-vue';
  8. import DataTable from './component/DataTable.vue';
  9. import VerticalDivider from '/@/components/VerticalDivider/index.vue';
  10. import { useTableHeight } from '/@/utils/useTableHeight';
  11. const titleContainer: Ref<HTMLElement | null> = useTemplateRef('titleContainer');
  12. const queryContainer: Ref<HTMLElement | null> = useTemplateRef('queryContainer');
  13. const { tableHeight } = useTableHeight(titleContainer, queryContainer);
  14. const tableRef: Ref<any> = useTemplateRef('table');
  15. const btnLoading = ref(false);
  16. const resetLoading = ref(false);
  17. const formInline = reactive<any>({
  18. name: '',
  19. key: ''
  20. });
  21. provide('query-parameter', formInline);
  22. async function handleQuery() {
  23. btnLoading.value = true;
  24. await tableRef.value?.fetchList(true);
  25. btnLoading.value = false;
  26. }
  27. async function resetParameter() {
  28. for (const key in formInline) {
  29. formInline[key] = '';
  30. }
  31. resetLoading.value = true;
  32. await tableRef.value?.fetchList(true);
  33. resetLoading.value = false;
  34. }
  35. </script>
  36. <template>
  37. <div class="p-5">
  38. <el-card class="h-full" style="color: rgba(0, 0, 0, 0.88);">
  39. <div ref="titleContainer" class="text-xl font-semibold pb-5">产品属性</div>
  40. <!-- 查询条件 -->
  41. <div ref="queryContainer" class="flex justify-between">
  42. <div class="flex flex-1">
  43. <div class="w-full whitespace-nowrap">
  44. <el-row :gutter="20" style="margin-bottom: 5px;">
  45. <el-col :span="5">
  46. <div class="flex items-center">
  47. <span class="mr-2">属性名称</span>
  48. <el-input v-model="formInline.name" clearable placeholder="请输入属性名称" />
  49. </div>
  50. </el-col>
  51. <el-col :span="5">
  52. <div class="flex items-center">
  53. <span class="mr-2">属性标识</span>
  54. <el-input v-model="formInline.key" clearable placeholder="请输入属性标识" />
  55. </div>
  56. </el-col>
  57. </el-row>
  58. </div>
  59. </div>
  60. <VerticalDivider />
  61. <div class="flex gap-1.5 ml-5">
  62. <el-button :icon="Search" :loading="btnLoading" type="primary" @click="handleQuery">
  63. 查 询
  64. </el-button>
  65. <el-button :icon="RefreshLeft" :loading="resetLoading" color="#ECECF1C9" style="width: 88px; color: #3c3c3c;" @click="resetParameter">
  66. 重 置
  67. </el-button>
  68. </div>
  69. </div>
  70. <el-divider ref="dividerContainer" style="margin: 20px 0 12px 0;" />
  71. <div :style="{ height: tableHeight + 'px' }">
  72. <DataTable ref="table" />
  73. </div>
  74. </el-card>
  75. </div>
  76. </template>
  77. <style scoped>
  78. </style>