commit 81b0f177c43e59ea30cf77a8babd0bc70d0be069 Author: LiuJiaNan <15703339975@163.com> Date: Mon Nov 24 13:51:05 2025 +0800 init 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..06fcf00 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,48 @@ +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", + }, + 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..8211aa1 --- /dev/null +++ b/jjb.config.js @@ -0,0 +1,77 @@ +module.exports = { + // 应用后端git地址,部署上线需要 + javaGit: "", + // 应用后端仓库名称,部署上线需要 + javaGitName: "", + // 环境配置 + environment: { + development: { + // 应用后端分支名称,部署上线需要 + javaGitBranch: "", + // 接口服务地址 + API_HOST: "http://192.168.20.100:30140", + }, + production: { + // 应用后端分支名称,部署上线需要 + javaGitBranch: "", + // 接口服务地址 + API_HOST: "", + }, + }, + // 应用唯一标识符 + appIdentifier: "inspection", + // 应用上下文注入全局变量 + contextInject: { + // 应用Key + appKey: "", + fileUrl: "http://192.168.20.240:9787/mnt/", + }, + // public/index.html注入全局变量 + windowInject: { + // 应用标题 + title: "微应用模板", + // 注入css链接集合 + links: [], + element: { + root: { + // 挂载DOM元素ID + id: "root", + }, + }, + // 注入js链接集合 + scripts: [ + "https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr", + ], + }, + // 开发服务 + server: { + // 监听端口号 + port: "8080", + // 服务地址 + 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..87a4fcf --- /dev/null +++ b/package.json @@ -0,0 +1,49 @@ +{ + "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": "latest", + "@ant-design/pro-components": "^2.8.10", + "@cqsjjb/jjb-common-decorator": "latest", + "@cqsjjb/jjb-common-lib": "latest", + "@cqsjjb/jjb-dva-runtime": "latest", + "@cqsjjb/jjb-react-admin-component": "latest", + "@xyflow/react": "^12.9.3", + "ahooks": "^3.9.5", + "antd": "latest", + "dayjs": "^1.11.7", + "lodash-es": "^4.17.21", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-to-print": "^3.2.0", + "zy-react-library": "^1.0.124" + }, + "devDependencies": { + "@antfu/eslint-config": "^5.4.1", + "@babel/plugin-proposal-decorators": "^7.19.3", + "@cqsjjb/scripts": "latest", + "@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/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/api/inspection/index.js b/src/api/inspection/index.js new file mode 100644 index 0000000..8658a41 --- /dev/null +++ b/src/api/inspection/index.js @@ -0,0 +1,78 @@ +import { declareRequest } from "@cqsjjb/jjb-dva-runtime"; + +export const inspectionList = declareRequest( + "inspectionLoading", + `Post > @/inspection/safetyEnvironmentalInspection/page`, +); +export const inspectionFlowchart = declareRequest( + "inspectionLoading", + `Post > @/inspection/safetyEnvironmentalInspection/flowchart/{id}`, +); +export const inspectionAdd = declareRequest( + "inspectionLoading", + `Post > @/inspection/safetyEnvironmentalInspection/initiate`, +); +export const inspectionUpdate = declareRequest( + "inspectionLoading", + `Post > @/inspection/safetyEnvironmentalInspection/edit`, +); +export const inspectionView = declareRequest( + "inspectionLoading", + `Post > @/inspection/safetyEnvironmentalInspection/detail`, +); +export const inspectionDelete = declareRequest( + "inspectionLoading", + `Post > @/inspection/safetyEnvironmentalInspection/remove/{id}`, +); +export const hiddenDelete = declareRequest( + "inspectionLoading", + `Delete > @/hidden/hidden/ids?ids={ids}`, +); +export const hiddenAdd = declareRequest( + "inspectionLoading", + `Post > @/hidden/hidden/save`, +); +export const partAdd = declareRequest( + "inspectionLoading", + `Post > @/hidden/hiddenRegion/save`, +); +export const inspectedConfirm = declareRequest( + "inspectedLoading", + `Post > @/inspection/safetyEnvironmentalInspection/confirm`, +); +export const inspectorVerify = declareRequest( + "inspectorLoading", + `Post > @/inspection/safetyEnvironmentalInspection/verify`, +); +export const hiddenList = declareRequest( + "assignLoading", + `Post > @/hidden/hidden/queryHiddenListByForeign`, +); +export const hiddenConfirmUserAllList = declareRequest( + "confirmUserLoading", + `Post > @/hidden/hiddenConfirmUser/list`, +); +export const hiddenAssign = declareRequest( + "assignLoading", + `Post > @/inspection/safetyEnvironmentalInspection/assign`, +); +export const defenseSubmit = declareRequest( + "defenseLoading", + `Post > @/inspection/safetyEnvironmentalInspection/defenseReview`, +); +export const defenseRecordList = declareRequest( + "defenseLoading", + `Post > @/inspection/safetyEnvironmentalInspection/defense/{id}`, +); +export const hiddenAcceptance = declareRequest( + "acceptanceLoading", + `Put > @/hidden/hidden/checkHidden`, +); +export const hiddenFlowchart = declareRequest( + "acceptanceLoading", + `Get > /hidden/hidden/flowChart/{id}`, +); +export const inspectionCount = declareRequest( + "inspectionCountLoading", + `Post > @/inspection/safetyEnvironmentalInspection/getCount`, +); 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..99adb6b --- /dev/null +++ b/src/enumerate/constant/index.js @@ -0,0 +1,22 @@ +/** + * 全局常量定义 + */ + +export {}; + +export const INSPECTION_QUESTION_ENUM = [ + { bianma: "安全检查", name: "安全" }, + { bianma: "环保检查", name: "环保" }, + { bianma: "综合检查", name: "综合" }, +]; + +export const INSPECTION_STATE_ENUM = [ + { bianma: "100", name: "待核实" }, + { bianma: "200", name: "待确认" }, + { bianma: "300", name: "待指派" }, + { bianma: "400", name: "待验收" }, + { bianma: "500", name: "检查归档" }, + { bianma: "600", name: "检查核实打回" }, + { bianma: "700", name: "被检查人申辩" }, + { bianma: "-1", name: "暂存" }, +]; 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..0d6d80e --- /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_INSPECTION = defineNamespace("inspection"); diff --git a/src/main.js b/src/main.js new file mode 100644 index 0000000..c1cdccb --- /dev/null +++ b/src/main.js @@ -0,0 +1,47 @@ +import { setJJBCommonAntdMessage } from "@cqsjjb/jjb-common-lib"; +import { setup } from "@cqsjjb/jjb-dva-runtime"; +import { message } from "antd"; +import dayjs from "dayjs"; +import "dayjs/locale/zh-cn"; +import "../blessed_by_buddha"; + +require("antd/dist/reset.css"); + +dayjs.locale("zh-cn"); +setJJBCommonAntdMessage(message); + +const app = setup(); + +// 非底座环境运行 +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/BranchCompany/Acceptance/Acceptance/index.js b/src/pages/Container/BranchCompany/Acceptance/Acceptance/index.js new file mode 100644 index 0000000..008deff --- /dev/null +++ b/src/pages/Container/BranchCompany/Acceptance/Acceptance/index.js @@ -0,0 +1,60 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Divider, Form, message } from "antd"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import HeaderBack from "zy-react-library/components/HeaderBack"; +import HiddenInfo from "zy-react-library/components/HiddenInfo/gwj"; +import Upload from "zy-react-library/components/Upload"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import useUploadFile from "zy-react-library/hooks/useUploadFile"; +import { NS_INSPECTION } from "~/enumerate/namespace"; + +function Acceptance(props) { + const query = useGetUrlQuery(); + const [form] = Form.useForm(); + const { loading: uploadFileLoading, uploadFile } = useUploadFile(); + + const onSubmit = async (values) => { + await uploadFile({ + single: false, + files: values.files, + params: { type: UPLOAD_FILE_TYPE_ENUM["146"], foreignKey: query.hiddenId }, + }); + const { success } = await props["hiddenAcceptance"]({ ...values, id: query.id }); + if (success) { + message.success("验收成功"); + props.history.goBack(); + } + }; + + return ( +
+ + + 安全环保检查验收 + ) }, + ]} + /> +
+ ); +} + +export default Connect([NS_INSPECTION], true)(Acceptance); diff --git a/src/pages/Container/BranchCompany/Acceptance/HiddenList/index.js b/src/pages/Container/BranchCompany/Acceptance/HiddenList/index.js new file mode 100644 index 0000000..4356623 --- /dev/null +++ b/src/pages/Container/BranchCompany/Acceptance/HiddenList/index.js @@ -0,0 +1,57 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Space } from "antd"; +import HeaderBack from "zy-react-library/components/HeaderBack"; +import Table from "zy-react-library/components/Table"; +import { HIDDEN_STATE_ENUM } from "zy-react-library/enum/hidden/gwj"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import useTable from "zy-react-library/hooks/useTable"; +import { getLabelName } from "zy-react-library/utils"; +import { NS_INSPECTION } from "~/enumerate/namespace"; + +function HiddenList(props) { + const query = useGetUrlQuery(); + const { tableProps } = useTable(props["hiddenList"], { + params: { foreignKey: query.inspectionId, state: "301" }, + }); + + return ( +
+ +
+ getLabelName({ list: HIDDEN_STATE_ENUM, status: record.state }) }, + { + title: "操作", + width: 150, + render: (_, record) => ( + + + + + ), + }, + ]} + {...tableProps} + /> + + + ); +} + +export default Connect([NS_INSPECTION], true)(HiddenList); diff --git a/src/pages/Container/BranchCompany/Acceptance/List/index.js b/src/pages/Container/BranchCompany/Acceptance/List/index.js new file mode 100644 index 0000000..93c2d69 --- /dev/null +++ b/src/pages/Container/BranchCompany/Acceptance/List/index.js @@ -0,0 +1,87 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Form, Space } from "antd"; +import Search from "zy-react-library/components/Search"; +import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; +import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary"; +import Table from "zy-react-library/components/Table"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import useTable from "zy-react-library/hooks/useTable"; +import { INSPECTION_QUESTION_ENUM } from "~/enumerate/constant"; +import { NS_INSPECTION } from "~/enumerate/namespace"; + +function List(props) { + const [form] = Form.useForm(); + const { tableProps, getData } = useTable(props["inspectionList"], { + form, + transform: formData => ({ + checkStartTime: formData.checkTime?.[0], + checkEndTime: formData.checkTime?.[1], + }), + params: { status: "400" }, + }); + + return ( +
+ }, + { name: "inspectionUserName", label: "检查人" }, + { name: "type", label: "检查类型", render: }, + { name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE }, + { name: "inspectedDepartmentId", label: "被检查单位", render: }, + { name: "inspectedUserName", label: "被检查单位现场负责人" }, + ]} + form={form} + onFinish={getData} + /> +
(`${record.timeStart}至${record.timeEnd}`) }, + { title: "检查状态", dataIndex: "status", render: () => "待验收" }, + { title: "发现隐患数", dataIndex: "hiddenNumber" }, + { + title: "操作", + fixed: "right", + width: 150, + render: (_, record) => ( + + + + + ), + }, + ]} + {...tableProps} + /> + + ); +} + +export default Connect([NS_INSPECTION], true)(List); diff --git a/src/pages/Container/BranchCompany/Acceptance/index.js b/src/pages/Container/BranchCompany/Acceptance/index.js new file mode 100644 index 0000000..af24af4 --- /dev/null +++ b/src/pages/Container/BranchCompany/Acceptance/index.js @@ -0,0 +1,9 @@ +function Acceptance(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Acceptance; diff --git a/src/pages/Container/BranchCompany/Assign/Assign/index.js b/src/pages/Container/BranchCompany/Assign/Assign/index.js new file mode 100644 index 0000000..9419da5 --- /dev/null +++ b/src/pages/Container/BranchCompany/Assign/Assign/index.js @@ -0,0 +1,67 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Divider, Form, message } from "antd"; +import { useEffect, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import HeaderBack from "zy-react-library/components/HeaderBack"; +import HiddenInfo from "zy-react-library/components/HiddenInfo/gwj"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import { NS_INSPECTION } from "~/enumerate/namespace"; + +function Assign(props) { + const query = useGetUrlQuery(); + const [form] = Form.useForm(); + const [confirmUserList, setConfirmUserList] = useState([]); + const getConfirmUserList = async () => { + const { data } = await props["hiddenConfirmUserAllList"](); + setConfirmUserList(data); + }; + useEffect(() => { + getConfirmUserList(); + }, []); + + const onSubmit = async (values) => { + const { success } = await props["hiddenAssign"]({ ...values, inspectId: query.id, hiddenBusinessId: query.hiddenUUId, hiddenId: query.hiddenId }); + if (success) { + message.success("指派成功"); + props.history.goBack(); + } + }; + + return ( +
+ + + 隐患确认 + { + const findItem = confirmUserList.find(item => item.userId === value); + form.setFieldValue("userName", findItem.userName); + form.setFieldValue("deptName", findItem.deptName); + form.setFieldValue("deptId", findItem.deptId); + }, + }, + }, + { name: "userName", label: "隐患确认人名称", onlyForLabel: true }, + { name: "deptName", label: "隐患确认人部门名称", onlyForLabel: true }, + { name: "deptId", label: "隐患确认人部门id", onlyForLabel: true }, + ]} + /> +
+ ); +} + +export default Connect([NS_INSPECTION], true)(Assign); diff --git a/src/pages/Container/BranchCompany/Assign/HiddenList/index.js b/src/pages/Container/BranchCompany/Assign/HiddenList/index.js new file mode 100644 index 0000000..50fca30 --- /dev/null +++ b/src/pages/Container/BranchCompany/Assign/HiddenList/index.js @@ -0,0 +1,57 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Space } from "antd"; +import HeaderBack from "zy-react-library/components/HeaderBack"; +import Table from "zy-react-library/components/Table"; +import { HIDDEN_STATE_ENUM } from "zy-react-library/enum/hidden/gwj"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import useTable from "zy-react-library/hooks/useTable"; +import { getLabelName } from "zy-react-library/utils"; +import { NS_INSPECTION } from "~/enumerate/namespace"; + +function HiddenList(props) { + const query = useGetUrlQuery(); + const { tableProps } = useTable(props["hiddenList"], { + params: { foreignKey: query.inspectionId, state: "102" }, + }); + + return ( +
+ +
+
getLabelName({ list: HIDDEN_STATE_ENUM, status: record.state }) }, + { + title: "操作", + width: 150, + render: (_, record) => ( + + + + + ), + }, + ]} + {...tableProps} + /> + + + ); +} + +export default Connect([NS_INSPECTION], true)(HiddenList); diff --git a/src/pages/Container/BranchCompany/Assign/List/index.js b/src/pages/Container/BranchCompany/Assign/List/index.js new file mode 100644 index 0000000..a6ac555 --- /dev/null +++ b/src/pages/Container/BranchCompany/Assign/List/index.js @@ -0,0 +1,87 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Form, Space } from "antd"; +import Search from "zy-react-library/components/Search"; +import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; +import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary"; +import Table from "zy-react-library/components/Table"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import useTable from "zy-react-library/hooks/useTable"; +import { INSPECTION_QUESTION_ENUM } from "~/enumerate/constant"; +import { NS_INSPECTION } from "~/enumerate/namespace"; + +function List(props) { + const [form] = Form.useForm(); + const { tableProps, getData } = useTable(props["inspectionList"], { + form, + transform: formData => ({ + checkStartTime: formData.checkTime?.[0], + checkEndTime: formData.checkTime?.[1], + }), + params: { status: "300" }, + }); + + return ( +
+ }, + { name: "inspectionUserName", label: "检查人" }, + { name: "type", label: "检查类型", render: }, + { name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE }, + { name: "inspectedDepartmentId", label: "被检查单位", render: }, + { name: "inspectedUserName", label: "被检查单位现场负责人" }, + ]} + form={form} + onFinish={getData} + /> +
(`${record.timeStart}至${record.timeEnd}`) }, + { title: "检查状态", dataIndex: "status", render: () => "待指派" }, + { title: "发现隐患数", dataIndex: "hiddenNumber" }, + { + title: "操作", + fixed: "right", + width: 150, + render: (_, record) => ( + + + + + ), + }, + ]} + {...tableProps} + /> + + ); +} + +export default Connect([NS_INSPECTION], true)(List); diff --git a/src/pages/Container/BranchCompany/Assign/index.js b/src/pages/Container/BranchCompany/Assign/index.js new file mode 100644 index 0000000..02d455c --- /dev/null +++ b/src/pages/Container/BranchCompany/Assign/index.js @@ -0,0 +1,9 @@ +function Assign(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Assign; diff --git a/src/pages/Container/BranchCompany/Defense/List/index.js b/src/pages/Container/BranchCompany/Defense/List/index.js new file mode 100644 index 0000000..8b752bf --- /dev/null +++ b/src/pages/Container/BranchCompany/Defense/List/index.js @@ -0,0 +1,282 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Form, Image, message, Modal, Space } from "antd"; +import { useEffect, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import Search from "zy-react-library/components/Search"; +import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; +import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary"; +import Signature from "zy-react-library/components/Signature"; +import Table from "zy-react-library/components/Table"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useDownloadFile from "zy-react-library/hooks/useDownloadFile"; +import useGetFile from "zy-react-library/hooks/useGetFile"; +import useTable from "zy-react-library/hooks/useTable"; +import useUploadFile from "zy-react-library/hooks/useUploadFile"; +import { getFileUrl } from "zy-react-library/utils"; +import { INSPECTION_QUESTION_ENUM } from "~/enumerate/constant"; +import { NS_INSPECTION } from "~/enumerate/namespace"; + +function List(props) { + const [defenseHandlingModalOpen, setDefenseHandlingModalOpen] = useState(false); + const [defenseRecordModalOpen, setDefenseRecordModalOpen] = useState(false); + const [currentId, setCurrentId] = useState(""); + const [form] = Form.useForm(); + const { tableProps, getData } = useTable(props["inspectionList"], { + form, + transform: formData => ({ + checkStartTime: formData.checkTime?.[0], + checkEndTime: formData.checkTime?.[1], + }), + params: { status: "700" }, + }); + + return ( +
+ }, + { name: "inspectionUserName", label: "检查人" }, + { name: "type", label: "检查类型", render: }, + { name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE }, + { name: "inspectedDepartmentId", label: "被检查单位", render: }, + { name: "inspectedUserName", label: "被检查单位现场负责人" }, + ]} + form={form} + onFinish={getData} + /> +
(`${record.timeStart}至${record.timeEnd}`) }, + { title: "检查状态", dataIndex: "status", render: () => "被检查单位负责人申辩" }, + { title: "发现隐患数", dataIndex: "hiddenNumber" }, + { + title: "操作", + fixed: "right", + width: 200, + render: (_, record) => ( + + + + + + ), + }, + ]} + {...tableProps} + /> + {defenseHandlingModalOpen && ( + { + setDefenseHandlingModalOpen(false); + setCurrentId(""); + }} + getData={getData} + /> + )} + {defenseRecordModalOpen && ( + { + setDefenseRecordModalOpen(false); + setCurrentId(""); + }} + /> + )} + + ); +} + +function DefenseHandlingModalComponent(props) { + const [form] = Form.useForm(); + const { loading: uploadFileLoading, uploadFile } = useUploadFile(); + + const onSubmit = async (values) => { + let signature = ""; + if (values.signature) { + const { filePath } = await uploadFile({ + files: [{ originFileObj: values.signature }], + params: { type: UPLOAD_FILE_TYPE_ENUM["144"] }, + }); + signature = filePath; + } + const { success } = await props["defenseSubmit"]({ ...values, signature, inspectionId: props.id }); + if (success) { + message.success("操作成功"); + props.onCancel(); + props.getData(); + } + }; + + return ( + + { + form.setFieldValue("signatureTime", ""); + }, + }, + }, + { + name: "userRemarks", + label: "不成立理由内容", + render: FORM_ITEM_RENDER_ENUM.TEXTAREA, + dependencies: ["status"], + hidden: formValues => !(formValues.status === "2"), + }, + { + name: "signature", + label: "确认人", + required: false, + rules: [{ required: true, message: "请签名" }], + dependencies: ["status"], + hidden: formValues => !(formValues.status === "2"), + render: ( + { + form.setFieldValue("signature", value.file); + form.setFieldValue("signatureTime", value.time); + }} + /> + ), + }, + { name: "signatureTime", label: "签字时间", onlyForLabel: true }, + ]} + /> + + ); +} + +function DefenseRecordModalComponent(props) { + const [list, setList] = useState([]); + const { loading: downloadFileLoading, downloadFile } = useDownloadFile(); + const { loading: downloadGetFileLoading, getFile } = useGetFile(); + + const getFiles = async (list) => { + for (let i = 0; i < list.length; i++) { + const files = await getFile({ eqType: UPLOAD_FILE_TYPE_ENUM["143"], eqForeignKey: list[i].defendId }); + list[i].files = files; + } + setList(list); + }; + const { tableProps, getData } = useTable(props["defenseRecordList"], { + params: { id: props.id }, + manual: true, + usePagination: false, + useStorageQueryCriteria: false, + onSuccess: (data) => { + getFiles(data.list); + }, + }); + + useEffect(() => { + getData(); + }, []); + return ( + 取消, + ]} + loading={downloadFileLoading || downloadGetFileLoading} + > +
( + <> +
{record.isPass === 0 && "未审批"}
+
{record.isPass === 1 && "通过"}
+
{record.isPass === 2 && "未通过"}
+ + ) }, + { title: "签字图片", dataIndex: "signature", render: (_, record) => (record.signature && ) }, + { title: "申辩附件名称", dataIndex: "name", width: 200 }, + { title: "申辩附件", dataIndex: "url", render: (_, record) => ( + record.url && ( + + ) + ) }, + { title: "检查人签字", dataIndex: "checkSign", render: (_, record) => (record.checkSign && ) }, + { title: "检查人意见", dataIndex: "checkRemarks" }, + { title: "审批时间", dataIndex: "checkSignTime", width: 200 }, + ]} + {...tableProps} + dataSource={list} + /> + + ); +} + +const DefenseHandlingModal = Connect([NS_INSPECTION], true)(DefenseHandlingModalComponent); +const DefenseRecordModal = Connect([NS_INSPECTION], true)(DefenseRecordModalComponent); +export default Connect([NS_INSPECTION], true)(List); diff --git a/src/pages/Container/BranchCompany/Defense/index.js b/src/pages/Container/BranchCompany/Defense/index.js new file mode 100644 index 0000000..a23bcb1 --- /dev/null +++ b/src/pages/Container/BranchCompany/Defense/index.js @@ -0,0 +1,9 @@ +function Defense(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Defense; diff --git a/src/pages/Container/BranchCompany/HiddenView/index.js b/src/pages/Container/BranchCompany/HiddenView/index.js new file mode 100644 index 0000000..41db77d --- /dev/null +++ b/src/pages/Container/BranchCompany/HiddenView/index.js @@ -0,0 +1,11 @@ +import HiddenInfo from "zy-react-library/components/HiddenInfo/gwj"; + +function HiddenView() { + return ( +
+ +
+ ); +} + +export default HiddenView; diff --git a/src/pages/Container/BranchCompany/Inspected/List/index.js b/src/pages/Container/BranchCompany/Inspected/List/index.js new file mode 100644 index 0000000..02e7387 --- /dev/null +++ b/src/pages/Container/BranchCompany/Inspected/List/index.js @@ -0,0 +1,191 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Form, message, Modal, Space } from "antd"; +import { useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import Search from "zy-react-library/components/Search"; +import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; +import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary"; +import Signature from "zy-react-library/components/Signature"; +import Table from "zy-react-library/components/Table"; +import Upload from "zy-react-library/components/Upload"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useTable from "zy-react-library/hooks/useTable"; +import useUploadFile from "zy-react-library/hooks/useUploadFile"; +import { INSPECTION_QUESTION_ENUM } from "~/enumerate/constant"; +import { NS_INSPECTION } from "~/enumerate/namespace"; + +function List(props) { + const [confirmModalOpen, setConfirmModalOpen] = useState(false); + const [currentId, setCurrentId] = useState(""); + const [form] = Form.useForm(); + const { tableProps, getData } = useTable(props["inspectionList"], { + form, + transform: formData => ({ + checkStartTime: formData.checkTime?.[0], + checkEndTime: formData.checkTime?.[1], + }), + params: { status: "300" }, + }); + + return ( +
+ }, + { name: "inspectionUserName", label: "检查人" }, + { name: "type", label: "检查类型", render: }, + { name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE }, + { name: "inspectedDepartmentId", label: "被检查单位", render: }, + { name: "inspectedUserName", label: "被检查单位现场负责人" }, + ]} + form={form} + onFinish={getData} + /> +
(`${record.timeStart}至${record.timeEnd}`) }, + { title: "检查状态", dataIndex: "status", render: () => "待确认" }, + { title: "发现隐患数", dataIndex: "hiddenNumber" }, + { + title: "操作", + fixed: "right", + width: 150, + render: (_, record) => ( + + + + + ), + }, + ]} + {...tableProps} + /> + {confirmModalOpen && ( + { + setConfirmModalOpen(false); + setCurrentId(""); + }} + getData={getData} + /> + )} + + ); +} + +function ConfirmModalComponent(props) { + const [form] = Form.useForm(); + const { loading: uploadFileLoading, uploadFile } = useUploadFile(); + + const onSubmit = async (values) => { + const { id } = await uploadFile({ + single: false, + files: values.files, + params: { type: UPLOAD_FILE_TYPE_ENUM["143"], foreignKey: "" }, + }); + const { filePath } = await uploadFile({ + files: [{ originFileObj: values.signature }], + params: { type: UPLOAD_FILE_TYPE_ENUM["142"] }, + }); + const { success } = await props["inspectedConfirm"]({ ...values, signature: filePath, inspectionId: props.id, status: "1", defendId: id }); + if (success) { + message.success("操作成功"); + props.onCancel(); + props.getData(); + } + }; + + return ( + + !(formValues.reviewStatus === "2"), + }, + { + name: "files", + label: "附件", + required: false, + render: (), + dependencies: ["reviewStatus"], + hidden: formValues => !(formValues.reviewStatus === "2"), + }, + { + name: "signature", + label: "确认人", + required: false, + rules: [{ required: true, message: "请签名" }], + render: ( + { + form.setFieldValue("signature", value.file); + form.setFieldValue("signatureTime", value.time); + }} + /> + ), + }, + { name: "signatureTime", label: "签字时间", onlyForLabel: true }, + ]} + /> + + ); +} + +const ConfirmModal = Connect([NS_INSPECTION], true)(ConfirmModalComponent); +export default Connect([NS_INSPECTION], true)(List); diff --git a/src/pages/Container/BranchCompany/Inspected/index.js b/src/pages/Container/BranchCompany/Inspected/index.js new file mode 100644 index 0000000..a1657d1 --- /dev/null +++ b/src/pages/Container/BranchCompany/Inspected/index.js @@ -0,0 +1,9 @@ +function Inspected(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Inspected; diff --git a/src/pages/Container/BranchCompany/Inspection/Add/components/HiddenAdd/index.js b/src/pages/Container/BranchCompany/Inspection/Add/components/HiddenAdd/index.js new file mode 100644 index 0000000..48bf17b --- /dev/null +++ b/src/pages/Container/BranchCompany/Inspection/Add/components/HiddenAdd/index.js @@ -0,0 +1,143 @@ +import { Button, Form, Input, Modal } from "antd"; +import dayjs from "dayjs"; +import { useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import Map from "zy-react-library/components/Map"; +import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary"; +import HiddenLevelSelectTree from "zy-react-library/components/SelectTree/HiddenLevel/Gwj"; +import HiddenPartSelectTree from "zy-react-library/components/SelectTree/HiddenPart/Gwj"; +import Upload from "zy-react-library/components/Upload"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; + +function HiddenAddModal(props) { + const [form] = Form.useForm(); + const [hiddenPartType, setHiddenPartType] = useState("select"); + + const onSubmit = (values) => { + props.onConfirm({ ...values, hiddenPartType, hiddenFindTime: dayjs().format("YYYY-MM-DD hh:mm:ss"), rectificationType: 2 }); + props.onCancel(); + }; + + return ( + + +
+ + { + hiddenPartType === "select" + ? + : + } + + +
+ + ), + }, + { + name: "hiddenLevel", + label: "隐患级别", + render: ( + form.setFieldValue("hiddenLevelName", label)} + /> + ), + }, + { name: "hiddenLevelName", label: "隐患级别名称", onlyForLabel: true }, + { + name: "hiddenType", + label: "隐患类型", + render: ( + form.setFieldValue("hiddenTypeName", label)} + onGetNodePaths={(nodes) => { + form.setFieldValue("hiddenType2", nodes[0].dictValue); + form.setFieldValue("hiddenType2Name", nodes[0].dictLabel); + }} + /> + ), + }, + { name: "hiddenTypeName", label: "隐患类型名称", onlyForLabel: true }, + { name: "hiddenType2", label: "隐患类型名称", onlyForLabel: true }, + { name: "hiddenType2Name", label: "隐患类型名称", onlyForLabel: true }, + { + name: "isRelated", + label: "是否相关方", + render: FORM_ITEM_RENDER_ENUM.RADIO, + items: [{ bianma: 1, name: "是" }, { bianma: 2, name: "否" }], + }, + { name: "map", customizeRender: true, render: , span: 24 }, + { name: "positionDesc", label: "隐患位置描述", required: false, span: 24 }, + { + name: "hiddenImageFiles", + label: "隐患图片", + render: (), + span: 24, + }, + { + name: "hiddenVideoFiles", + label: "隐患视频", + render: (), + span: 24, + required: false, + }, + { + name: "creatorId", + label: "隐患发现人", + render: FORM_ITEM_RENDER_ENUM.SELECT, + items: props.hiddenDiscovererUserList, + itemsField: { labelKey: "userName", valueKey: "userId" }, + componentProps: { + onChange: (value) => { + const findItem = props.hiddenDiscovererUserList.find(item => item.userId === value) || {}; + form.setFieldValue("creatorName", findItem.userName); + form.setFieldValue("hiddenFindDeptName", findItem.departmentName); + form.setFieldValue("hiddenFindDept", findItem.departmentId); + }, + }, + }, + { name: "creatorName", label: "隐患发现人名称", onlyForLabel: true }, + { name: "hiddenFindDeptName", label: "隐患发现部门名称", onlyForLabel: true }, + { name: "hiddenFindDept", label: "隐患发现部门", onlyForLabel: true }, + ]} + /> +
+ ); +} + +export default HiddenAddModal; diff --git a/src/pages/Container/BranchCompany/Inspection/Add/index.js b/src/pages/Container/BranchCompany/Inspection/Add/index.js new file mode 100644 index 0000000..6b2574a --- /dev/null +++ b/src/pages/Container/BranchCompany/Inspection/Add/index.js @@ -0,0 +1,494 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Col, Form, Input, message, Modal, Row } from "antd"; +import { cloneDeep } from "lodash-es"; +import { useEffect, useRef, useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import HeaderBack from "zy-react-library/components/HeaderBack"; +import PersonnelSelect from "zy-react-library/components/Select/Personnel/Gwj"; +import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; +import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary"; +import Signature from "zy-react-library/components/Signature"; +import Table from "zy-react-library/components/Table"; +import Upload from "zy-react-library/components/Upload"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useDeleteFile from "zy-react-library/hooks/useDeleteFile"; +import useGetFile from "zy-react-library/hooks/useGetFile"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import useGetUserInfo from "zy-react-library/hooks/useGetUserInfo"; +import useIsExistenceDuplicateSelection from "zy-react-library/hooks/useIsExistenceDuplicateSelection"; +import useUploadFile from "zy-react-library/hooks/useUploadFile"; +import { getFileUrl, validatorEndTime } from "zy-react-library/utils"; +import { INSPECTION_QUESTION_ENUM } from "~/enumerate/constant"; +import { NS_INSPECTION } from "~/enumerate/namespace"; +import HiddenAddModal from "./components/HiddenAdd"; + +function Add(props) { + const query = useGetUrlQuery(); + const { getUserInfo } = useGetUserInfo(); + const { loading: deleteFileLoading, deleteFile } = useDeleteFile(); + const { loading: getFileLoading, getFile } = useGetFile(); + const { loading: uploadFileLoading, uploadFile } = useUploadFile(); + const { isExistenceDuplicateSelection } = useIsExistenceDuplicateSelection(); + + const [form] = Form.useForm(); + const personUnderInspectionDepartmentId = Form.useWatch(["personUnderInspection", "departmentId"], form); + const inspectorList = Form.useWatch("inspectorList", form); + + const [userInfo, setUserInfo] = useState({}); + const [hiddenAddModalOpen, setHiddenAddModalOpen] = useState(false); + const [hiddenDiscovererUserList, setHiddenDiscovererUserList] = useState([]); + const [hiddenList, setHiddenList] = useState([]); + const deleteHiddenIds = useRef([]); + const [signatureFilePath, setSignatureFilePath] = useState(""); + + const getData = async () => { + const userInfo = await getUserInfo(); + setUserInfo(userInfo); + if (query.id) { + const situationList = []; + const { data } = await props["inspectionView"]({ inspectionId: query.id }); + situationList.push(...data.content); + for (let i = 0; i < situationList.length; i++) { + const files = await getFile({ + eqType: UPLOAD_FILE_TYPE_ENUM["140"], + eqForeignKey: situationList[i].contentId, + }); + situationList[i].files = files; + } + const currentInspectorUser = data.inspectorVerificationList.filter(item => item.userId === userInfo.id)[0]; + setSignatureFilePath(currentInspectorUser.signature ? getFileUrl() + currentInspectorUser.signature : ""); + form.setFieldsValue({ + ...data, + situationList, + inspectorList: data.inspectorVerificationList, + personUnderInspection: data.inspectedPartyConfirmation, + initiator: { + userRemarks: currentInspectorUser.userRemarks, + signature: currentInspectorUser.signature, + signatureTime: currentInspectorUser.signatureTime, + }, + }); + const { data: hiddenList } = await props["hiddenList"]({ foreignKey: query.inspectionId, pageIndex: 1, pageSize: 999 }); + setHiddenList(hiddenList); + } + else { + form.setFieldsValue({ + inspectorList: [{ + departmentId: userInfo.departmentId, + userId: userInfo.id, + departmentName: userInfo.departmentName, + userName: userInfo.name, + }], + }); + } + }; + + useEffect(() => { + getData(); + }, []); + + const onSubmit = async (values, isDraft) => { + await isExistenceDuplicateSelection({ data: values.inspectorList, key: "userId" }); + // 删除旧的签字图片 + await deleteFile({ single: false, files: [{ filePath: values.deleteSignature }] }); + let signatureFilePath = ""; + // 签字图片 + if (typeof values.initiator.signature !== "string") { + const { filePath } = await uploadFile({ + files: [{ originFileObj: values.initiator.signature }], + params: { type: UPLOAD_FILE_TYPE_ENUM["139"] }, + }); + signatureFilePath = filePath; + } + else { + signatureFilePath = values.initiator.signature; + } + const situationList = cloneDeep(values.situationList.filter(Boolean)); + // 检查情况图片 + for (let i = 0; i < situationList.length; i++) { + await deleteFile({ single: false, files: situationList[i].deleteFiles }); + const { id } = await uploadFile({ + single: false, + files: situationList[i].files, + params: { type: UPLOAD_FILE_TYPE_ENUM["140"], foreignKey: situationList[i].contentId }, + }); + situationList[i].imgId = id; + delete situationList[i].deleteFiles; + delete situationList[i].files; + } + const inspectorList = cloneDeep(values.inspectorList.filter(Boolean)); + if (!inspectorList.some(item => userInfo.id === item.userId)) { + inspectorList.push({ + departmentId: userInfo.departmentId, + departmentName: userInfo.departmentName, + userId: userInfo.id, + userName: userInfo.name, + }); + } + // 发起新增请求 + const { traceId } = await props[!query.id ? "inspectionAdd" : "inspectionUpdate"]({ + ...values, + situationList, + inspectorList, + initiator: { ...values.initiator, signature: signatureFilePath }, + isDraft, + source: props.source || "5", + deleteSignature: undefined, + hiddenNumber: hiddenList.length, + inspectionId: query.id, + inspectionBusinessId: query.inspectionId, + }); + // 删除隐患附件,删除隐患 + for (let i = 0; i < deleteHiddenIds.current.length; i++) { + props["hiddenDelete"]({ ids: deleteHiddenIds.current.join(",") }); + const hiddenImageFiles = await getFile({ + eqType: UPLOAD_FILE_TYPE_ENUM["3"], + eqForeignKey: deleteHiddenIds.current[i], + }); + await deleteFile({ single: false, files: hiddenImageFiles }); + const hiddenVideoFiles = await getFile({ + eqType: UPLOAD_FILE_TYPE_ENUM["102"], + eqForeignKey: deleteHiddenIds.current[i], + }); + await deleteFile({ single: false, files: hiddenVideoFiles }); + } + // 上传隐患图片,新增隐患 + for (let i = 0; i < hiddenList.length; i++) { + if (!hiddenList[i].hiddenId) { + const { id } = await uploadFile({ + single: false, + files: hiddenList[i].hiddenImageFiles, + params: { type: UPLOAD_FILE_TYPE_ENUM["3"], foreignKey: hiddenList[i].hiddenId }, + }); + await uploadFile({ + single: false, + files: hiddenList[i].hiddenVideoFiles, + params: { type: UPLOAD_FILE_TYPE_ENUM["102"], foreignKey: id }, + }); + delete hiddenList[i].hiddenImageFiles; + delete hiddenList[i].hiddenVideoFiles; + if (hiddenList[i].hiddenPartType === "input") { + await props["partAdd"]({ hiddenregion: hiddenList[i].hiddenPart }); + } + await props["hiddenAdd"]({ + ...hiddenList[i], + source: 5, + hiddenId: id, + state: isDraft === 0 ? 102 : 98, + foreignKey: traceId, + }); + } + } + message.success("操作成功"); + props.history.goBack(); + }; + + return ( +
+ +
+ onSubmit(values, 0)} + extraActionButtons={[ + , + ]} + options={[ + { + name: "subject", + label: "检查题目", + render: FORM_ITEM_RENDER_ENUM.RADIO, + items: INSPECTION_QUESTION_ENUM, + span: 24, + }, + { + name: ["personUnderInspection", "departmentId"], + label: "被检查单位", + render: ( + form.setFieldValue(["personUnderInspection", "departmentName"], label)} + onChange={() => { + form.setFieldValue(["personUnderInspection", "userId"], ""); + form.setFieldValue(["personUnderInspection", "userName"], ""); + }} + /> + ), + }, + { name: ["personUnderInspection", "departmentName"], label: "被检查单位名称", onlyForLabel: true }, + { + name: ["personUnderInspection", "userId"], + label: "被检查单位现场负责人", + render: ( + form.setFieldValue(["personUnderInspection", "userName"], label)} + /> + ), + }, + { name: ["personUnderInspection", "userName"], label: "被检查单位现场负责人名称", onlyForLabel: true }, + { name: "place", label: "检查场所", span: 24 }, + { + name: "type", + label: "检查类型", + span: 8, + render: ( + form.setFieldValue("typeName", label)} + /> + ), + formItemProps: { labelCol: { span: 6 } }, + }, + { name: "typeName", label: "检查类型名称", onlyForLabel: true }, + { + name: "timeStart", + label: "检查开始时间", + span: 8, + render: FORM_ITEM_RENDER_ENUM.DATETIME, + formItemProps: { labelCol: { span: 6 } }, + }, + { + name: "timeEnd", + label: "检查结束时间", + span: 8, + render: FORM_ITEM_RENDER_ENUM.DATETIME, + formItemProps: { labelCol: { span: 6 } }, + rules: [validatorEndTime(form.getFieldValue("timeStart"))], + }, + { label: "检查人员", render: FORM_ITEM_RENDER_ENUM.DIVIDER }, + { + key: "inspectorList", + customizeRender: true, + span: 24, + render: ( + <> + + {(fields, { add, remove }) => ( + <> + {fields.map((field, index) => ( + +
+ + { + form.setFieldValue(["inspectorList", field.name, "userId"], ""); + form.setFieldValue(["inspectorList", field.name, "userName"], ""); + }} + onGetLabel={(label) => { + form.setFieldValue(["inspectorList", field.name, "departmentName"], label); + }} + /> + + + + + + + +
+ + form.setFieldValue(["inspectorList", field.name, "userName"], label)} + /> + + { + index >= 1 + ? + : + } +
+
+ + + + + + ))} + + )} + + + ), + }, + { label: "检查情况", render: FORM_ITEM_RENDER_ENUM.DIVIDER }, + { + key: "situationList", + customizeRender: true, + span: 24, + render: ( + <> + + {(fields, { add, remove }) => ( + <> + {fields.map((field, index) => ( + + + + + + + + +
+
+ + { + form.setFieldValue( + ["situationList", field.name, "deleteFiles"], + [...(form.getFieldValue(["situationList", field.name, "deleteFiles"]) || []), file], + ); + }} + /> + +
+ { + index >= 1 + ? + : + } +
+
+ + + + + + ))} + + )} + + + ), + }, + { label: "发现问题", render: FORM_ITEM_RENDER_ENUM.DIVIDER }, + { + key: "hiddenList", + customizeRender: true, + span: 24, + render: ( +
( + + )} + dataSource={hiddenList} + columns={[ + { title: "问题描述", dataIndex: "hiddenDesc" }, + { + title: "操作", + width: 100, + render: (_, record, index) => ( + + ), + }, + ]} + /> + ), + }, + { name: ["initiator", "userRemarks"], label: "检查人意见", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, span: 24 }, + { + name: ["initiator", "signature"], + label: "检查人", + span: 24, + required: false, + rules: [{ required: true, message: "请签名" }], + render: ( + { + const signature = form.getFieldValue(["initiator", "signature"]); + if (query.id && typeof signature === "string") { + form.setFieldValue("deleteSignature", signature); + } + form.setFieldValue(["initiator", "signature"], value.file); + form.setFieldValue(["initiator", "signatureTime"], value.time); + }} + /> + ), + }, + { name: ["initiator", "signatureTime"], label: "签字时间", onlyForLabel: true }, + { name: "deleteSignature", label: "删除的签字图片", onlyForLabel: true }, + ]} + /> + + { + hiddenAddModalOpen && ( + setHiddenAddModalOpen(false)} + onConfirm={values => setHiddenList([...hiddenList, values])} + /> + ) + } + + ); +} + +export default Connect([NS_INSPECTION], true)(Add); diff --git a/src/pages/Container/BranchCompany/Inspection/List/index.js b/src/pages/Container/BranchCompany/Inspection/List/index.js new file mode 100644 index 0000000..d138698 --- /dev/null +++ b/src/pages/Container/BranchCompany/Inspection/List/index.js @@ -0,0 +1,293 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { + ReactFlow, + ReactFlowProvider, +} from "@xyflow/react"; +import { Button, Form, message, Modal, Space, Spin } from "antd"; +import { useEffect, useState } from "react"; +import AddIcon from "zy-react-library/components/Icon/AddIcon"; +import ExportIcon from "zy-react-library/components/Icon/ExportIcon"; +import Search from "zy-react-library/components/Search"; +import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; +import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary"; +import Table from "zy-react-library/components/Table"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import useTable from "zy-react-library/hooks/useTable"; +import { getLabelName } from "zy-react-library/utils"; +import { INSPECTION_QUESTION_ENUM, INSPECTION_STATE_ENUM } from "~/enumerate/constant"; +import { NS_INSPECTION } from "~/enumerate/namespace"; +import { getFlowData } from "~/utils/flow"; +import "@xyflow/react/dist/style.css"; + +function List(props) { + const [flowModalOpen, setFlowModalOpen] = useState(false); + const [currentId, setCurrentId] = useState(""); + const [count, setCount] = useState({ + inspectCount: 0, + hiddenCount: 0, + safetyCount: 0, + environmentalCount: 0, + }); + + const [form] = Form.useForm(); + + const { tableProps, getData } = useTable(props["inspectionList"], { + form, + transform: formData => ({ + checkStartTime: formData.checkTime?.[0], + checkEndTime: formData.checkTime?.[1], + }), + params: { status: "" }, + }); + const getCount = async () => { + const { data } = await props["inspectionCount"](); + console.log(data); + setCount(data); + }; + useEffect(() => { + getCount(); + }, []); + + const onDelete = (id) => { + Modal.confirm({ + title: "删除确认", + content: "确定要删除吗?", + onOk: async () => { + const { success } = await props["inspectionDelete"]({ id }); + if (success) { + message.success("删除成功"); + getData(); + } + }, + }); + }; + + return ( +
+ }, + { name: "inspectionUserName", label: "检查人员" }, + { name: "type", label: "检查类型", render: }, + { name: "inspectedDepartmentId", label: "被检查单位", render: }, + { name: "inspectedUserName", label: "被检查单位现场负责人" }, + { name: "status", label: "检查状态", render: FORM_ITEM_RENDER_ENUM.SELECT, items: INSPECTION_STATE_ENUM }, + { name: "checkYear", label: "检查年度", render: FORM_ITEM_RENDER_ENUM.DATE_YEAR }, + { name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE }, + ]} + form={form} + onFinish={getData} + /> +
+ +
+ 安全检查总数: + {count.safetyCount} +
+
+ 环保检查总数: + {count.environmentalCount} +
+
+ 综合检查总数: + {count.comprehensiveCount} +
+
+ 涉及隐患总数: + {count.hiddenCount} +
+
+ + )} + toolBarRender={() => ( + + + + + )} + columns={[ + { title: "检查题目", dataIndex: "subject" }, + { title: "检查发起人", dataIndex: "inspectionOriginatorUserName" }, + { title: "检查部门", dataIndex: "inspectionDepartmentName" }, + { title: "检查人", dataIndex: "inspectionInspectorUserName" }, + { title: "被检查单位", dataIndex: "inspectionSiteDepartmentName" }, + { title: "被检查单位现场负责人", dataIndex: "inspectedSiteManagerName", width: 200 }, + { title: "检查类型", dataIndex: "typeName" }, + { title: "检查时间", width: 200, render: (_, record) => (`${record.timeStart}至${record.timeEnd}`) }, + { + title: "检查状态", + dataIndex: "status", + render: (_, record) => (getLabelName({ list: INSPECTION_STATE_ENUM, status: record.status })), + }, + { title: "发现隐患数", dataIndex: "hiddenNumber" }, + { + title: "操作", + fixed: "right", + width: 200, + render: (_, record) => ( + + {(record.status === -1 || record.status === 600) && ( + + )} + { + record.status !== -1 && ( + + ) + } + + + + ), + }, + ]} + {...tableProps} + /> + { + flowModalOpen && ( + { + setFlowModalOpen(false); + setCurrentId(""); + }} + /> + ) + } + + ); +} + +function FlowModalComponent(props) { + const [nodes, setNodes] = useState([]); + const [edges, setEdges] = useState([]); + + const getData = async () => { + const { data } = await props["inspectionFlowchart"]({ id: props.id }); + + // 定义type的顺序 + const typeOrder = [100, 200, 300, 600, 700, 400, 500]; + + // 根据type顺序对flowCOList进行排序 + const sortedFlowList = [...data.flowCOList].sort((a, b) => { + const indexA = typeOrder.indexOf(a.type); + const indexB = typeOrder.indexOf(b.type); + // 如果type不在预定义顺序中,放到最后 + return (indexA === -1 ? Infinity : indexA) - (indexB === -1 ? Infinity : indexB); + }); + + const { nodes, edges } = getFlowData(sortedFlowList, data.thisFlow); + setNodes(nodes); + setEdges(edges); + }; + + useEffect(() => { + getData(); + }, []); + + return ( + 取消, + ]} + > + +
+ + + +
+
+
+ ); +} + +const FlowModal = Connect([NS_INSPECTION], true)(FlowModalComponent); +export default Connect([NS_INSPECTION], true)(List); diff --git a/src/pages/Container/BranchCompany/Inspection/index.js b/src/pages/Container/BranchCompany/Inspection/index.js new file mode 100644 index 0000000..f1279b4 --- /dev/null +++ b/src/pages/Container/BranchCompany/Inspection/index.js @@ -0,0 +1,9 @@ +function Inspection(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Inspection; diff --git a/src/pages/Container/BranchCompany/Inspector/List/index.js b/src/pages/Container/BranchCompany/Inspector/List/index.js new file mode 100644 index 0000000..8ebd026 --- /dev/null +++ b/src/pages/Container/BranchCompany/Inspector/List/index.js @@ -0,0 +1,177 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { Button, Form, message, Modal, Space } from "antd"; +import { useState } from "react"; +import FormBuilder from "zy-react-library/components/FormBuilder"; +import Search from "zy-react-library/components/Search"; +import DepartmentSelectTree from "zy-react-library/components/SelectTree/Department/Gwj"; +import DictionarySelectTree from "zy-react-library/components/SelectTree/Dictionary"; +import Signature from "zy-react-library/components/Signature"; +import Table from "zy-react-library/components/Table"; +import { FORM_ITEM_RENDER_ENUM } from "zy-react-library/enum/formItemRender"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useTable from "zy-react-library/hooks/useTable"; +import useUploadFile from "zy-react-library/hooks/useUploadFile"; +import { INSPECTION_QUESTION_ENUM } from "~/enumerate/constant"; +import { NS_INSPECTION } from "~/enumerate/namespace"; + +function List(props) { + const [verifyModalOpen, setVerifyModalOpen] = useState(false); + const [currentId, setCurrentId] = useState(""); + const [form] = Form.useForm(); + const { tableProps, getData } = useTable(props["inspectionList"], { + form, + transform: formData => ({ + checkStartTime: formData.checkTime?.[0], + checkEndTime: formData.checkTime?.[1], + }), + params: { status: "200" }, + }); + + return ( +
+ }, + { name: "inspectionUserName", label: "检查人" }, + { name: "type", label: "检查类型", render: }, + { name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE }, + { name: "inspectedDepartmentId", label: "被检查单位", render: }, + { name: "inspectedUserName", label: "被检查单位现场负责人" }, + ]} + form={form} + onFinish={getData} + /> +
(`${record.timeStart}至${record.timeEnd}`) }, + { title: "检查状态", dataIndex: "status", render: () => "待核实" }, + { title: "发现隐患数", dataIndex: "hiddenNumber" }, + { + title: "操作", + fixed: "right", + width: 150, + render: (_, record) => ( + + + + + ), + }, + ]} + {...tableProps} + /> + {verifyModalOpen && ( + { + setVerifyModalOpen(false); + setCurrentId(""); + }} + getData={getData} + /> + )} + + ); +} + +function VerifyModalComponent(props) { + const [form] = Form.useForm(); + const { loading: uploadFileLoading, uploadFile } = useUploadFile(); + + const onSubmit = async (values) => { + const { filePath } = await uploadFile({ + files: [{ originFileObj: values.signature }], + params: { type: UPLOAD_FILE_TYPE_ENUM["141"] }, + }); + const { success } = await props["inspectorVerify"]({ ...values, signature: filePath, inspectionId: props.id }); + if (success) { + message.success("操作成功"); + props.onCancel(); + props.getData(); + } + }; + + return ( + + !(formValues.status === "2"), + }, + { + name: "signature", + label: "检查人", + required: false, + rules: [{ required: true, message: "请签名" }], + render: ( + { + form.setFieldValue("signature", value.file); + form.setFieldValue("signatureTime", value.time); + }} + /> + ), + }, + { name: "signatureTime", label: "签字时间", onlyForLabel: true }, + ]} + /> + + ); +} + +const VerifyModal = Connect([NS_INSPECTION], true)(VerifyModalComponent); +export default Connect([NS_INSPECTION], true)(List); diff --git a/src/pages/Container/BranchCompany/Inspector/index.js b/src/pages/Container/BranchCompany/Inspector/index.js new file mode 100644 index 0000000..92dfd3d --- /dev/null +++ b/src/pages/Container/BranchCompany/Inspector/index.js @@ -0,0 +1,9 @@ +function Inspector(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Inspector; diff --git a/src/pages/Container/BranchCompany/ViewInfo/index.js b/src/pages/Container/BranchCompany/ViewInfo/index.js new file mode 100644 index 0000000..6beebb7 --- /dev/null +++ b/src/pages/Container/BranchCompany/ViewInfo/index.js @@ -0,0 +1,322 @@ +import { Connect } from "@cqsjjb/jjb-dva-runtime"; +import { ReactFlow, ReactFlowProvider } from "@xyflow/react"; +import { Button, Descriptions, Divider, message, Modal, Space, Spin } from "antd"; +import { useEffect, useRef, useState } from "react"; +import { useReactToPrint } from "react-to-print"; +import HeaderBack from "zy-react-library/components/HeaderBack"; +import HiddenInfo from "zy-react-library/components/HiddenInfo/gwj"; +import PreviewImg from "zy-react-library/components/PreviewImg"; +import Table from "zy-react-library/components/Table"; +import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj"; +import useGetFile from "zy-react-library/hooks/useGetFile"; +import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery"; +import useGetUserInfo from "zy-react-library/hooks/useGetUserInfo"; +import { getFileUrl } from "zy-react-library/utils"; +import { NS_INSPECTION } from "~/enumerate/namespace"; +import { getFlowData } from "~/utils/flow"; +import "./index.less"; + +function View(props) { + const query = useGetUrlQuery(); + const { loading: getFileLoading, getFile } = useGetFile(); + const { getUserInfo } = useGetUserInfo(); + + const [info, setInfo] = useState({ + inspectedPartyConfirmation: {}, + currentInspectorUser: {}, + content: [], + inspectorVerificationList: [], + }); + const [hiddenList, setHiddenList] = useState([]); + const [hiddenViewModalOpen, setHiddenViewModalOpen] = useState(false); + const [hiddenId, setHiddenId] = useState(""); + const [hiddenUUId, setHiddenUUId] = useState(""); + const [flowModalOpen, setFlowModalOpen] = useState(false); + const [currentId, setCurrentId] = useState(""); + const contentRef = useRef(null); + const handlePrint = useReactToPrint({ + contentRef, + pageStyle: ` @page { + size: landscape; + margin: 0mm; + } + @media print { + body { + margin: 10px; + padding: 10px; + } + } + `, + documentTitle: "", + }); + + const getData = async () => { + const userInfo = await getUserInfo(); + const { data } = await props["inspectionView"]({ inspectionId: query.id }); + for (let i = 0; i < data.content.length; i++) { + const files = await getFile({ + eqType: UPLOAD_FILE_TYPE_ENUM["140"], + eqForeignKey: data.content[i].contentId, + }); + data.content[i].files = files; + } + data.currentInspectorUser = data.inspectorVerificationList.filter(item => item.userId === userInfo.id)[0]; + setInfo(data); + const { data: hiddenList } = await props["hiddenList"]({ foreignKey: query.inspectionId, pageIndex: 1, pageSize: 999 }); + setHiddenList(hiddenList); + }; + useEffect(() => { + getData(); + }, []); + + return ( +
+ + +
+ + {info.subject} + 现场安全检查记录 + + + 检查情况 + + [ + { label: "检查情况", children: item.content }, + { label: "图片", children: () }, + ], + ).flat() + } + /> + 发现问题 +
( + + + + + ) }, + ]} + /> +
+ + + + + + + + + { + (hiddenList || []).map((item, index) => ( + + + + + + )) + } + +
序号隐患描述隐患部位
{index + 1}{item.hiddenDesc}{item.hiddenPartName}
+ 检查人员审核情况 + (record.signature && ) }, + ]} + /> +
+ + + + + + + + + + { + info.inspectorVerificationList.map((item, index) => ( + + + + + + + )) + } + +
序号审核人员审核意见签字
{index + 1}{item.userName}{item.userRemarks}{item.signature && }
+ 被检查单位现场负责人确认情况 + ) }, + ]} + /> +
+
+ + + {query.isExport !== "0" && } + +
+ + {hiddenViewModalOpen && ( + { + setHiddenViewModalOpen(false); + setHiddenId(""); + setHiddenUUId(""); + }} + /> + )} + {flowModalOpen && ( + { + setFlowModalOpen(false); + setCurrentId(""); + }} + /> + )} +
+ ); +} + +function HiddenViewModal(props) { + return ( + 取消, + ]} + > + + + ); +} + +function FlowModalComponent(props) { + const [nodes, setNodes] = useState([]); + const [edges, setEdges] = useState([]); + + const getData = async () => { + const { success, data } = await props["hiddenFlowchart"]({ id: props.id }); + if (success) { + const { nodes, edges } = getFlowData(data.flowCOList, data.thisFlow); + setNodes(nodes); + setEdges(edges); + } + else { + message.error("获取数据失败"); + props.onCancel(); + } + }; + useEffect(() => { + getData(); + }, []); + + return ( + 取消, + ]} + > + +
+ + + +
+
+
+ ); +} + +const FlowModal = Connect([NS_INSPECTION], true)(FlowModalComponent); + +export default Connect([NS_INSPECTION], true)(View); diff --git a/src/pages/Container/BranchCompany/ViewInfo/index.less b/src/pages/Container/BranchCompany/ViewInfo/index.less new file mode 100644 index 0000000..53ccaa5 --- /dev/null +++ b/src/pages/Container/BranchCompany/ViewInfo/index.less @@ -0,0 +1,23 @@ +.print-table { + display: none; + border-collapse: collapse; + width: 100%; + font-size: 14px; + + td, th { + border: 1px solid #eaeaea; + padding: 8px; + line-height: 1.6; + text-align: center; + } + + @media print { + display: table; + } +} + +.print-no-use { + @media print { + display: none; + } +} diff --git a/src/pages/Container/BranchCompany/index.js b/src/pages/Container/BranchCompany/index.js new file mode 100644 index 0000000..627f42d --- /dev/null +++ b/src/pages/Container/BranchCompany/index.js @@ -0,0 +1,9 @@ +function BranchCompany(props) { + return ( +
+ {props.children} +
+ ); +} + +export default BranchCompany; 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/Supervision/Acceptance/Acceptance/index.js b/src/pages/Container/Supervision/Acceptance/Acceptance/index.js new file mode 100644 index 0000000..37a16c7 --- /dev/null +++ b/src/pages/Container/Supervision/Acceptance/Acceptance/index.js @@ -0,0 +1,7 @@ +import AcceptanceAcceptance from "../../../BranchCompany/Acceptance/Acceptance"; + +function Acceptance(props) { + return ; +} + +export default Acceptance; diff --git a/src/pages/Container/Supervision/Acceptance/HiddenList/index.js b/src/pages/Container/Supervision/Acceptance/HiddenList/index.js new file mode 100644 index 0000000..e9e10c6 --- /dev/null +++ b/src/pages/Container/Supervision/Acceptance/HiddenList/index.js @@ -0,0 +1,7 @@ +import AcceptanceHiddenList from "../../../BranchCompany/Acceptance/HiddenList"; + +function HiddenList(props) { + return ; +} + +export default HiddenList; diff --git a/src/pages/Container/Supervision/Acceptance/List/index.js b/src/pages/Container/Supervision/Acceptance/List/index.js new file mode 100644 index 0000000..dbc35c0 --- /dev/null +++ b/src/pages/Container/Supervision/Acceptance/List/index.js @@ -0,0 +1,7 @@ +import AcceptanceList from "../../../BranchCompany/Acceptance/List"; + +function List(props) { + return ; +} + +export default List; diff --git a/src/pages/Container/Supervision/Acceptance/index.js b/src/pages/Container/Supervision/Acceptance/index.js new file mode 100644 index 0000000..af24af4 --- /dev/null +++ b/src/pages/Container/Supervision/Acceptance/index.js @@ -0,0 +1,9 @@ +function Acceptance(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Acceptance; diff --git a/src/pages/Container/Supervision/Defense/List/index.js b/src/pages/Container/Supervision/Defense/List/index.js new file mode 100644 index 0000000..4194894 --- /dev/null +++ b/src/pages/Container/Supervision/Defense/List/index.js @@ -0,0 +1,7 @@ +import DefenseList from "../../../BranchCompany/Defense/List"; + +function List(props) { + return ; +} + +export default List; diff --git a/src/pages/Container/Supervision/Defense/index.js b/src/pages/Container/Supervision/Defense/index.js new file mode 100644 index 0000000..a23bcb1 --- /dev/null +++ b/src/pages/Container/Supervision/Defense/index.js @@ -0,0 +1,9 @@ +function Defense(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Defense; diff --git a/src/pages/Container/Supervision/Inspection/Add/index.js b/src/pages/Container/Supervision/Inspection/Add/index.js new file mode 100644 index 0000000..eb62a93 --- /dev/null +++ b/src/pages/Container/Supervision/Inspection/Add/index.js @@ -0,0 +1,7 @@ +import InspectionAdd from "../../../BranchCompany/Inspection/Add"; + +function Add(props) { + return ; +} + +export default Add; diff --git a/src/pages/Container/Supervision/Inspection/List/index.js b/src/pages/Container/Supervision/Inspection/List/index.js new file mode 100644 index 0000000..0d3a7b1 --- /dev/null +++ b/src/pages/Container/Supervision/Inspection/List/index.js @@ -0,0 +1,7 @@ +import InspectionList from "../../../BranchCompany/Inspection/List"; + +function List(props) { + return ; +} + +export default List; diff --git a/src/pages/Container/Supervision/Inspection/index.js b/src/pages/Container/Supervision/Inspection/index.js new file mode 100644 index 0000000..f1279b4 --- /dev/null +++ b/src/pages/Container/Supervision/Inspection/index.js @@ -0,0 +1,9 @@ +function Inspection(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Inspection; diff --git a/src/pages/Container/Supervision/Inspector/List/index.js b/src/pages/Container/Supervision/Inspector/List/index.js new file mode 100644 index 0000000..1ef0e3e --- /dev/null +++ b/src/pages/Container/Supervision/Inspector/List/index.js @@ -0,0 +1,7 @@ +import InspectorList from "../../../BranchCompany/Inspector/List"; + +function List(props) { + return ; +} + +export default List; diff --git a/src/pages/Container/Supervision/Inspector/index.js b/src/pages/Container/Supervision/Inspector/index.js new file mode 100644 index 0000000..92dfd3d --- /dev/null +++ b/src/pages/Container/Supervision/Inspector/index.js @@ -0,0 +1,9 @@ +function Inspector(props) { + return ( +
+ {props.children} +
+ ); +} + +export default Inspector; diff --git a/src/pages/Container/Supervision/ViewInfo/index.js b/src/pages/Container/Supervision/ViewInfo/index.js new file mode 100644 index 0000000..c93a8b6 --- /dev/null +++ b/src/pages/Container/Supervision/ViewInfo/index.js @@ -0,0 +1,7 @@ +import ViewInfoA from "../../BranchCompany/ViewInfo"; + +function ViewInfo() { + return ; +} + +export default ViewInfo; diff --git a/src/pages/Container/Supervision/index.js b/src/pages/Container/Supervision/index.js new file mode 100644 index 0000000..eda14bf --- /dev/null +++ b/src/pages/Container/Supervision/index.js @@ -0,0 +1,9 @@ +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..ebc67a8 --- /dev/null +++ b/src/utils/flow.js @@ -0,0 +1,83 @@ +// 根据状态获取颜色 +export const getStatusColor = (status, type, thisFlow) => { + // 如果data.thisFlow和flowItem的type相等,则显示红色 + if (thisFlow && type === thisFlow) { + return "#ff4d4f"; // 红色(正在审核) + } + + // 根据状态设置颜色 + switch (status) { + case 0: return "#1890ff"; // 蓝色 + case 1: return "#52c41a"; // 绿色 + case 2: return "#52c41a"; // 绿色 + default: return "#1890ff"; + } +}; + +// 获取节点标签 +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; + const horizontalSpacing = 350; + const verticalPosition = 100; + + // 创建节点 + list.forEach((flowItem, index) => { + nodes.push({ + id: `node-${index}`, + data: { + label: getNodeLabel(flowItem), + status: flowItem.status, + }, + style: { + background: getStatusColor(flowItem.status, flowItem.type, thisFlow), + color: "white", + borderColor: getStatusColor(flowItem.status, flowItem.type, thisFlow), + width: nodeWidth, + minHeight: nodeHeight, + padding: "10px", + borderRadius: 5, + wordBreak: "break-word", + whiteSpace: "normal", + display: "flex", + alignItems: "center", + justifyContent: "center", + textAlign: "center", + }, + position: { x: index * horizontalSpacing, y: verticalPosition }, + }); + }); + + // 创建连接线 + 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, + style: { stroke: "#1890ff", strokeWidth: 2 }, + markerEnd: { + type: "arrowclosed", + color: "#1890ff", + }, + }); + } + + 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/"), + }, + }, +};