mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-13 06:02:49 +00:00
优化
This commit is contained in:
parent
67e94cda63
commit
8109e99653
@ -9,7 +9,7 @@
|
|||||||
"lint:eslint": "eslint \"{src}/**/*.{vue,ts,tsx}\" --fix"
|
"lint:eslint": "eslint \"{src}/**/*.{vue,ts,tsx}\" --fix"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cool-vue/crud": "^7.0.1-beta4",
|
"@cool-vue/crud": "^7.0.1-beta6",
|
||||||
"@element-plus/icons-vue": "^2.1.0",
|
"@element-plus/icons-vue": "^2.1.0",
|
||||||
"@vueuse/core": "^10.4.0",
|
"@vueuse/core": "^10.4.0",
|
||||||
"@wangeditor/editor": "^5.1.23",
|
"@wangeditor/editor": "^5.1.23",
|
||||||
|
|||||||
4
packages/crud/index.d.ts
vendored
4
packages/crud/index.d.ts
vendored
@ -56,8 +56,8 @@ declare type List<T> = Array<DeepPartial<T> | (() => DeepPartial<T>)>;
|
|||||||
|
|
||||||
// 字典选项
|
// 字典选项
|
||||||
declare type DictOptions = {
|
declare type DictOptions = {
|
||||||
label: string;
|
label?: string;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string;
|
color?: string;
|
||||||
type?: string;
|
type?: string;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cool-vue/crud",
|
"name": "@cool-vue/crud",
|
||||||
"version": "7.0.1-beta4",
|
"version": "7.0.1-beta6",
|
||||||
"private": false,
|
"private": false,
|
||||||
"main": "./dist/index.umd.min.js",
|
"main": "./dist/index.umd.min.js",
|
||||||
"typings": "types/index.d.ts",
|
"typings": "types/index.d.ts",
|
||||||
|
|||||||
@ -29,15 +29,14 @@ export function parseTableDict(value: any, item: ClTable.Column) {
|
|||||||
// 设置颜色
|
// 设置颜色
|
||||||
if (item.dictColor) {
|
if (item.dictColor) {
|
||||||
options.forEach((e, i) => {
|
options.forEach((e, i) => {
|
||||||
|
if (!e.color) {
|
||||||
e.color = style.colors[i];
|
e.color = style.colors[i];
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 格式化方法
|
// 绑定值
|
||||||
const formatter = item.dictFormatter;
|
const values = (isArray(value) ? value : [value]).filter((e) => e !== undefined);
|
||||||
|
|
||||||
// 多个值
|
|
||||||
const values = isArray(value) ? value : [value];
|
|
||||||
|
|
||||||
// 返回值
|
// 返回值
|
||||||
const list = values.map((v) => {
|
const list = values.map((v) => {
|
||||||
@ -48,8 +47,8 @@ export function parseTableDict(value: any, item: ClTable.Column) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 是否格式化
|
// 是否格式化
|
||||||
if (formatter) {
|
if (item.dictFormatter) {
|
||||||
return formatter(list);
|
return item.dictFormatter(list);
|
||||||
} else {
|
} else {
|
||||||
return list.map((e) => {
|
return list.map((e) => {
|
||||||
return h(
|
return h(
|
||||||
@ -66,14 +65,14 @@ export function parseTableDict(value: any, item: ClTable.Column) {
|
|||||||
/**
|
/**
|
||||||
* 解析 table.op.buttons
|
* 解析 table.op.buttons
|
||||||
*/
|
*/
|
||||||
export function parseTableOpButtons(buttons: any, { scope }: any) {
|
export function parseTableOpButtons(buttons: any[], { scope }: any) {
|
||||||
const { crud } = useCore();
|
const { crud } = useCore();
|
||||||
const { style } = useConfig();
|
const { style } = useConfig();
|
||||||
const slots = useSlots();
|
const slots = useSlots();
|
||||||
|
|
||||||
const list = getValue(buttons, { scope }) || ["edit", "delete"];
|
const list: any[] = getValue(buttons, { scope }) || ["edit", "delete"];
|
||||||
|
|
||||||
return list.map((vnode: any) => {
|
return list.map((vnode) => {
|
||||||
if (vnode === "info") {
|
if (vnode === "info") {
|
||||||
return (
|
return (
|
||||||
<el-button
|
<el-button
|
||||||
|
|||||||
@ -74,15 +74,15 @@ export declare function useForm(): {
|
|||||||
name?: string | undefined;
|
name?: string | undefined;
|
||||||
options?: {
|
options?: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[] | {
|
}[] | {
|
||||||
value: {
|
value: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[];
|
}[];
|
||||||
@ -105,15 +105,15 @@ export declare function useForm(): {
|
|||||||
name?: string | undefined;
|
name?: string | undefined;
|
||||||
options?: {
|
options?: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[] | {
|
}[] | {
|
||||||
value: {
|
value: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[];
|
}[];
|
||||||
@ -136,15 +136,15 @@ export declare function useForm(): {
|
|||||||
name?: string | undefined;
|
name?: string | undefined;
|
||||||
options?: {
|
options?: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[] | {
|
}[] | {
|
||||||
value: {
|
value: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[];
|
}[];
|
||||||
|
|||||||
@ -13,15 +13,15 @@ export declare function useTable(props: any): {
|
|||||||
name?: string | undefined;
|
name?: string | undefined;
|
||||||
options?: {
|
options?: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[] | {
|
}[] | {
|
||||||
value: {
|
value: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[];
|
}[];
|
||||||
@ -41,15 +41,15 @@ export declare function useTable(props: any): {
|
|||||||
};
|
};
|
||||||
dict: {
|
dict: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[] | {
|
}[] | {
|
||||||
value: {
|
value: {
|
||||||
[x: string]: any;
|
[x: string]: any;
|
||||||
label: string;
|
label?: string | undefined;
|
||||||
value: any;
|
value?: any;
|
||||||
color?: string | undefined;
|
color?: string | undefined;
|
||||||
type?: string | undefined;
|
type?: string | undefined;
|
||||||
}[];
|
}[];
|
||||||
|
|||||||
2
packages/crud/types/utils/parse.d.ts
vendored
2
packages/crud/types/utils/parse.d.ts
vendored
@ -12,7 +12,7 @@ export declare function parseTableDict(value: any, item: ClTable.Column): string
|
|||||||
/**
|
/**
|
||||||
* 解析 table.op.buttons
|
* 解析 table.op.buttons
|
||||||
*/
|
*/
|
||||||
export declare function parseTableOpButtons(buttons: any, { scope }: any): any;
|
export declare function parseTableOpButtons(buttons: any[], { scope }: any): any[];
|
||||||
/**
|
/**
|
||||||
* 解析扩展组件
|
* 解析扩展组件
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -9,13 +9,7 @@
|
|||||||
</cl-row>
|
</cl-row>
|
||||||
|
|
||||||
<cl-row>
|
<cl-row>
|
||||||
<cl-table
|
<cl-table ref="Table" />
|
||||||
ref="Table"
|
|
||||||
:default-sort="{
|
|
||||||
prop: 'createTime',
|
|
||||||
order: 'descending'
|
|
||||||
}"
|
|
||||||
/>
|
|
||||||
</cl-row>
|
</cl-row>
|
||||||
|
|
||||||
<cl-row>
|
<cl-row>
|
||||||
@ -154,7 +148,7 @@ const Table = useTable({
|
|||||||
{
|
{
|
||||||
prop: "createTime",
|
prop: "createTime",
|
||||||
label: "创建时间",
|
label: "创建时间",
|
||||||
sortable: "custom",
|
sortable: "desc",
|
||||||
minWidth: 160
|
minWidth: 160
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -282,10 +282,10 @@
|
|||||||
"@babel/helper-validator-identifier" "^7.22.20"
|
"@babel/helper-validator-identifier" "^7.22.20"
|
||||||
to-fast-properties "^2.0.0"
|
to-fast-properties "^2.0.0"
|
||||||
|
|
||||||
"@cool-vue/crud@^7.0.1-beta4":
|
"@cool-vue/crud@^7.0.1-beta6":
|
||||||
version "7.0.1-beta4"
|
version "7.0.1-beta6"
|
||||||
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-7.0.1-beta4.tgz#2bc541296edcb2af83aa5c7094795c996beff41f"
|
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-7.0.1-beta6.tgz#dc3b8d6c607fba4dc2b4b40f6906c8a70f58bb49"
|
||||||
integrity sha512-dD0lKPTSR5LGPJU9GHLyx/1fcGDq2Mnw6kj8rCLIqXlnDP78ufmE6iYVk2U23qgjxEDonHnij3/w6OmtRa1Vzg==
|
integrity sha512-DtUvZc4EQtfANvPMv9ydfNJxcmXsOaoUiWEf66vRSzDeOZ1K0a1u1Ha0y7R09C2HC2wla8GvKv0ySxM9aDLXNQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
array.prototype.flat "^1.2.4"
|
array.prototype.flat "^1.2.4"
|
||||||
core-js "^3.21.1"
|
core-js "^3.21.1"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user