index.vue 2.6 KB

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