Merge branch 'client_sync' into v2

# Conflicts:
#	packages/ui/certd-client/.eslintrc.js
#	packages/ui/certd-client/LICENSE
#	packages/ui/certd-client/README.md
#	packages/ui/certd-client/package.json
#	packages/ui/certd-client/src/components/index.ts
#	packages/ui/certd-client/src/i18n/index.ts
#	packages/ui/certd-client/src/layout/layout-pass.vue
#	packages/ui/certd-client/src/main.ts
#	packages/ui/certd-client/src/router/index.ts
#	packages/ui/certd-client/src/router/source/framework.ts
#	packages/ui/certd-client/src/router/source/modules/crud.ts
#	packages/ui/certd-client/src/store/modules/settings.ts
#	packages/ui/certd-client/src/style/common.less
#	packages/ui/certd-client/src/views/crud/feature/header-group/index.vue
#	packages/ui/certd-client/src/views/crud/feature/search/crud.jsx
#	packages/ui/certd-client/src/views/crud/form/base/crud.jsx
#	packages/ui/certd-client/src/views/crud/form/base/index.vue
#	packages/ui/certd-client/src/views/framework/home/page-cover/index.vue
#	packages/ui/certd-client/tsconfig.json
#	packages/ui/certd-client/vite.config.ts
This commit is contained in:
xiaojunnuo
2023-01-29 15:46:15 +08:00
120 changed files with 8044 additions and 698 deletions
@@ -0,0 +1,42 @@
import { requestForMock } from "/src/api/service";
const request = requestForMock;
const apiPrefix = "/mock/BasisColumnMergePlugin";
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 }
});
}
@@ -0,0 +1,69 @@
import * as api from "./api";
import { dict } from "@fast-crud/fast-crud";
export default function ({ expose }) {
const pageRequest = async (query) => {
return await api.GetList(query);
};
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 {
output: {},
crudOptions: {
settings: {
viewFormUseCellComponent: true
},
request: {
pageRequest,
addRequest,
editRequest,
delRequest
},
columns: {
id: {
title: "ID",
key: "id",
type: "number",
column: {
width: 50
},
form: {
show: false
}
},
text: {
title: "text",
type: "text"
},
readonly: {
title: "只读字段",
type: "text",
readonly: true
},
useCell: {
title: "查看使用cell组件",
type: "dict-select",
readonly: true,
dict: dict({
url: "/mock/dicts/OpenStatusEnum"
}),
viewForm: {
component: {
vModel: "modelValue"
}
}
}
}
}
};
}
@@ -0,0 +1,34 @@
<template>
<fs-page>
<template #header>
<div class="title">可以实现类似dict的公共属性</div>
<div class="more"><a target="_blank" href="http://fast-crud.docmirror.cn/guide/advance/column-type.html#修改官方字段类型配置"> 字段合并插件帮助文档</a></div>
</template>
<fs-crud ref="crudRef" v-bind="crudBinding">
<template #actionbar-right>
<span class="fs-desc">此示例实现只需配置readonly: true即可关闭添加和编辑时该字段的显示更多说明请点击右上角帮助</span>
</template>
</fs-crud>
</fs-page>
</template>
<script>
import { defineComponent, ref, onMounted } from "vue";
import createCrudOptions from "./crud";
import { useFs } from "@fast-crud/fast-crud";
export default defineComponent({
name: "BasisColumnMergePlugin",
setup() {
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
// 页面打开后获取列表数据
onMounted(() => {
crudExpose.doRefresh();
});
return {
crudBinding,
crudRef
};
}
});
</script>
@@ -0,0 +1,25 @@
import mockUtil from "/src/mock/base";
const options = {
name: "BasisColumnMergePlugin",
idGenerator: 0
};
const list = [
{
text: "点击右边查看按钮看效果",
readonly: "我是只读",
useCell: "1"
},
{
text: "点击编辑按钮查看效果",
readonly: "我是只读",
useCell: "2"
},
{
text: "正常字段",
readonly: "我是只读",
useCell: "0"
}
];
options.list = list;
const mock = mockUtil.buildMock(options);
export default mock;
@@ -0,0 +1,42 @@
import { requestForMock } from "/src/api/service";
const request = requestForMock;
const apiPrefix = "/mock/DictSharedManager";
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 }
});
}
@@ -0,0 +1,58 @@
import * as api from "./api";
import { statusDict } from "../shared-dict";
export default function ({ crudExpose }) {
const pageRequest = async (query) => {
return await api.GetList(query);
};
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,
addRequest,
editRequest,
delRequest
},
pagination: {
pageSize: 9999
},
table: {
onRefreshed({ data }) {
statusDict.setData(data);
}
},
columns: {
id: {
title: "ID",
key: "id",
type: "number",
column: {
width: 50
},
form: {
show: false
}
},
name: {
title: "name",
type: "text"
},
label: {
title: "标签",
type: "text"
}
}
}
};
}
@@ -0,0 +1,33 @@
<template>
<fs-page>
<fs-crud ref="crudRef" v-bind="crudBinding">
<template #actionbar-right>
<a-alert class="ml-1" type="warning" message="管理共享字典,此处添加和修改字典,在使用时实时变化" />
</template>
</fs-crud>
</fs-page>
</template>
<script>
import { defineComponent, onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
export default defineComponent({
name: "DictSharedManager",
setup() {
// crud组件的ref
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
// 页面打开后获取列表数据
onMounted(() => {
crudExpose.doRefresh();
});
return {
crudBinding,
crudRef
};
}
});
</script>
@@ -0,0 +1,23 @@
import mockUtil from "/src/mock/base";
const options = {
name: "DictSharedManager",
idGenerator: 0,
copyTimes: 1
};
const list = [
{
name: "close",
label: "关闭"
},
{
name: "open",
label: "打开"
},
{
name: "stop",
label: "停止"
}
];
options.list = list;
const mock = mockUtil.buildMock(options);
export default mock;
@@ -0,0 +1,10 @@
import { dict, utils } from "@fast-crud/fast-crud";
import * as api from "./manager/api";
export const statusDict = dict({
value: "name",
async getData() {
const res = await api.GetList({ query: {}, sort: {}, page: { limit: 9999 } });
utils.logger.debug("status dict first loaded", res.records);
return res.records;
}
});
@@ -0,0 +1,42 @@
import { requestForMock } from "/src/api/service";
const request = requestForMock;
const apiPrefix = "/mock/DictSharedUse";
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 }
});
}
@@ -0,0 +1,47 @@
import * as api from "./api";
import { statusDict } from "../shared-dict";
export default function ({ crudExpose }) {
const pageRequest = async (query) => {
return await api.GetList(query);
};
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,
addRequest,
editRequest,
delRequest
},
columns: {
id: {
title: "ID",
key: "id",
type: "number",
column: {
width: 50
},
form: {
show: false
}
},
status: {
title: "状态",
type: "dict-select",
dict: statusDict
}
}
}
};
}
@@ -0,0 +1,33 @@
<template>
<fs-page>
<fs-crud ref="crudRef" v-bind="crudBinding">
<template #actionbar-right>
<a-alert class="ml-1" type="warning" message="共享字典的使用" />
</template>
</fs-crud>
</fs-page>
</template>
<script>
import { defineComponent, onMounted } from "vue";
import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
export default defineComponent({
name: "DictSharedUse",
setup() {
// crud组件的ref
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
// 页面打开后获取列表数据
onMounted(() => {
crudExpose.doRefresh();
});
return {
crudBinding,
crudRef
};
}
});
</script>
@@ -0,0 +1,19 @@
import mockUtil from "/src/mock/base";
const options = {
name: "DictSharedUse",
idGenerator: 0
};
const list = [
{
status: "close"
},
{
status: "stop"
},
{
status: "open"
}
];
options.list = list;
const mock = mockUtil.buildMock(options);
export default mock;
@@ -1,6 +1,8 @@
<template>
<fs-page>
<fs-crud ref="crudRef" v-bind="crudBinding" />
<fs-crud ref="crudRef" v-bind="crudBinding">
<template #cell_street="scope"> 街道{{ scope.value }} </template>
</fs-crud>
</fs-page>
</template>
@@ -30,20 +30,23 @@ export default function ({ expose }) {
console.log("onFilterChange", e);
}
},
search:{
buttons:{
custom:{
text:"自定义",
show:true,
order:3,
icon:{
icon:"ant-design:search",
style:{
"font-size":'16px'
search: {
initialForm: {
radio: "0"
},
buttons: {
custom: {
text: "自定义",
show: true,
order: 3,
icon: {
icon: "ant-design:search",
style: {
"font-size": "16px"
}
},
click(){
console.log("点击了自定义按钮")
click() {
console.log("点击了自定义按钮");
}
}
}
@@ -22,10 +22,32 @@ export default function ({ crudExpose }) {
editRequest,
delRequest
},
form: {
wrapper: {
buttons: {
ok: {
text: "保存"
}
}
}
},
columns: {
name: {
title: "姓名",
type: "text"
},
renderLabel: {
title: "labelRender",
type: "text",
form: {
title(context) {
console.log("render label context:", context);
return <div style={{ color: "red" }}>LabelRender</div>;
},
helper: {
text: "配置form.title为一个render方法即可自定义label"
}
}
}
}
}
@@ -10,14 +10,13 @@
<script lang="ts">
import { defineComponent, ref, onMounted, nextTick } from "vue";
import { useFs, useDrag } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud.jsx";
export default defineComponent({
name: "FormBase",
setup() {
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
const visibleRef = ref(false);
// 页面打开后获取列表数据
onMounted(async () => {
crudExpose.doRefresh();
@@ -0,0 +1,42 @@
import { requestForMock } from "/src/api/service";
const request = requestForMock;
const apiPrefix = "/mock/FormSingleColumn";
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 }
});
}
@@ -0,0 +1,59 @@
import * as api from "./api";
export default function ({ crudExpose }) {
const pageRequest = async (query) => {
return await api.GetList(query);
};
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,
addRequest,
editRequest,
delRequest
},
form: {
col: {
span: 24
}
},
columns: {
name: {
title: "姓名",
type: "text"
},
title: {
title: "商品标题",
type: "text"
},
code: {
title: "商品代码",
search: { show: true },
type: "text"
},
images: {
title: "图片",
type: "image-uploader"
},
price: {
title: "价格",
sortable: true
},
store: {
title: "库存",
type: "number"
}
}
}
};
}
@@ -0,0 +1,31 @@
<template>
<fs-page>
<fs-crud ref="crudRef" v-bind="crudBinding">
<template #actionbar-right>
<a-alert class="ml-1" type="info" message="单列模式" />
</template>
</fs-crud>
</fs-page>
</template>
<script lang="ts">
import { defineComponent, ref, onMounted, nextTick } from "vue";
import { useFs } from "@fast-crud/fast-crud";
import createCrudOptions from "./crud";
export default defineComponent({
name: "FormSingleColumn",
setup() {
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
// 页面打开后获取列表数据
onMounted(async () => {
crudExpose.doRefresh();
});
return {
crudBinding,
crudRef
};
}
});
</script>
@@ -0,0 +1,310 @@
import mockUtil from "/src/mock/base";
const options = {
name: "FormSingleColumn",
idGenerator: 0
};
const list = [
{
name: "王小虎",
age: 15,
password: "",
status: "2",
url: "https://baidu.com"
},
{
name: "张三",
age: 18,
password: "",
url: "https://baidu.com"
},
{
status: "2"
}
];
const dictData = [
{
value: "zhinan",
label: "指南",
children: [
{
value: "shejiyuanze",
label: "设计原则",
children: [
{
value: "yizhi",
label: "一致"
},
{
value: "fankui",
label: "反馈"
},
{
value: "xiaolv",
label: "效率"
},
{
value: "kekong",
label: "可控"
}
]
},
{
value: "daohang",
label: "导航",
children: [
{
value: "cexiangdaohang",
label: "侧向导航"
},
{
value: "dingbudaohang",
label: "顶部导航"
}
]
}
]
},
{
value: "zujian",
label: "组件",
children: [
{
value: "basic",
label: "Basic",
children: [
{
value: "layout",
label: "Layout 布局"
},
{
value: "color",
label: "Color 色彩"
},
{
value: "typography",
label: "Typography 字体"
},
{
value: "icon",
label: "Icon 图标"
},
{
value: "button",
label: "Button 按钮"
}
]
},
{
value: "form",
label: "Form",
children: [
{
value: "radio",
label: "Radio 单选框"
},
{
value: "checkbox",
label: "Checkbox 多选框"
},
{
value: "input",
label: "Input 输入框"
},
{
value: "input-number",
label: "InputNumber 计数器"
},
{
value: "select",
label: "Select 选择器"
},
{
value: "cascader",
label: "Cascader 级联选择器"
},
{
value: "switch",
label: "Switch 开关"
},
{
value: "slider",
label: "Slider 滑块"
},
{
value: "time-picker",
label: "TimePicker 时间选择器"
},
{
value: "date-picker",
label: "DatePicker 日期选择器"
},
{
value: "datetime-picker",
label: "DateTimePicker 日期时间选择器"
},
{
value: "upload",
label: "Upload 上传"
},
{
value: "rate",
label: "Rate 评分"
},
{
value: "form",
label: "Form 表单"
}
]
},
{
value: "data",
label: "Data",
children: [
{
value: "table",
label: "Table 表格"
},
{
value: "tag",
label: "Tag 标签"
},
{
value: "progress",
label: "Progress 进度条"
},
{
value: "tree",
label: "Tree 树形控件"
},
{
value: "pagination",
label: "Pagination 分页"
},
{
value: "badge",
label: "Badge 标记"
}
]
},
{
value: "notice",
label: "Notice",
children: [
{
value: "alert",
label: "Alert 警告"
},
{
value: "loading",
label: "Loading 加载"
},
{
value: "message",
label: "Message 消息提示"
},
{
value: "message-box",
label: "MessageBox 弹框"
},
{
value: "notification",
label: "Notification 通知"
}
]
},
{
value: "navigation",
label: "Navigation",
children: [
{
value: "menu",
label: "NavMenu 导航菜单"
},
{
value: "tabs",
label: "Tabs 标签页"
},
{
value: "breadcrumb",
label: "Breadcrumb 面包屑"
},
{
value: "dropdown",
label: "Dropdown 下拉菜单"
},
{
value: "steps",
label: "Steps 步骤条"
}
]
},
{
value: "others",
label: "Others",
children: [
{
value: "dialog",
label: "Dialog 对话框"
},
{
value: "tooltip",
label: "Tooltip 文字提示"
},
{
value: "popover",
label: "Popover 弹出框"
},
{
value: "card",
label: "Card 卡片"
},
{
value: "carousel",
label: "Carousel 走马灯"
},
{
value: "collapse",
label: "Collapse 折叠面板"
}
]
}
]
},
{
value: "ziyuan",
label: "资源",
children: [
{
value: "axure",
label: "Axure Components"
},
{
value: "sketch",
label: "Sketch Templates"
},
{
value: "jiaohu",
label: "组件交互文档"
}
]
}
];
options.list = list;
options.copyTimes = 1000;
const mock = mockUtil.buildMock(options);
mock.push({
path: "/select/cascadeData",
method: "get",
handle(req) {
return {
code: 0,
msg: "success",
data: dictData
};
}
});
export default mock;
@@ -8,7 +8,9 @@
</div>
<p class="d2-page-cover__sub-title">面向配置的crud编程快速开发crud功能</p>
<div class="exampleBox">
<div class="left"></div>
<div class="left">
<fs-highlight :code="helper.crud" lang="javascript" />
</div>
<div class="icon">
<fs-icon :icon="$fsui.icons.arrowRight" />
</div>