mirror of
https://github.com/certd/certd.git
synced 2026-07-12 00:07:35 +08:00
🔱: [client] sync upgrade with 12 commits [trident-sync]
refactor: 1.11.0 refactor: 1.11.0 refactor: 1.11.0 refactor: 1.11.0 refactor: ts化 refactor: ts化 feat: 全面TS化 perf: 全面ts化 refactor: 继续优化ts perf: ts定义优化 fix: 修复wangeditor无法上传视频的bug
This commit is contained in:
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureSearch";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
+9
-8
@@ -1,22 +1,23 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { ref } from "vue";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
const crudBinding = expose.crudBinding;
|
||||
|
||||
const crudBinding = crudExpose.crudBinding;
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -26,7 +27,7 @@ export default function ({ expose }) {
|
||||
delRequest
|
||||
},
|
||||
table: {
|
||||
onResizeColumn: (w, col) => {
|
||||
onResizeColumn: (w: number, col: any) => {
|
||||
//触发resize事件后,修改column宽度,width只能配置为number类型
|
||||
//可以将此方法写在app.use()中的commonOptions里面
|
||||
crudBinding.value.table.columnsMap[col.key].width = w;
|
||||
@@ -13,32 +13,19 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import { useCrud } from "@fast-crud/fast-crud";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose } from "@fast-crud/fast-crud";
|
||||
import { message } from "ant-design-vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureColumnResize",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureSearch",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureColumnSort";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+9
-4
@@ -1,13 +1,18 @@
|
||||
import * as api from "./api";
|
||||
export default function ({ expose }) {
|
||||
const editRequest = async ({ form, row }) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const addRequest = async ({ form }) => {
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
@@ -10,38 +10,23 @@
|
||||
<a target="_blank" href="http://fast-crud.docmirror.cn/api/crud-options/columns.html#key-form-order">表单字段顺序配置</a>
|
||||
</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<template #actionbar-right>
|
||||
<a-alert class="ml-1" type="info" message="" />
|
||||
</template>
|
||||
</fs-crud>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding"> </fs-crud>
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureColumnSort",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedIds } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureColumnSort",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureColumnsSet";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+7
-6
@@ -1,21 +1,22 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { ref } from "vue";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -12,32 +12,19 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import { BatchDelete } from "./api";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureColumnsSet",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedRowKeys } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureColumnsSet",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureEditableRow";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+7
-8
@@ -1,20 +1,19 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const id = await api.AddObj(form);
|
||||
return { id };
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -8,31 +8,19 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureEditableRow",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedIds } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
expose.editable.enable();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureEditableRow",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureEditable";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+7
-7
@@ -1,19 +1,19 @@
|
||||
import * as api from "./api";
|
||||
import { dict, compute } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const { crudBinding } = expose;
|
||||
const pageRequest = async (query) => {
|
||||
import { dict, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, UserPageQuery, UserPageRes, EditReq, DelReq, AddReq } from "@fast-crud/fast-crud";
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const { crudBinding } = crudExpose;
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
@@ -28,45 +28,34 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import { message } from "ant-design-vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureEditable",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedIds } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
expose.editable.enable({ mode: "free" });
|
||||
crudExpose.doRefresh();
|
||||
crudExpose.editable.enable({ mode: "free" });
|
||||
});
|
||||
|
||||
function enable() {
|
||||
expose.editable.enable({ enabled: true, mode: "free" });
|
||||
crudExpose.editable.enable({ enabled: true, mode: "free" });
|
||||
}
|
||||
function disable() {
|
||||
expose.editable.disable();
|
||||
crudExpose.editable.disable();
|
||||
}
|
||||
|
||||
return {
|
||||
crudBinding,
|
||||
crudRef,
|
||||
enabledChanged(event) {
|
||||
enabledChanged(event: boolean) {
|
||||
if (event) {
|
||||
enable();
|
||||
} else {
|
||||
@@ -76,13 +65,13 @@ export default defineComponent({
|
||||
enable,
|
||||
disable,
|
||||
active() {
|
||||
expose.editable.active();
|
||||
crudExpose.editable.active();
|
||||
},
|
||||
inactive() {
|
||||
expose.editable.inactive();
|
||||
crudExpose.editable.inactive();
|
||||
},
|
||||
save() {
|
||||
expose.getTableRef().editable.submit(({ changed, removed, setData }) => {
|
||||
crudExpose.getTableRef().editable.submit(({ changed, removed, setData }: any) => {
|
||||
console.log("changed", changed);
|
||||
console.log("removed", removed);
|
||||
// setData({ 0: {id:1} }); //设置data
|
||||
@@ -90,13 +79,13 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
expose.editable.resume();
|
||||
crudExpose.editable.resume();
|
||||
},
|
||||
addRow() {
|
||||
expose.editable.addRow();
|
||||
crudExpose.editable.addRow();
|
||||
},
|
||||
editCol() {
|
||||
expose.editable.editCol({ cols: ["radio"] });
|
||||
crudExpose.editable.editCol({ cols: ["radio"] });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureEditable",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureExpand";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+19
-9
@@ -1,21 +1,23 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import * as api from "./api.js";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { ref } from "vue";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
const currentRow = ref();
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -27,8 +29,17 @@ export default function ({ expose }) {
|
||||
table: {
|
||||
//默认展开第一行
|
||||
defaultExpandedRowKeys: [1],
|
||||
customRow(record: any, index: number) {
|
||||
const clazz = record.id === currentRow.value ? "fs-current-row" : "";
|
||||
return {
|
||||
onClick() {
|
||||
currentRow.value = record.id;
|
||||
},
|
||||
class: clazz
|
||||
};
|
||||
},
|
||||
slots: {
|
||||
expandedRowRender: (scope) => {
|
||||
expandedRowRender: (scope: any) => {
|
||||
return (
|
||||
<div>
|
||||
index: {scope.index} ; row: {JSON.stringify(scope.record)}
|
||||
@@ -40,7 +51,6 @@ export default function ({ expose }) {
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
key: "id",
|
||||
type: "number",
|
||||
column: {
|
||||
width: 50
|
||||
@@ -8,32 +8,19 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import { BatchDelete } from "./api";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureExpand",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedRowKeys } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
// @ts-ignore
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureExpand",
|
||||
idGenerator: 0
|
||||
};
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureFilter";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
+11
-10
@@ -1,21 +1,22 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { ref } from "vue";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -26,7 +27,7 @@ export default function ({ expose }) {
|
||||
},
|
||||
table: {
|
||||
// 表头过滤改变事件
|
||||
onFilterChange(e) {
|
||||
onFilterChange(e: any) {
|
||||
console.log("onFilterChange", e);
|
||||
}
|
||||
},
|
||||
@@ -57,10 +58,10 @@ export default function ({ expose }) {
|
||||
],
|
||||
// specify the condition of filtering result
|
||||
// here is that finding the name started with `value`
|
||||
onFilter: (value, record) => {
|
||||
onFilter: (value: any, record: any) => {
|
||||
return record.radio === value;
|
||||
},
|
||||
sorter: (a, b) => a.radio - b.radio,
|
||||
sorter: (a: any, b: any) => a.radio - b.radio,
|
||||
sortDirections: ["descend"]
|
||||
}
|
||||
}
|
||||
@@ -4,31 +4,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import { useCrud } from "@fast-crud/fast-crud";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureFilter",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureFilter",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureFixed";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+9
-5
@@ -1,14 +1,18 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const editRequest = async ({ form, row }) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const addRequest = async ({ form }) => {
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
@@ -4,30 +4,17 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
export default defineComponent({
|
||||
name: "FeatureFixed",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedIds } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureFixed",
|
||||
idGenerator: 0
|
||||
};
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureHeaderGroup";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
+8
-6
@@ -1,20 +1,22 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, ValueChangeContext } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -6,31 +6,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import { useCrud } from "@fast-crud/fast-crud";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureHeaderGroup",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureHeaderGroup",
|
||||
idGenerator: 0
|
||||
};
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/ComponentHeight";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
+8
-6
@@ -1,20 +1,22 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -4,31 +4,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import { useCrud } from "@fast-crud/fast-crud";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted, ref } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "ComponentHeight",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
const value = ref(null);
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "ComponentHeight",
|
||||
idGenerator: 0
|
||||
};
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureHide";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
+8
-6
@@ -1,20 +1,22 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -13,27 +13,15 @@
|
||||
<a-row>
|
||||
<a-col :span="2"> 动作条: </a-col>
|
||||
<a-col :span="2">
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.actionbar.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.actionbar.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
添加:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.actionbar.buttons.add.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.actionbar.buttons.add.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
自定义:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.actionbar.buttons.test.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.actionbar.buttons.test.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
@@ -43,43 +31,23 @@
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
查询:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.toolbar.buttons.search.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.toolbar.buttons.search.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
刷新:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.toolbar.buttons.refresh.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.toolbar.buttons.refresh.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
紧凑:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.toolbar.buttons.compact.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.toolbar.buttons.compact.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
导出:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.toolbar.buttons.export.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.toolbar.buttons.export.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
列设置:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.toolbar.buttons.columns.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.toolbar.buttons.columns.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
@@ -91,53 +59,29 @@
|
||||
<a-row>
|
||||
<a-col :span="2"> 操作列: </a-col>
|
||||
<a-col :span="2">
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.rowHandle.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.rowHandle.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
查看:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.rowHandle.buttons.view.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.rowHandle.buttons.view.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
修改:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.rowHandle.buttons.edit.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.rowHandle.buttons.edit.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
删除:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.rowHandle.buttons.remove.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.rowHandle.buttons.remove.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
<a-col :span="3">
|
||||
自定义:
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.rowHandle.buttons.custom.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.rowHandle.buttons.custom.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row>
|
||||
<a-col :span="2"> 翻页: </a-col>
|
||||
<a-col :span="2">
|
||||
<a-switch
|
||||
v-model:checked="crudBinding.pagination.show"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
/>
|
||||
<a-switch v-model:checked="crudBinding.pagination.show" active-color="#13ce66" inactive-color="#ff4949" />
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
@@ -147,32 +91,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import { useCrud } from "@fast-crud/fast-crud";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureHide",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureHide",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureIndex";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+10
-8
@@ -1,18 +1,19 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
@@ -28,6 +29,7 @@ export default function ({ expose }) {
|
||||
columns: {
|
||||
_index: {
|
||||
title: "序号",
|
||||
type: "text",
|
||||
form: { show: false },
|
||||
column: {
|
||||
// type: "index",
|
||||
@@ -36,8 +38,8 @@ export default function ({ expose }) {
|
||||
columnSetDisabled: true, //禁止在列设置中选择
|
||||
formatter: (context) => {
|
||||
//计算序号,你可以自定义计算规则,此处为翻页累加
|
||||
let index = context.index ?? 1;
|
||||
let pagination = expose.crudBinding.value.pagination;
|
||||
const index = context.index ?? 1;
|
||||
const pagination = crudExpose.crudBinding.value.pagination;
|
||||
return ((pagination.current ?? 1) - 1) * pagination.pageSize + index + 1;
|
||||
}
|
||||
}
|
||||
@@ -4,30 +4,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureIndex",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedIds } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureIndex",
|
||||
idGenerator: 0
|
||||
};
|
||||
@@ -1,32 +0,0 @@
|
||||
import { uiContext } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ expose }) {
|
||||
return {
|
||||
crudOptions: {
|
||||
mode:{
|
||||
name:'local',
|
||||
isMergeWhenUpdate:true,
|
||||
isAppendWhenAdd:true
|
||||
},
|
||||
search: {
|
||||
show: false
|
||||
},
|
||||
toolbar:{
|
||||
show:false,
|
||||
},
|
||||
pagination:{
|
||||
show:false
|
||||
},
|
||||
columns: {
|
||||
name: {
|
||||
type: "text",
|
||||
title: "联系人姓名"
|
||||
},
|
||||
mobile: {
|
||||
type: "text",
|
||||
title: "联系人手机号码"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import { CreateCrudOptionsProps, CreateCrudOptionsRet, uiContext } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
return {
|
||||
crudOptions: {
|
||||
mode: {
|
||||
name: "local",
|
||||
isMergeWhenUpdate: true,
|
||||
isAppendWhenAdd: true
|
||||
},
|
||||
search: {
|
||||
show: false
|
||||
},
|
||||
toolbar: {
|
||||
show: false
|
||||
},
|
||||
pagination: {
|
||||
show: false
|
||||
},
|
||||
columns: {
|
||||
name: {
|
||||
type: "text",
|
||||
title: "联系人姓名"
|
||||
},
|
||||
mobile: {
|
||||
type: "text",
|
||||
title: "联系人手机号码"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -1,51 +1,47 @@
|
||||
<template>
|
||||
<fs-page>
|
||||
<template #header>
|
||||
<div class="title">
|
||||
将本地crud当做v-model,编辑好之后一并提交,你还可以使用行编辑模式,效果更好
|
||||
</div>
|
||||
<div class="title">将本地crud当做v-model,编辑好之后一并提交,你还可以使用行编辑模式,效果更好</div>
|
||||
</template>
|
||||
<div style="padding:30px">
|
||||
<div style="padding: 30px">
|
||||
<a-form ref="formRef" :model="form" laba-width="120px">
|
||||
<a-form-item label="姓名">
|
||||
<a-input v-model:value="form.name"></a-input>
|
||||
</a-form-item>
|
||||
<a-form-item label="表格">
|
||||
<div style="min-height: 300px">
|
||||
<FeatureLocalModelValueInput v-model="form.data"/>
|
||||
<FeatureLocalModelValueInput v-model="form.data" />
|
||||
</div>
|
||||
</a-form-item>
|
||||
<a-form-item >
|
||||
<a-form-item>
|
||||
<a-button @click="submit">提交</a-button>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
|
||||
</div>
|
||||
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {defineComponent, reactive} from 'vue';
|
||||
import {message} from 'ant-design-vue'
|
||||
import FeatureLocalModelValueInput from './local.vue'
|
||||
<script lang="ts">
|
||||
import { defineComponent, reactive } from "vue";
|
||||
import { message } from "ant-design-vue";
|
||||
import FeatureLocalModelValueInput from "./local.vue";
|
||||
export default defineComponent({
|
||||
name: 'FeatureLocalVModel',
|
||||
components:{FeatureLocalModelValueInput},
|
||||
name: "FeatureLocalVModel",
|
||||
components: { FeatureLocalModelValueInput },
|
||||
setup() {
|
||||
const form = reactive({
|
||||
name:'test',
|
||||
data: [{name:'初始数据'}],
|
||||
})
|
||||
name: "test",
|
||||
data: [{ name: "初始数据" }]
|
||||
});
|
||||
|
||||
function submit(){
|
||||
message.info("submit:"+JSON.stringify(form))
|
||||
console.log('submit:',form)
|
||||
function submit() {
|
||||
message.info("submit:" + JSON.stringify(form));
|
||||
console.log("submit:", form);
|
||||
}
|
||||
return {
|
||||
form,
|
||||
submit
|
||||
};
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -1,63 +1,48 @@
|
||||
<template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding"/>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding" />
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {defineComponent, ref, onMounted, watch} from 'vue';
|
||||
import createCrudOptions from './crud';
|
||||
import {useExpose, useCrud} from '@fast-crud/fast-crud';
|
||||
<script lang="ts">
|
||||
import { defineComponent, watch } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: 'FeatureLocalModelValueInput',
|
||||
name: "FeatureLocalModelValueInput",
|
||||
props: {
|
||||
modelValue: {
|
||||
default() {
|
||||
return []
|
||||
return [];
|
||||
}
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const {expose} = useExpose({crudRef, crudBinding});
|
||||
// 你的crud配置
|
||||
const {crudOptions} = createCrudOptions({expose});
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const {resetCrudOptions} = useCrud({expose, crudOptions});
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
// onMounted(() => {
|
||||
// expose.doRefresh();
|
||||
// });
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
|
||||
//通过导出modelValue, 可以导出成为一个input组件
|
||||
watch(() => {
|
||||
return props.modelValue
|
||||
}, (value = []) => {
|
||||
crudBinding.value.data = value
|
||||
}, {
|
||||
immediate: true
|
||||
})
|
||||
|
||||
watch(
|
||||
() => {
|
||||
return props.modelValue;
|
||||
},
|
||||
(value = []) => {
|
||||
crudBinding.value.data = value;
|
||||
},
|
||||
{
|
||||
immediate: true
|
||||
}
|
||||
);
|
||||
|
||||
// 通过crudBinding.value.data 可以获取表格实时数据
|
||||
function showData() {
|
||||
console.log('data:', crudBinding.value.data)
|
||||
console.log("data:", crudBinding.value.data);
|
||||
}
|
||||
|
||||
|
||||
return {
|
||||
crudBinding,
|
||||
crudRef,
|
||||
showData,
|
||||
showData
|
||||
};
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<style lang="less">
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import { uiContext } from "@fast-crud/fast-crud";
|
||||
import { CreateCrudOptionsProps, CreateCrudOptionsRet } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ expose }) {
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
return {
|
||||
crudOptions: {
|
||||
mode: {
|
||||
@@ -11,10 +11,10 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { useExpose, useCrud, useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureLocal",
|
||||
@@ -22,25 +22,11 @@ export default defineComponent({
|
||||
modelValue: {}
|
||||
},
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
// onMounted(() => {
|
||||
// expose.doRefresh();
|
||||
// });
|
||||
|
||||
onMounted(() => {
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
// 通过crudBinding.value.data 可以获取表格实时数据
|
||||
function showData() {
|
||||
console.log("data:", crudBinding.value.data);
|
||||
@@ -51,7 +37,7 @@ export default defineComponent({
|
||||
|
||||
//启用行编辑
|
||||
function enabledRowEdit() {
|
||||
expose.editable.enable({
|
||||
crudExpose.editable.enable({
|
||||
mode: "row"
|
||||
});
|
||||
crudBinding.value.actionbar.buttons.add.show = false;
|
||||
@@ -60,7 +46,7 @@ export default defineComponent({
|
||||
|
||||
//启用自由编辑
|
||||
function enabledFreeEdit() {
|
||||
expose.editable.enable({
|
||||
crudExpose.editable.enable({
|
||||
mode: "free"
|
||||
});
|
||||
crudBinding.value.actionbar.buttons.add.show = false;
|
||||
@@ -69,7 +55,7 @@ export default defineComponent({
|
||||
|
||||
//启用关闭编辑模式
|
||||
function disabledEdit() {
|
||||
expose.editable.enable({
|
||||
crudExpose.editable.enable({
|
||||
enabled: false
|
||||
});
|
||||
crudBinding.value.actionbar.buttons.add.show = true;
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureMerge";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj :any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
+24
-12
@@ -1,25 +1,25 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
/**
|
||||
* 列合并render
|
||||
*/
|
||||
function colMergeRender({ index }) {
|
||||
function colMergeRender({ index }: any) {
|
||||
return {
|
||||
props: {
|
||||
colSpan: 5
|
||||
@@ -35,9 +35,18 @@ export default function ({ expose }) {
|
||||
delRequest
|
||||
},
|
||||
table: {
|
||||
//这里要减去总结栏的高度
|
||||
maxHeightAdjust: -39,
|
||||
slots: {
|
||||
summary() {
|
||||
return <div>总结栏</div>;
|
||||
return (
|
||||
<a-table-summary fixed>
|
||||
<a-table-summary-row>
|
||||
<a-table-summary-cell index={0}>总结栏</a-table-summary-cell>
|
||||
<a-table-summary-cell index={1}>这里是总结内容</a-table-summary-cell>
|
||||
</a-table-summary-row>
|
||||
</a-table-summary>
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -56,9 +65,10 @@ export default function ({ expose }) {
|
||||
},
|
||||
cellMerge: {
|
||||
title: "上下合并",
|
||||
type: "text",
|
||||
column: {
|
||||
customRender: ({ text, index }, cellRender) => {
|
||||
const obj = {
|
||||
customRender: ({ text, index }: any, cellRender: any) => {
|
||||
const obj: any = {
|
||||
props: {}
|
||||
};
|
||||
if (index === 2) {
|
||||
@@ -75,9 +85,10 @@ export default function ({ expose }) {
|
||||
},
|
||||
colMerge1: {
|
||||
title: "左右合并",
|
||||
type: "text",
|
||||
column: {
|
||||
align: "center",
|
||||
customRender({ text, index, record, dataIndex }, cellRender) {
|
||||
customRender({ text, index, record, dataIndex }: any, cellRender: any) {
|
||||
if (index !== 4) {
|
||||
return {
|
||||
children: cellRender()
|
||||
@@ -94,8 +105,9 @@ export default function ({ expose }) {
|
||||
},
|
||||
colMerge2: {
|
||||
title: "左右合并",
|
||||
type: "text",
|
||||
column: {
|
||||
customRender({ text, index, record, dataIndex }, cellRender) {
|
||||
customRender({ text, index, record, dataIndex }: any, cellRender: any) {
|
||||
if (index !== 4) {
|
||||
return {
|
||||
children: cellRender()
|
||||
@@ -4,26 +4,15 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureMerge",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { crudExpose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ crudExpose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ crudExpose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureMerge",
|
||||
idGenerator: 0
|
||||
};
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureRemove";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj :any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
+8
-7
@@ -1,21 +1,22 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { Modal } from "ant-design-vue";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -31,7 +32,7 @@ export default function ({ expose }) {
|
||||
Modal.confirm({
|
||||
content: `确定删除记录(${context.row.id})吗?`,
|
||||
onOk() {
|
||||
resolve();
|
||||
resolve(true);
|
||||
},
|
||||
onCancel() {
|
||||
reject();
|
||||
@@ -4,31 +4,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import { useCrud } from "@fast-crud/fast-crud";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureRemove",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureRemove",
|
||||
idGenerator: 0
|
||||
};
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureSearchMulti";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
+15
-16
@@ -1,21 +1,22 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { ref } from "vue";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
@@ -42,23 +43,23 @@ export default function ({ expose }) {
|
||||
change: {
|
||||
text: "切换模式",
|
||||
click() {
|
||||
if (expose.crudBinding.value.search.layout === "multi-line") {
|
||||
expose.crudBinding.value.search.layout = "";
|
||||
if (crudExpose.crudBinding.value.search.layout === "multi-line") {
|
||||
crudExpose.crudBinding.value.search.layout = "";
|
||||
} else {
|
||||
expose.crudBinding.value.search.layout = "multi-line";
|
||||
crudExpose.crudBinding.value.search.layout = "multi-line";
|
||||
}
|
||||
}
|
||||
},
|
||||
search: {
|
||||
text: "查询",
|
||||
click() {
|
||||
expose.getSearchRef().doSearch();
|
||||
crudExpose.getSearchRef().doSearch();
|
||||
}
|
||||
},
|
||||
reset: {
|
||||
text: "重置查询",
|
||||
click() {
|
||||
expose.getSearchRef().doReset();
|
||||
crudExpose.getSearchRef().doReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,12 +89,10 @@ export default function ({ expose }) {
|
||||
{ text: "关", value: "0" },
|
||||
{ text: "停", value: "2" }
|
||||
],
|
||||
// specify the condition of filtering result
|
||||
// here is that finding the name started with `value`
|
||||
onFilter: (value, record) => {
|
||||
onFilter: (value: any, record: any) => {
|
||||
return record.radio === value;
|
||||
},
|
||||
sorter: (a, b) => a.radio - b.radio,
|
||||
sorter: (a: any, b: any) => a.radio - b.radio,
|
||||
sortDirections: ["descend"]
|
||||
}
|
||||
},
|
||||
@@ -4,32 +4,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import { useCrud } from "@fast-crud/fast-crud";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose } from "@fast-crud/fast-crud";
|
||||
import { message } from "ant-design-vue";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureSearchMulti",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureSearchMulti",
|
||||
idGenerator: 0
|
||||
};
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureSearch";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
+11
-9
@@ -1,22 +1,24 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { computed, ref } from "vue";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { computed } from "vue";
|
||||
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
let statusRef = dict({
|
||||
|
||||
const statusRef = dict({
|
||||
url: "/mock/dicts/OpenStatusEnum?single"
|
||||
});
|
||||
return {
|
||||
@@ -55,7 +57,7 @@ export default function ({ expose }) {
|
||||
options: computed(() => {
|
||||
return statusRef.data;
|
||||
})
|
||||
},
|
||||
} as any,
|
||||
columns: {
|
||||
id: {
|
||||
title: "ID",
|
||||
@@ -10,46 +10,33 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import { useCrud } from "@fast-crud/fast-crud";
|
||||
import { useCrud, useFs } from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose } from "@fast-crud/fast-crud";
|
||||
import { message } from "ant-design-vue";
|
||||
export default defineComponent({
|
||||
name: "FeatureSearch",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
crudBinding,
|
||||
crudRef,
|
||||
getSearchFormData() {
|
||||
const form = expose.getSearchFormData();
|
||||
const form = crudExpose.getSearchFormData();
|
||||
message.info(`searchForm:${JSON.stringify(form)}`);
|
||||
},
|
||||
setSearchFormData() {
|
||||
expose.setSearchFormData({ form: { radio: "1" }, mergeForm: true });
|
||||
crudExpose.setSearchFormData({ form: { radio: "1" }, mergeForm: true });
|
||||
},
|
||||
clearSearchForm() {
|
||||
expose.setSearchFormData({ form: { radio: null }, mergeForm: false });
|
||||
crudExpose.setSearchFormData({ form: { radio: null }, mergeForm: false });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureSearch",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureSelection";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+9
-8
@@ -1,23 +1,24 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { ref } from "vue";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
const selectedRowKey = ref();
|
||||
const onSelectChange = (changed) => {
|
||||
const onSelectChange = (changed: any) => {
|
||||
console.log("selection", changed);
|
||||
selectedRowKey.value = changed;
|
||||
};
|
||||
@@ -30,7 +31,7 @@ export default function ({ expose }) {
|
||||
type: "radio",
|
||||
selectedRowKeys: selectedRowKey,
|
||||
onChange: onSelectChange,
|
||||
getCheckboxProps: (record) => ({
|
||||
getCheckboxProps: (record: any) => ({
|
||||
disabled: record.id === 1 // 此处演示第一行禁用
|
||||
})
|
||||
}
|
||||
@@ -8,32 +8,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import { BatchDelete } from "./api";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureSelectionRadio",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureSelection",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureSelection";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+9
-8
@@ -1,24 +1,25 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { ref } from "vue";
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
const selectedRowKeys = ref([]);
|
||||
|
||||
const onSelectChange = (changed) => {
|
||||
const onSelectChange = (changed: any) => {
|
||||
console.log("selection", changed);
|
||||
selectedRowKeys.value = changed;
|
||||
};
|
||||
@@ -30,7 +31,7 @@ export default function ({ expose }) {
|
||||
rowSelection: {
|
||||
selectedRowKeys: selectedRowKeys,
|
||||
onChange: onSelectChange,
|
||||
getCheckboxProps: (record) => ({
|
||||
getCheckboxProps: (record: any) => ({
|
||||
disabled: record.id === 1 // 此处演示第一行禁用
|
||||
})
|
||||
}
|
||||
@@ -13,32 +13,19 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { useExpose, useCrud, useFs } from "@fast-crud/fast-crud";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import { BatchDelete } from "./api";
|
||||
export default defineComponent({
|
||||
name: "FeatureSelection",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedRowKeys } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose, selectedRowKeys } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
const handleBatchDelete = () => {
|
||||
@@ -49,7 +36,7 @@ export default defineComponent({
|
||||
async onOk() {
|
||||
await BatchDelete(selectedRowKeys.value);
|
||||
message.info("删除成功");
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureSelection",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureSortable";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+10
-6
@@ -1,14 +1,18 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const editRequest = async ({ form, row }) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const addRequest = async ({ form }) => {
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
@@ -29,7 +33,7 @@ export default function ({ expose }) {
|
||||
url: "/mock/dicts/OpenStatusEnum?single"
|
||||
}),
|
||||
column: {
|
||||
sorter(a, b) {
|
||||
sorter(a: any, b: any) {
|
||||
return a.radio < b.radio ? 1 : -1;
|
||||
}
|
||||
}
|
||||
@@ -4,30 +4,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureSortable",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedIds } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureSortable",
|
||||
idGenerator: 0
|
||||
};
|
||||
@@ -15,44 +15,31 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import { useCrud } from "@fast-crud/fast-crud";
|
||||
import {useCrud, useFs} from "@fast-crud/fast-crud";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose } from "@fast-crud/fast-crud";
|
||||
import { message } from "ant-design-vue";
|
||||
export default defineComponent({
|
||||
name: "FeatureTabs",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
crudBinding,
|
||||
crudRef,
|
||||
getSearchFormData() {
|
||||
const form = expose.getSearchFormData();
|
||||
const form = crudExpose.getSearchFormData();
|
||||
message.info(`searchForm:${JSON.stringify(form)}`);
|
||||
},
|
||||
setSearchFormData() {
|
||||
expose.setSearchFormData({ form: { radio: "1" }, mergeForm: true });
|
||||
crudExpose.setSearchFormData({ form: { radio: "1" }, mergeForm: true });
|
||||
},
|
||||
clearSearchForm() {
|
||||
expose.setSearchFormData({ form: { radio: null }, mergeForm: false });
|
||||
crudExpose.setSearchFormData({ form: { radio: null }, mergeForm: false });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureTree";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+9
-7
@@ -1,25 +1,26 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
import { ref } from "vue";
|
||||
|
||||
export default function ({ expose }) {
|
||||
const pageRequest = async (query) => {
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }) => {
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
|
||||
const addRequest = async ({ form }) => {
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
const selectedRowKeys = ref([]);
|
||||
|
||||
const onSelectChange = (changed) => {
|
||||
const onSelectChange = (changed: any) => {
|
||||
console.log("selection", changed);
|
||||
selectedRowKeys.value = changed;
|
||||
};
|
||||
@@ -75,6 +76,7 @@ export default function ({ expose }) {
|
||||
},
|
||||
amount: {
|
||||
title: "金额(元)",
|
||||
type: "number",
|
||||
key: "amount"
|
||||
},
|
||||
radio: {
|
||||
@@ -10,32 +10,19 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { useExpose, useCrud, useFs } from "@fast-crud/fast-crud";
|
||||
import { message, Modal } from "ant-design-vue";
|
||||
import { BatchDelete } from "./api";
|
||||
export default defineComponent({
|
||||
name: "FeatureTree",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedRowKeys } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose, selectedRowKeys } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
const handleBatchDelete = () => {
|
||||
@@ -46,7 +33,7 @@ export default defineComponent({
|
||||
async onOk() {
|
||||
await BatchDelete(selectedRowKeys.value);
|
||||
message.info("删除成功");
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
selectedRowKeys.value = [];
|
||||
}
|
||||
});
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureTree",
|
||||
idGenerator: 0
|
||||
};
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureValueBuilder";
|
||||
export function GetList(query) {
|
||||
export function GetList(query: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
@@ -9,7 +9,7 @@ export function GetList(query) {
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
export function AddObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
@@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
export function UpdateObj(obj: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
@@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
export function DelObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
@@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
export function GetObj(id: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
@@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
export function BatchDelete(ids: any) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
+10
-6
@@ -1,14 +1,18 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const editRequest = async ({ form, row }) => {
|
||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||
return await api.GetList(query);
|
||||
};
|
||||
const editRequest = async ({ form, row }: EditReq) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
const delRequest = async ({ row }: DelReq) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const addRequest = async ({ form }) => {
|
||||
|
||||
const addRequest = async ({ form }: AddReq) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
@@ -43,7 +47,7 @@ export default function ({ expose }) {
|
||||
},
|
||||
valueBuilder({ form }) {
|
||||
if (form.roles) {
|
||||
form.roles = form.roles.map((item) => item.id);
|
||||
form.roles = form.roles.map((item: any) => item.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,12 @@
|
||||
<template>
|
||||
<fs-page>
|
||||
<template #header>
|
||||
<div class="title">
|
||||
ValueBuilder & ValueResolve
|
||||
<span class="sub">后台返回的值与字段组件的modelValue类型不一致时,需要使用ValueBuilder & ValueResolve做转换</span>
|
||||
</div>
|
||||
<div class="more"><a target="_blank" href="http://fast-crud.docmirror.cn/api/crud-options/columns.html#valuebuilder与valueresolve">文档</a> /</div>
|
||||
</template>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||
<template #cell_roles="scope">
|
||||
<!-- 后台返回的列表数据已经包含了角色的名称,所以无需通过fs-values-format来从dict里获取label-->
|
||||
@@ -11,30 +18,18 @@
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { defineComponent, ref, onMounted } from "vue";
|
||||
<script lang="ts">
|
||||
import { defineComponent, onMounted } from "vue";
|
||||
import createCrudOptions from "./crud";
|
||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
||||
import { useFs } from "@fast-crud/fast-crud";
|
||||
|
||||
export default defineComponent({
|
||||
name: "FeatureValueBuilder",
|
||||
setup() {
|
||||
// crud组件的ref
|
||||
const crudRef = ref();
|
||||
// crud 配置的ref
|
||||
const crudBinding = ref();
|
||||
// 暴露的方法
|
||||
const { expose } = useExpose({ crudRef, crudBinding });
|
||||
// 你的crud配置
|
||||
const { crudOptions, selectedIds } = createCrudOptions({ expose });
|
||||
// 初始化crud配置
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
||||
// 你可以调用此方法,重新初始化crud配置
|
||||
// resetCrudOptions(options)
|
||||
|
||||
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
crudExpose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
const options: any = {
|
||||
name: "FeatureValueBuilder",
|
||||
idGenerator: 0
|
||||
};
|
||||
Reference in New Issue
Block a user