This commit is contained in:
icssoa 2023-06-13 13:31:03 +08:00
parent fee911acf2
commit 96a7aa0939
21 changed files with 628 additions and 83 deletions

View File

@ -69,6 +69,13 @@ declare namespace Eps {
[key: string]: any;
}
interface DemoUserEntity {
/**
*
*/
[key: string]: any;
}
interface DictInfoEntity {
/**
*
@ -83,6 +90,27 @@ declare namespace Eps {
[key: string]: any;
}
interface FinanceDrawEntity {
/**
*
*/
[key: string]: any;
}
interface FinanceInvoiceInfoEntity {
/**
*
*/
[key: string]: any;
}
interface InfoCarEntity {
/**
*
*/
[key: string]: any;
}
interface IotDeviceEntity {
/**
*
@ -125,6 +153,27 @@ declare namespace Eps {
[key: string]: any;
}
interface UserAddressEntity {
/**
*
*/
[key: string]: any;
}
interface UserAuthEntity {
/**
*
*/
[key: string]: any;
}
interface UserCreditEntity {
/**
*
*/
[key: string]: any;
}
interface UserInfoEntity {
/**
*
@ -1118,6 +1167,63 @@ declare namespace Eps {
request: Service["request"];
}
interface DemoUser {
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<DemoUserEntity>;
/**
* list
*/
list(data?: any): Promise<DemoUserEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: DemoUserEntity[];
[key: string]: any;
}>;
/**
* add
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
delete: string;
update: string;
info: string;
list: string;
page: string;
add: string;
};
/**
*
*/
_permission: {
delete: boolean;
update: boolean;
info: boolean;
list: boolean;
page: boolean;
add: boolean;
};
/**
*
*/
request: Service["request"];
}
interface DictInfo {
/**
* delete
@ -1238,6 +1344,183 @@ declare namespace Eps {
request: Service["request"];
}
interface FinanceDraw {
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<FinanceDrawEntity>;
/**
* list
*/
list(data?: any): Promise<FinanceDrawEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: FinanceDrawEntity[];
[key: string]: any;
}>;
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* add
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
update: string;
info: string;
list: string;
page: string;
delete: string;
add: string;
};
/**
*
*/
_permission: {
update: boolean;
info: boolean;
list: boolean;
page: boolean;
delete: boolean;
add: boolean;
};
/**
*
*/
request: Service["request"];
}
interface FinanceInvoice {
/**
* orders
*/
orders(data?: any): Promise<any>;
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<FinanceInvoiceInfoEntity>;
/**
* list
*/
list(data?: any): Promise<FinanceInvoiceInfoEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: FinanceInvoiceInfoEntity[];
[key: string]: any;
}>;
/**
* add
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
orders: string;
delete: string;
update: string;
info: string;
list: string;
page: string;
add: string;
};
/**
*
*/
_permission: {
orders: boolean;
delete: boolean;
update: boolean;
info: boolean;
list: boolean;
page: boolean;
add: boolean;
};
/**
*
*/
request: Service["request"];
}
interface InfoCar {
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<InfoCarEntity>;
/**
* list
*/
list(data?: any): Promise<InfoCarEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: InfoCarEntity[];
[key: string]: any;
}>;
/**
* add
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
delete: string;
update: string;
info: string;
list: string;
page: string;
add: string;
};
/**
*
*/
_permission: {
delete: boolean;
update: boolean;
info: boolean;
list: boolean;
page: boolean;
add: boolean;
};
/**
*
*/
request: Service["request"];
}
interface IotDevice {
/**
* delete
@ -1685,6 +1968,177 @@ declare namespace Eps {
request: Service["request"];
}
interface UserAddress {
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<UserAddressEntity>;
/**
* list
*/
list(data?: any): Promise<UserAddressEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: UserAddressEntity[];
[key: string]: any;
}>;
/**
* add
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
delete: string;
update: string;
info: string;
list: string;
page: string;
add: string;
};
/**
*
*/
_permission: {
delete: boolean;
update: boolean;
info: boolean;
list: boolean;
page: boolean;
add: boolean;
};
/**
*
*/
request: Service["request"];
}
interface UserAuth {
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<UserAuthEntity>;
/**
* list
*/
list(data?: any): Promise<UserAuthEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: UserAuthEntity[];
[key: string]: any;
}>;
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* add
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
update: string;
info: string;
list: string;
page: string;
delete: string;
add: string;
};
/**
*
*/
_permission: {
update: boolean;
info: boolean;
list: boolean;
page: boolean;
delete: boolean;
add: boolean;
};
/**
*
*/
request: Service["request"];
}
interface UserCredit {
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<UserCreditEntity>;
/**
* list
*/
list(data?: any): Promise<UserCreditEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: UserCreditEntity[];
[key: string]: any;
}>;
/**
* add
*/
add(data?: any): Promise<any>;
/**
*
*/
permission: {
delete: string;
update: string;
info: string;
list: string;
page: string;
add: string;
};
/**
*
*/
_permission: {
delete: boolean;
update: boolean;
info: boolean;
list: boolean;
page: boolean;
add: boolean;
};
/**
*
*/
request: Service["request"];
}
interface UserInfo {
/**
* delete
@ -1766,12 +2220,14 @@ declare namespace Eps {
};
};
cloud: { db: CloudDb; func: { info: CloudFuncInfo; log: CloudFuncLog } };
demo: { goods: DemoGoods };
demo: { goods: DemoGoods; user: DemoUser };
dict: { info: DictInfo; type: DictType };
finance: { draw: FinanceDraw; invoice: FinanceInvoice };
info: { car: InfoCar };
iot: { device: IotDevice; message: IotMessage; mqtt: IotMqtt };
recycle: { data: RecycleData };
space: { info: SpaceInfo; type: SpaceType };
task: { info: TaskInfo };
user: { info: UserInfo };
user: { address: UserAddress; auth: UserAuth; credit: UserCredit; info: UserInfo };
};
}

View File

@ -1 +1 @@
[["/admin/base/comm","",[["/personUpdate","post"],["/uploadMode","get"],["/permmenu","get"],["/person","get"],["/upload","post"],["/logout","post"],["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/base/open","",[["/refreshToken","get"],["/captcha","get"],["/login","post"],["/html","get"],["/eps","get"],["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/base/sys/department","BaseSysDepartmentEntity",[["/delete","post"],["/update","post"],["/order","post"],["/list","post"],["/add","post"],["/page"],["/info"]]],["/admin/base/sys/log","BaseSysLogEntity",[["/setKeep","post"],["/getKeep","get"],["/clear","post"],["/page","post"],["/list"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/base/sys/menu","BaseSysMenuEntity",[["/create","post"],["/delete","post"],["/update","post"],["/parse","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/base/sys/param","BaseSysParamEntity",[["/delete","post"],["/update","post"],["/html","get"],["/info","get"],["/page","post"],["/add","post"],["/list"]]],["/admin/base/sys/role","BaseSysRoleEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/base/sys/user","BaseSysUserEntity",[["/delete","post"],["/update","post"],["/move","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/cloud/db","CloudDBEntity",[["/initEntity","post"],["/delete","post"],["/update","post"],["/data","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/cloud/func/info","CloudFuncInfoEntity",[["/invoke","post"],["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/cloud/func/log","CloudFuncLogEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/demo/goods","DemoGoodsEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/dict/info","DictInfoEntity",[["/delete","post"],["/update","post"],["/data","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/dict/type","DictTypeEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/iot/device","IotDeviceEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/iot/message","IotMessageEntity",[["/page","post"],["/list"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/iot/mqtt","",[["/publish","post"],["/config","get"],["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/recycle/data","RecycleDataEntity",[["/restore","post"],["/info","get"],["/page","post"],["/list"],["/update"],["/delete"],["/add"]]],["/admin/space/info","SpaceInfoEntity",[["/getConfig","get"],["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/space/type","SpaceTypeEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/task/info","TaskInfoEntity",[["/delete","post"],["/update","post"],["/start","post"],["/once","post"],["/stop","post"],["/info","get"],["/page","post"],["/log","get"],["/add","post"],["/list"]]],["/admin/user/info","UserInfoEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/chat/message","",[["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/chat/session","",[["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/test","",[["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]]]
[["/admin/base/comm","",[["/personUpdate","post"],["/uploadMode","get"],["/permmenu","get"],["/person","get"],["/upload","post"],["/logout","post"],["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/base/open","",[["/refreshToken","get"],["/captcha","get"],["/login","post"],["/html","get"],["/eps","get"],["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/base/sys/department","BaseSysDepartmentEntity",[["/delete","post"],["/update","post"],["/order","post"],["/list","post"],["/add","post"],["/page"],["/info"]]],["/admin/base/sys/log","BaseSysLogEntity",[["/setKeep","post"],["/getKeep","get"],["/clear","post"],["/page","post"],["/list"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/base/sys/menu","BaseSysMenuEntity",[["/create","post"],["/delete","post"],["/update","post"],["/parse","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/base/sys/param","BaseSysParamEntity",[["/delete","post"],["/update","post"],["/html","get"],["/info","get"],["/page","post"],["/add","post"],["/list"]]],["/admin/base/sys/role","BaseSysRoleEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/base/sys/user","BaseSysUserEntity",[["/delete","post"],["/update","post"],["/move","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/cloud/db","CloudDBEntity",[["/initEntity","post"],["/delete","post"],["/update","post"],["/data","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/cloud/func/info","CloudFuncInfoEntity",[["/invoke","post"],["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/cloud/func/log","CloudFuncLogEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/demo/goods","DemoGoodsEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/demo/user","DemoUserEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/dict/info","DictInfoEntity",[["/delete","post"],["/update","post"],["/data","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/dict/type","DictTypeEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/finance/draw","FinanceDrawEntity",[["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/delete"],["/add"]]],["/admin/finance/invoice","FinanceInvoiceInfoEntity",[["/orders","get"],["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/info/car","InfoCarEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/iot/device","IotDeviceEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/iot/message","IotMessageEntity",[["/page","post"],["/list"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/iot/mqtt","",[["/publish","post"],["/config","get"],["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/admin/recycle/data","RecycleDataEntity",[["/restore","post"],["/info","get"],["/page","post"],["/list"],["/update"],["/delete"],["/add"]]],["/admin/space/info","SpaceInfoEntity",[["/getConfig","get"],["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/space/type","SpaceTypeEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/task/info","TaskInfoEntity",[["/delete","post"],["/update","post"],["/start","post"],["/once","post"],["/stop","post"],["/info","get"],["/page","post"],["/log","get"],["/add","post"],["/list"]]],["/admin/user/address","UserAddressEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/user/auth","UserAuthEntity",[["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/delete"],["/add"]]],["/admin/user/credit","UserCreditEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/user/info","UserInfoEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/chat/message","",[["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/chat/session","",[["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]],["/test","",[["/list"],["/page"],["/info"],["/update"],["/delete"],["/add"]]]]

View File

@ -9,7 +9,7 @@
"lint:eslint": "eslint \"{src}/**/*.{vue,ts,tsx}\" --fix"
},
"dependencies": {
"@cool-vue/crud": "^6.2.2",
"@cool-vue/crud": "^6.3.1",
"@element-plus/icons-vue": "^2.0.10",
"@vueuse/core": "^9.1.0",
"@wangeditor/editor": "^5.1.23",

View File

@ -517,10 +517,11 @@ declare namespace ClForm {
hideLoading(): void;
setData(prop: string, value: any): void;
bindForm(data: obj): void;
setOptions(prop: string, list: Array<{ label: string; value?: any }>): void;
setProps(prop: string, value: any): void;
getForm(prop?: string): any;
setForm(prop: string, value: any): void;
setOptions(prop: string, list: { label: string; value?: any; [key: string]: any }[]): void;
setProps(prop: string, value: any): void;
setConfig(path: string, value: any): void;
showItem(props: string[] | string): void;
hideItem(props: string[] | string): void;
toggleItem(prop: string, flag?: boolean): void;

View File

@ -1,6 +1,6 @@
{
"name": "@cool-vue/crud",
"version": "6.2.2",
"version": "6.3.1",
"private": false,
"main": "./dist/index.umd.min.js",
"typings": "types/index.d.ts",

View File

@ -80,7 +80,7 @@ export default defineComponent({
<div
class={["cl-crud", { "is-border": props.border }]}
style={{ padding: props.padding }}>
{slots.default && slots.default()}
{slots.default?.()}
</div>
);
};

View File

@ -253,7 +253,7 @@ export default defineComponent({
class="cl-dialog__container"
style={{ height: props.height }}
key={cacheKey.value}>
{slots.default && slots.default()}
{slots.default?.()}
</div>
);
},

View File

@ -116,7 +116,7 @@ export default defineComponent({
);
},
default: () => {
slots.default && slots.default();
slots.default?.();
}
}
)}

