feat: 优化搜索按钮
parent
c9d63cde28
commit
907db1d3c9
|
|
@ -58,7 +58,7 @@ export const nodeMap = {
|
||||||
nodeProps: {
|
nodeProps: {
|
||||||
placeholder: "请输入",
|
placeholder: "请输入",
|
||||||
allowClear: true,
|
allowClear: true,
|
||||||
} as InstanceType<typeof InputSearch>["$props"],
|
} as InstanceType<typeof Input>["$props"] & InstanceType<typeof InputSearch>["$props"],
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 文本域
|
* 文本域
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
import { Doption, Link, TableColumnData, TableData } from "@arco-design/web-vue";
|
import { Doption, Link, TableColumnData, TableData } from "@arco-design/web-vue";
|
||||||
|
import { RenderFunction } from "vue";
|
||||||
import { FormModalProps, FormProps } from "../form";
|
import { FormModalProps, FormProps } from "../form";
|
||||||
import { IFormItem } from "../form/form-item";
|
import { IFormItem } from "../form/form-item";
|
||||||
import { TableProps } from "./table";
|
import { TableProps } from "./table";
|
||||||
import { RenderFunction } from "vue";
|
|
||||||
|
|
||||||
interface UseColumnRenderOptions {
|
interface UseColumnRenderOptions {
|
||||||
/**
|
/**
|
||||||
|
|
@ -102,12 +102,20 @@ type ExtendedFormItem = Partial<IFormItem> & {
|
||||||
extend?: string;
|
extend?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type SearchFormItem = ExtendedFormItem & {
|
||||||
|
enableLoad?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
type Search = Partial<
|
type Search = Partial<
|
||||||
Omit<FormProps, "items"> & {
|
Omit<FormProps, "items"> & {
|
||||||
/**
|
/**
|
||||||
* 表单项
|
* 表单项
|
||||||
*/
|
*/
|
||||||
items?: ExtendedFormItem[];
|
items?: SearchFormItem[];
|
||||||
|
/**
|
||||||
|
* bu
|
||||||
|
*/
|
||||||
|
button?: boolean
|
||||||
}
|
}
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
|
@ -147,4 +155,8 @@ export interface UseTableOptions extends Omit<TableProps, "search" | "create" |
|
||||||
* 详情弹窗配置
|
* 详情弹窗配置
|
||||||
*/
|
*/
|
||||||
detail?: any;
|
detail?: any;
|
||||||
|
/**
|
||||||
|
* 批量删除配置
|
||||||
|
*/
|
||||||
|
delete?: any;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -171,9 +171,22 @@ export const useTable = (optionsOrFn: UseTableOptions | (() => UseTableOptions))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
searchItems.push(merge({}, item));
|
const search = !item.enableLoad ? undefined : () => getTable().reloadData()
|
||||||
|
searchItems.push(
|
||||||
|
merge(
|
||||||
|
{
|
||||||
|
nodeProps: {
|
||||||
|
onSearch: search,
|
||||||
|
onPressEnter: search
|
||||||
|
},
|
||||||
|
},
|
||||||
|
item
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (options.search.button !== false) {
|
||||||
|
searchItems.push(config.searchItemSubmit);
|
||||||
}
|
}
|
||||||
searchItems.push(config.searchItemSubmit);
|
|
||||||
options.search.items = searchItems;
|
options.search.items = searchItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<BreadPage>
|
<BreadPage>
|
||||||
<Table v-bind="table">
|
<Table v-bind="table"> </Table>
|
||||||
|
|
||||||
</Table>
|
|
||||||
</BreadPage>
|
</BreadPage>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -45,8 +43,8 @@ const table = useTable({
|
||||||
width: 120,
|
width: 120,
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
type: 'modify',
|
type: "modify",
|
||||||
text: '修改'
|
text: "修改",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "delete",
|
type: "delete",
|
||||||
|
|
@ -59,15 +57,17 @@ const table = useTable({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
search: {
|
search: {
|
||||||
|
button: false,
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
field: "nickname",
|
field: "nickname",
|
||||||
label: "登陆账号",
|
label: "登陆账号",
|
||||||
type: "input",
|
type: "search",
|
||||||
required: false,
|
required: false,
|
||||||
|
enableLoad: true,
|
||||||
nodeProps: {
|
nodeProps: {
|
||||||
placeholder: "名称关键字",
|
placeholder: "分类名称",
|
||||||
},
|
} as any,
|
||||||
itemProps: {
|
itemProps: {
|
||||||
hideLabel: true,
|
hideLabel: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
|
|
||||||
export const useModal = (modal: any) => {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -21,7 +21,8 @@
|
||||||
</div>
|
</div>
|
||||||
<li
|
<li
|
||||||
v-for="i in 10"
|
v-for="i in 10"
|
||||||
class="group flex items-center justify-between gap-2 h-8 rounded mb-1 pl-2 hover:bg-gray-100 cursor-pointer">
|
class="group flex items-center justify-between gap-2 h-8 rounded mb-2 pl-3 hover:bg-gray-100 cursor-pointer"
|
||||||
|
>
|
||||||
<div>
|
<div>
|
||||||
<i class="icon-file-folder text-gray-600"></i>
|
<i class="icon-file-folder text-gray-600"></i>
|
||||||
日常素材
|
日常素材
|
||||||
|
|
@ -57,6 +58,23 @@
|
||||||
import { api } from "@/api";
|
import { api } from "@/api";
|
||||||
import { Table, useTable } from "@/components";
|
import { Table, useTable } from "@/components";
|
||||||
import { dayjs } from "@/libs/dayjs";
|
import { dayjs } from "@/libs/dayjs";
|
||||||
|
import numeral from 'numeral';
|
||||||
|
|
||||||
|
const getIcon = (mimetype: string) => {
|
||||||
|
if (mimetype.startsWith("image")) {
|
||||||
|
return "icon-file-iimage";
|
||||||
|
}
|
||||||
|
if (mimetype.startsWith("video")) {
|
||||||
|
return "icon-file-ivideo";
|
||||||
|
}
|
||||||
|
if (mimetype.startsWith("text")) {
|
||||||
|
return "icon-file-itxt";
|
||||||
|
}
|
||||||
|
if (mimetype.startsWith("audio")) {
|
||||||
|
return "icon-file-iaudio";
|
||||||
|
}
|
||||||
|
return "icon-file-iunknown";
|
||||||
|
};
|
||||||
|
|
||||||
const table = useTable({
|
const table = useTable({
|
||||||
data: async (model, paging) => {
|
data: async (model, paging) => {
|
||||||
|
|
@ -66,14 +84,23 @@ const table = useTable({
|
||||||
{
|
{
|
||||||
title: "文件名称",
|
title: "文件名称",
|
||||||
dataIndex: "name",
|
dataIndex: "name",
|
||||||
width: 260,
|
render: ({ record }) => {
|
||||||
|
return (
|
||||||
|
<div class="flex items-center">
|
||||||
|
<i class={`${getIcon(record.mimetype)} text-xl mr-2`}></i>
|
||||||
|
{record.name}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "操作描述",
|
title: "大小",
|
||||||
dataIndex: "description",
|
dataIndex: "description",
|
||||||
|
width: 120,
|
||||||
|
render: ({ record }) => numeral(record.size).format('0 b')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "登陆时间",
|
title: "上传时间",
|
||||||
dataIndex: "createdAt",
|
dataIndex: "createdAt",
|
||||||
width: 200,
|
width: 200,
|
||||||
render: ({ record }) => dayjs(record.createdAt).format(),
|
render: ({ record }) => dayjs(record.createdAt).format(),
|
||||||
|
|
@ -85,6 +112,7 @@ const table = useTable({
|
||||||
buttons: [
|
buttons: [
|
||||||
{
|
{
|
||||||
type: "modify",
|
type: "modify",
|
||||||
|
text: '修改'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: "delete",
|
type: "delete",
|
||||||
|
|
@ -97,11 +125,19 @@ const table = useTable({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
search: {
|
search: {
|
||||||
|
button: false,
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
field: "name",
|
field: "name",
|
||||||
label: "文件名称",
|
label: "文件名称",
|
||||||
type: "input",
|
type: "search",
|
||||||
|
enableLoad: true,
|
||||||
|
itemProps: {
|
||||||
|
hideLabel: true,
|
||||||
|
},
|
||||||
|
nodeProps: {
|
||||||
|
placeholder: '素材名称...'
|
||||||
|
} as any
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
@arcoblue-6: #08f;
|
@arcoblue-6: #08f;
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
--border-radius-small: 4px;
|
||||||
li.arco-dropdown-option {
|
li.arco-dropdown-option {
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
width: calc(100% - 8px);
|
width: calc(100% - 8px);
|
||||||
|
|
|
||||||
|
|
@ -7,34 +7,58 @@ export {}
|
||||||
|
|
||||||
declare module '@vue/runtime-core' {
|
declare module '@vue/runtime-core' {
|
||||||
export interface GlobalComponents {
|
export interface GlobalComponents {
|
||||||
|
AAlert: typeof import('@arco-design/web-vue')['Alert']
|
||||||
AAutoComplete: typeof import('@arco-design/web-vue')['AutoComplete']
|
AAutoComplete: typeof import('@arco-design/web-vue')['AutoComplete']
|
||||||
|
AAvatar: typeof import('@arco-design/web-vue')['Avatar']
|
||||||
|
ABreadcrumb: typeof import('@arco-design/web-vue')['Breadcrumb']
|
||||||
|
ABreadcrumbItem: typeof import('@arco-design/web-vue')['BreadcrumbItem']
|
||||||
AButton: typeof import('@arco-design/web-vue')['Button']
|
AButton: typeof import('@arco-design/web-vue')['Button']
|
||||||
|
ACard: typeof import('@arco-design/web-vue')['Card']
|
||||||
ACheckbox: typeof import('@arco-design/web-vue')['Checkbox']
|
ACheckbox: typeof import('@arco-design/web-vue')['Checkbox']
|
||||||
|
ACheckboxGroup: typeof import('@arco-design/web-vue')['CheckboxGroup']
|
||||||
AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider']
|
AConfigProvider: typeof import('@arco-design/web-vue')['ConfigProvider']
|
||||||
|
ADatePicker: typeof import('@arco-design/web-vue')['DatePicker']
|
||||||
ADivider: typeof import('@arco-design/web-vue')['Divider']
|
ADivider: typeof import('@arco-design/web-vue')['Divider']
|
||||||
ADoption: typeof import('@arco-design/web-vue')['Doption']
|
ADoption: typeof import('@arco-design/web-vue')['Doption']
|
||||||
|
ADrawer: typeof import('@arco-design/web-vue')['Drawer']
|
||||||
|
ADropdown: typeof import('@arco-design/web-vue')['Dropdown']
|
||||||
ADropdownButton: typeof import('@arco-design/web-vue')['DropdownButton']
|
ADropdownButton: typeof import('@arco-design/web-vue')['DropdownButton']
|
||||||
AEmpty: typeof import('@arco-design/web-vue')['Empty']
|
AEmpty: typeof import('@arco-design/web-vue')['Empty']
|
||||||
AForm: typeof import('@arco-design/web-vue')['Form']
|
AForm: typeof import('@arco-design/web-vue')['Form']
|
||||||
AFormItem: typeof import('@arco-design/web-vue')['FormItem']
|
AFormItem: typeof import('@arco-design/web-vue')['FormItem']
|
||||||
|
AImage: typeof import('@arco-design/web-vue')['Image']
|
||||||
AInput: typeof import('@arco-design/web-vue')['Input']
|
AInput: typeof import('@arco-design/web-vue')['Input']
|
||||||
AInputNumber: typeof import('@arco-design/web-vue')['InputNumber']
|
AInputNumber: typeof import('@arco-design/web-vue')['InputNumber']
|
||||||
AInputPassword: typeof import('@arco-design/web-vue')['InputPassword']
|
AInputPassword: typeof import('@arco-design/web-vue')['InputPassword']
|
||||||
AInputSearch: typeof import('@arco-design/web-vue')['InputSearch']
|
AInputSearch: typeof import('@arco-design/web-vue')['InputSearch']
|
||||||
|
ALayout: typeof import('@arco-design/web-vue')['Layout']
|
||||||
|
ALayoutContent: typeof import('@arco-design/web-vue')['LayoutContent']
|
||||||
|
ALayoutHeader: typeof import('@arco-design/web-vue')['LayoutHeader']
|
||||||
|
ALayoutSider: typeof import('@arco-design/web-vue')['LayoutSider']
|
||||||
ALink: typeof import('@arco-design/web-vue')['Link']
|
ALink: typeof import('@arco-design/web-vue')['Link']
|
||||||
|
AList: typeof import('@arco-design/web-vue')['List']
|
||||||
|
AListItem: typeof import('@arco-design/web-vue')['ListItem']
|
||||||
|
AListItemMeta: typeof import('@arco-design/web-vue')['ListItemMeta']
|
||||||
AMenu: typeof import('@arco-design/web-vue')['Menu']
|
AMenu: typeof import('@arco-design/web-vue')['Menu']
|
||||||
AMenuItem: typeof import('@arco-design/web-vue')['MenuItem']
|
AMenuItem: typeof import('@arco-design/web-vue')['MenuItem']
|
||||||
|
AMenuItemGroup: typeof import('@arco-design/web-vue')['MenuItemGroup']
|
||||||
AModal: typeof import('@arco-design/web-vue')['Modal']
|
AModal: typeof import('@arco-design/web-vue')['Modal']
|
||||||
APagination: typeof import('@arco-design/web-vue')['Pagination']
|
APagination: typeof import('@arco-design/web-vue')['Pagination']
|
||||||
APopover: typeof import('@arco-design/web-vue')['Popover']
|
APopover: typeof import('@arco-design/web-vue')['Popover']
|
||||||
ARadio: typeof import('@arco-design/web-vue')['Radio']
|
ARadio: typeof import('@arco-design/web-vue')['Radio']
|
||||||
ARadioGroup: typeof import('@arco-design/web-vue')['RadioGroup']
|
ARadioGroup: typeof import('@arco-design/web-vue')['RadioGroup']
|
||||||
|
AScrollbar: typeof import('@arco-design/web-vue')['Scrollbar']
|
||||||
ASelect: typeof import('@arco-design/web-vue')['Select']
|
ASelect: typeof import('@arco-design/web-vue')['Select']
|
||||||
ASpace: typeof import('@arco-design/web-vue')['Space']
|
ASpace: typeof import('@arco-design/web-vue')['Space']
|
||||||
ASpin: typeof import('@arco-design/web-vue')['Spin']
|
ASpin: typeof import('@arco-design/web-vue')['Spin']
|
||||||
|
ASwitch: typeof import('@arco-design/web-vue')['Switch']
|
||||||
|
ATabPane: typeof import('@arco-design/web-vue')['TabPane']
|
||||||
|
ATabs: typeof import('@arco-design/web-vue')['Tabs']
|
||||||
ATag: typeof import('@arco-design/web-vue')['Tag']
|
ATag: typeof import('@arco-design/web-vue')['Tag']
|
||||||
ATextarea: typeof import('@arco-design/web-vue')['Textarea']
|
ATextarea: typeof import('@arco-design/web-vue')['Textarea']
|
||||||
ATooltip: typeof import('@arco-design/web-vue')['Tooltip']
|
ATooltip: typeof import('@arco-design/web-vue')['Tooltip']
|
||||||
|
ATree: typeof import('@arco-design/web-vue')['Tree']
|
||||||
|
AUpload: typeof import('@arco-design/web-vue')['Upload']
|
||||||
BaseOption: typeof import('./../components/editor/components/BaseOption.vue')['default']
|
BaseOption: typeof import('./../components/editor/components/BaseOption.vue')['default']
|
||||||
Block: typeof import('./../components/editor/panel-main/components/block.vue')['default']
|
Block: typeof import('./../components/editor/panel-main/components/block.vue')['default']
|
||||||
BreadCrumb: typeof import('./../components/breadcrumb/bread-crumb.vue')['default']
|
BreadCrumb: typeof import('./../components/breadcrumb/bread-crumb.vue')['default']
|
||||||
|
|
|
||||||
|
|
@ -6,3 +6,8 @@ declare module "*.vue" {
|
||||||
const component: DefineComponent<{}, {}, any>;
|
const component: DefineComponent<{}, {}, any>;
|
||||||
export default component;
|
export default component;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module 'numeral' {
|
||||||
|
const numeral: any
|
||||||
|
export default numeral;
|
||||||
|
}
|
||||||
|
|
@ -7,7 +7,7 @@ const delOptions = {
|
||||||
title: "提示",
|
title: "提示",
|
||||||
titleAlign: "start",
|
titleAlign: "start",
|
||||||
width: 432,
|
width: 432,
|
||||||
content: "确定删除该数据吗?注意:该操作不可恢复!",
|
content: "危险操作!确定删除该数据吗?",
|
||||||
maskClosable: false,
|
maskClosable: false,
|
||||||
closable: false,
|
closable: false,
|
||||||
okText: "确定",
|
okText: "确定",
|
||||||
|
|
@ -27,3 +27,4 @@ const delConfirm = (config: DelOptions = {}) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export { delConfirm };
|
export { delConfirm };
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue