mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-18 01:06:39 +08:00
feat(ui): 细节优化
This commit is contained in:
parent
a48cb7bc34
commit
d4d1fb26f6
@ -19,11 +19,13 @@ const requestParams = computed(() => ({
|
||||
const [tableConfig, getList] = useAsyncTable(props.request, requestParams);
|
||||
|
||||
const _columns = computed(() => {
|
||||
return props.columns.map((item) => ({
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
...item,
|
||||
}));
|
||||
return props.columns
|
||||
.filter((item) => !item.hideInTable)
|
||||
.map((item) => ({
|
||||
ellipsis: true,
|
||||
tooltip: true,
|
||||
...item,
|
||||
}));
|
||||
});
|
||||
|
||||
const handleSearch = async (tips?: boolean) => {
|
||||
@ -46,7 +48,7 @@ onActivated(handleSearch);
|
||||
<FormSection
|
||||
v-model="formData"
|
||||
:columns="columns"
|
||||
:submitting="(tableConfig.loading as boolean)"
|
||||
:submitting="tableConfig.loading as boolean"
|
||||
@request="handleSearch"
|
||||
>
|
||||
<template v-for="slot in Object.keys($slots)" #[slot]="config">
|
||||
@ -60,7 +62,7 @@ onActivated(handleSearch);
|
||||
...tableConfig,
|
||||
...props,
|
||||
scroll: useTableScroll(_columns, tableContainerRef as HTMLElement),
|
||||
columns: _columns
|
||||
columns: _columns,
|
||||
}"
|
||||
>
|
||||
<template v-for="slot in Object.keys($slots)" #[slot]="config">
|
||||
|
@ -12,7 +12,7 @@ function useSubmit<T extends Record<string, any> = Record<string, any>, R = any>
|
||||
const hasError = await formRef.value?.validate();
|
||||
if (!hasError) {
|
||||
const { data, message } = await api({ ...formData ?? {}, ...unref(params) });
|
||||
Message.success(message);
|
||||
message && Message.success(message);
|
||||
return Promise.resolve({ formData, data });
|
||||
}
|
||||
return Promise.reject(false);
|
||||
|
@ -19,6 +19,7 @@ const columns = [
|
||||
{
|
||||
title: "key",
|
||||
dataIndex: "value",
|
||||
slotName: "value",
|
||||
},
|
||||
{
|
||||
title: "用途",
|
||||
@ -100,6 +101,11 @@ const handleStatusChange = ({ filed, value, record, reload }) => {
|
||||
><template #icon> <icon-plus /> </template>新增
|
||||
</a-button>
|
||||
</template>
|
||||
<template #value="{ record, column }">
|
||||
<a-typography-text copyable ellipsis style="margin: 0">
|
||||
{{ record[column.dataIndex] }}
|
||||
</a-typography-text>
|
||||
</template>
|
||||
<template #status="{ record, reload }">
|
||||
<a-switch
|
||||
v-model="record.enabled"
|
||||
|
@ -1,6 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import { ref, h } from "vue";
|
||||
import { Message, Modal } from "@arco-design/web-vue";
|
||||
import { dateFormat } from "@gpt-vue/packages/utils";
|
||||
import SearchTable from "@/components/SearchTable/SearchTable.vue";
|
||||
import type { SearchTableColumns } from "@/components/SearchTable/type";
|
||||
import app from "@/main";
|
||||
@ -51,6 +52,7 @@ const columns: SearchTableColumns[] = [
|
||||
search: {
|
||||
valueType: "range",
|
||||
},
|
||||
render: ({ record }) => dateFormat(record.created_at),
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
|
@ -1,6 +1,7 @@
|
||||
<script lang="ts" setup>
|
||||
import SearchTable from "@/components/SearchTable/SearchTable.vue";
|
||||
import type { SearchTableColumns } from "@/components/SearchTable/type";
|
||||
import { dateFormat } from "@gpt-vue/packages/utils";
|
||||
import { getList } from "./api";
|
||||
|
||||
const columns: SearchTableColumns[] = [
|
||||
@ -10,6 +11,7 @@ const columns: SearchTableColumns[] = [
|
||||
search: {
|
||||
valueType: "input",
|
||||
},
|
||||
width: 280,
|
||||
},
|
||||
{
|
||||
dataIndex: "username",
|
||||
@ -30,6 +32,8 @@ const columns: SearchTableColumns[] = [
|
||||
{
|
||||
dataIndex: "created_at",
|
||||
title: "下单时间",
|
||||
render: ({ record }) => dateFormat(record.created_at),
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
dataIndex: "status",
|
||||
@ -52,6 +56,8 @@ const columns: SearchTableColumns[] = [
|
||||
search: {
|
||||
valueType: "range",
|
||||
},
|
||||
slotName: "pay_time",
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
dataIndex: "pay_way",
|
||||
@ -60,11 +66,17 @@ const columns: SearchTableColumns[] = [
|
||||
{
|
||||
title: "操作",
|
||||
slotName: "actions",
|
||||
fixed: "right",
|
||||
width: 80,
|
||||
},
|
||||
];
|
||||
</script>
|
||||
<template>
|
||||
<SearchTable :request="getList" :columns="columns">
|
||||
<template #pay_time="{ record }">
|
||||
<a-tag v-if="!record.pay_time" color="blue">未支付</a-tag>
|
||||
<span v-else>{{ dateFormat(record.pay_time) }}</span>
|
||||
</template>
|
||||
<template #actions="{ record }">
|
||||
<a-link :key="record.id" status="danger">删除</a-link>
|
||||
</template>
|
||||
|
@ -148,7 +148,7 @@ onMounted(async () => {
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button type="primary" :loading="submitting" @click="handleSave">提交</a-button>
|
||||
<a-button type="primary" :loading="submitting" @click="handleSave">保存</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
@ -141,7 +141,7 @@ onMounted(reload);
|
||||
/>
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button type="primary" :loading="submitting" @click="handleSave">提交</a-button>
|
||||
<a-button type="primary" :loading="submitting" @click="handleSave">保存</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-card>
|
||||
|
@ -61,7 +61,7 @@ onMounted(reload);
|
||||
<md-editor v-model="formData.content" @on-upload-img="onUploadImg" />
|
||||
</a-form-item>
|
||||
<a-form-item>
|
||||
<a-button type="primary" :loading="submitting" @click="handleSave">提交</a-button>
|
||||
<a-button type="primary" :loading="submitting" @click="handleSave">保存</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user