-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
503 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { requestForMock } from "/src/api/service"; | ||
const request = requestForMock; | ||
const apiPrefix = "/DebugSelect"; | ||
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 } | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import * as api from "./api"; | ||
import { requestForMock } from "/src/api/service"; | ||
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); | ||
}; | ||
let dict1 = dict({ | ||
url: "/dicts/OpenStatusEnum?simple" | ||
}); | ||
dict1.loadDict(); | ||
return { | ||
crudOptions: { | ||
request: { | ||
pageRequest, | ||
addRequest, | ||
editRequest, | ||
delRequest | ||
}, | ||
form: { | ||
// 单列布局 | ||
col: { span: 24 }, | ||
labelCol: { span: 4 }, | ||
wrapperCol: { span: 18 } | ||
}, | ||
columns: { | ||
id: { | ||
title: "ID", | ||
key: "id", | ||
type: "number", | ||
column: { | ||
width: 50 | ||
}, | ||
form: { | ||
show: false | ||
} | ||
}, | ||
|
||
statusRemote: { | ||
title: "单选远程", | ||
search: { | ||
show: true | ||
}, | ||
type: "dict-select", | ||
dict: dict1, | ||
form: { | ||
rules: [{ required: true, message: "请选择一个选项" }] | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<template> | ||
<fs-crud ref="crudRef" v-bind="crudBinding" /> | ||
</template> | ||
|
||
<script> | ||
import { defineComponent, ref, onMounted } from "vue"; | ||
import { useCrud } from "@fast-crud/fast-crud"; | ||
import createCrudOptions from "./crud"; | ||
import { useExpose } from "@fast-crud/fast-crud"; | ||
export default defineComponent({ | ||
name: "DebugSelect", | ||
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) | ||
// 页面打开后获取列表数据 | ||
onMounted(() => { | ||
expose.doRefresh(); | ||
}); | ||
return { | ||
crudBinding, | ||
crudRef | ||
}; | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import mockUtil from "/src/mock/base"; | ||
const options = { | ||
name: "DebugSelect", | ||
idGenerator: 0 | ||
}; | ||
const list = []; | ||
options.list = list; | ||
const mock = mockUtil.buildMock(options); | ||
export default mock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.