mirror of
https://github.com/certd/certd.git
synced 2026-05-18 14:27:36 +08:00
🔱: [client] sync upgrade with 21 commits [trident-sync]
Update README.md
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import { requestForMock } from "/src/api/service";
|
||||
const request = requestForMock;
|
||||
const apiPrefix = "/mock/FeatureFixed";
|
||||
export function GetList(query) {
|
||||
return request({
|
||||
url: apiPrefix + "/page",
|
||||
method: "get",
|
||||
data: query
|
||||
});
|
||||
}
|
||||
|
||||
export function AddObj(obj) {
|
||||
return request({
|
||||
url: apiPrefix + "/add",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
}
|
||||
|
||||
export function UpdateObj(obj) {
|
||||
return request({
|
||||
url: apiPrefix + "/update",
|
||||
method: "post",
|
||||
data: obj
|
||||
});
|
||||
}
|
||||
|
||||
export function DelObj(id) {
|
||||
return request({
|
||||
url: apiPrefix + "/delete",
|
||||
method: "post",
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
export function GetObj(id) {
|
||||
return request({
|
||||
url: apiPrefix + "/info",
|
||||
method: "get",
|
||||
params: { id }
|
||||
});
|
||||
}
|
||||
|
||||
export function BatchDelete(ids) {
|
||||
return request({
|
||||
url: apiPrefix + "/batchDelete",
|
||||
method: "post",
|
||||
data: { ids }
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import * as api from "./api";
|
||||
import { dict } from "@fast-crud/fast-crud";
|
||||
export default function ({ expose }) {
|
||||
const editRequest = async ({ form, row }) => {
|
||||
form.id = row.id;
|
||||
return await api.UpdateObj(form);
|
||||
};
|
||||
const delRequest = async ({ row }) => {
|
||||
return await api.DelObj(row.id);
|
||||
};
|
||||
const addRequest = async ({ form }) => {
|
||||
return await api.AddObj(form);
|
||||
};
|
||||
|
||||
return {
|
||||
crudOptions: {
|
||||
request: {
|
||||
pageRequest: api.GetList,
|
||||
addRequest,
|
||||
editRequest,
|
||||
delRequest
|
||||
},
|
||||
rowHandle: {
|
||||
//固定右侧
|
||||
fixed: "right"
|
||||
},
|
||||
table: {
|
||||
scroll: {
|
||||
//当你表格宽度大到需要使用固定列时,需要设置此值,并且是大于等于列宽度之和的值
|
||||
//否则可能会出现将自动宽度列挤变形,或者拖动滚动条表头不动等问题。
|
||||
x: 1400
|
||||
}
|
||||
},
|
||||
columns: {
|
||||
text1: {
|
||||
title: "text1",
|
||||
type: "text",
|
||||
column: {
|
||||
// 固定左侧
|
||||
// 注意被固定在左侧的列要放在最前面,否则会出现某些列错位不显示的问题
|
||||
fixed: "left",
|
||||
width: 260
|
||||
}
|
||||
},
|
||||
id: {
|
||||
title: "id",
|
||||
type: "text",
|
||||
column: {
|
||||
width: 100
|
||||
}
|
||||
},
|
||||
text2: {
|
||||
title: "text2",
|
||||
type: "text",
|
||||
column: {
|
||||
width: 260
|
||||
}
|
||||
},
|
||||
text3: {
|
||||
title: "text3",
|
||||
type: "text",
|
||||
column: {
|
||||
width: 260
|
||||
}
|
||||
},
|
||||
text4: {
|
||||
title: "text4",
|
||||
type: "text",
|
||||
column: {
|
||||
width: 260
|
||||
}
|
||||
},
|
||||
text5: {
|
||||
title: "text5",
|
||||
type: "text",
|
||||
column: {
|
||||
width: 260
|
||||
}
|
||||
},
|
||||
last: {
|
||||
title: "last",
|
||||
type: "text",
|
||||
column: {
|
||||
width: 260
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<template>
|
||||
<fs-page>
|
||||
<fs-crud ref="crudRef" v-bind="crudBinding" />
|
||||
</fs-page>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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)
|
||||
|
||||
// 页面打开后获取列表数据
|
||||
onMounted(() => {
|
||||
expose.doRefresh();
|
||||
});
|
||||
|
||||
return {
|
||||
crudBinding,
|
||||
crudRef
|
||||
};
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,14 @@
|
||||
import mockUtil from "/src/mock/base";
|
||||
const options = {
|
||||
name: "FeatureFixed",
|
||||
idGenerator: 0
|
||||
};
|
||||
const list = [
|
||||
{
|
||||
text1: "我会被固定在左侧",
|
||||
last: "操作列被固定在右侧"
|
||||
}
|
||||
];
|
||||
options.list = list;
|
||||
const mock = mockUtil.buildMock(options);
|
||||
export default mock;
|
||||
Reference in New Issue
Block a user