This commit is contained in:
icssoa 2023-05-27 15:50:42 +08:00
commit 6f7b8dc213
7 changed files with 155 additions and 209 deletions

View File

@ -1,25 +1,4 @@
declare namespace Eps { declare namespace Eps {
interface AiLimitEntity {
/**
*
*/
[key: string]: any;
}
interface AiOrderEntity {
/**
*
*/
[key: string]: any;
}
interface AiVipEntity {
/**
*
*/
[key: string]: any;
}
interface BaseSysDepartmentEntity { interface BaseSysDepartmentEntity {
/** /**
* *
@ -90,6 +69,13 @@ declare namespace Eps {
[key: string]: any; [key: string]: any;
} }
interface DemoUserEntity {
/**
*
*/
[key: string]: any;
}
interface DictInfoEntity { interface DictInfoEntity {
/** /**
* *
@ -146,6 +132,13 @@ declare namespace Eps {
[key: string]: any; [key: string]: any;
} }
interface UserAddressEntity {
/**
*
*/
[key: string]: any;
}
interface UserInfoEntity { interface UserInfoEntity {
/** /**
* *
@ -323,177 +316,6 @@ declare namespace Eps {
request: Service["request"]; request: Service["request"];
} }
interface AiLimit {
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<AiLimitEntity>;
/**
* list
*/
list(data?: any): Promise<AiLimitEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: AiLimitEntity[];
[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 AiOrder {
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<AiOrderEntity>;
/**
* list
*/
list(data?: any): Promise<AiOrderEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: AiOrderEntity[];
[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 AiVip {
/**
* delete
*/
delete(data?: any): Promise<any>;
/**
* update
*/
update(data?: any): Promise<any>;
/**
* info
*/
info(data?: any): Promise<AiVipEntity>;
/**
* list
*/
list(data?: any): Promise<AiVipEntity[]>;
/**
* page
*/
page(data?: any): Promise<{
pagination: { size: number; page: number; total: number };
list: AiVipEntity[];
[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 BaseComm { interface BaseComm {
/** /**
* personUpdate * personUpdate
@ -1310,6 +1132,63 @@ declare namespace Eps {
request: Service["request"]; 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 { interface DictInfo {
/** /**
* delete * delete
@ -1877,6 +1756,63 @@ declare namespace Eps {
request: Service["request"]; 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 UserInfo { interface UserInfo {
/** /**
* delete * delete
@ -1945,7 +1881,6 @@ declare namespace Eps {
}): Promise<any>; }): Promise<any>;
chat: { message: ChatMessage; session: ChatSession }; chat: { message: ChatMessage; session: ChatSession };
test: Test; test: Test;
ai: { limit: AiLimit; order: AiOrder; vip: AiVip };
base: { base: {
comm: BaseComm; comm: BaseComm;
open: BaseOpen; open: BaseOpen;
@ -1959,12 +1894,12 @@ declare namespace Eps {
}; };
}; };
cloud: { db: CloudDb; func: { info: CloudFuncInfo; log: CloudFuncLog } }; cloud: { db: CloudDb; func: { info: CloudFuncInfo; log: CloudFuncLog } };
demo: { goods: DemoGoods }; demo: { goods: DemoGoods; user: DemoUser };
dict: { info: DictInfo; type: DictType }; dict: { info: DictInfo; type: DictType };
iot: { device: IotDevice; message: IotMessage; mqtt: IotMqtt }; iot: { device: IotDevice; message: IotMessage; mqtt: IotMqtt };
recycle: { data: RecycleData }; recycle: { data: RecycleData };
space: { info: SpaceInfo; type: SpaceType }; space: { info: SpaceInfo; type: SpaceType };
task: { info: TaskInfo }; task: { info: TaskInfo };
user: { info: UserInfo }; user: { address: UserAddress; info: UserInfo };
}; };
} }

View File

@ -1 +1 @@
[["/admin/ai/limit","AiLimitEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/ai/order","AiOrderEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/admin/ai/vip","AiVipEntity",[["/delete","post"],["/update","post"],["/info","get"],["/list","post"],["/page","post"],["/add","post"]]],["/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/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/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

@ -1,6 +1,6 @@
{ {
"name": "@cool-vue/crud", "name": "@cool-vue/crud",
"version": "6.2.0", "version": "6.2.1",
"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",

View File

@ -30,7 +30,7 @@ export default defineComponent({
onSearch: Function onSearch: Function
}, },
setup(props, { slots, expose }) { setup(props, { slots, expose, emit }) {
const { crud } = useCore(); const { crud } = useCore();
const { style } = useTools(); const { style } = useTools();
@ -66,6 +66,7 @@ export default defineComponent({
// 重置 // 重置
function reset() { function reset() {
Form.value?.reset(); Form.value?.reset();
emit("reset");
} }
expose({ expose({

View File

@ -26,7 +26,7 @@ export default defineComponent({
maxExportLimit: Number // 最大导出条数不传或者小于等于0为不限制 maxExportLimit: Number // 最大导出条数不传或者小于等于0为不限制
}, },
setup(props) { setup(props, { slots }) {
// 加载状态 // 加载状态
const loading = ref(false); const loading = ref(false);
@ -40,18 +40,20 @@ export default defineComponent({
// 获取表格数据 // 获取表格数据
function getData() { function getData() {
const params = {
...Crud.value?.paramsReplace(Crud.value.params),
maxExportLimit: props.maxExportLimit,
isExport: true
};
if (typeof props.data === "function") { if (typeof props.data === "function") {
return props.data(); return props.data(params);
} else { } else {
if (props.data) { if (props.data) {
return props.data; return props.data;
} else { } else {
return Crud.value?.service return Crud.value?.service
.page({ .page(params)
...Crud.value?.paramsReplace(Crud.value.params),
maxExportLimit: props.maxExportLimit,
isExport: true
})
.then((res) => { .then((res) => {
return res.list.map((e) => { return res.list.map((e) => {
for (const i in e) { for (const i in e) {
@ -106,7 +108,7 @@ export default defineComponent({
// 表格列 // 表格列
const columns = props.columns.filter( const columns = props.columns.filter(
(e: any) => (e) =>
!( !(
e.hidden === true || e.hidden === true ||
["selection", "expand", "index"].includes(e.type) || ["selection", "expand", "index"].includes(e.type) ||
@ -116,7 +118,7 @@ export default defineComponent({
); );
// 字段 // 字段
const fields = columns.map((e: any) => e.prop).filter(Boolean); const fields = columns.map((e) => e.prop).filter(Boolean);
// 表头 // 表头
const header = await getHeader(columns, fields); const header = await getHeader(columns, fields);
@ -150,7 +152,7 @@ export default defineComponent({
return () => { return () => {
return ( return (
<el-button loading={loading.value} onClick={toExport}> <el-button loading={loading.value} onClick={toExport}>
<slot></slot> {slots.default ? slots.default() : "导出"}
</el-button> </el-button>
); );
}; };

View File

@ -50,3 +50,9 @@ defineExpose({
open open
}); });
</script> </script>
<style lang="scss" scoped>
.item-viewer {
position: absolute;
}
</style>

View File

@ -269,7 +269,9 @@ const accept = computed(() => {
// //
const isAdd = computed(() => { const isAdd = computed(() => {
return props.multiple ? limit - list.value.length > 0 : list.value.length == 0; return props.multiple
? !disabled.value && limit - list.value.length > 0
: list.value.length == 0;
}); });
// //