mirror of https://github.com/certd/certd
🔱: [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无法上传视频的bugpull/14/head
parent
f344c58f26
commit
6ec697b010
|
@ -3,6 +3,22 @@
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
# [1.11.0](https://github.com/fast-crud/fast-crud/compare/v1.10.0...v1.11.0) (2023-03-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* 修复wangeditor无法上传视频的bug ([53ee51e](https://github.com/fast-crud/fast-crud/commit/53ee51e901956da9596600235632545bcf98746e))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* 全面ts化 ([168d3a2](https://github.com/fast-crud/fast-crud/commit/168d3a240eb67548195c31a5fa4cb5aedb8a410c))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [1.10.0](https://github.com/fast-crud/fast-crud/compare/v1.9.2...v1.10.0) (2023-03-11)
|
# [1.10.0](https://github.com/fast-crud/fast-crud/compare/v1.9.2...v1.10.0) (2023-03-11)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@fast-crud/fs-admin-antdv",
|
"name": "@fast-crud/fs-admin-antdv",
|
||||||
"version": "1.10.0",
|
"version": "1.11.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
"debug": "vite --mode debug",
|
"debug": "vite --mode debug",
|
||||||
"debug:pm": "vite --mode debugpm",
|
"debug:pm": "vite --mode debugpm",
|
||||||
"debug:force": "vite --force --mode debug",
|
"debug:force": "vite --force --mode debug",
|
||||||
"build": "vite build ",
|
"build": "npm run tsc && vite build ",
|
||||||
"serve": "vite preview",
|
"serve": "vite preview",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"pretty-quick": "pretty-quick",
|
"pretty-quick": "pretty-quick",
|
||||||
|
@ -22,13 +22,13 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ant-design/colors": "^7.0.0",
|
"@ant-design/colors": "^7.0.0",
|
||||||
"@ant-design/icons-vue": "^6.1.0",
|
"@ant-design/icons-vue": "^6.1.0",
|
||||||
"@aws-sdk/client-s3": "^3.288.0",
|
"@aws-sdk/client-s3": "^3.292.0",
|
||||||
"@aws-sdk/s3-request-presigner": "^3.288.0",
|
"@aws-sdk/s3-request-presigner": "^3.292.0",
|
||||||
"@fast-crud/fast-crud": "^1.10.0",
|
"@fast-crud/fast-crud": "^1.11.0",
|
||||||
"@fast-crud/fast-extends": "^1.10.0",
|
"@fast-crud/fast-extends": "^1.11.0",
|
||||||
"@fast-crud/ui-antdv": "^1.10.0",
|
"@fast-crud/ui-antdv": "^1.11.0",
|
||||||
"@iconify/iconify": "^3.1.0",
|
"@iconify/iconify": "^3.1.0",
|
||||||
"@iconify/json": "^2.2.32",
|
"@iconify/json": "^2.2.35",
|
||||||
"@purge-icons/generated": "^0.9.0",
|
"@purge-icons/generated": "^0.9.0",
|
||||||
"@soerenmartius/vue3-clipboard": "^0.1.2",
|
"@soerenmartius/vue3-clipboard": "^0.1.2",
|
||||||
"ant-design-vue": "^3.2.15",
|
"ant-design-vue": "^3.2.15",
|
||||||
|
@ -37,11 +37,10 @@
|
||||||
"base64-js": "^1.5.1",
|
"base64-js": "^1.5.1",
|
||||||
"better-scroll": "^2.5.0",
|
"better-scroll": "^2.5.0",
|
||||||
"china-division": "^2.6.0",
|
"china-division": "^2.6.0",
|
||||||
"core-js": "^3.29.0",
|
"core-js": "^3.29.1",
|
||||||
"cos-js-sdk-v5": "^1.4.16",
|
"cos-js-sdk-v5": "^1.4.16",
|
||||||
"cropperjs": "^1.5.13",
|
"cropperjs": "^1.5.13",
|
||||||
"dayjs": "^1.11.7",
|
"dayjs": "^1.11.7",
|
||||||
"deepdash-es": "5.3.5",
|
|
||||||
"highlight.js": "^11.7.0",
|
"highlight.js": "^11.7.0",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"mitt": "^3.0.0",
|
"mitt": "^3.0.0",
|
||||||
|
@ -60,22 +59,22 @@
|
||||||
"@rollup/plugin-commonjs": "^24.0.1",
|
"@rollup/plugin-commonjs": "^24.0.1",
|
||||||
"@rollup/plugin-node-resolve": "^15.0.1",
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
||||||
"@types/chai": "^4.3.4",
|
"@types/chai": "^4.3.4",
|
||||||
"@types/lodash-es": "^4.17.6",
|
"@types/lodash-es": "^4.17.7",
|
||||||
"@types/mocha": "^10.0.1",
|
"@types/mocha": "^10.0.1",
|
||||||
"@types/node": "^18.14.6",
|
"@types/node": "^18.15.3",
|
||||||
"@types/nprogress": "^0.2.0",
|
"@types/nprogress": "^0.2.0",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.54.1",
|
"@typescript-eslint/eslint-plugin": "^5.55.0",
|
||||||
"@typescript-eslint/parser": "^5.54.1",
|
"@typescript-eslint/parser": "^5.55.0",
|
||||||
"@vitejs/plugin-legacy": "^4.0.1",
|
"@vitejs/plugin-legacy": "^4.0.2",
|
||||||
"@vitejs/plugin-vue": "^4.0.0",
|
"@vitejs/plugin-vue": "^4.1.0",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
"@vitejs/plugin-vue-jsx": "^3.0.0",
|
||||||
"@vue/compiler-sfc": "^3.2.47",
|
"@vue/compiler-sfc": "^3.2.47",
|
||||||
"@vue/eslint-config-typescript": "^11.0.2",
|
"@vue/eslint-config-typescript": "^11.0.2",
|
||||||
"@vue/test-utils": "^2.3.1",
|
"@vue/test-utils": "^2.3.1",
|
||||||
"autoprefixer": "^10.4.13",
|
"autoprefixer": "^10.4.14",
|
||||||
"caller-path": "^4.0.0",
|
"caller-path": "^4.0.0",
|
||||||
"chai": "^4.3.7",
|
"chai": "^4.3.7",
|
||||||
"eslint": "8.35.0",
|
"eslint": "8.36.0",
|
||||||
"eslint-config-prettier": "^8.7.0",
|
"eslint-config-prettier": "^8.7.0",
|
||||||
"eslint-plugin-import": "^2.27.5",
|
"eslint-plugin-import": "^2.27.5",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
|
@ -86,21 +85,22 @@
|
||||||
"husky": "^8.0.3",
|
"husky": "^8.0.3",
|
||||||
"less": "^4.1.3",
|
"less": "^4.1.3",
|
||||||
"less-loader": "^11.1.0",
|
"less-loader": "^11.1.0",
|
||||||
"lint-staged": "^13.1.2",
|
"lint-staged": "^13.2.0",
|
||||||
"postcss": "^8.4.21",
|
"postcss": "^8.4.21",
|
||||||
"prettier": "2.8.4",
|
"prettier": "2.8.4",
|
||||||
"pretty-quick": "^3.1.3",
|
"pretty-quick": "^3.1.3",
|
||||||
"rimraf": "^4.4.0",
|
"rimraf": "^4.4.0",
|
||||||
"rollup": "^3.18.0",
|
"rollup": "^3.19.1",
|
||||||
"rollup-plugin-visualizer": "^5.9.0",
|
"rollup-plugin-visualizer": "^5.9.0",
|
||||||
"stylelint": "^15.2.0",
|
"stylelint": "^15.2.0",
|
||||||
"stylelint-config-prettier": "^9.0.5",
|
"stylelint-config-prettier": "^9.0.5",
|
||||||
"stylelint-order": "^6.0.3",
|
"stylelint-order": "^6.0.3",
|
||||||
"tailwindcss": "^3.2.7",
|
"tailwindcss": "^3.2.7",
|
||||||
|
"terser": "^5.16.6",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "4.9.5",
|
"typescript": "4.9.5",
|
||||||
"unplugin-vue-define-options": "^1.2.3",
|
"unplugin-vue-define-options": "^1.2.4",
|
||||||
"vite": "^4.1.4",
|
"vite": "^4.2.0",
|
||||||
"vite-plugin-compression": "^0.5.1",
|
"vite-plugin-compression": "^0.5.1",
|
||||||
"vite-plugin-optimize-persist": "^0.1.2",
|
"vite-plugin-optimize-persist": "^0.1.2",
|
||||||
"vite-plugin-package-config": "^0.1.1",
|
"vite-plugin-package-config": "^0.1.1",
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
</a-config-provider>
|
</a-config-provider>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import zhCN from "ant-design-vue/es/locale/zh_CN";
|
import zhCN from "ant-design-vue/es/locale/zh_CN";
|
||||||
import enUS from "ant-design-vue/es/locale/en_US";
|
import enUS from "ant-design-vue/es/locale/en_US";
|
||||||
import { provide, ref, nextTick } from "vue";
|
import { provide, ref, nextTick } from "vue";
|
||||||
|
@ -25,7 +25,7 @@ export default {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
routerEnabled.value = true;
|
routerEnabled.value = true;
|
||||||
}
|
}
|
||||||
function localeChanged(value) {
|
function localeChanged(value: any) {
|
||||||
console.log("locale changed:", value);
|
console.log("locale changed:", value);
|
||||||
if (value === "zh-cn") {
|
if (value === "zh-cn") {
|
||||||
locale.value = zhCN;
|
locale.value = zhCN;
|
||||||
|
|
|
@ -106,8 +106,8 @@ function createService() {
|
||||||
* @description 创建请求方法
|
* @description 创建请求方法
|
||||||
* @param {Object} service axios 实例
|
* @param {Object} service axios 实例
|
||||||
*/
|
*/
|
||||||
function createRequestFunction(service) {
|
function createRequestFunction(service: any) {
|
||||||
return function (config) {
|
return function (config: any) {
|
||||||
const configDefault = {
|
const configDefault = {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": get(config, "headers.Content-Type", "application/json")
|
"Content-Type": get(config, "headers.Content-Type", "application/json")
|
||||||
|
|
|
@ -48,7 +48,7 @@ export function responseError(data = {}, msg = "请求失败", code = 500) {
|
||||||
* @description 记录和显示错误
|
* @description 记录和显示错误
|
||||||
* @param {Error} error 错误对象
|
* @param {Error} error 错误对象
|
||||||
*/
|
*/
|
||||||
export function errorLog(error) {
|
export function errorLog(error: any) {
|
||||||
// 打印到控制台
|
// 打印到控制台
|
||||||
console.error(error);
|
console.error(error);
|
||||||
// 显示提示
|
// 显示提示
|
||||||
|
@ -59,7 +59,7 @@ export function errorLog(error) {
|
||||||
* @description 创建一个错误
|
* @description 创建一个错误
|
||||||
* @param {String} msg 错误信息
|
* @param {String} msg 错误信息
|
||||||
*/
|
*/
|
||||||
export function errorCreate(msg) {
|
export function errorCreate(msg: any) {
|
||||||
const error = new Error(msg);
|
const error = new Error(msg);
|
||||||
errorLog(error);
|
errorLog(error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
<pre class="fs-highlight hljs" v-html="highlightHTML"></pre>
|
<pre class="fs-highlight hljs" v-html="highlightHTMLRef"></pre>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
// 相关文档
|
// 相关文档
|
||||||
// https://highlightjs.org/usage/
|
// https://highlightjs.org/usage/
|
||||||
// http://highlightjs.readthedocs.io/en/latest/api.html#configure-options
|
// http://highlightjs.readthedocs.io/en/latest/api.html#configure-options
|
||||||
import highlight from "highlight.js";
|
import highlight from "highlight.js";
|
||||||
|
import { ref, watch } from "vue";
|
||||||
|
import { defineComponent, Ref } from "vue";
|
||||||
import "../highlight-styles/github-gist.css";
|
import "../highlight-styles/github-gist.css";
|
||||||
import htmlFormat from "./libs/htmlFormat";
|
//@ts-ignore
|
||||||
export default {
|
import htmlFormat from "./libs/htmlFormat.js";
|
||||||
|
export default defineComponent({
|
||||||
name: "FsHighlight",
|
name: "FsHighlight",
|
||||||
props: {
|
props: {
|
||||||
code: {
|
code: {
|
||||||
|
@ -28,34 +31,31 @@ export default {
|
||||||
default: ""
|
default: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
setup(props: any, ctx: any) {
|
||||||
|
const highlightHTMLRef: Ref = ref("");
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => {
|
||||||
|
return props.code;
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
doHighlight();
|
||||||
|
},
|
||||||
|
{
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function doHighlight() {
|
||||||
|
const code = props.formatHtml ? htmlFormat(props.code) : props.code;
|
||||||
|
highlightHTMLRef.value = (highlight as any).highlightAuto(code, [props.lang, "html", "javascript", "json", "css", "scss", "less"]).value;
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
highlightHTML: ""
|
highlightHTMLRef,
|
||||||
|
doHighlight
|
||||||
};
|
};
|
||||||
},
|
|
||||||
watch: {
|
|
||||||
code() {
|
|
||||||
this.highlight();
|
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
mounted() {
|
|
||||||
this.highlight();
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
highlight() {
|
|
||||||
const code = this.formatHtml ? htmlFormat(this.code) : this.code;
|
|
||||||
this.highlightHTML = highlight.highlightAuto(code, [
|
|
||||||
this.lang,
|
|
||||||
"html",
|
|
||||||
"javascript",
|
|
||||||
"json",
|
|
||||||
"css",
|
|
||||||
"scss",
|
|
||||||
"less"
|
|
||||||
]).value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { defineAsyncComponent } from "vue";
|
import { defineAsyncComponent } from "vue";
|
||||||
const AsyncHighLight = defineAsyncComponent(() => import("./highlight/index.vue"));
|
const AsyncHighLight = defineAsyncComponent(() => import("./highlight/index.vue"));
|
||||||
export default {
|
export default {
|
||||||
install(app) {
|
install(app: any) {
|
||||||
app.component("FsHighlight", AsyncHighLight);
|
app.component("FsHighlight", AsyncHighLight);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { createI18n } from "vue-i18n";
|
import { createI18n } from "vue-i18n";
|
||||||
//
|
//@ts-ignore
|
||||||
import enFsLocale from "@fast-crud/fast-crud/dist/locale/lang/en.js";
|
import enFsLocale from "@fast-crud/fast-crud/dist/locale/lang/en.js";
|
||||||
|
//@ts-ignore
|
||||||
import zhFsLocale from "@fast-crud/fast-crud/dist/locale/lang/zh-cn.js";
|
import zhFsLocale from "@fast-crud/fast-crud/dist/locale/lang/zh-cn.js";
|
||||||
import en from "./locale/en";
|
import en from "./locale/en";
|
||||||
import zh from "./locale/zh_CN";
|
import zh from "./locale/zh_CN";
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
<template>
|
|
||||||
<div class="fs-contentmenu-list" @click="rowClick">
|
|
||||||
<div
|
|
||||||
v-for="item in menulist"
|
|
||||||
:key="item.value"
|
|
||||||
:data-value="item.value"
|
|
||||||
class="fs-contentmenu-item"
|
|
||||||
flex="cross:center main:center"
|
|
||||||
>
|
|
||||||
<d2-icon v-if="item.icon" :name="item.icon" />
|
|
||||||
<div class="fs-contentmenu-item-title" flex-box="1">
|
|
||||||
{{ item.title }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: "FsContextmenuList",
|
|
||||||
props: {
|
|
||||||
menulist: {
|
|
||||||
type: Array,
|
|
||||||
default: () => []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
rowClick(event) {
|
|
||||||
let target = event.target;
|
|
||||||
while (!target.dataset.value) {
|
|
||||||
target = target.parentNode;
|
|
||||||
}
|
|
||||||
this.$emit("rowClick", target.dataset.value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less">
|
|
||||||
.fs-contentmenu-list {
|
|
||||||
.fs-contentmenu-item {
|
|
||||||
padding: 8px 20px 8px 15px;
|
|
||||||
margin: 0;
|
|
||||||
font-size: 14px;
|
|
||||||
color: #606266;
|
|
||||||
cursor: pointer;
|
|
||||||
&:hover {
|
|
||||||
background: #ecf5ff;
|
|
||||||
color: #66b1ff;
|
|
||||||
}
|
|
||||||
.fs-contentmenu-item-title {
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,68 +0,0 @@
|
||||||
<template>
|
|
||||||
<div v-show="flag" class="fs-contextmenu" :style="style">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: "FsContextmenu",
|
|
||||||
props: {
|
|
||||||
visible: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false
|
|
||||||
},
|
|
||||||
x: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
type: Number,
|
|
||||||
default: 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
flag: {
|
|
||||||
get() {
|
|
||||||
if (this.visible) {
|
|
||||||
// 注册全局监听事件 [ 目前只考虑鼠标解除触发 ]
|
|
||||||
window.addEventListener("mousedown", this.watchContextmenu);
|
|
||||||
}
|
|
||||||
return this.visible;
|
|
||||||
},
|
|
||||||
set(newVal) {
|
|
||||||
this.$emit("update:visible", newVal);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
style() {
|
|
||||||
return {
|
|
||||||
left: this.x + "px",
|
|
||||||
top: this.y + "px",
|
|
||||||
display: this.visible ? "block" : "none "
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
// 将菜单放置到body下
|
|
||||||
document.querySelector("body").appendChild(this.$el);
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
watchContextmenu(event) {
|
|
||||||
if (!this.$el.contains(event.target) || event.button !== 0) this.flag = false;
|
|
||||||
window.removeEventListener("mousedown", this.watchContextmenu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.fs-contextmenu {
|
|
||||||
position: absolute;
|
|
||||||
padding: 5px 0;
|
|
||||||
z-index: 2018;
|
|
||||||
background: #fff;
|
|
||||||
border: 1px solid #cfd7e5;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -19,7 +19,7 @@
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import i18n from "../../../i18n";
|
import i18n from "../../../i18n";
|
||||||
import { computed, inject } from "vue";
|
import { computed, inject } from "vue";
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
|
@ -27,8 +27,8 @@ export default {
|
||||||
name: "FsLocale",
|
name: "FsLocale",
|
||||||
setup() {
|
setup() {
|
||||||
const languages = computed(() => {
|
const languages = computed(() => {
|
||||||
const map = i18n.global.messages?.value || {};
|
const map: any = i18n.global.messages?.value || {};
|
||||||
const list = [];
|
const list: any = [];
|
||||||
_.forEach(map, (item, key) => {
|
_.forEach(map, (item, key) => {
|
||||||
list.push({
|
list.push({
|
||||||
key,
|
key,
|
||||||
|
@ -41,12 +41,12 @@ export default {
|
||||||
return i18n.global.locale.value;
|
return i18n.global.locale.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
const routerReload = inject("fn:router.reload");
|
const routerReload: any = inject("fn:router.reload");
|
||||||
const localeChanged = inject("fn:locale.changed");
|
const localeChanged: any = inject("fn:locale.changed");
|
||||||
const changeLocale = (change) => {
|
const changeLocale = (change: any) => {
|
||||||
i18n.global.locale.value = change.key;
|
i18n.global.locale.value = change.key;
|
||||||
routerReload();
|
routerReload();
|
||||||
localeChanged(change.key)
|
localeChanged(change.key);
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
languages,
|
languages,
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
import { ref, watch, onMounted, onUnmounted, resolveComponent, nextTick, defineComponent } from "vue";
|
import { ref, watch, onMounted, onUnmounted, resolveComponent, nextTick, defineComponent } from "vue";
|
||||||
import getEachDeep from "deepdash-es/getEachDeep";
|
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
import BScroll from "better-scroll";
|
import BScroll from "better-scroll";
|
||||||
import "./index.less";
|
import "./index.less";
|
||||||
const eachDeep = getEachDeep(_);
|
import { utils } from "@fast-crud/fast-crud";
|
||||||
|
|
||||||
function useBetterScroll(enabled = true) {
|
function useBetterScroll(enabled = true) {
|
||||||
let bsRef = ref(null);
|
const bsRef = ref(null);
|
||||||
let asideMenuRef = ref();
|
const asideMenuRef = ref();
|
||||||
|
|
||||||
let onOpenChange = () => {};
|
let onOpenChange = () => {};
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
@ -71,7 +70,7 @@ export default defineComponent({
|
||||||
scroll: {}
|
scroll: {}
|
||||||
},
|
},
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
async function open(path) {
|
async function open(path: any) {
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -90,23 +89,24 @@ export default defineComponent({
|
||||||
console.error("导航失败", e);
|
console.error("导航失败", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function onSelect(item) {
|
function onSelect(item: any) {
|
||||||
open(item.key);
|
open(item.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
const FsIcon = resolveComponent("FsIcon");
|
const fsIcon = resolveComponent("FsIcon");
|
||||||
|
|
||||||
const buildMenus = (children) => {
|
const buildMenus = (children: any) => {
|
||||||
const slots = [];
|
const slots: any = [];
|
||||||
if (children == null) {
|
if (children == null) {
|
||||||
return slots;
|
return slots;
|
||||||
}
|
}
|
||||||
for (let sub of children) {
|
for (const sub of children) {
|
||||||
const title = () => {
|
const title: any = () => {
|
||||||
if (sub?.meta?.icon) {
|
if (sub?.meta?.icon) {
|
||||||
|
// @ts-ignore
|
||||||
return (
|
return (
|
||||||
<div class={"menu-item-title"}>
|
<div class={"menu-item-title"}>
|
||||||
<FsIcon class={"anticon"} icon={sub.meta.icon} />
|
<fsIcon class={"anticon"} icon={sub.meta.icon} />
|
||||||
<span>{sub.title}</span>
|
<span>{sub.title}</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -147,16 +147,16 @@ export default defineComponent({
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
function openSelectedParents(fullPath) {
|
function openSelectedParents(fullPath: any) {
|
||||||
if (!props.expandSelected) {
|
if (!props.expandSelected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (props.menus == null) {
|
if (props.menus == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const keys = [];
|
const keys: any = [];
|
||||||
let changed = false;
|
let changed = false;
|
||||||
eachDeep(props.menus, (value, key, parent, context) => {
|
utils.deepdash.forEachDeep(props.menus, (value: any, key: any, parent: any, context: any) => {
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (keys.length > 0) {
|
if (keys.length > 0) {
|
||||||
for (let key of keys) {
|
for (const key of keys) {
|
||||||
if (openKeys.value.indexOf(key) === -1) {
|
if (openKeys.value.indexOf(key) === -1) {
|
||||||
openKeys.value.push(key);
|
openKeys.value.push(key);
|
||||||
changed = true;
|
changed = true;
|
||||||
|
@ -180,7 +180,7 @@ export default defineComponent({
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { asideMenuRef, onOpenChange } = useBetterScroll(props.scroll);
|
const { asideMenuRef, onOpenChange } = useBetterScroll(props.scroll as any);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => {
|
() => {
|
|
@ -5,7 +5,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, watch } from "vue";
|
import { defineComponent, ref, watch } from "vue";
|
||||||
import { useRoute, useRouter } from "vue-router";
|
import { useRoute, useRouter } from "vue-router";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -23,7 +23,7 @@ export default defineComponent({
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
const middle = "/fast-crud/fs-admin-antdv/tree/main/src/views";
|
const middle = "/fast-crud/fs-admin-antdv/tree/main/src/views";
|
||||||
function goSource(prefix) {
|
function goSource(prefix: any) {
|
||||||
const path = router.currentRoute.value.fullPath;
|
const path = router.currentRoute.value.fullPath;
|
||||||
window.open(prefix + middle + path + "/index.vue");
|
window.open(prefix + middle + path + "/index.vue");
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,22 +2,8 @@
|
||||||
<div class="fs-multiple-page-control-group">
|
<div class="fs-multiple-page-control-group">
|
||||||
<div class="fs-multiple-page-control-content">
|
<div class="fs-multiple-page-control-content">
|
||||||
<div class="fs-multiple-page-control-content-inner">
|
<div class="fs-multiple-page-control-content-inner">
|
||||||
<a-tabs
|
<a-tabs class="fs-multiple-page-control fs-multiple-page-sort" :active-key="page.getCurrent" type="editable-card" hide-add @tabClick="handleClick" @edit="handleTabEdit">
|
||||||
class="fs-multiple-page-control fs-multiple-page-sort"
|
<a-tab-pane v-for="item in page.getOpened" :key="item.fullPath" :tab="item.meta?.title || '未命名'" :name="item.fullPath" :closable="isTabClosable(item)" />
|
||||||
:active-key="page.getCurrent"
|
|
||||||
type="editable-card"
|
|
||||||
hide-add
|
|
||||||
@tabClick="handleClick"
|
|
||||||
@edit="handleTabEdit"
|
|
||||||
@contextmenu="handleContextmenu"
|
|
||||||
>
|
|
||||||
<a-tab-pane
|
|
||||||
v-for="item in page.getOpened"
|
|
||||||
:key="item.fullPath"
|
|
||||||
:tab="item.meta?.title || '未命名'"
|
|
||||||
:name="item.fullPath"
|
|
||||||
:closable="isTabClosable(item)"
|
|
||||||
/>
|
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
<!-- <fs-contextmenu v-model:visible="contextmenuFlag" :x="contentmenuX" :y="contentmenuY">-->
|
<!-- <fs-contextmenu v-model:visible="contextmenuFlag" :x="contentmenuX" :y="contentmenuY">-->
|
||||||
<!-- <fs-contextmenu-list-->
|
<!-- <fs-contextmenu-list-->
|
||||||
|
@ -33,7 +19,7 @@
|
||||||
<span class="iconify" data-icon="ion:close-circle" data-inline="false"></span>
|
<span class="iconify" data-icon="ion:close-circle" data-inline="false"></span>
|
||||||
<template #icon><DownOutlined /></template>
|
<template #icon><DownOutlined /></template>
|
||||||
<template #overlay>
|
<template #overlay>
|
||||||
<a-menu @click="(command) => handleControlItemClick(command)">
|
<a-menu @click="(command:any) => handleControlItemClick(command)">
|
||||||
<a-menu-item key="left">
|
<a-menu-item key="left">
|
||||||
<fs-icon name="arrow-left" class="fs-mr-10" />
|
<fs-icon name="arrow-left" class="fs-mr-10" />
|
||||||
关闭左侧
|
关闭左侧
|
||||||
|
@ -57,8 +43,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import Sortable from "sortablejs";
|
|
||||||
import { usePageStore } from "../../../store/modules/page";
|
import { usePageStore } from "../../../store/modules/page";
|
||||||
import { computed } from "vue";
|
import { computed } from "vue";
|
||||||
export default {
|
export default {
|
||||||
|
@ -119,14 +104,14 @@ export default {
|
||||||
* @description 计算某个标签页是否可关闭
|
* @description 计算某个标签页是否可关闭
|
||||||
* @param {Object} page 其中一个标签页
|
* @param {Object} page 其中一个标签页
|
||||||
*/
|
*/
|
||||||
isTabClosable(page) {
|
isTabClosable(page: any) {
|
||||||
return page.name !== "index";
|
return page.name !== "index";
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* @description 右键菜单功能点击
|
* @description 右键菜单功能点击
|
||||||
* @param {Object} event 事件
|
* @param {Object} event 事件
|
||||||
*/
|
*/
|
||||||
handleContextmenu(event) {
|
handleContextmenu(event: any) {
|
||||||
let target = event.target;
|
let target = event.target;
|
||||||
// fix https://github.com/fs-projects/fs-admin/issues/54
|
// fix https://github.com/fs-projects/fs-admin/issues/54
|
||||||
let flag = false;
|
let flag = false;
|
||||||
|
@ -148,7 +133,7 @@ export default {
|
||||||
* @description 右键菜单的 row-click 事件
|
* @description 右键菜单的 row-click 事件
|
||||||
* @param {String} command 事件类型
|
* @param {String} command 事件类型
|
||||||
*/
|
*/
|
||||||
contextmenuClick(command) {
|
contextmenuClick(command: any) {
|
||||||
this.handleControlItemClick(command, this.tagName);
|
this.handleControlItemClick(command, this.tagName);
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
|
@ -156,7 +141,7 @@ export default {
|
||||||
* @param {String} command 事件类型
|
* @param {String} command 事件类型
|
||||||
* @param {String} tagName tab 名称
|
* @param {String} tagName tab 名称
|
||||||
*/
|
*/
|
||||||
handleControlItemClick(command, tagName = null) {
|
handleControlItemClick(command: any, tagName: any = null) {
|
||||||
//if (tagName) this.contextmenuFlag = false;
|
//if (tagName) this.contextmenuFlag = false;
|
||||||
const params = { pageSelect: tagName };
|
const params = { pageSelect: tagName };
|
||||||
switch (command.key) {
|
switch (command.key) {
|
||||||
|
@ -182,9 +167,9 @@ export default {
|
||||||
* @param {object} tab 标签
|
* @param {object} tab 标签
|
||||||
* @param {object} event 事件
|
* @param {object} event 事件
|
||||||
*/
|
*/
|
||||||
handleClick(tab) {
|
handleClick(tab: any) {
|
||||||
// 找到点击的页面在 tag 列表里是哪个
|
// 找到点击的页面在 tag 列表里是哪个
|
||||||
const page = this.page.getOpened.find((page) => page.fullPath === tab);
|
const page = this.page.getOpened.find((page: any) => page.fullPath === tab);
|
||||||
if (page) {
|
if (page) {
|
||||||
const { name, params, query } = page;
|
const { name, params, query } = page;
|
||||||
this.$router.push({ name, params, query });
|
this.$router.push({ name, params, query });
|
||||||
|
@ -194,12 +179,12 @@ export default {
|
||||||
* @description 点击 tab 上的删除按钮触发这里
|
* @description 点击 tab 上的删除按钮触发这里
|
||||||
* @param {String} tagName tab 名称
|
* @param {String} tagName tab 名称
|
||||||
*/
|
*/
|
||||||
handleTabEdit(tagName, action) {
|
handleTabEdit(tagName: any, action: any) {
|
||||||
if (action === "remove") {
|
if (action === "remove") {
|
||||||
this.close({ tagName });
|
this.close({ tagName });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} as any
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref } from "vue";
|
import { defineComponent, ref } from "vue";
|
||||||
const colorListDefine = [
|
const colorListDefine = [
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@ export default defineComponent({
|
||||||
emits: ["change"],
|
emits: ["change"],
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
const colorList = ref(colorListDefine);
|
const colorList = ref(colorListDefine);
|
||||||
function changeColor(color) {
|
function changeColor(color: any) {
|
||||||
ctx.emit("change", color);
|
ctx.emit("change", color);
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,23 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="fs-theme" @click="show()">
|
<div class="fs-theme" @click="show()">
|
||||||
<fs-iconify icon="ion:sparkles-outline" />
|
<fs-iconify icon="ion:sparkles-outline" />
|
||||||
<a-drawer
|
<a-drawer v-model:visible="visible" title="主题设置" placement="right" width="350px" :closable="false" @after-visible-change="afterVisibleChange">
|
||||||
v-model:visible="visible"
|
<fs-theme-color-picker :primary-color="setting.getTheme.primaryColor" @change="setting.setPrimaryColor"></fs-theme-color-picker>
|
||||||
title="主题设置"
|
|
||||||
placement="right"
|
|
||||||
width="350px"
|
|
||||||
:closable="false"
|
|
||||||
@after-visible-change="afterVisibleChange"
|
|
||||||
>
|
|
||||||
<fs-theme-color-picker
|
|
||||||
:primary-color="setting.getTheme.primaryColor"
|
|
||||||
@change="setting.setPrimaryColor"
|
|
||||||
></fs-theme-color-picker>
|
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { ref, defineComponent } from "vue";
|
import { ref, defineComponent } from "vue";
|
||||||
import FsThemeColorPicker from "./color-picker.vue";
|
import FsThemeColorPicker from "./color-picker.vue";
|
||||||
import { useSettingStore } from "/@/store/modules/settings";
|
import { useSettingStore } from "/@/store/modules/settings";
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent } from "vue";
|
import { defineComponent } from "vue";
|
||||||
import { useUserStore } from "/src/store/modules/user";
|
import { useUserStore } from "/src/store/modules/user";
|
||||||
import { Modal } from "ant-design-vue";
|
import { Modal } from "ant-design-vue";
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
</a-layout>
|
</a-layout>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { computed, onErrorCaptured, ref } from "vue";
|
import { computed, onErrorCaptured, ref } from "vue";
|
||||||
import FsMenu from "./components/menu/index.jsx";
|
import FsMenu from "./components/menu/index.jsx";
|
||||||
import FsLocale from "./components/locale/index.vue";
|
import FsLocale from "./components/locale/index.vue";
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script lang="ts">
|
||||||
export default {
|
export default {
|
||||||
name: "LayoutOutside"
|
name: "LayoutOutside"
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
function copyList(originList, newList, options, parentId) {
|
function copyList(originList: any, newList: any, options: any, parentId?: any) {
|
||||||
for (const item of originList) {
|
for (const item of originList) {
|
||||||
const newItem = { ...item, parentId };
|
const newItem = { ...item, parentId };
|
||||||
newItem.id = ++options.idGenerator;
|
newItem.id = ++options.idGenerator;
|
||||||
|
@ -11,7 +11,7 @@ function copyList(originList, newList, options, parentId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function delById(req, list) {
|
function delById(req: any, list: any) {
|
||||||
for (let i = 0; i < list.length; i++) {
|
for (let i = 0; i < list.length; i++) {
|
||||||
const item = list[i];
|
const item = list[i];
|
||||||
console.log("remove i", i, req, req.params.id, item.id);
|
console.log("remove i", i, req, req.params.id, item.id);
|
||||||
|
@ -26,27 +26,27 @@ function delById(req, list) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findById(id, list) {
|
function findById(id: any, list: any) {
|
||||||
for (const item of list) {
|
for (const item of list) {
|
||||||
if (item.id === id) {
|
if (item.id === id) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
if (item.children != null && item.children.length > 0) {
|
if (item.children != null && item.children.length > 0) {
|
||||||
const sub = findById(id, item.children);
|
const sub: any = findById(id, item.children);
|
||||||
if (sub != null) {
|
if (sub != null) {
|
||||||
return sub;
|
return sub;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export default {
|
const mockUtil: any = {
|
||||||
findById,
|
findById,
|
||||||
buildMock(options) {
|
buildMock(options: any) {
|
||||||
const name = options.name;
|
const name = options.name;
|
||||||
if (options.copyTimes == null) {
|
if (options.copyTimes == null) {
|
||||||
options.copyTimes = 29;
|
options.copyTimes = 29;
|
||||||
}
|
}
|
||||||
const list = [];
|
const list: any = [];
|
||||||
for (let i = 0; i < options.copyTimes; i++) {
|
for (let i = 0; i < options.copyTimes; i++) {
|
||||||
copyList(options.list, list, options);
|
copyList(options.list, list, options);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ export default {
|
||||||
{
|
{
|
||||||
path: "/mock/" + name + "/page",
|
path: "/mock/" + name + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
handle(req) {
|
handle(req: any) {
|
||||||
let data = [...list];
|
let data = [...list];
|
||||||
let limit = 20;
|
let limit = 20;
|
||||||
let offset = 0;
|
let offset = 0;
|
||||||
|
@ -65,7 +65,7 @@ export default {
|
||||||
item.lazy = false;
|
item.lazy = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let orderProp, orderAsc;
|
let orderProp: any, orderAsc: any;
|
||||||
if (req && req.body) {
|
if (req && req.body) {
|
||||||
const { page, query, sort } = req.body;
|
const { page, query, sort } = req.body;
|
||||||
if (page.limit != null) {
|
if (page.limit != null) {
|
||||||
|
@ -78,7 +78,7 @@ export default {
|
||||||
orderAsc = sort.asc;
|
orderAsc = sort.asc;
|
||||||
|
|
||||||
if (Object.keys(query).length > 0) {
|
if (Object.keys(query).length > 0) {
|
||||||
data = list.filter((item) => {
|
data = list.filter((item: any) => {
|
||||||
let allFound = true; // 是否所有条件都符合
|
let allFound = true; // 是否所有条件都符合
|
||||||
for (const key in query) {
|
for (const key in query) {
|
||||||
// 判定某一个条件
|
// 判定某一个条件
|
||||||
|
@ -169,7 +169,7 @@ export default {
|
||||||
{
|
{
|
||||||
path: "/mock/" + name + "/get",
|
path: "/mock/" + name + "/get",
|
||||||
method: "get",
|
method: "get",
|
||||||
handle(req) {
|
handle(req: any) {
|
||||||
let id = req.params.id;
|
let id = req.params.id;
|
||||||
id = parseInt(id);
|
id = parseInt(id);
|
||||||
let current = null;
|
let current = null;
|
||||||
|
@ -189,7 +189,7 @@ export default {
|
||||||
{
|
{
|
||||||
path: "/mock/" + name + "/add",
|
path: "/mock/" + name + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
handle(req) {
|
handle(req: any) {
|
||||||
req.body.id = ++options.idGenerator;
|
req.body.id = ++options.idGenerator;
|
||||||
list.unshift(req.body);
|
list.unshift(req.body);
|
||||||
return {
|
return {
|
||||||
|
@ -202,7 +202,7 @@ export default {
|
||||||
{
|
{
|
||||||
path: "/mock/" + name + "/update",
|
path: "/mock/" + name + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
handle(req) {
|
handle(req: any): any {
|
||||||
const item = findById(req.body.id, list);
|
const item = findById(req.body.id, list);
|
||||||
if (item) {
|
if (item) {
|
||||||
_.mergeWith(item, req.body, (objValue, srcValue) => {
|
_.mergeWith(item, req.body, (objValue, srcValue) => {
|
||||||
|
@ -225,7 +225,7 @@ export default {
|
||||||
{
|
{
|
||||||
path: "/mock/" + name + "/delete",
|
path: "/mock/" + name + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
handle(req) {
|
handle(req: any): any {
|
||||||
delById(req, list);
|
delById(req, list);
|
||||||
return {
|
return {
|
||||||
code: 0,
|
code: 0,
|
||||||
|
@ -237,7 +237,7 @@ export default {
|
||||||
{
|
{
|
||||||
path: "/mock/" + name + "/batchDelete",
|
path: "/mock/" + name + "/batchDelete",
|
||||||
method: "post",
|
method: "post",
|
||||||
handle(req) {
|
handle(req: any): any {
|
||||||
const ids = req.body.ids;
|
const ids = req.body.ids;
|
||||||
for (let i = list.length - 1; i >= 0; i--) {
|
for (let i = list.length - 1; i >= 0; i--) {
|
||||||
const item = list[i];
|
const item = list[i];
|
||||||
|
@ -255,7 +255,7 @@ export default {
|
||||||
{
|
{
|
||||||
path: "/mock/" + name + "/delete",
|
path: "/mock/" + name + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
handle(req) {
|
handle(req: any): any {
|
||||||
delById(req, list);
|
delById(req, list);
|
||||||
return {
|
return {
|
||||||
code: 0,
|
code: 0,
|
||||||
|
@ -267,7 +267,7 @@ export default {
|
||||||
{
|
{
|
||||||
path: "/mock/" + name + "/all",
|
path: "/mock/" + name + "/all",
|
||||||
method: "post",
|
method: "post",
|
||||||
handle(req) {
|
handle(req: any): any {
|
||||||
return {
|
return {
|
||||||
code: 0,
|
code: 0,
|
||||||
msg: "success",
|
msg: "success",
|
||||||
|
@ -278,3 +278,5 @@ export default {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default mockUtil;
|
|
@ -1,5 +1,7 @@
|
||||||
import cascaderData from "./cascader-data";
|
import cascaderData from "./cascader-data";
|
||||||
|
// @ts-ignore
|
||||||
import pcaDataLittle from "./pca-data-little";
|
import pcaDataLittle from "./pca-data-little";
|
||||||
|
// @ts-ignore
|
||||||
import { TreeNodesLazyLoader, getPcaData } from "./pcas-data";
|
import { TreeNodesLazyLoader, getPcaData } from "./pcas-data";
|
||||||
|
|
||||||
const openStatus = [
|
const openStatus = [
|
||||||
|
@ -20,11 +22,11 @@ const textStatus = [
|
||||||
{ id: "0", text: "关闭", color: "red" }
|
{ id: "0", text: "关闭", color: "red" }
|
||||||
];
|
];
|
||||||
|
|
||||||
export function GetTreeChildrenByParentId(parentId) {
|
export function GetTreeChildrenByParentId(parentId: any) {
|
||||||
return TreeNodesLazyLoader.getChildren(parentId);
|
return TreeNodesLazyLoader.getChildren(parentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetNodesByValues(values) {
|
export function GetNodesByValues(values: any) {
|
||||||
return TreeNodesLazyLoader.getNodesByValues(values);
|
return TreeNodesLazyLoader.getNodesByValues(values);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +101,7 @@ export default [
|
||||||
{
|
{
|
||||||
path: "/mock/tree/GetTreeChildrenByParentId",
|
path: "/mock/tree/GetTreeChildrenByParentId",
|
||||||
method: "get",
|
method: "get",
|
||||||
async handle({ params }) {
|
async handle({ params }: any) {
|
||||||
const list = await GetTreeChildrenByParentId(params.parentId);
|
const list = await GetTreeChildrenByParentId(params.parentId);
|
||||||
return {
|
return {
|
||||||
code: 0,
|
code: 0,
|
||||||
|
@ -111,7 +113,7 @@ export default [
|
||||||
{
|
{
|
||||||
path: "/mock/tree/GetNodesByValues",
|
path: "/mock/tree/GetNodesByValues",
|
||||||
method: "get",
|
method: "get",
|
||||||
async handle({ params }) {
|
async handle({ params }: any) {
|
||||||
const list = await GetNodesByValues(params.values);
|
const list = await GetNodesByValues(params.values);
|
||||||
return {
|
return {
|
||||||
code: 0,
|
code: 0,
|
|
@ -1,16 +1,18 @@
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
export async function getPcasData() {
|
export async function getPcasData() {
|
||||||
|
// @ts-ignore
|
||||||
const pcasData = () => import("china-division/dist/pcas-code.json");
|
const pcasData = () => import("china-division/dist/pcas-code.json");
|
||||||
const ret = await pcasData();
|
const ret = await pcasData();
|
||||||
return ret.default;
|
return ret.default;
|
||||||
}
|
}
|
||||||
export async function getPcaData() {
|
export async function getPcaData() {
|
||||||
|
// @ts-ignore
|
||||||
const pcaData = () => import("china-division/dist/pca-code.json");
|
const pcaData = () => import("china-division/dist/pca-code.json");
|
||||||
const ret = await pcaData();
|
const ret = await pcaData();
|
||||||
return ret.default;
|
return ret.default;
|
||||||
}
|
}
|
||||||
export const TreeNodesLazyLoader = {
|
export const TreeNodesLazyLoader = {
|
||||||
getNodesByValues(values) {
|
getNodesByValues(values: any) {
|
||||||
console.log("getNodesByValues", values);
|
console.log("getNodesByValues", values);
|
||||||
if (!(values instanceof Array)) {
|
if (!(values instanceof Array)) {
|
||||||
values = [values];
|
values = [values];
|
||||||
|
@ -28,20 +30,20 @@ export const TreeNodesLazyLoader = {
|
||||||
return nodes;
|
return nodes;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getNode(list, value) {
|
getNode(list: any, value: any) {
|
||||||
for (const item of list) {
|
for (const item of list) {
|
||||||
if (item.code === value) {
|
if (item.code === value) {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
if (item.children && item.children.length > 0) {
|
if (item.children && item.children.length > 0) {
|
||||||
const found = this.getNode(item.children, value);
|
const found: any = this.getNode(item.children, value);
|
||||||
if (found) {
|
if (found) {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getChildren(parent) {
|
getChildren(parent: any) {
|
||||||
return getPcasData().then((data) => {
|
return getPcasData().then((data) => {
|
||||||
const list = this.getChildrenByParent(parent, data);
|
const list = this.getChildrenByParent(parent, data);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
|
@ -50,7 +52,7 @@ export const TreeNodesLazyLoader = {
|
||||||
return this.cloneAndDeleteChildren(list);
|
return this.cloneAndDeleteChildren(list);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
getChildrenByParent(parentId, tree) {
|
getChildrenByParent(parentId: any, tree: any) {
|
||||||
if (!parentId) {
|
if (!parentId) {
|
||||||
// 取第一级
|
// 取第一级
|
||||||
return tree;
|
return tree;
|
||||||
|
@ -61,7 +63,7 @@ export const TreeNodesLazyLoader = {
|
||||||
}
|
}
|
||||||
if (node.children && node.children.length > 0) {
|
if (node.children && node.children.length > 0) {
|
||||||
// 递归查找
|
// 递归查找
|
||||||
const list = this.getChildrenByParent(parentId, node.children);
|
const list: any = this.getChildrenByParent(parentId, node.children);
|
||||||
if (list) {
|
if (list) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -69,10 +71,10 @@ export const TreeNodesLazyLoader = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cloneAndDeleteChildren(list) {
|
cloneAndDeleteChildren(list: any) {
|
||||||
const newList = [];
|
const newList = [];
|
||||||
for (const node of list) {
|
for (const node of list) {
|
||||||
const newNode = {};
|
const newNode: any = {};
|
||||||
Object.assign(newNode, node);
|
Object.assign(newNode, node);
|
||||||
if (newNode.children == null || newNode.children.length === 0) {
|
if (newNode.children == null || newNode.children.length === 0) {
|
||||||
newNode.isLeaf = true;
|
newNode.isLeaf = true;
|
|
@ -1,12 +1,15 @@
|
||||||
import { mock } from "../api/service";
|
import { mock } from "../api/service";
|
||||||
import * as tools from "../api/tools";
|
import * as tools from "../api/tools";
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
const commonMocks = import.meta.glob("./common/mock.*.[j|t]s", { eager: true });
|
// @ts-ignore
|
||||||
const apiMocks = import.meta.glob("../api/modules/*.mock.ts", { eager: true });
|
const commonMocks: any = import.meta.glob("./common/mock.*.[j|t]s", { eager: true });
|
||||||
const viewMocks = import.meta.glob("../views/**/mock.[j|t]s", { eager: true });
|
// @ts-ignore
|
||||||
|
const apiMocks: any = import.meta.glob("../api/modules/*.mock.ts", { eager: true });
|
||||||
|
// @ts-ignore
|
||||||
|
const viewMocks: any = import.meta.glob("../views/**/mock.[j|t]s", { eager: true });
|
||||||
|
|
||||||
const list = [];
|
const list: any = [];
|
||||||
_.forEach(commonMocks, (value) => {
|
_.forEach(commonMocks, (value: any) => {
|
||||||
list.push(value.default);
|
list.push(value.default);
|
||||||
});
|
});
|
||||||
_.forEach(apiMocks, (value) => {
|
_.forEach(apiMocks, (value) => {
|
||||||
|
@ -16,7 +19,7 @@ _.forEach(viewMocks, (value) => {
|
||||||
list.push(value.default);
|
list.push(value.default);
|
||||||
});
|
});
|
||||||
|
|
||||||
list.forEach((apiFile) => {
|
list.forEach((apiFile: any) => {
|
||||||
for (const item of apiFile) {
|
for (const item of apiFile) {
|
||||||
mock.onAny(new RegExp(item.path)).reply(async (config) => {
|
mock.onAny(new RegExp(item.path)).reply(async (config) => {
|
||||||
console.log("------------fake request start -------------");
|
console.log("------------fake request start -------------");
|
|
@ -1,13 +1,12 @@
|
||||||
import { request, requestForMock } from "/src/api/service";
|
import { request, requestForMock } from "/src/api/service";
|
||||||
import "/src/mock";
|
import "/src/mock";
|
||||||
import { FastCrud, UseCrudProps, useTypes, setLogger, useColumns, ColumnCompositionProps, MergeColumnPlugin, CrudOptions, TransformQuery, PageQuery, UserPageQuery, UserPageRes, PageRes } from "@fast-crud/fast-crud";
|
import { ColumnCompositionProps, CrudOptions, FastCrud, PageQuery, PageRes, setLogger, TransformResProps, useColumns, UseCrudProps, UserPageQuery, useTypes } from "@fast-crud/fast-crud";
|
||||||
import "@fast-crud/fast-crud/dist/style.css";
|
import "@fast-crud/fast-crud/dist/style.css";
|
||||||
import { FsExtendsUploader, FsExtendsEditor, FsExtendsJson, FsExtendsCopyable, FsExtendsTime } from "@fast-crud/fast-extends";
|
import { FsExtendsCopyable, FsExtendsEditor, FsExtendsJson, FsExtendsTime, FsExtendsUploader } from "@fast-crud/fast-extends";
|
||||||
import "@fast-crud/fast-extends/dist/style.css";
|
import "@fast-crud/fast-extends/dist/style.css";
|
||||||
import UiAntdv from "@fast-crud/ui-antdv";
|
import UiAntdv from "@fast-crud/ui-antdv";
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
import { useCrudPermission } from "../permission";
|
import { useCrudPermission } from "../permission";
|
||||||
import { TransformResProps } from "@fast-crud/fast-crud";
|
|
||||||
import { GetSignedUrl } from "/@/views/crud/component/uploader/s3/api";
|
import { GetSignedUrl } from "/@/views/crud/component/uploader/s3/api";
|
||||||
|
|
||||||
function install(app: any, options: any = {}) {
|
function install(app: any, options: any = {}) {
|
||||||
|
@ -230,7 +229,12 @@ function install(app: any, options: any = {}) {
|
||||||
//安装editor
|
//安装editor
|
||||||
app.use(FsExtendsEditor, {
|
app.use(FsExtendsEditor, {
|
||||||
//编辑器的公共配置
|
//编辑器的公共配置
|
||||||
wangEditor: {}
|
wangEditor: {
|
||||||
|
editorConfig: {
|
||||||
|
MENU_CONF: {}
|
||||||
|
},
|
||||||
|
toolbarConfig: {}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
app.use(FsExtendsJson);
|
app.use(FsExtendsJson);
|
||||||
app.use(FsExtendsTime);
|
app.use(FsExtendsTime);
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
import { usePermission } from "/@/plugin/permission";
|
import { usePermission } from "/@/plugin/permission";
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
|
|
||||||
export type UseCrudPermissionProps = {
|
export type UseCrudPermissionExtraProps = {
|
||||||
permission:
|
hasActionPermission: (action: string) => boolean;
|
||||||
| string
|
};
|
||||||
| {
|
export type UseCrudPermissionExtra = (props: UseCrudPermissionExtraProps) => any;
|
||||||
|
export type UseCrudPermissionCompProps = {
|
||||||
prefix: string;
|
prefix: string;
|
||||||
|
extra?: UseCrudPermissionExtra;
|
||||||
[key: string]: any;
|
[key: string]: any;
|
||||||
};
|
};
|
||||||
|
export type UseCrudPermissionProps = {
|
||||||
|
permission: string | UseCrudPermissionCompProps;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* 设置按钮动作权限
|
* 设置按钮动作权限
|
||||||
|
|
|
@ -49,7 +49,7 @@ router.beforeEach(async (to, from, next) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.afterEach((to) => {
|
router.afterEach((to: any) => {
|
||||||
// 进度条
|
// 进度条
|
||||||
NProgress.done();
|
NProgress.done();
|
||||||
// 多页控制 打开新的页面
|
// 多页控制 打开新的页面
|
||||||
|
|
|
@ -3,11 +3,10 @@ import _ from "lodash-es";
|
||||||
import { outsideResource } from "./source/outside";
|
import { outsideResource } from "./source/outside";
|
||||||
import { headerResource } from "./source/header";
|
import { headerResource } from "./source/header";
|
||||||
import { frameworkResource } from "./source/framework";
|
import { frameworkResource } from "./source/framework";
|
||||||
// @ts-ignore
|
|
||||||
const modules = import.meta.glob("/src/views/**/*.vue");
|
const modules = import.meta.glob("/src/views/**/*.vue");
|
||||||
|
|
||||||
let index = 0;
|
let index = 0;
|
||||||
function transformOneResource(resource) {
|
function transformOneResource(resource: any) {
|
||||||
let menu: any = null;
|
let menu: any = null;
|
||||||
if (resource.meta == null) {
|
if (resource.meta == null) {
|
||||||
resource.meta = {};
|
resource.meta = {};
|
||||||
|
@ -46,7 +45,7 @@ function transformOneResource(resource) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const buildMenusAndRouters = (resources) => {
|
export const buildMenusAndRouters = (resources: any) => {
|
||||||
const routes: Array<any> = [];
|
const routes: Array<any> = [];
|
||||||
const menus: Array<any> = [];
|
const menus: Array<any> = [];
|
||||||
for (const item of resources) {
|
for (const item of resources) {
|
||||||
|
@ -84,7 +83,7 @@ export const buildMenusAndRouters = (resources) => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function setIndex(menus) {
|
function setIndex(menus: any) {
|
||||||
for (const menu of menus) {
|
for (const menu of menus) {
|
||||||
menu.index = "index_" + index;
|
menu.index = "index_" + index;
|
||||||
index++;
|
index++;
|
||||||
|
@ -94,7 +93,7 @@ function setIndex(menus) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function findMenus(menus, condition) {
|
function findMenus(menus: any, condition: any) {
|
||||||
const list: any = [];
|
const list: any = [];
|
||||||
for (const menu of menus) {
|
for (const menu of menus) {
|
||||||
if (condition(menu)) {
|
if (condition(menu)) {
|
||||||
|
@ -110,8 +109,8 @@ function findMenus(menus, condition) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
function filterMenus(menus, condition) {
|
function filterMenus(menus: any, condition: any) {
|
||||||
const list = menus.filter((item) => {
|
const list = menus.filter((item: any) => {
|
||||||
return condition(item);
|
return condition(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -123,7 +122,7 @@ function filterMenus(menus, condition) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
function flatChildren(list, children) {
|
function flatChildren(list: any, children: any) {
|
||||||
for (const child of children) {
|
for (const child of children) {
|
||||||
list.push(child);
|
list.push(child);
|
||||||
if (child.children && child.children.length > 0) {
|
if (child.children && child.children.length > 0) {
|
||||||
|
@ -132,7 +131,7 @@ function flatChildren(list, children) {
|
||||||
child.children = null;
|
child.children = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function flatSubRouters(routers) {
|
function flatSubRouters(routers: any) {
|
||||||
for (const router of routers) {
|
for (const router of routers) {
|
||||||
const children: Array<any> = [];
|
const children: Array<any> = [];
|
||||||
if (router.children && router.children.length > 0) {
|
if (router.children && router.children.length > 0) {
|
||||||
|
|
|
@ -403,7 +403,7 @@ export const usePageStore = defineStore({
|
||||||
* @param {Object} state state
|
* @param {Object} state state
|
||||||
* @param {Array} routes routes
|
* @param {Array} routes routes
|
||||||
*/
|
*/
|
||||||
async init(routes: any) {
|
async init(routes?: any) {
|
||||||
if (this.inited) {
|
if (this.inited) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
|
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/AdvancedBigData";
|
const apiPrefix = "/mock/AdvancedBigData";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +10,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +18,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +26,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +34,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,19 +1,19 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { message } from "ant-design-vue";
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
import { dict } from "@fast-crud/fast-crud";
|
|
||||||
export default function ({ expose }) {
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query) => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ export default function ({ expose }) {
|
||||||
columns: {
|
columns: {
|
||||||
id: {
|
id: {
|
||||||
title: "ID",
|
title: "ID",
|
||||||
key: "id",
|
|
||||||
type: "number",
|
type: "number",
|
||||||
column: {
|
column: {
|
||||||
width: 50
|
width: 50
|
|
@ -7,30 +7,18 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud, useExpose } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud.js";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "AdvancedBigData",
|
name: "AdvancedBigData",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose, output } = useFs({ createCrudOptions });
|
||||||
const crudRef = ref();
|
|
||||||
// crud 配置的ref
|
|
||||||
const crudBinding = ref();
|
|
||||||
// 暴露的方法
|
|
||||||
const { expose } = useExpose({ crudRef, crudBinding });
|
|
||||||
// 你的crud配置
|
|
||||||
const { crudOptions, output } = createCrudOptions({ expose });
|
|
||||||
// 初始化crud配置
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
|
||||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
|
||||||
// 你可以调用此方法,重新初始化crud配置
|
|
||||||
// resetCrudOptions(options)
|
|
||||||
|
|
||||||
// 页面打开后获取列表数据
|
// 页面打开后获取列表数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
// @ts-ignore
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "AdvancedBigData",
|
name: "AdvancedBigData",
|
||||||
idGenerator: 0,
|
idGenerator: 0,
|
||||||
copyTimes: 1000
|
copyTimes: 1000
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/AdvancedFromBackend";
|
const apiPrefix = "/mock/AdvancedFromBackend";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
<template>
|
<template>
|
||||||
|
<fs-page>
|
||||||
|
<template #header>
|
||||||
|
<div class="title">CrudOptions从后台加载</div>
|
||||||
|
<div class="more">
|
||||||
|
<a target="_blank" href="http://fast-crud.docmirror.cn/api/use.html#usefsasync">文档</a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<fs-crud v-if="crudBinding" ref="crudRef" v-bind="crudBinding" />
|
<fs-crud v-if="crudBinding" ref="crudRef" v-bind="crudBinding" />
|
||||||
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted, Ref } from "vue";
|
import { defineComponent, onMounted, ref, Ref } from "vue";
|
||||||
import { useCrud, dict, useExpose, useFs, UseFsProps, CrudBinding, CreateCrudOptionsRet, useFsAsync } from "@fast-crud/fast-crud";
|
import { CrudBinding, useFsAsync } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "AdvancedFromBackend",
|
name: "AdvancedFromBackend",
|
||||||
setup() {
|
setup() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/AdvancedInDialog";
|
const apiPrefix = "/mock/AdvancedInDialog";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,19 +1,22 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
export default function ({ expose }) {
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes, dict } from "@fast-crud/fast-crud";
|
||||||
const pageRequest = async (query) => {
|
import { SearchOutlined } from "@ant-design/icons-vue";
|
||||||
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
request: {
|
request: {
|
||||||
|
@ -68,23 +71,16 @@ export default function ({ expose }) {
|
||||||
},
|
},
|
||||||
render: {
|
render: {
|
||||||
title: "复杂输入(render)",
|
title: "复杂输入(render)",
|
||||||
|
type: "text",
|
||||||
form: {
|
form: {
|
||||||
title: "复杂输入",
|
title: "复杂输入",
|
||||||
component: {
|
component: {
|
||||||
render(context) {
|
render(context: any) {
|
||||||
console.log("context scope", context);
|
console.log("context scope", context);
|
||||||
return (
|
return (
|
||||||
<a-input-group compact>
|
<a-input-group compact>
|
||||||
<a-input
|
<a-input placeholder={"render1 input"} style="width: 50%" v-model={[context.form.render, "value"]} />
|
||||||
placeholder={"render1 input"}
|
<a-input placeholder={"render2 input"} style="width: 50%" v-model={[context.form.render2, "value"]} />
|
||||||
style="width: 50%"
|
|
||||||
v-model={[context.form.render, "value"]}
|
|
||||||
/>
|
|
||||||
<a-input
|
|
||||||
placeholder={"render2 input"}
|
|
||||||
style="width: 50%"
|
|
||||||
v-model={[context.form.render2, "value"]}
|
|
||||||
/>
|
|
||||||
</a-input-group>
|
</a-input-group>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -93,6 +89,7 @@ export default function ({ expose }) {
|
||||||
},
|
},
|
||||||
render2: {
|
render2: {
|
||||||
title: "我的值是由复杂输入列输入的",
|
title: "我的值是由复杂输入列输入的",
|
||||||
|
type: "text",
|
||||||
column: {
|
column: {
|
||||||
width: "300px"
|
width: "300px"
|
||||||
},
|
},
|
|
@ -4,31 +4,19 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud";
|
||||||
import { useExpose } from "@fast-crud/fast-crud";
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "fs-in-dialog",
|
name: "FsInDialog",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
// @ts-ignore
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "AdvancedInDialog",
|
name: "AdvancedInDialog",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,9 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<fs-page>
|
<fs-page>
|
||||||
<template #header>
|
<template #header>
|
||||||
<div class="title">
|
<div class="title">对话框中显示crud</div>
|
||||||
对话框中显示crud
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
<div style="padding: 50px">
|
<div style="padding: 50px">
|
||||||
<a-button type="primary" @click="openDialog">打开对话框</a-button>
|
<a-button type="primary" @click="openDialog">打开对话框</a-button>
|
||||||
|
@ -17,16 +15,16 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref } from "vue";
|
import { defineComponent, ref } from "vue";
|
||||||
import FsInDialog from './crud/index.vue'
|
import FsInDialog from "./crud/index.vue";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "InDialog",
|
name: "InDialog",
|
||||||
components: { FsInDialog },
|
components: { FsInDialog },
|
||||||
setup() {
|
setup() {
|
||||||
const dialogShow = ref(false)
|
const dialogShow = ref(false);
|
||||||
function openDialog() {
|
function openDialog() {
|
||||||
dialogShow.value=true
|
dialogShow.value = true;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
dialogShow,
|
dialogShow,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, ScopeContext, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, ScopeContext, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
export default function ({ expose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
|
@ -30,7 +30,6 @@ export default function ({ expose }: CreateCrudOptionsProps): CreateCrudOptionsR
|
||||||
columns: {
|
columns: {
|
||||||
id: {
|
id: {
|
||||||
title: "ID",
|
title: "ID",
|
||||||
key: "id",
|
|
||||||
type: "number",
|
type: "number",
|
||||||
column: {
|
column: {
|
||||||
width: 50
|
width: 50
|
||||||
|
@ -51,7 +50,7 @@ export default function ({ expose }: CreateCrudOptionsProps): CreateCrudOptionsR
|
||||||
cache: true
|
cache: true
|
||||||
}),
|
}),
|
||||||
form: {
|
form: {
|
||||||
valueChange({ form, value, getComponentRef }: ScopeContext) {
|
valueChange({ form, value, getComponentRef }) {
|
||||||
form.city = undefined; // 将“city”的值置空
|
form.city = undefined; // 将“city”的值置空
|
||||||
form.county = undefined; // 将“county”的值置空
|
form.county = undefined; // 将“county”的值置空
|
||||||
if (value) {
|
if (value) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/AdvancedLocalPagination";
|
const apiPrefix = "/mock/AdvancedLocalPagination";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,14 +1,16 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api.js";
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
import { dict } from "@fast-crud/fast-crud";
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
export default function ({ expose, localDataRef }) {
|
|
||||||
const pageRequest = async ({ page, query }) => {
|
export default function ({ crudExpose, localDataRef }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
|
const { page } = query;
|
||||||
//总数据
|
//总数据
|
||||||
let data = localDataRef.value;
|
let data = localDataRef.value;
|
||||||
//获取请求参数
|
//获取请求参数
|
||||||
const limit = page.limit;
|
const limit = page.limit;
|
||||||
let offset = page.offset;
|
const offset = page.offset;
|
||||||
data = data.filter((item) => {
|
data = data.filter((item: any) => {
|
||||||
// 根据你的业务,编写你的本地查询逻辑
|
// 根据你的业务,编写你的本地查询逻辑
|
||||||
// text改成你的查询字段
|
// text改成你的查询字段
|
||||||
if (query.status && item.status !== query.status) {
|
if (query.status && item.status !== query.status) {
|
||||||
|
@ -33,7 +35,7 @@ export default function ({ expose, localDataRef }) {
|
||||||
records
|
records
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
await api.UpdateObj(form);
|
await api.UpdateObj(form);
|
||||||
//更新本地数据
|
//更新本地数据
|
||||||
|
@ -45,7 +47,7 @@ export default function ({ expose, localDataRef }) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
const id = await api.AddObj(form);
|
const id = await api.AddObj(form);
|
||||||
//本地添加
|
//本地添加
|
||||||
form.id = id;
|
form.id = id;
|
||||||
|
@ -53,7 +55,7 @@ export default function ({ expose, localDataRef }) {
|
||||||
return id;
|
return id;
|
||||||
};
|
};
|
||||||
|
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
await api.DelObj(row.id);
|
await api.DelObj(row.id);
|
||||||
//本地删除那一条记录
|
//本地删除那一条记录
|
||||||
const tableData = localDataRef.value;
|
const tableData = localDataRef.value;
|
|
@ -11,9 +11,9 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, ref, onMounted } from "vue";
|
||||||
import { useCrud, useExpose } from "@fast-crud/fast-crud";
|
import { useCrud, useExpose, useFs } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud";
|
||||||
import { GetList } from "./api";
|
import { GetList } from "./api";
|
||||||
|
|
||||||
|
@ -36,16 +36,10 @@ export default defineComponent({
|
||||||
const ret = await GetList({ page: { offset: 0, limit: 99999999 }, query: {}, sort: {} });
|
const ret = await GetList({ page: { offset: 0, limit: 99999999 }, query: {}, sort: {} });
|
||||||
localDataRef.value = ret.records;
|
localDataRef.value = ret.records;
|
||||||
|
|
||||||
//然后再初始化crud
|
const { crudExpose } = useFs({ crudBinding, crudRef, createCrudOptions, localDataRef });
|
||||||
// 暴露的方法
|
|
||||||
const { expose } = useExpose({ crudRef, crudBinding });
|
|
||||||
// 你的crud配置
|
|
||||||
const { crudOptions } = createCrudOptions({ expose, localDataRef });
|
|
||||||
// 初始化crud配置
|
|
||||||
useCrud({ expose, crudOptions });
|
|
||||||
|
|
||||||
// 页面打开后获取列表数据
|
// 页面打开后获取列表数据
|
||||||
await expose.doRefresh();
|
await crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
// @ts-ignore
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "AdvancedLocalPagination",
|
name: "AdvancedLocalPagination",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/AdvancedNest";
|
const apiPrefix = "/mock/AdvancedNest";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BatchDelete(ids) {
|
export function BatchDelete(ids: any[]) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/batchDelete",
|
url: apiPrefix + "/batchDelete",
|
||||||
method: "post",
|
method: "post",
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/AdvancedAside";
|
const apiPrefix = "/mock/AdvancedAside";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BatchDelete(ids) {
|
export function BatchDelete(ids: any[]) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/batchDelete",
|
url: apiPrefix + "/batchDelete",
|
||||||
method: "post",
|
method: "post",
|
|
@ -1,14 +1,19 @@
|
||||||
import * as api from "./api";
|
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";
|
||||||
export default function ({ expose }) {
|
|
||||||
const editRequest = async ({ form, row }) => {
|
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;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
const addRequest = async ({ form }) => {
|
|
||||||
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,37 +6,26 @@
|
||||||
</fs-crud>
|
</fs-crud>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud.js";
|
||||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "AsideTable",
|
name: "AsideTable",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudBinding,
|
crudBinding,
|
||||||
crudRef,
|
crudRef,
|
||||||
setSearchFormData: expose.setSearchFormData,
|
setSearchFormData: crudExpose.setSearchFormData,
|
||||||
doRefresh: expose.doRefresh
|
doRefresh: crudExpose.doRefresh
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
// @ts-ignore
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "AdvancedAside",
|
name: "AdvancedAside",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,21 +1,27 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { ref, shallowRef } from "vue";
|
import { ref, shallowRef } from "vue";
|
||||||
import SubTable from "./sub-table/index.vue";
|
import SubTable from "./sub-table/index.vue";
|
||||||
import { compute } from "@fast-crud/fast-crud";
|
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
export default function ({ expose, asideTableRef }) {
|
|
||||||
const editRequest = async ({ form, row }) => {
|
export default function ({ crudExpose, asideTableRef }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
|
return await api.GetList(query);
|
||||||
|
};
|
||||||
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
const addRequest = async ({ form }) => {
|
|
||||||
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentRow = ref();
|
const currentRow = ref();
|
||||||
|
|
||||||
const onCurrentRowChange = (id) => {
|
const onCurrentRowChange = (id: number) => {
|
||||||
currentRow.value = id;
|
currentRow.value = id;
|
||||||
asideTableRef.value.setSearchFormData({ form: { gradeId: id } });
|
asideTableRef.value.setSearchFormData({ form: { gradeId: id } });
|
||||||
asideTableRef.value.doRefresh();
|
asideTableRef.value.doRefresh();
|
||||||
|
@ -23,7 +29,7 @@ export default function ({ expose, asideTableRef }) {
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
table: {
|
table: {
|
||||||
customRow(record, index) {
|
customRow(record: any, index: number) {
|
||||||
const clazz = record.id === currentRow.value ? "fs-current-row" : "";
|
const clazz = record.id === currentRow.value ? "fs-current-row" : "";
|
||||||
return {
|
return {
|
||||||
onClick() {
|
onClick() {
|
|
@ -13,34 +13,24 @@
|
||||||
</a-row>
|
</a-row>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted, ref } from "vue";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud.js";
|
||||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
|
||||||
import AsideTable from "./aside-table/index.vue";
|
import AsideTable from "./aside-table/index.vue";
|
||||||
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "FeatureNest",
|
name: "FeatureNest",
|
||||||
// eslint-disable-next-line vue/no-unused-components
|
// eslint-disable-next-line vue/no-unused-components
|
||||||
components: { AsideTable },
|
components: { AsideTable },
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
|
||||||
const crudRef = ref();
|
|
||||||
// crud 配置的ref
|
|
||||||
const crudBinding = ref();
|
|
||||||
// 暴露的方法
|
|
||||||
const { expose } = useExpose({ crudRef, crudBinding });
|
|
||||||
// 你的crud配置
|
|
||||||
const asideTableRef = ref();
|
const asideTableRef = ref();
|
||||||
const { crudOptions } = createCrudOptions({ expose, asideTableRef });
|
|
||||||
// 初始化crud配置
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, asideTableRef });
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
|
||||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
|
||||||
// 你可以调用此方法,重新初始化crud配置
|
|
||||||
// resetCrudOptions(options)
|
|
||||||
|
|
||||||
// 页面打开后获取列表数据
|
// 页面打开后获取列表数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
// @ts-ignore
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "AdvancedNest",
|
name: "AdvancedNest",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/AdvancedSubTable";
|
const apiPrefix = "/mock/AdvancedSubTable";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -41,7 +41,7 @@ export function GetObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function BatchDelete(ids) {
|
export function BatchDelete(ids: any[]) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/batchDelete",
|
url: apiPrefix + "/batchDelete",
|
||||||
method: "post",
|
method: "post",
|
|
@ -1,20 +1,26 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
export default function ({ expose, props, ctx }) {
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
const editRequest = async ({ form, row }) => {
|
|
||||||
|
export default function ({ crudExpose, props, ctx }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
|
return await api.GetList(query);
|
||||||
|
};
|
||||||
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
const addRequest = async ({ form }) => {
|
|
||||||
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
table: {
|
table: {
|
||||||
customRow(record, index) {
|
customRow(record: any, index: number) {
|
||||||
const clazz = record.id === props.modelValue ? "fs-current-row" : "";
|
const clazz = record.id === props.modelValue ? "fs-current-row" : "";
|
||||||
return {
|
return {
|
||||||
onClick() {
|
onClick() {
|
|
@ -7,10 +7,11 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted, watch } from "vue";
|
import { defineComponent, onMounted, watch } from "vue";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud";
|
||||||
import { useExpose, useCrud } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "SubTable",
|
name: "SubTable",
|
||||||
props: {
|
props: {
|
||||||
|
@ -19,23 +20,11 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
emits: ["update:modelValue"],
|
emits: ["update:modelValue"],
|
||||||
setup(props, ctx) {
|
setup(props, ctx) {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions, props, ctx });
|
||||||
const crudRef = ref();
|
|
||||||
// crud 配置的ref
|
|
||||||
const crudBinding = ref();
|
|
||||||
// 暴露的方法
|
|
||||||
const { expose } = useExpose({ crudRef, crudBinding });
|
|
||||||
// 你的crud配置
|
|
||||||
const { crudOptions } = createCrudOptions({ expose, props, ctx });
|
|
||||||
// 初始化crud配置
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
|
||||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
|
||||||
// 你可以调用此方法,重新初始化crud配置
|
|
||||||
// resetCrudOptions(options)
|
|
||||||
|
|
||||||
// 页面打开后获取列表数据
|
// 页面打开后获取列表数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
//你的业务代码
|
//你的业务代码
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
// @ts-ignore
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "AdvancedSubTable",
|
name: "AdvancedSubTable",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
import * as api from "./api.js";
|
import * as api from "./api.js";
|
||||||
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
export default function ({ expose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
// @ts-ignore
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "BasisColumnsSet",
|
name: "BasisColumnsSet",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/FormComputeMore";
|
const apiPrefix = "/mock/FormComputeMore";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
// @ts-ignore
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "FormComputeMore",
|
name: "FormComputeMore",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
import { AddReq, ButtonProps, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, RowHandleProps, useCompute, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, GetContextFn, ScopeContext, useCompute, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import { ref, computed } from "vue";
|
import { computed, ref } from "vue";
|
||||||
|
|
||||||
const { asyncCompute, compute } = useCompute();
|
const { asyncCompute, compute } = useCompute();
|
||||||
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
|
@ -59,7 +60,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
|
||||||
rowHandle: {
|
rowHandle: {
|
||||||
fixed: "right",
|
fixed: "right",
|
||||||
show: computed(() => {
|
show: computed(() => {
|
||||||
return false;
|
return true;
|
||||||
}),
|
}),
|
||||||
buttons: {
|
buttons: {
|
||||||
edit: {
|
edit: {
|
||||||
|
@ -71,13 +72,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
|
||||||
show: compute(({ row }) => {
|
show: compute(({ row }) => {
|
||||||
return row.editable;
|
return row.editable;
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
custom: compute(({ row }) => {
|
|
||||||
return {
|
|
||||||
text: "动态按钮:" + row.id,
|
|
||||||
show: true
|
|
||||||
};
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
columns: {
|
columns: {
|
||||||
|
@ -162,7 +157,7 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
|
||||||
vModel: "value",
|
vModel: "value",
|
||||||
placeholder: "异步计算远程获取options",
|
placeholder: "异步计算远程获取options",
|
||||||
options: asyncCompute({
|
options: asyncCompute({
|
||||||
async asyncFn(watchValue, context) {
|
async asyncFn(watchValue: any, context: GetContextFn) {
|
||||||
const url = "/mock/dicts/OpenStatusEnum?remote";
|
const url = "/mock/dicts/OpenStatusEnum?remote";
|
||||||
return await requestForMock({ url });
|
return await requestForMock({ url });
|
||||||
}
|
}
|
||||||
|
@ -181,10 +176,10 @@ export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOpti
|
||||||
vModel: "value",
|
vModel: "value",
|
||||||
placeholder: "异步计算远程获取options",
|
placeholder: "异步计算远程获取options",
|
||||||
options: asyncCompute({
|
options: asyncCompute({
|
||||||
watch({ form }: any) {
|
watch({ form }: ScopeContext) {
|
||||||
return form.compute;
|
return form.compute;
|
||||||
},
|
},
|
||||||
async asyncFn(watchValue) {
|
async asyncFn(watchValue: string) {
|
||||||
message.info("监听switch,触发远程获取options");
|
message.info("监听switch,触发远程获取options");
|
||||||
const url = watchValue ? "/mock/dicts/OpenStatusEnum?remote" : "/mock/dicts/moreOpenStatusEnum?remote";
|
const url = watchValue ? "/mock/dicts/OpenStatusEnum?remote" : "/mock/dicts/moreOpenStatusEnum?remote";
|
||||||
return await requestForMock({ url });
|
return await requestForMock({ url });
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
// @ts-ignore
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "FormCompute",
|
name: "FormCompute",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/BasisI18n";
|
const apiPrefix = "/mock/BasisI18n";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,22 +1,25 @@
|
||||||
import * as api from "./api";
|
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 { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
export default function ({ expose }) {
|
|
||||||
const { t } = useI18n();
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query) => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
request: {
|
request: {
|
|
@ -14,32 +14,19 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud } from "@fast-crud/fast-crud";
|
import createCrudOptions from "./crud.js";
|
||||||
import createCrudOptions from "./crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import { useExpose } from "@fast-crud/fast-crud";
|
|
||||||
import { message } from "ant-design-vue";
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "BasisI18n",
|
name: "BasisI18n",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "BasisI18n",
|
name: "BasisI18n",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/BasisLayoutCard";
|
const apiPrefix = "/mock/BasisLayoutCard";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,23 +1,24 @@
|
||||||
import * as api from "./api";
|
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 { computed } from "vue";
|
import { computed } from "vue";
|
||||||
|
|
||||||
export default function ({ crudExpose }) {
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query) => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
let cityDictRef = dict({
|
|
||||||
|
const cityDictRef = dict({
|
||||||
value: "id",
|
value: "id",
|
||||||
label: "text",
|
label: "text",
|
||||||
data: [
|
data: [
|
||||||
|
@ -48,7 +49,7 @@ export default function ({ crudExpose }) {
|
||||||
options: computed(() => {
|
options: computed(() => {
|
||||||
return cityDictRef.data;
|
return cityDictRef.data;
|
||||||
})
|
})
|
||||||
},
|
} as any,
|
||||||
columns: {
|
columns: {
|
||||||
id: {
|
id: {
|
||||||
title: "ID",
|
title: "ID",
|
|
@ -10,27 +10,15 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud } from "@fast-crud/fast-crud";
|
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud";
|
||||||
import { useExpose } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "BasisLayoutCard",
|
name: "BasisLayoutCard",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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)
|
|
||||||
|
|
||||||
// 页面打开后获取列表数据
|
// 页面打开后获取列表数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "BasisLayoutCard",
|
name: "BasisLayoutCard",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/BasisLayoutCustom";
|
const apiPrefix = "/mock/BasisLayoutCustom";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,22 +1,23 @@
|
||||||
import * as api from "./api";
|
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 CustomLayout from "./custom-layout.vue";
|
import CustomLayout from "./custom-layout.vue";
|
||||||
import { shallowRef } from "vue";
|
import { shallowRef } from "vue";
|
||||||
export default function ({ crudExpose }) {
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query) => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
container: {
|
container: {
|
||||||
|
@ -26,7 +27,7 @@ export default function ({ crudExpose }) {
|
||||||
show: true,
|
show: true,
|
||||||
name: "city",
|
name: "city",
|
||||||
type: "card"
|
type: "card"
|
||||||
},
|
} as any,
|
||||||
request: {
|
request: {
|
||||||
pageRequest,
|
pageRequest,
|
||||||
addRequest,
|
addRequest,
|
|
@ -13,27 +13,15 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud.js";
|
||||||
import { useExpose } from "@fast-crud/fast-crud";
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "BasisLayoutCustom",
|
name: "BasisLayoutCustom",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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)
|
|
||||||
|
|
||||||
// 页面打开后获取列表数据
|
// 页面打开后获取列表数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "BasisLayoutCustom",
|
name: "BasisLayoutCustom",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useFs, UseFsProps } from "@fast-crud/fast-crud";
|
import { CrudOptions, DynamicType, useFs, UseFsProps } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud.js";
|
import createCrudOptions from "./crud.js";
|
||||||
import _ from "lodash-es";
|
import _ from "lodash-es";
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -26,7 +26,7 @@ export default defineComponent({
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
//合并新的crudOptions
|
//合并新的crudOptions
|
||||||
const newOptions = _.merge(crudOptions, {
|
const newOptions: DynamicType<CrudOptions> = _.merge(crudOptions, {
|
||||||
columns: {
|
columns: {
|
||||||
text: {
|
text: {
|
||||||
title: "追加字段",
|
title: "追加字段",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/BasisValueChange";
|
const apiPrefix = "/mock/BasisValueChange";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,19 +1,20 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import { dict } from "@fast-crud/fast-crud";
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes, ValueChangeContext } from "@fast-crud/fast-crud";
|
||||||
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);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,12 +53,12 @@ export default function ({ expose }) {
|
||||||
name: "fs-dict-switch",
|
name: "fs-dict-switch",
|
||||||
vModel: "checked"
|
vModel: "checked"
|
||||||
},
|
},
|
||||||
valueChange(context) {
|
valueChange(context: ValueChangeContext) {
|
||||||
console.log("column value changed:", context);
|
console.log("column value changed:", context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
valueChange({ value, key, form }) {
|
valueChange({ value, key, form }: ValueChangeContext) {
|
||||||
console.log("valueChanged,", key, value, form);
|
console.log("valueChanged,", key, value, form);
|
||||||
message.info(`valueChanged:${key}=${value}`);
|
message.info(`valueChanged:${key}=${value}`);
|
||||||
}
|
}
|
||||||
|
@ -67,7 +68,7 @@ export default function ({ expose }) {
|
||||||
title: "value-change",
|
title: "value-change",
|
||||||
type: "text",
|
type: "text",
|
||||||
form: {
|
form: {
|
||||||
valueChange({ value, key, form }) {
|
valueChange({ value, key, form }: ValueChangeContext) {
|
||||||
console.log("valueChanged,", key, value, form);
|
console.log("valueChanged,", key, value, form);
|
||||||
message.info(`valueChanged:${key}=${value}`);
|
message.info(`valueChanged:${key}=${value}`);
|
||||||
}
|
}
|
||||||
|
@ -81,7 +82,7 @@ export default function ({ expose }) {
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
valueChange: {
|
valueChange: {
|
||||||
handle({ value, key, form, immediate }) {
|
handle({ value, key, form, immediate }: ValueChangeContext) {
|
||||||
console.log("valueChange,", key, value, "isImmediate=", immediate);
|
console.log("valueChange,", key, value, "isImmediate=", immediate);
|
||||||
message.info(`valueChanged:${key}=${value},isImmediate=${immediate}`);
|
message.info(`valueChanged:${key}=${value},isImmediate=${immediate}`);
|
||||||
},
|
},
|
|
@ -10,30 +10,19 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud, useExpose } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud.js";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "BasisValueChange",
|
name: "BasisValueChange",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose, output } = useFs({ createCrudOptions });
|
||||||
const crudRef = ref();
|
|
||||||
// crud 配置的ref
|
|
||||||
const crudBinding = ref();
|
|
||||||
// 暴露的方法
|
|
||||||
const { expose } = useExpose({ crudRef, crudBinding });
|
|
||||||
// 你的crud配置
|
|
||||||
const { crudOptions, output } = createCrudOptions({ expose });
|
|
||||||
// 初始化crud配置
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars,no-unused-vars
|
|
||||||
const { resetCrudOptions } = useCrud({ expose, crudOptions });
|
|
||||||
// 你可以调用此方法,重新初始化crud配置
|
|
||||||
// resetCrudOptions(options)
|
|
||||||
|
|
||||||
// 页面打开后获取列表数据
|
// 页面打开后获取列表数据
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "BasisValueChange",
|
name: "BasisValueChange",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/ComponentButton";
|
const apiPrefix = "/mock/ComponentButton";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,22 +1,23 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { requestForMock } from "/src/api/service";
|
import { AddReq, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
import { dict, compute } from "@fast-crud/fast-crud";
|
|
||||||
import { message } from "ant-design-vue";
|
import { message } 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);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
request: {
|
request: {
|
|
@ -4,31 +4,19 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud.js";
|
||||||
import { useExpose } from "@fast-crud/fast-crud";
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ComponentButton",
|
name: "ComponentButton",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "ComponentButton",
|
name: "ComponentButton",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/ComponentCascader";
|
const apiPrefix = "/mock/ComponentCascader";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,19 +1,20 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
import { dict } from "@fast-crud/fast-crud";
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
export default function ({ crudRef }) {
|
|
||||||
const pageRequest = async (query) => {
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
return {
|
return {
|
||||||
|
@ -47,7 +48,6 @@ export default function ({ crudRef }) {
|
||||||
search: { show: true },
|
search: { show: true },
|
||||||
type: "dict-cascader",
|
type: "dict-cascader",
|
||||||
dict: dict({
|
dict: dict({
|
||||||
cloneable: false,
|
|
||||||
isTree: true,
|
isTree: true,
|
||||||
url: "/mock/dicts/cascaderData?single"
|
url: "/mock/dicts/cascaderData?single"
|
||||||
})
|
})
|
||||||
|
@ -61,7 +61,7 @@ export default function ({ crudRef }) {
|
||||||
label: "name",
|
label: "name",
|
||||||
isTree: true,
|
isTree: true,
|
||||||
prototype: true,
|
prototype: true,
|
||||||
getNodesByValues(values) {
|
getNodesByValues(values: any) {
|
||||||
//给cell展示组件调用,根据value值获取节点,每行都会请求一次
|
//给cell展示组件调用,根据value值获取节点,每行都会请求一次
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -87,7 +87,7 @@ export default function ({ crudRef }) {
|
||||||
isLeaf: false
|
isLeaf: false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
loadData: async (selectedOptions) => {
|
loadData: async (selectedOptions: any) => {
|
||||||
console.log("lazyLoad", selectedOptions);
|
console.log("lazyLoad", selectedOptions);
|
||||||
const targetOption = selectedOptions[selectedOptions.length - 1];
|
const targetOption = selectedOptions[selectedOptions.length - 1];
|
||||||
targetOption.loading = true;
|
targetOption.loading = true;
|
||||||
|
@ -122,8 +122,8 @@ export default function ({ crudRef }) {
|
||||||
form: {
|
form: {
|
||||||
component: {
|
component: {
|
||||||
showSearch: {
|
showSearch: {
|
||||||
filter: (inputValue, path) => {
|
filter: (inputValue: any, path: any) => {
|
||||||
return path.some((option) => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
|
return path.some((option: any) => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"change-on-select": true
|
"change-on-select": true
|
|
@ -4,31 +4,19 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud } from "@fast-crud/fast-crud";
|
import createCrudOptions from "./crud.js";
|
||||||
import createCrudOptions from "./crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import { useExpose } from "@fast-crud/fast-crud";
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ComponentCascader",
|
name: "ComponentCascader",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "ComponentCascader",
|
name: "ComponentCascader",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/ComponentCheckbox";
|
const apiPrefix = "/mock/ComponentCheckbox";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,19 +1,19 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { requestForMock } from "/src/api/service";
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, EditReq, UserPageQuery, UserPageRes } from "@fast-crud/fast-crud";
|
||||||
import { dict } from "@fast-crud/fast-crud";
|
|
||||||
export default function ({ crudRef }) {
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query) => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
return {
|
return {
|
|
@ -4,31 +4,19 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud";
|
||||||
import { useExpose } from "@fast-crud/fast-crud";
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ComponentCheckbox",
|
name: "ComponentCheckbox",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "ComponentCheckbox",
|
name: "ComponentCheckbox",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/ComponentDate";
|
const apiPrefix = "/mock/ComponentDate";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,23 +1,24 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { utils } from "@fast-crud/fast-crud";
|
import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, EditReq, ScopeContext, UserPageQuery, UserPageRes, utils } from "@fast-crud/fast-crud";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
|
|
||||||
console.log("utils", utils);
|
console.log("utils", utils);
|
||||||
export default function ({ expose }) {
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
const pageRequest = async (query) => {
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
request: {
|
request: {
|
||||||
|
@ -116,8 +117,8 @@ export default function ({ expose }) {
|
||||||
form: {
|
form: {
|
||||||
component: {
|
component: {
|
||||||
valueFormat: "YYYY-MM-DD HH:mm:ss", //输入值的格式
|
valueFormat: "YYYY-MM-DD HH:mm:ss", //输入值的格式
|
||||||
events: {
|
on: {
|
||||||
onChange(context) {
|
onChange(context: ScopeContext) {
|
||||||
console.log("change", context);
|
console.log("change", context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +176,7 @@ export default function ({ expose }) {
|
||||||
form: {
|
form: {
|
||||||
component: {
|
component: {
|
||||||
valueFormat: "YYYY-MM-DD HH:mm:ss", //输入值的格式
|
valueFormat: "YYYY-MM-DD HH:mm:ss", //输入值的格式
|
||||||
disabledDate(current) {
|
disabledDate(current: any) {
|
||||||
return current && current < dayjs().endOf("day");
|
return current && current < dayjs().endOf("day");
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,40 +2,25 @@
|
||||||
<fs-page>
|
<fs-page>
|
||||||
<fs-crud ref="crudRef" v-bind="crudBinding">
|
<fs-crud ref="crudRef" v-bind="crudBinding">
|
||||||
<template #actionbar-right>
|
<template #actionbar-right>
|
||||||
<a-alert
|
<a-alert style="margin-left: 10px" message="关于日期时间,建议前后端统一使用时间戳(long类型)进行交互,可以避免时区转化带来的问题" />
|
||||||
style="margin-left: 10px"
|
|
||||||
message="关于日期时间,建议前后端统一使用时间戳(long类型)进行交互,可以避免时区转化带来的问题"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</fs-crud>
|
</fs-crud>
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud } from "@fast-crud/fast-crud";
|
import createCrudOptions from "./crud.js";
|
||||||
import createCrudOptions from "./crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import { useExpose } from "@fast-crud/fast-crud";
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ComponentDate",
|
name: "ComponentDate",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import mockUtil from "/src/mock/base";
|
import mockUtil from "/src/mock/base";
|
||||||
|
|
||||||
const options = {
|
const options: any = {
|
||||||
name: "ComponentDate",
|
name: "ComponentDate",
|
||||||
idGenerator: 0
|
idGenerator: 0
|
||||||
};
|
};
|
|
@ -1,7 +1,7 @@
|
||||||
import { requestForMock } from "/src/api/service";
|
import { requestForMock } from "/src/api/service";
|
||||||
const request = requestForMock;
|
const request = requestForMock;
|
||||||
const apiPrefix = "/mock/ComponentEditor";
|
const apiPrefix = "/mock/ComponentEditor";
|
||||||
export function GetList(query) {
|
export function GetList(query: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/page",
|
url: apiPrefix + "/page",
|
||||||
method: "get",
|
method: "get",
|
||||||
|
@ -9,7 +9,7 @@ export function GetList(query) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function AddObj(obj) {
|
export function AddObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/add",
|
url: apiPrefix + "/add",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -17,7 +17,7 @@ export function AddObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function UpdateObj(obj) {
|
export function UpdateObj(obj: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/update",
|
url: apiPrefix + "/update",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -25,7 +25,7 @@ export function UpdateObj(obj) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DelObj(id) {
|
export function DelObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/delete",
|
url: apiPrefix + "/delete",
|
||||||
method: "post",
|
method: "post",
|
||||||
|
@ -33,7 +33,7 @@ export function DelObj(id) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function GetObj(id) {
|
export function GetObj(id: any) {
|
||||||
return request({
|
return request({
|
||||||
url: apiPrefix + "/info",
|
url: apiPrefix + "/info",
|
||||||
method: "get",
|
method: "get",
|
|
@ -1,20 +1,23 @@
|
||||||
import * as api from "./api";
|
import * as api from "./api";
|
||||||
import { utils, dict, compute } from "@fast-crud/fast-crud";
|
import { utils, dict, compute, CreateCrudOptionsProps, CreateCrudOptionsRet, UserPageQuery, UserPageRes, EditReq, DelReq, AddReq, ScopeContext } from "@fast-crud/fast-crud";
|
||||||
export default function ({ expose }) {
|
import { FsUploaderFormOptions } from "@fast-crud/fast-extends";
|
||||||
const pageRequest = async (query) => {
|
|
||||||
|
export default function ({ crudExpose }: CreateCrudOptionsProps): CreateCrudOptionsRet {
|
||||||
|
const pageRequest = async (query: UserPageQuery): Promise<UserPageRes> => {
|
||||||
return await api.GetList(query);
|
return await api.GetList(query);
|
||||||
};
|
};
|
||||||
const editRequest = async ({ form, row }) => {
|
const editRequest = async ({ form, row }: EditReq) => {
|
||||||
form.id = row.id;
|
form.id = row.id;
|
||||||
return await api.UpdateObj(form);
|
return await api.UpdateObj(form);
|
||||||
};
|
};
|
||||||
const delRequest = async ({ row }) => {
|
const delRequest = async ({ row }: DelReq) => {
|
||||||
return await api.DelObj(row.id);
|
return await api.DelObj(row.id);
|
||||||
};
|
};
|
||||||
|
|
||||||
const addRequest = async ({ form }) => {
|
const addRequest = async ({ form }: AddReq) => {
|
||||||
return await api.AddObj(form);
|
return await api.AddObj(form);
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
crudOptions: {
|
crudOptions: {
|
||||||
request: {
|
request: {
|
||||||
|
@ -26,7 +29,6 @@ export default function ({ expose }) {
|
||||||
columns: {
|
columns: {
|
||||||
id: {
|
id: {
|
||||||
title: "ID",
|
title: "ID",
|
||||||
key: "id",
|
|
||||||
type: "number",
|
type: "number",
|
||||||
column: {
|
column: {
|
||||||
width: 50
|
width: 50
|
||||||
|
@ -42,23 +44,20 @@ export default function ({ expose }) {
|
||||||
width: 400
|
width: 400
|
||||||
},
|
},
|
||||||
form: {
|
form: {
|
||||||
col: { span: 24 },
|
col: { span: 24 }
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
text: {
|
text: {
|
||||||
title: "摘要",
|
title: "摘要",
|
||||||
type: "textarea",
|
type: "textarea",
|
||||||
form: {
|
form: {
|
||||||
col: { span: 24 },
|
col: { span: 24 }
|
||||||
},
|
},
|
||||||
viewForm: {
|
viewForm: {
|
||||||
component: {
|
render(scope: ScopeContext) {
|
||||||
name: null,
|
|
||||||
render(h, scope) {
|
|
||||||
return <div>{scope.value}</div>;
|
return <div>{scope.value}</div>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
},
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
title: "禁用启用",
|
title: "禁用启用",
|
||||||
|
@ -77,7 +76,7 @@ export default function ({ expose }) {
|
||||||
width: 300,
|
width: 300,
|
||||||
show: false
|
show: false
|
||||||
},
|
},
|
||||||
type: ["editor-wang5"], // 富文本图片上传依赖file-uploader,请先配置好file-uploader
|
type: "editor-wang5", // 富文本图片上传依赖file-uploader,请先配置好file-uploader
|
||||||
form: {
|
form: {
|
||||||
helper: "示例已升级到wangEditor5版本,原来的editor-wang目前仍然可以使用,后续fs升级可能会将其删除,请尽快升级到editor-wang5版本",
|
helper: "示例已升级到wangEditor5版本,原来的editor-wang目前仍然可以使用,后续fs升级可能会将其删除,请尽快升级到editor-wang5版本",
|
||||||
col: { span: 24 },
|
col: { span: 24 },
|
||||||
|
@ -94,10 +93,10 @@ export default function ({ expose }) {
|
||||||
config: {},
|
config: {},
|
||||||
uploader: {
|
uploader: {
|
||||||
type: "form",
|
type: "form",
|
||||||
buildUrl(res) {
|
buildUrl(res: any) {
|
||||||
return res.url;
|
return res.url;
|
||||||
}
|
}
|
||||||
}
|
} as FsUploaderFormOptions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,31 +8,19 @@
|
||||||
</fs-page>
|
</fs-page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script lang="ts">
|
||||||
import { defineComponent, ref, onMounted } from "vue";
|
import { defineComponent, onMounted } from "vue";
|
||||||
import { useCrud } from "@fast-crud/fast-crud";
|
import { useFs } from "@fast-crud/fast-crud";
|
||||||
import createCrudOptions from "./crud";
|
import createCrudOptions from "./crud";
|
||||||
import { useExpose } from "@fast-crud/fast-crud";
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: "ComponentEditor",
|
name: "ComponentEditor",
|
||||||
setup() {
|
setup() {
|
||||||
// crud组件的ref
|
const { crudBinding, crudRef, crudExpose } = useFs({ createCrudOptions });
|
||||||
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(() => {
|
onMounted(() => {
|
||||||
expose.doRefresh();
|
crudExpose.doRefresh();
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue