12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <script lang="ts" setup>
- /**
- * @Name: index.vue
- * @Description: 产品属性
- * @Author: Cheney
- */
- import { RefreshRight, Search } from '@element-plus/icons-vue';
- import DataTable from './component/DataTable.vue';
- import VerticalDivider from '/@/components/VerticalDivider/index.vue';
- import { useTableHeight } from '/@/utils/useTableHeight';
- const titleContainer: Ref<HTMLElement | null> = useTemplateRef('titleContainer');
- const queryContainer: Ref<HTMLElement | null> = useTemplateRef('queryContainer');
- const { tableHeight } = useTableHeight(titleContainer, queryContainer);
- const tableRef: Ref<any> = useTemplateRef('table');
- const btnLoading = ref(false);
- const formInline = reactive<any>({
- name: '',
- key: ''
- });
- provide('query-parameter', formInline);
- async function handleQuery() {
- btnLoading.value = true;
- await tableRef.value?.fetchList();
- btnLoading.value = false;
- }
- function resetParameter() {
- for (const key in formInline) {
- formInline[key] = '';
- }
- }
- </script>
- <template>
- <div class="p-5">
- <el-card class="h-full" style="color: rgba(0, 0, 0, 0.88);">
- <div ref="titleContainer" class="text-xl font-semibold pb-5">产品属性</div>
- <!-- 查询条件 -->
- <div ref="queryContainer" class="flex justify-between">
- <div class="flex flex-1">
- <div class="w-full whitespace-nowrap">
- <el-row :gutter="20" style="margin-bottom: 5px;">
- <el-col :span="5">
- <div class="flex items-center">
- <span class="mr-2">属性名称</span>
- <el-input v-model="formInline.name" clearable placeholder="请输入属性名称" />
- </div>
- </el-col>
- <el-col :span="5">
- <div class="flex items-center">
- <span class="mr-2">属性标识</span>
- <el-input v-model="formInline.key" clearable placeholder="请输入属性标识" />
- </div>
- </el-col>
- </el-row>
- </div>
- </div>
- <VerticalDivider />
- <div class="flex gap-1.5 ml-5">
- <el-button :icon="Search" :loading="btnLoading" type="primary" @click="handleQuery">
- 查 询
- </el-button>
- <el-button :icon="RefreshRight" color="#ECECF1C9" style="width: 88px; color: #3c3c3c;" @click="resetParameter">
- 重 置
- </el-button>
- </div>
- </div>
- <el-divider ref="dividerContainer" style="margin: 20px 0 12px 0;" />
- <div :style="{ height: tableHeight + 'px' }">
- <DataTable ref="table" />
- </div>
- </el-card>
- </div>
- </template>
- <style scoped>
- </style>
|