mirror of https://github.com/certd/certd
🔱: [client] sync upgrade with 5 commits [trident-sync]
build: publish success perf: 增加card列表示例 fix: 修复antdv4新页面打开示例不显示表单的bug chore:client_sync
parent
4aa136189a
commit
7b42d7252e
|
@ -3,6 +3,16 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
## [1.23.3](https://github.com/fast-crud/fast-crud/compare/v1.23.2...v1.23.3) (2024-11-26)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* 修复antdv4新页面打开示例不显示表单的bug ([34ab106](https://github.com/fast-crud/fast-crud/commit/34ab106d5e1cce918ce9745df141fda03f69331d))
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* 增加card列表示例 ([cfad8c8](https://github.com/fast-crud/fast-crud/commit/cfad8c87cb6f9588bb016c0595d03b34b0147c2a))
|
||||
|
||||
## [1.23.2](https://github.com/fast-crud/fast-crud/compare/v1.23.1...v1.23.2) (2024-11-18)
|
||||
|
||||
### Bug Fixes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@fast-crud/fs-admin-antdv4",
|
||||
"version": "1.23.2",
|
||||
"version": "1.23.3",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
@ -26,10 +26,10 @@
|
|||
"@ant-design/icons-vue": "^7.0.1",
|
||||
"@aws-sdk/client-s3": "^3.535.0",
|
||||
"@aws-sdk/s3-request-presigner": "^3.535.0",
|
||||
"@fast-crud/fast-crud": "^1.23.2",
|
||||
"@fast-crud/fast-extends": "^1.23.2",
|
||||
"@fast-crud/ui-antdv4": "^1.23.2",
|
||||
"@fast-crud/ui-interface": "^1.23.2",
|
||||
"@fast-crud/fast-crud": "^1.23.3",
|
||||
"@fast-crud/fast-extends": "^1.23.3",
|
||||
"@fast-crud/ui-antdv4": "^1.23.3",
|
||||
"@fast-crud/ui-interface": "^1.23.3",
|
||||
"@iconify/vue": "^4.1.1",
|
||||
"@soerenmartius/vue3-clipboard": "^0.1.2",
|
||||
"ant-design-vue": "^4.1.2",
|
||||
|
|
|
@ -782,6 +782,12 @@ export const crudResources = [
|
|||
name: "AdvancedBigData",
|
||||
path: "/crud/advanced/big-data",
|
||||
component: "/crud/advanced/big-data/index.vue"
|
||||
},
|
||||
{
|
||||
title: "列表以card方式显示",
|
||||
name: "AdvancedCard",
|
||||
path: "/crud/advanced/card",
|
||||
component: "/crud/advanced/card/index.vue"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/AdvancedCard";
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
data: query
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/get",
|
||||
method: "get",
|
||||
params: { id }
|
||||
});
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
import * as api from "./api";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, ScopeContext, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
export default async function ({ crudExpose }: CreateCrudOptionsProps): Promise<CreateCrudOptionsRet> {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
if (form.id == null) {
|
||||
form.id = row.id;
|
||||
}
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
},
|
||||
rowHandle: {
|
||||
align: "center"
|
||||
},
|
||||
table: {
|
||||
show: false
|
||||
},
|
||||
toolbar: {
|
||||
compact: false
|
||||
},
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
type: "number",
|
||||
column: {
|
||||
width: 50
|
||||
},
|
||||
form: {
|
||||
show: false
|
||||
}
|
||||
},
|
||||
title: {
|
||||
title: "标题",
|
||||
type: "text"
|
||||
},
|
||||
content: {
|
||||
title: "内容",
|
||||
type: "text"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<a-row v-if="crudBinding.data" gutter="10" style="height: 100%; width: 100%; overflow: auto">
|
||||
<a-col v-for="(item, index) of crudBinding.data" :key="item.id" :span="6" style="margin-bottom: 10px">
|
||||
<a-card :title="item.title">
|
||||
{{ item.content }}
|
||||
<template #extra> 操作 </template>
|
||||
<template #actions>
|
||||
<fs-icon icon="ion:eye-outline" @click="openView({ index: index, row: item })"></fs-icon>
|
||||
<fs-icon icon="ion:create-outline" @click="openEdit({ index: index, row: item })"></fs-icon>
|
||||
<fs-icon icon="ion:trash-outline" @click="doRemove({ index: index, row: item })"></fs-icon>
|
||||
</template>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</fs-crud>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import { useFsAsync, useFsRef } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud.js";
|
||||
|
||||
const { crudRef, crudBinding, crudExpose, context } = useFsRef();
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(async () => {
|
||||
await useFsAsync({ crudBinding, crudRef, crudExpose, context, createCrudOptions });
|
||||
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
function openView(opts: any) {
|
||||
crudExpose.openView(opts);
|
||||
}
|
||||
function openEdit(opts: any) {
|
||||
crudExpose.openEdit(opts);
|
||||
}
|
||||
function doRemove(opts: any) {
|
||||
crudExpose.doRemove(opts);
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,27 @@
|
|||
// @ts-ignore
|
||||
import mockUtil from "/src/mock/base";
|
||||
import _ from "lodash-es";
|
||||
const options: any = {
|
||||
name: "AdvancedCard",
|
||||
idGenerator: 0
|
||||
};
|
||||
const list = [
|
||||
{
|
||||
title: "fast-crud怎么样",
|
||||
content: "很好用"
|
||||
},
|
||||
{
|
||||
title: "大环境不好呀",
|
||||
content: "好好学习提升自己吧"
|
||||
},
|
||||
{
|
||||
title: "Certd是什么",
|
||||
content: "Certd是一款开源的证书全自动管理系统"
|
||||
}
|
||||
];
|
||||
|
||||
options.list = list;
|
||||
options.copyTimes = 100;
|
||||
const mock = mockUtil.buildMock(options);
|
||||
|
||||
export default mock;
|
|
@ -210,7 +210,10 @@ export default async function ({ crudExpose }: CreateCrudOptionsProps): Promise<
|
|||
title: "查看模式",
|
||||
dict: dict({
|
||||
value: "id",
|
||||
label: "name"
|
||||
label: "name",
|
||||
getNodesByValues: async (values: any[]) => {
|
||||
return await textTableApi.GetByIds(values);
|
||||
}
|
||||
}),
|
||||
column: {
|
||||
component: {
|
||||
|
@ -219,6 +222,14 @@ export default async function ({ crudExpose }: CreateCrudOptionsProps): Promise<
|
|||
viewMode: true,
|
||||
createCrudOptions: createCrudOptionsText,
|
||||
crudOptionsOverride,
|
||||
on: {
|
||||
dialogClose(ctx) {
|
||||
console.log("dialog close", ctx);
|
||||
},
|
||||
dialogClosed(ctx) {
|
||||
console.log("dialog closed", ctx);
|
||||
}
|
||||
},
|
||||
slots: {
|
||||
default({ scope, value }) {
|
||||
async function open() {
|
||||
|
|
|
@ -25,19 +25,16 @@ export default defineComponent({
|
|||
name: "FormNewPageEdit",
|
||||
setup(props, ctx) {
|
||||
const { crudRef, crudBinding, crudExpose, context } = useFsRef();
|
||||
|
||||
const formRef = ref();
|
||||
const formOptions = ref();
|
||||
const pageStore = usePageStore();
|
||||
const route = useRoute();
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(async () => {
|
||||
await useFsAsync({ crudBinding, crudRef, crudExpose, context, createCrudOptions });
|
||||
await crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
const formRef = ref();
|
||||
const formOptions = ref();
|
||||
|
||||
const route = useRoute();
|
||||
const id: any = route.query.id;
|
||||
|
||||
if (id) {
|
||||
//编辑表单
|
||||
formOptions.value = crudBinding.value.editForm;
|
||||
|
@ -45,7 +42,6 @@ export default defineComponent({
|
|||
formOptions.value = crudBinding.value.addForm;
|
||||
}
|
||||
const doSubmit = formOptions.value.doSubmit;
|
||||
const pageStore = usePageStore();
|
||||
|
||||
formOptions.value.doSubmit = (context: any) => {
|
||||
utils.logger.log("submit", context);
|
||||
|
@ -55,11 +51,6 @@ export default defineComponent({
|
|||
pageStore.close({ tagName: route.fullPath });
|
||||
};
|
||||
|
||||
const getDetail = async (id: any) => {
|
||||
return await api.GetObj(id);
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
if (id) {
|
||||
//远程获取记录详情
|
||||
const detail = await getDetail(id);
|
||||
|
@ -67,6 +58,10 @@ export default defineComponent({
|
|||
}
|
||||
});
|
||||
|
||||
const getDetail = async (id: any) => {
|
||||
return await api.GetObj(id);
|
||||
};
|
||||
|
||||
return {
|
||||
crudBinding,
|
||||
crudRef,
|
||||
|
|
Loading…
Reference in New Issue