mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-12 13:42:50 +00:00
优化
This commit is contained in:
parent
6a8f3ca393
commit
f4c702a438
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@cool-vue/crud",
|
"name": "@cool-vue/crud",
|
||||||
"version": "7.0.4",
|
"version": "7.0.5",
|
||||||
"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",
|
||||||
|
|||||||
@ -54,7 +54,7 @@ export function useHelper({ config, crud, mitt }: Options) {
|
|||||||
function refresh(params?: obj) {
|
function refresh(params?: obj) {
|
||||||
const { service, dict } = crud;
|
const { service, dict } = crud;
|
||||||
|
|
||||||
return new Promise((end) => {
|
return new Promise((success, error) => {
|
||||||
// 合并请求参数
|
// 合并请求参数
|
||||||
const reqParams = paramsReplace(Object.assign(crud.params, params));
|
const reqParams = paramsReplace(Object.assign(crud.params, params));
|
||||||
|
|
||||||
@ -67,13 +67,14 @@ export function useHelper({ config, crud, mitt }: Options) {
|
|||||||
// 完成事件
|
// 完成事件
|
||||||
function done() {
|
function done() {
|
||||||
crud.loading = false;
|
crud.loading = false;
|
||||||
end(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 渲染
|
// 渲染
|
||||||
function render(list: any[], pagination?: any) {
|
function render(list: any[], pagination?: any) {
|
||||||
mitt.emit("crud.refresh", { list, pagination });
|
const res = { list, pagination };
|
||||||
done();
|
done();
|
||||||
|
success(res);
|
||||||
|
mitt.emit("crud.refresh", res);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下一步
|
// 下一步
|
||||||
@ -91,16 +92,16 @@ export function useHelper({ config, crud, mitt }: Options) {
|
|||||||
render(res.list, res.pagination);
|
render(res.list, res.pagination);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
success(res);
|
||||||
resolve(res);
|
resolve(res);
|
||||||
done();
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
ElMessage.error(err.message);
|
ElMessage.error(err.message);
|
||||||
|
error(err);
|
||||||
reject(err);
|
reject(err);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
end(true);
|
done();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -214,7 +214,7 @@ function select() {
|
|||||||
// 全选
|
// 全选
|
||||||
async function selectAll() {
|
async function selectAll() {
|
||||||
// 全部数据
|
// 全部数据
|
||||||
await Crud.value?.service.page({ page: 1, size: 10000 }).then((res) => {
|
await Crud.value?.refresh({ page: 1, size: 10000 }).then((res) => {
|
||||||
list.value = res.list;
|
list.value = res.list;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -240,7 +240,7 @@ function remove() {
|
|||||||
// 监听已选列表,返回 ids
|
// 监听已选列表,返回 ids
|
||||||
watch(
|
watch(
|
||||||
list,
|
list,
|
||||||
(arr) => {
|
(arr = []) => {
|
||||||
emit(
|
emit(
|
||||||
"update:modelValue",
|
"update:modelValue",
|
||||||
arr.map((e) => e.id)
|
arr.map((e) => e.id)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user