From 7a793bd4729fdc3d1f67a5768b1af9492a1eee70 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Fri, 20 Mar 2026 09:48:21 +0800 Subject: [PATCH] init --- .editorconfig | 13 + .gitignore | 14 + .vscode/settings.json | 47 +++ README.md | 75 ++++ blessed_by_buddha.js | 66 ++++ eslint.config.js | 49 +++ jjb.babel.js | 23 ++ jjb.config.js | 77 ++++ jsconfig.json | 9 + package.json | 50 +++ public/index.html | 54 +++ router.md | 19 + src/api/eightwork/index.js | 18 + src/api/global/index.js | 11 + src/components/index.js | 1 + src/enumerate/constant/index.js | 25 ++ src/enumerate/context/index.js | 8 + src/enumerate/namespace/index.js | 8 + src/main.js | 49 +++ .../Enterprise/HotWork/Archive/List/index.js | 7 + .../Enterprise/HotWork/Archive/View/index.js | 7 + .../Enterprise/HotWork/Archive/index.js | 5 + .../HotWork/ForceClose/List/index.js | 7 + .../HotWork/ForceClose/View/index.js | 7 + .../Enterprise/HotWork/ForceClose/index.js | 5 + .../Enterprise/HotWork/Homework/List/index.js | 334 ++++++++++++++++++ .../Enterprise/HotWork/Homework/View/index.js | 264 ++++++++++++++ .../HotWork/Homework/View/index.less | 27 ++ .../Enterprise/HotWork/Homework/index.js | 5 + .../Container/Enterprise/HotWork/index.js | 5 + src/pages/Container/Enterprise/index.js | 5 + src/pages/Container/Entry/index.js | 31 ++ .../Stakeholder/HotWork/Archive/List/index.js | 7 + .../Stakeholder/HotWork/Archive/View/index.js | 7 + .../Stakeholder/HotWork/Archive/index.js | 5 + .../HotWork/Homework/List/index.js | 7 + .../HotWork/Homework/View/index.js | 7 + .../Stakeholder/HotWork/Homework/index.js | 5 + .../Container/Stakeholder/HotWork/index.js | 5 + src/pages/Container/Stakeholder/index.js | 5 + .../Supervision/HotWork/List/index.js | 92 +++++ .../Supervision/HotWork/RecordsList/index.js | 10 + .../Container/Supervision/HotWork/index.js | 5 + src/pages/Container/Supervision/index.js | 5 + src/pages/Container/index.js | 101 ++++++ src/pages/index.js | 8 + src/utils/flow.js | 63 ++++ webstorm.config.js | 16 + 48 files changed, 1673 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 .vscode/settings.json create mode 100644 README.md create mode 100644 blessed_by_buddha.js create mode 100644 eslint.config.js create mode 100644 jjb.babel.js create mode 100644 jjb.config.js create mode 100644 jsconfig.json create mode 100644 package.json create mode 100644 public/index.html create mode 100644 router.md create mode 100644 src/api/eightwork/index.js create mode 100644 src/api/global/index.js create mode 100644 src/components/index.js create mode 100644 src/enumerate/constant/index.js create mode 100644 src/enumerate/context/index.js create mode 100644 src/enumerate/namespace/index.js create mode 100644 src/main.js create mode 100644 src/pages/Container/Enterprise/HotWork/Archive/List/index.js create mode 100644 src/pages/Container/Enterprise/HotWork/Archive/View/index.js create mode 100644 src/pages/Container/Enterprise/HotWork/Archive/index.js create mode 100644 src/pages/Container/Enterprise/HotWork/ForceClose/List/index.js create mode 100644 src/pages/Container/Enterprise/HotWork/ForceClose/View/index.js create mode 100644 src/pages/Container/Enterprise/HotWork/ForceClose/index.js create mode 100644 src/pages/Container/Enterprise/HotWork/Homework/List/index.js create mode 100644 src/pages/Container/Enterprise/HotWork/Homework/View/index.js create mode 100644 src/pages/Container/Enterprise/HotWork/Homework/View/index.less create mode 100644 src/pages/Container/Enterprise/HotWork/Homework/index.js create mode 100644 src/pages/Container/Enterprise/HotWork/index.js create mode 100644 src/pages/Container/Enterprise/index.js create mode 100644 src/pages/Container/Entry/index.js create mode 100644 src/pages/Container/Stakeholder/HotWork/Archive/List/index.js create mode 100644 src/pages/Container/Stakeholder/HotWork/Archive/View/index.js create mode 100644 src/pages/Container/Stakeholder/HotWork/Archive/index.js create mode 100644 src/pages/Container/Stakeholder/HotWork/Homework/List/index.js create mode 100644 src/pages/Container/Stakeholder/HotWork/Homework/View/index.js create mode 100644 src/pages/Container/Stakeholder/HotWork/Homework/index.js create mode 100644 src/pages/Container/Stakeholder/HotWork/index.js create mode 100644 src/pages/Container/Stakeholder/index.js create mode 100644 src/pages/Container/Supervision/HotWork/List/index.js create mode 100644 src/pages/Container/Supervision/HotWork/RecordsList/index.js create mode 100644 src/pages/Container/Supervision/HotWork/index.js create mode 100644 src/pages/Container/Supervision/index.js create mode 100644 src/pages/Container/index.js create mode 100644 src/pages/index.js create mode 100644 src/utils/flow.js create mode 100644 webstorm.config.js diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..271822f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 2 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b840685 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules + +# production +/dist +/demo + +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.idea +yarn.lock \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..96ed201 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,47 @@ +{ + "prettier.enable": false, + "editor.formatOnSave": false, + + "editor.codeActionsOnSave": { + "source.fixAll.eslint": "explicit", + "source.organizeImports": "never" + }, + + "eslint.rules.customizations": [ + { "rule": "style/*", "severity": "off", "fixable": true }, + { "rule": "format/*", "severity": "off", "fixable": true }, + { "rule": "*-indent", "severity": "off", "fixable": true }, + { "rule": "*-spacing", "severity": "off", "fixable": true }, + { "rule": "*-spaces", "severity": "off", "fixable": true }, + { "rule": "*-order", "severity": "off", "fixable": true }, + { "rule": "*-dangle", "severity": "off", "fixable": true }, + { "rule": "*-newline", "severity": "off", "fixable": true }, + { "rule": "*quotes", "severity": "off", "fixable": true }, + { "rule": "*semi", "severity": "off", "fixable": true } + ], + + "eslint.validate": [ + "javascript", + "javascriptreact", + "typescript", + "typescriptreact", + "vue", + "html", + "markdown", + "json", + "json5", + "jsonc", + "yaml", + "toml", + "xml", + "gql", + "graphql", + "astro", + "svelte", + "css", + "less", + "scss", + "pcss", + "postcss" + ] +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..a3da031 --- /dev/null +++ b/README.md @@ -0,0 +1,75 @@ +# 微应用模板说明文档 + +## 在线文档 + +https://www.yuque.com/buhangjiecheshen-ymbtb/qc0093/gxdun1dphetcurko + + +## 安装依赖 +项目依赖可通过 **yarn** 或 **npm** 进行安装: + +```bash +# 使用 yarn +yarn + +# 或使用 npm +npm i +``` + +## 开发服务&打包应用 + +```bash +# 启动开发服务 +yarn serve: +# 或 +npm run serve: + +# 开发环境打包 +yarn build: +# 或 +npm run build: +``` + +## 路由配置&路由访问&自动化路由 +所有页面必须放在`src/pages/container`目录下,启动访问页面请在浏览器地址栏输入`//container/<你的路由页面文件名称>` +解释: +1. 所有页面组件命名为`index.js`或`index.jsx`,必须放在一个首字母大写的文件中。 +2. `container`为固定路径访问格式 +3. ``为应用的唯一标识符,也是应用路由的`basename`,在底座中用于区分其他应用。可在根目录 `jjb.config.js` 文件的 `appIdentifier` 节点中进行修改。 +4. 自动化路由将根据`pages/container`中的路由页面文件自动生成路由树。 +5. `id`匹配路由,文件夹命名`_id` + +## 应用接口环境配置 +应用接口环境相关配置在根目录 `jjb.config.js` 文件的 `environment` 节点中进行定义。 + +## 应用开发服务配置 +应用开发服务相关配置在根目录 `jjb.config.js` 文件的 `server` 节点中进行定义。 + +## Babel 配置 +应用的 `Babel` 配置在根目录 `jjb.babel.js` 文件中进行管理。 + +## 目录说明 + +1. `src/api/` 配置各个 store 模块的接口数据。 +2. `src/components/` 全局公共组件。 +3. `src/enumerate/` 全局各种枚举配置。 +4. `src/pages/` 页面文件目录。 +5. `src/main.js` 应用的入口文件。 + +## 核心依赖 +1. `@cqsjjb/jjb-common-decorator` + 1. 公共装饰器库,内部包含: + 1. 按钮权限处理 + 2. antd/Table 控制 + 3. 文本重命名处理 + 4. 具体使用方式可参考各个模块的 `d.ts`。 +2. `@cqsjjb/jjb-common-lib` + 1. 公共工具库,具体 API 使用请查看 `d.ts` +3. `@cqsjjb/jjb-dva-runtime` + 1. 核心运行时,基于 `dvajs` 实现。 + 1. 应用核心依赖模块 + 2. 应用的自动化路由 + 3. `store` 模块接口数据处理 + 4. 均基于此依赖实现,具体使用方式请查看 `d.ts`。 +4. `@cqsjjb/jjb-react-admin-component` + 1. 公共组件库,具体组件使用方式请查看 `d.ts`。 diff --git a/blessed_by_buddha.js b/blessed_by_buddha.js new file mode 100644 index 0000000..340fa53 --- /dev/null +++ b/blessed_by_buddha.js @@ -0,0 +1,66 @@ +/* + _ooOoo_ + o8888888o + 88" . "88 + (| -_- |) + O\ = /O + ____/`---'\____ + . ' \\| |// `. + / \\||| : |||// \ + / _||||| -:- |||||- \ + | | \\\ - /// | | + | \_| ''\---/'' | | + \ .-\__ `-` ___/-. / + ___`. .' /--.--\ `. . __ + ."" '< `.___\_<|>_/___.' >'"". + | | : `- \`.;`\ _ /`;.`/ - ` : | | + \ \ `-. \_ __\ /__ _/ .-` / / + ======`-.____`-.___\_____/___.-`____.-'====== + `=---=' + + ............................................. + 佛祖保佑 永无BUG + 佛曰: + 写字楼里写字间,写字间里程序员; + 程序人员写程序,又拿程序换酒钱。 + 酒醒只在网上坐,酒醉还来网下眠; + 酒醉酒醒日复日,网上网下年复年。 + 但愿老死电脑间,不愿鞠躬老板前; + 奔驰宝马贵者趣,公交自行程序员。 + 别人笑我忒疯癫,我笑自己命太贱; + 不见满街漂亮妹,哪个归得程序员? + */ + +const blessedByBuddha + = "%c _ooOoo_\n" + + " o8888888o\n" + + " 88\" . \"88\n" + + " (| -_- |)\n" + + " O\\ = /O\n" + + " ____/`---'\\____\n" + + " . ' \\\\| |// `.\n" + + " / \\\\||| : |||// \\\n" + + " / _||||| -:- |||||- \\\n" + + " | | \\\\\\ - /// | |\n" + + " | \\_| ''\\---/'' | |\n" + + " \\ .-\\__ `-` ___/-. /\n" + + " ___`. .' /--.--\\ `. . __\n" + + " .\"\" '< `.___\\_<|>_/___.' >'\"\".\n" + + " | | : `- \\`.;`\\ _ /`;.`/ - ` : | |\n" + + " \\ \\ `-. \\_ __\\ /__ _/ .-` / /\n" + + " ======`-.____`-.___\\_____/___.-`____.-'======\n" + + " `=---='\n" + + "\n" + + "%c .............................................\n" + + " 佛祖保佑 永无BUG\n" + + "\n" + + "%c 佛曰:\n" + + " 写字楼里写字间,写字间里程序员;\n" + + " 程序人员写程序,又拿程序换酒钱。\n" + + " 酒醒只在网上坐,酒醉还来网下眠;\n" + + " 酒醉酒醒日复日,网上网下年复年。\n" + + " 但愿老死电脑间,不愿鞠躬老板前;\n" + + " 奔驰宝马贵者趣,公交自行程序员。\n" + + " 别人笑我忒疯癫,我笑自己命太贱;\n" + + " 不见满街漂亮妹,哪个归得程序员?"; +console.log(blessedByBuddha, "color:#ffd700", "color:red", "color:#1e80ff"); diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..fab559e --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,49 @@ +import antfu from "@antfu/eslint-config"; + +export default antfu({ + formatters: { + html: false, + css: true, + }, + test: false, + typescript: true, + react: true, + vue: false, + markdown: false, + stylistic: { + semi: true, + quotes: "double", + }, + overrides: { + react: { + "react/no-comment-textnodes": "off", + "react-hooks-extra/no-unnecessary-use-prefix": "off", + "react-hooks-extra/prefer-use-state-lazy-initialization": "off", + "react-hooks/exhaustive-deps": "off", + "react/no-implicit-key": "off", + }, + javascript: { + "no-console": process.env.NODE_ENV === "production" ? "error" : "warn", + "no-debugger": process.env.NODE_ENV === "production" ? "error" : "warn", + "no-alert": process.env.NODE_ENV === "production" ? "error" : "warn", + "no-restricted-syntax": [ + "error", + { + selector: "VariableDeclarator[id.name='pd']", + message: "不允许使用 pd,请改用有语义化的变量名", + }, + { + selector: "ObjectExpression > Property[key.name='pd']", + message: "不允许使用 pd,请改用有语义化的变量名", + }, + ], + "no-unused-vars": ["error", { varsIgnorePattern: "^React$" }], + }, + }, + rules: { + "antfu/top-level-function": "off", + "node/prefer-global/process": "off", + "dot-notation": "off", + "linebreak-style": ["off", "windows"], + }, +}); diff --git a/jjb.babel.js b/jjb.babel.js new file mode 100644 index 0000000..e58cbef --- /dev/null +++ b/jjb.babel.js @@ -0,0 +1,23 @@ +module.exports = { + compact: false, + // 插件 + plugins: [ + [ + "@babel/plugin-proposal-decorators", + { + legacy: true, + }, + ], + ], + // 预设 + presets: [ + ["@babel/preset-env", { + targets: { + browsers: ["ie >= 10"], + }, + }], + ["@babel/preset-react", { + runtime: "automatic", + }], + ], +}; diff --git a/jjb.config.js b/jjb.config.js new file mode 100644 index 0000000..5d3ff7e --- /dev/null +++ b/jjb.config.js @@ -0,0 +1,77 @@ +module.exports = { + // 应用后端git地址,部署上线需要 + javaGit: "", + // 应用后端仓库名称,部署上线需要 + javaGitName: "", + // 环境配置 + environment: { + development: { + // 应用后端分支名称,部署上线需要 + javaGitBranch: "", + // 接口服务地址 + API_HOST: "https://gbs-gateway.qhdsafety.com", + // API_HOST: "http://192.168.20.100:30140", + }, + production: { + // 应用后端分支名称,部署上线需要 + javaGitBranch: "", + // 接口服务地址 + API_HOST: "", + }, + }, + // 应用唯一标识符 + appIdentifier: "eightwork", + // 应用上下文注入全局变量 + contextInject: { + // 应用Key + appKey: "", + // fileUrl: "http://192.168.20.240:9787/mnt/", + fileUrl: "https://jpfz.qhdsafety.com/gbsFileTest/", + }, + // public/index.html注入全局变量 + windowInject: { + // 应用标题 + title: "微应用模板", + // 注入css链接集合 + links: [], + element: { + root: { + // 挂载DOM元素ID + id: "root", + }, + }, + // 注入js链接集合 + scripts: [], + }, + // 开发服务 + server: { + // 监听端口号 + port: "8063", + // 服务地址 + host: "127.0.0.1", + // 是否自动打开浏览器 + open: true, + }, + // 框架 + framework: { + // ant-design + antd: { + // 全局antd-class-name前缀 + "ant-prefix": "micro-temp", + // 全局字体 + "fontFamily": "PingFangSC-Regular", + // 全局主题色 + "colorPrimary": "#1677ff", + // 全局圆角 + "borderRadius": 2, + }, + }, + // webpack + webpackConfig: { + // 单页面插件 + htmlWebpackPluginOption: { + // 自动注入编译后的文件到public/index.html中 + inject: true, + }, + }, +}; diff --git a/jsconfig.json b/jsconfig.json new file mode 100644 index 0000000..4cf89dc --- /dev/null +++ b/jsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "baseUrl": "src", + "paths": { + "~/*": ["*"] + } + }, + "include": ["src"] +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..eb66fec --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "micro-app", + "version": "2.0.0", + "description": "建教帮微应用模板", + "author": "JJB", + "license": "MIT", + "main": "index.js", + "scripts": { + "serve": "node node_modules/@cqsjjb/scripts/webpack.dev.server.js", + "build": "node node_modules/@cqsjjb/scripts/webpack.build.js", + "push": "jjb-cmd push java production", + "clean-cache": "rimraf node_modules/.cache/webpack", + "serve:development": "cross-env NODE_ENV=development npm run serve", + "serve:production": "cross-env NODE_ENV=production npm run serve", + "build:development": "cross-env NODE_ENV=development npm run build", + "build:production": "cross-env NODE_ENV=production npm run build", + "code-optimization": "node node_modules/@cqsjjb/scripts/code-optimization.js", + "lint": "eslint --ext .js,.jsx,.tsx --fix src" + }, + "dependencies": { + "@ant-design/icons": "^5.6.1", + "@ant-design/pro-components": "^2.8.10", + "@ant-design/pro-flow": "^1.3.12", + "@cqsjjb/jjb-common-decorator": "latest", + "@cqsjjb/jjb-common-lib": "latest", + "@cqsjjb/jjb-dva-runtime": "latest", + "@cqsjjb/jjb-react-admin-component": "latest", + "@xyflow/react": "^12.10.1", + "ahooks": "^3.9.5", + "antd": "^5.27.6", + "dayjs": "^1.11.7", + "lodash-es": "^4.17.21", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-to-print": "^3.3.0", + "zy-react-library": "1.2.6" + }, + "devDependencies": { + "@antfu/eslint-config": "^5.4.1", + "@babel/plugin-proposal-decorators": "^7.19.3", + "@cqsjjb/scripts": "2.0.0-alpha-1", + "@eslint-react/eslint-plugin": "^2.2.2", + "cross-env": "^7.0.3", + "eslint": "^9.37.0", + "eslint-plugin-format": "^1.0.2", + "eslint-plugin-react-hooks": "^7.0.0", + "eslint-plugin-react-refresh": "^0.4.23", + "typescript": "^5.9.3" + } +} diff --git a/public/index.html b/public/index.html new file mode 100644 index 0000000..9bfa85d --- /dev/null +++ b/public/index.html @@ -0,0 +1,54 @@ + + + + + + + + + + + + + <% for (const item of $links) { %> + + <% } %> + -- + + + <% for (const item of $scripts) { %> + + <% } %> + + + + + + <% const { root } = $element; %> +
+ + diff --git a/router.md b/router.md new file mode 100644 index 0000000..e894032 --- /dev/null +++ b/router.md @@ -0,0 +1,19 @@ +### 企业端 +- 动火作业/作业管理 + `/eightwork/container/enterprise/hotWork/homework/list` +- 动火作业/归档管理 + `/eightwork/container/enterprise/hotWork/archive/list` +- 动火作业/关闭管理 + `/eightwork/container/enterprise/hotWork/forceClose/list` + + +### 相关方端 +- 动火作业/作业管理 + `/eightwork/container/stakeholder/hotWork/homework/list` +- 动火作业/归档管理 + `/eightwork/container/stakeholder/hotWork/archive/list` + + +### 监管端 +- 动火作业 + `/eightwork/container/supervision/hotWork/list` diff --git a/src/api/eightwork/index.js b/src/api/eightwork/index.js new file mode 100644 index 0000000..9bfbb6e --- /dev/null +++ b/src/api/eightwork/index.js @@ -0,0 +1,18 @@ +import { declareRequest } from "@cqsjjb/jjb-dva-runtime"; + +export const eightworkList = declareRequest( + "eightworkLoading", + `Post > @/eightwork/eightworkInfo/list`, +); +export const eightworkInfo = declareRequest( + "eightworkLoading", + `Get > /eightwork/eightworkInfo/{id}`, +); +export const eightworkType = declareRequest( + "eightworkLoading", + `Post > @/eightwork/eightworkTask/listByWorkType`, +); +export const eightworkRecordsList = declareRequest( + "eightworkLoading", + `Post > @/eightwork/eightworkInfo/list`, +); diff --git a/src/api/global/index.js b/src/api/global/index.js new file mode 100644 index 0000000..ba35796 --- /dev/null +++ b/src/api/global/index.js @@ -0,0 +1,11 @@ +export {}; + +// export const riskList = declareRequest( +// "loading", +// "Post > @/xxx", +// "dataSource: [] | res.data || [] & total: 0 | res.totalCount || 0 & pageIndex: 1 | res.pageIndex || 1 & pageSize: 10 | res.pageSize || 10", +// ); +// export const riskDelete = declareRequest( +// "loading", +// "Delete > @/xxx/{id}", +// ); diff --git a/src/components/index.js b/src/components/index.js new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/src/components/index.js @@ -0,0 +1 @@ +export {}; diff --git a/src/enumerate/constant/index.js b/src/enumerate/constant/index.js new file mode 100644 index 0000000..0ec0b80 --- /dev/null +++ b/src/enumerate/constant/index.js @@ -0,0 +1,25 @@ +/** + * 全局常量定义 + */ + +export {}; + +// HOT_WORK("hot_work", "DH","动火作业"), +// BLINDBOARD_WORK("blindboard_work", "MBCD","盲板抽堵作业"), +// BREAKGROUND_WORK("breakground_work", "DT","动土作业"), +// CONFINEDSPACE_WORK("confinedspace_work", "SXKJ","受限空间作业"), +// CUTROAD_WORK("cutroad_work", "DL","短路作业"), +// ELECTRICITY_WORK("electricity_work", "LSYD","临时用电作业"), +// HIGH_WORK("high_work", "GC","高处作业"), +// HOISTING("hoisting_work", "DZ","吊装作业"); + +export const STATUS_ENUM = [ + { name: "未开始", bianma: "0" }, + { name: "进行中", bianma: "1" }, + { name: "强制归档", bianma: "998" }, + { name: "归档", bianma: "999" }, +]; +export const WORK_TYPE_ENUM = [ + { name: "相关方", bianma: "1" }, + { name: "内部", bianma: "998" }, +]; diff --git a/src/enumerate/context/index.js b/src/enumerate/context/index.js new file mode 100644 index 0000000..2b11e05 --- /dev/null +++ b/src/enumerate/context/index.js @@ -0,0 +1,8 @@ +/** + * 全局上下文定义 + */ + +import React from "react"; + +// 获取antd全局静态方法 +export const InjectContext = React.createContext({}); diff --git a/src/enumerate/namespace/index.js b/src/enumerate/namespace/index.js new file mode 100644 index 0000000..8caea58 --- /dev/null +++ b/src/enumerate/namespace/index.js @@ -0,0 +1,8 @@ +/** + * 全局数据状态管理模块定义 + */ + +import { defineNamespace } from "@cqsjjb/jjb-dva-runtime"; + +export const NS_GLOBAL = defineNamespace("global"); +export const NS_EIGHTWORK = defineNamespace("eightwork"); diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..e8b9f5c --- /dev/null +++ b/src/main.js @@ -0,0 +1,49 @@ +import { setJJBCommonAntdMessage } from "@cqsjjb/jjb-common-lib"; +import { setup } from "@cqsjjb/jjb-dva-runtime"; +import { message } from "antd"; +import dayjs from "dayjs"; +import { getFileUrlFromServer } from "zy-react-library/utils"; +import "dayjs/locale/zh-cn"; +import "../blessed_by_buddha"; + +require("antd/dist/reset.css"); +require("zy-react-library/css/common.less"); + +dayjs.locale("zh-cn"); +setJJBCommonAntdMessage(message); + +const app = setup(); +getFileUrlFromServer(); +// 非底座环境运行 +if (!window.__POWERED_BY_QIANKUN__) { + // 云组件默认依赖 + window.__coreLib = {}; + window.__coreLib.React = require("react"); + window.__coreLib.ReactDOM = require("react-dom"); + window.__coreLib.jjbCommonLib = require("@cqsjjb/jjb-common-lib"); +} + +/** + * @description 挂载 + * @param props {{ setGlobalState: ({ rendered: boolean }) => void }} + * @returns {Promise<*>} '' + */ +export const mount = async (props) => { + // 云组件默认依赖 + window.__coreLib.React = require("react"); + window.__coreLib.ReactDOM = require("react-dom"); + window.__coreLib.jjbCommonLib = require("@cqsjjb/jjb-common-lib"); + app.mount(props); +}; + +/** + * @description 卸载 + * @param props {object} + * @returns {Promise<*>} '' + */ +export const unmount = async props => app.unmount(props); +/** + * @description 启动 + * @param props + */ +export const bootstrap = async props => app.bootstrap(props); diff --git a/src/pages/Container/Enterprise/HotWork/Archive/List/index.js b/src/pages/Container/Enterprise/HotWork/Archive/List/index.js new file mode 100644 index 0000000..d004e42 --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/Archive/List/index.js @@ -0,0 +1,7 @@ +import ListPage from "../../Homework/List"; + +function List(props) { + return (); +} + +export default List; diff --git a/src/pages/Container/Enterprise/HotWork/Archive/View/index.js b/src/pages/Container/Enterprise/HotWork/Archive/View/index.js new file mode 100644 index 0000000..993dfb5 --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/Archive/View/index.js @@ -0,0 +1,7 @@ +import ViewPage from "../../Homework/View"; + +function View(props) { + return (); +} + +export default View; diff --git a/src/pages/Container/Enterprise/HotWork/Archive/index.js b/src/pages/Container/Enterprise/HotWork/Archive/index.js new file mode 100644 index 0000000..9050ce1 --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/Archive/index.js @@ -0,0 +1,5 @@ +function Archive(props) { + return props.children; +} + +export default Archive; diff --git a/src/pages/Container/Enterprise/HotWork/ForceClose/List/index.js b/src/pages/Container/Enterprise/HotWork/ForceClose/List/index.js new file mode 100644 index 0000000..e5348d8 --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/ForceClose/List/index.js @@ -0,0 +1,7 @@ +import ListPage from "../../Homework/List"; + +function List(props) { + return (); +} + +export default List; diff --git a/src/pages/Container/Enterprise/HotWork/ForceClose/View/index.js b/src/pages/Container/Enterprise/HotWork/ForceClose/View/index.js new file mode 100644 index 0000000..993dfb5 --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/ForceClose/View/index.js @@ -0,0 +1,7 @@ +import ViewPage from "../../Homework/View"; + +function View(props) { + return (); +} + +export default View; diff --git a/src/pages/Container/Enterprise/HotWork/ForceClose/index.js b/src/pages/Container/Enterprise/HotWork/ForceClose/index.js new file mode 100644 index 0000000..b345ac4 --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/ForceClose/index.js @@ -0,0 +1,5 @@ +function ForceClose(props) { + return props.children; +} + +export default ForceClose; diff --git a/src/pages/Container/Enterprise/HotWork/Homework/List/index.js b/src/pages/Container/Enterprise/HotWork/Homework/List/index.js new file mode 100644 index 0000000..fb26c15 --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/Homework/List/index.js @@ -0,0 +1,334 @@ +import { FlowView, FlowViewProvider } from "@ant-design/pro-flow"; +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { BaseEdge, EdgeLabelRenderer, getBezierPath } from "@xyflow/react"; +import { Button, Modal, Space } from "antd"; +import { useEffect, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import Page from "zy-react-library/components/Page"; +import Search from "zy-react-library/components/Search"; +import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; +import Table from "zy-react-library/components/Table"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import useTable from "zy-react-library/hooks/useTable"; +import { getLabelName } from "zy-react-library/utils"; +import { STATUS_ENUM, WORK_TYPE_ENUM } from "~/enumerate/constant"; +import { NS_EIGHTWORK } from "~/enumerate/namespace"; +import { getFlowData } from "~/utils/flow"; + +function List(props) { + // status 默认不传是作业管理,999 是归档管理,998 是强制关闭管理 + // entrance 默认不传是企业端,stakeholder 是相关方端,supervision 是监督端 + + const [form] = Search.useForm(); + const query = useGetUrlQuery(); + + const [eightworkType, setEightworkType] = useState([]); + const [forceTerminationModalOpen, setForceTerminationModalOpen] = useState(false); + const [flowModalOpen, setFlowModalOpen] = useState(true); + const [currentId, setCurrentId] = useState(""); + + const { tableProps, getData } = useTable(props["eightworkList"], { + form, + params: { eqWorkType: "hot_work", corpinfoId: query.corpinfoId }, + transform: formData => ({ + geCreateTime: formData.createTime?.[0], + leCreateTime: formData.createTime?.[1], + eqStatus: props.status || formData.eqStatus, + }), + }); + + const getEightworkType = async () => { + const { data } = await props["eightworkType"]({ workType: "hot_work" }); + setEightworkType(data); + }; + + useEffect(() => { + getEightworkType(); + }, []); + + return ( + + }, + { + name: "todo", + label: "服务单位", + render: , + hidden: !(props.entrance === "stakeholder"), + }, + ]} + form={form} + onFinish={getData} + /> + getLabelName({ list: WORK_TYPE_ENUM, status: record.xgfFlag }), + }, + { title: "动火等级", dataIndex: "workLevel" }, + { title: "申请人", dataIndex: "createName" }, + { title: "申请单位", dataIndex: "todo" }, + { title: "申请时间", dataIndex: "createTime" }, + { title: "作业人", dataIndex: "todo" }, + { title: "作业单位", dataIndex: "todo" }, + { title: "作业时间", dataIndex: "todo" }, + { title: "作业内容", dataIndex: "todo" }, + { + title: "审核状态", + dataIndex: "status", + render: (_, record) => getLabelName({ list: STATUS_ENUM, status: record.status }), + }, + { title: "强制关闭原因", dataIndex: "todo", hidden: !(props.status === "998") }, + { + title: "操作", + fixed: "right", + width: 250, + render: (_, record) => ( + + + + {(!props.status && !props.entrance) && ( + + )} + + ), + }, + ]} + {...tableProps} + dataSource={[{}]} + loading={false} + /> + { + forceTerminationModalOpen && ( + { + setForceTerminationModalOpen(false); + setCurrentId(""); + }} + getData={getData} + /> + ) + } + { + flowModalOpen && ( + { + setFlowModalOpen(false); + setCurrentId(""); + }} + /> + ) + } + + ); +} + +const ForceTerminationModalComponent = (props) => { + const [form] = FormBuilder.useForm(); + + const onSubmit = async () => { + + }; + + return ( + +
+
请确认是否强制关闭作业票?
+ +
+
+ ); +}; + +const CustomFlowNode = ({ data }) => { + const { title, backgroundColor, width, height } = data; + return ( +
+ {title} +
+ ); +}; + +const CustomFlowEdge = (edge) => { + console.log(111); + const { + id, + sourceX, + sourceY, + targetX, + targetY, + sourcePosition, + targetPosition, + style = {}, + markerEnd, + } = edge; + + const [edgePath, labelX, labelY] = getBezierPath({ + sourceX, + sourceY, + sourcePosition, + targetX, + targetY, + targetPosition, + }); + console.log(edgePath); + console.log(labelX); + console.log(labelY); + return ( + <> + + +
+ 123123123 +
+
+ + ); +}; + +function FlowModalComponent(props) { + const [flowNodes, setFlowNodes] = useState([]); + const [flowEdges, setFlowEdges] = useState([]); + + const getData = async () => { + const data = { + flowCOList: [ + { status: 1, flowList: ["申请人提报", "张三", "2024-01-15 09:30"] }, + { status: 2, flowList: ["部门审批", "李四"], type: 1, thisFlow: 1 }, + { status: 2, flowList: ["安全部门审批", "王五"] }, + { status: 2, flowList: ["审批通过", "系统"] }, + ], + thisFlow: 1, + }; + + const { nodes, edges } = getFlowData(data.flowCOList, data.thisFlow); + setFlowNodes(nodes); + setFlowEdges(edges); + }; + + useEffect(() => { + getData(); + }, []); + + return ( + 取消, + ]} + > +
+ + + +
+
+ ); +} + +const ForceTerminationModal = Connect([NS_EIGHTWORK], true)(ForceTerminationModalComponent); +const FlowModal = Connect([NS_EIGHTWORK], true)(FlowModalComponent); +export default Connect([NS_EIGHTWORK], true)(List); diff --git a/src/pages/Container/Enterprise/HotWork/Homework/View/index.js b/src/pages/Container/Enterprise/HotWork/Homework/View/index.js new file mode 100644 index 0000000..4620fd1 --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/Homework/View/index.js @@ -0,0 +1,264 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Divider, Image } from "antd"; +import { useEffect, useRef, useState } from "react"; +import { useReactToPrint } from "react-to-print"; +import Page from "zy-react-library/components/Page"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import { NS_EIGHTWORK } from "~/enumerate/namespace"; +import "./index.less"; + +function View(props) { + const query = useGetUrlQuery(); + const contentRef = useRef(null); + const handlePrint = useReactToPrint({ + contentRef, + pageStyle: `@page { + size: landscape; + margin: 0mm; + } + @media print { + body { + margin: 10px; + padding: 10px; + } + } + `, + documentTitle: "", + }); + + const [info, setInfo] = useState({}); + const [safetyMeasures, setSafetyMeasures] = useState([ + { content: "动火操作人(焊工)、参与人(电工)及其他特种作业人员须持有效证书方可作业;动火相关设备、必须符合国家、行业标准;", status: "1" }, + { content: "在动火部位配备2具以上适合现场灭火的相应介质合格灭火器 及(1)桶水", status: "1" }, + { content: "动火前须设置警戒线,清理现场易燃物,对无法清理的要用水浇湿或进行有效隔离,对于有油污等易燃物或狭窄危险部位须铺垫方防火石棉布;", status: "1" }, + { content: "动火前,现场管辖单位人员须检查确认动火安全措施落实到位;", status: "1" }, + { content: "动火中,现场人员须严格遵守消防相关规章制度和操作规程;", status: "1" }, + { content: "动火中,监火人不得离开动火现场;", status: "1" }, + { content: "动火中,发现事故隐患须立即停止动火,待事故隐患排除后方可继续动火;", status: "0" }, + { content: "动火结束,现场管辖单位人员与动火现场负责人共同对动火现场检查,确认现场清理完毕,无遗留火种,有延时监火要求的,现场管辖单位指定人员延时监火。", status: "1" }, + ]); + const [otherSafetyMeasures, setOtherSafetyMeasures] = useState([ + { content: "监火人不得离开动火现场;", preparedBy: "张三" }, + { content: "动火前,现场管辖单位人员须检查确认动火安全措施落实到位;", preparedBy: "张三" }, + { content: "动火中,现场人员须严格遵守消防相关规章制度和操作规程;", preparedBy: "张三" }, + ]); + const [delayedFireMonitoringRecord, setDelayedFireMonitoringRecord] = useState([ + { time: "2023-04-01 10:00:00", monitor: "张三", signature: "https://pic1.arkoo.com/56D0B40F99F841DF8A2425762AE2565D/picture/o_1i4qop009177v1tgf14db15he1iaj1is.jpg" }, + { time: "2023-04-01 10:00:00", monitor: "张三", signature: "https://pic1.arkoo.com/56D0B40F99F841DF8A2425762AE2565D/picture/o_1i4qop009177v1tgf14db15he1iaj1is.jpg" }, + { time: "2023-04-01 10:00:00", monitor: "张三", signature: "https://pic1.arkoo.com/56D0B40F99F841DF8A2425762AE2565D/picture/o_1i4qop009177v1tgf14db15he1iaj1is.jpg" }, + { time: "2023-04-01 10:00:00", monitor: "张三", signature: "https://pic1.arkoo.com/56D0B40F99F841DF8A2425762AE2565D/picture/o_1i4qop009177v1tgf14db15he1iaj1is.jpg" }, + ]); + + const getData = async () => { + const { data } = await props["eightworkInfo"]({ id: query.id }); + setInfo(data); + }; + + useEffect(() => { + getData(); + }, []); + + return ( + 打印 + )} + > +
+
+ + + + + + + + + + {props.entrance === "stakeholder" && ( + + + + + )} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 动火申请审批许可证 +
+ 编号: + {info.xx} +
服务单位{info.xx}
申请单位{info.xx}申请时间{info.xx}
动火部位{info.xx}动火方法{info.xx}
动火等级{info.xx}作业内容{info.xx}
动火时间{info.xx}
现场管辖人{info.xx}动火操作人{info.xx}
动火监火人{info.xx}
可燃气体分析(运行的生产装置、罐区和具有火灾爆炸危险场所)
分析时间{info.xx}分析点{info.xx}
可燃气体检测结果{info.xx}分析人{info.xx}
动火要求安全措施安全提示
+ + + + + + + + + {safetyMeasures.map((item, index) => ( + + + + + + + ))} + + + + + +
序号安全措施是否涉及确认人
{index + 1}{item.content}{item.status === "1" ? "是" : "否"} + +
{safetyMeasures.length + 1} + { + otherSafetyMeasures.map((item, index) => ( +
+
+ 其他安全措施: + {item.content} +
+
+ 编制人: + {item.preparedBy} +
+
+ )) + } +
+
动火单位(部门)负责人意见 +
+ +
+
{info.xx}
+
项目发包单位(部门)人员意见 +
+ +
+
{info.xx}
+
现场管辖单位(部门)负责人意见 +
+ +
+
{info.xx}
+
动火许可证签发单位意见 +
+ +
+
{info.xx}
+
动火前管辖单位现场人员许可 +
+ +
+
{info.xx}
+
动火后管辖单位现场人员验收 +
+ +
+
{info.xx}
+
延时监火记录
+ + + + + + + + {delayedFireMonitoringRecord.map((item, index) => ( + + + + + + ))} + +
监火人时间签字照片
{item.monitor}{item.time} + +
+
+ +
+ ); +} + +export default Connect([NS_EIGHTWORK], true)(View); diff --git a/src/pages/Container/Enterprise/HotWork/Homework/View/index.less b/src/pages/Container/Enterprise/HotWork/Homework/View/index.less new file mode 100644 index 0000000..e125fe2 --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/Homework/View/index.less @@ -0,0 +1,27 @@ +.work_ticket_details { + table { + width: 100%; + border-collapse: collapse; + border-spacing: 0; + + th, td { + border: 1px solid #ddd; + padding: 8px; + + &.title{ + font-weight: 600; + color: #333; + background-color: #f2f2f2; + width: 200px; + } + + &.center { + text-align: center; + } + + &.right { + text-align: right; + } + } + } +} diff --git a/src/pages/Container/Enterprise/HotWork/Homework/index.js b/src/pages/Container/Enterprise/HotWork/Homework/index.js new file mode 100644 index 0000000..e0c86ef --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/Homework/index.js @@ -0,0 +1,5 @@ +function Homework(props) { + return props.children; +} + +export default Homework; diff --git a/src/pages/Container/Enterprise/HotWork/index.js b/src/pages/Container/Enterprise/HotWork/index.js new file mode 100644 index 0000000..90ef57b --- /dev/null +++ b/src/pages/Container/Enterprise/HotWork/index.js @@ -0,0 +1,5 @@ +function HotWork(props) { + return props.children; +} + +export default HotWork; diff --git a/src/pages/Container/Enterprise/index.js b/src/pages/Container/Enterprise/index.js new file mode 100644 index 0000000..c7a390b --- /dev/null +++ b/src/pages/Container/Enterprise/index.js @@ -0,0 +1,5 @@ +function Enterprise(props) { + return props.children; +} + +export default Enterprise; diff --git a/src/pages/Container/Entry/index.js b/src/pages/Container/Entry/index.js new file mode 100644 index 0000000..c51ecfd --- /dev/null +++ b/src/pages/Container/Entry/index.js @@ -0,0 +1,31 @@ +import { ImportCore } from "@cqsjjb/jjb-common-decorator/module"; +import React from "react"; + +export default class Entry extends React.Component { + state = { + Component: undefined, + }; + + componentDidMount() { + if (process.env.app.appKey) { + ImportCore({ + name: "$", + from: "https://cdn.cqjjb.cn/jcloud/use/plugin/b31c9840a57f11ef91cf7f3cabbb7484/latest", + }).then((res) => { + if (res.status) { + this.setState({ Component: res.module?.default }); + } + }); + } + } + + render() { + const { Component } = this.state; + return (Component && process.env.app.appKey) && ( + + ); + } +} diff --git a/src/pages/Container/Stakeholder/HotWork/Archive/List/index.js b/src/pages/Container/Stakeholder/HotWork/Archive/List/index.js new file mode 100644 index 0000000..7a50f63 --- /dev/null +++ b/src/pages/Container/Stakeholder/HotWork/Archive/List/index.js @@ -0,0 +1,7 @@ +import ListPage from "~/pages/Container/Enterprise/HotWork/Homework/List"; + +function List(props) { + return (); +} + +export default List; diff --git a/src/pages/Container/Stakeholder/HotWork/Archive/View/index.js b/src/pages/Container/Stakeholder/HotWork/Archive/View/index.js new file mode 100644 index 0000000..77734aa --- /dev/null +++ b/src/pages/Container/Stakeholder/HotWork/Archive/View/index.js @@ -0,0 +1,7 @@ +import ViewPage from "~/pages/Container/Enterprise/HotWork/Homework/View"; + +function View(props) { + return (); +} + +export default View; diff --git a/src/pages/Container/Stakeholder/HotWork/Archive/index.js b/src/pages/Container/Stakeholder/HotWork/Archive/index.js new file mode 100644 index 0000000..9050ce1 --- /dev/null +++ b/src/pages/Container/Stakeholder/HotWork/Archive/index.js @@ -0,0 +1,5 @@ +function Archive(props) { + return props.children; +} + +export default Archive; diff --git a/src/pages/Container/Stakeholder/HotWork/Homework/List/index.js b/src/pages/Container/Stakeholder/HotWork/Homework/List/index.js new file mode 100644 index 0000000..8f88636 --- /dev/null +++ b/src/pages/Container/Stakeholder/HotWork/Homework/List/index.js @@ -0,0 +1,7 @@ +import ListPage from "~/pages/Container/Enterprise/HotWork/Homework/List"; + +function List(props) { + return (); +} + +export default List; diff --git a/src/pages/Container/Stakeholder/HotWork/Homework/View/index.js b/src/pages/Container/Stakeholder/HotWork/Homework/View/index.js new file mode 100644 index 0000000..77734aa --- /dev/null +++ b/src/pages/Container/Stakeholder/HotWork/Homework/View/index.js @@ -0,0 +1,7 @@ +import ViewPage from "~/pages/Container/Enterprise/HotWork/Homework/View"; + +function View(props) { + return (); +} + +export default View; diff --git a/src/pages/Container/Stakeholder/HotWork/Homework/index.js b/src/pages/Container/Stakeholder/HotWork/Homework/index.js new file mode 100644 index 0000000..e0c86ef --- /dev/null +++ b/src/pages/Container/Stakeholder/HotWork/Homework/index.js @@ -0,0 +1,5 @@ +function Homework(props) { + return props.children; +} + +export default Homework; diff --git a/src/pages/Container/Stakeholder/HotWork/index.js b/src/pages/Container/Stakeholder/HotWork/index.js new file mode 100644 index 0000000..90ef57b --- /dev/null +++ b/src/pages/Container/Stakeholder/HotWork/index.js @@ -0,0 +1,5 @@ +function HotWork(props) { + return props.children; +} + +export default HotWork; diff --git a/src/pages/Container/Stakeholder/index.js b/src/pages/Container/Stakeholder/index.js new file mode 100644 index 0000000..d54483c --- /dev/null +++ b/src/pages/Container/Stakeholder/index.js @@ -0,0 +1,5 @@ +function Stakeholder(props) { + return props.children; +} + +export default Stakeholder; diff --git a/src/pages/Container/Supervision/HotWork/List/index.js b/src/pages/Container/Supervision/HotWork/List/index.js new file mode 100644 index 0000000..a009adb --- /dev/null +++ b/src/pages/Container/Supervision/HotWork/List/index.js @@ -0,0 +1,92 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button } from "antd"; +import Page from "zy-react-library/components/Page"; +import Search from "zy-react-library/components/Search"; +import Table from "zy-react-library/components/Table"; +import useTable from "zy-react-library/hooks/useTable"; +import { NS_EIGHTWORK } from "~/enumerate/namespace"; + +function List(props) { + const [form] = Search.useForm(); + + const { tableProps, getData } = useTable(props["eightworkRecordsList"], { + form, + params: { eqWorkType: "hot_work" }, + }); + + return ( + + + ( + + ), + }, + { + title: "完成数", + dataIndex: "todo", + render: (_, record) => ( + + ), + }, + { + title: "进行数", + dataIndex: "todo", + render: (_, record) => ( + + ), + }, + { + title: "废除数", + dataIndex: "todo", + render: (_, record) => ( + + ), + }, + ]} + {...tableProps} + /> + + ); +} + +export default Connect([NS_EIGHTWORK], true)(List); diff --git a/src/pages/Container/Supervision/HotWork/RecordsList/index.js b/src/pages/Container/Supervision/HotWork/RecordsList/index.js new file mode 100644 index 0000000..02ada01 --- /dev/null +++ b/src/pages/Container/Supervision/HotWork/RecordsList/index.js @@ -0,0 +1,10 @@ +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import ListPage from "~/pages/Container/Enterprise/HotWork/Homework/List"; + +function RecordsList(props) { + const query = useGetUrlQuery(); + + return (); +} + +export default RecordsList; diff --git a/src/pages/Container/Supervision/HotWork/index.js b/src/pages/Container/Supervision/HotWork/index.js new file mode 100644 index 0000000..90ef57b --- /dev/null +++ b/src/pages/Container/Supervision/HotWork/index.js @@ -0,0 +1,5 @@ +function HotWork(props) { + return props.children; +} + +export default HotWork; diff --git a/src/pages/Container/Supervision/index.js b/src/pages/Container/Supervision/index.js new file mode 100644 index 0000000..e8ad3c1 --- /dev/null +++ b/src/pages/Container/Supervision/index.js @@ -0,0 +1,5 @@ +function Supervision(props) { + return props.children; +} + +export default Supervision; diff --git a/src/pages/Container/index.js b/src/pages/Container/index.js new file mode 100644 index 0000000..c26d322 --- /dev/null +++ b/src/pages/Container/index.js @@ -0,0 +1,101 @@ +import { ImportCore } from "@cqsjjb/jjb-common-decorator/module"; +import { theme as antdTheme, App, ConfigProvider } from "antd"; +import language from "antd/locale/zh_CN"; +import React from "react"; + +import { InjectContext } from "~/enumerate/context"; + +export default class Container extends React.Component { + state = window?.base?.themeConfig || { + algorithm: window.process.env.app.antd.algorithm, + borderRadius: window.process.env.app.antd.borderRadius, + colorPrimary: window.process.env.app.antd.colorPrimary, + }; + + get token() { + const { + colorPrimary, + borderRadius, + } = this.state; + return { + fontFamily: window.process.env.app.antd.fontFamily, + colorPrimary, + borderRadius, + }; + } + + get algorithm() { + return antdTheme[this.state.algorithm]; + } + + componentDidMount() { + if (window.__IN_BASE__) { + // eslint-disable-next-line react-web-api/no-leaked-event-listener + window.base.addEventListener("EVENT_THEME_CONTROL", (e) => { + const config = e.data; + this.setState({ [config.field]: config.value }); + }); + } + } + + render() { + return ( + + + + + + ); + } +} + +function AppMiddle(props) { + return ( + + {process.env.NODE_ENV === "development" + ? props.children + : ( + + {props.children} + + )} + + ); +} + +class Interceptor extends React.Component { + state = { + Component: undefined, + }; + + componentDidMount() { + if (process.env.app.appKey) { + ImportCore({ + name: "$", + from: "https://cdn.cqjjb.cn/jcloud/use/plugin/b31c9840a57f11ef91cf7f3cabbb7484/latest", + }).then(async (res) => { + if (res.status) { + this.setState({ Component: res.module?.PageCover }); + } + }); + } + } + + render() { + const { Component } = this.state; + return (Component && process.env.app.appKey && process.env.NODE_ENV === "development") + ? ( + + {this.props.children} + + ) + : this.props.children; + } +} diff --git a/src/pages/index.js b/src/pages/index.js new file mode 100644 index 0000000..64c36bb --- /dev/null +++ b/src/pages/index.js @@ -0,0 +1,8 @@ +export default function () { + return ( +

+ 底座微应用模板,技术文档: + https://www.yuque.com/buhangjiecheshen-ymbtb/qc0093/gxdun1dphetcurko +

+ ); +} diff --git a/src/utils/flow.js b/src/utils/flow.js new file mode 100644 index 0000000..f658818 --- /dev/null +++ b/src/utils/flow.js @@ -0,0 +1,63 @@ +// 根据状态获取颜色 +export const getStatusColor = (status, type, thisFlow) => { + // 进行中节点(当前待审批节点)显示红色 + if (thisFlow && type === thisFlow) { + return "#ff4d4f"; // 红色(进行中) + } + + // 已完成节点显示绿色 + if (status === 1) { + return "#52c41a"; // 绿色(已完成) + } + + // 未进行节点显示灰色 + return "#9c9c9c"; // 灰色(未进行) +}; + +// 获取节点标签 +export const getNodeLabel = (flowItem) => { + return ( +
+
{flowItem.flowList[0]}
+ {flowItem.flowList.slice(1).map((item, index) => ( +
{item}
+ ))} +
+ ); +}; + +export const getFlowData = (list, thisFlow) => { + const nodes = []; + const edges = []; + + const nodeWidth = 300; + const nodeHeight = 200; + + list.forEach((flowItem, index) => { + nodes.push({ + id: `node-${index}`, + type: "customNode", + width: nodeWidth, + height: nodeHeight, + data: { + backgroundColor: getStatusColor(flowItem.status, flowItem.type, thisFlow), + title: getNodeLabel(flowItem), + width: nodeWidth, + height: nodeHeight, + }, + }); + }); + + // 创建连接线 + for (let i = 0; i < list.length - 1; i++) { + edges.push({ + id: `edge-${i}`, + source: `node-${i}`, + target: `node-${i + 1}`, + type: "smoothstep", + animated: true, + }); + } + + return { nodes, edges }; +}; diff --git a/webstorm.config.js b/webstorm.config.js new file mode 100644 index 0000000..ca262cd --- /dev/null +++ b/webstorm.config.js @@ -0,0 +1,16 @@ +"use strict"; +const path = require("node:path"); + +function resolve(dir) { + return path.join(__dirname, ".", dir); +} + +module.exports = { + context: path.resolve(__dirname, "./"), + resolve: { + extensions: [".js"], + alias: { + "~": resolve("src/"), + }, + }, +};