View File

@ -15,7 +15,7 @@ export default defineComponent({
{props.label}
</span>
{slots.default && slots.default()}
{slots.default?.()}
</div>
);
};

View File

@ -11,6 +11,12 @@ export default defineComponent({
props: {
label: String,
// 展开状态
expand: {
type: Boolean,
default: true
},
// 是否能展开、收起
isExpand: {
type: Boolean,
default: true
@ -18,21 +24,23 @@ export default defineComponent({
},
setup(props, { slots }) {
const isExpand = ref(props.isExpand);
const visible = ref(props.expand);
async function toExpand() {
isExpand.value = !isExpand.value;
function toExpand() {
if (props.isExpand) {
visible.value = !visible.value;
}
}
return () => {
return (
<div class={["cl-form-card", { "is-expand": isExpand.value }]}>
<div class={["cl-form-card", { "is-expand": visible.value }]}>
<div class="cl-form-card__header" v-show={props.label} onClick={toExpand}>
<span>{props.label}</span>
<el-icon>
<arrow-down v-show={!isExpand.value} />
<arrow-up v-show={isExpand.value} />
<el-icon v-show={props.isExpand}>
<arrow-down v-show={!visible.value} />
<arrow-up v-show={visible.value} />
</el-icon>
</div>
<div class="cl-form-card__container">{slots.default?.()}</div>

View File

@ -8,37 +8,63 @@ declare type Form = Vue.Ref<any>;
// 操作
export function useAction({ config, form, Form }: { config: Config; form: obj; Form: Form }) {
// 设置数据
function set({ prop, options, hidden, path, props }: any, data?: any): any {
function set(
{
prop,
key,
path
}: { prop?: string; key?: "options" | "props" | "hidden" | "hidden-toggle"; path?: string },
data?: any
) {
let p: string = path || "";
if (prop) {
p = `items[prop:${prop}]`;
if (path) {
dataset(config, p, data);
} else {
let d: any;
if (prop) {
function deep(arr: ClForm.Item[]) {
arr.forEach((e) => {
if (e.prop == prop) {
d = e;
} else {
if (e.children) {
deep(e.children);
}
}
});
}
deep(config.items);
}
if (d) {
switch (key) {
case "options":
d.component.options = data;
break;
case "props":
Object.assign(d.component.props, data);
break;
case "hidden":
d.hidden = data;
break;
case "hidden-toggle":
d.hidden = data === undefined ? !d.hidden : !data;
break;
default:
Object.assign(d, data);
break;
}
} else {
console.error(`prop "${prop}" not found`);
}
}
if (options) {
p += `.component.options`;
}
if (props) {
p += `.component.props`;
}
if (hidden) {
p += ".hidden";
}
return dataset(config, p, data);
}
// 合并数据
function merge(options: any, value: any): any {
return set(
{
...options,
isMerge: true
},
value
);
}
// 获取表单值
@ -63,33 +89,30 @@ export function useAction({ config, form, Form }: { config: Config; form: obj; F
// 设置表单项的下拉数据列表
function setOptions(prop: string, value: any[]) {
set({ options: true, prop }, value);
set({ prop, key: "options" }, value);
}
// 设置表单项的组件参数
function setProps(prop: string, value: any) {
merge({ props: true, prop }, value);
set({ prop, key: "props" }, value);
}
// 切换表单项的显示、隐藏
function toggleItem(prop: string, value?: boolean) {
if (value === undefined) {
value = set({ prop, hidden: true });
}
set({ hidden: true, prop }, !value);
set({ prop, key: "hidden-toggle" }, value);
}
// 对部分表单项隐藏
function hideItem(...props: string[]) {
props.forEach((prop) => {
set({ hidden: true, prop }, true);
set({ prop, key: "hidden" }, true);
});
}
// 对部分表单项显示
function showItem(...props: string[]) {
props.forEach((prop) => {
set({ hidden: true, prop }, false);
set({ prop, key: "hidden" }, false);
});
}
@ -221,6 +244,7 @@ export function useApi({ Form }: { Form: Form }) {
"getForm",
"setForm",
"setData",
"setConfig",
"setOptions",
"setProps",
"toggleItem",

View File

@ -244,11 +244,22 @@ export default defineComponent({
// 合并配置
for (const i in config) {
switch (i) {
// 动态处理
// 表单项
case "items":
config.items = (options.items || []).map((e) => getValue(e));
function deep(arr: any[]): any[] {
return arr.map((e) => {
const d = getValue(e);
return {
...d,
children: d?.children ? deep(d.children) : undefined
};
});
}
config.items = deep(options.items || []);
break;
// 合并处理
// 事件、参数、操作
case "on":
case "op":
case "props":
@ -256,7 +267,7 @@ export default defineComponent({
case "_data":
deepMerge(config[i], options[i] || {});
break;
// 赋值
// 标题、宽度
case "title":
case "width":
default:

View File

@ -209,7 +209,8 @@ const Table = useTable({
{
label: "创建时间",
prop: "createTime",
sortable: "desc"
sortable: "desc",
width: 160
},
{
type: "op",

View File

@ -47,12 +47,15 @@ const Upsert = useUpsert({
}
}
},
{
label: "手机号",
prop: "phone",
component: {
name: "el-input"
}
() => {
return {
label: "手机号",
prop: "phone",
hidden: Upsert.value?.mode == "update",
component: {
name: "el-input"
}
};
}
]
},
@ -102,7 +105,7 @@ const Upsert = useUpsert({
}
],
plugins: [setFocus()],
plugins: [setFocus("account")],
onOpened() {
Upsert.value?.setOptions("work", [
@ -115,6 +118,10 @@ const Upsert = useUpsert({
value: 2
}
]);
// Upsert.value?.setProps("account", {
// disabled: Upsert.value?.mode == "update"
// });
},
onClose(action, done) {

View File

@ -12,13 +12,19 @@ export function setFocus(prop?: string): ClForm.Plugin {
const name = prop || exposed.config.items[0].prop;
if (name) {
exposed.config.items.find((e) => {
if (e.prop == name) {
if (e.component) {
e.component.ref = setRefs(name);
function deep(arr: ClForm.Item[]) {
arr.forEach((e) => {
if (e.prop == name && name) {
if (e.component) {
e.component.ref = setRefs(name);
}
} else {
deep(e.children || []);
}
}
});
});
}
deep(exposed.config.items);
onOpen(() => {
refs[name]?.focus();

View File

@ -297,7 +297,6 @@
&.no-label {
& > .el-form-item__label {
padding: 0;
width: 0 !important;
}
}
}
@ -455,7 +454,7 @@
display: grid;
grid-template-rows: 0fr;
.cl-form-item__children {
> .cl-form-item__children {
margin: 10px 10px 10px 0px;
min-height: 0;
overflow: hidden;
@ -463,12 +462,16 @@
}
&.is-expand {
.cl-form-card__container {
> .cl-form-card__container {
border: 1px solid var(--el-border-color);
border-radius: var(--el-border-radius-base);
grid-template-rows: 1fr;
}
}
.cl-form-card {
margin-left: 10px;
}
}
.cl-dialog {

View File

@ -0,0 +1,25 @@
declare const _default: import("vue").DefineComponent<{
label: StringConstructor;
expand: {
type: BooleanConstructor;
default: boolean;
};
isExpand: {
type: BooleanConstructor;
default: boolean;
};
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
label: StringConstructor;
expand: {
type: BooleanConstructor;
default: boolean;
};
isExpand: {
type: BooleanConstructor;
default: boolean;
};
}>>, {
expand: boolean;
isExpand: boolean;
}>;
export default _default;

View File

@ -4,6 +4,7 @@ interface Options {
scope?: any;
item?: any;
slots?: any;
children?: any[] & any;
custom?: (vnode: any) => any;
render?: "slot" | null;
[key: string]: any;

View File

@ -1,9 +1,11 @@
import { Merge, ModuleConfig } from "/@/cool";
import Crud from "@cool-vue/crud";
// 调试或者自定义crud
// import Crud from "../../../packages/crud/src";
import "@cool-vue/crud/dist/index.css";
// 调试、自定义crud
// import Crud from "../../../packages/crud/src";
// import "../../../packages/crud/src/static/index.scss";
export default (): Merge<ModuleConfig, CrudOptions> => {
return {
options: {

View File

@ -67,11 +67,11 @@ const Table = useTable({
}
}
},
{ label: "删除条数", prop: "count", minWidth: 120, sortable: "custom" },
{ label: "删除条数", prop: "count", minWidth: 100, sortable: "custom" },
{ label: "创建时间", prop: "createTime", minWidth: 160, sortable: "desc" },
{
type: "op",
minWidth: 150,
width: 120,
buttons: [
{
label: "恢复",

View File

@ -280,10 +280,10 @@
"@babel/helper-validator-identifier" "^7.19.1"
to-fast-properties "^2.0.0"
"@cool-vue/crud@^6.2.2":
version "6.2.2"
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.2.2.tgz#4e24bfb157307b5aef249476b4a41acd61217e30"
integrity sha512-0NBn8ZtbjJ85HkuVWueEmJ8+Uvc+yNezGO12f3AuHn0Ru1uVk5Dmy3EFDK5XhoWurOmTgk1lDaG3/G+CCgtCtw==
"@cool-vue/crud@^6.3.1":
version "6.3.1"
resolved "https://registry.yarnpkg.com/@cool-vue/crud/-/crud-6.3.1.tgz#871d9788d43576337af92ebae5b770dd16ee7826"
integrity sha512-mbAaumXavoVW4wtShZpQb0lKG9VHGfvrsUgnVt78zi7TVB32+9duasMjf2Y3gz6HM1p1FODMPhfkCOXGbpOHyA==
dependencies:
array.prototype.flat "^1.2.4"
core-js "^3.21.1"