diff --git a/.gitignore b/.gitignore index ccedd9fff..3fda47516 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,32 @@ # IntelliJ project files +.vscode/ +node_modules/ +npm-debug.log +yarn-error.log +yarn.lock +package-lock.json +/.idea/ +*/**/dist +*/**/pnpm-lock.yaml +*/**/stats.html .idea *.iml out gen -node_modules/ -packages/*/test/*-private.js +/test/*.private.* + +/*.log + +/packages/ui/*/.idea + +/packages/ui/*/node_modules + +/packages/*/node_modules +/packages/ui/certd-server/tmp/ +/packages/ui/certd-ui/dist/ +/other +/dev-sidecar-test +/packages/core/certd/yarn.lock +/packages/test +/test/own +/pnpm-lock.yaml diff --git a/packages/ui/certd-client/.browserslistrc b/packages/ui/certd-client/.browserslistrc new file mode 100644 index 000000000..214388fe4 --- /dev/null +++ b/packages/ui/certd-client/.browserslistrc @@ -0,0 +1,3 @@ +> 1% +last 2 versions +not dead diff --git a/packages/ui/certd-client/.env b/packages/ui/certd-client/.env new file mode 100644 index 000000000..4933b20fc --- /dev/null +++ b/packages/ui/certd-client/.env @@ -0,0 +1,3 @@ +VITE_APP_API=/api +#登录与权限关闭 +VITE_APP_PM_ENABLED=true diff --git a/packages/ui/certd-client/.env.debug b/packages/ui/certd-client/.env.debug new file mode 100644 index 000000000..6a532d749 --- /dev/null +++ b/packages/ui/certd-client/.env.debug @@ -0,0 +1,2 @@ +#登录与权限开启 +VITE_APP_PM_ENABLED=false diff --git a/packages/ui/certd-client/.env.debugpm b/packages/ui/certd-client/.env.debugpm new file mode 100644 index 000000000..c3b69a80f --- /dev/null +++ b/packages/ui/certd-client/.env.debugpm @@ -0,0 +1,2 @@ +#登录与权限开启 +VITE_APP_PM_ENABLED=true diff --git a/packages/ui/certd-client/.env.pm b/packages/ui/certd-client/.env.pm new file mode 100644 index 000000000..c3b69a80f --- /dev/null +++ b/packages/ui/certd-client/.env.pm @@ -0,0 +1,2 @@ +#登录与权限开启 +VITE_APP_PM_ENABLED=true diff --git a/packages/ui/certd-client/.env.production b/packages/ui/certd-client/.env.production new file mode 100644 index 000000000..bc3dbcb73 --- /dev/null +++ b/packages/ui/certd-client/.env.production @@ -0,0 +1,3 @@ +VITE_APP_API=http://www.docmirror.cn:7001/api +#登录与权限开启 +VITE_APP_PM_ENABLED=true diff --git a/packages/ui/certd-client/.eslintignore b/packages/ui/certd-client/.eslintignore new file mode 100644 index 000000000..eb79dd5fc --- /dev/null +++ b/packages/ui/certd-client/.eslintignore @@ -0,0 +1,2 @@ +node_modules +.idea diff --git a/packages/ui/certd-client/.eslintrc.js b/packages/ui/certd-client/.eslintrc.js new file mode 100644 index 000000000..a10cc42d8 --- /dev/null +++ b/packages/ui/certd-client/.eslintrc.js @@ -0,0 +1,76 @@ +module.exports = { + root: true, + env: { + browser: true, + node: true, + es6: true + }, + parser: "vue-eslint-parser", + parserOptions: { + parser: "@typescript-eslint/parser", + ecmaVersion: 2020, + sourceType: "module", + jsxPragma: "React", + ecmaFeatures: { + jsx: true, + tsx: true + } + }, + extends: [ + "plugin:vue/vue3-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended", + "prettier" + ], + rules: { + //"max-len": [0, 200, 2, { ignoreUrls: true }], + "@typescript-eslint/ban-ts-ignore": "off", + "@typescript-eslint/explicit-function-return-type": "off", + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/no-empty-function": "off", + "@typescript-eslint/no-use-before-define": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/ban-types": "off", + "@typescript-eslint/no-non-null-assertion": "off", + "@typescript-eslint/explicit-module-boundary-types": "off" + // "@typescript-eslint/no-unused-vars": [ + // "error", + // { + // argsIgnorePattern: "^h$", + // varsIgnorePattern: "^h$", + // }, + // ], + // "no-unused-vars": [ + // "error", + // { + // argsIgnorePattern: "^h$", + // varsIgnorePattern: "^h$", + // }, + // ], + // "vue/custom-event-name-casing": "off", + // "no-use-before-define": "off", + // "space-before-function-paren": "off", + + // "vue/attributes-order": "off", + // "vue/one-component-per-file": "off", + // "vue/html-closing-bracket-newline": "off", + // "vue/max-attributes-per-line": "off", + // "vue/multiline-html-element-content-newline": "off", + // "vue/singleline-html-element-content-newline": "off", + // "vue/attribute-hyphenation": "off", + // "vue/require-default-prop": "off", + // "vue/html-self-closing": [ + // "error", + // { + // html: { + // void: "always", + // normal: "never", + // component: "always", + // }, + // svg: "always", + // math: "always", + // }, + // ], + } +}; diff --git a/packages/ui/certd-client/.gitignore b/packages/ui/certd-client/.gitignore new file mode 100644 index 000000000..980be95df --- /dev/null +++ b/packages/ui/certd-client/.gitignore @@ -0,0 +1,11 @@ +node_modules +.DS_Store +dist +dist-ssr +*.local +/stats.html +yarn.lock +.idea +/.idea/ +yarn-error.log +vite-profile.cpuprofile diff --git a/packages/ui/certd-client/.npmignore b/packages/ui/certd-client/.npmignore new file mode 100644 index 000000000..b6c09bbd8 --- /dev/null +++ b/packages/ui/certd-client/.npmignore @@ -0,0 +1,2 @@ +node_modules +/stats.html diff --git a/packages/ui/certd-client/.prettierrc b/packages/ui/certd-client/.prettierrc new file mode 100644 index 000000000..61e99f7c5 --- /dev/null +++ b/packages/ui/certd-client/.prettierrc @@ -0,0 +1,5 @@ +{ + + "trailingComma": "none", + "printWidth": 220 +} diff --git a/packages/ui/certd-client/CHANGELOG.md b/packages/ui/certd-client/CHANGELOG.md new file mode 100644 index 000000000..ccaa88d14 --- /dev/null +++ b/packages/ui/certd-client/CHANGELOG.md @@ -0,0 +1,12 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.10.5](https://github.com/fast-crud/fast-crud/compare/v0.10.4...v0.10.5) (2021-07-01) + + +### Performance Improvements + +* fs-admin 与crud demo ([4e6b20f](https://github.com/fast-crud/fast-crud/commit/4e6b20fe19434460853841f371b9fd5f16e5e2d3)) +* fs-admin纳入子模块 ([2940d30](https://github.com/fast-crud/fast-crud/commit/2940d30f419bf4bde1e8e791f1fbdb9184818285)) diff --git a/packages/ui/certd-client/LICENSE b/packages/ui/certd-client/LICENSE new file mode 100644 index 000000000..e9513c2e7 --- /dev/null +++ b/packages/ui/certd-client/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 fast-crud + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/packages/ui/certd-client/README.md b/packages/ui/certd-client/README.md new file mode 100644 index 000000000..b360e070a --- /dev/null +++ b/packages/ui/certd-client/README.md @@ -0,0 +1,37 @@ +# fs-admin-antdv + +基于vue3、antdv 的 admin管理后台脚手架 +更多信息请参考: [fast-crud](https://github.com/fast-crud/fast-crud) +# server端 + +## fs-server-js +https://github.com/fast-crud/fs-server-js + +# 其他相关项目 + * [fast-crud](https://github.com/fast-crud/fast-crud) crud主项目 + * [fs-admin-element](https://github.com/fast-crud/fs-admin-element) element版示例 + * [fs-admin-naive](https://github.com/fast-crud/fs-admin-naive-ui) naive版示例 + * [fs-in-vben-starter](https://github.com/fast-crud/fs-in-vben-starter) vben示例 + +# 感谢 + +### 依赖 +* [vue](https://github.com/vuejs/vue-next) +* [vue-router](https://github.com/vuejs/vue-router-next) +* [antdv 2x](https://github.com/vueComponent/ant-design-vue) +* [vitejs](https://github.com/vitejs/vite) +* [pinia](https://github.com/posva/pinia) +* [purge-icons](https://github.com/antfu/purge-icons) + +### 参考如下项目 +* [d2-admin](https://github.com/d2-projects/d2-admin) +* [antdv-pro](https://github.com/vueComponent/ant-design-vue-pro) +* [vben-admin](https://github.com/anncwb/vue-vben-admin) + +感谢这些优秀的项目 + + + + + + diff --git a/packages/ui/certd-client/build/modify-vars.ts b/packages/ui/certd-client/build/modify-vars.ts new file mode 100644 index 000000000..c6cf20a37 --- /dev/null +++ b/packages/ui/certd-client/build/modify-vars.ts @@ -0,0 +1,11 @@ +// import { getThemeVariables } from "ant-design-vue/dist/theme"; +// import path from "path"; +// const resolve = path.resolve; +export function generateModifyVars(dark = false) { + //const modifyVars = getThemeVariables({ dark }); + // const vars = `${resolve("src/style/theme/index.less")}`; + return { + //...modifyVars + // hack: `true; @import (reference) "${vars}";` + }; +} diff --git a/packages/ui/certd-client/build/theme-colors.ts b/packages/ui/certd-client/build/theme-colors.ts new file mode 100644 index 000000000..41396ef06 --- /dev/null +++ b/packages/ui/certd-client/build/theme-colors.ts @@ -0,0 +1,72 @@ +import { generate } from "@ant-design/colors"; + +export const primaryColor = "#1890ff"; + +export const darkMode = "light"; + +type Fn = (...arg: any) => any; + +export interface GenerateColorsParams { + mixLighten: Fn; + mixDarken: Fn; + tinycolor: any; + color?: string; +} + +export function generateAntColors(color: string) { + return generate(color, { + theme: "default" + }); +} + +export function getThemeColors(color?: string) { + const tc = color || primaryColor; + const colors = generateAntColors(tc); + const primary = colors[5]; + const modeColors = generateAntColors(primary); + + return [...colors, ...modeColors]; +} + +export function generateColors({ color = primaryColor, mixLighten, mixDarken, tinycolor }: GenerateColorsParams) { + const arr = new Array(19).fill(0); + const lightens = arr.map((_t, i) => { + return mixLighten(color, i / 5); + }); + + const darkens = arr.map((_t, i) => { + return mixDarken(color, i / 5); + }); + + const alphaColors = arr.map((_t, i) => { + return tinycolor(color) + .setAlpha(i / 20) + .toRgbString(); + }); + + const shortAlphaColors = alphaColors.map((item) => item.replace(/\s/g, "").replace(/0\./g, ".")); + + const tinycolorLightens = arr + .map((_t, i) => { + return tinycolor(color) + .lighten(i * 5) + .toHexString(); + }) + .filter((item) => item !== "#ffffff"); + + const tinycolorDarkens = arr + .map((_t, i) => { + return tinycolor(color) + .darken(i * 5) + .toHexString(); + }) + .filter((item) => item !== "#000000"); + return [ + ...lightens, + ...darkens, + ...alphaColors, + ...shortAlphaColors, + ...tinycolorDarkens, + ...tinycolorLightens + ].filter((item) => !item.includes("-")); +} diff --git a/packages/ui/certd-client/build/theme-plugin.ts b/packages/ui/certd-client/build/theme-plugin.ts new file mode 100644 index 000000000..d223642b4 --- /dev/null +++ b/packages/ui/certd-client/build/theme-plugin.ts @@ -0,0 +1,68 @@ +/** + * Vite plugin for website theme color switching + * https://github.com/anncwb/vite-plugin-theme + */ +import type { Plugin } from "vite"; +import path from "path"; +import { viteThemePlugin, mixLighten, mixDarken, tinycolor, antdDarkThemePlugin } from "vite-plugin-theme"; +import { getThemeColors, generateColors } from "./theme-colors"; +import { generateModifyVars } from "./modify-vars"; + +export function configThemePlugin(isBuild: boolean): Plugin[] { + const colors = generateColors({ + mixDarken, + mixLighten, + tinycolor + }); + const colorVariables = [...getThemeColors(), ...colors]; + const plugin = [ + viteThemePlugin({ + // resolveSelector: (s) => { + // s = s.trim(); + // switch (s) { + // case ".ant-steps-item-process .ant-steps-item-icon > .ant-steps-icon": + // return ".ant-steps-item-icon > .ant-steps-icon"; + // case ".ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled)": + // case ".ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):hover": + // case ".ant-radio-button-wrapper-checked:not(.ant-radio-button-wrapper-disabled):active": + // return s; + // case ".ant-steps-item-icon > .ant-steps-icon": + // return s; + // } + // return `[data-theme] ${s}`; + // }, + resolveSelector: (s) => { + s = s.trim(); + if (s === ".ant-btn:hover,.ant-btn:focus") { + // console.log("ssss", s); + return ".theme-discard-xxxxxxx"; + } + return s; + }, + colorVariables + }), + antdDarkThemePlugin({ + preloadFiles: [ + path.resolve(process.cwd(), "node_modules/ant-design-vue/dist/antd.less"), + path.resolve(process.cwd(), "src/style/theme/index.less") + ], + filter: (id) => (isBuild ? !id.endsWith("antd.less") : true), + // extractCss: false, + darkModifyVars: { + ...generateModifyVars(true), + "text-color": "#c9d1d9", + "text-color-base": "#c9d1d9", + "component-background": "#151515", + // black: '#0e1117', + // #8b949e + "text-color-secondary": "#8b949e", + "border-color-base": "#303030", + // 'border-color-split': '#30363d', + "item-active-bg": "#111b26", + "app-content-background": "rgb(255 255 255 / 4%)" + } + }) + ]; + + return (plugin as unknown) as Plugin[]; +} diff --git a/packages/ui/certd-client/index.html b/packages/ui/certd-client/index.html new file mode 100644 index 000000000..aac3b8bfe --- /dev/null +++ b/packages/ui/certd-client/index.html @@ -0,0 +1,26 @@ + + + + + + + antdv-fast-crud + + + +
+
+
+
+
+ +
+ +
+ + + diff --git a/packages/ui/certd-client/package.json b/packages/ui/certd-client/package.json new file mode 100644 index 000000000..a629e40cc --- /dev/null +++ b/packages/ui/certd-client/package.json @@ -0,0 +1,120 @@ +{ + "name": "@fast-crud/fs-admin-antdv", + "version": "1.8.4", + "private": true, + "scripts": { + "dev": "vite", + "dev:pm": "vite --mode pm", + "dev:force": "vite --force", + "debug": "vite --mode debug", + "debug:pm": "vite --mode debugpm", + "debug:force": "vite --force --mode debug", + "build": "vite build ", + "serve": "vite preview", + "preview": "vite preview", + "pretty-quick": "pretty-quick", + "lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/", + "upgrade": "yarn upgrade-interactive --latest" + }, + "author": "Greper", + "license": "MIT", + "dependencies": { + "@ant-design/colors": "^6.0.0", + "@ant-design/icons-vue": "^6.0.1", + "@fast-crud/fast-crud": "^1.8.4", + "@fast-crud/fast-extends": "^1.8.4", + "@fast-crud/ui-antdv": "^1.8.4", + "@iconify/iconify": "^3.0.1", + "@iconify/json": "^2.1.151", + "@purge-icons/generated": "^0.9.0", + "@soerenmartius/vue3-clipboard": "^0.1.2", + "ant-design-vue": "^3.2.15", + "axios": "^1.2.1", + "axios-mock-adapter": "^1.21.2", + "base64-js": "^1.5.1", + "better-scroll": "^2.5.0", + "china-division": "^2.4.0", + "core-js": "^3.26.1", + "cos-js-sdk-v5": "^1.4.15-beta.0", + "cropperjs": "^1.5.13", + "deepdash-es": "5.3.5", + "highlight.js": "^11.7.0", + "lodash-es": "^4.17.15", + "mitt": "^3.0.0", + "nprogress": "^0.2.0", + "object-assign": "^4.1.1", + "pinia": "2.0.28", + "qiniu-js": "^3.4.1", + "sortablejs": "^1.14.0", + "vue": "^3.2.45", + "vue-cropperjs": "^5.0.0", + "vue-i18n": "^9.2.2", + "vue-router": "^4.1.5", + "vuedraggable": "^4.0.1" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^23.0.4", + "@rollup/plugin-node-resolve": "^15.0.1", + "@types/chai": "^4.3.4", + "@types/lodash-es": "^4.17.6", + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.15", + "@typescript-eslint/eslint-plugin": "^5.46.1", + "@typescript-eslint/parser": "^5.46.1", + "@vitejs/plugin-legacy": "^3.0.1", + "@vitejs/plugin-vue": "^4.0.0", + "@vitejs/plugin-vue-jsx": "^3.0.0", + "@vue/compiler-sfc": "^3.2.45", + "@vue/eslint-config-typescript": "^11.0.2", + "@vue/test-utils": "^2.2.6", + "autoprefixer": "^10.4.12", + "caller-path": "^4.0.0", + "chai": "^4.3.7", + "eslint": "8.29.0", + "eslint-config-prettier": "^8.1.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^4.2.1", + "eslint-plugin-promise": "^6.0.1", + "eslint-plugin-vue": "^9.8.0", + "esno": "^0.16.3", + "husky": "^8.0.2", + "less": "^4.1.3", + "less-loader": "^11.0.0", + "lint-staged": "^13.1.0", + "postcss": "^8.4.20", + "prettier": "2.8.1", + "pretty-quick": "^3.1.3", + "rimraf": "^3.0.2", + "rollup": "^3.7.4", + "rollup-plugin-visualizer": "^5.8.2", + "stylelint": "^14.16.0", + "stylelint-config-prettier": "^9.0.4", + "stylelint-order": "^5.0.0", + "tailwindcss": "^3.2.4", + "ts-node": "^10.9.1", + "typescript": "4.9.4", + "vite": "^4.0.1", + "vite-plugin-compression": "^0.5.1", + "vite-plugin-optimize-persist": "^0.1.2", + "vite-plugin-package-config": "^0.1.1", + "vite-plugin-purge-icons": "^0.9.2", + "vite-plugin-theme": "^0.8.1", + "vite-plugin-windicss": "^1.8.10", + "vue-eslint-parser": "^9.1.0", + "windicss": "^3.5.6" + }, + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } + }, + "gitHead": "9c2162697f3affea22c9a8cbc0ca74f4034ab27e", + "vite": { + "optimizeDeps": { + "include": [ + "@iconify/iconify" + ] + } + } +} diff --git a/packages/ui/certd-client/public/favicon.ico b/packages/ui/certd-client/public/favicon.ico new file mode 100644 index 000000000..df36fcfb7 Binary files /dev/null and b/packages/ui/certd-client/public/favicon.ico differ diff --git a/packages/ui/certd-client/public/images/logo-certd/logo.svg b/packages/ui/certd-client/public/images/logo-certd/logo.svg new file mode 100644 index 000000000..edcdefbed --- /dev/null +++ b/packages/ui/certd-client/public/images/logo-certd/logo.svg @@ -0,0 +1,7 @@ + + + diff --git a/packages/ui/certd-client/public/images/logo-certd/rect-black.svg b/packages/ui/certd-client/public/images/logo-certd/rect-black.svg new file mode 100644 index 000000000..19bf439f6 --- /dev/null +++ b/packages/ui/certd-client/public/images/logo-certd/rect-black.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 让你的证书永不过期 + + + diff --git a/packages/ui/certd-client/public/images/logo-certd/rect.svg b/packages/ui/certd-client/public/images/logo-certd/rect.svg new file mode 100644 index 000000000..acc2f41c7 --- /dev/null +++ b/packages/ui/certd-client/public/images/logo-certd/rect.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 让你的证书永不过期 + + + diff --git a/packages/ui/certd-client/public/images/logo-certd/square.svg b/packages/ui/certd-client/public/images/logo-certd/square.svg new file mode 100644 index 000000000..026dd978f --- /dev/null +++ b/packages/ui/certd-client/public/images/logo-certd/square.svg @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/packages/ui/certd-client/public/images/logo/logo.svg b/packages/ui/certd-client/public/images/logo/logo.svg new file mode 100644 index 000000000..edcdefbed --- /dev/null +++ b/packages/ui/certd-client/public/images/logo/logo.svg @@ -0,0 +1,7 @@ + + + diff --git a/packages/ui/certd-client/public/images/logo/rect-black.svg b/packages/ui/certd-client/public/images/logo/rect-black.svg new file mode 100644 index 000000000..a57352ec1 --- /dev/null +++ b/packages/ui/certd-client/public/images/logo/rect-black.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/packages/ui/certd-client/public/images/logo/rect.svg b/packages/ui/certd-client/public/images/logo/rect.svg new file mode 100644 index 000000000..acc2f41c7 --- /dev/null +++ b/packages/ui/certd-client/public/images/logo/rect.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 让你的证书永不过期 + + + diff --git a/packages/ui/certd-client/public/images/logo/square.svg b/packages/ui/certd-client/public/images/logo/square.svg new file mode 100644 index 000000000..1b1395a16 --- /dev/null +++ b/packages/ui/certd-client/public/images/logo/square.svg @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/packages/ui/certd-client/public/index.css b/packages/ui/certd-client/public/index.css new file mode 100644 index 000000000..0950b0504 --- /dev/null +++ b/packages/ui/certd-client/public/index.css @@ -0,0 +1,12 @@ +html, body, #app { height: 100%; margin: 0; padding: 0; width: 100%;} +.fs-bootstrap { background-color: #474949; height: 100%; display: flex; flex-direction: column;position: fixed;width: 100% } +.fs-bootstrap__main {flex:1; user-select: none; width: 100%; flex-grow: 1; display: flex; justify-content: center; align-items: center; flex-direction: column; } +.fs-bootstrap__footer { width: 100%; flex-grow: 0; text-align: center; padding: 10px 0; } +.fs-bootstrap__footer > a { font-size: 12px; color: #ABABAB; text-decoration: none; } +.fs-bootstrap__loading {box-sizing: border-box; height: 50px; width: 50px; margin-bottom: 5px;border:5px solid #333333;border-bottom:#aaa 5px solid; + border-radius:1000px; animation:load 1.1s infinite linear;-webkit-animation:load 1.1s infinite linear;-moz-animation:load 1.1s infinite linear; -o-animation:load 1.1s infinite linear; +} +@keyframes load {from {transform:rotate(0deg);-ms-transform:rotate(0deg);}to { transform:rotate(360deg);-ms-transform:rotate(360deg); } +}@-webkit-keyframes load {from {-webkit-transform:rotate(0deg); }to { -webkit-transform:rotate(360deg);} + }@-moz-keyframes load { from { -moz-transform:rotate(0deg); } to { -moz-transform:rotate(360deg);} + }@-o-keyframes load { from { -o-transform:rotate(0deg);} to { -o-transform:rotate(360deg);}} diff --git a/packages/ui/certd-client/public/index.html b/packages/ui/certd-client/public/index.html new file mode 100644 index 000000000..3e5a13962 --- /dev/null +++ b/packages/ui/certd-client/public/index.html @@ -0,0 +1,17 @@ + + + + + + + + <%= htmlWebpackPlugin.options.title %> + + + +
+ + + diff --git a/packages/ui/certd-client/public/logo.svg b/packages/ui/certd-client/public/logo.svg new file mode 100644 index 000000000..1b1395a16 --- /dev/null +++ b/packages/ui/certd-client/public/logo.svg @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/packages/ui/certd-client/src/App.vue b/packages/ui/certd-client/src/App.vue new file mode 100644 index 000000000..5059cfa5c --- /dev/null +++ b/packages/ui/certd-client/src/App.vue @@ -0,0 +1,56 @@ + + + diff --git a/packages/ui/certd-client/src/api/modules/api.user.mock.ts b/packages/ui/certd-client/src/api/modules/api.user.mock.ts new file mode 100644 index 000000000..53411901b --- /dev/null +++ b/packages/ui/certd-client/src/api/modules/api.user.mock.ts @@ -0,0 +1,31 @@ +export default [ + { + path: "/login", + method: "post", + handle() { + return { + code: 0, + msg: "success", + data: { + token: "faker token", + expire: 10000 + } + }; + } + }, + { + path: "/sys/authority/user/mine", + method: "get", + handle() { + return { + code: 0, + msg: "success", + data: { + id: 1, + username: "username", + nickName: "admin" + } + }; + } + } +]; diff --git a/packages/ui/certd-client/src/api/modules/api.user.ts b/packages/ui/certd-client/src/api/modules/api.user.ts new file mode 100644 index 000000000..ea711596f --- /dev/null +++ b/packages/ui/certd-client/src/api/modules/api.user.ts @@ -0,0 +1,51 @@ +import { request, requestForMock } from "../service"; +import { env } from "/@/utils/util.env"; +/** + * @description: Login interface parameters + */ +export interface LoginReq { + username: string; + password: string; +} + +export interface UserInfoRes { + id: string | number; + username: string; + nickName: string; +} + +export interface LoginRes { + token: string; + expire: number; +} + +export async function login(data: LoginReq): Promise { + if (env.PM_ENABLED === "false") { + //没有开启权限模块,模拟登录 + return await requestForMock({ + url: "/login", + method: "post", + data + }); + } + //如果开启了登录与权限模块,则真实登录 + return await request({ + url: "/login", + method: "post", + data + }); +} + +export async function mine(): Promise { + if (env.PM_ENABLED === "false") { + //没有开启权限模块,模拟登录 + return await requestForMock({ + url: "/sys/authority/user/mine", + method: "post" + }); + } + return await request({ + url: "/sys/authority/user/mine", + method: "post" + }); +} diff --git a/packages/ui/certd-client/src/api/service.ts b/packages/ui/certd-client/src/api/service.ts new file mode 100644 index 000000000..cd8da796f --- /dev/null +++ b/packages/ui/certd-client/src/api/service.ts @@ -0,0 +1,138 @@ +import axios from "axios"; +import { get } from "lodash-es"; +import Adapter from "axios-mock-adapter"; +import { errorLog, errorCreate } from "./tools"; +import { env } from "/src/utils/util.env"; +import { useUserStore } from "../store/modules/user"; +/** + * @description 创建请求实例 + */ +function createService() { + // 创建一个 axios 实例 + const service = axios.create(); + // 请求拦截 + service.interceptors.request.use( + (config) => config, + (error) => { + // 发送失败 + console.log(error); + return Promise.reject(error); + } + ); + // 响应拦截 + service.interceptors.response.use( + (response) => { + if (response.config.responseType === "blob") { + return response; + } + // dataAxios 是 axios 返回数据中的 data + const dataAxios = response.data; + // 这个状态码是和后端约定的 + const { code } = dataAxios; + // 根据 code 进行判断 + if (code === undefined) { + // 如果没有 code 代表这不是项目后端开发的接口 比如可能是 D2Admin 请求最新版本 + errorCreate(`非标准返回:${dataAxios}, ${response.config.url}`); + return dataAxios; + } else { + // 有 code 代表这是一个后端接口 可以进行进一步的判断 + switch (code) { + case 0: + // [ 示例 ] code === 0 代表没有错误 + // @ts-ignore + if (response.config.unpack === false) { + //如果不需要解包 + return dataAxios; + } + return dataAxios.data; + default: + // 不是正确的 code + errorCreate(`${dataAxios.msg}: ${response.config.url}`); + return dataAxios; + } + } + }, + (error) => { + const status = get(error, "response.status"); + switch (status) { + case 400: + error.message = "请求错误"; + break; + case 401: + error.message = "未授权,请登录"; + break; + case 403: + error.message = "拒绝访问"; + break; + case 404: + error.message = `请求地址出错: ${error.response.config.url}`; + break; + case 408: + error.message = "请求超时"; + break; + case 500: + error.message = "服务器内部错误"; + break; + case 501: + error.message = "服务未实现"; + break; + case 502: + error.message = "网关错误"; + break; + case 503: + error.message = "服务不可用"; + break; + case 504: + error.message = "网关超时"; + break; + case 505: + error.message = "HTTP版本不受支持"; + break; + default: + break; + } + errorLog(error); + if (status === 401) { + const userStore = useUserStore(); + userStore.logout(); + } + return Promise.reject(error); + } + ); + return service; +} + +/** + * @description 创建请求方法 + * @param {Object} service axios 实例 + */ +function createRequestFunction(service) { + return function (config) { + const configDefault = { + headers: { + "Content-Type": get(config, "headers.Content-Type", "application/json") + }, + timeout: 5000, + baseURL: env.API, + data: {} + }; + const userStore = useUserStore(); + const token = userStore.getToken; + if (token != null) { + // @ts-ignore + configDefault.headers.Authorization = token; + } + return service(Object.assign(configDefault, config)); + }; +} + +// 用于真实网络请求的实例和请求方法 +export const service = createService(); +export const request = createRequestFunction(service); + +// 用于模拟网络请求的实例和请求方法 +export const serviceForMock = createService(); +export const requestForMock = createRequestFunction(serviceForMock); + +// 网络请求数据模拟工具 +export const mock = new Adapter(serviceForMock, { delayResponse: 200 }); diff --git a/packages/ui/certd-client/src/api/tools.ts b/packages/ui/certd-client/src/api/tools.ts new file mode 100644 index 000000000..80fa784bf --- /dev/null +++ b/packages/ui/certd-client/src/api/tools.ts @@ -0,0 +1,66 @@ +/** + * @description 安全地解析 json 字符串 + * @param {String} jsonString 需要解析的 json 字符串 + * @param {String} defaultValue 默认值 + */ +import { uiContext } from "@fast-crud/fast-crud"; + +export function parse(jsonString = "{}", defaultValue = {}) { + let result = defaultValue; + try { + result = JSON.parse(jsonString); + } catch (error) { + console.log(error); + } + return result; +} + +/** + * @description 接口请求返回 + * @param {Any} data 返回值 + * @param {String} msg 状态信息 + * @param {Number} code 状态码 + */ +export function response(data = {}, msg = "", code = 0) { + return [200, { code, msg, data }]; +} + +/** + * @description 接口请求返回 正确返回 + * @param {Any} data 返回值 + * @param {String} msg 状态信息 + */ +export function responseSuccess(data = {}, msg = "成功") { + return response(data, msg); +} + +/** + * @description 接口请求返回 错误返回 + * @param {Any} data 返回值 + * @param {String} msg 状态信息 + * @param {Number} code 状态码 + */ +export function responseError(data = {}, msg = "请求失败", code = 500) { + return response(data, msg, code); +} + +/** + * @description 记录和显示错误 + * @param {Error} error 错误对象 + */ +export function errorLog(error) { + // 打印到控制台 + console.error(error); + // 显示提示 + uiContext.get().notification.error({ message: error.message }); +} + +/** + * @description 创建一个错误 + * @param {String} msg 错误信息 + */ +export function errorCreate(msg) { + const error = new Error(msg); + errorLog(error); + throw error; +} diff --git a/packages/ui/certd-client/src/assets/background.svg b/packages/ui/certd-client/src/assets/background.svg new file mode 100644 index 000000000..89c259764 --- /dev/null +++ b/packages/ui/certd-client/src/assets/background.svg @@ -0,0 +1,69 @@ + + + + Group 21 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/ui/certd-client/src/assets/logo.png b/packages/ui/certd-client/src/assets/logo.png new file mode 100644 index 000000000..f3d2503fc Binary files /dev/null and b/packages/ui/certd-client/src/assets/logo.png differ diff --git a/packages/ui/certd-client/src/components/highlight-styles/agate.css b/packages/ui/certd-client/src/components/highlight-styles/agate.css new file mode 100644 index 000000000..8d64547c5 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/agate.css @@ -0,0 +1,108 @@ +/*! + * Agate by Taufik Nurrohman + * ---------------------------------------------------- + * + * #ade5fc + * #a2fca2 + * #c6b4f0 + * #d36363 + * #fcc28c + * #fc9b9b + * #ffa + * #fff + * #333 + * #62c8f3 + * #888 + * + */ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #333; + color: white; +} + +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-code, +.hljs-emphasis { + font-style: italic; +} + +.hljs-tag { + color: #62c8f3; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-selector-id, +.hljs-selector-class { + color: #ade5fc; +} + +.hljs-string, +.hljs-bullet { + color: #a2fca2; +} + +.hljs-type, +.hljs-title, +.hljs-section, +.hljs-attribute, +.hljs-quote, +.hljs-built_in, +.hljs-builtin-name { + color: #ffa; +} + +.hljs-number, +.hljs-symbol, +.hljs-bullet { + color: #d36363; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal { + color: #fcc28c; +} + +.hljs-comment, +.hljs-deletion, +.hljs-code { + color: #888; +} + +.hljs-regexp, +.hljs-link { + color: #c6b4f0; +} + +.hljs-meta { + color: #fc9b9b; +} + +.hljs-deletion { + background-color: #fc9b9b; + color: #333; +} + +.hljs-addition { + background-color: #a2fca2; + color: #333; +} + +.hljs a { + color: inherit; +} + +.hljs a:focus, +.hljs a:hover { + color: inherit; + text-decoration: underline; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/androidstudio.css b/packages/ui/certd-client/src/components/highlight-styles/androidstudio.css new file mode 100644 index 000000000..bc8e473b5 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/androidstudio.css @@ -0,0 +1,66 @@ +/* +Date: 24 Fev 2015 +Author: Pedro Oliveira +*/ + +.hljs { + color: #a9b7c6; + background: #282b2e; + display: block; + overflow-x: auto; + padding: 0.5em; +} + +.hljs-number, +.hljs-literal, +.hljs-symbol, +.hljs-bullet { + color: #6897BB; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-deletion { + color: #cc7832; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-link { + color: #629755; +} + +.hljs-comment, +.hljs-quote { + color: #808080; +} + +.hljs-meta { + color: #bbb529; +} + +.hljs-string, +.hljs-attribute, +.hljs-addition { + color: #6A8759; +} + +.hljs-section, +.hljs-title, +.hljs-type { + color: #ffc66d; +} + +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #e8bf6a; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/arduino-light.css b/packages/ui/certd-client/src/components/highlight-styles/arduino-light.css new file mode 100644 index 000000000..4b8b7fd3c --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/arduino-light.css @@ -0,0 +1,88 @@ +/* + +Arduino® Light Theme - Stefania Mellai + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #FFFFFF; +} + +.hljs, +.hljs-subst { + color: #434f54; +} + +.hljs-keyword, +.hljs-attribute, +.hljs-selector-tag, +.hljs-doctag, +.hljs-name { + color: #00979D; +} + +.hljs-built_in, +.hljs-literal, +.hljs-bullet, +.hljs-code, +.hljs-addition { + color: #D35400; +} + +.hljs-regexp, +.hljs-symbol, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #00979D; +} + +.hljs-type, +.hljs-string, +.hljs-selector-id, +.hljs-selector-class, +.hljs-quote, +.hljs-template-tag, +.hljs-deletion { + color: #005C5F; +} + +.hljs-title, +.hljs-section { + color: #880000; + font-weight: bold; +} + +.hljs-comment { + color: rgba(149,165,166,.8); +} + +.hljs-meta-keyword { + color: #728E00; +} + +.hljs-meta { + color: #728E00; + color: #434f54; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-function { + color: #728E00; +} + +.hljs-number { + color: #8A7B52; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/arta.css b/packages/ui/certd-client/src/components/highlight-styles/arta.css new file mode 100644 index 000000000..75ef3a9e5 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/arta.css @@ -0,0 +1,73 @@ +/* +Date: 17.V.2011 +Author: pumbur +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #222; +} + +.hljs, +.hljs-subst { + color: #aaa; +} + +.hljs-section { + color: #fff; +} + +.hljs-comment, +.hljs-quote, +.hljs-meta { + color: #444; +} + +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-regexp { + color: #ffcc33; +} + +.hljs-number, +.hljs-addition { + color: #00cc66; +} + +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-template-variable, +.hljs-attribute, +.hljs-link { + color: #32aaee; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #6644aa; +} + +.hljs-title, +.hljs-variable, +.hljs-deletion, +.hljs-template-tag { + color: #bb1166; +} + +.hljs-section, +.hljs-doctag, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/ascetic.css b/packages/ui/certd-client/src/components/highlight-styles/ascetic.css new file mode 100644 index 000000000..48397e889 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/ascetic.css @@ -0,0 +1,45 @@ +/* + +Original style from softwaremaniacs.org (c) Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: white; + color: black; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-symbol, +.hljs-bullet, +.hljs-section, +.hljs-addition, +.hljs-attribute, +.hljs-link { + color: #888; +} + +.hljs-comment, +.hljs-quote, +.hljs-meta, +.hljs-deletion { + color: #ccc; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-section, +.hljs-name, +.hljs-type, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-cave-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-cave-dark.css new file mode 100644 index 000000000..65428f3b1 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-cave-dark.css @@ -0,0 +1,83 @@ +/* Base16 Atelier Cave Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/cave) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Cave Comment */ +.hljs-comment, +.hljs-quote { + color: #7e7887; +} + +/* Atelier-Cave Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-regexp, +.hljs-link, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #be4678; +} + +/* Atelier-Cave Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #aa573c; +} + +/* Atelier-Cave Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #2a9292; +} + +/* Atelier-Cave Blue */ +.hljs-title, +.hljs-section { + color: #576ddb; +} + +/* Atelier-Cave Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #955ae7; +} + +.hljs-deletion, +.hljs-addition { + color: #19171c; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #be4678; +} + +.hljs-addition { + background-color: #2a9292; +} + +.hljs { + display: block; + overflow-x: auto; + background: #19171c; + color: #8b8792; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-cave-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-cave-light.css new file mode 100644 index 000000000..b419f9fd8 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-cave-light.css @@ -0,0 +1,85 @@ +/* Base16 Atelier Cave Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/cave) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Cave Comment */ +.hljs-comment, +.hljs-quote { + color: #655f6d; +} + +/* Atelier-Cave Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #be4678; +} + +/* Atelier-Cave Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #aa573c; +} + +/* Atelier-Cave Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #2a9292; +} + +/* Atelier-Cave Blue */ +.hljs-title, +.hljs-section { + color: #576ddb; +} + +/* Atelier-Cave Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #955ae7; +} + +.hljs-deletion, +.hljs-addition { + color: #19171c; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #be4678; +} + +.hljs-addition { + background-color: #2a9292; +} + +.hljs { + display: block; + overflow-x: auto; + background: #efecf4; + color: #585260; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-dune-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-dune-dark.css new file mode 100644 index 000000000..1684f5225 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-dune-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Dune Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Dune Comment */ +.hljs-comment, +.hljs-quote { + color: #999580; +} + +/* Atelier-Dune Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #d73737; +} + +/* Atelier-Dune Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #b65611; +} + +/* Atelier-Dune Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #60ac39; +} + +/* Atelier-Dune Blue */ +.hljs-title, +.hljs-section { + color: #6684e1; +} + +/* Atelier-Dune Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #b854d4; +} + +.hljs { + display: block; + overflow-x: auto; + background: #20201d; + color: #a6a28c; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-dune-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-dune-light.css new file mode 100644 index 000000000..547719de8 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-dune-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Dune Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Dune Comment */ +.hljs-comment, +.hljs-quote { + color: #7d7a68; +} + +/* Atelier-Dune Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #d73737; +} + +/* Atelier-Dune Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #b65611; +} + +/* Atelier-Dune Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #60ac39; +} + +/* Atelier-Dune Blue */ +.hljs-title, +.hljs-section { + color: #6684e1; +} + +/* Atelier-Dune Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #b854d4; +} + +.hljs { + display: block; + overflow-x: auto; + background: #fefbec; + color: #6e6b5e; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-estuary-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-estuary-dark.css new file mode 100644 index 000000000..a5e507187 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-estuary-dark.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Estuary Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/estuary) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Estuary Comment */ +.hljs-comment, +.hljs-quote { + color: #878573; +} + +/* Atelier-Estuary Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ba6236; +} + +/* Atelier-Estuary Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #ae7313; +} + +/* Atelier-Estuary Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #7d9726; +} + +/* Atelier-Estuary Blue */ +.hljs-title, +.hljs-section { + color: #36a166; +} + +/* Atelier-Estuary Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #5f9182; +} + +.hljs-deletion, +.hljs-addition { + color: #22221b; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #ba6236; +} + +.hljs-addition { + background-color: #7d9726; +} + +.hljs { + display: block; + overflow-x: auto; + background: #22221b; + color: #929181; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-estuary-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-estuary-light.css new file mode 100644 index 000000000..1daee5d98 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-estuary-light.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Estuary Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/estuary) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Estuary Comment */ +.hljs-comment, +.hljs-quote { + color: #6c6b5a; +} + +/* Atelier-Estuary Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ba6236; +} + +/* Atelier-Estuary Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #ae7313; +} + +/* Atelier-Estuary Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #7d9726; +} + +/* Atelier-Estuary Blue */ +.hljs-title, +.hljs-section { + color: #36a166; +} + +/* Atelier-Estuary Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #5f9182; +} + +.hljs-deletion, +.hljs-addition { + color: #22221b; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #ba6236; +} + +.hljs-addition { + background-color: #7d9726; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f4f3ec; + color: #5f5e4e; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-forest-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-forest-dark.css new file mode 100644 index 000000000..0ef4fae31 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-forest-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Forest Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Forest Comment */ +.hljs-comment, +.hljs-quote { + color: #9c9491; +} + +/* Atelier-Forest Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #f22c40; +} + +/* Atelier-Forest Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #df5320; +} + +/* Atelier-Forest Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #7b9726; +} + +/* Atelier-Forest Blue */ +.hljs-title, +.hljs-section { + color: #407ee7; +} + +/* Atelier-Forest Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6666ea; +} + +.hljs { + display: block; + overflow-x: auto; + background: #1b1918; + color: #a8a19f; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-forest-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-forest-light.css new file mode 100644 index 000000000..bbedde18a --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-forest-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Forest Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/forest) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Forest Comment */ +.hljs-comment, +.hljs-quote { + color: #766e6b; +} + +/* Atelier-Forest Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #f22c40; +} + +/* Atelier-Forest Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #df5320; +} + +/* Atelier-Forest Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #7b9726; +} + +/* Atelier-Forest Blue */ +.hljs-title, +.hljs-section { + color: #407ee7; +} + +/* Atelier-Forest Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6666ea; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f1efee; + color: #68615e; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-heath-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-heath-dark.css new file mode 100644 index 000000000..fe01ff721 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-heath-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Heath Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Heath Comment */ +.hljs-comment, +.hljs-quote { + color: #9e8f9e; +} + +/* Atelier-Heath Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ca402b; +} + +/* Atelier-Heath Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #a65926; +} + +/* Atelier-Heath Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #918b3b; +} + +/* Atelier-Heath Blue */ +.hljs-title, +.hljs-section { + color: #516aec; +} + +/* Atelier-Heath Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #7b59c0; +} + +.hljs { + display: block; + overflow-x: auto; + background: #1b181b; + color: #ab9bab; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-heath-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-heath-light.css new file mode 100644 index 000000000..ee43786d1 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-heath-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Heath Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/heath) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Heath Comment */ +.hljs-comment, +.hljs-quote { + color: #776977; +} + +/* Atelier-Heath Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ca402b; +} + +/* Atelier-Heath Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #a65926; +} + +/* Atelier-Heath Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #918b3b; +} + +/* Atelier-Heath Blue */ +.hljs-title, +.hljs-section { + color: #516aec; +} + +/* Atelier-Heath Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #7b59c0; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f7f3f7; + color: #695d69; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-lakeside-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-lakeside-dark.css new file mode 100644 index 000000000..a937d3bf5 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-lakeside-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Lakeside Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Lakeside Comment */ +.hljs-comment, +.hljs-quote { + color: #7195a8; +} + +/* Atelier-Lakeside Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #d22d72; +} + +/* Atelier-Lakeside Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #935c25; +} + +/* Atelier-Lakeside Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #568c3b; +} + +/* Atelier-Lakeside Blue */ +.hljs-title, +.hljs-section { + color: #257fad; +} + +/* Atelier-Lakeside Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6b6bb8; +} + +.hljs { + display: block; + overflow-x: auto; + background: #161b1d; + color: #7ea2b4; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-lakeside-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-lakeside-light.css new file mode 100644 index 000000000..6c7e8f9ef --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-lakeside-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Lakeside Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Lakeside Comment */ +.hljs-comment, +.hljs-quote { + color: #5a7b8c; +} + +/* Atelier-Lakeside Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #d22d72; +} + +/* Atelier-Lakeside Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #935c25; +} + +/* Atelier-Lakeside Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #568c3b; +} + +/* Atelier-Lakeside Blue */ +.hljs-title, +.hljs-section { + color: #257fad; +} + +/* Atelier-Lakeside Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6b6bb8; +} + +.hljs { + display: block; + overflow-x: auto; + background: #ebf8ff; + color: #516d7b; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-plateau-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-plateau-dark.css new file mode 100644 index 000000000..3bb052693 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-plateau-dark.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Plateau Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/plateau) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Plateau Comment */ +.hljs-comment, +.hljs-quote { + color: #7e7777; +} + +/* Atelier-Plateau Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ca4949; +} + +/* Atelier-Plateau Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #b45a3c; +} + +/* Atelier-Plateau Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #4b8b8b; +} + +/* Atelier-Plateau Blue */ +.hljs-title, +.hljs-section { + color: #7272ca; +} + +/* Atelier-Plateau Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #8464c4; +} + +.hljs-deletion, +.hljs-addition { + color: #1b1818; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #ca4949; +} + +.hljs-addition { + background-color: #4b8b8b; +} + +.hljs { + display: block; + overflow-x: auto; + background: #1b1818; + color: #8a8585; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-plateau-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-plateau-light.css new file mode 100644 index 000000000..5f0222bec --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-plateau-light.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Plateau Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/plateau) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Plateau Comment */ +.hljs-comment, +.hljs-quote { + color: #655d5d; +} + +/* Atelier-Plateau Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #ca4949; +} + +/* Atelier-Plateau Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #b45a3c; +} + +/* Atelier-Plateau Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #4b8b8b; +} + +/* Atelier-Plateau Blue */ +.hljs-title, +.hljs-section { + color: #7272ca; +} + +/* Atelier-Plateau Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #8464c4; +} + +.hljs-deletion, +.hljs-addition { + color: #1b1818; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #ca4949; +} + +.hljs-addition { + background-color: #4b8b8b; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f4ecec; + color: #585050; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-savanna-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-savanna-dark.css new file mode 100644 index 000000000..38f831431 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-savanna-dark.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Savanna Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/savanna) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Savanna Comment */ +.hljs-comment, +.hljs-quote { + color: #78877d; +} + +/* Atelier-Savanna Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #b16139; +} + +/* Atelier-Savanna Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #9f713c; +} + +/* Atelier-Savanna Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #489963; +} + +/* Atelier-Savanna Blue */ +.hljs-title, +.hljs-section { + color: #478c90; +} + +/* Atelier-Savanna Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #55859b; +} + +.hljs-deletion, +.hljs-addition { + color: #171c19; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #b16139; +} + +.hljs-addition { + background-color: #489963; +} + +.hljs { + display: block; + overflow-x: auto; + background: #171c19; + color: #87928a; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-savanna-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-savanna-light.css new file mode 100644 index 000000000..1ccd7c685 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-savanna-light.css @@ -0,0 +1,84 @@ +/* Base16 Atelier Savanna Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/savanna) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Savanna Comment */ +.hljs-comment, +.hljs-quote { + color: #5f6d64; +} + +/* Atelier-Savanna Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #b16139; +} + +/* Atelier-Savanna Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #9f713c; +} + +/* Atelier-Savanna Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #489963; +} + +/* Atelier-Savanna Blue */ +.hljs-title, +.hljs-section { + color: #478c90; +} + +/* Atelier-Savanna Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #55859b; +} + +.hljs-deletion, +.hljs-addition { + color: #171c19; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #b16139; +} + +.hljs-addition { + background-color: #489963; +} + +.hljs { + display: block; + overflow-x: auto; + background: #ecf4ee; + color: #526057; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-seaside-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-seaside-dark.css new file mode 100644 index 000000000..df29949c6 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-seaside-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Seaside Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Seaside Comment */ +.hljs-comment, +.hljs-quote { + color: #809980; +} + +/* Atelier-Seaside Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #e6193c; +} + +/* Atelier-Seaside Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #87711d; +} + +/* Atelier-Seaside Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #29a329; +} + +/* Atelier-Seaside Blue */ +.hljs-title, +.hljs-section { + color: #3d62f5; +} + +/* Atelier-Seaside Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #ad2bee; +} + +.hljs { + display: block; + overflow-x: auto; + background: #131513; + color: #8ca68c; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-seaside-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-seaside-light.css new file mode 100644 index 000000000..9d960f29f --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-seaside-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Seaside Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/seaside) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Seaside Comment */ +.hljs-comment, +.hljs-quote { + color: #687d68; +} + +/* Atelier-Seaside Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #e6193c; +} + +/* Atelier-Seaside Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #87711d; +} + +/* Atelier-Seaside Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #29a329; +} + +/* Atelier-Seaside Blue */ +.hljs-title, +.hljs-section { + color: #3d62f5; +} + +/* Atelier-Seaside Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #ad2bee; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f4fbf4; + color: #5e6e5e; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-sulphurpool-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-sulphurpool-dark.css new file mode 100644 index 000000000..c2ab7938d --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-sulphurpool-dark.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Sulphurpool Dark - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/sulphurpool) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Sulphurpool Comment */ +.hljs-comment, +.hljs-quote { + color: #898ea4; +} + +/* Atelier-Sulphurpool Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #c94922; +} + +/* Atelier-Sulphurpool Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #c76b29; +} + +/* Atelier-Sulphurpool Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #ac9739; +} + +/* Atelier-Sulphurpool Blue */ +.hljs-title, +.hljs-section { + color: #3d8fd1; +} + +/* Atelier-Sulphurpool Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6679cc; +} + +.hljs { + display: block; + overflow-x: auto; + background: #202746; + color: #979db4; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atelier-sulphurpool-light.css b/packages/ui/certd-client/src/components/highlight-styles/atelier-sulphurpool-light.css new file mode 100644 index 000000000..96c47d086 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atelier-sulphurpool-light.css @@ -0,0 +1,69 @@ +/* Base16 Atelier Sulphurpool Light - Theme */ +/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/sulphurpool) */ +/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */ + +/* Atelier-Sulphurpool Comment */ +.hljs-comment, +.hljs-quote { + color: #6b7394; +} + +/* Atelier-Sulphurpool Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-regexp, +.hljs-link, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #c94922; +} + +/* Atelier-Sulphurpool Orange */ +.hljs-number, +.hljs-meta, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #c76b29; +} + +/* Atelier-Sulphurpool Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet { + color: #ac9739; +} + +/* Atelier-Sulphurpool Blue */ +.hljs-title, +.hljs-section { + color: #3d8fd1; +} + +/* Atelier-Sulphurpool Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #6679cc; +} + +.hljs { + display: block; + overflow-x: auto; + background: #f5f7ff; + color: #5e6687; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atom-one-dark.css b/packages/ui/certd-client/src/components/highlight-styles/atom-one-dark.css new file mode 100644 index 000000000..1616aafe3 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atom-one-dark.css @@ -0,0 +1,96 @@ +/* + +Atom One Dark by Daniel Gamage +Original One Dark Syntax theme from https://github.com/atom/one-dark-syntax + +base: #282c34 +mono-1: #abb2bf +mono-2: #818896 +mono-3: #5c6370 +hue-1: #56b6c2 +hue-2: #61aeee +hue-3: #c678dd +hue-4: #98c379 +hue-5: #e06c75 +hue-5-2: #be5046 +hue-6: #d19a66 +hue-6-2: #e6c07b + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #abb2bf; + background: #282c34; +} + +.hljs-comment, +.hljs-quote { + color: #5c6370; + font-style: italic; +} + +.hljs-doctag, +.hljs-keyword, +.hljs-formula { + color: #c678dd; +} + +.hljs-section, +.hljs-name, +.hljs-selector-tag, +.hljs-deletion, +.hljs-subst { + color: #e06c75; +} + +.hljs-literal { + color: #56b6c2; +} + +.hljs-string, +.hljs-regexp, +.hljs-addition, +.hljs-attribute, +.hljs-meta-string { + color: #98c379; +} + +.hljs-built_in, +.hljs-class .hljs-title { + color: #e6c07b; +} + +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-type, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-number { + color: #d19a66; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-meta, +.hljs-selector-id, +.hljs-title { + color: #61aeee; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/atom-one-light.css b/packages/ui/certd-client/src/components/highlight-styles/atom-one-light.css new file mode 100644 index 000000000..d5bd1d2a9 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/atom-one-light.css @@ -0,0 +1,96 @@ +/* + +Atom One Light by Daniel Gamage +Original One Light Syntax theme from https://github.com/atom/one-light-syntax + +base: #fafafa +mono-1: #383a42 +mono-2: #686b77 +mono-3: #a0a1a7 +hue-1: #0184bb +hue-2: #4078f2 +hue-3: #a626a4 +hue-4: #50a14f +hue-5: #e45649 +hue-5-2: #c91243 +hue-6: #986801 +hue-6-2: #c18401 + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #383a42; + background: #fafafa; +} + +.hljs-comment, +.hljs-quote { + color: #a0a1a7; + font-style: italic; +} + +.hljs-doctag, +.hljs-keyword, +.hljs-formula { + color: #a626a4; +} + +.hljs-section, +.hljs-name, +.hljs-selector-tag, +.hljs-deletion, +.hljs-subst { + color: #e45649; +} + +.hljs-literal { + color: #0184bb; +} + +.hljs-string, +.hljs-regexp, +.hljs-addition, +.hljs-attribute, +.hljs-meta-string { + color: #50a14f; +} + +.hljs-built_in, +.hljs-class .hljs-title { + color: #c18401; +} + +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-type, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-number { + color: #986801; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-meta, +.hljs-selector-id, +.hljs-title { + color: #4078f2; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/brown-paper.css b/packages/ui/certd-client/src/components/highlight-styles/brown-paper.css new file mode 100644 index 000000000..f0197b924 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/brown-paper.css @@ -0,0 +1,64 @@ +/* + +Brown Paper style from goldblog.com.ua (c) Zaripov Yura + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background:#b7a68e url(./brown-papersq.png); +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal { + color:#005599; + font-weight:bold; +} + +.hljs, +.hljs-subst { + color: #363c69; +} + +.hljs-string, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-built_in, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable, +.hljs-link, +.hljs-name { + color: #2c009f; +} + +.hljs-comment, +.hljs-quote, +.hljs-meta, +.hljs-deletion { + color: #802022; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/brown-papersq.png b/packages/ui/certd-client/src/components/highlight-styles/brown-papersq.png new file mode 100644 index 000000000..3813903db Binary files /dev/null and b/packages/ui/certd-client/src/components/highlight-styles/brown-papersq.png differ diff --git a/packages/ui/certd-client/src/components/highlight-styles/codepen-embed.css b/packages/ui/certd-client/src/components/highlight-styles/codepen-embed.css new file mode 100644 index 000000000..195c4a078 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/codepen-embed.css @@ -0,0 +1,60 @@ +/* + codepen.io Embed Theme + Author: Justin Perry + Original theme - https://github.com/chriskempson/tomorrow-theme +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #222; + color: #fff; +} + +.hljs-comment, +.hljs-quote { + color: #777; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-regexp, +.hljs-meta, +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-params, +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-deletion { + color: #ab875d; +} + +.hljs-section, +.hljs-title, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-type, +.hljs-attribute { + color: #9b869b; +} + +.hljs-string, +.hljs-keyword, +.hljs-selector-tag, +.hljs-addition { + color: #8f9c6c; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/color-brewer.css b/packages/ui/certd-client/src/components/highlight-styles/color-brewer.css new file mode 100644 index 000000000..7934d986a --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/color-brewer.css @@ -0,0 +1,71 @@ +/* + +Colorbrewer theme +Original: https://github.com/mbostock/colorbrewer-theme (c) Mike Bostock +Ported by Fabrício Tavares de Oliveira + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fff; +} + +.hljs, +.hljs-subst { + color: #000; +} + +.hljs-string, +.hljs-meta, +.hljs-symbol, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition { + color: #756bb1; +} + +.hljs-comment, +.hljs-quote { + color: #636363; +} + +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-bullet, +.hljs-link { + color: #31a354; +} + +.hljs-deletion, +.hljs-variable { + color: #88f; +} + + + +.hljs-keyword, +.hljs-selector-tag, +.hljs-title, +.hljs-section, +.hljs-built_in, +.hljs-doctag, +.hljs-type, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-strong { + color: #3182bd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-attribute { + color: #e6550d; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/darcula.css b/packages/ui/certd-client/src/components/highlight-styles/darcula.css new file mode 100644 index 000000000..be182d0b5 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/darcula.css @@ -0,0 +1,77 @@ +/* + +Darcula color scheme from the JetBrains family of IDEs + +*/ + + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #2b2b2b; +} + +.hljs { + color: #bababa; +} + +.hljs-strong, +.hljs-emphasis { + color: #a8a8a2; +} + +.hljs-bullet, +.hljs-quote, +.hljs-link, +.hljs-number, +.hljs-regexp, +.hljs-literal { + color: #6896ba; +} + +.hljs-code, +.hljs-selector-class { + color: #a6e22e; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-section, +.hljs-attribute, +.hljs-name, +.hljs-variable { + color: #cb7832; +} + +.hljs-params { + color: #b9b9b9; +} + +.hljs-string { + color: #6a8759; +} + +.hljs-subst, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-symbol, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition { + color: #e0c46c; +} + +.hljs-comment, +.hljs-deletion, +.hljs-meta { + color: #7f7f7f; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/dark.css b/packages/ui/certd-client/src/components/highlight-styles/dark.css new file mode 100644 index 000000000..b4724f5f5 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/dark.css @@ -0,0 +1,63 @@ +/* + +Dark style from softwaremaniacs.org (c) Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #444; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-section, +.hljs-link { + color: white; +} + +.hljs, +.hljs-subst { + color: #ddd; +} + +.hljs-string, +.hljs-title, +.hljs-name, +.hljs-type, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-built_in, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #d88; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #777; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-title, +.hljs-section, +.hljs-doctag, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/darkula.css b/packages/ui/certd-client/src/components/highlight-styles/darkula.css new file mode 100644 index 000000000..f4646c3c5 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/darkula.css @@ -0,0 +1,6 @@ +/* + Deprecated due to a typo in the name and left here for compatibility purpose only. + Please use darcula.css instead. +*/ + +@import url('darcula.css'); diff --git a/packages/ui/certd-client/src/components/highlight-styles/default.css b/packages/ui/certd-client/src/components/highlight-styles/default.css new file mode 100644 index 000000000..f1bfade31 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/default.css @@ -0,0 +1,99 @@ +/* + +Original highlight.js style (c) Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #F0F0F0; +} + + +/* Base color: saturation 0; */ + +.hljs, +.hljs-subst { + color: #444; +} + +.hljs-comment { + color: #888888; +} + +.hljs-keyword, +.hljs-attribute, +.hljs-selector-tag, +.hljs-meta-keyword, +.hljs-doctag, +.hljs-name { + font-weight: bold; +} + + +/* User color: hue: 0 */ + +.hljs-type, +.hljs-string, +.hljs-number, +.hljs-selector-id, +.hljs-selector-class, +.hljs-quote, +.hljs-template-tag, +.hljs-deletion { + color: #880000; +} + +.hljs-title, +.hljs-section { + color: #880000; + font-weight: bold; +} + +.hljs-regexp, +.hljs-symbol, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #BC6060; +} + + +/* Language color: hue: 90; */ + +.hljs-literal { + color: #78A960; +} + +.hljs-built_in, +.hljs-bullet, +.hljs-code, +.hljs-addition { + color: #397300; +} + + +/* Meta color: hue: 200 */ + +.hljs-meta { + color: #1f7199; +} + +.hljs-meta-string { + color: #4d99bf; +} + + +/* Misc effects */ + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/docco.css b/packages/ui/certd-client/src/components/highlight-styles/docco.css new file mode 100644 index 000000000..db366be37 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/docco.css @@ -0,0 +1,97 @@ +/* +Docco style used in http://jashkenas.github.com/docco/ converted by Simon Madine (@thingsinjars) +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #000; + background: #f8f8ff; +} + +.hljs-comment, +.hljs-quote { + color: #408080; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-subst { + color: #954121; +} + +.hljs-number { + color: #40a070; +} + +.hljs-string, +.hljs-doctag { + color: #219161; +} + +.hljs-selector-id, +.hljs-selector-class, +.hljs-section, +.hljs-type { + color: #19469d; +} + +.hljs-params { + color: #00f; +} + +.hljs-title { + color: #458; + font-weight: bold; +} + +.hljs-tag, +.hljs-name, +.hljs-attribute { + color: #000080; + font-weight: normal; +} + +.hljs-variable, +.hljs-template-variable { + color: #008080; +} + +.hljs-regexp, +.hljs-link { + color: #b68; +} + +.hljs-symbol, +.hljs-bullet { + color: #990073; +} + +.hljs-built_in, +.hljs-builtin-name { + color: #0086b3; +} + +.hljs-meta { + color: #999; + font-weight: bold; +} + +.hljs-deletion { + background: #fdd; +} + +.hljs-addition { + background: #dfd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/dracula.css b/packages/ui/certd-client/src/components/highlight-styles/dracula.css new file mode 100644 index 000000000..d591db680 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/dracula.css @@ -0,0 +1,76 @@ +/* + +Dracula Theme v1.2.0 + +https://github.com/zenorocha/dracula-theme + +Copyright 2015, All rights reserved + +Code licensed under the MIT license +http://zenorocha.mit-license.org + +@author Éverton Ribeiro +@author Zeno Rocha + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #282a36; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-section, +.hljs-link { + color: #8be9fd; +} + +.hljs-function .hljs-keyword { + color: #ff79c6; +} + +.hljs, +.hljs-subst { + color: #f8f8f2; +} + +.hljs-string, +.hljs-title, +.hljs-name, +.hljs-type, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #f1fa8c; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #6272a4; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-title, +.hljs-section, +.hljs-doctag, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/far.css b/packages/ui/certd-client/src/components/highlight-styles/far.css new file mode 100644 index 000000000..2b3f87b56 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/far.css @@ -0,0 +1,71 @@ +/* + +FAR Style (c) MajestiC + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #000080; +} + +.hljs, +.hljs-subst { + color: #0ff; +} + +.hljs-string, +.hljs-attribute, +.hljs-symbol, +.hljs-bullet, +.hljs-built_in, +.hljs-builtin-name, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition { + color: #ff0; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-section, +.hljs-type, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-variable { + color: #fff; +} + +.hljs-comment, +.hljs-quote, +.hljs-doctag, +.hljs-deletion { + color: #888; +} + +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-link { + color: #0f0; +} + +.hljs-meta { + color: #008080; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-title, +.hljs-section, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/foundation.css b/packages/ui/certd-client/src/components/highlight-styles/foundation.css new file mode 100644 index 000000000..f1fe64b37 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/foundation.css @@ -0,0 +1,88 @@ +/* +Description: Foundation 4 docs style for highlight.js +Author: Dan Allen +Website: http://foundation.zurb.com/docs/ +Version: 1.0 +Date: 2013-04-02 +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #eee; color: black; +} + +.hljs-link, +.hljs-emphasis, +.hljs-attribute, +.hljs-addition { + color: #070; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong, +.hljs-string, +.hljs-deletion { + color: #d14; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-quote, +.hljs-comment { + color: #998; + font-style: italic; +} + +.hljs-section, +.hljs-title { + color: #900; +} + +.hljs-class .hljs-title, +.hljs-type { + color: #458; +} + +.hljs-variable, +.hljs-template-variable { + color: #336699; +} + +.hljs-bullet { + color: #997700; +} + +.hljs-meta { + color: #3344bb; +} + +.hljs-code, +.hljs-number, +.hljs-literal, +.hljs-keyword, +.hljs-selector-tag { + color: #099; +} + +.hljs-regexp { + background-color: #fff0ff; + color: #880088; +} + +.hljs-symbol { + color: #990073; +} + +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #007700; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/github-gist.css b/packages/ui/certd-client/src/components/highlight-styles/github-gist.css new file mode 100644 index 000000000..155f0b916 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/github-gist.css @@ -0,0 +1,71 @@ +/** + * GitHub Gist Theme + * Author : Louis Barranqueiro - https://github.com/LouisBarranqueiro + */ + +.hljs { + display: block; + background: white; + padding: 0.5em; + color: #333333; + overflow-x: auto; +} + +.hljs-comment, +.hljs-meta { + color: #969896; +} + +.hljs-string, +.hljs-variable, +.hljs-template-variable, +.hljs-strong, +.hljs-emphasis, +.hljs-quote { + color: #df5000; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-type { + color: #a71d5d; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute { + color: #0086b3; +} + +.hljs-section, +.hljs-name { + color: #63a35c; +} + +.hljs-tag { + color: #333333; +} + +.hljs-title, +.hljs-attr, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #795da3; +} + +.hljs-addition { + color: #55a532; + background-color: #eaffea; +} + +.hljs-deletion { + color: #bd2c00; + background-color: #ffecec; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/github.css b/packages/ui/certd-client/src/components/highlight-styles/github.css new file mode 100644 index 000000000..791932b87 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/github.css @@ -0,0 +1,99 @@ +/* + +github.com style (c) Vasily Polovnyov + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #333; + background: #f8f8f8; +} + +.hljs-comment, +.hljs-quote { + color: #998; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-subst { + color: #333; + font-weight: bold; +} + +.hljs-number, +.hljs-literal, +.hljs-variable, +.hljs-template-variable, +.hljs-tag .hljs-attr { + color: #008080; +} + +.hljs-string, +.hljs-doctag { + color: #d14; +} + +.hljs-title, +.hljs-section, +.hljs-selector-id { + color: #900; + font-weight: bold; +} + +.hljs-subst { + font-weight: normal; +} + +.hljs-type, +.hljs-class .hljs-title { + color: #458; + font-weight: bold; +} + +.hljs-tag, +.hljs-name, +.hljs-attribute { + color: #000080; + font-weight: normal; +} + +.hljs-regexp, +.hljs-link { + color: #009926; +} + +.hljs-symbol, +.hljs-bullet { + color: #990073; +} + +.hljs-built_in, +.hljs-builtin-name { + color: #0086b3; +} + +.hljs-meta { + color: #999; + font-weight: bold; +} + +.hljs-deletion { + background: #fdd; +} + +.hljs-addition { + background: #dfd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/googlecode.css b/packages/ui/certd-client/src/components/highlight-styles/googlecode.css new file mode 100644 index 000000000..884ad6353 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/googlecode.css @@ -0,0 +1,89 @@ +/* + +Google Code style (c) Aahan Krish + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: white; + color: black; +} + +.hljs-comment, +.hljs-quote { + color: #800; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-section, +.hljs-title, +.hljs-name { + color: #008; +} + +.hljs-variable, +.hljs-template-variable { + color: #660; +} + +.hljs-string, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-regexp { + color: #080; +} + +.hljs-literal, +.hljs-symbol, +.hljs-bullet, +.hljs-meta, +.hljs-number, +.hljs-link { + color: #066; +} + +.hljs-title, +.hljs-doctag, +.hljs-type, +.hljs-attr, +.hljs-built_in, +.hljs-builtin-name, +.hljs-params { + color: #606; +} + +.hljs-attribute, +.hljs-subst { + color: #000; +} + +.hljs-formula { + background-color: #eee; + font-style: italic; +} + +.hljs-selector-id, +.hljs-selector-class { + color: #9B703F +} + +.hljs-addition { + background-color: #baeeba; +} + +.hljs-deletion { + background-color: #ffc8bd; +} + +.hljs-doctag, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/grayscale.css b/packages/ui/certd-client/src/components/highlight-styles/grayscale.css new file mode 100644 index 000000000..5376f3406 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/grayscale.css @@ -0,0 +1,101 @@ +/* + +grayscale style (c) MY Sun + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #333; + background: #fff; +} + +.hljs-comment, +.hljs-quote { + color: #777; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-subst { + color: #333; + font-weight: bold; +} + +.hljs-number, +.hljs-literal { + color: #777; +} + +.hljs-string, +.hljs-doctag, +.hljs-formula { + color: #333; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAYAAACp8Z5+AAAAJ0lEQVQIW2O8e/fufwYGBgZBQUEQxcCIIfDu3Tuwivfv30NUoAsAALHpFMMLqZlPAAAAAElFTkSuQmCC) repeat; +} + +.hljs-title, +.hljs-section, +.hljs-selector-id { + color: #000; + font-weight: bold; +} + +.hljs-subst { + font-weight: normal; +} + +.hljs-class .hljs-title, +.hljs-type, +.hljs-name { + color: #333; + font-weight: bold; +} + +.hljs-tag { + color: #333; +} + +.hljs-regexp { + color: #333; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAICAYAAADA+m62AAAAPUlEQVQYV2NkQAN37979r6yszIgujiIAU4RNMVwhuiQ6H6wQl3XI4oy4FMHcCJPHcDS6J2A2EqUQpJhohQDexSef15DBCwAAAABJRU5ErkJggg==) repeat; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link { + color: #000; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAKElEQVQIW2NkQAO7d+/+z4gsBhJwdXVlhAvCBECKwIIwAbhKZBUwBQA6hBpm5efZsgAAAABJRU5ErkJggg==) repeat; +} + +.hljs-built_in, +.hljs-builtin-name { + color: #000; + text-decoration: underline; +} + +.hljs-meta { + color: #999; + font-weight: bold; +} + +.hljs-deletion { + color: #fff; + background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAADCAYAAABS3WWCAAAAE0lEQVQIW2MMDQ39zzhz5kwIAQAyxweWgUHd1AAAAABJRU5ErkJggg==) repeat; +} + +.hljs-addition { + color: #000; + background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAYAAADgkQYQAAAALUlEQVQYV2N89+7dfwYk8P79ewZBQUFkIQZGOiu6e/cuiptQHAPl0NtNxAQBAM97Oejj3Dg7AAAAAElFTkSuQmCC) repeat; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/gruvbox-dark.css b/packages/ui/certd-client/src/components/highlight-styles/gruvbox-dark.css new file mode 100644 index 000000000..f563811a8 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/gruvbox-dark.css @@ -0,0 +1,108 @@ +/* + +Gruvbox style (dark) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox) + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #282828; +} + +.hljs, +.hljs-subst { + color: #ebdbb2; +} + +/* Gruvbox Red */ +.hljs-deletion, +.hljs-formula, +.hljs-keyword, +.hljs-link, +.hljs-selector-tag { + color: #fb4934; +} + +/* Gruvbox Blue */ +.hljs-built_in, +.hljs-emphasis, +.hljs-name, +.hljs-quote, +.hljs-strong, +.hljs-title, +.hljs-variable { + color: #83a598; +} + +/* Gruvbox Yellow */ +.hljs-attr, +.hljs-params, +.hljs-template-tag, +.hljs-type { + color: #fabd2f; +} + +/* Gruvbox Purple */ +.hljs-builtin-name, +.hljs-doctag, +.hljs-literal, +.hljs-number { + color: #8f3f71; +} + +/* Gruvbox Orange */ +.hljs-code, +.hljs-meta, +.hljs-regexp, +.hljs-selector-id, +.hljs-template-variable { + color: #fe8019; +} + +/* Gruvbox Green */ +.hljs-addition, +.hljs-meta-string, +.hljs-section, +.hljs-selector-attr, +.hljs-selector-class, +.hljs-string, +.hljs-symbol { + color: #b8bb26; +} + +/* Gruvbox Aqua */ +.hljs-attribute, +.hljs-bullet, +.hljs-class, +.hljs-function, +.hljs-function .hljs-keyword, +.hljs-meta-keyword, +.hljs-selector-pseudo, +.hljs-tag { + color: #8ec07c; +} + +/* Gruvbox Gray */ +.hljs-comment { + color: #928374; +} + +/* Gruvbox Purple */ +.hljs-link_label, +.hljs-literal, +.hljs-number { + color: #d3869b; +} + +.hljs-comment, +.hljs-emphasis { + font-style: italic; +} + +.hljs-section, +.hljs-strong, +.hljs-tag { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/gruvbox-light.css b/packages/ui/certd-client/src/components/highlight-styles/gruvbox-light.css new file mode 100644 index 000000000..ff45468eb --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/gruvbox-light.css @@ -0,0 +1,108 @@ +/* + +Gruvbox style (light) (c) Pavel Pertsev (original style at https://github.com/morhetz/gruvbox) + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fbf1c7; +} + +.hljs, +.hljs-subst { + color: #3c3836; +} + +/* Gruvbox Red */ +.hljs-deletion, +.hljs-formula, +.hljs-keyword, +.hljs-link, +.hljs-selector-tag { + color: #9d0006; +} + +/* Gruvbox Blue */ +.hljs-built_in, +.hljs-emphasis, +.hljs-name, +.hljs-quote, +.hljs-strong, +.hljs-title, +.hljs-variable { + color: #076678; +} + +/* Gruvbox Yellow */ +.hljs-attr, +.hljs-params, +.hljs-template-tag, +.hljs-type { + color: #b57614; +} + +/* Gruvbox Purple */ +.hljs-builtin-name, +.hljs-doctag, +.hljs-literal, +.hljs-number { + color: #8f3f71; +} + +/* Gruvbox Orange */ +.hljs-code, +.hljs-meta, +.hljs-regexp, +.hljs-selector-id, +.hljs-template-variable { + color: #af3a03; +} + +/* Gruvbox Green */ +.hljs-addition, +.hljs-meta-string, +.hljs-section, +.hljs-selector-attr, +.hljs-selector-class, +.hljs-string, +.hljs-symbol { + color: #79740e; +} + +/* Gruvbox Aqua */ +.hljs-attribute, +.hljs-bullet, +.hljs-class, +.hljs-function, +.hljs-function .hljs-keyword, +.hljs-meta-keyword, +.hljs-selector-pseudo, +.hljs-tag { + color: #427b58; +} + +/* Gruvbox Gray */ +.hljs-comment { + color: #928374; +} + +/* Gruvbox Purple */ +.hljs-link_label, +.hljs-literal, +.hljs-number { + color: #8f3f71; +} + +.hljs-comment, +.hljs-emphasis { + font-style: italic; +} + +.hljs-section, +.hljs-strong, +.hljs-tag { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/hopscotch.css b/packages/ui/certd-client/src/components/highlight-styles/hopscotch.css new file mode 100644 index 000000000..32e60d230 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/hopscotch.css @@ -0,0 +1,83 @@ +/* + * Hopscotch + * by Jan T. Sott + * https://github.com/idleberg/Hopscotch + * + * This work is licensed under the Creative Commons CC0 1.0 Universal License + */ + +/* Comment */ +.hljs-comment, +.hljs-quote { + color: #989498; +} + +/* Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-attribute, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-link, +.hljs-deletion { + color: #dd464c; +} + +/* Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params { + color: #fd8b19; +} + +/* Yellow */ +.hljs-class .hljs-title { + color: #fdcc59; +} + +/* Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #8fc13e; +} + +/* Aqua */ +.hljs-meta { + color: #149b93; +} + +/* Blue */ +.hljs-function, +.hljs-section, +.hljs-title { + color: #1290bf; +} + +/* Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #c85e7c; +} + +.hljs { + display: block; + background: #322931; + color: #b9b5b8; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/hybrid.css b/packages/ui/certd-client/src/components/highlight-styles/hybrid.css new file mode 100644 index 000000000..29735a189 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/hybrid.css @@ -0,0 +1,102 @@ +/* + +vim-hybrid theme by w0ng (https://github.com/w0ng/vim-hybrid) + +*/ + +/*background color*/ +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #1d1f21; +} + +/*selection color*/ +.hljs::selection, +.hljs span::selection { + background: #373b41; +} + +.hljs::-moz-selection, +.hljs span::-moz-selection { + background: #373b41; +} + +/*foreground color*/ +.hljs { + color: #c5c8c6; +} + +/*color: fg_yellow*/ +.hljs-title, +.hljs-name { + color: #f0c674; +} + +/*color: fg_comment*/ +.hljs-comment, +.hljs-meta, +.hljs-meta .hljs-keyword { + color: #707880; +} + +/*color: fg_red*/ +.hljs-number, +.hljs-symbol, +.hljs-literal, +.hljs-deletion, +.hljs-link { + color: #cc6666 +} + +/*color: fg_green*/ +.hljs-string, +.hljs-doctag, +.hljs-addition, +.hljs-regexp, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #b5bd68; +} + +/*color: fg_purple*/ +.hljs-attribute, +.hljs-code, +.hljs-selector-id { + color: #b294bb; +} + +/*color: fg_blue*/ +.hljs-keyword, +.hljs-selector-tag, +.hljs-bullet, +.hljs-tag { + color: #81a2be; +} + +/*color: fg_aqua*/ +.hljs-subst, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #8abeb7; +} + +/*color: fg_orange*/ +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-quote, +.hljs-section, +.hljs-selector-class { + color: #de935f; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/idea.css b/packages/ui/certd-client/src/components/highlight-styles/idea.css new file mode 100644 index 000000000..3bf1892bd --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/idea.css @@ -0,0 +1,97 @@ +/* + +Intellij Idea-like styling (c) Vasily Polovnyov + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #000; + background: #fff; +} + +.hljs-subst, +.hljs-title { + font-weight: normal; + color: #000; +} + +.hljs-comment, +.hljs-quote { + color: #808080; + font-style: italic; +} + +.hljs-meta { + color: #808000; +} + +.hljs-tag { + background: #efefef; +} + +.hljs-section, +.hljs-name, +.hljs-literal, +.hljs-keyword, +.hljs-selector-tag, +.hljs-type, +.hljs-selector-id, +.hljs-selector-class { + font-weight: bold; + color: #000080; +} + +.hljs-attribute, +.hljs-number, +.hljs-regexp, +.hljs-link { + font-weight: bold; + color: #0000ff; +} + +.hljs-number, +.hljs-regexp, +.hljs-link { + font-weight: normal; +} + +.hljs-string { + color: #008000; + font-weight: bold; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-formula { + color: #000; + background: #d0eded; + font-style: italic; +} + +.hljs-doctag { + text-decoration: underline; +} + +.hljs-variable, +.hljs-template-variable { + color: #660e7a; +} + +.hljs-addition { + background: #baeeba; +} + +.hljs-deletion { + background: #ffc8bd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/ir-black.css b/packages/ui/certd-client/src/components/highlight-styles/ir-black.css new file mode 100644 index 000000000..bd4c755ed --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/ir-black.css @@ -0,0 +1,73 @@ +/* + IR_Black style (c) Vasily Mikhailitchenko +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #000; + color: #f8f8f8; +} + +.hljs-comment, +.hljs-quote, +.hljs-meta { + color: #7c7c7c; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-tag, +.hljs-name { + color: #96cbfe; +} + +.hljs-attribute, +.hljs-selector-id { + color: #ffffb6; +} + +.hljs-string, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition { + color: #a8ff60; +} + +.hljs-subst { + color: #daefa3; +} + +.hljs-regexp, +.hljs-link { + color: #e9c062; +} + +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-doctag { + color: #ffffb6; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-variable, +.hljs-template-variable, +.hljs-literal { + color: #c6c5fe; +} + +.hljs-number, +.hljs-deletion { + color:#ff73fd; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/kimbie.dark.css b/packages/ui/certd-client/src/components/highlight-styles/kimbie.dark.css new file mode 100644 index 000000000..d139cb5d0 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/kimbie.dark.css @@ -0,0 +1,74 @@ +/* + Name: Kimbie (dark) + Author: Jan T. Sott + License: Creative Commons Attribution-ShareAlike 4.0 Unported License + URL: https://github.com/idleberg/Kimbie-highlight.js +*/ + +/* Kimbie Comment */ +.hljs-comment, +.hljs-quote { + color: #d6baad; +} + +/* Kimbie Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-meta { + color: #dc3958; +} + +/* Kimbie Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-deletion, +.hljs-link { + color: #f79a32; +} + +/* Kimbie Yellow */ +.hljs-title, +.hljs-section, +.hljs-attribute { + color: #f06431; +} + +/* Kimbie Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #889b4a; +} + +/* Kimbie Purple */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-function { + color: #98676a; +} + +.hljs { + display: block; + overflow-x: auto; + background: #221a0f; + color: #d3af86; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/kimbie.light.css b/packages/ui/certd-client/src/components/highlight-styles/kimbie.light.css new file mode 100644 index 000000000..04ff6ed3a --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/kimbie.light.css @@ -0,0 +1,74 @@ +/* + Name: Kimbie (light) + Author: Jan T. Sott + License: Creative Commons Attribution-ShareAlike 4.0 Unported License + URL: https://github.com/idleberg/Kimbie-highlight.js +*/ + +/* Kimbie Comment */ +.hljs-comment, +.hljs-quote { + color: #a57a4c; +} + +/* Kimbie Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-meta { + color: #dc3958; +} + +/* Kimbie Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-deletion, +.hljs-link { + color: #f79a32; +} + +/* Kimbie Yellow */ +.hljs-title, +.hljs-section, +.hljs-attribute { + color: #f06431; +} + +/* Kimbie Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #889b4a; +} + +/* Kimbie Purple */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-function { + color: #98676a; +} + +.hljs { + display: block; + overflow-x: auto; + background: #fbebd4; + color: #84613d; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/magula.css b/packages/ui/certd-client/src/components/highlight-styles/magula.css new file mode 100644 index 000000000..44dee5e8e --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/magula.css @@ -0,0 +1,70 @@ +/* +Description: Magula style for highligh.js +Author: Ruslan Keba +Website: http://rukeba.com/ +Version: 1.0 +Date: 2009-01-03 +Music: Aphex Twin / Xtal +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background-color: #f4f4f4; +} + +.hljs, +.hljs-subst { + color: black; +} + +.hljs-string, +.hljs-title, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #050; +} + +.hljs-comment, +.hljs-quote { + color: #777; +} + +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-type, +.hljs-link { + color: #800; +} + +.hljs-deletion, +.hljs-meta { + color: #00e; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-built_in, +.hljs-tag, +.hljs-name { + font-weight: bold; + color: navy; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/mono-blue.css b/packages/ui/certd-client/src/components/highlight-styles/mono-blue.css new file mode 100644 index 000000000..884c97c76 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/mono-blue.css @@ -0,0 +1,59 @@ +/* + Five-color theme from a single blue hue. +*/ +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #eaeef3; +} + +.hljs { + color: #00193a; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-title, +.hljs-section, +.hljs-doctag, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-comment { + color: #738191; +} + +.hljs-string, +.hljs-title, +.hljs-section, +.hljs-built_in, +.hljs-literal, +.hljs-type, +.hljs-addition, +.hljs-tag, +.hljs-quote, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #0048ab; +} + +.hljs-meta, +.hljs-subst, +.hljs-symbol, +.hljs-regexp, +.hljs-attribute, +.hljs-deletion, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-bullet { + color: #4c81c9; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/monokai-sublime.css b/packages/ui/certd-client/src/components/highlight-styles/monokai-sublime.css new file mode 100644 index 000000000..2864170da --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/monokai-sublime.css @@ -0,0 +1,83 @@ +/* + +Monokai Sublime style. Derived from Monokai by noformnocontent http://nn.mit-license.org/ + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #23241f; +} + +.hljs, +.hljs-tag, +.hljs-subst { + color: #f8f8f2; +} + +.hljs-strong, +.hljs-emphasis { + color: #a8a8a2; +} + +.hljs-bullet, +.hljs-quote, +.hljs-number, +.hljs-regexp, +.hljs-literal, +.hljs-link { + color: #ae81ff; +} + +.hljs-code, +.hljs-title, +.hljs-section, +.hljs-selector-class { + color: #a6e22e; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-name, +.hljs-attr { + color: #f92672; +} + +.hljs-symbol, +.hljs-attribute { + color: #66d9ef; +} + +.hljs-params, +.hljs-class .hljs-title { + color: #f8f8f2; +} + +.hljs-string, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-variable { + color: #e6db74; +} + +.hljs-comment, +.hljs-deletion, +.hljs-meta { + color: #75715e; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/monokai.css b/packages/ui/certd-client/src/components/highlight-styles/monokai.css new file mode 100644 index 000000000..775d53f91 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/monokai.css @@ -0,0 +1,70 @@ +/* +Monokai style - ported by Luigi Maselli - http://grigio.org +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #272822; color: #ddd; +} + +.hljs-tag, +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-strong, +.hljs-name { + color: #f92672; +} + +.hljs-code { + color: #66d9ef; +} + +.hljs-class .hljs-title { + color: white; +} + +.hljs-attribute, +.hljs-symbol, +.hljs-regexp, +.hljs-link { + color: #bf79db; +} + +.hljs-string, +.hljs-bullet, +.hljs-subst, +.hljs-title, +.hljs-section, +.hljs-emphasis, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #a6e22e; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #75715e; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-selector-id { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/obsidian.css b/packages/ui/certd-client/src/components/highlight-styles/obsidian.css new file mode 100644 index 000000000..356630fa2 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/obsidian.css @@ -0,0 +1,88 @@ +/** + * Obsidian style + * ported by Alexander Marenin (http://github.com/ioncreature) + */ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #282b2e; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-selector-id { + color: #93c763; +} + +.hljs-number { + color: #ffcd22; +} + +.hljs { + color: #e0e2e4; +} + +.hljs-attribute { + color: #668bb0; +} + +.hljs-code, +.hljs-class .hljs-title, +.hljs-section { + color: white; +} + +.hljs-regexp, +.hljs-link { + color: #d39745; +} + +.hljs-meta { + color: #557182; +} + +.hljs-tag, +.hljs-name, +.hljs-bullet, +.hljs-subst, +.hljs-emphasis, +.hljs-type, +.hljs-built_in, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable { + color: #8cbbad; +} + +.hljs-string, +.hljs-symbol { + color: #ec7600; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion { + color: #818e96; +} + +.hljs-selector-class { + color: #A082BD +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-name, +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/ocean.css b/packages/ui/certd-client/src/components/highlight-styles/ocean.css new file mode 100644 index 000000000..5901581b4 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/ocean.css @@ -0,0 +1,74 @@ +/* Ocean Dark Theme */ +/* https://github.com/gavsiu */ +/* Original theme - https://github.com/chriskempson/base16 */ + +/* Ocean Comment */ +.hljs-comment, +.hljs-quote { + color: #65737e; +} + +/* Ocean Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #bf616a; +} + +/* Ocean Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #d08770; +} + +/* Ocean Yellow */ +.hljs-attribute { + color: #ebcb8b; +} + +/* Ocean Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #a3be8c; +} + +/* Ocean Blue */ +.hljs-title, +.hljs-section { + color: #8fa1b3; +} + +/* Ocean Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #b48ead; +} + +.hljs { + display: block; + overflow-x: auto; + background: #2b303b; + color: #c0c5ce; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/paraiso-dark.css b/packages/ui/certd-client/src/components/highlight-styles/paraiso-dark.css new file mode 100644 index 000000000..e7292401c --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/paraiso-dark.css @@ -0,0 +1,72 @@ +/* + Paraíso (dark) + Created by Jan T. Sott (http://github.com/idleberg) + Inspired by the art of Rubens LP (http://www.rubenslp.com.br) +*/ + +/* Paraíso Comment */ +.hljs-comment, +.hljs-quote { + color: #8d8687; +} + +/* Paraíso Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-link, +.hljs-meta { + color: #ef6155; +} + +/* Paraíso Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-deletion { + color: #f99b15; +} + +/* Paraíso Yellow */ +.hljs-title, +.hljs-section, +.hljs-attribute { + color: #fec418; +} + +/* Paraíso Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #48b685; +} + +/* Paraíso Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #815ba4; +} + +.hljs { + display: block; + overflow-x: auto; + background: #2f1e2e; + color: #a39e9b; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/paraiso-light.css b/packages/ui/certd-client/src/components/highlight-styles/paraiso-light.css new file mode 100644 index 000000000..944857cd8 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/paraiso-light.css @@ -0,0 +1,72 @@ +/* + Paraíso (light) + Created by Jan T. Sott (http://github.com/idleberg) + Inspired by the art of Rubens LP (http://www.rubenslp.com.br) +*/ + +/* Paraíso Comment */ +.hljs-comment, +.hljs-quote { + color: #776e71; +} + +/* Paraíso Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-link, +.hljs-meta { + color: #ef6155; +} + +/* Paraíso Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-deletion { + color: #f99b15; +} + +/* Paraíso Yellow */ +.hljs-title, +.hljs-section, +.hljs-attribute { + color: #fec418; +} + +/* Paraíso Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #48b685; +} + +/* Paraíso Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #815ba4; +} + +.hljs { + display: block; + overflow-x: auto; + background: #e7e9db; + color: #4f424c; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/pojoaque.css b/packages/ui/certd-client/src/components/highlight-styles/pojoaque.css new file mode 100644 index 000000000..2e07847b2 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/pojoaque.css @@ -0,0 +1,83 @@ +/* + +Pojoaque Style by Jason Tate +http://web-cms-designs.com/ftopict-10-pojoaque-style-for-highlight-js-code-highlighter.html +Based on Solarized Style from http://ethanschoonover.com/solarized + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + color: #dccf8f; + background: url(./pojoaque.jpg) repeat scroll left top #181914; +} + +.hljs-comment, +.hljs-quote { + color: #586e75; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-addition { + color: #b64926; +} + +.hljs-number, +.hljs-string, +.hljs-doctag, +.hljs-regexp { + color: #468966; +} + +.hljs-title, +.hljs-section, +.hljs-built_in, +.hljs-name { + color: #ffb03b; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-class .hljs-title, +.hljs-type, +.hljs-tag { + color: #b58900; +} + +.hljs-attribute { + color: #b89859; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link, +.hljs-subst, +.hljs-meta { + color: #cb4b16; +} + +.hljs-deletion { + color: #dc322f; +} + +.hljs-selector-id, +.hljs-selector-class { + color: #d3a60c; +} + +.hljs-formula { + background: #073642; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/pojoaque.jpg b/packages/ui/certd-client/src/components/highlight-styles/pojoaque.jpg new file mode 100644 index 000000000..9c07d4ab4 Binary files /dev/null and b/packages/ui/certd-client/src/components/highlight-styles/pojoaque.jpg differ diff --git a/packages/ui/certd-client/src/components/highlight-styles/purebasic.css b/packages/ui/certd-client/src/components/highlight-styles/purebasic.css new file mode 100644 index 000000000..5ce9b9e07 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/purebasic.css @@ -0,0 +1,96 @@ +/* + +PureBASIC native IDE style ( version 1.0 - April 2016 ) + +by Tristano Ajmone + +Public Domain + +NOTE_1: PureBASIC code syntax highlighting only applies the following classes: + .hljs-comment + .hljs-function + .hljs-keywords + .hljs-string + .hljs-symbol + + Other classes are added here for the benefit of styling other languages with the look and feel of PureBASIC native IDE style. + If you need to customize a stylesheet for PureBASIC only, remove all non-relevant classes -- PureBASIC-related classes are followed by + a "--- used for PureBASIC ... ---" comment on same line. + +NOTE_2: Color names provided in comments were derived using "Name that Color" online tool: + http://chir.ag/projects/name-that-color +*/ + +.hljs { /* Common set of rules required by highlight.js (don'r remove!) */ + display: block; + overflow-x: auto; + padding: 0.5em; + background: #FFFFDF; /* Half and Half (approx.) */ +/* --- Uncomment to add PureBASIC native IDE styled font! + font-family: Consolas; +*/ +} + +.hljs, /* --- used for PureBASIC base color --- */ +.hljs-type, /* --- used for PureBASIC Procedures return type --- */ +.hljs-function, /* --- used for wrapping PureBASIC Procedures definitions --- */ +.hljs-name, +.hljs-number, +.hljs-attr, +.hljs-params, +.hljs-subst { + color: #000000; /* Black */ +} + +.hljs-comment, /* --- used for PureBASIC Comments --- */ +.hljs-regexp, +.hljs-section, +.hljs-selector-pseudo, +.hljs-addition { + color: #00AAAA; /* Persian Green (approx.) */ +} + +.hljs-title, /* --- used for PureBASIC Procedures Names --- */ +.hljs-tag, +.hljs-variable, +.hljs-code { + color: #006666; /* Blue Stone (approx.) */ +} + +.hljs-keyword, /* --- used for PureBASIC Keywords --- */ +.hljs-class, +.hljs-meta-keyword, +.hljs-selector-class, +.hljs-built_in, +.hljs-builtin-name { + color: #006666; /* Blue Stone (approx.) */ + font-weight: bold; +} + +.hljs-string, /* --- used for PureBASIC Strings --- */ +.hljs-selector-attr { + color: #0080FF; /* Azure Radiance (approx.) */ +} + +.hljs-symbol, /* --- used for PureBASIC Constants --- */ +.hljs-link, +.hljs-deletion, +.hljs-attribute { + color: #924B72; /* Cannon Pink (approx.) */ +} + +.hljs-meta, +.hljs-literal, +.hljs-selector-id { + color: #924B72; /* Cannon Pink (approx.) */ + font-weight: bold; +} + +.hljs-strong, +.hljs-name { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/qtcreator_dark.css b/packages/ui/certd-client/src/components/highlight-styles/qtcreator_dark.css new file mode 100644 index 000000000..7aa56a365 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/qtcreator_dark.css @@ -0,0 +1,83 @@ +/* + +Qt Creator dark color scheme + +*/ + + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #000000; +} + +.hljs, +.hljs-subst, +.hljs-tag, +.hljs-title { + color: #aaaaaa; +} + +.hljs-strong, +.hljs-emphasis { + color: #a8a8a2; +} + +.hljs-bullet, +.hljs-quote, +.hljs-number, +.hljs-regexp, +.hljs-literal { + color: #ff55ff; +} + +.hljs-code +.hljs-selector-class { + color: #aaaaff; +} + +.hljs-emphasis, +.hljs-stronge, +.hljs-type { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-function, +.hljs-section, +.hljs-symbol, +.hljs-name { + color: #ffff55; +} + +.hljs-attribute { + color: #ff5555; +} + +.hljs-variable, +.hljs-params, +.hljs-class .hljs-title { + color: #8888ff; +} + +.hljs-string, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition, +.hljs-link { + color: #ff55ff; +} + +.hljs-comment, +.hljs-meta, +.hljs-deletion { + color: #55ffff; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/qtcreator_light.css b/packages/ui/certd-client/src/components/highlight-styles/qtcreator_light.css new file mode 100644 index 000000000..1efa2c660 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/qtcreator_light.css @@ -0,0 +1,83 @@ +/* + +Qt Creator light color scheme + +*/ + + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #ffffff; +} + +.hljs, +.hljs-subst, +.hljs-tag, +.hljs-title { + color: #000000; +} + +.hljs-strong, +.hljs-emphasis { + color: #000000; +} + +.hljs-bullet, +.hljs-quote, +.hljs-number, +.hljs-regexp, +.hljs-literal { + color: #000080; +} + +.hljs-code +.hljs-selector-class { + color: #800080; +} + +.hljs-emphasis, +.hljs-stronge, +.hljs-type { + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-function, +.hljs-section, +.hljs-symbol, +.hljs-name { + color: #808000; +} + +.hljs-attribute { + color: #800000; +} + +.hljs-variable, +.hljs-params, +.hljs-class .hljs-title { + color: #0055AF; +} + +.hljs-string, +.hljs-selector-id, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-type, +.hljs-built_in, +.hljs-builtin-name, +.hljs-template-tag, +.hljs-template-variable, +.hljs-addition, +.hljs-link { + color: #008000; +} + +.hljs-comment, +.hljs-meta, +.hljs-deletion { + color: #008000; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/railscasts.css b/packages/ui/certd-client/src/components/highlight-styles/railscasts.css new file mode 100644 index 000000000..008cdc5bf --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/railscasts.css @@ -0,0 +1,106 @@ +/* + +Railscasts-like style (c) Visoft, Inc. (Damien White) + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #232323; + color: #e6e1dc; +} + +.hljs-comment, +.hljs-quote { + color: #bc9458; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag { + color: #c26230; +} + +.hljs-string, +.hljs-number, +.hljs-regexp, +.hljs-variable, +.hljs-template-variable { + color: #a5c261; +} + +.hljs-subst { + color: #519f50; +} + +.hljs-tag, +.hljs-name { + color: #e8bf6a; +} + +.hljs-type { + color: #da4939; +} + + +.hljs-symbol, +.hljs-bullet, +.hljs-built_in, +.hljs-builtin-name, +.hljs-attr, +.hljs-link { + color: #6d9cbe; +} + +.hljs-params { + color: #d0d0ff; +} + +.hljs-attribute { + color: #cda869; +} + +.hljs-meta { + color: #9b859d; +} + +.hljs-title, +.hljs-section { + color: #ffc66d; +} + +.hljs-addition { + background-color: #144212; + color: #e6e1dc; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #600; + color: #e6e1dc; + display: inline-block; + width: 100%; +} + +.hljs-selector-class { + color: #9b703f; +} + +.hljs-selector-id { + color: #8b98ab; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-link { + text-decoration: underline; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/rainbow.css b/packages/ui/certd-client/src/components/highlight-styles/rainbow.css new file mode 100644 index 000000000..905eb8ef1 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/rainbow.css @@ -0,0 +1,85 @@ +/* + +Style with support for rainbow parens + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #474949; + color: #d1d9e1; +} + + +.hljs-comment, +.hljs-quote { + color: #969896; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-type, +.hljs-addition { + color: #cc99cc; +} + +.hljs-number, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #f99157; +} + +.hljs-string, +.hljs-doctag, +.hljs-regexp { + color: #8abeb7; +} + +.hljs-title, +.hljs-name, +.hljs-section, +.hljs-built_in { + color: #b5bd68; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-selector-id, +.hljs-class .hljs-title { + color: #ffcc66; +} + +.hljs-section, +.hljs-name, +.hljs-strong { + font-weight: bold; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-subst, +.hljs-meta, +.hljs-link { + color: #f99157; +} + +.hljs-deletion { + color: #dc322f; +} + +.hljs-formula { + background: #eee8d5; +} + +.hljs-attr, +.hljs-attribute { + color: #81a2be; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/routeros.css b/packages/ui/certd-client/src/components/highlight-styles/routeros.css new file mode 100644 index 000000000..ebe23990d --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/routeros.css @@ -0,0 +1,108 @@ +/* + + highlight.js style for Microtik RouterOS script + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #F0F0F0; +} + +/* Base color: saturation 0; */ + +.hljs, +.hljs-subst { + color: #444; +} + +.hljs-comment { + color: #888888; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-meta-keyword, +.hljs-doctag, +.hljs-name { + font-weight: bold; +} + +.hljs-attribute { + color: #0E9A00; +} + +.hljs-function { + color: #99069A; +} + +.hljs-builtin-name { + color: #99069A; +} + +/* User color: hue: 0 */ + +.hljs-type, +.hljs-string, +.hljs-number, +.hljs-selector-id, +.hljs-selector-class, +.hljs-quote, +.hljs-template-tag, +.hljs-deletion { + color: #880000; +} + +.hljs-title, +.hljs-section { + color: #880000; + font-weight: bold; +} + +.hljs-regexp, +.hljs-symbol, +.hljs-variable, +.hljs-template-variable, +.hljs-link, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #BC6060; +} + + +/* Language color: hue: 90; */ + +.hljs-literal { + color: #78A960; +} + +.hljs-built_in, +.hljs-bullet, +.hljs-code, +.hljs-addition { + color: #0C9A9A; +} + + +/* Meta color: hue: 200 */ + +.hljs-meta { + color: #1f7199; +} + +.hljs-meta-string { + color: #4d99bf; +} + + +/* Misc effects */ + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/school-book.css b/packages/ui/certd-client/src/components/highlight-styles/school-book.css new file mode 100644 index 000000000..964b51d84 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/school-book.css @@ -0,0 +1,72 @@ +/* + +School Book style from goldblog.com.ua (c) Zaripov Yura + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 15px 0.5em 0.5em 30px; + font-size: 11px; + line-height:16px; +} + +pre{ + background:#f6f6ae url(./school-book.png); + border-top: solid 2px #d2e8b9; + border-bottom: solid 1px #d2e8b9; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal { + color:#005599; + font-weight:bold; +} + +.hljs, +.hljs-subst { + color: #3e5915; +} + +.hljs-string, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-symbol, +.hljs-bullet, +.hljs-attribute, +.hljs-built_in, +.hljs-builtin-name, +.hljs-addition, +.hljs-variable, +.hljs-template-tag, +.hljs-template-variable, +.hljs-link { + color: #2c009f; +} + +.hljs-comment, +.hljs-quote, +.hljs-deletion, +.hljs-meta { + color: #e60415; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal, +.hljs-doctag, +.hljs-title, +.hljs-section, +.hljs-type, +.hljs-name, +.hljs-selector-id, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/school-book.png b/packages/ui/certd-client/src/components/highlight-styles/school-book.png new file mode 100644 index 000000000..956e9790a Binary files /dev/null and b/packages/ui/certd-client/src/components/highlight-styles/school-book.png differ diff --git a/packages/ui/certd-client/src/components/highlight-styles/solarized-dark.css b/packages/ui/certd-client/src/components/highlight-styles/solarized-dark.css new file mode 100644 index 000000000..b4c0da1f7 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/solarized-dark.css @@ -0,0 +1,84 @@ +/* + +Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #002b36; + color: #839496; +} + +.hljs-comment, +.hljs-quote { + color: #586e75; +} + +/* Solarized Green */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-addition { + color: #859900; +} + +/* Solarized Cyan */ +.hljs-number, +.hljs-string, +.hljs-meta .hljs-meta-string, +.hljs-literal, +.hljs-doctag, +.hljs-regexp { + color: #2aa198; +} + +/* Solarized Blue */ +.hljs-title, +.hljs-section, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #268bd2; +} + +/* Solarized Yellow */ +.hljs-attribute, +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-class .hljs-title, +.hljs-type { + color: #b58900; +} + +/* Solarized Orange */ +.hljs-symbol, +.hljs-bullet, +.hljs-subst, +.hljs-meta, +.hljs-meta .hljs-keyword, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-link { + color: #cb4b16; +} + +/* Solarized Red */ +.hljs-built_in, +.hljs-deletion { + color: #dc322f; +} + +.hljs-formula { + background: #073642; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/solarized-light.css b/packages/ui/certd-client/src/components/highlight-styles/solarized-light.css new file mode 100644 index 000000000..fdcfcc72c --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/solarized-light.css @@ -0,0 +1,84 @@ +/* + +Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fdf6e3; + color: #657b83; +} + +.hljs-comment, +.hljs-quote { + color: #93a1a1; +} + +/* Solarized Green */ +.hljs-keyword, +.hljs-selector-tag, +.hljs-addition { + color: #859900; +} + +/* Solarized Cyan */ +.hljs-number, +.hljs-string, +.hljs-meta .hljs-meta-string, +.hljs-literal, +.hljs-doctag, +.hljs-regexp { + color: #2aa198; +} + +/* Solarized Blue */ +.hljs-title, +.hljs-section, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class { + color: #268bd2; +} + +/* Solarized Yellow */ +.hljs-attribute, +.hljs-attr, +.hljs-variable, +.hljs-template-variable, +.hljs-class .hljs-title, +.hljs-type { + color: #b58900; +} + +/* Solarized Orange */ +.hljs-symbol, +.hljs-bullet, +.hljs-subst, +.hljs-meta, +.hljs-meta .hljs-keyword, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-link { + color: #cb4b16; +} + +/* Solarized Red */ +.hljs-built_in, +.hljs-deletion { + color: #dc322f; +} + +.hljs-formula { + background: #eee8d5; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/sunburst.css b/packages/ui/certd-client/src/components/highlight-styles/sunburst.css new file mode 100644 index 000000000..f56dd5e9b --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/sunburst.css @@ -0,0 +1,102 @@ +/* + +Sunburst-like style (c) Vasily Polovnyov + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #000; + color: #f8f8f8; +} + +.hljs-comment, +.hljs-quote { + color: #aeaeae; + font-style: italic; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-type { + color: #e28964; +} + +.hljs-string { + color: #65b042; +} + +.hljs-subst { + color: #daefa3; +} + +.hljs-regexp, +.hljs-link { + color: #e9c062; +} + +.hljs-title, +.hljs-section, +.hljs-tag, +.hljs-name { + color: #89bdff; +} + +.hljs-class .hljs-title, +.hljs-doctag { + text-decoration: underline; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-number { + color: #3387cc; +} + +.hljs-params, +.hljs-variable, +.hljs-template-variable { + color: #3e87e3; +} + +.hljs-attribute { + color: #cda869; +} + +.hljs-meta { + color: #8996a8; +} + +.hljs-formula { + background-color: #0e2231; + color: #f8f8f8; + font-style: italic; +} + +.hljs-addition { + background-color: #253b22; + color: #f8f8f8; +} + +.hljs-deletion { + background-color: #420e09; + color: #f8f8f8; +} + +.hljs-selector-class { + color: #9b703f; +} + +.hljs-selector-id { + color: #8b98ab; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night-blue.css b/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night-blue.css new file mode 100644 index 000000000..78e59cc8c --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night-blue.css @@ -0,0 +1,75 @@ +/* Tomorrow Night Blue Theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #7285b7; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #ff9da4; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #ffc58f; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #ffeead; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #d1f1a9; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #bbdaff; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #ebbbff; +} + +.hljs { + display: block; + overflow-x: auto; + background: #002451; + color: white; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night-bright.css b/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night-bright.css new file mode 100644 index 000000000..e05af8ae2 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night-bright.css @@ -0,0 +1,74 @@ +/* Tomorrow Night Bright Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #969896; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #d54e53; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #e78c45; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #e7c547; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #b9ca4a; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #7aa6da; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #c397d8; +} + +.hljs { + display: block; + overflow-x: auto; + background: black; + color: #eaeaea; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night-eighties.css b/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night-eighties.css new file mode 100644 index 000000000..08fd51c74 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night-eighties.css @@ -0,0 +1,74 @@ +/* Tomorrow Night Eighties Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #999999; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #f2777a; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #f99157; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #ffcc66; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #99cc99; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #6699cc; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #cc99cc; +} + +.hljs { + display: block; + overflow-x: auto; + background: #2d2d2d; + color: #cccccc; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night.css b/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night.css new file mode 100644 index 000000000..ddd270a4e --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/tomorrow-night.css @@ -0,0 +1,75 @@ +/* Tomorrow Night Theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #969896; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #cc6666; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #de935f; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #f0c674; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #b5bd68; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #81a2be; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #b294bb; +} + +.hljs { + display: block; + overflow-x: auto; + background: #1d1f21; + color: #c5c8c6; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/tomorrow.css b/packages/ui/certd-client/src/components/highlight-styles/tomorrow.css new file mode 100644 index 000000000..026a62fe3 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/tomorrow.css @@ -0,0 +1,72 @@ +/* http://jmblog.github.com/color-themes-for-google-code-highlightjs */ + +/* Tomorrow Comment */ +.hljs-comment, +.hljs-quote { + color: #8e908c; +} + +/* Tomorrow Red */ +.hljs-variable, +.hljs-template-variable, +.hljs-tag, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-regexp, +.hljs-deletion { + color: #c82829; +} + +/* Tomorrow Orange */ +.hljs-number, +.hljs-built_in, +.hljs-builtin-name, +.hljs-literal, +.hljs-type, +.hljs-params, +.hljs-meta, +.hljs-link { + color: #f5871f; +} + +/* Tomorrow Yellow */ +.hljs-attribute { + color: #eab700; +} + +/* Tomorrow Green */ +.hljs-string, +.hljs-symbol, +.hljs-bullet, +.hljs-addition { + color: #718c00; +} + +/* Tomorrow Blue */ +.hljs-title, +.hljs-section { + color: #4271ae; +} + +/* Tomorrow Purple */ +.hljs-keyword, +.hljs-selector-tag { + color: #8959a8; +} + +.hljs { + display: block; + overflow-x: auto; + background: white; + color: #4d4d4c; + padding: 0.5em; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/vs.css b/packages/ui/certd-client/src/components/highlight-styles/vs.css new file mode 100644 index 000000000..c5d07d311 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/vs.css @@ -0,0 +1,68 @@ +/* + +Visual Studio-like style based on original C# coloring by Jason Diamond + +*/ +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: white; + color: black; +} + +.hljs-comment, +.hljs-quote, +.hljs-variable { + color: #008000; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-built_in, +.hljs-name, +.hljs-tag { + color: #00f; +} + +.hljs-string, +.hljs-title, +.hljs-section, +.hljs-attribute, +.hljs-literal, +.hljs-template-tag, +.hljs-template-variable, +.hljs-type, +.hljs-addition { + color: #a31515; +} + +.hljs-deletion, +.hljs-selector-attr, +.hljs-selector-pseudo, +.hljs-meta { + color: #2b91af; +} + +.hljs-doctag { + color: #808080; +} + +.hljs-attr { + color: #f00; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link { + color: #00b0e8; +} + + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/vs2015.css b/packages/ui/certd-client/src/components/highlight-styles/vs2015.css new file mode 100644 index 000000000..d1d9be3ca --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/vs2015.css @@ -0,0 +1,115 @@ +/* + * Visual Studio 2015 dark style + * Author: Nicolas LLOBERA + */ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #1E1E1E; + color: #DCDCDC; +} + +.hljs-keyword, +.hljs-literal, +.hljs-symbol, +.hljs-name { + color: #569CD6; +} +.hljs-link { + color: #569CD6; + text-decoration: underline; +} + +.hljs-built_in, +.hljs-type { + color: #4EC9B0; +} + +.hljs-number, +.hljs-class { + color: #B8D7A3; +} + +.hljs-string, +.hljs-meta-string { + color: #D69D85; +} + +.hljs-regexp, +.hljs-template-tag { + color: #9A5334; +} + +.hljs-subst, +.hljs-function, +.hljs-title, +.hljs-params, +.hljs-formula { + color: #DCDCDC; +} + +.hljs-comment, +.hljs-quote { + color: #57A64A; + font-style: italic; +} + +.hljs-doctag { + color: #608B4E; +} + +.hljs-meta, +.hljs-meta-keyword, +.hljs-tag { + color: #9B9B9B; +} + +.hljs-variable, +.hljs-template-variable { + color: #BD63C5; +} + +.hljs-attr, +.hljs-attribute, +.hljs-builtin-name { + color: #9CDCFE; +} + +.hljs-section { + color: gold; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +/*.hljs-code { + font-family:'Monospace'; +}*/ + +.hljs-bullet, +.hljs-selector-tag, +.hljs-selector-id, +.hljs-selector-class, +.hljs-selector-attr, +.hljs-selector-pseudo { + color: #D7BA7D; +} + +.hljs-addition { + background-color: #144212; + display: inline-block; + width: 100%; +} + +.hljs-deletion { + background-color: #600; + display: inline-block; + width: 100%; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/xcode.css b/packages/ui/certd-client/src/components/highlight-styles/xcode.css new file mode 100644 index 000000000..43dddad84 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/xcode.css @@ -0,0 +1,93 @@ +/* + +XCode style (c) Angel Garcia + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #fff; + color: black; +} + +.hljs-comment, +.hljs-quote { + color: #006a00; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-literal { + color: #aa0d91; +} + +.hljs-name { + color: #008; +} + +.hljs-variable, +.hljs-template-variable { + color: #660; +} + +.hljs-string { + color: #c41a16; +} + +.hljs-regexp, +.hljs-link { + color: #080; +} + +.hljs-title, +.hljs-tag, +.hljs-symbol, +.hljs-bullet, +.hljs-number, +.hljs-meta { + color: #1c00cf; +} + +.hljs-section, +.hljs-class .hljs-title, +.hljs-type, +.hljs-attr, +.hljs-built_in, +.hljs-builtin-name, +.hljs-params { + color: #5c2699; +} + +.hljs-attribute, +.hljs-subst { + color: #000; +} + +.hljs-formula { + background-color: #eee; + font-style: italic; +} + +.hljs-addition { + background-color: #baeeba; +} + +.hljs-deletion { + background-color: #ffc8bd; +} + +.hljs-selector-id, +.hljs-selector-class { + color: #9b703f; +} + +.hljs-doctag, +.hljs-strong { + font-weight: bold; +} + +.hljs-emphasis { + font-style: italic; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/xt256.css b/packages/ui/certd-client/src/components/highlight-styles/xt256.css new file mode 100644 index 000000000..58df82cb7 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/xt256.css @@ -0,0 +1,92 @@ + +/* + xt256.css + + Contact: initbar [at] protonmail [dot] ch + : github.com/initbar +*/ + +.hljs { + display: block; + overflow-x: auto; + color: #eaeaea; + background: #000; + padding: 0.5; +} + +.hljs-subst { + color: #eaeaea; +} + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} + +.hljs-builtin-name, +.hljs-type { + color: #eaeaea; +} + +.hljs-params { + color: #da0000; +} + +.hljs-literal, +.hljs-number, +.hljs-name { + color: #ff0000; + font-weight: bolder; +} + +.hljs-comment { + color: #969896; +} + +.hljs-selector-id, +.hljs-quote { + color: #00ffff; +} + +.hljs-template-variable, +.hljs-variable, +.hljs-title { + color: #00ffff; + font-weight: bold; +} + +.hljs-selector-class, +.hljs-keyword, +.hljs-symbol { + color: #fff000; +} + +.hljs-string, +.hljs-bullet { + color: #00ff00; +} + +.hljs-tag, +.hljs-section { + color: #000fff; +} + +.hljs-selector-tag { + color: #000fff; + font-weight: bold; +} + +.hljs-attribute, +.hljs-built_in, +.hljs-regexp, +.hljs-link { + color: #ff00ff; +} + +.hljs-meta { + color: #fff; + font-weight: bolder; +} diff --git a/packages/ui/certd-client/src/components/highlight-styles/zenburn.css b/packages/ui/certd-client/src/components/highlight-styles/zenburn.css new file mode 100644 index 000000000..07be50201 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight-styles/zenburn.css @@ -0,0 +1,80 @@ +/* + +Zenburn style from voldmar.ru (c) Vladimir Epifanov +based on dark.css by Ivan Sagalaev + +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #3f3f3f; + color: #dcdcdc; +} + +.hljs-keyword, +.hljs-selector-tag, +.hljs-tag { + color: #e3ceab; +} + +.hljs-template-tag { + color: #dcdcdc; +} + +.hljs-number { + color: #8cd0d3; +} + +.hljs-variable, +.hljs-template-variable, +.hljs-attribute { + color: #efdcbc; +} + +.hljs-literal { + color: #efefaf; +} + +.hljs-subst { + color: #8f8f8f; +} + +.hljs-title, +.hljs-name, +.hljs-selector-id, +.hljs-selector-class, +.hljs-section, +.hljs-type { + color: #efef8f; +} + +.hljs-symbol, +.hljs-bullet, +.hljs-link { + color: #dca3a3; +} + +.hljs-deletion, +.hljs-string, +.hljs-built_in, +.hljs-builtin-name { + color: #cc9393; +} + +.hljs-addition, +.hljs-comment, +.hljs-quote, +.hljs-meta { + color: #7f9f7f; +} + + +.hljs-emphasis { + font-style: italic; +} + +.hljs-strong { + font-weight: bold; +} diff --git a/packages/ui/certd-client/src/components/highlight/index.vue b/packages/ui/certd-client/src/components/highlight/index.vue new file mode 100644 index 000000000..67388235d --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight/index.vue @@ -0,0 +1,66 @@ + + + + + diff --git a/packages/ui/certd-client/src/components/highlight/libs/htmlFormat.js b/packages/ui/certd-client/src/components/highlight/libs/htmlFormat.js new file mode 100644 index 000000000..637e1ab54 --- /dev/null +++ b/packages/ui/certd-client/src/components/highlight/libs/htmlFormat.js @@ -0,0 +1,365 @@ +/* eslint-disable */ + +// 功能 +// 将HTML字符串格式化 + +const format = (function() { + function style_html(html_source, indent_size, indent_character, max_char) { + var Parser, multi_parser; + function Parser() { + this.pos = 0; + this.token = ''; + this.current_mode = 'CONTENT'; + this.tags = { + parent: 'parent1', + parentcount: 1, + parent1: '' + }; + this.tag_type = ''; + this.token_text = this.last_token = this.last_text = this.token_type = ''; + this.Utils = { + whitespace: "\n\r\t ".split(''), + single_token: 'br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed'.split(','), + extra_liners: 'head,body,/html'.split(','), + in_array: function(what, arr) { + for (var i = 0; i < arr.length; i++) { + if (what === arr[i]) { + return true; + } + } + return false; + } + } + this.get_content = function() { + var char = ''; + var content = []; + var space = false; + while (this.input.charAt(this.pos) !== '<') { + if (this.pos >= this.input.length) { + return content.length ? content.join('') : ['', 'TK_EOF']; + } + char = this.input.charAt(this.pos); + this.pos++; + this.line_char_count++; + if (this.Utils.in_array(char, this.Utils.whitespace)) { + if (content.length) { + space = true; + } + this.line_char_count--; + continue; + } else if (space) { + if (this.line_char_count >= this.max_char) { + content.push('\n'); + for (var i = 0; i < this.indent_level; i++) { + content.push(this.indent_string); + } + this.line_char_count = 0; + } else { + content.push(' '); + this.line_char_count++; + } + space = false; + } + content.push(char); + } + return content.length ? content.join('') : ''; + } + this.get_script = function() { + var char = ''; + var content = []; + var reg_match = new RegExp('\<\/script' + '\>', 'igm'); + reg_match.lastIndex = this.pos; + var reg_array = reg_match.exec(this.input); + var end_script = reg_array ? reg_array.index: this.input.length; + while (this.pos < end_script) { + if (this.pos >= this.input.length) { + return content.length ? content.join('') : ['', 'TK_EOF']; + } + char = this.input.charAt(this.pos); + this.pos++; + content.push(char); + } + return content.length ? content.join('') : ''; + } + this.record_tag = function(tag) { + if (this.tags[tag + 'count']) { + this.tags[tag + 'count']++; + this.tags[tag + this.tags[tag + 'count']] = this.indent_level; + } else { + this.tags[tag + 'count'] = 1; + this.tags[tag + this.tags[tag + 'count']] = this.indent_level; + } + this.tags[tag + this.tags[tag + 'count'] + 'parent'] = this.tags.parent; + this.tags.parent = tag + this.tags[tag + 'count']; + } + this.retrieve_tag = function(tag) { + if (this.tags[tag + 'count']) { + var temp_parent = this.tags.parent; + while (temp_parent) { + if (tag + this.tags[tag + 'count'] === temp_parent) { + break; + } + temp_parent = this.tags[temp_parent + 'parent']; + } + if (temp_parent) { + this.indent_level = this.tags[tag + this.tags[tag + 'count']]; + this.tags.parent = this.tags[temp_parent + 'parent']; + } + delete this.tags[tag + this.tags[tag + 'count'] + 'parent']; + delete this.tags[tag + this.tags[tag + 'count']]; + if (this.tags[tag + 'count'] == 1) { + delete this.tags[tag + 'count']; + } else { + this.tags[tag + 'count']--; + } + } + } + this.get_tag = function() { + var char = ''; + var content = []; + var space = false; + do { + if (this.pos >= this.input.length) { + return content.length ? content.join('') : ['', 'TK_EOF']; + } + char = this.input.charAt(this.pos); + this.pos++; + this.line_char_count++; + if (this.Utils.in_array(char, this.Utils.whitespace)) { + space = true; + this.line_char_count--; + continue; + } + if (char === "'" || char === '"') { + if (!content[1] || content[1] !== '!') { + char += this.get_unformatted(char); + space = true; + } + } + if (char === '=') { + space = false; + } + if (content.length && content[content.length - 1] !== '=' && char !== '>' && space) { + if (this.line_char_count >= this.max_char) { + this.print_newline(false, content); + this.line_char_count = 0; + } else { + content.push(' '); + this.line_char_count++; + } + space = false; + } + content.push(char); + } while ( char !== '>'); + var tag_complete = content.join(''); + var tag_index; + if (tag_complete.indexOf(' ') != -1) { + tag_index = tag_complete.indexOf(' '); + } else { + tag_index = tag_complete.indexOf('>'); + } + var tag_check = tag_complete.substring(1, tag_index).toLowerCase(); + if (tag_complete.charAt(tag_complete.length - 2) === '/' || this.Utils.in_array(tag_check, this.Utils.single_token)) { + this.tag_type = 'SINGLE'; + } else if (tag_check === 'script') { + this.record_tag(tag_check); + this.tag_type = 'SCRIPT'; + } else if (tag_check === 'style') { + this.record_tag(tag_check); + this.tag_type = 'STYLE'; + } else if (tag_check.charAt(0) === '!') { + if (tag_check.indexOf('[if') != -1) { + if (tag_complete.indexOf('!IE') != -1) { + var comment = this.get_unformatted('-->', tag_complete); + content.push(comment); + } + this.tag_type = 'START'; + } else if (tag_check.indexOf('[endif') != -1) { + this.tag_type = 'END'; + this.unindent(); + } else if (tag_check.indexOf('[cdata[') != -1) { + var comment = this.get_unformatted(']]>', tag_complete); + content.push(comment); + this.tag_type = 'SINGLE'; + } else { + var comment = this.get_unformatted('-->', tag_complete); + content.push(comment); + this.tag_type = 'SINGLE'; + } + } else { + if (tag_check.charAt(0) === '/') { + this.retrieve_tag(tag_check.substring(1)); + this.tag_type = 'END'; + } else { + this.record_tag(tag_check); + this.tag_type = 'START'; + } + if (this.Utils.in_array(tag_check, this.Utils.extra_liners)) { + this.print_newline(true, this.output); + } + } + return content.join(''); + } + this.get_unformatted = function(delimiter, orig_tag) { + if (orig_tag && orig_tag.indexOf(delimiter) != -1) { + return ''; + } + var char = ''; + var content = ''; + var space = true; + do { + char = this.input.charAt(this.pos); + this.pos++ + if (this.Utils.in_array(char, this.Utils.whitespace)) { + if (!space) { + this.line_char_count--; + continue; + } + if (char === '\n' || char === '\r') { + content += '\n'; + for (var i = 0; i < this.indent_level; i++) { + content += this.indent_string; + } + space = false; + this.line_char_count = 0; + continue; + } + } + content += char; + this.line_char_count++; + space = true; + + } while ( content . indexOf ( delimiter ) == -1); + return content; + } + this.get_token = function() { + var token; + if (this.last_token === 'TK_TAG_SCRIPT') { + var temp_token = this.get_script(); + if (typeof temp_token !== 'string') { + return temp_token; + } + //token = js_beautify(temp_token, this.indent_size, this.indent_character, this.indent_level); + //return [token, 'TK_CONTENT']; + return [temp_token, 'TK_CONTENT']; + } + if (this.current_mode === 'CONTENT') { + token = this.get_content(); + if (typeof token !== 'string') { + return token; + } else { + return [token, 'TK_CONTENT']; + } + } + if (this.current_mode === 'TAG') { + token = this.get_tag(); + if (typeof token !== 'string') { + return token; + } else { + var tag_name_type = 'TK_TAG_' + this.tag_type; + return [token, tag_name_type]; + } + } + } + this.printer = function(js_source, indent_character, indent_size, max_char) { + this.input = js_source || ''; + this.output = []; + this.indent_character = indent_character || ' '; + this.indent_string = ''; + this.indent_size = indent_size || 2; + this.indent_level = 0; + this.max_char = max_char || 70; + this.line_char_count = 0; + for (var i = 0; i < this.indent_size; i++) { + this.indent_string += this.indent_character; + } + this.print_newline = function(ignore, arr) { + this.line_char_count = 0; + if (!arr || !arr.length) { + return; + } + if (!ignore) { + while (this.Utils.in_array(arr[arr.length - 1], this.Utils.whitespace)) { + arr.pop(); + } + } + arr.push('\n'); + for (var i = 0; i < this.indent_level; i++) { + arr.push(this.indent_string); + } + } + this.print_token = function(text) { + this.output.push(text); + } + this.indent = function() { + this.indent_level++; + } + this.unindent = function() { + if (this.indent_level > 0) { + this.indent_level--; + } + } + } + return this; + } + multi_parser = new Parser(); + multi_parser.printer(html_source, indent_character, indent_size); + while (true) { + var t = multi_parser.get_token(); + multi_parser.token_text = t[0]; + multi_parser.token_type = t[1]; + if (multi_parser.token_type === 'TK_EOF') { + break; + } + switch (multi_parser.token_type) { + case 'TK_TAG_START': + case 'TK_TAG_SCRIPT': + case 'TK_TAG_STYLE': + multi_parser.print_newline(false, multi_parser.output); + multi_parser.print_token(multi_parser.token_text); + multi_parser.indent(); + multi_parser.current_mode = 'CONTENT'; + break; + case 'TK_TAG_END': + multi_parser.print_newline(true, multi_parser.output); + multi_parser.print_token(multi_parser.token_text); + multi_parser.current_mode = 'CONTENT'; + break; + case 'TK_TAG_SINGLE': + multi_parser.print_newline(false, multi_parser.output); + multi_parser.print_token(multi_parser.token_text); + multi_parser.current_mode = 'CONTENT'; + break; + case 'TK_CONTENT': + if (multi_parser.token_text !== '') { + multi_parser.print_newline(false, multi_parser.output); + multi_parser.print_token(multi_parser.token_text); + } + multi_parser.current_mode = 'TAG'; + break; + } + multi_parser.last_token = multi_parser.token_type; + multi_parser.last_text = multi_parser.token_text; + } + return multi_parser.output.join(''); + } + return function(data) { + var dataHolder = ['__dataHolder_', [Math.random(), Math.random(), Math.random(), Math.random()].join('_').replace(/[^0-9]/g, '_'), '_'].join('_'); + var dataHolders = {}; + var index = 0; + data = data.replace(/(\")(data:[^\"]*)(\")/g, + function($0, $1, $2, $3) { + var name = dataHolder + index++; + dataHolders[name] = $2; + return $1 + name + $3; + }) + data = style_html(data, 2, ' ', 0x10000000); + data = data.replace(new RegExp(dataHolder + '[0-9]+', 'g'), + function($0) { + return dataHolders[$0]; + }); + return data; + } +})(); + +export default format diff --git a/packages/ui/certd-client/src/components/index.ts b/packages/ui/certd-client/src/components/index.ts new file mode 100644 index 000000000..408edf284 --- /dev/null +++ b/packages/ui/certd-client/src/components/index.ts @@ -0,0 +1,7 @@ +import { defineAsyncComponent } from "vue"; +const AsyncHighLight = defineAsyncComponent(() => import("./highlight/index.vue")); +export default { + install(app) { + app.component("FsHighlight", AsyncHighLight); + } +}; diff --git a/packages/ui/certd-client/src/i18n/index.ts b/packages/ui/certd-client/src/i18n/index.ts new file mode 100644 index 000000000..015c35458 --- /dev/null +++ b/packages/ui/certd-client/src/i18n/index.ts @@ -0,0 +1,27 @@ +import { createI18n } from "vue-i18n"; +// +import enFsLocale from "@fast-crud/fast-crud/dist/locale/lang/en.js"; +import zhFsLocale from "@fast-crud/fast-crud/dist/locale/lang/zh-cn.js"; +import en from "./locale/en"; +import zh from "./locale/zh_CN"; +const messages = { + en: { + label: "English", + // 定义您自己的字典,但是请不要和 `fs` 重复,这样会导致 fast-crud 内部组件的翻译失效. + fs: enFsLocale.fs, + ...en + }, + "zh-cn": { + label: "简体中文", + // 定义您自己的字典,但是请不要和 `fs` 重复,这样会导致 fast-crud 内部组件的翻译失效. + fs: zhFsLocale.fs, + ...zh + } +}; + +export default createI18n({ + legacy: false, + locale: "zh-cn", + fallbackLocale: "zh-cn", + messages +}); diff --git a/packages/ui/certd-client/src/i18n/locale/en.ts b/packages/ui/certd-client/src/i18n/locale/en.ts new file mode 100644 index 000000000..d59a415d1 --- /dev/null +++ b/packages/ui/certd-client/src/i18n/locale/en.ts @@ -0,0 +1,3 @@ +export default { + app: { crud: { i18n: { name: "name", city: "city", status: "status" } } } +}; diff --git a/packages/ui/certd-client/src/i18n/locale/zh_CN.ts b/packages/ui/certd-client/src/i18n/locale/zh_CN.ts new file mode 100644 index 000000000..cfb247c36 --- /dev/null +++ b/packages/ui/certd-client/src/i18n/locale/zh_CN.ts @@ -0,0 +1,9 @@ +export default { + app: { + crud: { i18n: { name: "姓名", city: "城市", status: "状态" } }, + login: { + logoutTip: "确认", + logoutMessage: "确定要注销登录吗?" + } + } +}; diff --git a/packages/ui/certd-client/src/layout/components/contextmenu/components/contentmenuList/index.vue b/packages/ui/certd-client/src/layout/components/contextmenu/components/contentmenuList/index.vue new file mode 100644 index 000000000..6e3866f7a --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/contextmenu/components/contentmenuList/index.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/packages/ui/certd-client/src/layout/components/contextmenu/index.vue b/packages/ui/certd-client/src/layout/components/contextmenu/index.vue new file mode 100644 index 000000000..664f41328 --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/contextmenu/index.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/packages/ui/certd-client/src/layout/components/locale/index.vue b/packages/ui/certd-client/src/layout/components/locale/index.vue new file mode 100644 index 000000000..87f8d92ac --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/locale/index.vue @@ -0,0 +1,76 @@ + + + + + diff --git a/packages/ui/certd-client/src/layout/components/menu/index.jsx b/packages/ui/certd-client/src/layout/components/menu/index.jsx new file mode 100644 index 000000000..cb2cb58dd --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/menu/index.jsx @@ -0,0 +1,224 @@ +import { useRoute, useRouter } from "vue-router"; +import { ref, watch, onMounted, onUnmounted, resolveComponent, nextTick, defineComponent } from "vue"; +import getEachDeep from "deepdash-es/getEachDeep"; +import _ from "lodash-es"; +import BScroll from "better-scroll"; +import "./index.less"; +const eachDeep = getEachDeep(_); + +function useBetterScroll(enabled = true) { + let bsRef = ref(null); + let asideMenuRef = ref(); + + let onOpenChange = () => {}; + if (enabled) { + function bsInit() { + if (asideMenuRef.value == null) { + return; + } + bsRef.value = new BScroll(asideMenuRef.value, { + mouseWheel: true, + click: true, + momentum: false, + // 如果你愿意可以打开显示滚动条 + scrollbar: { + fade: true, + interactive: false + }, + bounce: false + }); + } + + function bsDestroy() { + if (bsRef.value != null && bsRef.value.destroy) { + try { + bsRef.value.destroy(); + } catch (e) { + // console.error(e); + } finally { + bsRef.value = null; + } + } + } + + onMounted(() => { + bsInit(); + }); + + onUnmounted(() => { + bsDestroy(); + }); + onOpenChange = async () => { + console.log("onOpenChange"); + setTimeout(() => { + bsRef.value?.refresh(); + }, 300); + }; + } + return { + onOpenChange, + asideMenuRef + }; +} +export default defineComponent({ + name: "FsMenu", + inheritAttrs: true, + props: { + menus: {}, + expandSelected: { + default: false + }, + scroll: {} + }, + setup(props, ctx) { + async function open(path) { + if (path == null) { + return; + } + if (path.startsWith("http://") || path.startsWith("https://")) { + window.open(path); + return; + } + try { + const navigationResult = await router.push(path); + if (navigationResult) { + // 导航被阻止 + } else { + // 导航成功 (包括重新导航的情况) + } + } catch (e) { + console.error("导航失败", e); + } + } + function onSelect(item) { + open(item.key); + } + + const FsIcon = resolveComponent("FsIcon"); + + const buildMenus = (children) => { + const slots = []; + if (children == null) { + return slots; + } + for (let sub of children) { + const title = () => { + if (sub?.meta?.icon) { + return ( +
+ + {sub.title} +
+ ); + } + return sub.title; + }; + if (sub.children && sub.children.length > 0) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const subSlots = { + default: () => { + return buildMenus(sub.children); + }, + title + }; + function onTitleClick() { + if (sub.path && ctx.attrs.mode === "horizontal") { + open(sub.path); + } + } + slots.push(); + } else { + slots.push( + + {title} + + ); + } + } + return slots; + }; + const slots = { + default() { + return buildMenus(props.menus); + } + }; + const selectedKeys = ref([]); + const openKeys = ref([]); + const route = useRoute(); + const router = useRouter(); + + function openSelectedParents(fullPath) { + if (!props.expandSelected) { + return; + } + if (props.menus == null) { + return; + } + const keys = []; + let changed = false; + eachDeep(props.menus, (value, key, parent, context) => { + if (value == null) { + return; + } + if (value.path === fullPath) { + _.forEach(context.parents, (item) => { + if (item.value instanceof Array) { + return; + } + keys.push(item.value.index); + }); + } + }); + if (keys.length > 0) { + for (let key of keys) { + if (openKeys.value.indexOf(key) === -1) { + openKeys.value.push(key); + changed = true; + } + } + } + return changed; + } + + const { asideMenuRef, onOpenChange } = useBetterScroll(props.scroll); + + watch( + () => { + return route.fullPath; + }, + (path) => { + // path = route.fullPath; + selectedKeys.value = [path]; + const changed = openSelectedParents(path); + if (changed) { + onOpenChange(); + } + }, + { + immediate: true + } + ); + return () => { + const menu = ( + + ); + const classNames = { "fs-menu-wrapper": true, "fs-menu-better-scroll": props.scroll }; + return ( +
+ {menu} +
+ ); + }; + } +}); diff --git a/packages/ui/certd-client/src/layout/components/menu/index.less b/packages/ui/certd-client/src/layout/components/menu/index.less new file mode 100644 index 000000000..9521a4070 --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/menu/index.less @@ -0,0 +1,11 @@ +.fs-menu-wrapper{ + height: 100%; + overflow-y: auto; + &.fs-menu-better-scroll{ + overflow-y: hidden; + } + .menu-item-title{ + display: flex; + align-items: center; + } +} diff --git a/packages/ui/certd-client/src/layout/components/source-link/index.vue b/packages/ui/certd-client/src/layout/components/source-link/index.vue new file mode 100644 index 000000000..9d16a5021 --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/source-link/index.vue @@ -0,0 +1,54 @@ + + + + + diff --git a/packages/ui/certd-client/src/layout/components/tabs/index.vue b/packages/ui/certd-client/src/layout/components/tabs/index.vue new file mode 100644 index 000000000..21ddddb8c --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/tabs/index.vue @@ -0,0 +1,295 @@ + + + + diff --git a/packages/ui/certd-client/src/layout/components/theme/color-picker.vue b/packages/ui/certd-client/src/layout/components/theme/color-picker.vue new file mode 100644 index 000000000..599baf34e --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/theme/color-picker.vue @@ -0,0 +1,101 @@ + + + + diff --git a/packages/ui/certd-client/src/layout/components/theme/index.vue b/packages/ui/certd-client/src/layout/components/theme/index.vue new file mode 100644 index 000000000..bc8a92c05 --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/theme/index.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/packages/ui/certd-client/src/layout/components/user-info/index.vue b/packages/ui/certd-client/src/layout/components/user-info/index.vue new file mode 100644 index 000000000..24af19850 --- /dev/null +++ b/packages/ui/certd-client/src/layout/components/user-info/index.vue @@ -0,0 +1,40 @@ + + diff --git a/packages/ui/certd-client/src/layout/layout-framework.vue b/packages/ui/certd-client/src/layout/layout-framework.vue new file mode 100644 index 000000000..0e57eab86 --- /dev/null +++ b/packages/ui/certd-client/src/layout/layout-framework.vue @@ -0,0 +1,230 @@ + + + + diff --git a/packages/ui/certd-client/src/layout/layout-outside.vue b/packages/ui/certd-client/src/layout/layout-outside.vue new file mode 100644 index 000000000..a35b8c5e1 --- /dev/null +++ b/packages/ui/certd-client/src/layout/layout-outside.vue @@ -0,0 +1,154 @@ + + + + diff --git a/packages/ui/certd-client/src/layout/layout-pass.vue b/packages/ui/certd-client/src/layout/layout-pass.vue new file mode 100644 index 000000000..98240aef8 --- /dev/null +++ b/packages/ui/certd-client/src/layout/layout-pass.vue @@ -0,0 +1,3 @@ + diff --git a/packages/ui/certd-client/src/main.ts b/packages/ui/certd-client/src/main.ts new file mode 100644 index 000000000..409b9ee64 --- /dev/null +++ b/packages/ui/certd-client/src/main.ts @@ -0,0 +1,23 @@ +import { createApp } from "vue"; +import App from "./App.vue"; +import router from "./router"; +import Antd from "ant-design-vue"; +import "ant-design-vue/dist/antd.less"; +// import "virtual:windi.css"; +import "./style/common.less"; +import "./mock"; +import i18n from "./i18n"; +import store from "./store"; +import components from "./components"; +import plugin from "./plugin/"; + +// @ts-ignore +const app = createApp(App); +// 尽量 +app.use(Antd); +app.use(router); +app.use(i18n); +app.use(store); +app.use(components); +app.use(plugin, { i18n }); +app.mount("#app"); diff --git a/packages/ui/certd-client/src/mock/base.js b/packages/ui/certd-client/src/mock/base.js new file mode 100644 index 000000000..1cacbac71 --- /dev/null +++ b/packages/ui/certd-client/src/mock/base.js @@ -0,0 +1,280 @@ +import _ from "lodash-es"; +function copyList(originList, newList, options, parentId) { + for (const item of originList) { + const newItem = { ...item, parentId }; + newItem.id = ++options.idGenerator; + newList.push(newItem); + if (item.children != null) { + newItem.children = []; + copyList(item.children, newItem.children, options, newItem.id); + } + } +} + +function delById(req, list) { + for (let i = 0; i < list.length; i++) { + const item = list[i]; + console.log("remove i", i, req, req.params.id, item.id); + if (item.id === parseInt(req.params.id)) { + console.log("remove i", i); + list.splice(i, 1); + break; + } + if (item.children != null && item.children.length > 0) { + delById(req, item.children); + } + } +} + +function findById(id, list) { + for (const item of list) { + if (item.id === id) { + return item; + } + if (item.children != null && item.children.length > 0) { + const sub = findById(id, item.children); + if (sub != null) { + return sub; + } + } + } +} +export default { + findById, + buildMock(options) { + const name = options.name; + if (options.copyTimes == null) { + options.copyTimes = 29; + } + const list = []; + for (let i = 0; i < options.copyTimes; i++) { + copyList(options.list, list, options); + } + options.list = list; + return [ + { + path: "/mock/" + name + "/page", + method: "get", + handle(req) { + let data = [...list]; + let limit = 20; + let offset = 0; + for (const item of list) { + if (item.children != null && item.children.length === 0) { + item.hasChildren = false; + item.lazy = false; + } + } + let orderProp, orderAsc; + if (req && req.body) { + const { page, query, sort } = req.body; + if (page.limit != null) { + limit = parseInt(page.limit); + } + if (page.offset != null) { + offset = parseInt(page.offset); + } + orderProp = sort.prop; + orderAsc = sort.asc; + + if (Object.keys(query).length > 0) { + data = list.filter((item) => { + let allFound = true; // 是否所有条件都符合 + for (const key in query) { + // 判定某一个条件 + const value = query[key]; + if (value == null || value === "") { + continue; + } + if (value instanceof Array) { + // 如果条件中的value是数组的话,只要查到一个就行 + if (value.length === 0) { + continue; + } + let found = false; + for (const i of value) { + if (item[key] instanceof Array) { + for (const j of item[key]) { + if (i === j) { + found = true; + break; + } + } + if (found) { + break; + } + } else if (item[key] === i || (typeof item[key] === "string" && item[key].indexOf(i + "") >= 0)) { + found = true; + break; + } + if (found) { + break; + } + } + if (!found) { + allFound = false; + } + } else if (value instanceof Object) { + for (const key2 in value) { + const v = value[key2]; + if (v && item[key] && v !== item[key][key2]) { + return false; + } + } + } else if (item[key] !== value) { + allFound = false; + } + } + return allFound; + }); + } + } + + const start = offset; + let end = offset + limit; + if (data.length < end) { + end = data.length; + } + + if (orderProp) { + // 排序 + data.sort((a, b) => { + let ret = 0; + if (a[orderProp] > b[orderProp]) { + ret = 1; + } else { + ret = -1; + } + return orderAsc ? ret : -ret; + }); + } + + const records = data.slice(start, end); + const lastOffset = data.length - (data.length % limit); + if (offset > lastOffset) { + offset = lastOffset; + } + return { + code: 0, + msg: "success", + data: { + records: records, + total: data.length, + limit, + offset + } + }; + } + }, + { + path: "/mock/" + name + "/get", + method: "get", + handle(req) { + let id = req.params.id; + id = parseInt(id); + let current = null; + for (const item of list) { + if (item.id === id) { + current = item; + break; + } + } + return { + code: 0, + msg: "success", + data: current + }; + } + }, + { + path: "/mock/" + name + "/add", + method: "post", + handle(req) { + req.body.id = ++options.idGenerator; + list.unshift(req.body); + return { + code: 0, + msg: "success", + data: req.body.id + }; + } + }, + { + path: "/mock/" + name + "/update", + method: "post", + handle(req) { + const item = findById(req.body.id, list); + if (item) { + _.mergeWith(item, req.body, (objValue, srcValue) => { + if (srcValue == null) { + return; + } + // 如果被合并对象为数组,则直接被覆盖对象覆盖,只要覆盖对象不为空 + if (_.isArray(objValue)) { + return srcValue; + } + }); + } + return { + code: 0, + msg: "success", + data: null + }; + } + }, + { + path: "/mock/" + name + "/delete", + method: "post", + handle(req) { + delById(req, list); + return { + code: 0, + msg: "success", + data: null + }; + } + }, + { + path: "/mock/" + name + "/batchDelete", + method: "post", + handle(req) { + const ids = req.body.ids; + for (let i = list.length - 1; i >= 0; i--) { + const item = list[i]; + if (ids.indexOf(item.id) >= 0) { + list.splice(i, 1); + } + } + return { + code: 0, + msg: "success", + data: null + }; + } + }, + { + path: "/mock/" + name + "/delete", + method: "post", + handle(req) { + delById(req, list); + return { + code: 0, + msg: "success", + data: null + }; + } + }, + { + path: "/mock/" + name + "/all", + method: "post", + handle(req) { + return { + code: 0, + msg: "success", + data: list + }; + } + } + ]; + } +}; diff --git a/packages/ui/certd-client/src/mock/common/cascader-data.js b/packages/ui/certd-client/src/mock/common/cascader-data.js new file mode 100644 index 000000000..2b22016ff --- /dev/null +++ b/packages/ui/certd-client/src/mock/common/cascader-data.js @@ -0,0 +1,268 @@ +export default [ + { + value: "zhinan", + label: "指南", + children: [ + { + value: "shejiyuanze", + label: "设计原则", + children: [ + { + value: "yizhi", + label: "一致" + }, + { + value: "fankui", + label: "反馈" + }, + { + value: "xiaolv", + label: "效率" + }, + { + value: "kekong", + label: "可控" + } + ] + }, + { + value: "daohang", + label: "导航", + children: [ + { + value: "cexiangdaohang", + label: "侧向导航" + }, + { + value: "dingbudaohang", + label: "顶部导航" + } + ] + } + ] + }, + { + value: "zujian", + label: "组件", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout 布局" + }, + { + value: "color", + label: "Color 色彩" + }, + { + value: "typography", + label: "Typography 字体" + }, + { + value: "icon", + label: "Icon 图标" + }, + { + value: "button", + label: "Button 按钮" + } + ] + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio 单选框" + }, + { + value: "checkbox", + label: "Checkbox 多选框" + }, + { + value: "input", + label: "Input 输入框" + }, + { + value: "input-number", + label: "InputNumber 计数器" + }, + { + value: "select", + label: "Select 选择器" + }, + { + value: "cascader", + label: "Cascader 级联选择器" + }, + { + value: "switch", + label: "Switch 开关" + }, + { + value: "slider", + label: "Slider 滑块" + }, + { + value: "time-picker", + label: "TimePicker 时间选择器" + }, + { + value: "date-picker", + label: "DatePicker 日期选择器" + }, + { + value: "datetime-picker", + label: "DateTimePicker 日期时间选择器" + }, + { + value: "upload", + label: "Upload 上传" + }, + { + value: "rate", + label: "Rate 评分" + }, + { + value: "form1", + label: "Form 表单" + } + ] + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table 表格" + }, + { + value: "tag", + label: "Tag 标签" + }, + { + value: "progress", + label: "Progress 进度条" + }, + { + value: "tree", + label: "Tree 树形控件" + }, + { + value: "pagination", + label: "Pagination 分页" + }, + { + value: "badge", + label: "Badge 标记" + } + ] + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert 警告" + }, + { + value: "loading", + label: "Loading 加载" + }, + { + value: "message", + label: "Message 消息提示" + }, + { + value: "message-box", + label: "MessageBox 弹框" + }, + { + value: "notification", + label: "Notification 通知" + } + ] + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "NavMenu 导航菜单" + }, + { + value: "tabs", + label: "Tabs 标签页" + }, + { + value: "breadcrumb", + label: "Breadcrumb 面包屑" + }, + { + value: "dropdown", + label: "Dropdown 下拉菜单" + }, + { + value: "steps", + label: "Steps 步骤条" + } + ] + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog 对话框" + }, + { + value: "tooltip", + label: "Tooltip 文字提示" + }, + { + value: "popover", + label: "Popover 弹出框" + }, + { + value: "card", + label: "Card 卡片" + }, + { + value: "carousel", + label: "Carousel 走马灯" + }, + { + value: "collapse", + label: "Collapse 折叠面板" + } + ] + } + ] + }, + { + value: "ziyuan", + label: "资源", + children: [ + { + value: "axure", + label: "Axure Components" + }, + { + value: "sketch", + label: "Sketch Templates" + }, + { + value: "jiaohu", + label: "组件交互文档" + } + ] + } +]; diff --git a/packages/ui/certd-client/src/mock/common/mock.dict.js b/packages/ui/certd-client/src/mock/common/mock.dict.js new file mode 100644 index 000000000..d758ddd4e --- /dev/null +++ b/packages/ui/certd-client/src/mock/common/mock.dict.js @@ -0,0 +1,123 @@ +import cascaderData from "./cascader-data"; +import pcaDataLittle from "./pca-data-little"; +import { TreeNodesLazyLoader, getPcaData } from "./pcas-data"; + +const openStatus = [ + { value: "1", label: "打开", color: "success",icon:"ion:radio-button-on" }, + { value: "2", label: "停止", color: "cyan" }, + { value: "0", label: "关闭", color: "red",icon:"ion:radio-button-off" } +]; + +const moreOpenStatus = [ + { value: "1", label: "打开(open)", color: "success" }, + { value: "2", label: "停止(stop)", color: "cyan" }, + { value: "0", label: "关闭(close)", color: "red" } +]; + +const textStatus = [ + { id: "1", text: "打开", color: "success" }, + { id: "2", text: "停止", color: "cyan" }, + { id: "0", text: "关闭", color: "red" } +]; + +export function GetTreeChildrenByParentId(parentId) { + return TreeNodesLazyLoader.getChildren(parentId); +} + +export function GetNodesByValues(values) { + return TreeNodesLazyLoader.getNodesByValues(values); +} + +export default [ + { + path: "/mock/dicts/OpenStatusEnum", + method: "get", + handle() { + return { + code: 0, + msg: "success", + data: openStatus + }; + } + }, + { + path: "/mock/dicts/_OpenStatusEnum2", + method: "get", + handle() { + return { + code: 0, + msg: "success", + data: textStatus + }; + } + }, + { + path: "/mock/dicts/moreOpenStatusEnum", + method: "get", + handle() { + return { + code: 0, + msg: "success", + data: moreOpenStatus + }; + } + }, + { + path: "/mock/dicts/cascaderData", + method: "get", + handle() { + return { + code: 0, + msg: "success", + data: cascaderData + }; + } + }, + { + path: "/mock/dicts/pca", + method: "get", + async handle() { + const data = await getPcaData(); + return { + code: 0, + msg: "success", + data: data + }; + } + }, + { + path: "/mock/dicts/littlePca", + method: "get", + async handle() { + return { + code: 0, + msg: "success", + data: pcaDataLittle + }; + } + }, + { + path: "/mock/tree/GetTreeChildrenByParentId", + method: "get", + async handle({ params }) { + const list = await GetTreeChildrenByParentId(params.parentId); + return { + code: 0, + msg: "success", + data: list + }; + } + }, + { + path: "/mock/tree/GetNodesByValues", + method: "get", + async handle({ params }) { + const list = await GetNodesByValues(params.values); + return { + code: 0, + msg: "success", + data: list + }; + } + } +]; diff --git a/packages/ui/certd-client/src/mock/common/pca-data-little.js b/packages/ui/certd-client/src/mock/common/pca-data-little.js new file mode 100644 index 000000000..ae5aa367a --- /dev/null +++ b/packages/ui/certd-client/src/mock/common/pca-data-little.js @@ -0,0 +1,70 @@ +export default [ + { + code: "1", + name: "北京", + children: [ + { + code: "2", + name: "北京市区", + children: [ + { + code: "3", + name: "海淀" + }, + { + code: "4", + name: "朝阳" + } + ] + }, + { + code: "5", + name: "北京郊区", + children: [ + { + code: "6", + name: "海淀郊区" + }, + { + code: "7", + name: "朝阳郊区" + } + ] + } + ] + }, + { + code: "11", + name: "深圳", + children: [ + { + code: "12", + name: "深圳市区", + children: [ + { + code: "13", + name: "南山" + }, + { + code: "14", + name: "福田" + } + ] + }, + { + code: "15", + name: "深圳郊区", + children: [ + { + code: "16", + name: "南山郊区" + }, + { + code: "17", + name: "福田郊区" + } + ] + } + ] + } +]; diff --git a/packages/ui/certd-client/src/mock/common/pcas-data.js b/packages/ui/certd-client/src/mock/common/pcas-data.js new file mode 100644 index 000000000..c1bbb64a7 --- /dev/null +++ b/packages/ui/certd-client/src/mock/common/pcas-data.js @@ -0,0 +1,87 @@ +import _ from "lodash-es"; +export async function getPcasData() { + const pcasData = () => import("china-division/dist/pcas-code.json"); + const ret = await pcasData(); + return ret.default; +} +export async function getPcaData() { + const pcaData = () => import("china-division/dist/pca-code.json"); + const ret = await pcaData(); + return ret.default; +} +export const TreeNodesLazyLoader = { + getNodesByValues(values) { + console.log("getNodesByValues", values); + if (!(values instanceof Array)) { + values = [values]; + } + return getPcasData().then((data) => { + const nodes = []; + for (const value of values) { + const found = this.getNode(data, value); + if (found) { + const target = _.cloneDeep(found); + delete target.children; + nodes.push(target); + } + } + return nodes; + }); + }, + getNode(list, value) { + for (const item of list) { + if (item.code === value) { + return item; + } + if (item.children && item.children.length > 0) { + const found = this.getNode(item.children, value); + if (found) { + return found; + } + } + } + }, + getChildren(parent) { + return getPcasData().then((data) => { + const list = this.getChildrenByParent(parent, data); + if (list == null) { + return []; + } + return this.cloneAndDeleteChildren(list); + }); + }, + getChildrenByParent(parentId, tree) { + if (!parentId) { + // 取第一级 + return tree; + } else { + for (const node of tree) { + if (node.code === parentId) { + return node.children; + } + if (node.children && node.children.length > 0) { + // 递归查找 + const list = this.getChildrenByParent(parentId, node.children); + if (list) { + return list; + } + } + } + } + }, + cloneAndDeleteChildren(list) { + const newList = []; + for (const node of list) { + const newNode = {}; + Object.assign(newNode, node); + if (newNode.children == null || newNode.children.length === 0) { + newNode.isLeaf = true; + newNode.leaf = true; + } + delete newNode.children; + newList.push(newNode); + } + console.log("found children:", newList); + return newList; + } +}; diff --git a/packages/ui/certd-client/src/mock/index.js b/packages/ui/certd-client/src/mock/index.js new file mode 100644 index 000000000..4494fc5f9 --- /dev/null +++ b/packages/ui/certd-client/src/mock/index.js @@ -0,0 +1,49 @@ +import { mock } from "../api/service"; +import * as tools from "../api/tools"; +import _ from "lodash-es"; +const commonMocks = import.meta.globEager("./common/mock.*.js"); +const apiMocks = import.meta.globEager("../api/modules/*.mock.ts"); +const viewMocks = import.meta.globEager("../views/**/mock.js"); + +const list = []; +_.forEach(commonMocks, (value) => { + list.push(value.default); +}); +_.forEach(apiMocks, (value) => { + list.push(value.default); +}); +_.forEach(viewMocks, (value) => { + list.push(value.default); +}); + +list.forEach((apiFile) => { + for (const item of apiFile) { + mock.onAny(new RegExp(item.path)).reply(async (config) => { + console.log("------------fake request start -------------"); + console.log("request:", config); + const data = config.data ? JSON.parse(config.data) : {}; + const query = config.url.indexOf("?") >= 0 ? config.url.substring(config.url.indexOf("?") + 1) : undefined; + const params = config.params || {}; + if (query) { + const arr = query.split("&"); + for (const item of arr) { + const kv = item.split("="); + params[kv[0]] = kv[1]; + } + } + + const req = { + body: data, + params: params + }; + const ret = await item.handle(req); + console.log("response:", ret); + console.log("------------fake request end-------------"); + if (ret.code === 0) { + return tools.responseSuccess(ret.data, ret.msg); + } else { + return tools.responseError(ret.data, ret.msg, ret.code); + } + }); + } +}); diff --git a/packages/ui/certd-client/src/plugin/fast-crud/index.tsx b/packages/ui/certd-client/src/plugin/fast-crud/index.tsx new file mode 100644 index 000000000..5733f18db --- /dev/null +++ b/packages/ui/certd-client/src/plugin/fast-crud/index.tsx @@ -0,0 +1,245 @@ +import { request, requestForMock } from "/src/api/service"; +import "/src/mock"; +import { FastCrud, UseCrudProps, useTypes, setLogger, useColumns, ColumnCompositionProps, MergeColumnPlugin, CrudOptions } from "@fast-crud/fast-crud"; +import "@fast-crud/fast-crud/dist/style.css"; +import { FsExtendsUploader, FsExtendsEditor, FsExtendsJson, FsExtendsCopyable, FsExtendsTime } from "@fast-crud/fast-extends"; +import "@fast-crud/fast-extends/dist/style.css"; +import UiAntdv from "@fast-crud/ui-antdv"; +import _ from "lodash-es"; +import { useCrudPermission } from "../permission"; + +function install(app, options: any = {}) { + app.use(UiAntdv); + //设置日志级别 + setLogger({ level: "debug" }); + app.use(FastCrud, { + i18n: options.i18n, + async dictRequest({ url }) { + if (url && url.startsWith("/mock")) { + //如果是crud开头的dict请求视为mock + return await requestForMock({ url, method: "post" }); + } + return await request({ url, method: "post" }); + }, + /** + * useCrud时会被执行 + * @param context,useCrud的参数 + */ + commonOptions(context: UseCrudProps) { + const crudBinding = context.expose?.crudBinding; + const opts: CrudOptions = { + table: { + size: "small", + pagination: false, + onResizeColumn: (w, col) => { + crudBinding.value.table.columnsMap[col.key].width = w; + } + }, + rowHandle: { + buttons: { + view: { type: "link", text: null, icon: "ion:eye-outline" }, + edit: { type: "link", text: null, icon: "ion:create-outline" }, + remove: { type: "link", style: { color: "red" }, text: null, icon: "ion:trash-outline" } + }, + dropdown: { + more: { + type: "link" + } + } + }, + request: { + transformQuery: ({ page, form, sort }) => { + const limit = page.pageSize; + const currentPage = page.currentPage ?? 1; + const offset = limit * (currentPage - 1); + + sort = sort == null ? {} : sort; + + return { + page: { + limit, + offset + }, + query: form, + sort + }; + }, + transformRes: ({ res }) => { + const pageSize = res.limit; + let currentPage = res.offset / pageSize; + if (res.offset % pageSize === 0) { + currentPage++; + } + return { currentPage, pageSize, ...res }; + } + }, + form: { + display: "flex", + labelCol: { + //固定label宽度 + span: null, + style: { + width: "120px" + } + }, + wrapperCol: { + span: null + } + } + }; + + // 从 useCrud({permission}) 里获取permission参数,去设置各个按钮的权限 + const crudPermission = useCrudPermission({ permission: context.permission }); + return crudPermission.merge(opts); + } + }); + + // fast-extends里面的扩展组件均为异步组件,只有在使用时才会被加载,并不会影响首页加载速度 + //安装uploader 公共参数 + app.use(FsExtendsUploader, { + defaultType: "cos", + cos: { + domain: "https://d2p-demo-1251260344.cos.ap-guangzhou.myqcloud.com", + bucket: "d2p-demo-1251260344", + region: "ap-guangzhou", + secretId: "", // + secretKey: "", // 传了secretKey 和secretId 代表使用本地签名模式(不安全,生产环境不推荐) + getAuthorization(custom) { + // 不传secretKey代表使用临时签名模式,此时此参数必传(安全,生产环境推荐) + return request({ + url: "http://www.docmirror.cn:7070/api/upload/cos/getAuthorization", + method: "get" + }).then((ret) => { + // 返回结构如下 + // ret.data:{ + // TmpSecretId, + // TmpSecretKey, + // XCosSecurityToken, + // ExpiredTime, // SDK 在 ExpiredTime 时间前,不会再次调用 getAuthorization + // } + return ret; + }); + }, + successHandle(ret) { + // 上传完成后可以在此处处理结果,修改url什么的 + console.log("success handle:", ret); + return ret; + } + }, + alioss: { + domain: "https://d2p-demo.oss-cn-shenzhen.aliyuncs.com", + bucket: "d2p-demo", + region: "oss-cn-shenzhen", + accessKeyId: "", + accessKeySecret: "", + async getAuthorization(custom, context) { + // 不传accessKeySecret代表使用临时签名模式,此时此参数必传(安全,生产环境推荐) + const ret = await request({ + url: "http://www.docmirror.cn:7070/api/upload/alioss/getAuthorization", + method: "get" + }); + console.log("ret", ret); + return ret; + }, + sdkOpts: { + // sdk配置 + secure: true // 默认为非https上传,为了安全,设置为true + }, + successHandle(ret) { + // 上传完成后可以在此处处理结果,修改url什么的 + console.log("success handle:", ret); + return ret; + } + }, + qiniu: { + bucket: "d2p-demo", + async getToken(options) { + const ret = await request({ + url: "http://www.docmirror.cn:7070/api/upload/qiniu/getToken", + method: "get" + }); + return ret; // {token:xxx,expires:xxx} + }, + successHandle(ret) { + // 上传完成后可以在此处处理结果,修改url什么的 + console.log("success handle:", ret); + return ret; + }, + domain: "http://d2p.file.handsfree.work/" + }, + form: { + action: "http://www.docmirror.cn:7070/api/upload/form/upload", + name: "file", + withCredentials: false, + uploadRequest: async ({ action, file, onProgress }) => { + // @ts-ignore + const data = new FormData(); + data.append("file", file); + return await request({ + url: action, + method: "post", + headers: { + "Content-Type": "multipart/form-data" + }, + timeout: 60000, + data, + onUploadProgress: (p) => { + onProgress({ percent: Math.round((p.loaded / p.total) * 100) }); + } + }); + }, + successHandle(ret) { + // 上传完成后的结果处理, 此处应返回格式为{url:xxx} + return { + url: "http://www.docmirror.cn:7070" + ret, + key: ret.replace("/api/upload/form/download?key=", "") + }; + } + } + }); + + //安装editor + app.use(FsExtendsEditor, { + //编辑器的公共配置 + wangEditor: {} + }); + app.use(FsExtendsJson); + app.use(FsExtendsTime); + app.use(FsExtendsCopyable); + + // 此处演示自定义字段类型 + const { addTypes } = useTypes(); + addTypes({ + time2: { + //如果与官方字段类型同名,将会覆盖官方的字段类型 + form: { component: { name: "a-date-picker" } }, + column: { component: { name: "fs-date-format", format: "YYYY-MM-DD" } }, + valueBuilder(context) { + console.log("time2,valueBuilder", context); + } + } + }); + + // 此处演示自定义字段合并插件 + const { registerMergeColumnPlugin } = useColumns(); + registerMergeColumnPlugin({ + name: "readonly-plugin", + order: 1, + handle: (columnProps: ColumnCompositionProps) => { + // 你可以在此处做你自己的处理 + // 比如你可以定义一个readonly的公共属性,处理该字段只读,不能编辑 + if (columnProps.readonly) { + // 合并column配置 + _.merge(columnProps, { + form: { show: false }, + viewForm: { show: true } + }); + } + return columnProps; + } + }); +} + +export default { + install +}; diff --git a/packages/ui/certd-client/src/plugin/iconfont/iconfont.js b/packages/ui/certd-client/src/plugin/iconfont/iconfont.js new file mode 100644 index 000000000..357dc3bdd --- /dev/null +++ b/packages/ui/certd-client/src/plugin/iconfont/iconfont.js @@ -0,0 +1 @@ +!function(t){var e,c,o,n,l,a='',i=(i=document.getElementsByTagName("script"))[i.length-1].getAttribute("data-injectcss"),h=function(t,e){e.parentNode.insertBefore(t,e)};if(i&&!t.__iconfont__svg__cssinject__){t.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(t){console&&console.log(t)}}function s(){l||(l=!0,o())}function d(){try{n.documentElement.doScroll("left")}catch(t){return void setTimeout(d,50)}s()}e=function(){var t,e=document.createElement("div");e.innerHTML=a,a=null,(e=e.getElementsByTagName("svg")[0])&&(e.setAttribute("aria-hidden","true"),e.style.position="absolute",e.style.width=0,e.style.height=0,e.style.overflow="hidden",e=e,(t=document.body).firstChild?h(e,t.firstChild):t.appendChild(e))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(e,0):(c=function(){document.removeEventListener("DOMContentLoaded",c,!1),e()},document.addEventListener("DOMContentLoaded",c,!1)):document.attachEvent&&(o=e,n=t.document,l=!1,d(),n.onreadystatechange=function(){"complete"==n.readyState&&(n.onreadystatechange=null,s())})}(window); diff --git a/packages/ui/certd-client/src/plugin/iconfont/index.ts b/packages/ui/certd-client/src/plugin/iconfont/index.ts new file mode 100644 index 000000000..e1f5d7f5b --- /dev/null +++ b/packages/ui/certd-client/src/plugin/iconfont/index.ts @@ -0,0 +1 @@ +import "./iconfont.js" diff --git a/packages/ui/certd-client/src/plugin/iconify/index.ts b/packages/ui/certd-client/src/plugin/iconify/index.ts new file mode 100644 index 000000000..34aacf5ae --- /dev/null +++ b/packages/ui/certd-client/src/plugin/iconify/index.ts @@ -0,0 +1,2 @@ +// import "@iconify/iconify"; +import "@purge-icons/generated"; diff --git a/packages/ui/certd-client/src/plugin/index.ts b/packages/ui/certd-client/src/plugin/index.ts new file mode 100644 index 000000000..4a73280d1 --- /dev/null +++ b/packages/ui/certd-client/src/plugin/index.ts @@ -0,0 +1,12 @@ +import "./iconify"; +import "./iconfont"; +import FastCrud from "./fast-crud"; +import permission from "./permission"; +function install(app, options: any = {}) { + app.use(FastCrud, options); + app.use(permission); +} + +export default { + install +}; diff --git a/packages/ui/certd-client/src/plugin/permission/api.ts b/packages/ui/certd-client/src/plugin/permission/api.ts new file mode 100644 index 000000000..2b9c1ea4c --- /dev/null +++ b/packages/ui/certd-client/src/plugin/permission/api.ts @@ -0,0 +1,10 @@ +import { request } from "/src/api/service"; +export async function getPermissions() { + const ret = await request({ + url: "/sys/authority/user/permissions", + method: "post" + }); + // 如果使用你自己的后端,需要在此处将返回结果改造为本模块需要的结构 + // 结构详情,请参考示例中打印的日志 ”获取权限数据成功:{...}“ (实际上就是“资源管理”页面中列出来的数据) + return ret; +} diff --git a/packages/ui/certd-client/src/plugin/permission/directive/index.js b/packages/ui/certd-client/src/plugin/permission/directive/index.js new file mode 100644 index 000000000..e0e5181f7 --- /dev/null +++ b/packages/ui/certd-client/src/plugin/permission/directive/index.js @@ -0,0 +1,9 @@ +import permission from "./permission"; +import permissionUtil from "../util.permission"; +const install = function (app) { + app.directive("permission", permission); + app.config.globalProperties.$hasPermissions = permissionUtil.hasPermissions; +}; + +permission.install = install; +export default permission; diff --git a/packages/ui/certd-client/src/plugin/permission/directive/permission.js b/packages/ui/certd-client/src/plugin/permission/directive/permission.js new file mode 100644 index 000000000..0b2a95786 --- /dev/null +++ b/packages/ui/certd-client/src/plugin/permission/directive/permission.js @@ -0,0 +1,11 @@ +import permissionUtil from "../util.permission"; +export default { + mounted(el, binding, vnode) { + const { value } = binding; + const hasPermission = permissionUtil.hasPermissions(value); + + if (!hasPermission) { + el.parentNode && el.parentNode.removeChild(el); + } + } +}; diff --git a/packages/ui/certd-client/src/plugin/permission/errors.ts b/packages/ui/certd-client/src/plugin/permission/errors.ts new file mode 100644 index 000000000..6537f4544 --- /dev/null +++ b/packages/ui/certd-client/src/plugin/permission/errors.ts @@ -0,0 +1,5 @@ +export class NoPermissionError extends Error { + constructor(message?: string) { + super(message || "对不起,您没有权限执行此操作"); + } +} diff --git a/packages/ui/certd-client/src/plugin/permission/hook.ts b/packages/ui/certd-client/src/plugin/permission/hook.ts new file mode 100644 index 000000000..af4b0c76a --- /dev/null +++ b/packages/ui/certd-client/src/plugin/permission/hook.ts @@ -0,0 +1,45 @@ +import router from "/src/router"; +import { useUserStore } from "/@/store/modules/user"; +import { usePermissionStore } from "./store.permission"; +import util from "./util.permission"; +import { message } from "ant-design-vue"; +import NProgress from "nprogress"; +export function registerRouterHook() { + // 注册路由beforeEach钩子,在第一次加载路由页面时,加载权限 + router.beforeEach(async (to, from, next) => { + const permissionStore = usePermissionStore(); + if (permissionStore.isInited) { + if (to.meta.permission) { + //校验权限 + // @ts-ignore + if (!util.hasPermissions(to.meta.permission)) { + //没有权限 + message.warn("对不起,您没有权限"); + //throw new Error("对不起,您没有权限"); + NProgress.done(); + return false; + } + } + next(); + return; + } + + const userStore = useUserStore(); + const token = userStore.getToken; + if (!token || token === "undefined") { + next(); + return; + } + + // 初始化权限列表 + try { + console.log("permission is enabled"); + await permissionStore.loadFromRemote(); + console.log("PM load success"); + next({ ...to, replace: true }); + } catch (e) { + console.error("加载动态路由失败", e); + next(); + } + }); +} diff --git a/packages/ui/certd-client/src/plugin/permission/index.ts b/packages/ui/certd-client/src/plugin/permission/index.ts new file mode 100644 index 000000000..c300560a2 --- /dev/null +++ b/packages/ui/certd-client/src/plugin/permission/index.ts @@ -0,0 +1,23 @@ +import permissionDirective from "./directive/index"; +import { registerRouterHook } from "./hook"; +import util from "./util.permission"; +export * from "./use-crud-permission"; +export * from "./errors"; + +export function usePermission() { + return { + ...util + }; +} + +export default { + install(app) { + // 开启权限模块 + // 注册v-permission指令, 用于控制按钮权限 + app.use(permissionDirective); + // 注册路由钩子 + // 通过路由守卫,在登录成功后拦截路由,从后台加载权限数据 + // 然后将权限数据转化为菜单和路由,添加到系统中 + registerRouterHook(); + } +}; diff --git a/packages/ui/certd-client/src/plugin/permission/store.permission.ts b/packages/ui/certd-client/src/plugin/permission/store.permission.ts new file mode 100644 index 000000000..5cbb3305a --- /dev/null +++ b/packages/ui/certd-client/src/plugin/permission/store.permission.ts @@ -0,0 +1,89 @@ +import { defineStore } from "pinia"; +import { useResourceStore } from "/src/store/modules/resource"; +import { getPermissions } from "./api"; +import { mitter } from "/@/utils/util.mitt"; +import { env } from "/@/utils/util.env"; + +//监听注销事件 +mitter.on("app.logout", () => { + const permissionStore = usePermissionStore(); + permissionStore.clear(); +}); + +interface PermissionState { + permissions: []; + inited: boolean; +} + +/** + * 构建权限码列表 + * @param menuTree + * @param permissionList + * @returns {*} + */ +function formatPermissions(menuTree: Array, permissionList = []) { + if (menuTree == null) { + menuTree = []; + } + menuTree.forEach((item: any) => { + if (item.permission) { + // @ts-ignore + permissionList.push(item.permission); + } + if (item.children != null && item.children.length > 0) { + formatPermissions(item.children, permissionList); + } + }); + return permissionList; +} + +export const usePermissionStore = defineStore({ + id: "app.permission", + state: (): PermissionState => ({ + permissions: [], + inited: false + }), + getters: { + getPermissions() { + // @ts-ignore + return this.permissions; + }, + isInited() { + // @ts-ignore + return this.inited; + } + }, + actions: { + init({ permissions }) { + this.permissions = permissions; + this.inited = true; + }, + clear() { + this.permissions = []; + this.inited = false; + }, + resolve(resourceTree) { + const permissions = formatPermissions(resourceTree); + this.init({ permissions }); + + //过滤没有权限的菜单 + const resourceStore = useResourceStore(); + resourceStore.filterByPermission(permissions); + }, + async loadFromRemote() { + let permissionTree = []; + if (env.PM_ENABLED === "false") { + console.warn("当前权限模块未开启,权限列表为空"); + } else { + //开启了权限模块,向后台请求权限列表 + const data = await getPermissions(); + if (data != null) { + permissionTree = data; + } else { + console.warn("当前获取到的权限列表为空"); + } + } + this.resolve(permissionTree); + } + } +}); diff --git a/packages/ui/certd-client/src/plugin/permission/use-crud-permission.ts b/packages/ui/certd-client/src/plugin/permission/use-crud-permission.ts new file mode 100644 index 000000000..2c60f8e2c --- /dev/null +++ b/packages/ui/certd-client/src/plugin/permission/use-crud-permission.ts @@ -0,0 +1,60 @@ +import { usePermission } from "/@/plugin/permission"; +import _ from "lodash-es"; + +/** + * 设置按钮动作权限 + * @param permission {prefix,extra} + */ +export function useCrudPermission({ permission }) { + const { hasPermissions } = usePermission(); + + const prefix = permission instanceof Object ? permission.prefix : permission; + + //根据权限显示按钮 + function hasActionPermission(action) { + if (!prefix) { + return true; + } + return hasPermissions(prefix + ":" + action); + } + + function buildCrudPermission() { + if (permission == null) { + return {}; + } + + let extra = {}; + if (permission instanceof Object) { + extra = permission.extra; + if (permission.extra && permission.extra instanceof Function) { + extra = permission.extra({ hasActionPermission }); + } + } + + return _.merge( + { + actionbar: { + buttons: { + add: { show: hasActionPermission("add") } + } + }, + rowHandle: { + buttons: { + edit: { show: hasActionPermission("edit") }, + remove: { show: hasActionPermission("remove") }, + view: { show: hasActionPermission("view") } + } + } + }, + extra + ); + } + + function merge(userOptions) { + const permissionOptions = buildCrudPermission(); + _.merge(permissionOptions, userOptions); + return permissionOptions; + } + + return { merge, buildCrudPermission, hasActionPermission }; +} diff --git a/packages/ui/certd-client/src/plugin/permission/util.permission.ts b/packages/ui/certd-client/src/plugin/permission/util.permission.ts new file mode 100644 index 000000000..1c197335a --- /dev/null +++ b/packages/ui/certd-client/src/plugin/permission/util.permission.ts @@ -0,0 +1,29 @@ +import { usePermissionStore } from "./store.permission"; +import { NoPermissionError } from "./errors"; +import { message } from "ant-design-vue"; +const util = { + hasPermissions: (value: string | string[]): boolean => { + let need: string[] = []; + if (typeof value === "string") { + need.push(value); + } else if (value && value instanceof Array && value.length > 0) { + need = need.concat(value); + } + if (need.length === 0) { + throw new Error('need permissions! Like "sys:user:view" '); + } + const permissionStore = usePermissionStore(); + const userPermissionList = permissionStore.getPermissions; + return userPermissionList.some((permission) => { + return need.includes(permission); + }); + }, + requirePermissions: (value) => { + if (!util.hasPermissions(value)) { + message.error("对不起,您没有权限执行此操作"); + throw new NoPermissionError(); + } + } +}; + +export default util; diff --git a/packages/ui/certd-client/src/router/index.ts b/packages/ui/certd-client/src/router/index.ts new file mode 100644 index 000000000..72d1aac68 --- /dev/null +++ b/packages/ui/certd-client/src/router/index.ts @@ -0,0 +1,68 @@ +import { createRouter, createWebHashHistory } from "vue-router"; +// 进度条 +import NProgress from "nprogress"; +import "nprogress/nprogress.css"; +import { usePageStore } from "../store/modules/page"; +import { site } from "../utils/util.site"; +import { routes } from "./resolve"; +import { useResourceStore } from "../store/modules/resource"; +import { useUserStore } from "../store/modules/user"; +const router = createRouter({ + history: createWebHashHistory(), + routes +}); + +/** + * 路由拦截 + */ +router.beforeEach(async (to, from, next) => { + // 进度条 + NProgress.start(); + + // 验证当前路由所有的匹配中是否需要有登录验证的 + if ( + to.matched.some((r) => { + return r.meta?.auth || r.meta?.permission; + }) + ) { + const userStore = useUserStore(); + // 这里暂时将cookie里是否存有token作为验证是否登录的条件 + // 请根据自身业务需要修改 + const token = userStore.getToken; + if (token) { + next(); + } else { + // 没有登录的时候跳转到登录界面 + // 携带上登陆成功之后需要跳转的页面完整路径 + next({ + name: "login", + query: { + redirect: to.fullPath + } + }); + // https://github.com/d2-projects/d2-admin/issues/138 + NProgress.done(); + } + } else { + // 不需要身份校验 直接通过 + next(); + } +}); + +router.afterEach((to) => { + // 进度条 + NProgress.done(); + // 多页控制 打开新的页面 + const pageStore = usePageStore(); + pageStore.open(to); + // 更改标题 + site.title(to.meta.title); + + //修改左侧边栏 + const matched = to.matched; + if (matched.length > 0) { + const resourceStore = useResourceStore(); + resourceStore.setAsideMenuByCurrentRoute(matched); + } +}); +export default router; diff --git a/packages/ui/certd-client/src/router/resolve.ts b/packages/ui/certd-client/src/router/resolve.ts new file mode 100644 index 000000000..39cbd9980 --- /dev/null +++ b/packages/ui/certd-client/src/router/resolve.ts @@ -0,0 +1,155 @@ +import LayoutPass from "/src/layout/layout-pass.vue"; +import _ from "lodash-es"; +import { outsideResource } from "./source/outside"; +import { headerResource } from "./source/header"; +import { frameworkResource } from "./source/framework"; +// @ts-ignore +const modules = import.meta.glob("/src/views/**/*.vue"); + +let index = 0; +function transformOneResource(resource) { + let menu: any = null; + if (resource.meta == null) { + resource.meta = {}; + } + const meta = resource.meta; + meta.title = meta.title ?? resource.title ?? "未命名"; + if (resource.title == null) { + resource.title = meta.title; + } + if (meta.isMenu === false) { + menu = null; + } else { + menu = _.cloneDeep(resource); + delete menu.component; + } + let route; + if (resource.type !== "menu") { + if (resource.path == null || resource.path.startsWith("https://") || resource.path.startsWith("http://")) { + //没有route + route = null; + } else { + route = _.cloneDeep(resource); + if (route.component && typeof route.component === "string") { + const path = "/src/views" + route.component; + route.component = modules[path]; + } + if (route.component == null) { + route.component = LayoutPass; + } + } + } + + return { + menu, + route + }; +} + +export const buildMenusAndRouters = (resources) => { + const routes: Array = []; + const menus: Array = []; + for (const item of resources) { + const { menu, route } = transformOneResource(item); + let menuChildren; + let routeChildren; + if (item.children) { + if (item.children.length > 0) { + const ret = buildMenusAndRouters(item.children); + menuChildren = ret.menus; + routeChildren = ret.routes; + } + } + + if (menu) { + menus.push(menu); + menu.children = menuChildren; + } + if (route) { + if (route?.meta?.cache !== false) { + if (route.meta == null) { + route.meta = {}; + } + route.meta.cache = true; + } + routes.push(route); + route.children = routeChildren; + } + } + + setIndex(menus); + return { + routes, + menus + }; +}; + +function setIndex(menus) { + for (const menu of menus) { + menu.index = "index_" + index; + index++; + if (menu.children && menu.children.length > 0) { + setIndex(menu.children); + } + } +} + +function findMenus(menus, condition) { + const list: any = []; + for (const menu of menus) { + if (condition(menu)) { + list.push(menu); + } + if (menu.children && menu.children.length > 0) { + const subList = findMenus(menu.children, condition); + for (const item of subList) { + list.push(item); + } + } + } + return list; +} + +function filterMenus(menus, condition) { + const list = menus.filter((item) => { + return condition(item); + }); + + for (const item of list) { + if (item.children && item.children.length > 0) { + item.children = filterMenus(item.children, condition); + } + } + return list; +} + +function flatChildren(list, children) { + for (const child of children) { + list.push(child); + if (child.children && child.children.length > 0) { + flatChildren(list, child.children); + } + child.children = null; + } +} +function flatSubRouters(routers) { + for (const router of routers) { + const children: Array = []; + if (router.children && router.children.length > 0) { + flatChildren(children, router.children); + } + router.children = children; + } + return routers; +} + +const frameworkRet = buildMenusAndRouters(frameworkResource); +const outsideRet = buildMenusAndRouters(outsideResource); +const headerRet = buildMenusAndRouters(headerResource); + +const outsideRoutes = outsideRet.routes; +const frameworkRoutes = flatSubRouters(frameworkRet.routes); +const routes = [...outsideRoutes, ...frameworkRoutes]; +const frameworkMenus = frameworkRet.menus; +const headerMenus = headerRet.menus; +export { routes, outsideRoutes, frameworkRoutes, frameworkMenus, headerMenus, findMenus, filterMenus }; diff --git a/packages/ui/certd-client/src/router/source/framework.ts b/packages/ui/certd-client/src/router/source/framework.ts new file mode 100644 index 000000000..45366ca2e --- /dev/null +++ b/packages/ui/certd-client/src/router/source/framework.ts @@ -0,0 +1,31 @@ +import LayoutFramework from "/src/layout/layout-framework.vue"; +import { crudResources } from "/@/router/source/modules/crud"; +import { sysResources } from "/@/router/source/modules/sys"; +export const frameworkResource = [ + { + title: "框架", + name: "framework", + path: "/", + redirect: "/index", + component: LayoutFramework, + meta: { + icon: "ion:accessibility" + }, + children: [ + { + title: "首页", + name: "index", + path: "/index", + component: "/framework/home/index.vue", + meta: { + fixedAside: true, + showOnHeader: false, + icon: "ion:home-outline" + } + }, + ...crudResources, + ...sysResources + ] + } +]; +console.assert(frameworkResource.length === 1, "frameworkResource数组长度只能为1,你只能配置framework路由的子路由"); diff --git a/packages/ui/certd-client/src/router/source/header.ts b/packages/ui/certd-client/src/router/source/header.ts new file mode 100644 index 000000000..8c30304ae --- /dev/null +++ b/packages/ui/certd-client/src/router/source/header.ts @@ -0,0 +1,73 @@ +export const headerResource = [ + { + title: "文档", + path: "http://fast-crud.docmirror.cn/" + }, + { + title: "其他Demo", + name: "demo", + children: [ + { + title: "Element版", + path: "http://fast-crud.docmirror.cn/element/" + }, + { + title: "VbenAdmin", + path: "http://fast-crud.docmirror.cn/vben/" + }, + { + title: "cool-admin-vue", + path: "http://fast-crud.docmirror.cn/cool/" + } + ] + }, + + { + title: "源码", + name: "source", + key: "source", + meta: { + icon: "ion:git-branch-outline" + }, + children: [ + { + title: "fast-crud", + children: [ + { + title: "github", + path: "http://github.com/fast-crud/fast-crud", + meta: { + icon: "ion:logo-github" + } + }, + { + title: "gitee", + path: "http://gitee.com/fast-crud/fast-crud", + meta: { + icon: "ion:logo-octocat" + } + } + ] + }, + { + title: "fs-admin", + children: [ + { + title: "github", + path: "http://github.com/fast-crud/fs-admin-antdv", + meta: { + icon: "ion:logo-github" + } + }, + { + title: "gitee", + path: "http://gitee.com/fast-crud/fs-admin-antdv", + meta: { + icon: "ion:logo-octocat" + } + } + ] + } + ] + } +]; diff --git a/packages/ui/certd-client/src/router/source/modules/crud.ts b/packages/ui/certd-client/src/router/source/modules/crud.ts new file mode 100644 index 000000000..226ff916b --- /dev/null +++ b/packages/ui/certd-client/src/router/source/modules/crud.ts @@ -0,0 +1,635 @@ +export const crudResources = [ + { + title: "CRUD示例", + name: "crud", + path: "/crud", + redirect: "/crud/basis", + meta: { + icon: "ion:apps-sharp" + }, + children: [ + { + title: "基本特性", + name: "basis", + path: "/crud/basis", + redirect: "/crud/basis/i18n", + meta: { + icon: "ion:disc-outline" + }, + children: [ + { + title: "HelloWorld", + name: "FsCrudFirst", + path: "/crud/basis/first", + component: "/crud/basis/first/index.vue" + }, + { + title: "动态计算", + name: "BasisCompute", + path: "/crud/basis/compute", + component: "/crud/basis/compute/index.vue" + }, + { + title: "动态计算-更多示例", + name: "BasisComputeMore", + path: "/crud/basis/compute-more", + component: "/crud/basis/compute-more/index.vue" + }, + { + title: "国际化", + name: "BasisI18n", + path: "/crud/basis/i18n", + component: "/crud/basis/i18n/index.vue" + }, + { + title: "ValueChange", + name: "BasisValueChange", + path: "/crud/basis/value-change", + component: "/crud/basis/value-change/index.vue" + }, + { + title: "Card布局", + name: "BasisLayoutCard", + path: "/crud/basis/layout-card", + component: "/crud/basis/layout-card/index.vue" + }, + { + title: "自定义布局", + name: "BasisLayoutCustom", + path: "/crud/basis/layout-custom", + component: "/crud/basis/layout-custom/index.vue" + }, + { + title: "列设置", + name: "BasisColumnsSet", + path: "/crud/basis/columns-set", + component: "/crud/basis/columns-set/index.vue" + }, + { + title: "字段合并插件", + name: "BasisColumnMergePlugin", + path: "/crud/basis/column-merge-plugin", + component: "/crud/basis/column-merge-plugin/index.vue" + } + ] + }, + { + title: "数据字典", + name: "dict", + path: "/crud/dict", + redirect: "/crud/dict/single", + meta: { + icon: "ion:book-outline" + }, + children: [ + { + title: "单例", + name: "DictSingle", + path: "/crud/dict/single", + component: "/crud/dict/single/index.vue" + }, + { + title: "分发复制", + name: "DictCloneable", + path: "/crud/dict/cloneable", + component: "/crud/dict/cloneable/index.vue" + }, + { + title: "原型复制", + name: "DictPrototype", + path: "/crud/dict/prototype", + component: "/crud/dict/prototype/index.vue" + }, + { + title: "页面间共享", + name: "DictShared", + path: "/crud/dict/shared", + children: [ + { + title: "共享字典数据管理", + name: "DictSharedManager", + path: "/crud/dict/shared/manager", + component: "/crud/dict/shared/manager/index.vue" + }, + { + title: "共享字典使用", + name: "DictSharedUse", + path: "/crud/dict/shared/use", + component: "/crud/dict/shared/use/index.vue" + } + ] + } + ] + }, + { + title: "操作列", + name: "row-handle", + path: "/crud/row-handle", + redirect: "/crud/row-handle/tooltip", + meta: { + icon: "ion:build-outline" + }, + children: [ + { + title: "Tooltip", + name: "RowHandleTooltip", + path: "/crud/row-handle/tooltip", + component: "/crud/row-handle/tooltip/index.vue" + }, + { + title: "按钮折叠", + name: "RowHandleDropdown", + path: "/crud/row-handle/dropdown", + component: "/crud/row-handle/dropdown/index.vue" + } + ] + }, + { + title: "组件示例", + name: "component", + path: "/crud/component", + redirect: "/crud/component/text", + meta: { + icon: "ion:cube-outline" + }, + children: [ + { + title: "文本输入(input)", + name: "ComponentText", + path: "/crud/component/text", + component: "/crud/component/text/index.vue" + }, + { + title: "选择(select)", + name: "ComponentSelect", + path: "/crud/component/select", + component: "/crud/component/select/index.vue" + }, + { + title: "级联(cascader)", + name: "ComponentCascader", + path: "/crud/component/cascader", + component: "/crud/component/cascader/index.vue" + }, + { + title: "多选(checkbox)", + name: "ComponentCheckbox", + path: "/crud/component/checkbox", + component: "/crud/component/checkbox/index.vue" + }, + { + title: "单选(radio)", + name: "ComponentRadio", + path: "/crud/component/radio", + component: "/crud/component/radio/index.vue" + }, + { + title: "开关(switch)", + name: "ComponentSwitch", + path: "/crud/component/switch", + component: "/crud/component/switch/index.vue" + }, + { + title: "日期时间(date)", + name: "ComponentDate", + path: "/crud/component/date", + component: "/crud/component/date/index.vue" + }, + { + title: "按钮链接", + name: "ComponentButton", + path: "/crud/component/button", + component: "/crud/component/button/index.vue" + }, + { + title: "数字", + name: "ComponentNumber", + path: "/crud/component/number", + component: "/crud/component/number/index.vue" + }, + { + title: "树形选择", + name: "ComponentTree", + path: "/crud/component/tree", + component: "/crud/component/tree/index.vue" + }, + { + title: "图片裁剪上传", + name: "ComponentUploaderCropper", + path: "/crud/component/uploader/cropper", + component: "/crud/component/uploader/cropper/index.vue" + }, + { + title: "表单本地上传", + name: "ComponentUploaderForm", + path: "/crud/component/uploader/form", + component: "/crud/component/uploader/form/index.vue" + }, + { + title: "阿里云oss上传", + name: "ComponentUploaderAlioss", + path: "/crud/component/uploader/alioss", + component: "/crud/component/uploader/alioss/index.vue" + }, + { + title: "腾讯云cos上传", + name: "ComponentUploaderCos", + path: "/crud/component/uploader/cos", + component: "/crud/component/uploader/cos/index.vue" + }, + { + title: "七牛云上传", + name: "ComponentUploaderQiniu", + path: "/crud/component/uploader/qiniu", + component: "/crud/component/uploader/qiniu/index.vue" + }, + { + title: "富文本编辑器", + name: "ComponentEditor", + path: "/crud/component/editor", + component: "/crud/component/editor/index.vue" + }, + { + title: "图标", + name: "ComponentIcon", + path: "/crud/component/icon", + component: "/crud/component/icon/index.vue" + }, + { + title: "JsonEditor", + name: "ComponentJson", + path: "/crud/component/json", + component: "/crud/component/json/index.vue" + } + ] + }, + { + title: "Form表单", + name: "form", + path: "/crud/form", + redirect: "/crud/form/layout", + meta: { + icon: "ion:document-text-outline" + }, + children: [ + { + title: "基本表单", + name: "FormBase", + path: "/crud/form/base", + component: "/crud/form/base/index.vue" + }, + { + title: "表单Grid布局", + name: "FormLayoutGrid", + path: "/crud/form/layout-grid", + component: "/crud/form/layout-grid/index.vue" + }, + { + title: "表单Flex布局", + name: "FormLayoutFlex", + path: "/crud/form/layout-flex", + component: "/crud/form/layout-flex/index.vue" + }, + { + title: "表单动态布局", + name: "FormLayout", + path: "/crud/form/layout", + component: "/crud/form/layout/index.vue" + }, + { + title: "表单单列模式", + name: "FormSingleColumn", + path: "/crud/form/single-column", + component: "/crud/form/single-column/index.vue" + }, + { + title: "表单校验", + name: "FormValidation", + path: "/crud/form/validation", + component: "/crud/form/validation/index.vue" + }, + { + title: "抽屉表单", + name: "FormDrawer", + path: "/crud/form/drawer", + component: "/crud/form/drawer/index.vue" + }, + { + title: "表单分组", + name: "FormGroup", + path: "/crud/form/group", + component: "/crud/form/group/index.vue" + }, + { + title: "表单分组(tabs)", + name: "FormGroupTabs", + path: "/crud/form/group-tabs", + component: "/crud/form/group-tabs/index.vue" + }, + { + title: "自定义表单", + name: "FormCustomForm", + path: "/crud/form/custom-form", + component: "/crud/form/custom-form/index.vue" + }, + { + title: "字段帮助说明", + name: "FormHelper", + path: "/crud/form/helper", + component: "/crud/form/helper/index.vue" + }, + { + title: "页面内部弹出表单", + name: "FormInner", + path: "/crud/form/inner", + component: "/crud/form/inner/index.vue", + meta: { + cache: true + } + }, + { + title: "地区字典管理", + name: "FormInnerArea", + path: "/crud/form/inner/area", + component: "/crud/form/inner/area/index.vue", + meta: { + isMenu: false + } + }, + { + title: "新页面编辑", + name: "FormNewPage", + path: "/crud/form/new-page", + component: "/crud/form/new-page/index.vue", + meta: { + cache: false + } + }, + { + title: "新页面编辑表单", + name: "FormNewPageEdit", + path: "/crud/form/new-page/edit", + component: "/crud/form/new-page/edit.vue", + meta: { + isMenu: false + } + }, + { + title: "独立使用表单", + name: "FormIndependent", + path: "/crud/form/independent", + component: "/crud/form/independent/index.vue" + }, + { + title: "重置表单", + name: "FormReset", + path: "/crud/form/reset", + component: "/crud/form/reset/index.vue" + }, + { + title: "嵌套数据结构", + name: "FormNest", + path: "/crud/form/nest", + component: "/crud/form/nest/index.vue" + } + ] + }, + { + title: "表格特性", + path: "/crud/feature", + meta: { + icon: "ion:beer-outline" + }, + redirect: "/crud/feature/dropdown", + children: [ + { + title: "部件显隐", + name: "FeatureHide", + path: "/crud/feature/hide", + component: "/crud/feature/hide/index.vue" + }, + { + title: "多选&批量删除", + name: "FeatureSelection", + path: "/crud/feature/selection", + component: "/crud/feature/selection/index.vue" + }, + { + title: "单选", + name: "FeatureSelectionRadio", + path: "/crud/feature/selection-radio", + component: "/crud/feature/selection-radio/index.vue" + }, + { + title: "表头过滤", + name: "FeatureFilter", + path: "/crud/feature/filter", + component: "/crud/feature/filter/index.vue" + }, + { + title: "行展开", + name: "FeatureExpand", + path: "/crud/feature/expand", + component: "/crud/feature/expand/index.vue" + }, + { + title: "树形表格", + name: "FeatureTree", + path: "/crud/feature/tree", + component: "/crud/feature/tree/index.vue" + }, + { + title: "多级表头", + name: "FeatureHeaderGroup", + path: "/crud/feature/header-group", + component: "/crud/feature/header-group/index.vue" + }, + { + title: "合并单元格", + name: "FeatureMerge", + path: "/crud/feature/merge", + component: "/crud/feature/merge/index.vue" + }, + { + title: "序号", + name: "FeatureIndex", + path: "/crud/feature/index", + component: "/crud/feature/index/index.vue" + }, + { + title: "排序", + name: "FeatureSortable", + path: "/crud/feature/sortable", + component: "/crud/feature/sortable/index.vue" + }, + { + title: "固定列", + name: "FeatureFixed", + path: "/crud/feature/fixed", + component: "/crud/feature/fixed/index.vue" + }, + { + title: "不固定高度", + name: "FeatureHeight", + path: "/crud/feature/height", + component: "/crud/feature/height/index.vue" + }, + { + title: "可编辑", + name: "FeatureEditable", + path: "/crud/feature/editable", + component: "/crud/feature/editable/index.vue" + }, + { + title: "行编辑", + name: "FeatureEditableRow", + path: "/crud/feature/editable-row", + component: "/crud/feature/editable-row/index.vue" + }, + { + title: "查询框", + name: "FeatureSearch", + path: "/crud/feature/search", + component: "/crud/feature/search/index.vue" + }, + { + title: "查询框多行模式", + name: "FeatureSearchMulti", + path: "/crud/feature/search-multi", + component: "/crud/feature/search-multi/index.vue" + }, + { + title: "字段排序", + name: "FeatureColumnSort", + path: "/crud/feature/column-sort", + component: "/crud/feature/column-sort/index.vue" + }, + { + title: "ValueBuilder", + name: "FeatureValueBuilder", + path: "/crud/feature/value-builder", + component: "/crud/feature/value-builder/index.vue" + }, + { + title: "列设置", + name: "FeatureColumnsSet", + path: "/crud/feature/columns-set", + component: "/crud/feature/columns-set/index.vue" + }, + { + title: "本地化编辑", + name: "FeatureLocal", + path: "/crud/feature/local", + component: "/crud/feature/local/index.vue" + }, + { + title: "v-model", + name: "FeatureVModel", + path: "/crud/feature/v-model", + component: "/crud/feature/local-v-model/index.vue" + }, + { + title: "自定义删除", + name: "FeatureRemove", + path: "/crud/feature/remove", + component: "/crud/feature/remove/index.vue" + }, + { + title: "调整列宽", + name: "FeatureColumnResize", + path: "/crud/feature/column-resize", + component: "/crud/feature/column-resize/index.vue" + } + ] + }, + { + title: "插槽", + name: "Slots", + path: "/crud/slots", + redirect: "/crud/slots/layout", + meta: { + icon: "ion:extension-puzzle-outline" + }, + children: [ + { + title: "页面占位插槽", + name: "SlotsLayout", + path: "/crud/slots/layout", + component: "/crud/slots/layout/index.vue" + }, + { + title: "表单占位插槽", + name: "SlotsForm", + path: "/crud/slots/form", + component: "/crud/slots/form/index.vue" + }, + { + title: "查询字段插槽", + name: "SlotsSearch", + path: "/crud/slots/search", + component: "/crud/slots/search/index.vue" + }, + { + title: "单元格插槽", + name: "SlotsCell", + path: "/crud/slots/cell", + component: "/crud/slots/cell/index.vue" + }, + { + title: "表单字段插槽", + name: "SlotsFormItem", + path: "/crud/slots/form-item", + component: "/crud/slots/form-item/index.vue" + } + ] + }, + { + title: "复杂需求", + name: "Advanced", + path: "/crud/advanced", + redirect: "/crud/advanced/linkage", + meta: { + icon: "ion:flame-outline" + }, + children: [ + { + title: "选择联动", + name: "AdvancedLinkage", + path: "/crud/advanced/linkage", + component: "/crud/advanced/linkage/index.vue" + }, + { + title: "后台加载crud", + name: "AdvancedFormBackend", + path: "/crud/advanced/from-backend", + component: "/crud/advanced/from-backend/index.vue" + }, + { + title: "本地分页", + name: "AdvancedLocalPagination", + path: "/crud/advanced/local-pagination", + component: "/crud/advanced/local-pagination/index.vue" + }, + { + title: "嵌套子表格", + name: "AdvancedNest", + path: "/crud/advanced/nest", + component: "/crud/advanced/nest/index.vue" + }, + { + title: "对话框中显示crud", + name: "AdvancedInDialog", + path: "/crud/advanced/in-dialog", + component: "/crud/advanced/in-dialog/index.vue" + }, + { + title: "大量数据", + name: "AdvancedBigData", + path: "/crud/advanced/big-data", + component: "/crud/advanced/big-data/index.vue" + } + ] + } + ] + } +]; diff --git a/packages/ui/certd-client/src/router/source/modules/sys.ts b/packages/ui/certd-client/src/router/source/modules/sys.ts new file mode 100644 index 000000000..a2d751271 --- /dev/null +++ b/packages/ui/certd-client/src/router/source/modules/sys.ts @@ -0,0 +1,61 @@ +import LayoutPass from "/@/layout/layout-pass.vue"; + +export const sysResources = [ + { + title: "系统管理", + name: "sys", + path: "/sys", + redirect: "/sys/authority", + component: LayoutPass, + meta: { + icon: "ion:settings-outline", + permission: "sys" + }, + children: [ + { + title: "权限管理", + name: "authority", + path: "/sys/authority", + redirect: "/sys/authority/permission", + meta: { + icon: "ion:ribbon-outline", + //需要校验权限 + permission: "sys:auth" + }, + children: [ + { + title: "权限资源管理", + name: "permission", + meta: { + icon: "ion:list-outline", + //需要校验权限 + permission: "sys:auth:per:view" + }, + path: "/sys/authority/permission", + component: "/sys/authority/permission/index.vue" + }, + { + title: "角色管理", + name: "role", + meta: { + icon: "ion:people-outline", + permission: "sys:auth:role:view" + }, + path: "/sys/authority/role", + component: "/sys/authority/role/index.vue" + } + ] + }, + { + title: "用户管理", + name: "user", + meta: { + icon: "ion:person-outline", + permission: "sys:auth:user:view" + }, + path: "/sys/authority/user", + component: "/sys/authority/user/index.vue" + } + ] + } +]; diff --git a/packages/ui/certd-client/src/router/source/outside.ts b/packages/ui/certd-client/src/router/source/outside.ts new file mode 100644 index 000000000..177172c35 --- /dev/null +++ b/packages/ui/certd-client/src/router/source/outside.ts @@ -0,0 +1,22 @@ +import LayoutOutside from "/src/layout/layout-outside.vue"; +import Error404 from "/src/views/framework/error/404.vue"; +const errorPage = [{ path: "/:pathMatch(.*)*", name: "not-found", component: Error404 }]; +export const outsideResource = [ + { + title: "outside", + name: "outside", + path: "/outside", + component: LayoutOutside, + children: [ + { + meta: { + title: "登录" + }, + name: "login", + path: "/login", + component: "/framework/login/index.vue" + } + ] + }, + ...errorPage +]; diff --git a/packages/ui/certd-client/src/shims-vue.d.ts b/packages/ui/certd-client/src/shims-vue.d.ts new file mode 100644 index 000000000..daba9b9ec --- /dev/null +++ b/packages/ui/certd-client/src/shims-vue.d.ts @@ -0,0 +1,5 @@ +declare module "*.vue" { + import { DefineComponent } from "vue"; + const component: DefineComponent<{}, {}, any>; + export default component; +} diff --git a/packages/ui/certd-client/src/store/index.ts b/packages/ui/certd-client/src/store/index.ts new file mode 100644 index 000000000..52b9cf688 --- /dev/null +++ b/packages/ui/certd-client/src/store/index.ts @@ -0,0 +1,9 @@ +import { createPinia } from "pinia"; +const store = createPinia(); +export default { + install(app) { + app.use(store); + } +}; + +export { store }; diff --git a/packages/ui/certd-client/src/store/modules/page.ts b/packages/ui/certd-client/src/store/modules/page.ts new file mode 100644 index 000000000..8c2d7176d --- /dev/null +++ b/packages/ui/certd-client/src/store/modules/page.ts @@ -0,0 +1,436 @@ +import { defineStore } from "pinia"; +import { cloneDeep, get, uniq } from "lodash-es"; +import router from "/src/router"; +import { frameworkRoutes } from "/src/router/resolve"; +// @ts-ignore +import { LocalStorage } from "/src/utils/util.storage"; +import { useUserStore } from "/src/store/modules/user"; +const OPENED_CACHE_KEY = "TABS_OPENED"; + +interface PageState { + // 可以在多页 tab 模式下显示的页面 + pool: Array; + // 当前显示的多页面列表 + opened: Array; + // 已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201 + openedLoaded: boolean; + // 当前页面 + current: ""; + // 需要缓存的页面 name + keepAlive: Array; + inited: boolean; +} +// 判定是否需要缓存 +const isKeepAlive = (data) => get(data, "meta.cache", false); + +export const usePageStore = defineStore({ + id: "app.page", + state: (): PageState => ({ + // 可以在多页 tab 模式下显示的页面 + pool: [], + // 当前显示的多页面列表 + opened: [ + { + name: "index", + fullPath: "/index", + meta: { + title: "首页", + auth: false + } + } + ], + // 已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201 + openedLoaded: false, + // 当前页面 + current: "", + // 需要缓存的页面 name + keepAlive: [], + inited: false + }), + getters: { + getOpened() { + // @ts-ignore + return this.opened; + }, + getCurrent(): string { + return this.current; + } + }, + actions: { + /** + * @description 确认已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201 + * @param {Object} context + */ + async isLoaded() { + if (this.openedLoaded) { + return true; + } + return new Promise((resolve) => { + const timer = setInterval(() => { + if (this.openedLoaded) { + resolve(clearInterval(timer)); + } + }, 10); + }); + }, + /** + * @class opened + * @description 从持久化数据载入标签页列表 + * @param {Object} context + */ + async openedLoad() { + // store 赋值 + const value = LocalStorage.get(this.getStorageKey()); + if (value == null) { + return; + } + // 在处理函数中进行数据优化 过滤掉现在已经失效的页签或者已经改变了信息的页签 + // 以 fullPath 字段为准 + // 如果页面过多的话可能需要优化算法 + // valid 有效列表 1, 1, 0, 1 => 有效, 有效, 失效, 有效 + const valid: Array = []; + // 处理数据 + this.opened = value + .map((opened) => { + // 忽略首页 + if (opened.fullPath === "/index") { + valid.push(1); + return opened; + } + // 尝试在所有的支持多标签页的页面里找到 name 匹配的页面 + const find = this.pool.find((item) => item.name === opened.name); + // 记录有效或无效信息 + valid.push(find ? 1 : 0); + // 返回合并后的数据 新的覆盖旧的 + // 新的数据中一般不会携带 params 和 query, 所以旧的参数会留存 + return Object.assign({}, opened, find); + }) + .filter((opened, index) => valid[index] === 1); + // 标记已经加载多标签页数据 https://github.com/d2-projects/d2-admin/issues/201 + this.openedLoaded = true; + // 根据 opened 数据生成缓存设置 + this.keepAliveRefresh(); + }, + + getStorageKey() { + const userStore = useUserStore(); + const userId = userStore.getUserInfo?.id ?? "anonymous"; + return OPENED_CACHE_KEY + ":" + userId; + }, + /** + * 将 opened 属性赋值并持久化 在这之前请先确保已经更新了 state.opened + * @param {Object} context + */ + async opened2db() { + // 设置数据 + + LocalStorage.set(this.getStorageKey(), this.opened); + }, + /** + * @class opened + * @description 更新页面列表上的某一项 + * @param {Object} context + * @param {Object} payload { index, params, query, fullPath } 路由信息 + */ + async openedUpdate({ index, params, query, fullPath }) { + // 更新页面列表某一项 + const page = this.opened[index]; + page.params = params || page.params; + page.query = query || page.query; + page.fullPath = fullPath || page.fullPath; + this.opened.splice(index, 1, page); + // 持久化 + await this.opened2db(); + }, + /** + * @class opened + * @description 重排页面列表上的某一项 + * @param {Object} context + * @param {Object} payload { oldIndex, newIndex } 位置信息 + */ + async openedSort({ oldIndex, newIndex }) { + // 重排页面列表某一项 + const page = this.opened[oldIndex]; + this.opened.splice(oldIndex, 1); + this.opened.splice(newIndex, 0, page); + // 持久化 + await this.opened2db(); + }, + /** + * @class opened + * @description 新增一个 tag (打开一个页面) + * @param {Object} context + * @param {Object} payload new tag info + */ + async add({ tag, params, query, fullPath }) { + // 设置新的 tag 在新打开一个以前没打开过的页面时使用 + const newTag = tag; + newTag.params = params || newTag.params; + newTag.query = query || newTag.query; + newTag.fullPath = fullPath || newTag.fullPath; + // 添加进当前显示的页面数组 + this.opened.push(newTag); + // 如果这个页面需要缓存 将其添加到缓存设置 + if (isKeepAlive(newTag)) { + this.keepAlivePush(tag.name); + } + // 持久化 + await this.opened2db(); + }, + /** + * @class current + * @description 打开一个新的页面 + * @param {Object} context + * @param {Object} payload 从路由钩子的 to 对象上获取 { name, params, query, fullPath, meta } 路由信息 + */ + async open({ name, params, query, fullPath, meta }) { + // 已经打开的页面 + const opened = this.opened; + // 判断此页面是否已经打开 并且记录位置 + let pageOpendIndex = 0; + const pageOpend = opened.find((page, index) => { + const same = page.fullPath === fullPath; + pageOpendIndex = same ? index : pageOpendIndex; + return same; + }); + if (pageOpend) { + // 页面以前打开过 + await this.openedUpdate({ + index: pageOpendIndex, + params, + query, + fullPath + }); + } else { + // 页面以前没有打开过 + const page = this.pool.find((t) => t.name === name); + // 如果这里没有找到 page 代表这个路由虽然在框架内 但是不参与标签页显示 + if (page) { + this.add({ + tag: Object.assign({}, page), + params, + query, + fullPath + }); + } + } + // 如果这个页面需要缓存 将其添加到缓存设置 + if (isKeepAlive({ meta })) { + this.keepAlivePush(name); + } + // 设置当前的页面 + this.currentSet(fullPath); + }, + /** + * @class opened + * @description 关闭一个 tag (关闭一个页面) + * @param {Object} context + * @param {Object} payload { tagName: 要关闭的标签名字 } + */ + async close({ tagName }) { + // 预定下个新页面 + let newPage = {}; + const isCurrent = this.current === tagName; + // 如果关闭的页面就是当前显示的页面 + if (isCurrent) { + // 去找一个新的页面 + const len = this.opened.length; + for (let i = 0; i < len; i++) { + if (this.opened[i].fullPath === tagName) { + newPage = i < len - 1 ? this.opened[i + 1] : this.opened[i - 1]; + break; + } + } + } + // 找到这个页面在已经打开的数据里是第几个 + const index = this.opened.findIndex((page) => page.fullPath === tagName); + if (index >= 0) { + // 如果这个页面是缓存的页面 将其在缓存设置中删除 + this.keepAliveRemove(this.opened[index].name); + // 更新数据 删除关闭的页面 + this.opened.splice(index, 1); + } + // 持久化 + await this.opened2db(); + // 决定最后停留的页面 + if (isCurrent) { + // @ts-ignore + const { name = "index", params = {}, query = {} } = newPage; + const routerObj = { name, params, query }; + await router.push(routerObj); + } + }, + /** + * @class opened + * @description 关闭当前标签左边的标签 + * @param opts + */ + async closeLeft(opts = {}) { + await this.closeByCondition({ + condition({ i, currentIndex }) { + return i >= currentIndex; + }, + ...opts + }); + }, + /** + * @class opened + * @description 关闭当前标签右边的标签 + * @param opts + */ + async closeRight(opts = {}) { + await this.closeByCondition({ + condition({ i, currentIndex }) { + return currentIndex >= i; + }, + ...opts + }); + }, + /** + * @class opened + * @description 关闭当前标签右边的标签 + * @param opts + */ + async closeByCondition(opts = {}) { + // @ts-ignore + const { pageSelect, condition } = opts; + const pageAim = pageSelect || this.current; + let currentIndex = 0; + this.opened.forEach((page, index) => { + if (page.fullPath === pageAim) currentIndex = index; + }); + // 删除打开的页面 并在缓存设置中删除 + for (let i = this.opened.length - 1; i >= 0; i--) { + if (this.opened[i].name === "index" || condition({ i, currentIndex })) { + continue; + } + this.keepAliveRemove(this.opened[i].name); + this.opened.splice(i, 1); + } + // 持久化 + await this.opened2db(); + // 设置当前的页面 + this.current = pageAim; + // @ts-ignore + if (router.currentRoute.fullPath !== pageAim) await router.push(pageAim); + }, + /** + * @class opened + * @description 关闭当前激活之外的 tag + * @param opts + */ + async closeOther(opts = {}) { + await this.closeByCondition({ + condition({ i, currentIndex }) { + return currentIndex === i; + }, + ...opts + }); + }, + /** + * @class opened + * @description 关闭所有 tag + * @param {Object} context + */ + async closeAll() { + // 删除打开的页面 并在缓存设置中删除 + for (let i = this.opened.length - 1; i >= 0; i--) { + if (this.opened[i].name === "index") { + continue; + } + + this.keepAliveRemove(this.opened[i].name); + this.opened.splice(i, 1); + } + // 持久化 + await this.opened2db(); + // 关闭所有的标签页后需要判断一次现在是不是在首页 + // @ts-ignore + if (router.currentRoute.name !== "index") { + await router.push({ name: "index" }); + } + }, + /** + * @class keepAlive + * @description 从已经打开的页面记录中更新需要缓存的页面记录 + * @param {Object} state state + */ + keepAliveRefresh() { + this.keepAlive = this.opened.filter((item) => isKeepAlive(item)).map((e) => e.name); + console.log("keep alive:", this.keepAlive); + }, + /** + * @description 删除一个页面的缓存设置 + * @param {Object} state state + * @param {String} name name + */ + keepAliveRemove(name) { + const list = cloneDeep(this.keepAlive); + const index = list.findIndex((item) => item === name); + if (index !== -1) { + list.splice(index, 1); + this.keepAlive = list; + } + }, + /** + * @description 增加一个页面的缓存设置 + * @param {Object} state state + * @param {String} name name + */ + keepAlivePush(name) { + const keep = cloneDeep(this.keepAlive); + keep.push(name); + this.keepAlive = uniq(keep); + }, + /** + * @description 清空页面缓存设置 + * @param {Object} state state + */ + keepAliveClean() { + this.keepAlive = []; + }, + /** + * @class current + * @description 设置当前激活的页面 fullPath + * @param {Object} state state + * @param {String} fullPath new fullPath + */ + currentSet(fullPath) { + this.current = fullPath; + }, + /** + * @class pool + * @description 保存 pool (候选池) + * @param {Object} state state + * @param {Array} routes routes + */ + async init(routes) { + if (this.inited) { + return; + } + this.inited = true; + if (routes == null) { + //不能用全部的routes,只能是framework内的 + routes = frameworkRoutes; + } + + const pool = []; + const push = function (routes) { + routes.forEach((route) => { + if (route.children && route.children.length > 0) { + push(route.children); + } else { + if (!route.hidden) { + const { meta, name, path } = route; + // @ts-ignore + pool.push({ meta, name, path }); + } + } + }); + }; + push(routes); + this.pool = pool; + await this.openedLoad(); + } + } +}); diff --git a/packages/ui/certd-client/src/store/modules/resource.ts b/packages/ui/certd-client/src/store/modules/resource.ts new file mode 100644 index 000000000..33674c972 --- /dev/null +++ b/packages/ui/certd-client/src/store/modules/resource.ts @@ -0,0 +1,127 @@ +import { defineStore } from "pinia"; +// @ts-ignore +import { frameworkMenus, headerMenus, filterMenus, findMenus } from "/src/router/resolve"; +import _ from "lodash-es"; +import { mitter } from "/src/utils/util.mitt"; +//监听注销事件 +mitter.on("app.logout", () => { + const resourceStore = useResourceStore(); + resourceStore.clear(); +}); + +interface ResourceState { + frameworkMenus: Array; + headerMenus: Array; + asideMenus: Array; + fixedAsideMenus: Array; + inited: boolean; + currentAsidePath: string; +} + +export const useResourceStore = defineStore({ + id: "app.resource", + state: (): ResourceState => ({ + // user info + frameworkMenus: [], + headerMenus: [], + asideMenus: [], + fixedAsideMenus: [], + inited: false, + currentAsidePath: "" + }), + getters: { + getAsideMenus() { + return this.asideMenus; + }, + getHeaderMenus() { + return this.headerMenus; + }, + getFrameworkMenus() { + return this.frameworkMenus; + } + }, + actions: { + clear() { + this.inited = false; + }, + /** + * 初始化资源 + */ + init() { + if (this.inited) { + return; + } + this.inited = true; + + const showMenus = _.cloneDeep(frameworkMenus[0].children); + this.frameworkMenus = filterMenus(showMenus, (item) => { + return item?.meta?.showOnHeader !== false; + }); + + this.fixedAsideMenus = findMenus(showMenus, (item) => { + return item?.meta?.fixedAside === true; + }); + this.headerMenus = headerMenus; + this.setAsideMenu(); + }, + setAsideMenu(topMenu?) { + if (this.frameworkMenus.length === 0) { + return; + } + if (topMenu == null) { + topMenu = this.frameworkMenus[0]; + } + const asideMenus = topMenu?.children || []; + this.asideMenus = [...this.fixedAsideMenus, ...asideMenus]; + }, + setAsideMenuByCurrentRoute(matched) { + const menuHeader = this.frameworkMenus; + if (matched?.length <= 1) { + return; + } + + function findFromTree(tree, find) { + const results: Array = []; + for (const item of tree) { + if (find(item)) { + results.push(item); + return results; + } + if (item.children && item.children.length > 0) { + const found = findFromTree(item.children, find); + if (found) { + results.push(item); + return results.concat(found); + } + } + } + } + const matchedPath = matched[1].path; + const _side = findFromTree(menuHeader, (menu) => menu.path === matchedPath); + if (_side?.length > 0) { + if (this.currentAsidePath === _side[0]) { + return; + } + this.currentAsidePath = _side[0]; + this.setAsideMenu(_side[0]); + } + }, + filterByPermission(permissions) { + this.frameworkMenus = this.filterChildrenByPermission(this.frameworkMenus, permissions); + }, + filterChildrenByPermission(list, permissions) { + const menus = list.filter((item) => { + if (item?.meta?.permission) { + return permissions.includes(item.meta.permission); + } + return true; + }); + for (const menu of menus) { + if (menu.children && menu.children.length > 0) { + menu.children = this.filterChildrenByPermission(menu.children, permissions); + } + } + return menus; + } + } +}); diff --git a/packages/ui/certd-client/src/store/modules/settings.ts b/packages/ui/certd-client/src/store/modules/settings.ts new file mode 100644 index 000000000..c5fc0446c --- /dev/null +++ b/packages/ui/certd-client/src/store/modules/settings.ts @@ -0,0 +1,63 @@ +import { defineStore } from "pinia"; +// @ts-ignore +import { LocalStorage } from "/src/utils/util.storage"; +// import { replaceStyleVariables } from "vite-plugin-theme/es/client"; + +// import { getThemeColors, generateColors } from "/src/../build/theme-colors"; +// +// import { mixLighten, mixDarken, tinycolor } from "vite-plugin-theme/es/colorUtils"; + +// export async function changeTheme(color?: string) { +// if (color == null) { +// return; +// } +// const colors = generateColors({ +// mixDarken, +// mixLighten, +// tinycolor, +// color +// }); +// +// return await replaceStyleVariables({ +// colorVariables: [...getThemeColors(color), ...colors] +// }); +// } + +interface SettingState { + theme: any; +} + +const SETTING_THEME_KEY = "SETTING_THEME"; +export const useSettingStore = defineStore({ + id: "app.setting", + state: (): SettingState => ({ + // user info + theme: null + }), + getters: { + getTheme(): any { + return this.theme || LocalStorage.get(SETTING_THEME_KEY) || {}; + } + }, + actions: { + persistTheme() { + LocalStorage.set(SETTING_THEME_KEY, this.getTheme); + }, + async setTheme(theme?: Object) { + if (theme == null) { + theme = this.getTheme; + } + this.theme = theme; + this.persistTheme(); + // await changeTheme(this.theme.primaryColor); + }, + async setPrimaryColor(color) { + const theme = this.theme; + theme.primaryColor = color; + await this.setTheme(); + }, + async init() { + await this.setTheme(this.getTheme); + } + } +}); diff --git a/packages/ui/certd-client/src/store/modules/user.ts b/packages/ui/certd-client/src/store/modules/user.ts new file mode 100644 index 000000000..45ed7b29b --- /dev/null +++ b/packages/ui/certd-client/src/store/modules/user.ts @@ -0,0 +1,106 @@ +import { defineStore } from "pinia"; +import { store } from "../index"; +import router from "../../router"; +// @ts-ignore +import { LocalStorage } from "/src/utils/util.storage"; +// @ts-ignore +import * as UserApi from "/src/api/modules/api.user"; +// @ts-ignore +import { LoginReq, UserInfoRes } from "/@/api/modules/api.user"; +import { Modal } from "ant-design-vue"; +import { useI18n } from "vue-i18n"; + +import { mitter } from "/src/utils/util.mitt"; + +interface UserState { + userInfo: Nullable; + token?: string; +} + +const USER_INFO_KEY = "USER_INFO"; +const TOKEN_KEY = "TOKEN"; +export const useUserStore = defineStore({ + id: "app.user", + state: (): UserState => ({ + // user info + userInfo: null, + // token + token: undefined + }), + getters: { + getUserInfo(): UserInfoRes { + return this.userInfo || LocalStorage.get(USER_INFO_KEY) || {}; + }, + getToken(): string { + return this.token || LocalStorage.get(TOKEN_KEY); + } + }, + actions: { + setToken(info: string, expire: number) { + this.token = info; + LocalStorage.set(TOKEN_KEY, this.token, expire); + }, + setUserInfo(info: UserInfoRes) { + this.userInfo = info; + LocalStorage.set(USER_INFO_KEY, info); + }, + resetState() { + this.userInfo = null; + this.token = ""; + LocalStorage.remove(TOKEN_KEY); + LocalStorage.remove(USER_INFO_KEY); + }, + /** + * @description: login + */ + async login(params: LoginReq): Promise { + try { + const data = await UserApi.login(params); + const { token, expire } = data; + + // save token + this.setToken(token, expire); + // get user info + const userInfo = await this.getUserInfoAction(); + await router.replace("/"); + mitter.emit("app.login", { userInfo, token: data }); + return userInfo; + } catch (error) { + return null; + } + }, + async getUserInfoAction(): Promise { + const userInfo = await UserApi.mine(); + this.setUserInfo(userInfo); + return userInfo; + }, + /** + * @description: logout + */ + logout(goLogin = true) { + this.resetState(); + goLogin && router.push("/login"); + mitter.emit("app.logout"); + }, + + /** + * @description: Confirm before logging out + */ + confirmLoginOut() { + const { t } = useI18n(); + Modal.config({ + iconType: "warning", + title: t("app.login.logoutTip"), + content: t("app.login.logoutMessage"), + onOk: async () => { + await this.logout(true); + } + }); + } + } +}); + +// Need to be used outside the setup +export function useUserStoreWidthOut() { + return useUserStore(store); +} diff --git a/packages/ui/certd-client/src/style.css b/packages/ui/certd-client/src/style.css new file mode 100644 index 000000000..211ee80a8 --- /dev/null +++ b/packages/ui/certd-client/src/style.css @@ -0,0 +1 @@ +/*占位,勿删*/ diff --git a/packages/ui/certd-client/src/style/common.less b/packages/ui/certd-client/src/style/common.less new file mode 100644 index 000000000..fb8b3b353 --- /dev/null +++ b/packages/ui/certd-client/src/style/common.less @@ -0,0 +1,44 @@ +@import './theme/index.less'; +@import './theme/default.less'; +@import './scroll.less'; +@import './transition.less'; +@import './fix-windicss.less'; + +html, body { + margin: 0; + padding: 0; + height: 100%; + width: 100%; + box-sizing: border-box; +} + +div#app { + height: 100% +} + +h1, h2, h3, h4, h5, h6 { + margin-bottom: 0; +} + +.fs-desc{ + font-size: 12px; + color:#888888; + margin-left: 5px; + margin-right: 5px; +} + + + +.ant-btn-link { + height: 24px; +} + + +.ant-input-affix-wrapper { + padding: 4px 11px; +} + + +.anticon { + vertical-align: 0 !important; +} diff --git a/packages/ui/certd-client/src/style/fix-windicss.less b/packages/ui/certd-client/src/style/fix-windicss.less new file mode 100644 index 000000000..c4e284ecc --- /dev/null +++ b/packages/ui/certd-client/src/style/fix-windicss.less @@ -0,0 +1,3 @@ +img.ant-image-preview-img{ + display: initial; +} diff --git a/packages/ui/certd-client/src/style/scroll.less b/packages/ui/certd-client/src/style/scroll.less new file mode 100644 index 000000000..67b7a33ab --- /dev/null +++ b/packages/ui/certd-client/src/style/scroll.less @@ -0,0 +1,28 @@ +::-webkit-scrollbar { + width: 8px; + height: 8px; +} + +::-webkit-scrollbar-track { + width: 8px; + background: rgba(#101F1C, 0.1); + -webkit-border-radius: 2em; + -moz-border-radius: 2em; + border-radius: 2em; +} + +::-webkit-scrollbar-thumb { + // background-color: rgba(#101F1C, 0.5); + background-clip: padding-box; + min-height: 28px; + -webkit-border-radius: 2em; + -moz-border-radius: 2em; + border-radius: 2em; + background-color: #b3b3b3; + box-shadow: 0px 1px 1px #eee inset; +} + +::-webkit-scrollbar-thumb:hover { + + //background-color: rgba(#101F1C, 1); +} diff --git a/packages/ui/certd-client/src/style/theme/default.less b/packages/ui/certd-client/src/style/theme/default.less new file mode 100644 index 000000000..9b91b3456 --- /dev/null +++ b/packages/ui/certd-client/src/style/theme/default.less @@ -0,0 +1,27 @@ +.ant-layout{ + background-color: @bg-color; +} +.ant-layout-header { + background-color: @bg-color +} +.ant-layout-sider { + background-color:@bg-color +} +.ant-menu{ + background-color: @bg-color; + &.ant-menu-submenu-popup{ + background-color: transparent; + } +} +.aside-menu{ + .ant-menu-submenu > .ant-menu{ + background-color:@bg-color + } + + .ant-menu-item-active{ + background-color: @bg-menu-item-color; + } + .ant-menu-item-selected{ + background-color: @bg-menu-item-color !important; + } +} diff --git a/packages/ui/certd-client/src/style/theme/index.less b/packages/ui/certd-client/src/style/theme/index.less new file mode 100644 index 000000000..d83434fcf --- /dev/null +++ b/packages/ui/certd-client/src/style/theme/index.less @@ -0,0 +1,4 @@ +@primary-color: #1890ff; +// theme +@bg-color: #ebf1f6; +@bg-menu-item-color:hsla(0,0%,100%,.5); diff --git a/packages/ui/certd-client/src/style/transition.less b/packages/ui/certd-client/src/style/transition.less new file mode 100644 index 000000000..8ab0a2698 --- /dev/null +++ b/packages/ui/certd-client/src/style/transition.less @@ -0,0 +1,36 @@ +//.v-enter-from, +//.v-leave-to { +// opacity: 0; +//} +// +//.v-leave-from, +//.v-enter-to { +// opacity: 1; +//} +// 过渡动画 横向渐变 +.fade-transverse-leave-active, +.fade-transverse-enter-active { + transition: all .5s; +} +.fade-transverse-enter-from { + opacity: 0; + transform: translateX(-30px); +} +.fade-transverse-leave-to { + opacity: 0; + transform: translateX(30px); +} + +// 过渡动画 缩放渐变 +.fade-scale-leave-active, +.fade-scale-enter-active { + transition: all .3s; +} +.fade-scale-enter { + opacity: 0; + transform: scale(1.2); +} +.fade-scale-leave-to { + opacity: 0; + transform: scale(0.8); +} diff --git a/packages/ui/certd-client/src/types/global.d.ts b/packages/ui/certd-client/src/types/global.d.ts new file mode 100644 index 000000000..d40bbd681 --- /dev/null +++ b/packages/ui/certd-client/src/types/global.d.ts @@ -0,0 +1,99 @@ +import type { + ComponentRenderProxy, + VNode, + ComponentPublicInstance, + FunctionalComponent, + PropType as VuePropType, +} from 'vue'; + +declare global { + const __APP_INFO__: { + pkg: { + name: string; + version: string; + dependencies: Recordable; + devDependencies: Recordable; + }; + lastBuildTime: string; + }; + declare interface Window { + // Global vue app instance + __APP__: App; + } + + // vue + declare type PropType = VuePropType; + + export type Writable = { + -readonly [P in keyof T]: T[P]; + }; + + declare type Nullable = T | null; + declare type NonNullable = T extends null | undefined ? never : T; + declare type Recordable = Record; + declare type ReadonlyRecordable = { + readonly [key: string]: T; + }; + declare type Indexable = { + [key: string]: T; + }; + declare type DeepPartial = { + [P in keyof T]?: DeepPartial; + }; + declare type TimeoutHandle = ReturnType; + declare type IntervalHandle = ReturnType; + + declare interface ChangeEvent extends Event { + target: HTMLInputElement; + } + + declare interface WheelEvent { + path?: EventTarget[]; + } + interface ImportMetaEnv extends ViteEnv { + __: unknown; + } + + declare interface ViteEnv { + VITE_PORT: number; + VITE_USE_MOCK: boolean; + VITE_USE_PWA: boolean; + VITE_PUBLIC_PATH: string; + VITE_PROXY: [string, string][]; + VITE_GLOB_APP_TITLE: string; + VITE_GLOB_APP_SHORT_NAME: string; + VITE_USE_CDN: boolean; + VITE_DROP_CONSOLE: boolean; + VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none'; + VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean; + VITE_LEGACY: boolean; + VITE_USE_IMAGEMIN: boolean; + VITE_GENERATE_UI: string; + } + + declare function parseInt(s: string | number, radix?: number): number; + + declare function parseFloat(string: string | number): number; + + namespace JSX { + // tslint:disable no-empty-interface + type Element = VNode; + // tslint:disable no-empty-interface + type ElementClass = ComponentRenderProxy; + interface ElementAttributesProperty { + $props: any; + } + interface IntrinsicElements { + [elem: string]: any; + } + interface IntrinsicAttributes { + [elem: string]: any; + } + } +} + +declare module 'vue' { + export type JSXComponent = + | { new (): ComponentPublicInstance } + | FunctionalComponent; +} diff --git a/packages/ui/certd-client/src/utils/index.ts b/packages/ui/certd-client/src/utils/index.ts new file mode 100644 index 000000000..7e3f9afef --- /dev/null +++ b/packages/ui/certd-client/src/utils/index.ts @@ -0,0 +1,12 @@ +import * as envs from "./util.env"; +import * as sites from "./util.site"; +import * as storages from "./util.storage"; +import * as commons from "./util.common"; +import * as mitt from "./util.mitt"; +export const util = { + ...envs, + ...sites, + ...storages, + ...commons, + ...mitt +}; diff --git a/packages/ui/certd-client/src/utils/util.common.ts b/packages/ui/certd-client/src/utils/util.common.ts new file mode 100644 index 000000000..ca20b8c30 --- /dev/null +++ b/packages/ui/certd-client/src/utils/util.common.ts @@ -0,0 +1,33 @@ +import _ from "lodash-es"; +export default { + arrayToMap(array) { + if (!array) { + return {}; + } + if (!_.isArray(array)) { + return array; + } + const map = {}; + for (const item of array) { + if (item.key) { + map[item.key] = item; + } + } + return map; + }, + mapToArray(map) { + if (!map) { + return []; + } + if (_.isArray(map)) { + return map; + } + const array: any = []; + for (const key in map) { + const item = map[key]; + item.key = key; + array.push(item); + } + return array; + } +}; diff --git a/packages/ui/certd-client/src/utils/util.env.ts b/packages/ui/certd-client/src/utils/util.env.ts new file mode 100644 index 000000000..d87db9091 --- /dev/null +++ b/packages/ui/certd-client/src/utils/util.env.ts @@ -0,0 +1,40 @@ +import _ from "lodash-es"; +export function getEnvValue(key) { + // @ts-ignore + return import.meta.env["VITE_APP_" + key]; +} + +export class EnvConfig { + API; + MODE; + STORAGE; + TITLE; + PM_ENABLED; + constructor() { + this.init(); + } + + init() { + // @ts-ignore + _.forEach(import.meta.env, (value, key) => { + if (key.startsWith("VITE_APP")) { + key = key.replace("VITE_APP_", ""); + this[key] = value; + } + }); + // @ts-ignore + this.MODE = import.meta.env.MODE; + } + + get(key, defaultValue) { + return this[key] ?? defaultValue; + } + isDev() { + return this.MODE === "development" || this.MODE === "debug"; + } + isProd() { + return this.MODE === "production"; + } +} + +export const env = new EnvConfig(); diff --git a/packages/ui/certd-client/src/utils/util.mitt.ts b/packages/ui/certd-client/src/utils/util.mitt.ts new file mode 100644 index 000000000..be0f064f4 --- /dev/null +++ b/packages/ui/certd-client/src/utils/util.mitt.ts @@ -0,0 +1,2 @@ +import mitt from "mitt"; +export const mitter = mitt(); diff --git a/packages/ui/certd-client/src/utils/util.site.ts b/packages/ui/certd-client/src/utils/util.site.ts new file mode 100644 index 000000000..6305d396c --- /dev/null +++ b/packages/ui/certd-client/src/utils/util.site.ts @@ -0,0 +1,11 @@ +import { env } from "./util.env"; +export const site = { + /** + * @description 更新标题 + * @param {String} title 标题 + */ + title: function (titleText) { + const processTitle = env.TITLE || "FsAdmin"; + window.document.title = `${processTitle}${titleText ? ` | ${titleText}` : ""}`; + } +}; diff --git a/packages/ui/certd-client/src/utils/util.storage.ts b/packages/ui/certd-client/src/utils/util.storage.ts new file mode 100644 index 000000000..b9342da67 --- /dev/null +++ b/packages/ui/certd-client/src/utils/util.storage.ts @@ -0,0 +1,113 @@ +import { env } from "./util.env"; +function isNullOrUnDef(value) { + return value == null; +} +const DEFAULT_CACHE_TIME = 60 * 60 * 24 * 7; +export interface CreateStorageParams { + prefixKey: string; + storage: Storage; + timeout?: number; +} + +/** + *Cache class + *Construction parameters can be passed into sessionStorage, localStorage, + * @class Cache + * @example + */ +export class WebStorage { + private storage: Storage; + private prefixKey?: string; + private timeout?: number; + /** + * + * @param option + */ + constructor(option: Partial) { + this.storage = option.storage ?? localStorage; + this.prefixKey = option.prefixKey ?? getStorageShortName(); + this.timeout = option.timeout ?? DEFAULT_CACHE_TIME; + } + + private getKey(key: string) { + return `${this.prefixKey}${key}`.toUpperCase(); + } + + /** + * + * Set cache + * @param {string} key + * @param {*} value + * @param expire + * @expire Expiration time in seconds + * @memberof Cache + */ + set(key: string, value: any, expire: number | undefined = this.timeout) { + const stringData = JSON.stringify({ + value, + time: Date.now(), + expire: expire != null ? new Date().getTime() + expire * 1000 : null + }); + this.storage.setItem(this.getKey(key), stringData); + } + + /** + *Read cache + * @param {string} key + * @param def + * @memberof Cache + */ + get(key: string, def: any = null): any { + const val = this.storage.getItem(this.getKey(key)); + if (!val) return def; + + try { + const data = JSON.parse(val); + const { value, expire } = data; + if (isNullOrUnDef(expire) || expire >= new Date().getTime()) { + return value; + } + this.remove(key); + } catch (e) { + return def; + } + } + + /** + * Delete cache based on key + * @param {string} key + * @memberof Cache + */ + remove(key: string) { + this.storage.removeItem(this.getKey(key)); + } + + /** + * Delete all caches of this instance + */ + clear(): void { + this.storage.clear(); + } +} +export const createStorage = (option: Partial = {}): WebStorage => { + return new WebStorage(option); +}; + +export type Options = Partial; + +function getStorageShortName() { + return env.MODE + "_" + env.get("STORAGE", "certd") + "_"; +} + +export const createSessionStorage = (options: Options = {}): WebStorage => { + return createStorage({ storage: sessionStorage, ...options }); +}; + +export const createLocalStorage = (options: Options = {}): WebStorage => { + return createStorage({ storage: localStorage, timeout: DEFAULT_CACHE_TIME, ...options }); +}; + +export const SessionStorage = createSessionStorage(); +export const LocalStorage = createLocalStorage(); + +export default WebStorage; diff --git a/packages/ui/certd-client/src/views/crud/advanced/big-data/api.js b/packages/ui/certd-client/src/views/crud/advanced/big-data/api.js new file mode 100644 index 000000000..a2e187ae2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/big-data/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/AdvancedBigData"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/big-data/crud.jsx b/packages/ui/certd-client/src/views/crud/advanced/big-data/crud.jsx new file mode 100644 index 000000000..d66f65d81 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/big-data/crud.jsx @@ -0,0 +1,170 @@ +import * as api from "./api"; +import { message } from "ant-design-vue"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + output: {}, + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + scroll: { + //启用横向滚动条,设置一个大于所有列宽之和的值,一般大于表格宽度 + x: 2400 + } + }, + pagination: { + pageSize: 100 + }, + rowHandle: { + fixed: "right" + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + text: { + title: "文本", + type: "text" + }, + dict1: { + title: "字典1", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict1" + }) + }, + dict2: { + title: "字典2", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict2" + }) + }, + dict3: { + title: "字典3", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict3" + }) + }, + dict4: { + title: "字典4", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict4" + }) + }, + dict5: { + title: "字典5", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict5" + }) + }, + dict6: { + title: "字典6", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict6" + }) + }, + dict7: { + title: "字典7", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict7" + }) + }, + dict8: { + title: "字典8", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict8" + }) + }, + dict9: { + title: "字典9", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict9" + }) + }, + dict10: { + title: "字典10", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?from=dict10" + }) + }, + text1: { + title: "文本", + type: "text" + }, + text2: { + title: "文本", + type: "text" + }, + text3: { + title: "文本", + type: "text" + }, + text4: { + title: "文本", + type: "text" + }, + text5: { + title: "文本", + type: "text" + }, + text6: { + title: "文本", + type: "text" + }, + text7: { + title: "文本", + type: "text" + }, + text8: { + title: "文本", + type: "text" + }, + text9: { + title: "文本", + type: "text" + }, + text10: { + title: "文本", + type: "text" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/big-data/index.vue b/packages/ui/certd-client/src/views/crud/advanced/big-data/index.vue new file mode 100644 index 000000000..91a4914c0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/big-data/index.vue @@ -0,0 +1,43 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/advanced/big-data/mock.js b/packages/ui/certd-client/src/views/crud/advanced/big-data/mock.js new file mode 100644 index 000000000..a166ac9d3 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/big-data/mock.js @@ -0,0 +1,126 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "AdvancedBigData", + idGenerator: 0, + copyTimes: 1000 +}; +const list = [ + { + text: "测试文本", + dict1: "1", + dict2: "1", + dict3: "2", + dict4: "1", + dict5: "2", + dict6: "1", + dict7: "1", + dict8: "1", + text1: "测试文本1", + text2: "测试文本2", + text3: "测试文本3", + text4: "测试文本4", + text5: "测试文本5", + text6: "测试文本6", + text7: "测试文本7", + text8: "测试文本8", + dict9: "2", + dict10: "1", + dict11: "2", + dict12: "1" + }, + { + text: "测试文本", + dict1: "1", + dict2: "1", + dict3: "2", + dict4: "1", + dict5: "2", + dict6: "1", + dict7: "1", + dict8: "1", + text1: "测试文本1", + text2: "测试文本2", + text3: "测试文本3", + text4: "测试文本4", + text5: "测试文本5", + text6: "测试文本6", + text7: "测试文本7", + text8: "测试文本8", + dict9: "2", + dict10: "1", + dict11: "2", + dict12: "1" + }, + { + text: "测试文本", + dict1: "1", + dict2: "1", + dict3: "2", + dict4: "1", + dict5: "2", + dict6: "1", + dict7: "1", + dict8: "1", + text1: "测试文本1", + text2: "测试文本2", + text3: "测试文本3", + text4: "测试文本4", + text5: "测试文本5", + text6: "测试文本6", + text7: "测试文本7", + text8: "测试文本8", + dict9: "2", + dict10: "1", + dict11: "2", + dict12: "1" + }, + { + text: "测试文本", + dict1: "1", + dict2: "1", + dict3: "2", + dict4: "1", + dict5: "2", + dict6: "1", + dict7: "1", + dict8: "1", + text1: "测试文本1", + text2: "测试文本2", + text3: "测试文本3", + text4: "测试文本4", + text5: "测试文本5", + text6: "测试文本6", + text7: "测试文本7", + text8: "测试文本8", + dict9: "2", + dict10: "1", + dict11: "2", + dict12: "1" + }, + { + text: "测试文本", + dict1: "1", + dict2: "1", + dict3: "2", + dict4: "1", + dict5: "2", + dict6: "1", + dict7: "1", + dict8: "1", + text1: "测试文本1", + text2: "测试文本2", + text3: "测试文本3", + text4: "测试文本4", + text5: "测试文本5", + text6: "测试文本6", + text7: "测试文本7", + text8: "测试文本8", + dict9: "2", + dict10: "1", + dict11: "2", + dict12: "1" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/advanced/from-backend/api.js b/packages/ui/certd-client/src/views/crud/advanced/from-backend/api.js new file mode 100644 index 000000000..ae38d2931 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/from-backend/api.js @@ -0,0 +1,48 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/AdvancedFromBackend"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} +export function GetCrud() { + return request({ + url: apiPrefix + "/crud", + method: "get" + }); +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/from-backend/crud-backend.js b/packages/ui/certd-client/src/views/crud/advanced/from-backend/crud-backend.js new file mode 100644 index 000000000..abcf8ef11 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/from-backend/crud-backend.js @@ -0,0 +1,29 @@ +export const crudOptions = ` + ({expose,dict}) => { + return { + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } +} + + +`; diff --git a/packages/ui/certd-client/src/views/crud/advanced/from-backend/crud.jsx b/packages/ui/certd-client/src/views/crud/advanced/from-backend/crud.jsx new file mode 100644 index 000000000..a577b88d8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/from-backend/crud.jsx @@ -0,0 +1,27 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/from-backend/index.vue b/packages/ui/certd-client/src/views/crud/advanced/from-backend/index.vue new file mode 100644 index 000000000..bec759306 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/from-backend/index.vue @@ -0,0 +1,45 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/advanced/from-backend/mock.js b/packages/ui/certd-client/src/views/crud/advanced/from-backend/mock.js new file mode 100644 index 000000000..2f802d45d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/from-backend/mock.js @@ -0,0 +1,35 @@ +import mockUtil from "/src/mock/base"; +import { crudOptions } from "./crud-backend"; +const options = { + name: "AdvancedFromBackend", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); + +mock.push({ + path: "/AdvancedFromBackend/crud", + method: "get", + handle(req) { + return { + code: 0, + msg: "success", + data: crudOptions + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/api.js b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/api.js new file mode 100644 index 000000000..236e922ac --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/AdvancedInDialog"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/crud.jsx b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/crud.jsx new file mode 100644 index 000000000..cde2c0c2f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/crud.jsx @@ -0,0 +1,106 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + name: { + title: "姓名", + type: "text", //虽然不写也能正确显示组件,但不建议省略它 + search: { show: true }, + form: { + component: { + maxlength: 20 + } + } + }, + search: { + title: "搜索", + type: "text", + form: { + component: { + addonAfter: "后置", + suffix: "suffix", + children: { + addonBefore() { + return ; + } + } + } + } + }, + password: { + title: "密码", + type: "password", + column: { + //一般密码不显示在列里面 + show: false + } + }, + intro: { + title: "简介", + type: "textarea", + form: { + component: { showWordLimit: true, maxlength: 200 } + }, + column: { + ellipsis: true + } + }, + render: { + title: "复杂输入(render)", + form: { + title: "复杂输入", + component: { + render(context) { + console.log("context scope", context); + return ( + + + + + ); + } + } + } + }, + render2: { + title: "我的值是由复杂输入列输入的", + column: { + width: "300px" + }, + form: { + show: false + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/index.vue b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/index.vue new file mode 100644 index 000000000..5b3591efe --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/mock.js b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/mock.js new file mode 100644 index 000000000..31a5c5618 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/crud/mock.js @@ -0,0 +1,40 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "AdvancedInDialog", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + date: "2016-05-02", + status: "0", + province: "1", + avatar: "https://alicdn.antdv.com/vue.png", + show: true, + city: "sz", + address: "123123", + zip: "518000", + intro: "王小虎是element-plus的table示例出现的名字" + }, + { + name: "张三", + date: "2016-05-04", + status: "1", + province: "2" + }, + { + name: "李四", + date: 2232433534511, + status: "1", + province: "0" + }, + { + name: "王五", + date: "2016-05-03", + status: "2", + province: "wh,gz" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/advanced/in-dialog/index.vue b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/index.vue new file mode 100644 index 000000000..64ac77137 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/in-dialog/index.vue @@ -0,0 +1,37 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/advanced/linkage/api.js b/packages/ui/certd-client/src/views/crud/advanced/linkage/api.js new file mode 100644 index 000000000..bbc69cc2f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/linkage/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormLinkage"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/linkage/crud.jsx b/packages/ui/certd-client/src/views/crud/advanced/linkage/crud.jsx new file mode 100644 index 000000000..6fe185407 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/linkage/crud.jsx @@ -0,0 +1,118 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + rowHandle: { + align: "center" + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + province: { + title: "省", + type: "dict-select", + search: { + show: true + }, + dict: dict({ + url: "/mock/linkage/province", + value: "id", + cache: true + }), + form: { + valueChange({ form, value, getComponentRef }) { + form.city = undefined; // 将“city”的值置空 + form.county = undefined; // 将“county”的值置空 + if (value) { + getComponentRef("city").reloadDict(); // 执行city的select组件的reloadDict()方法,触发“city”重新加载字典 + } + } + } + }, + city: { + title: "市", + type: "dict-select", + search: { + show: true + }, + dict: dict({ + cache: true, + prototype: true, + // url() 改成构建url,返回一个url + url({ form }) { + if (form && form.province != null) { + // 本数据字典的url是通过前一个select的选项决定的 + return `/mock/linkage/city?province=${form.province}`; + } + return undefined; // 返回undefined 将不加载字典 + }, + value: "id" + }), + form: { + // 注释同上 + valueChange({ value, form, getComponentRef }) { + if (value) { + form.county = undefined; // 将county的value置空 + const countySelect = getComponentRef("county"); + if (form && form.province && form.city) { + countySelect.reloadDict(); // 重新加载字典项 + } else { + countySelect.clearDict(); // 清空选项 + } + } + } + } + }, + county: { + title: "区", + type: "dict-select", + search: { + show: true + }, + dict: dict({ + value: "id", + cache: true, + prototype: true, + url({ form }) { + if (form && form.province != null && form.city != null) { + return `/mock/linkage/county?province=${form.province} &city=${form.city}`; + } + return undefined; + } + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/linkage/index.vue b/packages/ui/certd-client/src/views/crud/advanced/linkage/index.vue new file mode 100644 index 000000000..48faf05b2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/linkage/index.vue @@ -0,0 +1,38 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/advanced/linkage/mock.js b/packages/ui/certd-client/src/views/crud/advanced/linkage/mock.js new file mode 100644 index 000000000..8e42b2d52 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/linkage/mock.js @@ -0,0 +1,129 @@ +import mockUtil from "/src/mock/base"; +import _ from "lodash-es"; +const options = { + name: "FormLinkage", + idGenerator: 0 +}; +const list = [ + { + province: 10000, + city: 100003, + county: 100004 + }, + { + province: 10010, + city: 100113, + county: 100115 + } +]; +const tree = [ + { + id: 10000, + label: "北京市", + children: [ + { + id: 100003, + label: "北京市辖区", + children: [ + { id: 100004, label: "东城区" }, + { id: 100005, label: "西城区" } + ] + }, + { + id: 100103, + label: "北京郊区", + children: [ + { id: 100104, label: "东郊" }, + { id: 100105, label: "西郊" } + ] + } + ] + }, + { + id: 10010, + label: "天津市", + children: [ + { + id: 100013, + label: "天津市辖区", + children: [ + { id: 100014, label: "天津湾" }, + { id: 100015, label: "渤海湾" } + ] + }, + { + id: 100113, + label: "天津市郊区", + children: [ + { id: 100114, label: "天津湾郊区" }, + { id: 100115, label: "渤海湾郊区" } + ] + } + ] + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); + +function omitChildren(orignalListt) { + const list = []; + orignalListt.forEach((item) => { + list.push(_.omit(item, "children")); + }); + return list; +} +mock.push({ + path: "/mock/linkage/province", + method: "get", + handle() { + const list = omitChildren(tree); + return { + code: 0, + msg: "success", + data: list + }; + } +}); + +mock.push({ + path: "/mock/linkage/city", + method: "get", + handle(req) { + const province = parseInt(req.params.province); + const a = tree.filter((item) => { + return item.id === province; + }); + const list = omitChildren(a[0].children); + return { + code: 0, + msg: "success", + data: list + }; + } +}); + +mock.push({ + path: "/mock/linkage/county", + method: "get", + handle(req) { + const province = parseInt(req.params.province); + const a = tree.filter((item) => { + return item.id === province; + }); + const city = parseInt(req.params.city); + const b = a[0].children.filter((item) => { + return item.id === city; + }); + + const list = omitChildren(b[0].children); + return { + code: 0, + msg: "success", + data: list + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/advanced/local-pagination/api.js b/packages/ui/certd-client/src/views/crud/advanced/local-pagination/api.js new file mode 100644 index 000000000..457dac6d8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/local-pagination/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/AdvancedLocalPagination"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/local-pagination/crud.jsx b/packages/ui/certd-client/src/views/crud/advanced/local-pagination/crud.jsx new file mode 100644 index 000000000..e4989bee1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/local-pagination/crud.jsx @@ -0,0 +1,101 @@ +import * as api from "./api"; +import _ from "lodash-es"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose, localDataRef }) { + const pageRequest = async ({ page, query }) => { + //总数据 + let data = localDataRef.value; + //获取请求参数 + const limit = page.limit; + let offset = page.offset; + data = data.filter((item) => { + // 根据你的业务,编写你的本地查询逻辑 + // text改成你的查询字段 + if (query.status && item.status !== query.status) { + return false; + } + return true; + }); + + // 本地分页 + const start = offset; + let end = offset + limit; + if (data.length < end) { + end = data.length; + } + const records = data.slice(start, end); + + // 构造返回结果 + return { + offset, + limit, + total: localDataRef.value.length, + records + }; + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + await api.UpdateObj(form); + //更新本地数据 + const tableData = localDataRef.value; + for (const item of tableData) { + if (item.id === form.id) { + _.merge(item, form); + } + } + }; + + const addRequest = async ({ form }) => { + const id = await api.AddObj(form); + //本地添加 + form.id = id; + localDataRef.value.unshift(form); + return id; + }; + + const delRequest = async ({ row }) => { + await api.DelObj(row.id); + //本地删除那一条记录 + const tableData = localDataRef.value; + let index = 0; + for (const item of tableData) { + if (item.id === row.id) { + localDataRef.value.splice(index, 1); + } + index++; + } + }; + + return { + output: {}, + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + status: { + title: "状态", + search: { show: true }, + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/local-pagination/index.vue b/packages/ui/certd-client/src/views/crud/advanced/local-pagination/index.vue new file mode 100644 index 000000000..d48a680ee --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/local-pagination/index.vue @@ -0,0 +1,57 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/advanced/local-pagination/mock.js b/packages/ui/certd-client/src/views/crud/advanced/local-pagination/mock.js new file mode 100644 index 000000000..120c2a634 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/local-pagination/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "AdvancedLocalPagination", + idGenerator: 0 +}; +const list = [ + { + status: "1" + }, + { + status: "2" + }, + { + status: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/api.js b/packages/ui/certd-client/src/views/crud/advanced/nest/api.js new file mode 100644 index 000000000..b18db901d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/AdvancedNest"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/api.js b/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/api.js new file mode 100644 index 000000000..3a8a4a1b2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/AdvancedAside"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/crud.jsx b/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/crud.jsx new file mode 100644 index 000000000..567715c65 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/crud.jsx @@ -0,0 +1,56 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + pagination: { + showSizeChanger: false, // antdv + showQuickJumper: false // antdv + }, + request: { + pageRequest: api.GetList, + addRequest, + editRequest, + delRequest + }, + toolbar: { + compact: false + }, + rowHandle: { + width: "230px" + }, + table: {}, + columns: { + gradeId: { + title: "年级Id", + search: { show: true }, + type: "number", + column: { + width: 80, + align: "center", + sortable: true + } + }, + class: { + title: "班级", + search: { show: false }, + type: "text", + column: { + sortable: true + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/index.vue b/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/index.vue new file mode 100644 index 000000000..9a198b9e4 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/index.vue @@ -0,0 +1,43 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/mock.js b/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/mock.js new file mode 100644 index 000000000..2d70c579f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/aside-table/mock.js @@ -0,0 +1,26 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "AdvancedAside", + idGenerator: 0 +}; +const list = [ + { + class: "一班", + gradeId: 1 + }, + { + class: "二班", + gradeId: 1 + }, + { + class: "三班", + gradeId: 2 + }, + { + class: "四班", + gradeId: 2 + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/crud.jsx b/packages/ui/certd-client/src/views/crud/advanced/nest/crud.jsx new file mode 100644 index 000000000..b42ba5c82 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/crud.jsx @@ -0,0 +1,101 @@ +import * as api from "./api"; +import { ref, shallowRef } from "vue"; +import SubTable from "./sub-table/index.vue"; +import { compute } from "@fast-crud/fast-crud"; +export default function ({ expose, asideTableRef }) { + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + const currentRow = ref(); + + const onCurrentRowChange = (id) => { + currentRow.value = id; + asideTableRef.value.setSearchFormData({ form: { gradeId: id } }); + asideTableRef.value.doRefresh(); + }; + return { + crudOptions: { + table: { + customRow(record, index) { + const clazz = record.id === currentRow.value ? "fs-current-row" : ""; + return { + onClick() { + onCurrentRowChange(record.id); + }, + class: clazz + }; + } + }, + pagination: { + showSizeChanger: false, // antdv + showQuickJumper: false // antdv + }, + form: { + wrapper: { + is: "a-drawer" + } + }, + request: { + pageRequest: api.GetList, + addRequest, + editRequest, + delRequest + }, + rowHandle: { + width: "240px" + }, + toolbar: { + compact: false + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + grade: { + title: "年级", + search: { show: true }, + type: "text", + column: { + sortable: true + } + }, + nestId: { + title: "嵌套表格", + //复合字段类型 + type: ["number", "colspan"], + form: { + // 嵌套表格字段 + rules: [{ required: true, message: "请选择用户" }], + component: { + //局部引用子表格,要用shallowRef包裹 + name: shallowRef(SubTable), + vModel: "modelValue", + gradeId: compute(({ form }) => { + return form.id; + }) + } + // antdv 的跨列配置,需要配置如下三个, 可以通过colspan简化 + // col: { span: 24 }, + // labelCol: { span: 2 }, + // wrapperCol: { span: 21 } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/index.vue b/packages/ui/certd-client/src/views/crud/advanced/nest/index.vue new file mode 100644 index 000000000..5fa4b445e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/index.vue @@ -0,0 +1,59 @@ + + + + diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/mock.js b/packages/ui/certd-client/src/views/crud/advanced/nest/mock.js new file mode 100644 index 000000000..709699d22 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/mock.js @@ -0,0 +1,22 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "AdvancedNest", + idGenerator: 0 +}; +const list = [ + { + grade: "一年级", + nestId: 1 + }, + { + grade: "二年级", + nestId: 2 + }, + { + grade: "三年级", + nestId: 3 + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/api.js b/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/api.js new file mode 100644 index 000000000..167a31de3 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/AdvancedSubTable"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/crud.jsx b/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/crud.jsx new file mode 100644 index 000000000..ad5faa1e5 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/crud.jsx @@ -0,0 +1,62 @@ +import * as api from "./api"; +export default function ({ expose, props, ctx }) { + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + table: { + customRow(record, index) { + const clazz = record.id === props.modelValue ? "fs-current-row" : ""; + return { + onClick() { + ctx.emit("update:modelValue", record.id); + }, + class: clazz + }; + } + }, + request: { + pageRequest: api.GetList, + addRequest, + editRequest, + delRequest + }, + search: { show: false }, + form: { + wrapper: { + is: "a-drawer" + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + name: { + title: "用户姓名", + search: { show: true }, + type: "text", + column: { + sortable: true + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/index.vue b/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/index.vue new file mode 100644 index 000000000..fb9284386 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/index.vue @@ -0,0 +1,61 @@ + + + + diff --git a/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/mock.js b/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/mock.js new file mode 100644 index 000000000..726a628a8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/advanced/nest/sub-table/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "AdvancedSubTable", + idGenerator: 0 +}; +const list = [ + { + name: "张三" + }, + { + name: "李四" + }, + { + name: "王五" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/api.js b/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/api.js new file mode 100644 index 000000000..af612a7a8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/BasisColumnMergePlugin"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/crud.jsx b/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/crud.jsx new file mode 100644 index 000000000..40a9cc8ca --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/crud.jsx @@ -0,0 +1,69 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; + +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + output: {}, + crudOptions: { + settings: { + viewFormUseCellComponent: true + }, + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + text: { + title: "text", + type: "text" + }, + readonly: { + title: "只读字段", + type: "text", + readonly: true + }, + useCell: { + title: "查看使用cell组件", + type: "dict-select", + readonly: true, + dict: dict({ + url: "/mock/dicts/OpenStatusEnum" + }), + viewForm: { + component: { + vModel: "modelValue" + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/index.vue b/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/index.vue new file mode 100644 index 000000000..186aa0367 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/index.vue @@ -0,0 +1,34 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/mock.js b/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/mock.js new file mode 100644 index 000000000..a36687c60 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/column-merge-plugin/mock.js @@ -0,0 +1,25 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "BasisColumnMergePlugin", + idGenerator: 0 +}; +const list = [ + { + text: "点击右边查看按钮看效果", + readonly: "我是只读", + useCell: "1" + }, + { + text: "点击编辑按钮查看效果", + readonly: "我是只读", + useCell: "2" + }, + { + text: "正常字段", + readonly: "我是只读", + useCell: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/basis/columns-set/api.js b/packages/ui/certd-client/src/views/crud/basis/columns-set/api.js new file mode 100644 index 000000000..2d20318fa --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/columns-set/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/BasisColumnsSet"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/basis/columns-set/crud.jsx b/packages/ui/certd-client/src/views/crud/basis/columns-set/crud.jsx new file mode 100644 index 000000000..559e49e35 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/columns-set/crud.jsx @@ -0,0 +1,69 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + toolbar: { + columnsFilter: { + mode: "default" + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + }, + disabled: { + title: "列设置禁用", + type: "text", + column: { + columnSetDisabled: true + } + }, + hidden: { + title: "列设置隐藏", + type: "text", + column: { + columnSetShow: false + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/basis/columns-set/index.vue b/packages/ui/certd-client/src/views/crud/basis/columns-set/index.vue new file mode 100644 index 000000000..a54361075 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/columns-set/index.vue @@ -0,0 +1,52 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/columns-set/mock.js b/packages/ui/certd-client/src/views/crud/basis/columns-set/mock.js new file mode 100644 index 000000000..90154b73b --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/columns-set/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "BasisColumnsSet", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/basis/compute-more/api.js b/packages/ui/certd-client/src/views/crud/basis/compute-more/api.js new file mode 100644 index 000000000..39c56ba12 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/compute-more/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormComputeMore"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/basis/compute-more/crud.jsx b/packages/ui/certd-client/src/views/crud/basis/compute-more/crud.jsx new file mode 100644 index 000000000..92ccdee89 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/compute-more/crud.jsx @@ -0,0 +1,79 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { useCompute } from "@fast-crud/fast-crud"; +import { message } from "ant-design-vue"; +import { ref, computed } from "vue"; +const { asyncCompute, compute } = useCompute(); +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + //普通的ref引用,可以动态切换配置 + const defValueRef = ref("我是动态的默认值"); + const defValueComputed = computed(() => { + return defValueRef.value; + }); + return { + output: { + defValueRef, + defValueComputed + }, + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + scroll: { + x: 1500 + } + }, + form: { + labelCol: { span: 8 }, + wrapperCol: { span: 14 } + }, + rowHandle: { + fixed: "right", + align:'center', + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + defValue: { + title: "默认值", + type: "text", + search: { show: true, value: null }, + form: { + // form.value不支持asyncCompute + // 假如你的默认值异步获取的,那么你自己必须保证先异步计算完成之后,才能打开对话框。 + // 因为在打开对话框时,默认值就必须得设置好。 + value: defValueRef + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/basis/compute-more/index.vue b/packages/ui/certd-client/src/views/crud/basis/compute-more/index.vue new file mode 100644 index 000000000..01d9da383 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/compute-more/index.vue @@ -0,0 +1,43 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/compute-more/mock.js b/packages/ui/certd-client/src/views/crud/basis/compute-more/mock.js new file mode 100644 index 000000000..ee602acfa --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/compute-more/mock.js @@ -0,0 +1,32 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FormComputeMore", + idGenerator: 0 +}; +const list = [ + { + ref: "根据showRef显示", + compute: true, + status: "1", + remote: "2", + shower: "---> 点右边编辑查看示例效果", + remote2: "2", + editable: true + }, + { + compute: false, + status: "2", + remote: "0", + remote2: "2", + editable: false + }, + { + compute: true, + status: "0", + remote2: "2", + editable: true + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/basis/compute/api.js b/packages/ui/certd-client/src/views/crud/basis/compute/api.js new file mode 100644 index 000000000..c8ec9fc8e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/compute/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormCompute"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/basis/compute/crud.jsx b/packages/ui/certd-client/src/views/crud/basis/compute/crud.jsx new file mode 100644 index 000000000..0f450f138 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/compute/crud.jsx @@ -0,0 +1,211 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { useCompute } from "@fast-crud/fast-crud"; +import { message } from "ant-design-vue"; +import { ref, computed } from "vue"; +const { asyncCompute, compute } = useCompute(); +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + //普通的ref引用,可以动态切换配置 + const showRef = ref(false); + const showTableRef = ref(true); + const showTableComputed = computed(() => { + return showTableRef.value; + }); + + const columnComponentShowRef = ref(true); + const columnComponentShowComputed = computed(() => { + return columnComponentShowRef.value; + }); + + return { + output: { + showRef, + showTableRef, + columnComponentShowRef + }, + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + scroll: { + x: 1500 + }, + //通过switch动态显隐table + show: showTableComputed //不仅支持computed,直接传showTableRef也是可以的 + }, + form: { + labelCol: { span: 8 }, + wrapperCol: { span: 14 } + }, + rowHandle: { + fixed: "right", + buttons: { + edit: { + show: compute(({ row }) => { + return row.editable; + }) + }, + remove: { + show: compute(({ row }) => { + return row.editable; + }) + } + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50, + resizable: true + }, + form: { + show: false + } + }, + refSwitch: { + title: "ref引用切换", + type: "text", + form: { + helper: "点我切换右边的输入框显示" + } + }, + ref: { + title: "根据ref引用显示", + type: ["text"], + form: { + component: { + show: showRef + }, + helper: "我会根据showRef进行显隐" + } + }, + compute: { + title: "compute", + search: { show: false }, + type: "text", + column: { + show: columnComponentShowComputed, + columnSetDisabled: true, //这里采用自定义控制显隐,那么列设置里面就要禁用 + // columnSetShow: false, //直接不在列设置里面显示也行 + component: { + name: "a-switch", + vModel: "checked" + } + }, + form: { + component: { + name: "a-switch", + vModel: "checked" + }, + helper: "点我触发动态计算" + } + }, + shower: { + title: "根据compute显示", + search: { show: false }, + type: "button", + form: { + component: { + show: compute(({ form }) => { + return form.compute; + }) + } + }, + column: { + width: 250, + resizable: true, + component: { + show: compute(({ row }) => { + return row.compute; + }) + } + } + }, + remote: { + title: "asyncCompute", + search: { show: true }, + type: "text", + form: { + component: { + name: "a-select", + vModel: "value", + placeholder: "异步计算远程获取options", + options: asyncCompute({ + async asyncFn(watchValue, context) { + const url = "/mock/dicts/OpenStatusEnum?remote"; + return await requestForMock({ url }); + } + }) + }, + helper: "我的options是异步计算远程获取的,只会获取一次" + } + }, + remote2: { + title: "监听switch触发异步计算", + search: { show: false }, + type: "text", + form: { + component: { + name: "a-select", + vModel: "value", + placeholder: "异步计算远程获取options", + options: asyncCompute({ + watch({ form }) { + return form.compute; + }, + async asyncFn(watchValue) { + message.info("监听switch,触发远程获取options"); + const url = watchValue + ? "/mock/dicts/OpenStatusEnum?remote" + : "/mock/dicts/moreOpenStatusEnum?remote"; + return await requestForMock({ url }); + } + }) + }, + helper: "监听其他属性修改后,触发重新计算" + }, + column: { + width: 200 + } + }, + editable: { + title: "可编辑", + search: { show: false }, + type: "text", + column: { + fixed: "right", + component: { + name: "a-switch", + vModel: "checked" + } + }, + form: { + show: false + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/basis/compute/index.vue b/packages/ui/certd-client/src/views/crud/basis/compute/index.vue new file mode 100644 index 000000000..d7408935e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/compute/index.vue @@ -0,0 +1,60 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/compute/mock.js b/packages/ui/certd-client/src/views/crud/basis/compute/mock.js new file mode 100644 index 000000000..b4c21d853 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/compute/mock.js @@ -0,0 +1,34 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FormCompute", + idGenerator: 0 +}; +const list = [ + { + ref: "根据showRef显示", + compute: true, + status: "1", + remote: "2", + shower: "---> 点右边编辑查看示例效果", + remote2: "2", + editable: true + }, + { + compute: false, + shower: "---> 点右边编辑查看示例效果", + status: "2", + remote: "0", + remote2: "2", + editable: false + }, + { + compute: true, + shower: "---> 点右边编辑查看示例效果", + status: "0", + remote2: "2", + editable: true + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/basis/first/index.vue b/packages/ui/certd-client/src/views/crud/basis/first/index.vue new file mode 100644 index 000000000..6edf3a6d1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/first/index.vue @@ -0,0 +1,109 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/i18n/api.js b/packages/ui/certd-client/src/views/crud/basis/i18n/api.js new file mode 100644 index 000000000..d62b1b729 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/i18n/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/BasisI18n"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/basis/i18n/crud.jsx b/packages/ui/certd-client/src/views/crud/basis/i18n/crud.jsx new file mode 100644 index 000000000..e789ca3e4 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/i18n/crud.jsx @@ -0,0 +1,72 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { useI18n } from "vue-i18n"; +export default function ({ expose }) { + const { t } = useI18n(); + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + name: { + title: t("app.crud.i18n.name"), + type: "text", + search: { show: true } + }, + city: { + title: t("app.crud.i18n.city"), + type: "dict-select", + search: { show: true }, + dict: dict({ + value: "id", + label: "text", + data: [ + { id: "sz", text: "深圳", color: "success" }, + { id: "gz", text: "广州", color: "blue" }, + { id: "bj", text: "北京" }, + { id: "wh", text: "武汉" }, + { id: "sh", text: "上海" } + ] + }) + }, + radio: { + title: t("app.crud.i18n.status"), + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/basis/i18n/index.vue b/packages/ui/certd-client/src/views/crud/basis/i18n/index.vue new file mode 100644 index 000000000..3c50ea0a3 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/i18n/index.vue @@ -0,0 +1,53 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/i18n/mock.js b/packages/ui/certd-client/src/views/crud/basis/i18n/mock.js new file mode 100644 index 000000000..4bbcc95b7 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/i18n/mock.js @@ -0,0 +1,25 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "BasisI18n", + idGenerator: 0 +}; +const list = [ + { + radio: "1", + name: "张三", + city: "sz" + }, + { + radio: "2", + name: "李四", + city: "gz" + }, + { + radio: "0", + name: "王五", + city: "sh" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/basis/layout-card/api.js b/packages/ui/certd-client/src/views/crud/basis/layout-card/api.js new file mode 100644 index 000000000..1ee8f29fa --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/layout-card/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/BasisLayoutCard"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/basis/layout-card/crud.jsx b/packages/ui/certd-client/src/views/crud/basis/layout-card/crud.jsx new file mode 100644 index 000000000..085f48522 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/layout-card/crud.jsx @@ -0,0 +1,73 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ crudExpose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + container: { + is: "fs-layout-card" + }, + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + name: { + title: "姓名", + type: "text", + search: { show: true } + }, + city: { + title: "城市", + type: "dict-select", + search: { show: true }, + dict: dict({ + value: "id", + label: "text", + data: [ + { id: "sz", text: "深圳", color: "success" }, + { id: "gz", text: "广州", color: "blue" }, + { id: "bj", text: "北京" }, + { id: "wh", text: "武汉" }, + { id: "sh", text: "上海" } + ] + }) + }, + radio: { + title: "单选", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/basis/layout-card/index.vue b/packages/ui/certd-client/src/views/crud/basis/layout-card/index.vue new file mode 100644 index 000000000..60597b7e4 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/layout-card/index.vue @@ -0,0 +1,46 @@ + + + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/layout-card/mock.js b/packages/ui/certd-client/src/views/crud/basis/layout-card/mock.js new file mode 100644 index 000000000..417d9601f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/layout-card/mock.js @@ -0,0 +1,25 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "BasisLayoutCard", + idGenerator: 0 +}; +const list = [ + { + radio: "1", + name: "张三", + city: "sz" + }, + { + radio: "2", + name: "李四", + city: "gz" + }, + { + radio: "0", + name: "王五", + city: "sh" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/basis/layout-custom/api.js b/packages/ui/certd-client/src/views/crud/basis/layout-custom/api.js new file mode 100644 index 000000000..f243b4020 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/layout-custom/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/BasisLayoutCustom"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/basis/layout-custom/crud.jsx b/packages/ui/certd-client/src/views/crud/basis/layout-custom/crud.jsx new file mode 100644 index 000000000..851929944 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/layout-custom/crud.jsx @@ -0,0 +1,75 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import CustomLayout from "./custom-layout.vue"; +import { shallowRef } from "vue"; +export default function ({ crudExpose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + container: { + is: shallowRef(CustomLayout) //可以将自定义布局组件全局注册,这里只需要配置name即可 + }, + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + name: { + title: "姓名", + type: "text", + search: { show: true } + }, + city: { + title: "城市", + type: "dict-select", + search: { show: false }, + dict: dict({ + value: "id", + label: "text", + data: [ + { id: "sz", text: "深圳", color: "success" }, + { id: "gz", text: "广州", color: "blue" }, + { id: "bj", text: "北京" }, + { id: "wh", text: "武汉" }, + { id: "sh", text: "上海" } + ] + }) + }, + radio: { + title: "单选", + search: { show: false }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/basis/layout-custom/custom-layout.vue b/packages/ui/certd-client/src/views/crud/basis/layout-custom/custom-layout.vue new file mode 100644 index 000000000..0f65a9b21 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/layout-custom/custom-layout.vue @@ -0,0 +1,74 @@ + + + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/layout-custom/index.vue b/packages/ui/certd-client/src/views/crud/basis/layout-custom/index.vue new file mode 100644 index 000000000..747c9dd9e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/layout-custom/index.vue @@ -0,0 +1,56 @@ + + + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/layout-custom/mock.js b/packages/ui/certd-client/src/views/crud/basis/layout-custom/mock.js new file mode 100644 index 000000000..d877b043e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/layout-custom/mock.js @@ -0,0 +1,25 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "BasisLayoutCustom", + idGenerator: 0 +}; +const list = [ + { + radio: "1", + name: "张三", + city: "sz" + }, + { + radio: "2", + name: "李四", + city: "gz" + }, + { + radio: "0", + name: "王五", + city: "sh" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/basis/value-change/api.js b/packages/ui/certd-client/src/views/crud/basis/value-change/api.js new file mode 100644 index 000000000..35fdfa0c1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/value-change/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/BasisValueChange"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/basis/value-change/crud.jsx b/packages/ui/certd-client/src/views/crud/basis/value-change/crud.jsx new file mode 100644 index 000000000..15dde4a4b --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/value-change/crud.jsx @@ -0,0 +1,95 @@ +import * as api from "./api"; +import { message } from "ant-design-vue"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + output: {}, + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + switch: { + title: "开关", + type: "dict-switch", + dict: dict({ + data: [ + { value: true, label: "开启" }, + { value: false, label: "关闭" } + ] + }), + column: { + component: { + name: "fs-dict-switch", + vModel: "checked" + }, + valueChange(context) { + console.log("column value changed:", context); + } + }, + form: { + valueChange({ value, key, form }) { + console.log("valueChanged,", key, value, form); + message.info(`valueChanged:${key}=${value}`); + } + } + }, + normal: { + title: "value-change", + type: "text", + form: { + valueChange({ value, key, form }) { + console.log("valueChanged,", key, value, form); + message.info(`valueChanged:${key}=${value}`); + } + } + }, + immediate: { + title: "immediate", + type: "text", + search: { + show: true + }, + form: { + valueChange: { + handle({ value, key, form, immediate }) { + console.log("valueChange,", key, value, "isImmediate=", immediate); + message.info(`valueChanged:${key}=${value},isImmediate=${immediate}`); + }, + immediate: true + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/basis/value-change/index.vue b/packages/ui/certd-client/src/views/crud/basis/value-change/index.vue new file mode 100644 index 000000000..0a6bc659c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/value-change/index.vue @@ -0,0 +1,43 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/basis/value-change/mock.js b/packages/ui/certd-client/src/views/crud/basis/value-change/mock.js new file mode 100644 index 000000000..2d16ebcc6 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/basis/value-change/mock.js @@ -0,0 +1,32 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "BasisValueChange", + idGenerator: 0 +}; +const list = [ + { + ref: "根据showRef显示", + compute: true, + status: "1", + remote: "2", + shower: "---> 点右边编辑查看示例效果", + remote2: "2", + editable: true + }, + { + compute: false, + status: "2", + remote: "0", + remote2: "2", + editable: false + }, + { + compute: true, + status: "0", + remote2: "2", + editable: true + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/button/api.js b/packages/ui/certd-client/src/views/crud/component/button/api.js new file mode 100644 index 000000000..99ab67a8a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/button/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentButton"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/button/crud.jsx b/packages/ui/certd-client/src/views/crud/component/button/crud.jsx new file mode 100644 index 000000000..4e10ee199 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/button/crud.jsx @@ -0,0 +1,115 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { dict, compute } from "@fast-crud/fast-crud"; +import { message } from "ant-design-vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + //配置表单label的宽度 + labelCol: { span: 6 } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + button: { + title: "按钮", + search: { show: true }, + type: "button", + column: { + component: { + show: compute(({ value }) => { + //当value为null时,不显示 + return value != null; + }), + on: { + // 注意:必须要on前缀 + onClick({ row }) { + message.success("按钮点击:" + row.button); + } + } + } + } + }, + url: { + title: "url", + search: { show: true }, + type: "text", + column: { + show: false + } + }, + link: { + title: "链接", + search: { show: true }, + type: "link", + column: { + component: { + on: { + // 注意:必须要on前缀 + onClick({ row }) { + if (row.url) { + window.open(row.url); + } + } + } + } + }, + form: { + title: "按钮文字" + } + }, + link2: { + title: "手写link配置", + search: { show: true }, + type: "text", //form组件用input + column: { + component: { + name: "fs-button", //列展示组件为button + vModel: "text", // 将row.link2的值赋值给text属性 + type: "link", // 按钮展示为链接样式 + on: { + //注册点击事件 + // 注意:必须要on前缀 + onClick({ row }) { + if (row.url) { + window.open(row.url); + } + } + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/button/index.vue b/packages/ui/certd-client/src/views/crud/component/button/index.vue new file mode 100644 index 000000000..bf86cd95a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/button/index.vue @@ -0,0 +1,42 @@ + + + + + diff --git a/packages/ui/certd-client/src/views/crud/component/button/mock.js b/packages/ui/certd-client/src/views/crud/component/button/mock.js new file mode 100644 index 000000000..bddcce225 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/button/mock.js @@ -0,0 +1,23 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentButton", + idGenerator: 0 +}; +const list = [ + { + button: "张三", + link: "百度", + url: "https://www.baidu.com", + link2: "手写配置" + }, + { + button: "李四", + link: "百度", + url: "https://www.baidu.com", + link2: "手写配置" + }, + {} +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/cascader/api.js b/packages/ui/certd-client/src/views/crud/component/cascader/api.js new file mode 100644 index 000000000..8e851ae50 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/cascader/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentCascader"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/cascader/crud.jsx b/packages/ui/certd-client/src/views/crud/component/cascader/crud.jsx new file mode 100644 index 000000000..2b5206b7d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/cascader/crud.jsx @@ -0,0 +1,137 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ crudRef }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + // 单列布局 + col: { span: 24 }, + labelCol: { span: 4 }, + wrapperCol: { span: 18 } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + cascader: { + title: "级联", + search: { show: true }, + type: "dict-cascader", + dict: dict({ + cloneable: false, + isTree: true, + url: "/mock/dicts/cascaderData?single" + }) + }, + lazyLoad: { + title: "懒加载", + type: "dict-cascader", + dict: dict({ + url: "/mock/tree/GetTreeChildrenByParentId?lazyLoad", + value: "code", + label: "name", + isTree: true, + prototype: true, + getNodesByValues(values) { + //给cell展示组件调用,根据value值获取节点,每行都会请求一次 + if (values == null) { + return []; + } + return requestForMock({ + url: "/mock/tree/GetNodesByValues", + params: { values } + }); + } + }), + form: { + component: { + vModel: "value", + options: [ + { + code: "11", + name: "北京", + isLeaf: false + }, + { + code: "12", + name: "天津", + isLeaf: false + } + ], + loadData: async (selectedOptions) => { + console.log("lazyLoad", selectedOptions); + const targetOption = selectedOptions[selectedOptions.length - 1]; + targetOption.loading = true; + + const ret = await requestForMock({ + url: "/mock/tree/GetTreeChildrenByParentId", + params: { parentId: targetOption.code } + }); + targetOption.loading = false; + const list = []; + for (const item of ret) { + list.push({ + code: item.code, + name: item.name, + isLeaf: item.leaf === true + }); + } + targetOption.children = list; + //options.value = [...options.value]; + }, + changeOnSelect: true + } + } + }, + multiple: { + title: "可搜索,可只选父节点", + type: "dict-cascader", + dict: dict({ + isTree: true, + url: "/mock/dicts/cascaderData?multiple" + }), + form: { + component: { + showSearch: { + filter: (inputValue, path) => { + return path.some((option) => option.label.toLowerCase().indexOf(inputValue.toLowerCase()) > -1); + } + }, + "change-on-select": true + }, + helper: "antd cascader 不支持级联多选" + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/cascader/index.vue b/packages/ui/certd-client/src/views/crud/component/cascader/index.vue new file mode 100644 index 000000000..58428ac78 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/cascader/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/cascader/mock.js b/packages/ui/certd-client/src/views/crud/component/cascader/mock.js new file mode 100644 index 000000000..01bc0582f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/cascader/mock.js @@ -0,0 +1,23 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentCascader", + idGenerator: 0 +}; +const list = [ + { + cascader: ["zhinan", "shejiyuanze", "yizhi"], + lazyLoad: ["11", "1101", "110101", "110101001"], + multiple: ["antdv cascader不支持多选"] + }, + { + cascader: ["zhinan", "shejiyuanze", "yizhi"], + multiple: ["antdv cascader不支持多选"] + }, + { + cascader: ["zhinan", "shejiyuanze", "yizhi"], + multiple: ["antdv cascader不支持多选"] + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/checkbox/api.js b/packages/ui/certd-client/src/views/crud/component/checkbox/api.js new file mode 100644 index 000000000..f1d4edba9 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/checkbox/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentCheckbox"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/checkbox/crud.jsx b/packages/ui/certd-client/src/views/crud/component/checkbox/crud.jsx new file mode 100644 index 000000000..ba55af1bc --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/checkbox/crud.jsx @@ -0,0 +1,50 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ crudRef }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + checkbox: { + title: "状态", + search: { show: true }, + type: "dict-checkbox", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/checkbox/index.vue b/packages/ui/certd-client/src/views/crud/component/checkbox/index.vue new file mode 100644 index 000000000..a1dd4729c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/checkbox/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/checkbox/mock.js b/packages/ui/certd-client/src/views/crud/component/checkbox/mock.js new file mode 100644 index 000000000..1763e9bb6 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/checkbox/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentCheckbox", + idGenerator: 0 +}; +const list = [ + { + checkbox: ["1", "2"] + }, + { + checkbox: "2" + }, + { + checkbox: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/date/api.js b/packages/ui/certd-client/src/views/crud/component/date/api.js new file mode 100644 index 000000000..f6a0197f3 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/date/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentDate"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/date/crud.jsx b/packages/ui/certd-client/src/views/crud/component/date/crud.jsx new file mode 100644 index 000000000..ba405c562 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/date/crud.jsx @@ -0,0 +1,174 @@ +import * as api from "./api"; +import { utils } from "@fast-crud/fast-crud"; +import dayjs from "dayjs"; + +console.log("utils", utils); +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + scroll: { x: 2000 } + }, + rowHandle: { fixed: "right" }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + timestamp: { + title: "时间戳", + type: "datetime", + search: { + show: true, + width: 185, + component: {} + }, + valueBuilder({ value, row, key }) { + console.log("value builder:", key, value, row); + if (value != null) { + row[key] = dayjs(value); + } + }, + valueResolve({ value, row, key }) { + if (value != null) { + row[key] = value.unix(); + } + } + }, + humanize: { + type: ["datetime", "time-humanize"], + title: "人性化时间", + column: { + component: { + options: { + largest: 2 + } + } + } + }, + datetime: { + title: "日期时间", + type: "datetime", + form: { + component: { + valueFormat: "YYYY-MM-DD HH:mm:ss" //输入值的格式 + } + } + }, + format: { + title: "格式化", + type: "datetime", + form: { + component: { + format: "YYYY年MM月DD日 HH:mm", + valueFormat: "YYYY-MM-DD HH:mm:ss" //输入值的格式 + } + }, + column: { + width: 180, + component: { + // 行展示组件使用的dayjs, + format: "YYYY年MM月DD日 HH:mm" + } + } + }, + date: { + title: "仅日期", + type: "date", + form: { + component: { + valueFormat: "YYYY-MM-DD HH:mm:ss", //输入值的格式 + events: { + onChange(context) { + console.log("change", context); + } + } + } + } + }, + time: { + title: "仅时间", + type: "time", + form: { + component: { + valueFormat: "YYYY-MM-DD HH:mm:ss" //输入值的格式 + } + } + }, + disabledDate: { + title: "禁用日期", + type: "date", + form: { + component: { + valueFormat: "YYYY-MM-DD HH:mm:ss", //输入值的格式 + disabledDate(current) { + return current && current < dayjs().endOf("day"); + } + } + } + }, + daterange: { + title: "日期范围", + type: "daterange", + search: { show: true, width: 300 }, + valueBuilder({ row, key }) { + if (!utils.strings.hasEmpty(row.daterangeStart, row.daterangeEnd)) { + row[key] = [dayjs(row.daterangeStart), dayjs(row.daterangeEnd)]; + } + } + }, + datetimerange: { + title: "日期时间范围", + type: "datetimerange", + search: { show: true, width: 300 }, + valueBuilder({ row, key }) { + if (!utils.strings.hasEmpty(row.datetimerangeStart, row.datetimerangeEnd)) { + row[key] = [dayjs(row.datetimerangeStart), dayjs(row.datetimerangeEnd)]; + } + }, + valueResolve({ form, key }) { + const row = form; + if (row[key] != null && !utils.strings.hasEmpty(row[key])) { + row.datetimerangeStart = row[key][0]; + row.datetimerangeEnd = row[key][1]; + } else { + row.datetimerangeStart = null; + row.datetimerangeEnd = null; + } + } + }, + customType: { + title: "自定义字段类型", + type: "time2" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/date/index.vue b/packages/ui/certd-client/src/views/crud/component/date/index.vue new file mode 100644 index 000000000..8ec795284 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/date/index.vue @@ -0,0 +1,47 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/date/mock.js b/packages/ui/certd-client/src/views/crud/component/date/mock.js new file mode 100644 index 000000000..895fddda9 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/date/mock.js @@ -0,0 +1,44 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "ComponentDate", + idGenerator: 0 +}; +const list = [ + { + timestamp: 123123123123, + humanize: new Date().getTime() - 11111111, + datetime: "2019-09-01 11:11:11", + date: "2019-09-02 11:11:11", + format: "2019-09-21 11:11:11", + time: "2019-09-22 12:11:11", + daterangeStart: "2019-09-23 11:11:11", + daterangeEnd: "2019-09-24 11:11:11", + datetimerangeStart: "2019-09-25 11:11:11", + datetimerangeEnd: "2019-09-26 11:11:11" + }, + { + // timestamp: 444444555, + datetime: "2017-09-20 11:11:11", + date: "2019-09-20 11:11:11", + humanize: new Date().getTime() - 22222222, + // time: 12313123334, + daterangeStart: "2019-09-20 11:11:11", + daterangeEnd: "2019-09-21 11:11:11", + datetimerangeStart: "2019-09-20 11:11:11", + datetimerangeEnd: "2019-09-21 11:11:11" + }, + { + // timestamp: 5555555555, + datetime: "2017-09-20 11:11:11", + date: "2019-09-20 11:11:11", + // time: 12313123334, + daterangeStart: "2019-09-20 11:11:11", + daterangeEnd: "2019-09-21 11:11:11", + datetimerangeStart: "2019-09-20 11:11:11", + datetimerangeEnd: "2019-09-21 11:11:11" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/editor/api.js b/packages/ui/certd-client/src/views/crud/component/editor/api.js new file mode 100644 index 000000000..523cfb370 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/editor/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentEditor"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/editor/crud.jsx b/packages/ui/certd-client/src/views/crud/component/editor/crud.jsx new file mode 100644 index 000000000..d32431b78 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/editor/crud.jsx @@ -0,0 +1,107 @@ +import * as api from "./api"; +import { utils, dict, compute } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + title: { + title: "标题", + type: "text", + column: { + width: 400 + }, + form:{ + col: { span: 24 }, + }, + }, + text: { + title: "摘要", + type: "textarea", + form:{ + col: { span: 24 }, + }, + viewForm: { + component: { + name: null, + render(h, scope) { + return
{scope.value}
; + } + } + } + }, + disabled: { + title: "禁用启用", + search: { show: false }, + type: "dict-switch", + dict: dict({ + data: [ + { value: true, label: "禁用" }, + { value: false, label: "启用" } + ] + }) + }, + content_wang: { + title: "内容", + column: { + width: 300, + show: false + }, + type: ["editor-wang5"], // 富文本图片上传依赖file-uploader,请先配置好file-uploader + form: { + helper:"示例已升级到wangEditor5版本,原来的editor-wang目前仍然可以使用,后续fs升级可能会将其删除,请尽快升级到editor-wang5版本", + col: { span: 24 }, + // 动态显隐字段 + // show: compute(({ form }) => { + // return form.change === "wang"; + // }), + rules: [{ required: true, message: "此项必填" }], + component: { + disabled: compute(({ form }) => { + return form.disabled; + }), + id: "1", // 当同一个页面有多个editor时,需要配置不同的id + config: {}, + uploader: { + type: "form", + buildUrl(res) { + return res.url; + } + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/editor/index.vue b/packages/ui/certd-client/src/views/crud/component/editor/index.vue new file mode 100644 index 000000000..61e5e2033 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/editor/index.vue @@ -0,0 +1,44 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/editor/mock.js b/packages/ui/certd-client/src/views/crud/component/editor/mock.js new file mode 100644 index 000000000..8351e0756 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/editor/mock.js @@ -0,0 +1,29 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "ComponentEditor", + idGenerator: 0 +}; +const list = [ + { + title: "d2-crud-plus好用吗?", + text: "非常好用", + content_quill: '

非常好用哦

', + change: "quill" + }, + { + title: "d2-crud-plus有什么优势?", + text: "简单,方便", + content_quill: "简单方便", + change: "wang" + }, + { + title: "1111111", + text: "22222", + content_quill: "3333", + change: "wang" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/icon/api.js b/packages/ui/certd-client/src/views/crud/component/icon/api.js new file mode 100644 index 000000000..4db9ed9ba --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/icon/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentIcon"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/icon/crud.jsx b/packages/ui/certd-client/src/views/crud/component/icon/crud.jsx new file mode 100644 index 000000000..ad9c38bed --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/icon/crud.jsx @@ -0,0 +1,75 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + icon: { + title: "icon", + search: { show: true }, + type: "text", + column: { + component: { + name: "fs-icon", + vModel: "icon", + style: "font-size:18px" + } + }, + form: { + helper: { + render() { + return ( + + 点击此处选择图标名称 + + ); + } + } + } + }, + svg: { + title: "svg", + search: { show: true }, + type: "text", + column: { + component: { + name: "fs-icon", + vModel: "icon", + style: "font-size:18px" + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/icon/index.vue b/packages/ui/certd-client/src/views/crud/component/icon/index.vue new file mode 100644 index 000000000..f8f1e9293 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/icon/index.vue @@ -0,0 +1,42 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/icon/mock.js b/packages/ui/certd-client/src/views/crud/component/icon/mock.js new file mode 100644 index 000000000..fe2de8ed2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/icon/mock.js @@ -0,0 +1,22 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentIcon", + idGenerator: 0 +}; +const list = [ + { + icon: "ri:24-hours-fill", + svg:"svg:icon-compass" + }, + { + icon: "ion:add-circle-outline", + svg:"svg:icon-left-circle" + }, + { + icon: "ion:american-football-sharp", + svg:"svg:icon-Dollar" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/json/api.js b/packages/ui/certd-client/src/views/crud/component/json/api.js new file mode 100644 index 000000000..a62736e62 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/json/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentJson"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/json/crud.jsx b/packages/ui/certd-client/src/views/crud/component/json/crud.jsx new file mode 100644 index 000000000..898fb5d30 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/json/crud.jsx @@ -0,0 +1,78 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + wrapper: { + async onOpened({ mode, formRef }) { + if (!formRef.form.async) { + setTimeout(() => { + formRef.form.async = { aaa: "11", bb: "111" }; + }, 2000); + } + } + } + }, + columns: { + json: { + title: "json", + type: "json", + form: { + valueBuilder({ form }) { + if (form.json == null) { + return; + } + form.json = JSON.parse(form.json); + }, + valueResolve({ form }) { + if (form.json == null) { + return; + } + form.json = JSON.stringify(form.json); + } + } + }, + async: { + title: "异步加载", + type: "json", + form: { + // 上面form.wrapper.onOpened里面配置了异步加载 + helper: "在onOpened里面配置异步加载json字符串", + valueBuilder({ form }) { + if (form.async == null) { + return; + } + form.async = JSON.parse(form.async); + }, + valueResolve({ form }) { + if (form.async == null) { + return; + } + form.async = JSON.stringify(form.async); + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/json/index.vue b/packages/ui/certd-client/src/views/crud/component/json/index.vue new file mode 100644 index 000000000..34868881f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/json/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/json/mock.js b/packages/ui/certd-client/src/views/crud/component/json/mock.js new file mode 100644 index 000000000..727a17889 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/json/mock.js @@ -0,0 +1,18 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentJson", + idGenerator: 0 +}; +const list = [ + { + json: '{"a":1,"b":2}', + async: null + }, + { + json: '{"a":3,"b":4}', + async: null + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/number/api.js b/packages/ui/certd-client/src/views/crud/component/number/api.js new file mode 100644 index 000000000..30c88fc3f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/number/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentNumber"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/number/crud.jsx b/packages/ui/certd-client/src/views/crud/component/number/crud.jsx new file mode 100644 index 000000000..057f7b18a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/number/crud.jsx @@ -0,0 +1,71 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + integer: { + title: "整数", + search: { show: true }, + type: "number" + }, + float: { + title: "小数", + type: "number", + form: { + component: { + step: "0.1" + } + } + }, + format: { + title: "格式化", + type: "number", + form: { + component: { + formatter: (value) => `${value}%`, + parser: (value) => value.replace("%", "") + } + }, + column: { + formatter({ value }) { + return value + "%"; + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/number/index.vue b/packages/ui/certd-client/src/views/crud/component/number/index.vue new file mode 100644 index 000000000..f6989e027 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/number/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/number/mock.js b/packages/ui/certd-client/src/views/crud/component/number/mock.js new file mode 100644 index 000000000..6b8854a1c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/number/mock.js @@ -0,0 +1,25 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentNumber", + idGenerator: 0 +}; +const list = [ + { + integer: 1, + float: 1.1, + format: 100 + }, + { + integer: 2, + float: 1.2, + format: 100 + }, + { + integer: 3, + float: 1.3, + format: 100 + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/radio/api.js b/packages/ui/certd-client/src/views/crud/component/radio/api.js new file mode 100644 index 000000000..761dae47f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/radio/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentRadio"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/radio/crud.jsx b/packages/ui/certd-client/src/views/crud/component/radio/crud.jsx new file mode 100644 index 000000000..cf7320196 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/radio/crud.jsx @@ -0,0 +1,73 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + }, + button: { + title: "按钮样式", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }), + form: { + component: { + optionName: "a-radio-button" + } + } + }, + bool: { + title: "布尔类型", + search: { show: true }, + type: "dict-radio", + dict: dict({ + data: [ + { value: true, label: "TRUE" }, + { value: false, label: "FALSE" } + ] + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/radio/index.vue b/packages/ui/certd-client/src/views/crud/component/radio/index.vue new file mode 100644 index 000000000..d851e5852 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/radio/index.vue @@ -0,0 +1,42 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/radio/mock.js b/packages/ui/certd-client/src/views/crud/component/radio/mock.js new file mode 100644 index 000000000..647514850 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/radio/mock.js @@ -0,0 +1,24 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentRadio", + idGenerator: 0 +}; +const list = [ + { + radio: "1", + button: "1", + bool: true + }, + { + radio: "2", + button: "2", + bool: false + }, + { + radio: "0", + button: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/select/api.js b/packages/ui/certd-client/src/views/crud/component/select/api.js new file mode 100644 index 000000000..6c9e2511d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/select/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentSelect"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/select/crud.jsx b/packages/ui/certd-client/src/views/crud/component/select/crud.jsx new file mode 100644 index 000000000..a04fafa05 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/select/crud.jsx @@ -0,0 +1,311 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +import _ from "lodash-es"; +function useSearchRemote() { + let lastFetchId = 0; + + const state = { + data: ref([]), + fetching: ref(false) + }; + const fetchUser = _.debounce((value) => { + console.log("fetching user", value); + lastFetchId += 1; + + const fetchId = lastFetchId; + + state.data.value = []; + + state.fetching.value = true; + + fetch("https://randomuser.me/api/?results=5") + .then((response) => response.json()) + .then((body) => { + if (fetchId !== lastFetchId) { + // for fetch callback order + return; + } + const data = body.results.map((user) => ({ + text: `${user.name.first} ${user.name.last}`, + value: user.login.username + })); + state.data.value = data; + state.fetching.value = false; + }); + }, 800); + + return { + fetchUser, + searchState: state + }; +} +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + const dictRef = dict({ + value: "id", + label: "text", + data: [ + { id: "sz", text: "深圳", color: "success" }, + { id: "gz", text: "广州", color: "blue" }, + { id: "bj", text: "北京" }, + { id: "wh", text: "武汉" }, + { id: "sh", text: "上海" } + ] + }); + + function dynamicUpdateDictOptions() { + dictRef.data.push({ id: "xg", text: "香港" }); + //dictRef.toMap(); + } + + const { fetchUser, searchState } = useSearchRemote(); + return { + dynamicUpdateDictOptions, + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + // 单列布局 + col: { span: 24 }, + labelCol: { span: 4 }, + wrapperCol: { span: 18 } + }, + rowHandle: { + fixed: "right", + align: "center" + }, + table: { + scroll: { + //启用横向滚动条,设置一个大于所有列宽之和的值,一般大于表格宽度 + x: 1400 + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + statusLocal: { + title: "单选本地", + type: "dict-select", + dict: dictRef + }, + statusRemote: { + title: "单选远程", + search: { + show: true, + rules: null, + component: { + style: { width: "100px" } + } + }, + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?simple" + }), + form: { + rules: [{ required: true, message: "请选择一个选项" }] + } + }, + filter: { + title: "本地过滤", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?simple" + }), + form: { + component: { + showSearch: true, + //默认的filterOption仅支持value的过滤,label并不会加入查询 + //所以需要自定义filterOption + filterOption(inputValue, option) { + return option.label.indexOf(inputValue) >= 0 || option.value.indexOf(inputValue) >= 0; + } + } + } + }, + search: { + title: "远程搜索", + search: { show: true, component: { style: { width: "240px" } } }, + form: { + component: { + name: "a-select", + vModel: "value", + filterOption: false, + //labelInValue: true, + mode: "multiple", + showSearch: true, + allowClear: true, + placeholder: "输入远程搜索,数据仅供演示", + options: searchState.data, + onSearch(value) { + fetchUser(value); + }, + children: { + notFoundContent() { + if (searchState.fetching.value) { + return ; + } + return "暂无记录"; + } + } + } + } + }, + customDictGetData: { + title: "自定义字典请求", + search: { show: false }, + type: "dict-select", + dict: dict({ + getData({ dict }) { + // 覆盖全局获取字典请求配置 + console.log(`我是从自定义的getData方法中加载的数据字典`, dict); + return requestForMock({ + url: "/mock/dicts/OpenStatusEnum?cache", + method: "get" + }); + } + }), + form: { + value: "2", //默认值, 注意search也会影响到,需要将search.value=null,取消search的默认值 + helper: "dict.getData可以覆盖全局配置的getRemoteDictFunc" + }, + column: { + width: 120, + component: { + type: "text" // 不使用tag,纯文本展示 + } + } + }, + disabledOptions: { + title: "禁用某个选项", + key: "disabledOptions", + type: "dict-select", + dict: dict({ + cloneable: true, + url: "/mock/dicts/OpenStatusEnum?disabledOptions" + }), + form: { + component: { + dict: { + // 此处dict配置会覆盖上面dict的属性 + prototype: true, // form表单的dict设置为原型复制,每次初始化时都会重新loadDict + onReady({ dict }) { + console.log("字典请求ready", dict); + dict.data[0].disabled = true; // 禁用某个选项, 还可以自己修改选项 + } + } + }, + helper: "禁用字典选项" + }, + column: { + width: 150 + } + }, + firstDefault: { + title: "默认值", + type: "dict-select", + dict: dict({ + cloneable: true, + url: "/mock/dicts/OpenStatusEnum?disabledOptions" + }), + form: { + component: { + //监听 dict-change事件 + onDictChange({ dict, form, key }) { + console.log("dict data changed", dict, key); + if (dict.data != null && form.firstDefault == null) { + form.firstDefault = dict.data[0].value; + } + } + // 下面的方法也可以,注意要配置dict.prototype:true + // dict: { + // // 此处dict配置会覆盖上面dict的属性 + // // form表单的dict设置为原型复制,每次初始化时都会重新loadDict + // prototype: true, + // + // onReady({ dict, form }) { + // console.log("字典请求ready", dict, form, getComponentRef); + // // prototype= true 才能获取到form表单数据 + // form.firstDefault = dict.data[0].value; + // } + // } + }, + helper: "默认选择第一个选项" + } + }, + multiple: { + title: "多选自动染色", + sortable: true, + type: "dict-select", + form: { + title: "多选本地", + component: { + mode: "multiple" + } + }, + dict: dict({ + data: [ + { value: "sz", label: "深圳", color: "success" }, + { value: "gz", label: "广州" }, + { value: "wh", label: "武汉" }, + { value: "sh", label: "上海" }, + { value: "hz", label: "杭州" }, + { value: "bj", label: "北京", color: "red" } + ] + }), + column: { + width: 290, + component: { + color: "auto", // 自动染色 + defaultLabel: "未知城市" //无数据字典时的默认文本 + } + } + }, + statusSimple: { + title: "普通选择", + form: { + component: { + name: "a-select", + vModel: "value", + options: [ + { value: "sz", label: "深圳", color: "success" }, + { value: "gz", label: "广州", color: "blue" }, + { value: "bj", label: "北京" }, + { value: "wh", label: "武汉" }, + { value: "sh", label: "上海" } + ] + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/select/index.vue b/packages/ui/certd-client/src/views/crud/component/select/index.vue new file mode 100644 index 000000000..8278b4564 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/select/index.vue @@ -0,0 +1,45 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/select/mock.js b/packages/ui/certd-client/src/views/crud/component/select/mock.js new file mode 100644 index 000000000..d74488775 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/select/mock.js @@ -0,0 +1,42 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentSelect", + idGenerator: 0 +}; +const list = [ + { + statusLocal: "sz", + customDictUrl: "0", + statusValue: 1, + multiple: ["sz", "bj", "gz", "sh", "hz", "xz", "xg"], + checkbox: "0", + select_local: "sz", + statusRemote: "0", + status_custom_2: "0", + customDictGetData: "1", + checkbox_btn: "1" + }, + { + statusLocal: "xg", + customDictUrl: "1", + statusValue: 2, + statusRemote: "1", + status_custom_2: "2", + select_local: "gz", + multiple: ["sh", "sz"], + checkbox: "0" + }, + { + statusLocal: "gz", + customDictUrl: "1", + statusValue: 1, + disabledCache: "1", + disabledOptions: "2", + select_local: "gz", + multiple: ["sh", "gz"], + checkbox: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/switch/api.js b/packages/ui/certd-client/src/views/crud/component/switch/api.js new file mode 100644 index 000000000..f2e25bed5 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/switch/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentSwitch"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/switch/crud.jsx b/packages/ui/certd-client/src/views/crud/component/switch/crud.jsx new file mode 100644 index 000000000..e2d751a75 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/switch/crud.jsx @@ -0,0 +1,141 @@ +import * as api from "./api"; +import { dict, compute } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + switch: { + title: "状态", + search: { show: true }, + type: "dict-switch", + dict: dict({ + data: [ + { value: false, label: "开启" }, + { value: true, label: "关闭" } + ] + }) + }, + notBool: { + title: "自定义value", + search: { show: true }, + type: "dict-switch", + dict: dict({ + data: [ + { value: "1", label: "开启" }, + { value: "2", label: "关闭" } + ] + }) + }, + switchLabel: { + title: "切换字段label", + search: { show: true }, + type: "dict-switch", + dict: dict({ + data: [ + { value: true, label: "开启" }, + { value: false, label: "关闭" } + ] + }), + column: { + show: false + } + }, + labelTarget: { + title: "我将被切换", + type: "text", + column: { + show: false + }, + form: { + label: compute(({ form }) => { + return form.switchLabel ? "我将被切换" : "再切换一下"; + }) + } + }, + cellSwitch: { + title: "cell显示", + search: { show: true }, + type: "dict-switch", + form: { + component: {} + }, + column: { + component: { + name: "fs-dict-switch", + vModel: "checked", + onChange: (value) => { + console.log("onChange", value); + } + // onChange: compute((context) => { + // //动态onChange方法测试 + // return () => { + // console.log("onChange", context.row.cellSwitch); + // }; + // }) + } + }, + dict: dict({ + data: [ + { value: true, label: "开启" }, + { value: false, label: "关闭" } + ] + }) + }, + showTarget: { + title: "显隐目标", + type: "text", + column: { + component: { + name: "fs-values-format", + show: compute((context) => { + //根据cellSwitch字段显隐 + return context.row.cellSwitch === true; + }) + } + }, + search: { + show: false + }, + form: { + show: compute((context) => { + console.log("context", context); + //根据cellSwitch字段显隐 + return context.form.cellSwitch === true; + }) + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/switch/index.vue b/packages/ui/certd-client/src/views/crud/component/switch/index.vue new file mode 100644 index 000000000..beb30f7df --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/switch/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/switch/mock.js b/packages/ui/certd-client/src/views/crud/component/switch/mock.js new file mode 100644 index 000000000..42772b1f7 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/switch/mock.js @@ -0,0 +1,27 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentSwitch", + idGenerator: 0 +}; +const list = [ + { + switch: true, + cellSwitch: true, + notBool: "1", + showTarget: "点左边开关显示或隐藏" + }, + { + switch: false, + cellSwitch: true, + notBool: "2", + showTarget: "点左边开关显示或隐藏" + }, + { + switch: true, + cellSwitch: false, + showTarget: "点左边开关显示或隐藏" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/text/api.js b/packages/ui/certd-client/src/views/crud/component/text/api.js new file mode 100644 index 000000000..2111f7724 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/text/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentText"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/text/crud.jsx b/packages/ui/certd-client/src/views/crud/component/text/crud.jsx new file mode 100644 index 000000000..24850e9e5 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/text/crud.jsx @@ -0,0 +1,130 @@ +import * as api from "./api"; +import { compute } from "@fast-crud/fast-crud"; +import { resolveDirective, withDirectives } from "vue"; + +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + name: { + title: "姓名", + type: "text", //虽然不写也能正确显示组件,但不建议省略它 + search: { show: true }, + form: { + component: { + maxlength: 20 + } + } + }, + search: { + title: "搜索", + type: "text", + form: { + component: { + addonAfter: "后置", + suffix: "suffix", + children: { + addonBefore() { + return ; + } + } + } + } + }, + password: { + title: "密码", + type: "password", + column: { + //一般密码不显示在列里面 + show: false + } + }, + // copy: { + // title: "剪贴板", + // type: "text", + // column: { + // cellRender({ value, row }) { + // const content = ( + //
+ // {value} + // 复制 + //
+ // ); + // const clipboard = resolveDirective("clipboard"); + // return withDirectives(content, [[clipboard, value]]); + // } + // } + // }, + copy: { + title: "剪贴板", + type: ["text", "copyable"] + }, + intro: { + title: "简介", + type: "textarea", + form: { + component: { showWordLimit: true, maxlength: 200 } + }, + column: { + ellipsis: true, + showTitle: true + } + }, + render: { + title: "复杂输入(render)", + form: { + title: "复杂输入", + component: { + render(context) { + console.log("context scope", context); + return ( + + + + + ); + } + } + } + }, + render2: { + title: "我的值是由复杂输入列输入的", + column: { + width: "300px" + }, + form: { + show: false + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/text/index.vue b/packages/ui/certd-client/src/views/crud/component/text/index.vue new file mode 100644 index 000000000..a97ef5519 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/text/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/text/mock.js b/packages/ui/certd-client/src/views/crud/component/text/mock.js new file mode 100644 index 000000000..4bc9df77c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/text/mock.js @@ -0,0 +1,43 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentText", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + date: "2016-05-02", + status: "0", + province: "1", + avatar: "https://alicdn.antdv.com/vue.png", + show: true, + city: "sz", + address: "123123", + zip: "518000", + intro: "王小虎是element-plus的table示例出现的名字", + copy: "测试文本" + }, + { + name: "张三", + date: "2016-05-04", + status: "1", + province: "2", + copy: "测试文本" + }, + { + name: "李四", + date: 2232433534511, + status: "1", + province: "0", + copy: "测试文本" + }, + { + name: "王五", + date: "2016-05-03", + status: "2", + province: "wh,gz" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/tree/api.js b/packages/ui/certd-client/src/views/crud/component/tree/api.js new file mode 100644 index 000000000..b9db03f12 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/tree/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentTree"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/tree/crud.jsx b/packages/ui/certd-client/src/views/crud/component/tree/crud.jsx new file mode 100644 index 000000000..1d3ce5abf --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/tree/crud.jsx @@ -0,0 +1,81 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + tree: { + title: "树形选择", + search: { show: false }, + type: "dict-tree", + dict: dict({ + isTree: true, + url: "/mock/dicts/cascaderData?single" + }) + }, + multiple: { + title: "多选", + search: { show: false }, + type: "dict-tree", + dict: dict({ + cloneable: false, + isTree: true, + url: "/mock/dicts/cascaderData?single" + }), + form: { + component: { + "tree-checkable": true + } + } + }, + fieldReplace: { + title: "修改options的value字段名", + search: { show: false }, + type: "dict-tree", + dict: dict({ + isTree: true, + url: "/mock/dicts/littlePca", + value: "code", + label: "name" + }), + form: { + component: { + fieldNames: { label: "name", key: "code", value: "code" } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/tree/index.vue b/packages/ui/certd-client/src/views/crud/component/tree/index.vue new file mode 100644 index 000000000..b5c740739 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/tree/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/tree/mock.js b/packages/ui/certd-client/src/views/crud/component/tree/mock.js new file mode 100644 index 000000000..ed3a1d394 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/tree/mock.js @@ -0,0 +1,16 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentTree", + idGenerator: 0 +}; +const list = [ + { + tree: "zhinan", + multiple: ["zhinan", "yizhi"] + }, + { tree: "zhinan" }, + { tree: "zhinan" } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/alioss/api.js b/packages/ui/certd-client/src/views/crud/component/uploader/alioss/api.js new file mode 100644 index 000000000..c5871d5bf --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/alioss/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/AliossUploader"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/alioss/crud.jsx b/packages/ui/certd-client/src/views/crud/component/uploader/alioss/crud.jsx new file mode 100644 index 000000000..c5dd0c412 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/alioss/crud.jsx @@ -0,0 +1,75 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + file: { + title: "阿里云上传", + type: "file-uploader", + form: { + component: { + uploader: { + type: "alioss" + } + } + } + }, + pictureCard: { + title: "照片墙", + type: "image-uploader", + form: { + component: { + uploader: { + type: "alioss" + } + } + } + }, + cropper: { + title: "裁剪", + type: "cropper-uploader", + form: { + component: { + uploader: { + type: "alioss" + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/alioss/index.vue b/packages/ui/certd-client/src/views/crud/component/uploader/alioss/index.vue new file mode 100644 index 000000000..0a305710c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/alioss/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/alioss/mock.js b/packages/ui/certd-client/src/views/crud/component/uploader/alioss/mock.js new file mode 100644 index 000000000..c3de48577 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/alioss/mock.js @@ -0,0 +1,24 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "AliossUploader", + idGenerator: 0 +}; +const list = [ + { + avatar_error1: "http://greper.handsfree.work/extends/avatar1.jpg", + avatar_error2: "http://greper.handsfree.work/extends/avatar1.jpg", + avatar: "http://greper.handsfree.work/extends/avatar.jpg", + file: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + image: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + image2: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"] + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/cos/api.js b/packages/ui/certd-client/src/views/crud/component/uploader/cos/api.js new file mode 100644 index 000000000..536456ea9 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/cos/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/CosUploader"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/cos/crud.jsx b/packages/ui/certd-client/src/views/crud/component/uploader/cos/crud.jsx new file mode 100644 index 000000000..05e54e162 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/cos/crud.jsx @@ -0,0 +1,75 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + file: { + title: "腾讯云", + type: "file-uploader", + form: { + component: { + uploader: { + type: "cos" + } + } + } + }, + pictureCard: { + title: "照片墙", + type: "image-uploader", + form: { + component: { + uploader: { + type: "cos" + } + } + } + }, + cropper: { + title: "裁剪", + type: "cropper-uploader", + form: { + component: { + uploader: { + type: "cos" + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/cos/index.vue b/packages/ui/certd-client/src/views/crud/component/uploader/cos/index.vue new file mode 100644 index 000000000..8b4bc1ef5 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/cos/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/cos/mock.js b/packages/ui/certd-client/src/views/crud/component/uploader/cos/mock.js new file mode 100644 index 000000000..5c608212f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/cos/mock.js @@ -0,0 +1,22 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "CosUploader", + idGenerator: 0 +}; +const list = [ + { + avatar: "http://greper.handsfree.work/extends/avatar.jpg", + file: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + image: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + image2: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"] + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/cropper/api.js b/packages/ui/certd-client/src/views/crud/component/uploader/cropper/api.js new file mode 100644 index 000000000..5113d49c4 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/cropper/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/CropperUploader"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/cropper/crud.jsx b/packages/ui/certd-client/src/views/crud/component/uploader/cropper/crud.jsx new file mode 100644 index 000000000..4d8e168c9 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/cropper/crud.jsx @@ -0,0 +1,110 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + cropper: { + title: "头像裁剪上传", + type: "cropper-uploader" + }, + avatar: { + title: "数量限制", + type: "cropper-uploader", + form: { + component: { + limit: 5 //默认限制1个,即头像上传,0为不限制 + } + } + }, + aspect: { + title: "按比例裁剪", + type: "cropper-uploader", + form: { + component: { + cropper: { + aspectRatio: 2 + } + } + } + }, + alioss: { + title: "alioss", + type: "cropper-uploader", + form: { + component: { + uploader: { + type: "alioss" + } + } + } + }, + qiniu: { + title: "七牛", + type: "cropper-uploader", + form: { + component: { + uploader: { + type: "qiniu" + } + } + } + }, + cos: { + title: "腾讯cos", + type: "cropper-uploader", + form: { + component: { + uploader: { + type: "cos" + } + } + } + }, + form: { + title: "表单", + type: "cropper-uploader", + form: { + component: { + uploader: { + type: "form" + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/cropper/index.vue b/packages/ui/certd-client/src/views/crud/component/uploader/cropper/index.vue new file mode 100644 index 000000000..3e6a98bf8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/cropper/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/cropper/mock.js b/packages/ui/certd-client/src/views/crud/component/uploader/cropper/mock.js new file mode 100644 index 000000000..83108782a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/cropper/mock.js @@ -0,0 +1,24 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "CropperUploader", + idGenerator: 0 +}; +const list = [ + { + avatar_error1: "http://greper.handsfree.work/extends/avatar1.jpg", + avatar_error2: "http://greper.handsfree.work/extends/avatar1.jpg", + avatar: "http://greper.handsfree.work/extends/avatar.jpg", + file: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + image: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + image2: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"] + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/form/api.js b/packages/ui/certd-client/src/views/crud/component/uploader/form/api.js new file mode 100644 index 000000000..af8d42b4a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/form/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentUploader"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/form/crud.jsx b/packages/ui/certd-client/src/views/crud/component/uploader/form/crud.jsx new file mode 100644 index 000000000..7a9cb0646 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/form/crud.jsx @@ -0,0 +1,223 @@ +import * as api from "./api"; +import { AllUploadSuccessValidator } from "@fast-crud/fast-extends"; +import { dict } from "@fast-crud/fast-crud"; +import { nextTick } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + wrapper: { + async onOpened() { + // 异步组件实例的获取 + const componentRef = await expose.getFormComponentRef("file", true); + console.log("componentRef", componentRef); + } + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + file: { + title: "表单上传", + type: "file-uploader", + form: { + component: { + multiple: true, //可选择多个 + uploader: { + type: "form" + } + } + }, + column: { + component: { + // 如果你后台返回的值不是一个完整的url,那么展示时就无法显示和点击 + // 需要你本地根据value构建文件的url。 + // 支持异步 + async buildUrl(value) { + return value; + } + } + } + }, + pictureCard: { + title: "照片墙", + type: "image-uploader", + form: { + component: { + limit: 1, + uploader: { + type: "form" + } + }, + helper: "最大可上传1个文件" + }, + column: { + component: { + buildPreviewUrl({ url, index }) { + if (index === 0) { + return "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"; + } else { + return url + "?preview=600x600"; + } + } + } + } + }, + pictureCard2: { + title: "通过urls显示", + type: "image-uploader", + column: { + component: { + urls: [ + { + url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?1", + previewUrl: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?preview1" + }, + { + url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?2", + previewUrl: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png?preview2" + } + ] + } + } + }, + avatar: { + title: "头像上传", + type: "avatar-uploader", + form: { + component: { + uploader: { + type: "form" + } + }, + helper: "就是照片墙limit=1的效果" + } + }, + cropper: { + title: "裁剪", + type: "cropper-uploader", + form: { + component: { + uploader: { + type: "form" + } + } + } + }, + keyValueType: { + title: "valueType为key", + type: "file-uploader", + form: { + component: { + uploader: { + type: "form" + }, + valueType: "key", + async buildUrl(value) { + return new Promise((resolve) => { + const url = "http://www.docmirror.cn:7070/api/upload/form/download?key=" + value; + resolve(url); + }); + } + } + }, + column: { + component: { + async buildUrl(value) { + return new Promise((resolve) => { + const url = "http://www.docmirror.cn:7070/api/upload/form/download?key=" + value; + resolve(url); + }); + } + } + } + }, + limit: { + title: "限制数量", + type: "file-uploader", + form: { + component: { + limit: 2, + uploader: { + type: "form" + } + }, + helper: "最大可上传2个文件" + } + }, + sizeLimit: { + title: "限制大小", + type: "file-uploader", + form: { + component: { + sizeLimit: 1024, + uploader: { + type: "form" + } + }, + helper: "大小不能超过1k" + } + }, + accept: { + title: "限制类型", + type: "file-uploader", + form: { + component: { + accept: "*.jpg,*.png" + }, + helper: "只能上传jpg或者png" + } + }, + validation: { + title: "校验", + type: "file-uploader", + form: { + rules: [ + { required: true, message: "此项必传" }, + { + validator: AllUploadSuccessValidator(), //如果要自定义校验规则则需要手动配置这个 + message: "还有文件正在上传,请稍候" + } + ], + helper: "大小不能超过50M,文件未上传完成之前,阻止提交", + component: { + uploader: { + type: "form", + sizeLimit: 1024 * 1024 * 50 + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/form/index.vue b/packages/ui/certd-client/src/views/crud/component/uploader/form/index.vue new file mode 100644 index 000000000..eaae1cac8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/form/index.vue @@ -0,0 +1,43 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/form/mock.js b/packages/ui/certd-client/src/views/crud/component/uploader/form/mock.js new file mode 100644 index 000000000..e4fda8db3 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/form/mock.js @@ -0,0 +1,24 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentUploader", + idGenerator: 0 +}; +const list = [ + { + avatar: "http://greper.handsfree.work/extends/avatar.jpg", + file: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + pictureCard: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + limit: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + statusRemote: "0", + keyValueType: "/2022-12-20/qygzqdjd1g.yaml" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/api.js b/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/api.js new file mode 100644 index 000000000..2d79f7b54 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/QiniuUploader"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/crud.jsx b/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/crud.jsx new file mode 100644 index 000000000..89c787c3e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/crud.jsx @@ -0,0 +1,73 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + file: { + title: "七牛云上传", + type: "file-uploader", + form: { + component: { + uploader: { + type: "qiniu" + } + } + } + }, + pictureCard: { + title: "照片墙", + type: "image-uploader", + form: { + component: { + uploader: { + type: "qiniu" + } + } + } + }, + cropper: { + title: "裁剪", + type: "cropper-uploader", + form: { + component: { + uploader: { + type: "qiniu" + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/index.vue b/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/index.vue new file mode 100644 index 000000000..0a305710c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/mock.js b/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/mock.js new file mode 100644 index 000000000..45c796850 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/component/uploader/qiniu/mock.js @@ -0,0 +1,22 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "QiniuUploader", + idGenerator: 0 +}; +const list = [ + { + avatar: "http://greper.handsfree.work/extends/avatar.jpg", + file: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + image: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"], + image2: ["http://greper.handsfree.work/extends/avatar.jpg", "https://www.baidu.com/img/bd_logo1.png"] + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/debug/select/api.js b/packages/ui/certd-client/src/views/crud/debug/select/api.js new file mode 100644 index 000000000..06a6bd3e5 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/debug/select/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/DebugSelect"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/debug/select/crud.jsx b/packages/ui/certd-client/src/views/crud/debug/select/crud.jsx new file mode 100644 index 000000000..d3bee6123 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/debug/select/crud.jsx @@ -0,0 +1,106 @@ +import * as api from "./api"; +import { requestForMock } from "/src/api/service"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + // 单列布局 + col: { span: 24 }, + labelCol: { span: 4 }, + wrapperCol: { span: 18 } + }, + rowHandle: { + fixed: "right" + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + + statusRemote: { + title: "单选远程", + search: { + show: true, + value: [] + }, + type: "dict-select", + dict: dict({ + url: "/mock/dicts/_OpenStatusEnum2?simple", + value: "id", + label: "text" + }), + form: { + component: { mode: "multiple" }, + rules: [{ required: true, message: "请选择一个选项" }] + }, + column: { + width: 200 + } + }, + id2: { + title: "ID", + key: "id", + type: "number", + column: { + width: 300 + }, + form: { + show: false + } + }, + id3: { + title: "ID", + key: "id", + type: "number", + column: { + width: 300 + }, + form: { + show: false + } + }, + id4: { + title: "ID", + key: "id", + type: "number", + column: { + width: 300 + }, + form: { + show: false + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/debug/select/index.vue b/packages/ui/certd-client/src/views/crud/debug/select/index.vue new file mode 100644 index 000000000..e7105c522 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/debug/select/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/debug/select/mock.js b/packages/ui/certd-client/src/views/crud/debug/select/mock.js new file mode 100644 index 000000000..2cb1e1750 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/debug/select/mock.js @@ -0,0 +1,9 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "DebugSelect", + idGenerator: 0 +}; +const list = []; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/dict/cloneable/api.js b/packages/ui/certd-client/src/views/crud/dict/cloneable/api.js new file mode 100644 index 000000000..a6c63db5f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/cloneable/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/DictCloneable"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/dict/cloneable/crud.jsx b/packages/ui/certd-client/src/views/crud/dict/cloneable/crud.jsx new file mode 100644 index 000000000..4ad17c789 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/cloneable/crud.jsx @@ -0,0 +1,88 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + const remoteDict = dict({ + cloneable: true, + url: "/mock/dicts/OpenStatusEnum" + }); + + return { + crudOptions: { + remoteDict, + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + remote: { + title: "远程字典", + search: { show: true }, + dict: remoteDict, + type: "dict-select", + form: { + component: { dict: { cache: false } } + } + }, + modifyDict: { + title: "动态修改字典", + search: { show: false }, + type: "text", + column: { + component: { + name: "a-switch", + vModel: "checked" + }, + valueChange({ row, getComponentRef }) { + // 这里不能使用remoteDict,因为在分发时已经clone到form配置中了 + // 这里dict修改不会影响列里面的数据 + const targetDict = getComponentRef("remote").dict; + targetDict.url = row.modifyDict ? "/mock/dicts/moreOpenStatusEnum?remote" : "/mock/dicts/OpenStatusEnum?remote"; + targetDict.reloadDict(); + } + }, + form: { + component: { + name: "a-switch", + vModel: "checked" + }, + valueChange({ form, getComponentRef }) { + // 这里不能使用remoteDict,因为在分发时已经clone到form配置中了 + // 这里dict修改不会影响列里面的数据 + const targetDict = getComponentRef("remote").dict; + targetDict.url = form.modifyDict ? "/mock/dicts/moreOpenStatusEnum?remote" : "/mock/dicts/OpenStatusEnum?remote"; + targetDict.reloadDict(); + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/dict/cloneable/index.vue b/packages/ui/certd-client/src/views/crud/dict/cloneable/index.vue new file mode 100644 index 000000000..4850b6200 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/cloneable/index.vue @@ -0,0 +1,48 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/dict/cloneable/mock.js b/packages/ui/certd-client/src/views/crud/dict/cloneable/mock.js new file mode 100644 index 000000000..acb0f31b8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/cloneable/mock.js @@ -0,0 +1,21 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "DictCloneable", + idGenerator: 0 +}; +const list = [ + { + status: "1", + remote: "2" + }, + { + status: "2", + remote: "0" + }, + { + status: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/dict/prototype/api.js b/packages/ui/certd-client/src/views/crud/dict/prototype/api.js new file mode 100644 index 000000000..08ab81955 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/prototype/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/DictPrototype"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/dict/prototype/crud.jsx b/packages/ui/certd-client/src/views/crud/dict/prototype/crud.jsx new file mode 100644 index 000000000..c40a2b070 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/prototype/crud.jsx @@ -0,0 +1,128 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { requestForMock } from "../../../../api/service"; + +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + const remoteDict = dict({ + prototype: true, //这个dict只是一个原型,引用它的dict组件初始化时都会把此dict对象clone一份 + url: "/mock/dicts/OpenStatusEnum" + }); + + const dynamicUrlDict = dict({ + cache: true, + prototype: true, //这个dict只是一个原型,引用它的dict组件初始化时都会把此dict对象clone一份 + url({ row }) { + return row.switch ? "/mock/dicts/moreOpenStatusEnum" : "/mock/dicts/OpenStatusEnum"; + } + }); + const dynamicDict = dict({ + cache: true, + prototype: true, //这个dict只是一个原型,引用它的dict组件初始化时都会把此dict对象clone一份 + url({ row }) { + return row.switch ? "/mock/dicts/moreOpenStatusEnum" : "/mock/dicts/OpenStatusEnum"; + }, + async getData({ url }) { + return await requestForMock({ url }); + } + }); + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + remote: { + title: "远程字典", + search: { show: true }, + dict: remoteDict, + type: "dict-select" + }, + modifyDict: { + title: "动态修改字典", + search: { show: true }, + type: "text", + form: { + helper: "此处可以动态切换左边select的options", + component: { + name: "a-switch", + vModel: "checked" + }, + valueChange({ form, value, getComponentRef }) { + console.log("form", value); + const targetDict = getComponentRef("remote").getDict(); + targetDict.url = form.modifyDict + ? "/mock/dicts/moreOpenStatusEnum?remote" + : "/mock/dicts/OpenStatusEnum?remote"; + targetDict.reloadDict(); + } + }, + column: { + component: { + name: "a-switch", + vModel: "checked" + }, + valueChange({ value, getComponentRef }) { + console.log("value", value); + const targetDict = getComponentRef("remote").getDict(); + targetDict.url = value ? "/mock/dicts/moreOpenStatusEnum?remote" : "/mock/dicts/OpenStatusEnum?remote"; + targetDict.reloadDict(); + } + } + }, + switch: { + title: "switch", + type: "dict-switch", + dict: dict({ + data: [ + { value: true, label: "开启" }, + { value: false, label: "关闭" } + ] + }), + form: { + helper: "动态getData和动态Url根据此字段的值获取不同的dictData,此处无法动态切换,仅在打开对话框时生效" + } + }, + dynamicGetData: { + title: "动态getData", + dict: dynamicDict, + type: "dict-select" + }, + dynamicUrl: { + title: "动态Url", + dict: dynamicUrlDict, + type: "dict-select" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/dict/prototype/index.vue b/packages/ui/certd-client/src/views/crud/dict/prototype/index.vue new file mode 100644 index 000000000..1adcdfaa0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/prototype/index.vue @@ -0,0 +1,48 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/dict/prototype/mock.js b/packages/ui/certd-client/src/views/crud/dict/prototype/mock.js new file mode 100644 index 000000000..adc12b8a0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/prototype/mock.js @@ -0,0 +1,31 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "DictPrototype", + idGenerator: 0 +}; +const list = [ + { + status: "1", + remote: "2", + modifyDict: false, + switch: true, + dynamicGetData: "1", + dynamicUrl: "2" + }, + { + status: "2", + remote: "0", + modifyDict: false, + dynamicGetData: "1", + dynamicUrl: "2" + }, + { + status: "0", + modifyDict: false, + dynamicGetData: "1", + dynamicUrl: "2" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/dict/shared/manager/api.js b/packages/ui/certd-client/src/views/crud/dict/shared/manager/api.js new file mode 100644 index 000000000..0d2a093ff --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/shared/manager/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/DictSharedManager"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/dict/shared/manager/crud.tsx b/packages/ui/certd-client/src/views/crud/dict/shared/manager/crud.tsx new file mode 100644 index 000000000..5293f5025 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/shared/manager/crud.tsx @@ -0,0 +1,58 @@ +import * as api from "./api"; +import { statusDict } from "../shared-dict"; +export default function ({ crudExpose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + pagination: { + pageSize: 9999 + }, + table: { + onRefreshed({ data }) { + statusDict.setData(data); + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + name: { + title: "name", + type: "text" + }, + label: { + title: "标签", + type: "text" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/dict/shared/manager/index.vue b/packages/ui/certd-client/src/views/crud/dict/shared/manager/index.vue new file mode 100644 index 000000000..da55bca04 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/shared/manager/index.vue @@ -0,0 +1,33 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/dict/shared/manager/mock.js b/packages/ui/certd-client/src/views/crud/dict/shared/manager/mock.js new file mode 100644 index 000000000..d99468cbd --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/shared/manager/mock.js @@ -0,0 +1,23 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "DictSharedManager", + idGenerator: 0, + copyTimes: 1 +}; +const list = [ + { + name: "close", + label: "关闭" + }, + { + name: "open", + label: "打开" + }, + { + name: "stop", + label: "停止" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/dict/shared/shared-dict.ts b/packages/ui/certd-client/src/views/crud/dict/shared/shared-dict.ts new file mode 100644 index 000000000..606f93ae0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/shared/shared-dict.ts @@ -0,0 +1,10 @@ +import { dict, utils } from "@fast-crud/fast-crud"; +import * as api from "./manager/api"; +export const statusDict = dict({ + value: "name", + async getData() { + const res = await api.GetList({ query: {}, sort: {}, page: { limit: 9999 } }); + utils.logger.debug("status dict first loaded", res.records); + return res.records; + } +}); diff --git a/packages/ui/certd-client/src/views/crud/dict/shared/use/api.js b/packages/ui/certd-client/src/views/crud/dict/shared/use/api.js new file mode 100644 index 000000000..c2bdbc91c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/shared/use/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/DictSharedUse"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/dict/shared/use/crud.jsx b/packages/ui/certd-client/src/views/crud/dict/shared/use/crud.jsx new file mode 100644 index 000000000..f2f566d53 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/shared/use/crud.jsx @@ -0,0 +1,47 @@ +import * as api from "./api"; +import { statusDict } from "../shared-dict"; +export default function ({ crudExpose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + status: { + title: "状态", + type: "dict-select", + dict: statusDict + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/dict/shared/use/index.vue b/packages/ui/certd-client/src/views/crud/dict/shared/use/index.vue new file mode 100644 index 000000000..547dc92d8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/shared/use/index.vue @@ -0,0 +1,33 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/dict/shared/use/mock.js b/packages/ui/certd-client/src/views/crud/dict/shared/use/mock.js new file mode 100644 index 000000000..b7c65bf3c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/shared/use/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "DictSharedUse", + idGenerator: 0 +}; +const list = [ + { + status: "close" + }, + { + status: "stop" + }, + { + status: "open" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/dict/single/api.js b/packages/ui/certd-client/src/views/crud/dict/single/api.js new file mode 100644 index 000000000..971936543 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/single/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/DictSingle"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/dict/single/crud.jsx b/packages/ui/certd-client/src/views/crud/dict/single/crud.jsx new file mode 100644 index 000000000..aa161d64b --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/single/crud.jsx @@ -0,0 +1,111 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + const statusDict = dict({ + cloneable: false, // 关闭cloneable,任何情况下,都使用同一个dict + data: [ + { value: "1", label: "开启", color: "success" }, + { value: "2", label: "停止", color: "blue" }, + { value: "0", label: "关闭", color: "blue" } + ] + }); + + const remoteDict = dict({ + cloneable: false, // 关闭cloneable,任何情况下,都使用同一个dict + url: "/mock/dicts/OpenStatusEnum", + immediate: false + }); + // remoteDict.loadDict(); + + return { + remoteDict, + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + status: { + title: "本地字典", + search: { show: false }, + dict: statusDict, + type: "dict-select" + }, + remote: { + title: "远程字典", + search: { show: true }, + dict: remoteDict, + type: "dict-select", + column: { + component: { + onDictChange(opts) { + console.log("字典变化:", opts); + } + } + } + }, + modifyDict: { + title: "动态修改字典", + search: { show: false }, + type: "text", + form: { + component: { + name: "a-switch", + vModel: "checked" + }, + valueChange({ form }) { + console.log("changed", form.modifyDict); + remoteDict.url = form.modifyDict + ? "/mock/dicts/moreOpenStatusEnum?remote" + : "/mock/dicts/OpenStatusEnum?remote"; + // 由于remoteDict.cloneable =false,所以全局公用一个实例,修改会影响全部地方 + remoteDict.reloadDict(); + } + }, + column: { + component: { + name: "a-switch", + vModel: "checked", + on: { + // 注意:必须要on前缀 + onChange({ $event }) { + remoteDict.url = $event + ? "/mock/dicts/moreOpenStatusEnum?remote" + : "/mock/dicts/OpenStatusEnum?remote"; + remoteDict.reloadDict(); + } + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/dict/single/index.vue b/packages/ui/certd-client/src/views/crud/dict/single/index.vue new file mode 100644 index 000000000..a0f6a2d01 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/single/index.vue @@ -0,0 +1,49 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/dict/single/mock.js b/packages/ui/certd-client/src/views/crud/dict/single/mock.js new file mode 100644 index 000000000..cad375c93 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/dict/single/mock.js @@ -0,0 +1,21 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "DictSingle", + idGenerator: 0 +}; +const list = [ + { + status: "1", + remote: "2" + }, + { + status: "2", + remote: "0" + }, + { + status: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/column-resize/api.js b/packages/ui/certd-client/src/views/crud/feature/column-resize/api.js new file mode 100644 index 000000000..279509cc9 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/column-resize/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureSearch"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/column-resize/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/column-resize/crud.jsx new file mode 100644 index 000000000..913909dbd --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/column-resize/crud.jsx @@ -0,0 +1,70 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + const crudBinding = expose.crudBinding; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + onResizeColumn: (w, col) => { + //触发resize事件后,修改column宽度,width只能配置为number类型 + //可以将此方法写在app.use()中的commonOptions里面 + crudBinding.value.table.columnsMap[col.key].width = w; + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50, //宽度必须number类型 + resizable: true //配置true,表示可以调整宽度 + }, + form: { + show: false + } + }, + text: { + title: "说明", + type: "text", + column: { + ellipsis: true, + showTitle: true, + resizable: true, //配置true,表示可以调整宽度 + width: 400 //宽度必须number类型 + } + }, + //必须留一个自动宽度 + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/column-resize/index.vue b/packages/ui/certd-client/src/views/crud/feature/column-resize/index.vue new file mode 100644 index 000000000..8565e9e60 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/column-resize/index.vue @@ -0,0 +1,43 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/column-resize/mock.js b/packages/ui/certd-client/src/views/crud/feature/column-resize/mock.js new file mode 100644 index 000000000..68cfb67ad --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/column-resize/mock.js @@ -0,0 +1,20 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureSearch", + idGenerator: 0 +}; +const list = [ + { + text: "这一列可以调整宽度,另外必须留一列自动宽度", + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/column-sort/api.js b/packages/ui/certd-client/src/views/crud/feature/column-sort/api.js new file mode 100644 index 000000000..37c27d576 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/column-sort/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureColumnSort"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/column-sort/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/column-sort/crud.jsx new file mode 100644 index 000000000..fbadd388f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/column-sort/crud.jsx @@ -0,0 +1,94 @@ +import * as api from "./api"; +export default function ({ expose }) { + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest: api.GetList, + addRequest, + editRequest, + delRequest + }, + toolbar: { + //工具按钮排序 + buttons: { + search: { order: 1 } // 查询按钮排到前面 + } + }, + form: { + //表单跨列 + col: { span: 24 }, + labelCol: { span: 6 } + }, + columns: { + col1: { + title: "col.1", + search: { show: true }, + type: "text" + }, + col2: { + title: "col.2,我排最后一个", + search: { + //控制查询字段顺序 + show: true, + //字段默认order为100,比100大的放最后面 + order: 101 + }, + type: "text", + column: { + //控制列字段顺序 + //字段默认order为100,比100大的放最后面 + order: 101 + }, + form: { + //控制表单字段顺序 + //字段默认order为100,比100大的放最后面 + order: 101 + } + }, + col3: { + title: "col.3,我排第一个", + search: { + show: true, + order: 0 + }, + type: "text", + column: { + order: 0 + }, + form: { + order: 0 + } + }, + col4: { + title: "col.4,我在col3后面", + type: "text", + search: { + show: true, + order: 0 + }, + column: { + order: 0 + }, + form: { + order: 0 + } + }, + col5: { + title: "col.5", + type: "text" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/column-sort/index.vue b/packages/ui/certd-client/src/views/crud/feature/column-sort/index.vue new file mode 100644 index 000000000..4f86ebeab --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/column-sort/index.vue @@ -0,0 +1,47 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/column-sort/mock.js b/packages/ui/certd-client/src/views/crud/feature/column-sort/mock.js new file mode 100644 index 000000000..66315f552 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/column-sort/mock.js @@ -0,0 +1,31 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureColumnSort", + idGenerator: 0 +}; +const list = [ + { + col1: "1", + col2: "2", + col3: "3", + col4: "4", + col5: "5" + }, + { + col1: "1", + col2: "2", + col3: "3", + col4: "4", + col5: "5" + }, + { + col1: "1", + col2: "2", + col3: "3", + col4: "4", + col5: "5" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/columns-set/api.js b/packages/ui/certd-client/src/views/crud/feature/columns-set/api.js new file mode 100644 index 000000000..b3a572570 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/columns-set/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureColumnsSet"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/columns-set/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/columns-set/crud.jsx new file mode 100644 index 000000000..3099f8b95 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/columns-set/crud.jsx @@ -0,0 +1,55 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + toolbar: { + columnsFilter: { + mode: "simple" + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/columns-set/index.vue b/packages/ui/certd-client/src/views/crud/feature/columns-set/index.vue new file mode 100644 index 000000000..5c898b199 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/columns-set/index.vue @@ -0,0 +1,49 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/columns-set/mock.js b/packages/ui/certd-client/src/views/crud/feature/columns-set/mock.js new file mode 100644 index 000000000..79043c91e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/columns-set/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureColumnsSet", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/editable-row/api.js b/packages/ui/certd-client/src/views/crud/feature/editable-row/api.js new file mode 100644 index 000000000..acb0aab5c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/editable-row/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureEditableRow"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/editable-row/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/editable-row/crud.jsx new file mode 100644 index 000000000..4b4c8784b --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/editable-row/crud.jsx @@ -0,0 +1,88 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + const id = await api.AddObj(form); + return { id }; + }; + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + actionbar: { buttons: { add: { show: false }, addRow: { show: true } } }, + table: { + editable: { + enabled: true, + mode: "row", + activeTrigger: false + } + }, + columns: { + id: { + title: "ID", + type: "number", + form: { + show: false + }, + column: { width: 80, align: "center" } + }, + disable: { + title: "禁止编辑", + type: "text", + column: { + editable: { + disabled: true //也可以配置为方法,根据条件禁用或启用编辑 + // disabled: ({ column, index, row }) => { + // return index % 2 === 0; + // } + } + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + }, + name: { + title: "姓名", + type: "text" + }, + province: { + title: "省份", + search: { show: true }, + type: "dict-select", + dict: dict({ + value: "id", + label: "text", + data: [ + { id: "sz", text: "深圳", color: "success" }, + { id: "gz", text: "广州", color: "primary" }, + { id: "bj", text: "北京" }, + { id: "wh", text: "武汉" }, + { id: "sh", text: "上海" } + ] + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/editable-row/index.vue b/packages/ui/certd-client/src/views/crud/feature/editable-row/index.vue new file mode 100644 index 000000000..54f2c6973 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/editable-row/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/editable-row/mock.js b/packages/ui/certd-client/src/views/crud/feature/editable-row/mock.js new file mode 100644 index 000000000..9a11dbb27 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/editable-row/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureEditableRow", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/editable/api.js b/packages/ui/certd-client/src/views/crud/feature/editable/api.js new file mode 100644 index 000000000..e3cf94ecc --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/editable/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureEditable"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/editable/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/editable/crud.jsx new file mode 100644 index 000000000..72d8d6084 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/editable/crud.jsx @@ -0,0 +1,105 @@ +import * as api from "./api"; +import { dict, compute } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const { crudBinding } = expose; + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + actionbar: { + buttons: { + add: { + show: compute(() => { + if (crudBinding.value) { + return !crudBinding.value?.table.editable.enabled; + } + return false; + }) + }, + addRow: { + show: compute(() => { + if (crudBinding.value) { + return crudBinding.value?.table.editable.enabled; + } + return false; + }) + } + } + }, + table: { + editable: { + mode: "free" + } + }, + columns: { + id: { + title: "ID", + type: "number", + form: { + show: false + }, + column: { width: 80, align: "center" } + }, + disable: { + title: "禁止编辑", + type: "text", + column: { + editable: { + disabled: true //也可以配置为方法,根据条件禁用或启用编辑 + // disabled: ({ column, index, row }) => { + // return index % 2 === 0; + // } + } + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + }, + name: { + title: "姓名", + type: "text" + }, + province: { + title: "省份", + search: { show: true }, + type: "dict-select", + dict: dict({ + value: "id", + label: "text", + data: [ + { id: "sz", text: "深圳", color: "success" }, + { id: "gz", text: "广州", color: "primary" }, + { id: "bj", text: "北京" }, + { id: "wh", text: "武汉" }, + { id: "sh", text: "上海" } + ] + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/editable/index.vue b/packages/ui/certd-client/src/views/crud/feature/editable/index.vue new file mode 100644 index 000000000..e7280e8a0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/editable/index.vue @@ -0,0 +1,100 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/editable/mock.js b/packages/ui/certd-client/src/views/crud/feature/editable/mock.js new file mode 100644 index 000000000..b1d6b08d6 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/editable/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureEditable", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/expand/api.js b/packages/ui/certd-client/src/views/crud/feature/expand/api.js new file mode 100644 index 000000000..c9ad003be --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/expand/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureExpand"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/expand/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/expand/crud.jsx new file mode 100644 index 000000000..5a3dee3f6 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/expand/crud.jsx @@ -0,0 +1,63 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + //默认展开第一行 + defaultExpandedRowKeys:[1], + slots: { + expandedRowRender: (scope) => { + return ( +
+ index: {scope.index} ; row: {JSON.stringify(scope.record)} +
+ ); + } + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/expand/index.vue b/packages/ui/certd-client/src/views/crud/feature/expand/index.vue new file mode 100644 index 000000000..fe8b3d2c4 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/expand/index.vue @@ -0,0 +1,65 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/expand/mock.js b/packages/ui/certd-client/src/views/crud/feature/expand/mock.js new file mode 100644 index 000000000..3b6d69446 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/expand/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureExpand", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/filter/api.js b/packages/ui/certd-client/src/views/crud/feature/filter/api.js new file mode 100644 index 000000000..6970dae3d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/filter/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureFilter"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/filter/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/filter/crud.jsx new file mode 100644 index 000000000..672d89113 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/filter/crud.jsx @@ -0,0 +1,70 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + // 表头过滤改变事件 + onFilterChange(e) { + console.log("onFilterChange", e); + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }), + column: { + filters: [ + { text: "开", value: "1" }, + { text: "关", value: "0" }, + { text: "停", value: "2" } + ], + // specify the condition of filtering result + // here is that finding the name started with `value` + onFilter: (value, record) => { + return record.radio === value; + }, + sorter: (a, b) => a.radio - b.radio, + sortDirections: ["descend"] + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/filter/index.vue b/packages/ui/certd-client/src/views/crud/feature/filter/index.vue new file mode 100644 index 000000000..7205a9473 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/filter/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/filter/mock.js b/packages/ui/certd-client/src/views/crud/feature/filter/mock.js new file mode 100644 index 000000000..fd405168b --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/filter/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureFilter", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/fixed/api.js b/packages/ui/certd-client/src/views/crud/feature/fixed/api.js new file mode 100644 index 000000000..ac40ccaf6 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/fixed/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureFixed"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/fixed/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/fixed/crud.jsx new file mode 100644 index 000000000..9b15c1ec1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/fixed/crud.jsx @@ -0,0 +1,90 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest: api.GetList, + addRequest, + editRequest, + delRequest + }, + rowHandle: { + //固定右侧 + fixed: "right" + }, + table: { + scroll: { + //当你表格宽度大到需要使用固定列时,需要设置此值,并且是大于等于列宽度之和的值 + //否则可能会出现将自动宽度列挤变形,或者拖动滚动条表头不动等问题。 + x: 1400 + } + }, + columns: { + text1: { + title: "text1", + type: "text", + column: { + // 固定左侧 + // 注意被固定在左侧的列要放在最前面,否则会出现某些列错位不显示的问题 + fixed: "left", + width: 260 + } + }, + id: { + title: "id", + type: "text", + column: { + width: 100 + } + }, + text2: { + title: "text2", + type: "text", + column: { + width: 260 + } + }, + text3: { + title: "text3", + type: "text", + column: { + width: 260 + } + }, + text4: { + title: "text4", + type: "text", + column: { + width: 260 + } + }, + text5: { + title: "text5", + type: "text", + column: { + width: 260 + } + }, + last: { + title: "last", + type: "text", + column: { + width: 260 + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/fixed/index.vue b/packages/ui/certd-client/src/views/crud/feature/fixed/index.vue new file mode 100644 index 000000000..2e1d2ddfd --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/fixed/index.vue @@ -0,0 +1,39 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/fixed/mock.js b/packages/ui/certd-client/src/views/crud/feature/fixed/mock.js new file mode 100644 index 000000000..22bd02c46 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/fixed/mock.js @@ -0,0 +1,14 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureFixed", + idGenerator: 0 +}; +const list = [ + { + text1: "我会被固定在左侧", + last: "操作列被固定在右侧" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/header-group/api.js b/packages/ui/certd-client/src/views/crud/feature/header-group/api.js new file mode 100644 index 000000000..4af20b765 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/header-group/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureHeaderGroup"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/header-group/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/header-group/crud.jsx new file mode 100644 index 000000000..09819296d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/header-group/crud.jsx @@ -0,0 +1,109 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { size: "small" }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + user: { + title: "用户信息", + children: { + name: { + title: "姓名", + type: "text" + }, + age: { + title: "年龄", + type: "number" + }, + switch: { + title: "开关", + type: "dict-switch", + dict: dict({ + data: [ + { value: true, label: "开启" }, + { value: false, label: "关闭" } + ] + }), + column: { + component: { + name: "fs-dict-switch", + vModel: "checked" + }, + valueChange(context) { + console.log("column value changed:", context); + } + } + } + } + }, + address: { + title: "地址", + children: { + area: { + title: "地区", + children: { + province: { + title: "省", + search: { show: true }, + type: "dict-select", + dict: dict({ + data: [ + { value: "广东省", label: "广东省" }, + { value: "浙江省", label: "浙江省" } + ] + }) + }, + city: { + title: "市", + search: { show: true }, + type: "text" + }, + county: { + title: "区", + search: { show: true }, + type: "text" + } + } + }, + street: { + title: "街道", + type: "text" + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/header-group/index.vue b/packages/ui/certd-client/src/views/crud/feature/header-group/index.vue new file mode 100644 index 000000000..77c344ff4 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/header-group/index.vue @@ -0,0 +1,42 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/header-group/mock.js b/packages/ui/certd-client/src/views/crud/feature/header-group/mock.js new file mode 100644 index 000000000..05760a739 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/header-group/mock.js @@ -0,0 +1,30 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureHeaderGroup", + idGenerator: 0 +}; +const list = [ + { + name: "张三", + age: 18, + province: "广东省", + city: "深圳市", + county: "南山区", + street: "粤海街道" + }, + { + name: "李四", + age: 26, + province: "浙江省", + city: "杭州市", + county: "西湖区", + street: "西湖街道" + }, + { + name: "王五", + age: 24 + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/height/api.js b/packages/ui/certd-client/src/views/crud/feature/height/api.js new file mode 100644 index 000000000..4f5c7d118 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/height/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/ComponentHeight"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/height/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/height/crud.jsx new file mode 100644 index 000000000..ecd5350d9 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/height/crud.jsx @@ -0,0 +1,57 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + container: { + fixedHeight: false + }, + table: { + scroll: { + y: null + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/height/index.vue b/packages/ui/certd-client/src/views/crud/feature/height/index.vue new file mode 100644 index 000000000..34e52d62d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/height/index.vue @@ -0,0 +1,42 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/height/mock.js b/packages/ui/certd-client/src/views/crud/feature/height/mock.js new file mode 100644 index 000000000..594f66396 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/height/mock.js @@ -0,0 +1,24 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "ComponentHeight", + idGenerator: 0 +}; +const list = [ + { + radio: "1", + button: "1", + bool: true + }, + { + radio: "2", + button: "2", + bool: false + }, + { + radio: "0", + button: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/hide/api.js b/packages/ui/certd-client/src/views/crud/feature/hide/api.js new file mode 100644 index 000000000..dd73bbf3c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/hide/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureHide"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/hide/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/hide/crud.jsx new file mode 100644 index 000000000..27d53eda0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/hide/crud.jsx @@ -0,0 +1,100 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + search: { + show: true + }, + pagination: { + show: true + }, + table: { + show: true + }, + actionbar: { + show: true, + buttons: { + add: { + show: true + }, + test: { + text: "自定义按钮", + show: true, + click() { + console.log("click"); + } + } + } + }, + toolbar: { + show: true, + buttons: { + search: { show: true }, + refresh: { show: true }, + compact: { show: true }, + export: { show: true }, + columns: { show: true } + } + }, + rowHandle: { + show: true, + width: 330, + buttons: { + view: { show: true }, + edit: { show: true }, + remove: { show: true }, + custom: { + text: "自定义", + order: 4, + show: true, + click(context) { + console.log("click", context); + } + } + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/hide/index.vue b/packages/ui/certd-client/src/views/crud/feature/hide/index.vue new file mode 100644 index 000000000..454fa5a3e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/hide/index.vue @@ -0,0 +1,184 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/hide/mock.js b/packages/ui/certd-client/src/views/crud/feature/hide/mock.js new file mode 100644 index 000000000..6876a94c7 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/hide/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureHide", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/index/api.js b/packages/ui/certd-client/src/views/crud/feature/index/api.js new file mode 100644 index 000000000..4cf33ea3a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/index/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureIndex"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/index/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/index/crud.jsx new file mode 100644 index 000000000..5c3f31050 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/index/crud.jsx @@ -0,0 +1,56 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: {}, + columns: { + _index: { + title: "序号", + form: { show: false }, + column: { + // type: "index", + align: "center", + width: "55px", + columnSetDisabled: true, //禁止在列设置中选择 + formatter: (context) => { + //计算序号,你可以自定义计算规则,此处为翻页累加 + let index = context.index ?? 1; + let pagination = expose.crudBinding.value.pagination; + return ((pagination.currentPage ?? 1) - 1) * pagination.pageSize + index + 1; + } + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/index/index.vue b/packages/ui/certd-client/src/views/crud/feature/index/index.vue new file mode 100644 index 000000000..06c33b2b8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/index/index.vue @@ -0,0 +1,39 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/index/mock.js b/packages/ui/certd-client/src/views/crud/feature/index/mock.js new file mode 100644 index 000000000..6e10439f4 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/index/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureIndex", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/local-v-model/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/local-v-model/crud.jsx new file mode 100644 index 000000000..1dbe46ff5 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/local-v-model/crud.jsx @@ -0,0 +1,32 @@ +import { uiContext } from "@fast-crud/fast-crud"; + +export default function ({ expose }) { + return { + crudOptions: { + mode:{ + name:'local', + isMergeWhenUpdate:true, + isAppendWhenAdd:true + }, + search: { + show: false + }, + toolbar:{ + show:false, + }, + pagination:{ + show:false + }, + columns: { + name: { + type: "text", + title: "联系人姓名" + }, + mobile: { + type: "text", + title: "联系人手机号码" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/local-v-model/index.vue b/packages/ui/certd-client/src/views/crud/feature/local-v-model/index.vue new file mode 100644 index 000000000..01e615f59 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/local-v-model/index.vue @@ -0,0 +1,51 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/local-v-model/local.vue b/packages/ui/certd-client/src/views/crud/feature/local-v-model/local.vue new file mode 100644 index 000000000..0110ae279 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/local-v-model/local.vue @@ -0,0 +1,67 @@ + + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/local/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/local/crud.jsx new file mode 100644 index 000000000..c0f2f6af8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/local/crud.jsx @@ -0,0 +1,35 @@ +import { uiContext } from "@fast-crud/fast-crud"; + +export default function ({ expose }) { + return { + crudOptions: { + mode: { + name: "local", + isMergeWhenUpdate: true, + isAppendWhenAdd: true + }, + actionbar: { buttons: { add: { show: true }, addRow: { show: false } } }, + editable: { + enabled: false, + mode: "row", + activeTrigger: false + }, + search: { + show: false + }, + pagination: { + show: false + }, + columns: { + name: { + type: "text", + title: "联系人姓名" + }, + mobile: { + type: "text", + title: "联系人手机号码" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/local/index.vue b/packages/ui/certd-client/src/views/crud/feature/local/index.vue new file mode 100644 index 000000000..743588f1a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/local/index.vue @@ -0,0 +1,89 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/merge/api.js b/packages/ui/certd-client/src/views/crud/feature/merge/api.js new file mode 100644 index 000000000..65dafffca --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/merge/api.js @@ -0,0 +1,43 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureMerge"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + diff --git a/packages/ui/certd-client/src/views/crud/feature/merge/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/merge/crud.jsx new file mode 100644 index 000000000..36d418971 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/merge/crud.jsx @@ -0,0 +1,129 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + /** + * 列合并render + */ + function colMergeRender({ index }) { + return { + props: { + colSpan: 5 + } + }; + } + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + slots: { + summary() { + return
总结栏
; + } + } + }, + columns: { + id: { + title: "id", + type: "text" + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + }, + cellMerge: { + title: "上下合并", + column: { + customRender: ({ text, index }, cellRender) => { + const obj = { + props: {} + }; + if (index === 2) { + obj.children = text + "(我合并了)"; + obj.props.rowSpan = 2; + } else if (index === 3) { + obj.props.rowSpan = 0; + } else { + obj.children = cellRender(); + } + return obj; + } + } + }, + colMerge1: { + title: "左右合并", + column: { + align: "center", + customRender({ text, index, record, dataIndex }, cellRender) { + if (index !== 4) { + return { + children: cellRender() + }; + } + return { + children: text + "(我合并了)", + props: { + colSpan: 2 + } + }; + } + } + }, + colMerge2: { + title: "左右合并", + column: { + customRender({ text, index, record, dataIndex }, cellRender) { + if (index !== 4) { + return { + children: cellRender() + }; + } + return { + props: { + colSpan: 0 + } + }; + } + } + }, + header1: { + title: "表头合并(我合并了)", + type: "text", + column: { + colSpan: 2 + } + }, + header2: { + title: "表头合并", + type: "text", + column: { + colSpan: 0 + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/merge/index.vue b/packages/ui/certd-client/src/views/crud/feature/merge/index.vue new file mode 100644 index 000000000..49d0ce99c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/merge/index.vue @@ -0,0 +1,39 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/merge/mock.js b/packages/ui/certd-client/src/views/crud/feature/merge/mock.js new file mode 100644 index 000000000..e99a6af50 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/merge/mock.js @@ -0,0 +1,36 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureMerge", + idGenerator: 0 +}; +const list = [ + { + radio: "1", + cellMerge: "test", + colMerge1: "111", + colMerge2: "222", + + header1: "aaa", + header2: "bbb" + }, + { + radio: "2", + cellMerge: "test", + colMerge1: "111", + colMerge2: "222", + + header1: "aaa", + header2: "bbb" + }, + { + radio: "0", + cellMerge: "test", + colMerge1: "111", + colMerge2: "222", + header1: "aaa", + header2: "bbb" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/remove/api.js b/packages/ui/certd-client/src/views/crud/feature/remove/api.js new file mode 100644 index 000000000..1d251eb79 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/remove/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureRemove"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/remove/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/remove/crud.jsx new file mode 100644 index 000000000..52a476cd3 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/remove/crud.jsx @@ -0,0 +1,74 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { Modal } from "ant-design-vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + remove: { + async confirmFn(context) { + await new Promise((resolve, reject) => { + Modal.confirm({ + content: `确定删除记录(${context.row.id})吗?`, + onOk() { + resolve(); + }, + onCancel() { + reject(); + } + }); + }); + }, + confirmTitle: "请确认", // confirmFn配置为空时生效 + confirmMessage: "确定删除此记录吗", // confirmFn配置为空时生效 + showSuccessMessage: true, //是否显示删除成功记录 + refreshTable: true, //删除后刷新表格 + onCanceled({ row }) { + console.log(`记录${row.id}取消删除`); + }, + onRemoved({ row }) { + console.log(`记录${row.id}已删除`); + } + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + text: { + title: "文本", + search: { show: true }, + type: "text" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/remove/index.vue b/packages/ui/certd-client/src/views/crud/feature/remove/index.vue new file mode 100644 index 000000000..804e85bb1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/remove/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/remove/mock.js b/packages/ui/certd-client/src/views/crud/feature/remove/mock.js new file mode 100644 index 000000000..efb116af7 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/remove/mock.js @@ -0,0 +1,25 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureRemove", + idGenerator: 0 +}; +const list = [ + { + text: "测试文本1" + }, + { + text: "测试文本2" + }, + { + text: "测试文本3" + }, + { + text: "测试文本4" + }, + { + text: "测试文本5" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/search-multi/api.js b/packages/ui/certd-client/src/views/crud/feature/search-multi/api.js new file mode 100644 index 000000000..2f83742af --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/search-multi/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureSearchMulti"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/search-multi/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/search-multi/crud.jsx new file mode 100644 index 000000000..6f9fdbd2f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/search-multi/crud.jsx @@ -0,0 +1,143 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + search: { + layout: "multi-line", + col: { + span: 4 + }, + options: { + labelCol: { + style: { + width: "100px" + } + } + } + }, + actionbar: { + buttons: { + change: { + text: "切换模式", + click() { + if (expose.crudBinding.value.search.layout === "multi-line") { + expose.crudBinding.value.search.layout = ""; + } else { + expose.crudBinding.value.search.layout = "multi-line"; + } + } + }, + search: { + text: "查询", + click() { + expose.getSearchRef().doSearch(); + } + }, + reset: { + text: "重置查询", + click() { + expose.getSearchRef().doReset(); + } + } + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }), + column: { + filters: [ + { text: "开", value: "1" }, + { text: "关", value: "0" }, + { text: "停", value: "2" } + ], + // specify the condition of filtering result + // here is that finding the name started with `value` + onFilter: (value, record) => { + return record.radio === value; + }, + sorter: (a, b) => a.radio - b.radio, + sortDirections: ["descend"] + } + }, + text1: { + type: "text", + title: "text1", + search: { show: true } + }, + text2: { + type: "text", + title: "text2", + search: { show: true } + }, + text3: { + type: "text", + title: "text3", + search: { show: true } + }, + text4: { + type: "text", + title: "text4", + search: { show: true } + }, + text5: { + type: "text", + title: "text5", + search: { show: true } + }, + text6: { + type: "text", + title: "text6", + search: { show: true } + }, + text7: { + type: "text", + title: "text7", + search: { show: true } + }, + text8: { + type: "text", + title: "text8", + search: { show: true } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/search-multi/index.vue b/packages/ui/certd-client/src/views/crud/feature/search-multi/index.vue new file mode 100644 index 000000000..6e6d96052 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/search-multi/index.vue @@ -0,0 +1,41 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/search-multi/mock.js b/packages/ui/certd-client/src/views/crud/feature/search-multi/mock.js new file mode 100644 index 000000000..0a2531527 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/search-multi/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureSearchMulti", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/search/api.js b/packages/ui/certd-client/src/views/crud/feature/search/api.js new file mode 100644 index 000000000..279509cc9 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/search/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureSearch"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/search/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/search/crud.jsx new file mode 100644 index 000000000..061395363 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/search/crud.jsx @@ -0,0 +1,91 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + // 表头过滤改变事件 + onFilterChange(e) { + console.log("onFilterChange", e); + } + }, + search: { + initialForm: { + radio: "0" + }, + buttons: { + custom: { + text: "自定义", + show: true, + order: 3, + icon: { + icon: "ant-design:search", + style: { + "font-size": "16px" + } + }, + click() { + console.log("点击了自定义按钮"); + } + } + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }), + column: { + filters: [ + { text: "开", value: "1" }, + { text: "关", value: "0" }, + { text: "停", value: "2" } + ], + // specify the condition of filtering result + // here is that finding the name started with `value` + onFilter: (value, record) => { + return record.radio === value; + }, + sorter: (a, b) => a.radio - b.radio, + sortDirections: ["descend"] + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/search/index.vue b/packages/ui/certd-client/src/views/crud/feature/search/index.vue new file mode 100644 index 000000000..e36b8dff1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/search/index.vue @@ -0,0 +1,57 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/search/mock.js b/packages/ui/certd-client/src/views/crud/feature/search/mock.js new file mode 100644 index 000000000..a6741fa06 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/search/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureSearch", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/selection-radio/api.js b/packages/ui/certd-client/src/views/crud/feature/selection-radio/api.js new file mode 100644 index 000000000..1d86caa21 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/selection-radio/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureSelection"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/selection-radio/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/selection-radio/crud.jsx new file mode 100644 index 000000000..18efb25f8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/selection-radio/crud.jsx @@ -0,0 +1,67 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + const selectedRowKey = ref(); + const onSelectChange = (changed) => { + console.log("selection", changed); + selectedRowKey.value = changed; + }; + return { + selectedRowKey, //返回给index.vue去使用 + crudOptions: { + table: { + rowKey: "id", + rowSelection: { + type: "radio", + selectedRowKeys: selectedRowKey, + onChange: onSelectChange, + getCheckboxProps: (record) => ({ + disabled: record.id === 1 // 此处演示第一行禁用 + }) + } + }, + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/selection-radio/index.vue b/packages/ui/certd-client/src/views/crud/feature/selection-radio/index.vue new file mode 100644 index 000000000..57386c5a6 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/selection-radio/index.vue @@ -0,0 +1,45 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/selection-radio/mock.js b/packages/ui/certd-client/src/views/crud/feature/selection-radio/mock.js new file mode 100644 index 000000000..b9b0bade6 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/selection-radio/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureSelection", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/selection/api.js b/packages/ui/certd-client/src/views/crud/feature/selection/api.js new file mode 100644 index 000000000..1d86caa21 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/selection/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureSelection"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/selection/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/selection/crud.jsx new file mode 100644 index 000000000..9ac917e3b --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/selection/crud.jsx @@ -0,0 +1,67 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + const selectedRowKeys = ref([]); + + const onSelectChange = (changed) => { + console.log("selection", changed); + selectedRowKeys.value = changed; + }; + return { + selectedRowKeys, //返回给index.vue去使用 + crudOptions: { + table: { + rowKey: "id", + rowSelection: { + selectedRowKeys: selectedRowKeys, + onChange: onSelectChange, + getCheckboxProps: (record) => ({ + disabled: record.id === 1 // 此处演示第一行禁用 + }) + } + }, + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/selection/index.vue b/packages/ui/certd-client/src/views/crud/feature/selection/index.vue new file mode 100644 index 000000000..7a84d6c29 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/selection/index.vue @@ -0,0 +1,68 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/selection/mock.js b/packages/ui/certd-client/src/views/crud/feature/selection/mock.js new file mode 100644 index 000000000..b9b0bade6 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/selection/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureSelection", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/sortable/api.js b/packages/ui/certd-client/src/views/crud/feature/sortable/api.js new file mode 100644 index 000000000..17fe338f5 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/sortable/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureSortable"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/sortable/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/sortable/crud.jsx new file mode 100644 index 000000000..0b00b387a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/sortable/crud.jsx @@ -0,0 +1,62 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest: api.GetList, + addRequest, + editRequest, + delRequest + }, + columns: { + radio: { + title: "本地排序", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }), + column: { + sorter(a, b) { + return a.radio < b.radio ? 1 : -1; + } + } + }, + radio1: { + title: "服务端排序1", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }), + column: { + sorter: true + } + }, + radio2: { + title: "服务端排序2", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }), + column: { + sorter: true + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/sortable/index.vue b/packages/ui/certd-client/src/views/crud/feature/sortable/index.vue new file mode 100644 index 000000000..1d3e59455 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/sortable/index.vue @@ -0,0 +1,39 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/sortable/mock.js b/packages/ui/certd-client/src/views/crud/feature/sortable/mock.js new file mode 100644 index 000000000..5bb6d0e69 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/sortable/mock.js @@ -0,0 +1,25 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureSortable", + idGenerator: 0 +}; +const list = [ + { + radio: "1", + radio1: "1", + radio2: "2" + }, + { + radio: "2", + radio1: "2", + radio2: "0" + }, + { + radio: "0", + radio1: "0", + radio2: "1" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/tree/api.js b/packages/ui/certd-client/src/views/crud/feature/tree/api.js new file mode 100644 index 000000000..771633983 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/tree/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureTree"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/tree/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/tree/crud.jsx new file mode 100644 index 000000000..b47c3fa96 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/tree/crud.jsx @@ -0,0 +1,91 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; + +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + const selectedRowKeys = ref([]); + + const onSelectChange = (changed) => { + console.log("selection", changed); + selectedRowKeys.value = changed; + }; + return { + selectedRowKeys, //返回给index.vue去使用 + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + table: { + rowSelection: { selectedRowKeys: selectedRowKeys, onChange: onSelectChange } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 100 + }, + form: { + show: false + } + }, + time: { + title: "时间", + type: "datetime", + column: { + width: 180 + } + }, + province: { + title: "地区", + type: "dict-select", + search: { show: true }, + form: { + component: { filterable: true, multiple: true } + }, + dict: dict({ + data: [ + { value: "sz", label: "深圳" }, + { value: "gz", label: "广州" }, + { value: "wh", label: "武汉" }, + { value: "sh", label: "上海" } + ] + }), + column: { + width: 300 + } + }, + amount: { + title: "金额(元)", + key: "amount" + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/tree/index.vue b/packages/ui/certd-client/src/views/crud/feature/tree/index.vue new file mode 100644 index 000000000..b9240eac1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/tree/index.vue @@ -0,0 +1,65 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/tree/mock.js b/packages/ui/certd-client/src/views/crud/feature/tree/mock.js new file mode 100644 index 000000000..f1df3badc --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/tree/mock.js @@ -0,0 +1,85 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureTree", + idGenerator: 0 +}; +const list = [ + { + radio: "1", + data: "我会懒加载", + time: "2020-01-01 11:11:11", + province: "wh", + amount: 100, + hasChildren: true, + loaded: false, + children: [ + { + data: "懒加载的子数据", + province: ["sh", "gz"], + time: "2020-01-01 11:11:11", + amount: 100 + }, + { + data: "懒加载的子数据2", + province: ["sh", "sz"], + time: "2020-01-01 11:11:11", + amount: 100 + } + ] + }, + { + data: "data2", + province: "sh", + time: "2020-01-01 11:11:11", + amount: 100, + children: [ + { + id: 999, + data: "data1_1", + time: "2020-01-01 11:11:11", + province: ["gz", "sz"], // 可以逗号分隔的字符串 'gz,sz' + amount: 100, + children: [ + { + id: 1000, + data: "data1_1_1", + time: "2020-01-01 11:11:11", + province: ["sz", "gz"], // 可以逗号分隔的字符串 'gz,sz' + amount: 100 + } + ] + }, + { + id: 888, + data: "data1_2", + time: "2020-01-01 11:11:11", + province: "sh", + amount: 100, + children: [ + { + id: 889, + data: "data1_2_1", + time: "2020-01-01 11:11:11", + province: "gz", + amount: 100 + } + ] + } + ] + }, + { + data: "data3", + province: ["sh", "gz"], + time: "2020-01-01 11:11:11", + amount: 100 + }, + { + data: "data4", + province: ["sh", "sz"], + time: "2020-01-01 11:11:11", + amount: 100 + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/feature/value-builder/api.js b/packages/ui/certd-client/src/views/crud/feature/value-builder/api.js new file mode 100644 index 000000000..09e547c6a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/value-builder/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FeatureValueBuilder"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/feature/value-builder/crud.jsx b/packages/ui/certd-client/src/views/crud/feature/value-builder/crud.jsx new file mode 100644 index 000000000..b44f24830 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/value-builder/crud.jsx @@ -0,0 +1,54 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest: api.GetList, + addRequest, + editRequest, + delRequest + }, + columns: { + name: { + title: "姓名", + type: "text" + }, + roles: { + title: "角色", + search: { show: true }, + type: "dict-select", + dict: dict({ + value: "id", + label: "name", + data: [ + { id: 1, name: "管理员" }, + { id: 2, name: "普通用户" } + ] + }), + form: { + component: { + mode: "multiple" + }, + valueBuilder({ form }) { + if (form.roles) { + form.roles = form.roles.map((item) => item.id); + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/feature/value-builder/index.vue b/packages/ui/certd-client/src/views/crud/feature/value-builder/index.vue new file mode 100644 index 000000000..156b4e5bf --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/value-builder/index.vue @@ -0,0 +1,46 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/feature/value-builder/mock.js b/packages/ui/certd-client/src/views/crud/feature/value-builder/mock.js new file mode 100644 index 000000000..8c86a37e1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/feature/value-builder/mock.js @@ -0,0 +1,21 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "FeatureValueBuilder", + idGenerator: 0 +}; +const list = [ + { + name: "user1", + roles: [ + { id: 1, name: "管理员" }, + { id: 2, name: "普通用户" } + ] + }, + { + name: "user2", + roles: [{ id: 1, name: "管理员" }] + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/base/api.js b/packages/ui/certd-client/src/views/crud/form/base/api.js new file mode 100644 index 000000000..cff9ab911 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/base/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormBase"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/base/crud.jsx b/packages/ui/certd-client/src/views/crud/form/base/crud.jsx new file mode 100644 index 000000000..26220cee2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/base/crud.jsx @@ -0,0 +1,55 @@ +import * as api from "./api"; +export default function ({ crudExpose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + wrapper: { + buttons: { + ok: { + text: "保存" + } + } + } + }, + columns: { + name: { + title: "姓名", + type: "text" + }, + renderLabel: { + title: "labelRender", + type: "text", + form: { + title(context) { + console.log("render label context:", context); + return
LabelRender
; + }, + helper: { + text: "配置form.title为一个render方法即可自定义label" + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/base/index.vue b/packages/ui/certd-client/src/views/crud/form/base/index.vue new file mode 100644 index 000000000..c7a2168c1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/base/index.vue @@ -0,0 +1,31 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/base/mock.js b/packages/ui/certd-client/src/views/crud/form/base/mock.js new file mode 100644 index 000000000..bb0fe7b99 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/base/mock.js @@ -0,0 +1,310 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormBase", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + age: 15, + password: "", + status: "2", + url: "https://baidu.com" + }, + { + name: "张三", + age: 18, + password: "", + url: "https://baidu.com" + }, + { + status: "2" + } +]; + +const dictData = [ + { + value: "zhinan", + label: "指南", + children: [ + { + value: "shejiyuanze", + label: "设计原则", + children: [ + { + value: "yizhi", + label: "一致" + }, + { + value: "fankui", + label: "反馈" + }, + { + value: "xiaolv", + label: "效率" + }, + { + value: "kekong", + label: "可控" + } + ] + }, + { + value: "daohang", + label: "导航", + children: [ + { + value: "cexiangdaohang", + label: "侧向导航" + }, + { + value: "dingbudaohang", + label: "顶部导航" + } + ] + } + ] + }, + { + value: "zujian", + label: "组件", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout 布局" + }, + { + value: "color", + label: "Color 色彩" + }, + { + value: "typography", + label: "Typography 字体" + }, + { + value: "icon", + label: "Icon 图标" + }, + { + value: "button", + label: "Button 按钮" + } + ] + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio 单选框" + }, + { + value: "checkbox", + label: "Checkbox 多选框" + }, + { + value: "input", + label: "Input 输入框" + }, + { + value: "input-number", + label: "InputNumber 计数器" + }, + { + value: "select", + label: "Select 选择器" + }, + { + value: "cascader", + label: "Cascader 级联选择器" + }, + { + value: "switch", + label: "Switch 开关" + }, + { + value: "slider", + label: "Slider 滑块" + }, + { + value: "time-picker", + label: "TimePicker 时间选择器" + }, + { + value: "date-picker", + label: "DatePicker 日期选择器" + }, + { + value: "datetime-picker", + label: "DateTimePicker 日期时间选择器" + }, + { + value: "upload", + label: "Upload 上传" + }, + { + value: "rate", + label: "Rate 评分" + }, + { + value: "form", + label: "Form 表单" + } + ] + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table 表格" + }, + { + value: "tag", + label: "Tag 标签" + }, + { + value: "progress", + label: "Progress 进度条" + }, + { + value: "tree", + label: "Tree 树形控件" + }, + { + value: "pagination", + label: "Pagination 分页" + }, + { + value: "badge", + label: "Badge 标记" + } + ] + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert 警告" + }, + { + value: "loading", + label: "Loading 加载" + }, + { + value: "message", + label: "Message 消息提示" + }, + { + value: "message-box", + label: "MessageBox 弹框" + }, + { + value: "notification", + label: "Notification 通知" + } + ] + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "NavMenu 导航菜单" + }, + { + value: "tabs", + label: "Tabs 标签页" + }, + { + value: "breadcrumb", + label: "Breadcrumb 面包屑" + }, + { + value: "dropdown", + label: "Dropdown 下拉菜单" + }, + { + value: "steps", + label: "Steps 步骤条" + } + ] + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog 对话框" + }, + { + value: "tooltip", + label: "Tooltip 文字提示" + }, + { + value: "popover", + label: "Popover 弹出框" + }, + { + value: "card", + label: "Card 卡片" + }, + { + value: "carousel", + label: "Carousel 走马灯" + }, + { + value: "collapse", + label: "Collapse 折叠面板" + } + ] + } + ] + }, + { + value: "ziyuan", + label: "资源", + children: [ + { + value: "axure", + label: "Axure Components" + }, + { + value: "sketch", + label: "Sketch Templates" + }, + { + value: "jiaohu", + label: "组件交互文档" + } + ] + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +mock.push({ + path: "/select/cascadeData", + method: "get", + handle(req) { + return { + code: 0, + msg: "success", + data: dictData + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/custom-form/api.js b/packages/ui/certd-client/src/views/crud/form/custom-form/api.js new file mode 100644 index 000000000..1cab36020 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/custom-form/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormCustomForm"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/custom-form/crud.jsx b/packages/ui/certd-client/src/views/crud/form/custom-form/crud.jsx new file mode 100644 index 000000000..875a80636 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/custom-form/crud.jsx @@ -0,0 +1,40 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const { getFormRef, getFormData } = expose; + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + title: { + title: "商品标题", + type: "text" + }, + code: { + title: "商品代码", + search: { show: true }, + type: "text" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/custom-form/index.vue b/packages/ui/certd-client/src/views/crud/form/custom-form/index.vue new file mode 100644 index 000000000..faa3c2be1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/custom-form/index.vue @@ -0,0 +1,86 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/custom-form/mock.js b/packages/ui/certd-client/src/views/crud/form/custom-form/mock.js new file mode 100644 index 000000000..479b89b43 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/custom-form/mock.js @@ -0,0 +1,303 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormCustomForm", + idGenerator: 0 +}; +const list = [ + { + title: "无线充电宝", + code: "100001", + images: "https://img0.bdstatic.com/static/searchdetail/img/logo-2X_0c4ef02.png", + price: 100, + stock: 99, + intro: "30000毫安超大容量移动电源充电宝官方原装正品专用便携", + content: "" + } +]; + +const dictData = [ + { + value: "zhinan", + label: "指南", + children: [ + { + value: "shejiyuanze", + label: "设计原则", + children: [ + { + value: "yizhi", + label: "一致" + }, + { + value: "fankui", + label: "反馈" + }, + { + value: "xiaolv", + label: "效率" + }, + { + value: "kekong", + label: "可控" + } + ] + }, + { + value: "daohang", + label: "导航", + children: [ + { + value: "cexiangdaohang", + label: "侧向导航" + }, + { + value: "dingbudaohang", + label: "顶部导航" + } + ] + } + ] + }, + { + value: "zujian", + label: "组件", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout 布局" + }, + { + value: "color", + label: "Color 色彩" + }, + { + value: "typography", + label: "Typography 字体" + }, + { + value: "icon", + label: "Icon 图标" + }, + { + value: "button", + label: "Button 按钮" + } + ] + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio 单选框" + }, + { + value: "checkbox", + label: "Checkbox 多选框" + }, + { + value: "input", + label: "Input 输入框" + }, + { + value: "input-number", + label: "InputNumber 计数器" + }, + { + value: "select", + label: "Select 选择器" + }, + { + value: "cascader", + label: "Cascader 级联选择器" + }, + { + value: "switch", + label: "Switch 开关" + }, + { + value: "slider", + label: "Slider 滑块" + }, + { + value: "time-picker", + label: "TimePicker 时间选择器" + }, + { + value: "date-picker", + label: "DatePicker 日期选择器" + }, + { + value: "datetime-picker", + label: "DateTimePicker 日期时间选择器" + }, + { + value: "upload", + label: "Upload 上传" + }, + { + value: "rate", + label: "Rate 评分" + }, + { + value: "form", + label: "Form 表单" + } + ] + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table 表格" + }, + { + value: "tag", + label: "Tag 标签" + }, + { + value: "progress", + label: "Progress 进度条" + }, + { + value: "tree", + label: "Tree 树形控件" + }, + { + value: "pagination", + label: "Pagination 分页" + }, + { + value: "badge", + label: "Badge 标记" + } + ] + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert 警告" + }, + { + value: "loading", + label: "Loading 加载" + }, + { + value: "message", + label: "Message 消息提示" + }, + { + value: "message-box", + label: "MessageBox 弹框" + }, + { + value: "notification", + label: "Notification 通知" + } + ] + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "NavMenu 导航菜单" + }, + { + value: "tabs", + label: "Tabs 标签页" + }, + { + value: "breadcrumb", + label: "Breadcrumb 面包屑" + }, + { + value: "dropdown", + label: "Dropdown 下拉菜单" + }, + { + value: "steps", + label: "Steps 步骤条" + } + ] + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog 对话框" + }, + { + value: "tooltip", + label: "Tooltip 文字提示" + }, + { + value: "popover", + label: "Popover 弹出框" + }, + { + value: "card", + label: "Card 卡片" + }, + { + value: "carousel", + label: "Carousel 走马灯" + }, + { + value: "collapse", + label: "Collapse 折叠面板" + } + ] + } + ] + }, + { + value: "ziyuan", + label: "资源", + children: [ + { + value: "axure", + label: "Axure Components" + }, + { + value: "sketch", + label: "Sketch Templates" + }, + { + value: "jiaohu", + label: "组件交互文档" + } + ] + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +mock.push({ + path: "/select/cascadeData", + method: "get", + handle(req) { + return { + code: 0, + msg: "success", + data: dictData + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/drawer/api.js b/packages/ui/certd-client/src/views/crud/form/drawer/api.js new file mode 100644 index 000000000..b9e50dc64 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/drawer/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/formText"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/drawer/crud.jsx b/packages/ui/certd-client/src/views/crud/form/drawer/crud.jsx new file mode 100644 index 000000000..bf6e0c5fa --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/drawer/crud.jsx @@ -0,0 +1,44 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + wrapper: { + is: "a-drawer" + } + }, + columns: { + name: { + title: "姓名", + type: "text", //虽然不写也能正确显示组件,但不建议省略它 + search: { show: true }, + form: { + component: { + maxlength: 20 + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/drawer/index.vue b/packages/ui/certd-client/src/views/crud/form/drawer/index.vue new file mode 100644 index 000000000..5143f074e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/drawer/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/drawer/mock.js b/packages/ui/certd-client/src/views/crud/form/drawer/mock.js new file mode 100644 index 000000000..fcf01621e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/drawer/mock.js @@ -0,0 +1,40 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "formText", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + date: "2016-05-02", + status: "0", + province: "1", + avatar: "https://alicdn.antdv.com/vue.png", + show: true, + city: "sz", + address: "123123", + zip: "518000", + intro: "王小虎是element-plus的table示例出现的名字" + }, + { + name: "张三", + date: "2016-05-04", + status: "1", + province: "2" + }, + { + name: "李四", + date: 2232433534511, + status: "1", + province: "0" + }, + { + name: "王五", + date: "2016-05-03", + status: "2", + province: "wh,gz" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/group-tabs/api.js b/packages/ui/certd-client/src/views/crud/form/group-tabs/api.js new file mode 100644 index 000000000..a059b9001 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/group-tabs/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormGroupTabs"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/group-tabs/crud.jsx b/packages/ui/certd-client/src/views/crud/form/group-tabs/crud.jsx new file mode 100644 index 000000000..74dbfb0b3 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/group-tabs/crud.jsx @@ -0,0 +1,114 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const { getFormRef, getFormData } = expose; + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + title: { + title: "商品标题", + type: "text" + }, + code: { + title: "商品代码", + search: { show: true }, + type: "text", + form: { + rules: [{ required: true, message: "此项必填" }] + } + }, + images: { + title: "图片", + type: "image-uploader" + }, + price: { + title: "价格", + sortable: true + }, + store: { + title: "库存", + type: "number" + }, + intro: { + title: "简介", + type: "textarea", + column: { + ellipsis: true, + showTitle: true + } + }, + content: { + title: "详情", + type: "editor-ueditor", + form: { + labelWidth: "0px" + } + } + }, + form: { + group: { + groupType: "tabs", //collapse, tabs + accordion: false, + groups: { + base: { + slots: { + tab: (scope) => { + return ( + + + 商品基础 + + ); + } + }, + icon: "el-icon-goods", + columns: ["code", "title", "images"] + }, + price: { + tab: "库存价格", + icon: "el-icon-price-tag", + columns: ["store", "price"] + }, + info: { + tab: "详情", + collapsed: true, //默认折叠 + icon: "el-icon-warning-outline", + columns: ["intro", "content"] + } + // custom: { + // title: "自定义", + // collapsed: false, + // show(context) { + // console.log("custom context", context); + // return context.mode === "view"; + // }, + // disabled: false, + // icon: "el-icon-warning-outline", + // columns: ["custom", "custom2"] + // } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/group-tabs/index.vue b/packages/ui/certd-client/src/views/crud/form/group-tabs/index.vue new file mode 100644 index 000000000..3d65edece --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/group-tabs/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/group-tabs/mock.js b/packages/ui/certd-client/src/views/crud/form/group-tabs/mock.js new file mode 100644 index 000000000..bc980fa87 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/group-tabs/mock.js @@ -0,0 +1,303 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormGroupTabs", + idGenerator: 0 +}; +const list = [ + { + title: "无线充电宝", + code: "100001", + images: "https://img0.bdstatic.com/static/searchdetail/img/logo-2X_0c4ef02.png", + price: 100, + stock: 99, + intro: "30000毫安超大容量移动电源充电宝官方原装正品专用便携", + content: "" + } +]; + +const dictData = [ + { + value: "zhinan", + label: "指南", + children: [ + { + value: "shejiyuanze", + label: "设计原则", + children: [ + { + value: "yizhi", + label: "一致" + }, + { + value: "fankui", + label: "反馈" + }, + { + value: "xiaolv", + label: "效率" + }, + { + value: "kekong", + label: "可控" + } + ] + }, + { + value: "daohang", + label: "导航", + children: [ + { + value: "cexiangdaohang", + label: "侧向导航" + }, + { + value: "dingbudaohang", + label: "顶部导航" + } + ] + } + ] + }, + { + value: "zujian", + label: "组件", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout 布局" + }, + { + value: "color", + label: "Color 色彩" + }, + { + value: "typography", + label: "Typography 字体" + }, + { + value: "icon", + label: "Icon 图标" + }, + { + value: "button", + label: "Button 按钮" + } + ] + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio 单选框" + }, + { + value: "checkbox", + label: "Checkbox 多选框" + }, + { + value: "input", + label: "Input 输入框" + }, + { + value: "input-number", + label: "InputNumber 计数器" + }, + { + value: "select", + label: "Select 选择器" + }, + { + value: "cascader", + label: "Cascader 级联选择器" + }, + { + value: "switch", + label: "Switch 开关" + }, + { + value: "slider", + label: "Slider 滑块" + }, + { + value: "time-picker", + label: "TimePicker 时间选择器" + }, + { + value: "date-picker", + label: "DatePicker 日期选择器" + }, + { + value: "datetime-picker", + label: "DateTimePicker 日期时间选择器" + }, + { + value: "upload", + label: "Upload 上传" + }, + { + value: "rate", + label: "Rate 评分" + }, + { + value: "form", + label: "Form 表单" + } + ] + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table 表格" + }, + { + value: "tag", + label: "Tag 标签" + }, + { + value: "progress", + label: "Progress 进度条" + }, + { + value: "tree", + label: "Tree 树形控件" + }, + { + value: "pagination", + label: "Pagination 分页" + }, + { + value: "badge", + label: "Badge 标记" + } + ] + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert 警告" + }, + { + value: "loading", + label: "Loading 加载" + }, + { + value: "message", + label: "Message 消息提示" + }, + { + value: "message-box", + label: "MessageBox 弹框" + }, + { + value: "notification", + label: "Notification 通知" + } + ] + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "NavMenu 导航菜单" + }, + { + value: "tabs", + label: "Tabs 标签页" + }, + { + value: "breadcrumb", + label: "Breadcrumb 面包屑" + }, + { + value: "dropdown", + label: "Dropdown 下拉菜单" + }, + { + value: "steps", + label: "Steps 步骤条" + } + ] + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog 对话框" + }, + { + value: "tooltip", + label: "Tooltip 文字提示" + }, + { + value: "popover", + label: "Popover 弹出框" + }, + { + value: "card", + label: "Card 卡片" + }, + { + value: "carousel", + label: "Carousel 走马灯" + }, + { + value: "collapse", + label: "Collapse 折叠面板" + } + ] + } + ] + }, + { + value: "ziyuan", + label: "资源", + children: [ + { + value: "axure", + label: "Axure Components" + }, + { + value: "sketch", + label: "Sketch Templates" + }, + { + value: "jiaohu", + label: "组件交互文档" + } + ] + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +mock.push({ + path: "/select/cascadeData", + method: "get", + handle(req) { + return { + code: 0, + msg: "success", + data: dictData + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/group/api.js b/packages/ui/certd-client/src/views/crud/form/group/api.js new file mode 100644 index 000000000..b1fcf8560 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/group/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormGroup"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/group/crud.jsx b/packages/ui/certd-client/src/views/crud/form/group/crud.jsx new file mode 100644 index 000000000..8016d35e4 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/group/crud.jsx @@ -0,0 +1,143 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + title: { + title: "商品标题", + type: "text" + }, + code: { + title: "商品代码", + search: { show: true }, + type: "text" + }, + images: { + title: "图片", + type: "image-uploader" + }, + price: { + title: "价格", + sortable: true + }, + store: { + title: "库存", + type: "number" + }, + intro: { + title: "简介", + type: "textarea", + column: { + ellipsis: true, + showTitle: true + } + }, + content: { + title: "详情", + type: "editor-ueditor", + form: { + labelWidth: "0px" + } + }, + slotField: { + title: "插槽示例", + type: "text" + }, + product: { + title: "未分组字段", + type: "text", + form: { + col: { span: 24 }, + helper: "未分组的字段会显示在这里,一般来说你应该把所有字段都编入分组内" + } + }, + hidden1: { + title: "隐藏1", + type: "text", + form: { + show: false + }, + column: { + show: false + } + }, + hidden2: { + title: "隐藏2", + type: "text", + form: { + show: false + }, + column: { + show: false + } + } + }, + form: { + group: { + type: "collapse", // tab + accordion: true, //手风琴模式 + groups: { + base: { + slots: { + //自定义header + header: () => { + return ( + + 商品基础 + + + ); + } + }, + columns: ["code", "title", "images", "invalidKey"] + }, + price: { + header: "库存价格", + columns: ["store", "price"] + }, + info: { + header: "详情", + collapsed: true, //默认折叠 + columns: ["intro", "content", "slotField"] + }, + hiddenTest: { + header: "分组隐藏测试", //如果组里面的所有的组件都配置了隐藏,则本分组隐藏 + columns: ["hidden1", "hidden2"] + } + // custom: { + // title: "自定义", + // collapsed: false, + // show(context) { + // console.log("custom context", context); + // return context.mode === "view"; + // }, + // disabled: false, + // icon: "el-icon-warning-outline", + // columns: ["custom", "custom2"] + // } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/group/index.vue b/packages/ui/certd-client/src/views/crud/form/group/index.vue new file mode 100644 index 000000000..14e290c72 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/group/index.vue @@ -0,0 +1,46 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/group/mock.js b/packages/ui/certd-client/src/views/crud/form/group/mock.js new file mode 100644 index 000000000..70d8f4d4d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/group/mock.js @@ -0,0 +1,303 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormGroup", + idGenerator: 0 +}; +const list = [ + { + title: "无线充电宝", + code: "100001", + images: "https://img0.bdstatic.com/static/searchdetail/img/logo-2X_0c4ef02.png", + price: 100, + stock: 99, + intro: "30000毫安超大容量移动电源充电宝官方原装正品专用便携", + content: "" + } +]; + +const dictData = [ + { + value: "zhinan", + label: "指南", + children: [ + { + value: "shejiyuanze", + label: "设计原则", + children: [ + { + value: "yizhi", + label: "一致" + }, + { + value: "fankui", + label: "反馈" + }, + { + value: "xiaolv", + label: "效率" + }, + { + value: "kekong", + label: "可控" + } + ] + }, + { + value: "daohang", + label: "导航", + children: [ + { + value: "cexiangdaohang", + label: "侧向导航" + }, + { + value: "dingbudaohang", + label: "顶部导航" + } + ] + } + ] + }, + { + value: "zujian", + label: "组件", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout 布局" + }, + { + value: "color", + label: "Color 色彩" + }, + { + value: "typography", + label: "Typography 字体" + }, + { + value: "icon", + label: "Icon 图标" + }, + { + value: "button", + label: "Button 按钮" + } + ] + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio 单选框" + }, + { + value: "checkbox", + label: "Checkbox 多选框" + }, + { + value: "input", + label: "Input 输入框" + }, + { + value: "input-number", + label: "InputNumber 计数器" + }, + { + value: "select", + label: "Select 选择器" + }, + { + value: "cascader", + label: "Cascader 级联选择器" + }, + { + value: "switch", + label: "Switch 开关" + }, + { + value: "slider", + label: "Slider 滑块" + }, + { + value: "time-picker", + label: "TimePicker 时间选择器" + }, + { + value: "date-picker", + label: "DatePicker 日期选择器" + }, + { + value: "datetime-picker", + label: "DateTimePicker 日期时间选择器" + }, + { + value: "upload", + label: "Upload 上传" + }, + { + value: "rate", + label: "Rate 评分" + }, + { + value: "form", + label: "Form 表单" + } + ] + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table 表格" + }, + { + value: "tag", + label: "Tag 标签" + }, + { + value: "progress", + label: "Progress 进度条" + }, + { + value: "tree", + label: "Tree 树形控件" + }, + { + value: "pagination", + label: "Pagination 分页" + }, + { + value: "badge", + label: "Badge 标记" + } + ] + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert 警告" + }, + { + value: "loading", + label: "Loading 加载" + }, + { + value: "message", + label: "Message 消息提示" + }, + { + value: "message-box", + label: "MessageBox 弹框" + }, + { + value: "notification", + label: "Notification 通知" + } + ] + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "NavMenu 导航菜单" + }, + { + value: "tabs", + label: "Tabs 标签页" + }, + { + value: "breadcrumb", + label: "Breadcrumb 面包屑" + }, + { + value: "dropdown", + label: "Dropdown 下拉菜单" + }, + { + value: "steps", + label: "Steps 步骤条" + } + ] + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog 对话框" + }, + { + value: "tooltip", + label: "Tooltip 文字提示" + }, + { + value: "popover", + label: "Popover 弹出框" + }, + { + value: "card", + label: "Card 卡片" + }, + { + value: "carousel", + label: "Carousel 走马灯" + }, + { + value: "collapse", + label: "Collapse 折叠面板" + } + ] + } + ] + }, + { + value: "ziyuan", + label: "资源", + children: [ + { + value: "axure", + label: "Axure Components" + }, + { + value: "sketch", + label: "Sketch Templates" + }, + { + value: "jiaohu", + label: "组件交互文档" + } + ] + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +mock.push({ + path: "/select/cascadeData", + method: "get", + handle(req) { + return { + code: 0, + msg: "success", + data: dictData + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/helper/api.js b/packages/ui/certd-client/src/views/crud/form/helper/api.js new file mode 100644 index 000000000..aa8f08902 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/helper/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormHelper"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/helper/crud.jsx b/packages/ui/certd-client/src/views/crud/form/helper/crud.jsx new file mode 100644 index 000000000..e9946e84f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/helper/crud.jsx @@ -0,0 +1,72 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + labelCol: { span: 6 }, + wrapperCol: { span: 16 }, + helper: { + // position: "label" // helper的展示位置全局配置 + // tooltip:{} + } + }, + columns: { + name: { + title: "最简单", + type: "text", + form: { + helper: "最简单的helper\n换行测试" + } + }, + age: { + title: "jsx", + type: "text", + form: { + helper: { + render() { + return
jsx自定义render
; + } + } + } + }, + status: { + title: "显示在label", + type: "text", + form: { + rules: [{ required: true, message: "此项必填" }], + helper: { + position: "label", + tooltip: { + placement: "topLeft" + }, + text: "在label通过tooltip方式显示的helper\n换行测试" + // render() { + // return
在label通过tooltip方式显示的helper
; + // } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/helper/index.vue b/packages/ui/certd-client/src/views/crud/form/helper/index.vue new file mode 100644 index 000000000..440574488 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/helper/index.vue @@ -0,0 +1,48 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/helper/mock.js b/packages/ui/certd-client/src/views/crud/form/helper/mock.js new file mode 100644 index 000000000..92b3dacaa --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/helper/mock.js @@ -0,0 +1,310 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormHelper", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + age: 15, + password: "", + status: "2", + url: "https://baidu.com" + }, + { + name: "张三", + age: 18, + password: "", + url: "https://baidu.com" + }, + { + status: "2" + } +]; + +const dictData = [ + { + value: "zhinan", + label: "指南", + children: [ + { + value: "shejiyuanze", + label: "设计原则", + children: [ + { + value: "yizhi", + label: "一致" + }, + { + value: "fankui", + label: "反馈" + }, + { + value: "xiaolv", + label: "效率" + }, + { + value: "kekong", + label: "可控" + } + ] + }, + { + value: "daohang", + label: "导航", + children: [ + { + value: "cexiangdaohang", + label: "侧向导航" + }, + { + value: "dingbudaohang", + label: "顶部导航" + } + ] + } + ] + }, + { + value: "zujian", + label: "组件", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout 布局" + }, + { + value: "color", + label: "Color 色彩" + }, + { + value: "typography", + label: "Typography 字体" + }, + { + value: "icon", + label: "Icon 图标" + }, + { + value: "button", + label: "Button 按钮" + } + ] + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio 单选框" + }, + { + value: "checkbox", + label: "Checkbox 多选框" + }, + { + value: "input", + label: "Input 输入框" + }, + { + value: "input-number", + label: "InputNumber 计数器" + }, + { + value: "select", + label: "Select 选择器" + }, + { + value: "cascader", + label: "Cascader 级联选择器" + }, + { + value: "switch", + label: "Switch 开关" + }, + { + value: "slider", + label: "Slider 滑块" + }, + { + value: "time-picker", + label: "TimePicker 时间选择器" + }, + { + value: "date-picker", + label: "DatePicker 日期选择器" + }, + { + value: "datetime-picker", + label: "DateTimePicker 日期时间选择器" + }, + { + value: "upload", + label: "Upload 上传" + }, + { + value: "rate", + label: "Rate 评分" + }, + { + value: "form", + label: "Form 表单" + } + ] + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table 表格" + }, + { + value: "tag", + label: "Tag 标签" + }, + { + value: "progress", + label: "Progress 进度条" + }, + { + value: "tree", + label: "Tree 树形控件" + }, + { + value: "pagination", + label: "Pagination 分页" + }, + { + value: "badge", + label: "Badge 标记" + } + ] + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert 警告" + }, + { + value: "loading", + label: "Loading 加载" + }, + { + value: "message", + label: "Message 消息提示" + }, + { + value: "message-box", + label: "MessageBox 弹框" + }, + { + value: "notification", + label: "Notification 通知" + } + ] + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "NavMenu 导航菜单" + }, + { + value: "tabs", + label: "Tabs 标签页" + }, + { + value: "breadcrumb", + label: "Breadcrumb 面包屑" + }, + { + value: "dropdown", + label: "Dropdown 下拉菜单" + }, + { + value: "steps", + label: "Steps 步骤条" + } + ] + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog 对话框" + }, + { + value: "tooltip", + label: "Tooltip 文字提示" + }, + { + value: "popover", + label: "Popover 弹出框" + }, + { + value: "card", + label: "Card 卡片" + }, + { + value: "carousel", + label: "Carousel 走马灯" + }, + { + value: "collapse", + label: "Collapse 折叠面板" + } + ] + } + ] + }, + { + value: "ziyuan", + label: "资源", + children: [ + { + value: "axure", + label: "Axure Components" + }, + { + value: "sketch", + label: "Sketch Templates" + }, + { + value: "jiaohu", + label: "组件交互文档" + } + ] + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +mock.push({ + path: "/select/cascadeData", + method: "get", + handle(req) { + return { + code: 0, + msg: "success", + data: dictData + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/independent/crud.jsx b/packages/ui/certd-client/src/views/crud/form/independent/crud.jsx new file mode 100644 index 000000000..7e492d640 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/independent/crud.jsx @@ -0,0 +1,59 @@ +export default function ({ expose }) { + return { + crudOptions: { + form: { + wrapper: { + onClosed(e) { + console.log("onClosed", e); + }, + onOpened(e) { + console.log("onOpened", e); + } + }, + labelCol: { span: 6 }, + wrapperCol: { span: 16 }, + helper: { + // position: "label" // helper的展示位置全局配置 + // tooltip:{} + } + }, + columns: { + name: { + title: "最简单", + type: "text", + form: { + helper: "最简单的helper" + } + }, + age: { + title: "jsx", + type: "text", + form: { + helper: { + render() { + return
jsx自定义render
; + } + } + } + }, + status: { + title: "显示在label", + type: "text", + form: { + rules: [{ required: true, message: "此项必填" }], + helper: { + position: "label", + tooltip: { + placement: "topLeft" + }, + text: "在label通过tooltip方式显示的helper" + // render() { + // return
在label通过tooltip方式显示的helper
; + // } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/independent/index.vue b/packages/ui/certd-client/src/views/crud/form/independent/index.vue new file mode 100644 index 000000000..633904440 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/independent/index.vue @@ -0,0 +1,215 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/inner/api.js b/packages/ui/certd-client/src/views/crud/form/inner/api.js new file mode 100644 index 000000000..d8c3543c8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/inner/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormInner"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/inner/area/api.js b/packages/ui/certd-client/src/views/crud/form/inner/area/api.js new file mode 100644 index 000000000..b9142c890 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/inner/area/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormInnerArea"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function GetAll(query) { + return request({ + url: apiPrefix + "/all", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/inner/area/crud.jsx b/packages/ui/certd-client/src/views/crud/form/inner/area/crud.jsx new file mode 100644 index 000000000..dbd13b803 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/inner/area/crud.jsx @@ -0,0 +1,39 @@ +import * as api from "./api"; +import { dict, useExpose } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + wrapper: { + inner: true + } + }, + columns: { + area: { + title: "地区", + type: "text" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/inner/area/index.vue b/packages/ui/certd-client/src/views/crud/form/inner/area/index.vue new file mode 100644 index 000000000..ab81c09b0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/inner/area/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/inner/area/mock.js b/packages/ui/certd-client/src/views/crud/form/inner/area/mock.js new file mode 100644 index 000000000..d7c076ef2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/inner/area/mock.js @@ -0,0 +1,24 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormInnerArea", + idGenerator: 0 +}; +const list = [ + { + area: "深圳" + }, + { + area: "北京" + }, + { + area: "上海" + }, + { + area: "广州" + } +]; +options.list = list; +options.copyTimes = 1; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/inner/crud.jsx b/packages/ui/certd-client/src/views/crud/form/inner/crud.jsx new file mode 100644 index 000000000..c7009bf7f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/inner/crud.jsx @@ -0,0 +1,77 @@ +import * as api from "./api"; +import { dict, useExpose } from "@fast-crud/fast-crud"; +import { useRouter } from "vue-router"; +import { message } from "ant-design-vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + const router = useRouter(); + const areaDict = dict({ + value: "id", + label: "area", + url: "/mock/FormInnerArea/all" + }); + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + wrapper: { + inner: true + } + }, + columns: { + name: { + title: "姓名", + type: "text" + }, + age: { + title: "年龄", + type: "text" + }, + area: { + title: "地区", + type: "dict-select", + dict: areaDict, + form: { + suffixRender() { + function refresh() { + message.info("刷新dict"); + areaDict.reloadDict(); + } + function gotoAddArea() { + message.info("调用 router.push 打开地区管理页面"); + router.push({ path: "/crud/form/inner/area" }); + } + return ( + + + + + 添加地区 + + ); + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/inner/index.vue b/packages/ui/certd-client/src/views/crud/form/inner/index.vue new file mode 100644 index 000000000..ab81c09b0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/inner/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/inner/mock.js b/packages/ui/certd-client/src/views/crud/form/inner/mock.js new file mode 100644 index 000000000..a9f809c81 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/inner/mock.js @@ -0,0 +1,25 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormInner", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + age: 15, + password: "", + status: "2", + url: "https://baidu.com" + }, + { + name: "张三", + age: 18, + password: "", + url: "https://baidu.com" + } +]; +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/layout-flex/api.js b/packages/ui/certd-client/src/views/crud/form/layout-flex/api.js new file mode 100644 index 000000000..0ba39afe2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout-flex/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/formLayoutFlex"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/layout-flex/crud.jsx b/packages/ui/certd-client/src/views/crud/form/layout-flex/crud.jsx new file mode 100644 index 000000000..1e7c5c383 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout-flex/crud.jsx @@ -0,0 +1,63 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + display: "flex", + labelCol: { + //固定label宽度 + span: null, + style: { + width: "120px" + } + }, + wrapperCol: { + span: null + } + }, + columns: { + name: { + title: "姓名", + type: "text", + search: { show: true } + }, + order: { + title: "字段排序", + type: "text", + form: { + order: 0 + } + }, + intro: { + title: "跨列", + search: { show: true }, + type: ["textarea"], + form: { + col: { span: 24 } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/layout-flex/index.vue b/packages/ui/certd-client/src/views/crud/form/layout-flex/index.vue new file mode 100644 index 000000000..e43bc8cf1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout-flex/index.vue @@ -0,0 +1,43 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/layout-flex/mock.js b/packages/ui/certd-client/src/views/crud/form/layout-flex/mock.js new file mode 100644 index 000000000..e48c1f0fd --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout-flex/mock.js @@ -0,0 +1,35 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "formLayoutFlex", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + date: "2016-05-02", + status: "0", + province: "1", + avatar: "https://alicdn.antdv.com/vue.png", + show: true, + city: "sz", + address: "123123", + zip: "518000", + order: "我在编辑的时候会排到第一个", + intro: "王小虎是element-plus的table示例出现的名字" + }, + { + name: "张三", + date: "2016-05-04", + status: "1", + province: "2" + }, + { + name: "李四", + date: 2232433534511, + status: "1", + province: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/layout-grid/api.js b/packages/ui/certd-client/src/views/crud/form/layout-grid/api.js new file mode 100644 index 000000000..c00a57873 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout-grid/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/formLayoutGrid"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/layout-grid/crud.jsx b/packages/ui/certd-client/src/views/crud/form/layout-grid/crud.jsx new file mode 100644 index 000000000..284f7b9f8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout-grid/crud.jsx @@ -0,0 +1,67 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + // 具体可配置请参考 grid 布局: http://www.ruanyifeng.com/blog/2019/03/grid-layout-tutorial.html + display: "grid" + }, + columns: { + avatar: { + title: "头像上传", + type: "avatar-uploader", + form: { + order: 0, + col: { + style: { gridRow: "span 3" } + }, + helper: "通过grid布局,可以实现比flex更加规整的排列" + } + }, + name: { + title: "姓名", + type: "text", + search: { show: true } + }, + order: { + title: "占位演示", + type: "text" + }, + place: { + title: "占位演示", + type: "text" + }, + intro: { + title: "跨列", + type: "textarea", + form: { + col: { + style: { gridColumn: "span 2" } // grid 模式控制跨列 + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/layout-grid/index.vue b/packages/ui/certd-client/src/views/crud/form/layout-grid/index.vue new file mode 100644 index 000000000..499e5fe7d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout-grid/index.vue @@ -0,0 +1,52 @@ + + + + diff --git a/packages/ui/certd-client/src/views/crud/form/layout-grid/mock.js b/packages/ui/certd-client/src/views/crud/form/layout-grid/mock.js new file mode 100644 index 000000000..41ec78880 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout-grid/mock.js @@ -0,0 +1,34 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "formLayoutGrid", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + date: "2016-05-02", + status: "0", + province: "1", + avatar: "https://alicdn.antdv.com/vue.png", + show: true, + city: "sz", + address: "123123", + zip: "518000", + order: "我在编辑的时候会排到第一个", + intro: "王小虎是element-plus的table示例出现的名字" + }, + { + name: "张三", + date: "2016-05-04", + status: "1" + }, + { + name: "李四", + date: 2232433534511, + status: "1", + province: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/layout/api.js b/packages/ui/certd-client/src/views/crud/form/layout/api.js new file mode 100644 index 000000000..d9a789418 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/formLayout"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/layout/crud.jsx b/packages/ui/certd-client/src/views/crud/form/layout/crud.jsx new file mode 100644 index 000000000..fabaec8ee --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout/crud.jsx @@ -0,0 +1,101 @@ +import * as api from "./api"; +import { dict, compute } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + + const { getFormData, getFormWrapperRef } = expose; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + /** + * flex模式,通过 + * grid模式 + */ + display: "flex", + wrapper: { + customClass: "page-layout", + onOpened(context) { + getFormWrapperRef().formOptions.display = context.options.initial?.display; + console.log("form opened", context, getFormData()); + } + } + }, + columns: { + display: { + title: "布局", + type: "dict-radio", + dict: dict({ + data: [ + { value: "flex", label: "flex", color: "blue" }, + { value: "grid", label: "grid", color: "green" } + ] + }), + search: { show: true, valueChange: null }, + form: { + valueChange(context) { + const { value } = context; + getFormWrapperRef().formOptions.display = value; + console.log("valueChange", value, context); + } + } + }, + name: { + title: "姓名", + type: "text", + search: { show: true } + }, + zip: { + title: "邮编", + type: "text" + }, + blank: { + title: "表单占位栏", + type: "text", + form: { + blank: true + } + }, + gridSpan: { + title: "grid跨列", + type: "textarea", + form: { + col: { + style: { gridColumn: "span 2" } // grid 模式 + } + } + }, + flexSpan: { + title: "flex跨列", + type: "textarea", + search: { show: false }, + form: { + show: compute((context) => { + // grid跨列模式下使用flex模式的设置会显示异常,为了演示效果,在grid模式下隐藏 + return context.form.display !== "grid"; + }), + col: { span: 24 } // flex模式跨列配置 + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/layout/index.vue b/packages/ui/certd-client/src/views/crud/form/layout/index.vue new file mode 100644 index 000000000..1a969b414 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout/index.vue @@ -0,0 +1,50 @@ + + + + diff --git a/packages/ui/certd-client/src/views/crud/form/layout/mock.js b/packages/ui/certd-client/src/views/crud/form/layout/mock.js new file mode 100644 index 000000000..f63208a5a --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/layout/mock.js @@ -0,0 +1,41 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "formLayout", + idGenerator: 0 +}; +const list = [ + { + display: "flex", + name: "aa", + date: "2016-05-02", + status: "0", + province: "1", + avatar: "https://alicdn.antdv.com/vue.png", + show: true, + city: "sz", + address: "123123", + zip: "518000" + }, + { + display: "grid", + name: "bb", + date: "2016-05-04", + status: "1", + province: "2" + }, + { + name: "cc", + date: 2232433534511, + status: "1", + province: "0" + }, + { + name: "dd", + date: "2016-05-03", + status: "2", + province: "wh,gz" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/nest/api.js b/packages/ui/certd-client/src/views/crud/form/nest/api.js new file mode 100644 index 000000000..f7d01faa7 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/nest/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormNestObject"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/nest/crud.jsx b/packages/ui/certd-client/src/views/crud/form/nest/crud.jsx new file mode 100644 index 000000000..1bf0a55af --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/nest/crud.jsx @@ -0,0 +1,76 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + labelCol: { span: 6 }, + wrapperCol: { span: 16 }, + helper: { + // position: "label" // helper的展示位置全局配置 + // tooltip:{} + } + }, + columns: { + username: { + title: "用户名", + type: "text" + }, + "profile.name": { + title: "profile.name", + type: "text", + search:{show:true}, + form: { + key: ["profile", "name"], + rules: [{ required: true, message: "姓名必填" }] + } + }, + "profile.age": { + title: "profile.age", + type: "number", + form: { + key: ["profile", "age"] + } + }, + "profile.status": { + title: "profile.status", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }), + form: { + key: ["profile", "status"] + } + }, + "profile.count": { + title: "不提交的字段", + type: "text", + form: { + submit: false, + key: ["profile", "count"] + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/nest/index.vue b/packages/ui/certd-client/src/views/crud/form/nest/index.vue new file mode 100644 index 000000000..5e4c48c99 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/nest/index.vue @@ -0,0 +1,48 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/nest/mock.js b/packages/ui/certd-client/src/views/crud/form/nest/mock.js new file mode 100644 index 000000000..1658d74a1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/nest/mock.js @@ -0,0 +1,319 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormNestObject", + idGenerator: 0 +}; +const list = [ + { + username: "wangxiaohu", + profile: { + name: "王小虎", + age: 15, + status: "1", + count: "配置submit=false将不会提交给后台" + } + }, + { + username: "zhangsan", + profile: { + name: "张三", + age: 18, + status: "2" + } + }, + { + username: "lisi", + profile: { + name: "李四", + age: 18, + status: "2" + } + } +]; + +const dictData = [ + { + value: "zhinan", + label: "指南", + children: [ + { + value: "shejiyuanze", + label: "设计原则", + children: [ + { + value: "yizhi", + label: "一致" + }, + { + value: "fankui", + label: "反馈" + }, + { + value: "xiaolv", + label: "效率" + }, + { + value: "kekong", + label: "可控" + } + ] + }, + { + value: "daohang", + label: "导航", + children: [ + { + value: "cexiangdaohang", + label: "侧向导航" + }, + { + value: "dingbudaohang", + label: "顶部导航" + } + ] + } + ] + }, + { + value: "zujian", + label: "组件", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout 布局" + }, + { + value: "color", + label: "Color 色彩" + }, + { + value: "typography", + label: "Typography 字体" + }, + { + value: "icon", + label: "Icon 图标" + }, + { + value: "button", + label: "Button 按钮" + } + ] + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio 单选框" + }, + { + value: "checkbox", + label: "Checkbox 多选框" + }, + { + value: "input", + label: "Input 输入框" + }, + { + value: "input-number", + label: "InputNumber 计数器" + }, + { + value: "select", + label: "Select 选择器" + }, + { + value: "cascader", + label: "Cascader 级联选择器" + }, + { + value: "switch", + label: "Switch 开关" + }, + { + value: "slider", + label: "Slider 滑块" + }, + { + value: "time-picker", + label: "TimePicker 时间选择器" + }, + { + value: "date-picker", + label: "DatePicker 日期选择器" + }, + { + value: "datetime-picker", + label: "DateTimePicker 日期时间选择器" + }, + { + value: "upload", + label: "Upload 上传" + }, + { + value: "rate", + label: "Rate 评分" + }, + { + value: "form", + label: "Form 表单" + } + ] + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table 表格" + }, + { + value: "tag", + label: "Tag 标签" + }, + { + value: "progress", + label: "Progress 进度条" + }, + { + value: "tree", + label: "Tree 树形控件" + }, + { + value: "pagination", + label: "Pagination 分页" + }, + { + value: "badge", + label: "Badge 标记" + } + ] + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert 警告" + }, + { + value: "loading", + label: "Loading 加载" + }, + { + value: "message", + label: "Message 消息提示" + }, + { + value: "message-box", + label: "MessageBox 弹框" + }, + { + value: "notification", + label: "Notification 通知" + } + ] + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "NavMenu 导航菜单" + }, + { + value: "tabs", + label: "Tabs 标签页" + }, + { + value: "breadcrumb", + label: "Breadcrumb 面包屑" + }, + { + value: "dropdown", + label: "Dropdown 下拉菜单" + }, + { + value: "steps", + label: "Steps 步骤条" + } + ] + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog 对话框" + }, + { + value: "tooltip", + label: "Tooltip 文字提示" + }, + { + value: "popover", + label: "Popover 弹出框" + }, + { + value: "card", + label: "Card 卡片" + }, + { + value: "carousel", + label: "Carousel 走马灯" + }, + { + value: "collapse", + label: "Collapse 折叠面板" + } + ] + } + ] + }, + { + value: "ziyuan", + label: "资源", + children: [ + { + value: "axure", + label: "Axure Components" + }, + { + value: "sketch", + label: "Sketch Templates" + }, + { + value: "jiaohu", + label: "组件交互文档" + } + ] + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +mock.push({ + path: "/select/cascadeData", + method: "get", + handle(req) { + return { + code: 0, + msg: "success", + data: dictData + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/new-page/api.js b/packages/ui/certd-client/src/views/crud/form/new-page/api.js new file mode 100644 index 000000000..0dc2616a0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/new-page/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormNewPage"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/get", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/new-page/crud.jsx b/packages/ui/certd-client/src/views/crud/form/new-page/crud.jsx new file mode 100644 index 000000000..c68282819 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/new-page/crud.jsx @@ -0,0 +1,96 @@ +import * as api from "./api"; +import { useRouter } from "vue-router"; +export default function ({ expose }) { + const router = useRouter(); + + const { getFormRef, getFormData } = expose; + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + if (row.id) { + form.id = row.id; + } + + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + actionbar: { + buttons: { + add: { + click() { + router.push("/crud/form/new-page/edit"); + } + } + } + }, + rowHandle: { + buttons: { + edit: { + click(context) { + router.push("/crud/form/new-page/edit?id=" + context.row.id); + } + } + } + }, + columns: { + title: { + title: "商品标题", + type: "text" + }, + code: { + title: "商品代码", + search: { show: true }, + type: "text" + }, + images: { + title: "图片", + type: "image-uploader" + }, + price: { + title: "价格", + sortable: true + }, + store: { + title: "库存", + type: "number" + }, + intro: { + title: "简介", + type: "textarea", + column: { + ellipsis: true + } + }, + content: { + title: "详情", + type: ["editor-wang", "colspan"], + form: { + itemProps: { labelWidth: "0px" } + } + }, + product: { + title: "未分组字段", + type: ["text", "colspan"], + form: { + helper: "未分组的字段会显示在这里,一般来说你应该把所有字段都编入分组内" + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/new-page/edit.vue b/packages/ui/certd-client/src/views/crud/form/new-page/edit.vue new file mode 100644 index 000000000..c93ef0bdd --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/new-page/edit.vue @@ -0,0 +1,81 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/new-page/index.vue b/packages/ui/certd-client/src/views/crud/form/new-page/index.vue new file mode 100644 index 000000000..0702f08c9 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/new-page/index.vue @@ -0,0 +1,43 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/new-page/mock.js b/packages/ui/certd-client/src/views/crud/form/new-page/mock.js new file mode 100644 index 000000000..a182214c8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/new-page/mock.js @@ -0,0 +1,22 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormNewPage", + idGenerator: 0 +}; +const list = [ + { + title: "无线充电宝", + code: "100001", + images: "https://img0.bdstatic.com/static/searchdetail/img/logo-2X_0c4ef02.png", + price: 100, + stock: 99, + intro: "30000毫安超大容量移动电源充电宝官方原装正品专用便携", + content: "" + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/reset/api.js b/packages/ui/certd-client/src/views/crud/form/reset/api.js new file mode 100644 index 000000000..52a5ff5b0 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/reset/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/formReset"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/reset/crud.jsx b/packages/ui/certd-client/src/views/crud/form/reset/crud.jsx new file mode 100644 index 000000000..1a4f1df2f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/reset/crud.jsx @@ -0,0 +1,56 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + async doReset() { + console.log("reset之后可以执行其他操作"); + }, + wrapper: { + buttons: { + reset: { + text: "重置", + order: -1, + click(value) { + console.log("on reset", value); + expose.getFormRef().reset(); + } + } + } + } + }, + columns: { + name: { + title: "姓名", + type: "text", //虽然不写也能正确显示组件,但不建议省略它 + search: { show: true }, + form: { + component: { + maxlength: 20 + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/reset/index.vue b/packages/ui/certd-client/src/views/crud/form/reset/index.vue new file mode 100644 index 000000000..8c2e77e6d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/reset/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/reset/mock.js b/packages/ui/certd-client/src/views/crud/form/reset/mock.js new file mode 100644 index 000000000..f586e9c46 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/reset/mock.js @@ -0,0 +1,40 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "formReset", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + date: "2016-05-02", + status: "0", + province: "1", + avatar: "https://alicdn.antdv.com/vue.png", + show: true, + city: "sz", + address: "123123", + zip: "518000", + intro: "王小虎是element-plus的table示例出现的名字" + }, + { + name: "张三", + date: "2016-05-04", + status: "1", + province: "2" + }, + { + name: "李四", + date: 2232433534511, + status: "1", + province: "0" + }, + { + name: "王五", + date: "2016-05-03", + status: "2", + province: "wh,gz" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/single-column/api.js b/packages/ui/certd-client/src/views/crud/form/single-column/api.js new file mode 100644 index 000000000..0ba49b67f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/single-column/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormSingleColumn"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/single-column/crud.jsx b/packages/ui/certd-client/src/views/crud/form/single-column/crud.jsx new file mode 100644 index 000000000..f82ff9175 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/single-column/crud.jsx @@ -0,0 +1,59 @@ +import * as api from "./api"; +export default function ({ crudExpose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + col: { + span: 24 + } + }, + columns: { + name: { + title: "姓名", + type: "text" + }, + title: { + title: "商品标题", + type: "text" + }, + code: { + title: "商品代码", + search: { show: true }, + type: "text" + }, + images: { + title: "图片", + type: "image-uploader" + }, + price: { + title: "价格", + sortable: true + }, + store: { + title: "库存", + type: "number" + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/single-column/index.vue b/packages/ui/certd-client/src/views/crud/form/single-column/index.vue new file mode 100644 index 000000000..83d27934b --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/single-column/index.vue @@ -0,0 +1,31 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/single-column/mock.js b/packages/ui/certd-client/src/views/crud/form/single-column/mock.js new file mode 100644 index 000000000..9b37c9e75 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/single-column/mock.js @@ -0,0 +1,310 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormSingleColumn", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + age: 15, + password: "", + status: "2", + url: "https://baidu.com" + }, + { + name: "张三", + age: 18, + password: "", + url: "https://baidu.com" + }, + { + status: "2" + } +]; + +const dictData = [ + { + value: "zhinan", + label: "指南", + children: [ + { + value: "shejiyuanze", + label: "设计原则", + children: [ + { + value: "yizhi", + label: "一致" + }, + { + value: "fankui", + label: "反馈" + }, + { + value: "xiaolv", + label: "效率" + }, + { + value: "kekong", + label: "可控" + } + ] + }, + { + value: "daohang", + label: "导航", + children: [ + { + value: "cexiangdaohang", + label: "侧向导航" + }, + { + value: "dingbudaohang", + label: "顶部导航" + } + ] + } + ] + }, + { + value: "zujian", + label: "组件", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout 布局" + }, + { + value: "color", + label: "Color 色彩" + }, + { + value: "typography", + label: "Typography 字体" + }, + { + value: "icon", + label: "Icon 图标" + }, + { + value: "button", + label: "Button 按钮" + } + ] + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio 单选框" + }, + { + value: "checkbox", + label: "Checkbox 多选框" + }, + { + value: "input", + label: "Input 输入框" + }, + { + value: "input-number", + label: "InputNumber 计数器" + }, + { + value: "select", + label: "Select 选择器" + }, + { + value: "cascader", + label: "Cascader 级联选择器" + }, + { + value: "switch", + label: "Switch 开关" + }, + { + value: "slider", + label: "Slider 滑块" + }, + { + value: "time-picker", + label: "TimePicker 时间选择器" + }, + { + value: "date-picker", + label: "DatePicker 日期选择器" + }, + { + value: "datetime-picker", + label: "DateTimePicker 日期时间选择器" + }, + { + value: "upload", + label: "Upload 上传" + }, + { + value: "rate", + label: "Rate 评分" + }, + { + value: "form", + label: "Form 表单" + } + ] + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table 表格" + }, + { + value: "tag", + label: "Tag 标签" + }, + { + value: "progress", + label: "Progress 进度条" + }, + { + value: "tree", + label: "Tree 树形控件" + }, + { + value: "pagination", + label: "Pagination 分页" + }, + { + value: "badge", + label: "Badge 标记" + } + ] + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert 警告" + }, + { + value: "loading", + label: "Loading 加载" + }, + { + value: "message", + label: "Message 消息提示" + }, + { + value: "message-box", + label: "MessageBox 弹框" + }, + { + value: "notification", + label: "Notification 通知" + } + ] + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "NavMenu 导航菜单" + }, + { + value: "tabs", + label: "Tabs 标签页" + }, + { + value: "breadcrumb", + label: "Breadcrumb 面包屑" + }, + { + value: "dropdown", + label: "Dropdown 下拉菜单" + }, + { + value: "steps", + label: "Steps 步骤条" + } + ] + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog 对话框" + }, + { + value: "tooltip", + label: "Tooltip 文字提示" + }, + { + value: "popover", + label: "Popover 弹出框" + }, + { + value: "card", + label: "Card 卡片" + }, + { + value: "carousel", + label: "Carousel 走马灯" + }, + { + value: "collapse", + label: "Collapse 折叠面板" + } + ] + } + ] + }, + { + value: "ziyuan", + label: "资源", + children: [ + { + value: "axure", + label: "Axure Components" + }, + { + value: "sketch", + label: "Sketch Templates" + }, + { + value: "jiaohu", + label: "组件交互文档" + } + ] + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +mock.push({ + path: "/select/cascadeData", + method: "get", + handle(req) { + return { + code: 0, + msg: "success", + data: dictData + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/form/validation/api.js b/packages/ui/certd-client/src/views/crud/form/validation/api.js new file mode 100644 index 000000000..f62ba48b1 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/validation/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/FormValidation"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/form/validation/crud.jsx b/packages/ui/certd-client/src/views/crud/form/validation/crud.jsx new file mode 100644 index 000000000..856ca779b --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/validation/crud.jsx @@ -0,0 +1,135 @@ +import * as api from "./api"; +import { dict, useExpose } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const { getFormRef, getFormData } = expose; + const validatePass1 = async (rule, value) => { + if (value === "") { + throw new Error("请输入密码"); + } + if (getFormData().password2 !== "") { + getFormRef().getFormRef().validateFields(["password2"]); + } + }; + const validatePass2 = async (rule, value) => { + if (value === "") { + throw new Error("请再次输入密码"); + } else if (value !== getFormData().password) { + throw new Error("两次输入密码不一致!"); + } + }; + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + form: { + row:{ + gutter:20 + }, + beforeSubmit(context) { + console.log("beforeSubmit", context); + }, + afterSubmit(context) { + console.log("afterSubmit", context); + } + }, + columns: { + name: { + title: "姓名", + type: "text", + form: { + helper: "添加和编辑时必填,编辑时额外需要校验长度", + rules: [{ required: true, message: "请输入姓名" }], + component: { + maxlength: 5, // 原生属性要写在这里 + props: { + type: "text", + showWordLimit: true + } + } + }, + editForm: { + rules: [{ min: 2, max: 5, message: "姓名长度为2-5" }] + } + }, + age: { + title: "年龄", + type: "text", + form: { + rules: [{ pattern: /^\d+$/, message: "必须为整数" }], + helper: "正则表达式" + } + }, + password: { + title: "密码", + type: "password", + column: { + component: { + cellRender() { + return ******; + } + } + }, + form: { + rules: [ + { required: true, message: "请输入密码" }, + { validator: validatePass1, trigger: "blur" } + ] + } + }, + password2: { + title: "确认密码", + type: "password", + column: { show: false }, + form: { + rules: [ + { required: true, message: "请输入确认密码" }, + { validator: validatePass2, trigger: "blur" } + ] + } + }, + status: { + title: "必选", + type: "dict-select", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum" + }), + form: { + rules: [{ required: true, message: "请选择一个选项" }] + } + }, + email: { + title: "邮箱", + type: "text", + form: { + rules: [{ type: "email", message: "请填写正确的邮箱" }] + } + }, + url: { + title: "URL", + type: "text", + form: { + rules: [{ type: "url", message: "请填写正确的url" }] + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/form/validation/index.vue b/packages/ui/certd-client/src/views/crud/form/validation/index.vue new file mode 100644 index 000000000..49bd373a8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/validation/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/form/validation/mock.js b/packages/ui/certd-client/src/views/crud/form/validation/mock.js new file mode 100644 index 000000000..0ca7bc117 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/form/validation/mock.js @@ -0,0 +1,310 @@ +import mockUtil from "/src/mock/base"; + +const options = { + name: "FormValidation", + idGenerator: 0 +}; +const list = [ + { + name: "王小虎", + age: 15, + password: "", + status: "2", + url: "https://baidu.com" + }, + { + name: "张三", + age: 18, + password: "", + url: "https://baidu.com" + }, + { + status: "2" + } +]; + +const dictData = [ + { + value: "zhinan", + label: "指南", + children: [ + { + value: "shejiyuanze", + label: "设计原则", + children: [ + { + value: "yizhi", + label: "一致" + }, + { + value: "fankui", + label: "反馈" + }, + { + value: "xiaolv", + label: "效率" + }, + { + value: "kekong", + label: "可控" + } + ] + }, + { + value: "daohang", + label: "导航", + children: [ + { + value: "cexiangdaohang", + label: "侧向导航" + }, + { + value: "dingbudaohang", + label: "顶部导航" + } + ] + } + ] + }, + { + value: "zujian", + label: "组件", + children: [ + { + value: "basic", + label: "Basic", + children: [ + { + value: "layout", + label: "Layout 布局" + }, + { + value: "color", + label: "Color 色彩" + }, + { + value: "typography", + label: "Typography 字体" + }, + { + value: "icon", + label: "Icon 图标" + }, + { + value: "button", + label: "Button 按钮" + } + ] + }, + { + value: "form", + label: "Form", + children: [ + { + value: "radio", + label: "Radio 单选框" + }, + { + value: "checkbox", + label: "Checkbox 多选框" + }, + { + value: "input", + label: "Input 输入框" + }, + { + value: "input-number", + label: "InputNumber 计数器" + }, + { + value: "select", + label: "Select 选择器" + }, + { + value: "cascader", + label: "Cascader 级联选择器" + }, + { + value: "switch", + label: "Switch 开关" + }, + { + value: "slider", + label: "Slider 滑块" + }, + { + value: "time-picker", + label: "TimePicker 时间选择器" + }, + { + value: "date-picker", + label: "DatePicker 日期选择器" + }, + { + value: "datetime-picker", + label: "DateTimePicker 日期时间选择器" + }, + { + value: "upload", + label: "Upload 上传" + }, + { + value: "rate", + label: "Rate 评分" + }, + { + value: "form", + label: "Form 表单" + } + ] + }, + { + value: "data", + label: "Data", + children: [ + { + value: "table", + label: "Table 表格" + }, + { + value: "tag", + label: "Tag 标签" + }, + { + value: "progress", + label: "Progress 进度条" + }, + { + value: "tree", + label: "Tree 树形控件" + }, + { + value: "pagination", + label: "Pagination 分页" + }, + { + value: "badge", + label: "Badge 标记" + } + ] + }, + { + value: "notice", + label: "Notice", + children: [ + { + value: "alert", + label: "Alert 警告" + }, + { + value: "loading", + label: "Loading 加载" + }, + { + value: "message", + label: "Message 消息提示" + }, + { + value: "message-box", + label: "MessageBox 弹框" + }, + { + value: "notification", + label: "Notification 通知" + } + ] + }, + { + value: "navigation", + label: "Navigation", + children: [ + { + value: "menu", + label: "NavMenu 导航菜单" + }, + { + value: "tabs", + label: "Tabs 标签页" + }, + { + value: "breadcrumb", + label: "Breadcrumb 面包屑" + }, + { + value: "dropdown", + label: "Dropdown 下拉菜单" + }, + { + value: "steps", + label: "Steps 步骤条" + } + ] + }, + { + value: "others", + label: "Others", + children: [ + { + value: "dialog", + label: "Dialog 对话框" + }, + { + value: "tooltip", + label: "Tooltip 文字提示" + }, + { + value: "popover", + label: "Popover 弹出框" + }, + { + value: "card", + label: "Card 卡片" + }, + { + value: "carousel", + label: "Carousel 走马灯" + }, + { + value: "collapse", + label: "Collapse 折叠面板" + } + ] + } + ] + }, + { + value: "ziyuan", + label: "资源", + children: [ + { + value: "axure", + label: "Axure Components" + }, + { + value: "sketch", + label: "Sketch Templates" + }, + { + value: "jiaohu", + label: "组件交互文档" + } + ] + } +]; + +options.list = list; +options.copyTimes = 1000; +const mock = mockUtil.buildMock(options); +mock.push({ + path: "/select/cascadeData", + method: "get", + handle(req) { + return { + code: 0, + msg: "success", + data: dictData + }; + } +}); + +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/home/index.vue b/packages/ui/certd-client/src/views/crud/home/index.vue new file mode 100644 index 000000000..274457799 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/home/index.vue @@ -0,0 +1,15 @@ + + + + diff --git a/packages/ui/certd-client/src/views/crud/home/page-cover/helper.js b/packages/ui/certd-client/src/views/crud/home/page-cover/helper.js new file mode 100644 index 000000000..5c955ba6e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/home/page-cover/helper.js @@ -0,0 +1,31 @@ +export default { + crud: ` columns: [ + date:{ + title: '日期', //字段名称 + type: 'date', //字段类型,添加、修改、查询将自动生成相应表单组件 + }, + status: { + title: '状态', + type: 'dict-select', //选择框,默认单选 + dict: dict({ url: '/dicts/OpenStatusEnum' })//远程数据字典 + }, + province: { + title: '地区', + type: 'dict-select', //选择框 + form: { //表单组件自定义配置,此处配置选择框为多选 + component: { //支持任何v-model组件 + filterable: true, multiple: true, clearable: true + } + }, + dict: dict({ + data: [ //本地数据字典 + { value: 'sz', label: '深圳' }, + { value: 'gz', label: '广州' }, + { value: 'wh', label: '武汉' }, + { value: 'sh', label: '上海' } + ] + }) + } + ] + ` +}; diff --git a/packages/ui/certd-client/src/views/crud/home/page-cover/image/crud.png b/packages/ui/certd-client/src/views/crud/home/page-cover/image/crud.png new file mode 100644 index 000000000..3dfb047dd Binary files /dev/null and b/packages/ui/certd-client/src/views/crud/home/page-cover/image/crud.png differ diff --git a/packages/ui/certd-client/src/views/crud/home/page-cover/image/darkblue@2x.png b/packages/ui/certd-client/src/views/crud/home/page-cover/image/darkblue@2x.png new file mode 100644 index 000000000..efe1577f4 Binary files /dev/null and b/packages/ui/certd-client/src/views/crud/home/page-cover/image/darkblue@2x.png differ diff --git a/packages/ui/certd-client/src/views/crud/home/page-cover/image/logo.svg b/packages/ui/certd-client/src/views/crud/home/page-cover/image/logo.svg new file mode 100644 index 000000000..7a33425e3 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/home/page-cover/image/logo.svg @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/ui/certd-client/src/views/crud/home/page-cover/index.vue b/packages/ui/certd-client/src/views/crud/home/page-cover/index.vue new file mode 100644 index 000000000..7c51dea3d --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/home/page-cover/index.vue @@ -0,0 +1,139 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/row-handle/dropdown/api.js b/packages/ui/certd-client/src/views/crud/row-handle/dropdown/api.js new file mode 100644 index 000000000..3cfd81822 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/row-handle/dropdown/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/RowHandleDropdown"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/row-handle/dropdown/crud.jsx b/packages/ui/certd-client/src/views/crud/row-handle/dropdown/crud.jsx new file mode 100644 index 000000000..2947b5377 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/row-handle/dropdown/crud.jsx @@ -0,0 +1,82 @@ +import * as api from "./api"; +import { dict, compute } from "@fast-crud/fast-crud"; +import { message } from "ant-design-vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + rowHandle: { + width: 290, + buttons: { + remove: { + // 根据row的值判断按钮是否显示 + show: compute(({ row }) => { + return row.radio !== "0"; + }), + dropdown: true //---------》给想要折叠的按钮配置dropdown为true,就会放入dropdown中《--------------- + }, + orderExample: { + text: "我排前面", + title: "按钮排序示例", + type: "link", + order: 0, //数字越小,越靠前,默认排序号为1 + click(opts) { + console.log("自定义操作列按钮点击", opts); + message.success("自定义操作列按钮点击"); + } + } + }, + dropdown: { + // 操作列折叠 + // 至少几个以上的按钮才会被折叠 + // atLeast: 2, //TODO 注意 [atLeast]参数即将废弃,请给button配置dropdown即可放入折叠 + more: { + text: "更多", + icon: null, + iconRight: "ion:caret-down-outline" + } + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/row-handle/dropdown/index.vue b/packages/ui/certd-client/src/views/crud/row-handle/dropdown/index.vue new file mode 100644 index 000000000..45d6937e2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/row-handle/dropdown/index.vue @@ -0,0 +1,40 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/row-handle/dropdown/mock.js b/packages/ui/certd-client/src/views/crud/row-handle/dropdown/mock.js new file mode 100644 index 000000000..ed703ceb8 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/row-handle/dropdown/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "RowHandleDropdown", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/row-handle/tooltip/api.js b/packages/ui/certd-client/src/views/crud/row-handle/tooltip/api.js new file mode 100644 index 000000000..dd8bf7d8c --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/row-handle/tooltip/api.js @@ -0,0 +1,50 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/RowHandleTooltip"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} + +export function BatchDelete(ids) { + return request({ + url: apiPrefix + "/batchDelete", + method: "post", + data: { ids } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/row-handle/tooltip/crud.jsx b/packages/ui/certd-client/src/views/crud/row-handle/tooltip/crud.jsx new file mode 100644 index 000000000..b8cc0141e --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/row-handle/tooltip/crud.jsx @@ -0,0 +1,84 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import { ref } from "vue"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + rowHandle: { + width: 400, + buttons: { + edit: { + tooltip: { + title: "编辑" + } + }, + view: { + tooltip: { + title: "查看" + } + }, + remove: { + tooltip: { + title: "删除" + } + }, + custom: { + text: "tooltip title render", + tooltip: { + slots: { + title() { + return ( +
+ 我是自定义render +
+ ); + } + } + } + } + } + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/row-handle/tooltip/index.vue b/packages/ui/certd-client/src/views/crud/row-handle/tooltip/index.vue new file mode 100644 index 000000000..40dde985f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/row-handle/tooltip/index.vue @@ -0,0 +1,51 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/row-handle/tooltip/mock.js b/packages/ui/certd-client/src/views/crud/row-handle/tooltip/mock.js new file mode 100644 index 000000000..7efa34b73 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/row-handle/tooltip/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "RowHandleTooltip", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/slots/cell/api.js b/packages/ui/certd-client/src/views/crud/slots/cell/api.js new file mode 100644 index 000000000..69094b0dd --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/cell/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/SlotsCell"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/slots/cell/crud.jsx b/packages/ui/certd-client/src/views/crud/slots/cell/crud.jsx new file mode 100644 index 000000000..ad836c9b2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/cell/crud.jsx @@ -0,0 +1,89 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +import dayjs from "dayjs"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + const radioDict = dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }); + return { + radioDict, + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + rowHandle: { + buttons: { + edit: { dropdown: true }, + remove: { dropdown: true } + }, + width: 630 + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + like: { + title: "like", + type: "number", + search: { show: true } + }, + switch: { + title: "switch", + type: "dict-switch", + dict: dict({ + data: [ + { value: true, label: "开启" }, + { value: false, label: "关闭" } + ] + }) + }, + createDate: { + title: "时间", + type: "datetime", + column: { + align: "left", + width: 300 + }, + valueBuilder({ key, row }) { + row[key] = dayjs(row[key]); + } + }, + updateDate: { + title: "修改时间", + type: "datetime", + column: { + show: false + }, + valueBuilder({ key, row }) { + row[key] = dayjs(row[key]); + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/slots/cell/index.vue b/packages/ui/certd-client/src/views/crud/slots/cell/index.vue new file mode 100644 index 000000000..9b8b43494 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/cell/index.vue @@ -0,0 +1,79 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/slots/cell/mock.js b/packages/ui/certd-client/src/views/crud/slots/cell/mock.js new file mode 100644 index 000000000..aa2397b79 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/cell/mock.js @@ -0,0 +1,26 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "SlotsCell", + idGenerator: 0 +}; +const list = [ + { + like: 10000, + switch: true, + createDate: new Date().getTime(), + updateDate: new Date().getTime() + }, + { + like: 10000, + switch: false, + createDate: new Date().getTime(), + updateDate: new Date().getTime() + }, + { + like: 10000, + switch: true + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/slots/form-item/api.js b/packages/ui/certd-client/src/views/crud/slots/form-item/api.js new file mode 100644 index 000000000..924d6570b --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/form-item/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/SlotsFormItem"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/slots/form-item/crud.jsx b/packages/ui/certd-client/src/views/crud/slots/form-item/crud.jsx new file mode 100644 index 000000000..7af63d446 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/form-item/crud.jsx @@ -0,0 +1,51 @@ +import * as api from "./api"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + topics: { + title: "多行输入", + type: "text", + search: { show: true }, + form: { + rules: [{ required: true, message: "请输入" }] + }, + column: { + component: { name: "fs-values-format" } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/slots/form-item/index.vue b/packages/ui/certd-client/src/views/crud/slots/form-item/index.vue new file mode 100644 index 000000000..97869b958 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/form-item/index.vue @@ -0,0 +1,72 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/slots/form-item/mock.js b/packages/ui/certd-client/src/views/crud/slots/form-item/mock.js new file mode 100644 index 000000000..a9f3d7569 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/form-item/mock.js @@ -0,0 +1,13 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "SlotsFormItem", + idGenerator: 0 +}; +const list = [ + { + topics: ["fast-crud 666", "fast-crud真好用"] + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/slots/form/api.js b/packages/ui/certd-client/src/views/crud/slots/form/api.js new file mode 100644 index 000000000..b15ec4e05 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/form/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/SlotsForm"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/slots/form/crud.jsx b/packages/ui/certd-client/src/views/crud/slots/form/crud.jsx new file mode 100644 index 000000000..b5d8c1df5 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/form/crud.jsx @@ -0,0 +1,50 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + const radioDict = dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }); + return { + radioDict, + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + text: { + title: "文本", + type: "text", + search: { show: true } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/slots/form/index.vue b/packages/ui/certd-client/src/views/crud/slots/form/index.vue new file mode 100644 index 000000000..74aa9ec35 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/form/index.vue @@ -0,0 +1,69 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/slots/form/mock.js b/packages/ui/certd-client/src/views/crud/slots/form/mock.js new file mode 100644 index 000000000..22d45cf72 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/form/mock.js @@ -0,0 +1,13 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "SlotsForm", + idGenerator: 0 +}; +const list = [ + { + text: "文本输入" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/slots/layout/api.js b/packages/ui/certd-client/src/views/crud/slots/layout/api.js new file mode 100644 index 000000000..56f3de45f --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/layout/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/SlotsLayout"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/slots/layout/crud.jsx b/packages/ui/certd-client/src/views/crud/slots/layout/crud.jsx new file mode 100644 index 000000000..af8ad45e2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/layout/crud.jsx @@ -0,0 +1,49 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async (id) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/slots/layout/index.vue b/packages/ui/certd-client/src/views/crud/slots/layout/index.vue new file mode 100644 index 000000000..ce35fe282 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/layout/index.vue @@ -0,0 +1,77 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/slots/layout/mock.js b/packages/ui/certd-client/src/views/crud/slots/layout/mock.js new file mode 100644 index 000000000..31e3a7d78 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/layout/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "SlotsLayout", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/crud/slots/search/api.js b/packages/ui/certd-client/src/views/crud/slots/search/api.js new file mode 100644 index 000000000..192ff43ea --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/search/api.js @@ -0,0 +1,42 @@ +import { requestForMock } from "/src/api/service"; +const request = requestForMock; +const apiPrefix = "/mock/SlotsSearch"; +export function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "get", + data: query + }); +} + +export function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "get", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/crud/slots/search/crud.jsx b/packages/ui/certd-client/src/views/crud/slots/search/crud.jsx new file mode 100644 index 000000000..af8ad45e2 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/search/crud.jsx @@ -0,0 +1,49 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async (id) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + columns: { + id: { + title: "ID", + key: "id", + type: "number", + column: { + width: 50 + }, + form: { + show: false + } + }, + radio: { + title: "状态", + search: { show: true }, + type: "dict-radio", + dict: dict({ + url: "/mock/dicts/OpenStatusEnum?single" + }) + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/crud/slots/search/index.vue b/packages/ui/certd-client/src/views/crud/slots/search/index.vue new file mode 100644 index 000000000..bbf30cffb --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/search/index.vue @@ -0,0 +1,54 @@ + + + diff --git a/packages/ui/certd-client/src/views/crud/slots/search/mock.js b/packages/ui/certd-client/src/views/crud/slots/search/mock.js new file mode 100644 index 000000000..4312767d5 --- /dev/null +++ b/packages/ui/certd-client/src/views/crud/slots/search/mock.js @@ -0,0 +1,19 @@ +import mockUtil from "/src/mock/base"; +const options = { + name: "SlotsSearch", + idGenerator: 0 +}; +const list = [ + { + radio: "1" + }, + { + radio: "2" + }, + { + radio: "0" + } +]; +options.list = list; +const mock = mockUtil.buildMock(options); +export default mock; diff --git a/packages/ui/certd-client/src/views/framework/error/404.vue b/packages/ui/certd-client/src/views/framework/error/404.vue new file mode 100644 index 000000000..2dacd3630 --- /dev/null +++ b/packages/ui/certd-client/src/views/framework/error/404.vue @@ -0,0 +1,18 @@ + + + diff --git a/packages/ui/certd-client/src/views/framework/home/index.vue b/packages/ui/certd-client/src/views/framework/home/index.vue new file mode 100644 index 000000000..274457799 --- /dev/null +++ b/packages/ui/certd-client/src/views/framework/home/index.vue @@ -0,0 +1,15 @@ + + + + diff --git a/packages/ui/certd-client/src/views/framework/home/page-cover/helper.js b/packages/ui/certd-client/src/views/framework/home/page-cover/helper.js new file mode 100644 index 000000000..38334ac1d --- /dev/null +++ b/packages/ui/certd-client/src/views/framework/home/page-cover/helper.js @@ -0,0 +1,31 @@ +export default { + crud: ` columns: { + date:{ + title: '姓名', //字段名称 + type: 'text', //字段类型,添加、修改、查询将自动生成相应表单组件 + }, + province: { + title: '城市', + type: 'dict-select', //选择框 + form: { //表单组件自定义配置,此处配置选择框为多选 + component: { //支持任何v-model组件 + filterable: true, multiple: true, clearable: true + } + }, + dict: dict({ + data: [ //本地数据字典 + { value: 'sz', label: '深圳' }, + { value: 'gz', label: '广州' }, + { value: 'wh', label: '武汉' }, + { value: 'sh', label: '上海' } + ] + }) + }, + status: { + title: '状态', + type: 'dict-select', //选择框,默认单选 + dict: dict({ url: '/dicts/OpenStatusEnum' })//远程数据字典 + }, + } + ` +}; diff --git a/packages/ui/certd-client/src/views/framework/home/page-cover/image/crud.png b/packages/ui/certd-client/src/views/framework/home/page-cover/image/crud.png new file mode 100644 index 000000000..3dfb047dd Binary files /dev/null and b/packages/ui/certd-client/src/views/framework/home/page-cover/image/crud.png differ diff --git a/packages/ui/certd-client/src/views/framework/home/page-cover/image/darkblue@2x.png b/packages/ui/certd-client/src/views/framework/home/page-cover/image/darkblue@2x.png new file mode 100644 index 000000000..efe1577f4 Binary files /dev/null and b/packages/ui/certd-client/src/views/framework/home/page-cover/image/darkblue@2x.png differ diff --git a/packages/ui/certd-client/src/views/framework/home/page-cover/image/logo.svg b/packages/ui/certd-client/src/views/framework/home/page-cover/image/logo.svg new file mode 100644 index 000000000..7a33425e3 --- /dev/null +++ b/packages/ui/certd-client/src/views/framework/home/page-cover/image/logo.svg @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/ui/certd-client/src/views/framework/home/page-cover/index.vue b/packages/ui/certd-client/src/views/framework/home/page-cover/index.vue new file mode 100644 index 000000000..976c620e4 --- /dev/null +++ b/packages/ui/certd-client/src/views/framework/home/page-cover/index.vue @@ -0,0 +1,139 @@ + + + diff --git a/packages/ui/certd-client/src/views/framework/login/index.vue b/packages/ui/certd-client/src/views/framework/login/index.vue new file mode 100644 index 000000000..a4b8728b7 --- /dev/null +++ b/packages/ui/certd-client/src/views/framework/login/index.vue @@ -0,0 +1,270 @@ + + + + diff --git a/packages/ui/certd-client/src/views/framework/register/index.vue b/packages/ui/certd-client/src/views/framework/register/index.vue new file mode 100644 index 000000000..d63e8e102 --- /dev/null +++ b/packages/ui/certd-client/src/views/framework/register/index.vue @@ -0,0 +1,178 @@ + + + + diff --git a/packages/ui/certd-client/src/views/sys/authority/permission/api.js b/packages/ui/certd-client/src/views/sys/authority/permission/api.js new file mode 100644 index 000000000..64627ea60 --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/permission/api.js @@ -0,0 +1,48 @@ +import { request } from "/src/api/service"; +const apiPrefix = "/sys/authority/permission"; +export async function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "post", + data: query + }); +} + +export async function GetTree() { + return request({ + url: apiPrefix + "/tree", + method: "post" + }); +} + +export async function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export async function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export async function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export async function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "post", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/sys/authority/permission/crud.jsx b/packages/ui/certd-client/src/views/sys/authority/permission/crud.jsx new file mode 100644 index 000000000..c8b918534 --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/permission/crud.jsx @@ -0,0 +1,150 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; + +export default function ({ expose }) { + const pageRequest = async (query) => { + const list = await api.GetTree(query); + + return { + current: 1, + records: list, + total: 10000, + pageSize: 10000 + }; + }; + + async function afterChange() { + await permissionTreeDict.reloadDict(); + } + const editRequest = async ({ form, row }) => { + form.id = row.id; + const ret = await api.UpdateObj(form); + await afterChange(); + return ret; + }; + const delRequest = async ({ row }) => { + const ret = await api.DelObj(row.id); + await afterChange(); + return ret; + }; + + const addRequest = async ({ form }) => { + const ret = await api.AddObj(form); + await afterChange(); + return ret; + }; + let permissionTreeDict = dict({ + url: "/sys/authority/permission/tree", + isTree: true, + value: "id", + label: "title", + async onReady({ dict }) { + dict.setData([{ id: -1, title: "根节点", children: dict.data }]); + } + }); + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + actionbar: { + show: false + }, + toolbar: { + show: false + }, + table: { + show: false + // scroll: { fixed: true } + }, + rowHandle: { + fixed: "right" + }, + search: { + show: false + }, + pagination: { + show: false, + pageSize: 100000 + }, + columns: { + id: { + title: "id", + type: "number", + form: { show: false }, // 表单配置 + column: { + width: 120, + sortable: "custom" + } + }, + title: { + title: "权限名称", + type: "text", + form: { + rules: [ + { required: true, message: "请输入权限名称" }, + { max: 50, message: "最大50个字符" } + ], + component: { + placeholder: "权限名称" + } + }, + column: { + width: 200 + } + }, + + permission: { + title: "权限代码", + type: "text", + column: { + width: 170 + }, + form: { + rules: [ + { required: true, message: "请输入权限代码" }, + { max: 100, message: "最大100个字符" } + ], + component: { + placeholder: "例如:sys:user:view" + } + } + }, + sort: { + title: "排序", + type: "number", + column: { + width: 100 + }, + form: { + value: 100, + rules: [{ required: true, type: "number", message: "排序号必填" }] + } + }, + parentId: { + title: "父节点", + type: "dict-tree", + column: { + width: 100 + }, + dict: permissionTreeDict, + form: { + value: -1, + component: { + multiple: false, + defaultExpandAll: true, + dict: { cache: false }, + fieldNames: { + value: "id", + label: "title" + } + } + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/sys/authority/permission/fs-permission-tree.vue b/packages/ui/certd-client/src/views/sys/authority/permission/fs-permission-tree.vue new file mode 100644 index 000000000..692ca1ddb --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/permission/fs-permission-tree.vue @@ -0,0 +1,178 @@ + + + + + diff --git a/packages/ui/certd-client/src/views/sys/authority/permission/index.vue b/packages/ui/certd-client/src/views/sys/authority/permission/index.vue new file mode 100644 index 000000000..0005298e3 --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/permission/index.vue @@ -0,0 +1,90 @@ + + + + diff --git a/packages/ui/certd-client/src/views/sys/authority/role/api.js b/packages/ui/certd-client/src/views/sys/authority/role/api.js new file mode 100644 index 000000000..6793b6fa3 --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/role/api.js @@ -0,0 +1,70 @@ +import { request } from "/src/api/service"; +const apiPrefix = "/sys/authority/role"; +export async function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "post", + data: query + }); +} + +export async function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export async function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export async function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export async function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "post", + params: { id } + }); +} + +/** + * 获取角色权限资源 + * @param roleId + * @returns {*} + * @constructor + */ +export function getPermissionIds(roleId) { + return request({ + url: apiPrefix + "/getPermissionIds", + method: "post", + params: { id: roleId } + }); +} + +/** + * 授权 + * @param roleId + * @param permissionIds + * @returns {*} + * @constructor + */ +export function DoAuthz(roleId, permissionIds) { + return request({ + url: apiPrefix + "/authz", + method: "post", + data: { roleId, permissionIds } + }); +} diff --git a/packages/ui/certd-client/src/views/sys/authority/role/crud.jsx b/packages/ui/certd-client/src/views/sys/authority/role/crud.jsx new file mode 100644 index 000000000..a4c7290ef --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/role/crud.jsx @@ -0,0 +1,81 @@ +import * as api from "./api"; +export default function ({ expose, authz }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + rowHandle: { + width: 300, + buttons: { + authz: { + type: "link", + text: "授权", + async click(context) { + await authz.authzOpen(context.record.id); + } + } + } + }, + columns: { + id: { + title: "id", + form: { show: false }, // 表单配置 + column: { + width: 70, + sorter: true + } + }, + name: { + title: "角色名称", + type: "text", + search: { show: true }, + form: { + rules: [ + { required: true, message: "请输入角色名称" }, + { max: 50, message: "最大50个字符" } + ] + }, // 表单配置 + column: { + sorter: true + } + }, + createTime: { + title: "创建时间", + type: "datetime", + column: { + sorter: true + }, + form: { + show: false + } + }, + updateTime: { + title: "更新时间", + type: "datetime", + column: { + sorter: true + }, + form: { show: false } // 表单配置 + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/sys/authority/role/index.vue b/packages/ui/certd-client/src/views/sys/authority/role/index.vue new file mode 100644 index 000000000..089cf1cdd --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/role/index.vue @@ -0,0 +1,133 @@ + + + diff --git a/packages/ui/certd-client/src/views/sys/authority/user/api.js b/packages/ui/certd-client/src/views/sys/authority/user/api.js new file mode 100644 index 000000000..55474d504 --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/user/api.js @@ -0,0 +1,41 @@ +import { request } from "/src/api/service"; +const apiPrefix = "/sys/authority/user"; +export async function GetList(query) { + return request({ + url: apiPrefix + "/page", + method: "post", + data: query + }); +} + +export async function AddObj(obj) { + return request({ + url: apiPrefix + "/add", + method: "post", + data: obj + }); +} + +export async function UpdateObj(obj) { + return request({ + url: apiPrefix + "/update", + method: "post", + data: obj + }); +} + +export async function DelObj(id) { + return request({ + url: apiPrefix + "/delete", + method: "post", + params: { id } + }); +} + +export async function GetObj(id) { + return request({ + url: apiPrefix + "/info", + method: "post", + params: { id } + }); +} diff --git a/packages/ui/certd-client/src/views/sys/authority/user/crud.jsx b/packages/ui/certd-client/src/views/sys/authority/user/crud.jsx new file mode 100644 index 000000000..291e31f35 --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/user/crud.jsx @@ -0,0 +1,146 @@ +import * as api from "./api"; +import { dict } from "@fast-crud/fast-crud"; +export default function ({ expose }) { + const pageRequest = async (query) => { + return await api.GetList(query); + }; + const editRequest = async ({ form, row }) => { + form.id = row.id; + return await api.UpdateObj(form); + }; + const delRequest = async ({ row }) => { + return await api.DelObj(row.id); + }; + + const addRequest = async ({ form }) => { + return await api.AddObj(form); + }; + return { + crudOptions: { + request: { + pageRequest, + addRequest, + editRequest, + delRequest + }, + rowHandle: { + fixed: "right" + }, + table: { + scroll: { + //使用固定列时需要设置此值,并且大于等于列宽度之和的值 + x: 1400 + } + }, + columns: { + id: { + title: "id", + form: { show: false }, // 表单配置 + column: { + width: 70, + sorter: true + } + }, + createTime: { + title: "创建时间", + type: "datetime", + form: { show: false }, // 表单配置 + column: { + width: 180, + sorter: true + } + }, + // updateTime: { + // title: "修改时间", + // type: "datetime", + // form: { show: false }, // 表单配置 + // column: { + // sortable: "update_time", + // width: 180 + // } + // }, + username: { + title: "用户名", + type: "text", + search: { show: true }, // 开启查询 + form: { + rules: [ + { required: true, message: "请输入用户名" }, + { max: 50, message: "最大50个字符" } + ] + }, + editForm: { component: { disabled: true } }, + column: { + sorter: true + } + }, + password: { + title: "密码", + type: "text", + key: "password", + column: { + show: false + }, + form: { + rules: [{ max: 50, message: "最大50个字符" }], + component: { + showPassword: true + }, + helper: "填写则修改密码" + } + }, + nickName: { + title: "昵称", + type: "text", + search: { show: true }, // 开启查询 + form: { + rules: [{ max: 50, message: "最大50个字符" }] + }, + column: { + sorter: true + } + }, + avatar: { + title: "头像", + type: "cropper-uploader", + column: { + width: 100, + component: { + //设置高度,修复操作列错位的问题 + style: { + height: "30px", + width: "auto" + } + } + } + }, + remark: { + title: "备注", + type: "text", + column: { + sorter: true + }, + form: { + rules: [{ max: 100, message: "最大100个字符" }] + } + }, + roles: { + title: "角色", + type: "dict-select", + dict: dict({ + url: "/sys/authority/role/list", + value: "id", + label: "name" + }), // 数据字典 + form: { + component: { mode: "multiple" } + }, + column: { + width: 250, + sortable: true + } + } + } + } + }; +} diff --git a/packages/ui/certd-client/src/views/sys/authority/user/index.vue b/packages/ui/certd-client/src/views/sys/authority/user/index.vue new file mode 100644 index 000000000..33f0c7a55 --- /dev/null +++ b/packages/ui/certd-client/src/views/sys/authority/user/index.vue @@ -0,0 +1,45 @@ + + + diff --git a/packages/ui/certd-client/tailwind.config.js b/packages/ui/certd-client/tailwind.config.js new file mode 100644 index 000000000..ec39f7e53 --- /dev/null +++ b/packages/ui/certd-client/tailwind.config.js @@ -0,0 +1,11 @@ +module.exports = { + purge: [], + darkMode: false, // or 'media' or 'class' + theme: { + extend: {} + }, + variants: { + extend: {} + }, + plugins: [] +}; diff --git a/packages/ui/certd-client/tests/unit/example.spec.ts b/packages/ui/certd-client/tests/unit/example.spec.ts new file mode 100644 index 000000000..bc9939b65 --- /dev/null +++ b/packages/ui/certd-client/tests/unit/example.spec.ts @@ -0,0 +1,13 @@ +import { expect } from 'chai' +import { shallowMount } from '@vue/test-utils' +import HelloWorld from '@/components/HelloWorld.vue' + +describe('HelloWorld.vue', () => { + it('renders props.msg when passed', () => { + const msg = 'new message' + const wrapper = shallowMount(HelloWorld, { + props: { msg } + }) + expect(wrapper.text()).to.include(msg) + }) +}) diff --git a/packages/ui/certd-client/tsconfig.json b/packages/ui/certd-client/tsconfig.json new file mode 100644 index 000000000..3fb89b64f --- /dev/null +++ b/packages/ui/certd-client/tsconfig.json @@ -0,0 +1,46 @@ +{ + "compilerOptions": { + // 这样就可以对 `this` 上的数据属性进行更严格的推断` + "noImplicitAny": false, + "target": "esnext", + "module": "esnext", + "strict": true, + "jsx": "preserve", + "importHelpers": true, + "moduleResolution": "node", + "experimentalDecorators": true, + "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "strictNullChecks" :false, + "sourceMap": true, + "baseUrl": ".", + "outDir": "./dist/ts", + "types": [ + "mocha", + "chai", + "node" + ], + "paths": { + "/@/*": ["src/*"], + "/src/*": ["src/*"], + "/#/*": ["types/*"] + }, + "lib": [ + "esnext", + "dom", + "dom.iterable", + "scripthost" + ] + }, + "include": [ + "src/**/*.ts", + "src/**/*.tsx", + "src/**/*.vue", + "tests/**/*.ts", + "tests/**/*.tsx" + ], + "exclude": [ + "node_modules" + ] +} diff --git a/packages/ui/certd-client/vite.config.ts b/packages/ui/certd-client/vite.config.ts new file mode 100644 index 000000000..15ea9604f --- /dev/null +++ b/packages/ui/certd-client/vite.config.ts @@ -0,0 +1,101 @@ +import vue from "@vitejs/plugin-vue"; +import vueJsx from "@vitejs/plugin-vue-jsx"; +import visualizer from "rollup-plugin-visualizer"; +import viteCompression from "vite-plugin-compression"; +import PurgeIcons from "vite-plugin-purge-icons"; +import * as path from "path"; +import WindiCSS from "vite-plugin-windicss"; +// import { generateModifyVars } from "./build/modify-vars"; +// import { configThemePlugin } from "./build/theme-plugin"; +// import OptimizationPersist from "vite-plugin-optimize-persist"; +// import PkgConfig from "vite-plugin-package-config"; +// https://vitejs.dev/config/ +// 增加环境变量 _ +process.env.VITE_APP_VERSION = require("./package.json").version; +process.env.VITE_APP_BUILD_TIME = require("dayjs")().format("YYYY-M-D HH:mm:ss"); + +export default ({ command, mode }) => { + console.log("args", command, mode); + + let devServerFs: any = {}; + let devAlias: any[] = []; + if (mode.startsWith("debug")) { + devAlias = [ + { find: /@fast-crud\/fast-crud\/dist/, replacement: path.resolve("../../fast-crud/src/") }, + { find: /@fast-crud\/fast-crud$/, replacement: path.resolve("../../fast-crud/src/") }, + { find: /@fast-crud\/fast-extends\/dist/, replacement: path.resolve("../../fast-extends/src/") }, + { find: /@fast-crud\/fast-extends$/, replacement: path.resolve("../../fast-extends/src/") }, + { find: /@fast-crud\/ui-antdv$/, replacement: path.resolve("../../ui/ui-antdv/src/") } + ]; + devServerFs = { + // 如果是你自己的项目,这项可以删掉 + // 这里配置dev启动时读取的项目根目录 + allow: ["../../"] + }; + console.log("devAlias", devAlias); + } + + return { + base: "/antdv/", + plugins: [ + vueJsx(), + vue(), + // 压缩build后的代码 + viteCompression(), + PurgeIcons({ + // iconSource: "local" + // remoteDataAPI: "https://gitee.com/fast-crud/collections-json/raw/master/json", + // includedCollections: ["ion"] + }), + //主题色替换 + //...configThemePlugin(true), + // viteThemePlugin({ + // // Match the color to be modified + // colorVariables: ["#1890ff", "#40a9ff"] + // }), + // windicss tailwindcss + WindiCSS() + ], + esbuild: { + // pure: ["console.log", "debugger"], + jsxFactory: "h", + jsxFragment: "Fragment" + }, + resolve: { + alias: [ + ...devAlias, + { find: "/@", replacement: path.resolve("./src") }, + { find: "/#", replacement: path.resolve("./types") } + ], + dedupe: ["vue"] + }, + optimizeDeps: { + include: ["ant-design-vue"] + }, + build: { + rollupOptions: { + plugins: [visualizer()] + } + }, + css: { + preprocessorOptions: { + less: { + // 修改默认主题颜色,配置less变量 + // modifyVars: generateModifyVars(), + javascriptEnabled: true + } + } + }, + server: { + port: 3002, + fs: devServerFs, + proxy: { + // with options + "/api": { + //配套后端 https://github.com/fast-crud/fs-server-js + target: "http://127.0.0.1:7001" + } + } + } + }; +}; diff --git a/packages/ui/certd-client/windi.config.js b/packages/ui/certd-client/windi.config.js new file mode 100644 index 000000000..6d82c4951 --- /dev/null +++ b/packages/ui/certd-client/windi.config.js @@ -0,0 +1,6 @@ +// windi.config.ts +export default { + attributify: { + prefix: "w:" + } +};