init
commit
81b0f177c4
|
|
@ -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
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,75 @@
|
||||||
|
# 微应用模板说明文档
|
||||||
|
|
||||||
|
## 在线文档
|
||||||
|
|
||||||
|
https://www.yuque.com/buhangjiecheshen-ymbtb/qc0093/gxdun1dphetcurko
|
||||||
|
|
||||||
|
|
||||||
|
## 安装依赖
|
||||||
|
项目依赖可通过 **yarn** 或 **npm** 进行安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 使用 yarn
|
||||||
|
yarn
|
||||||
|
|
||||||
|
# 或使用 npm
|
||||||
|
npm i
|
||||||
|
```
|
||||||
|
|
||||||
|
## 开发服务&打包应用
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 启动开发服务
|
||||||
|
yarn serve:<env>
|
||||||
|
# 或
|
||||||
|
npm run serve:<env>
|
||||||
|
|
||||||
|
# 开发环境打包
|
||||||
|
yarn build:<env>
|
||||||
|
# 或
|
||||||
|
npm run build:<env>
|
||||||
|
```
|
||||||
|
|
||||||
|
## 路由配置&路由访问&自动化路由
|
||||||
|
所有页面必须放在`src/pages/container`目录下,启动访问页面请在浏览器地址栏输入`/<appIdentifier>/container/<你的路由页面文件名称>`
|
||||||
|
解释:
|
||||||
|
1. 所有页面组件命名为`index.js`或`index.jsx`,必须放在一个首字母大写的文件中。
|
||||||
|
2. `container`为固定路径访问格式
|
||||||
|
3. `<appIdentifier>`为应用的唯一标识符,也是应用路由的`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`。
|
||||||
|
|
@ -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");
|
||||||
|
|
@ -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"],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
@ -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",
|
||||||
|
}],
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,77 @@
|
||||||
|
module.exports = {
|
||||||
|
// 应用后端git地址,部署上线需要
|
||||||
|
javaGit: "<git-url>",
|
||||||
|
// 应用后端仓库名称,部署上线需要
|
||||||
|
javaGitName: "<git-name>",
|
||||||
|
// 环境配置
|
||||||
|
environment: {
|
||||||
|
development: {
|
||||||
|
// 应用后端分支名称,部署上线需要
|
||||||
|
javaGitBranch: "<branch-name>",
|
||||||
|
// 接口服务地址
|
||||||
|
API_HOST: "http://192.168.20.100:30140",
|
||||||
|
},
|
||||||
|
production: {
|
||||||
|
// 应用后端分支名称,部署上线需要
|
||||||
|
javaGitBranch: "<branch-name>",
|
||||||
|
// 接口服务地址
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": "src",
|
||||||
|
"paths": {
|
||||||
|
"~/*": ["*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
||||||
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
<!--BEGIN-->
|
||||||
|
<!--<% var { env: $env, process: $process, mode: $mode, builtInfo: $builtInfo, links: $links, redirectLogin: $redirectLogin, framework: $framework, scripts: $scripts, element: $element } = htmlWebpackPlugin.options %>-->
|
||||||
|
<!--<% var { appKey: $appKey, antd: $antd, basename: $basename, API_HOST: $API_HOST } = $process %>-->
|
||||||
|
<!--<% var { ['ant-prefix']: $antPrefix, fontFamily: $fontFamily, colorPrimary: $colorPrimary, borderRadius: $borderRadius } = $antd %>-->
|
||||||
|
<!--NED-->
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh">
|
||||||
|
<head data-built-info="<%= $builtInfo %>">
|
||||||
|
<meta charset="UTF-8"/>
|
||||||
|
<meta name="renderer" content="webkit"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1"/>
|
||||||
|
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,viewport-fit=cover">
|
||||||
|
<% for (const item of $links) { %>
|
||||||
|
<link type="text/css" rel="stylesheet" href="<%= item %>"></link>
|
||||||
|
<% } %>
|
||||||
|
<title>--</title>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
const APP_ENV = {
|
||||||
|
antd: {
|
||||||
|
'ant-prefix': '<%= $antPrefix %>',
|
||||||
|
fontFamily: '<%= $fontFamily %>',
|
||||||
|
colorPrimary: '<%= $colorPrimary %>',
|
||||||
|
borderRadius: parseInt('<%= $borderRadius %>')
|
||||||
|
},
|
||||||
|
appKey: '<%= $appKey %>',
|
||||||
|
basename: '<%= $basename %>',
|
||||||
|
API_HOST: '<%= $API_HOST %>'
|
||||||
|
};
|
||||||
|
APP_ENV.API_HOST = sessionStorage.API_HOST || APP_ENV.API_HOST || window.location.origin;
|
||||||
|
window.process = {
|
||||||
|
env: { app: APP_ENV },
|
||||||
|
NODE_ENV: '<%= $mode %>'
|
||||||
|
};
|
||||||
|
window.__JJB_ENVIRONMENT__ = {
|
||||||
|
API_HOST: APP_ENV.API_HOST,
|
||||||
|
redirect: '<%= $redirectLogin %>',
|
||||||
|
FRAMEWORK: APP_ENV.antd
|
||||||
|
};
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<!-- SCRIPTS -->
|
||||||
|
<% for (const item of $scripts) { %>
|
||||||
|
<script src="<%= item %>" type="text/javascript"></script>
|
||||||
|
<% } %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- NOSCRIPT -->
|
||||||
|
<noscript>此网页需要开启JavaScript功能。</noscript>
|
||||||
|
<!-- MAIN -->
|
||||||
|
<% const { root } = $element; %>
|
||||||
|
<div id="<%= root.id %>" style="width: 100%; height: 100%; position: relative;overflow-y: auto"></div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -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}",
|
||||||
|
// );
|
||||||
|
|
@ -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`,
|
||||||
|
);
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
export {};
|
||||||
|
|
@ -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: "暂存" },
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
/**
|
||||||
|
* 全局上下文定义
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
|
// 获取antd全局静态方法
|
||||||
|
export const InjectContext = React.createContext({});
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
/**
|
||||||
|
* 全局数据状态管理模块定义
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { defineNamespace } from "@cqsjjb/jjb-dva-runtime";
|
||||||
|
|
||||||
|
export const NS_GLOBAL = defineNamespace("global");
|
||||||
|
export const NS_INSPECTION = defineNamespace("inspection");
|
||||||
|
|
@ -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);
|
||||||
|
|
@ -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 (
|
||||||
|
<div>
|
||||||
|
<HeaderBack title="隐患验收" />
|
||||||
|
<HiddenInfo isShowHeaderBack={false} hiddenId={query.hiddenId} id={query.id} />
|
||||||
|
<Divider orientation="left">安全环保检查验收</Divider>
|
||||||
|
<FormBuilder
|
||||||
|
form={form}
|
||||||
|
loading={uploadFileLoading || props.inspection.acceptanceLoading}
|
||||||
|
onFinish={onSubmit}
|
||||||
|
span={24}
|
||||||
|
values={{
|
||||||
|
finalCheck: "1",
|
||||||
|
}}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "finalCheck",
|
||||||
|
label: "是否合格",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.RADIO,
|
||||||
|
items: [{ bianma: "1", name: "是" }, { bianma: "2", name: "否" }],
|
||||||
|
},
|
||||||
|
{ name: "finalCheckDesc", label: "验收意见", render: FORM_ITEM_RENDER_ENUM.TEXTAREA },
|
||||||
|
{ name: "finalCheckTime", label: "验收时间", render: FORM_ITEM_RENDER_ENUM.DATETIME },
|
||||||
|
{ name: "files", label: "验收图片", required: false, render: (<Upload />) },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(Acceptance);
|
||||||
|
|
@ -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 (
|
||||||
|
<div>
|
||||||
|
<HeaderBack title="隐患验收" />
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "隐患描述", dataIndex: "hiddenDesc" },
|
||||||
|
{ title: "隐患状态", dataIndex: "state", render: (_, record) => getLabelName({ list: HIDDEN_STATE_ENUM, status: record.state }) },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
width: 150,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../HiddenView?hiddenId=${record.hiddenId}&id=${record.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`./acceptance?hiddenId=${record.hiddenId}&id=${record.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
验收
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(HiddenList);
|
||||||
|
|
@ -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 (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "inspectionSubject",
|
||||||
|
label: "检查题目",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
|
},
|
||||||
|
{ name: "inspectionDeptId", label: "检查部门", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "inspectionUserName", label: "检查人" },
|
||||||
|
{ name: "type", label: "检查类型", render: <DictionarySelectTree dictValue="inspectionType" onlyLastLevel /> },
|
||||||
|
{ name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
||||||
|
{ name: "inspectedDepartmentId", label: "被检查单位", render: <DepartmentSelectTree searchType={props.searchType} /> },
|
||||||
|
{ name: "inspectedUserName", label: "被检查单位现场负责人" },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "检查题目", dataIndex: "subject" },
|
||||||
|
{ 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: () => "待验收" },
|
||||||
|
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 150,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../viewInfo?id=${record.id}&inspectionId=${record.inspectionId}&isExport=0`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`./hiddenList?id=${record.id}&inspectionId=${record.inspectionId}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
验收
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(List);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Acceptance(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Acceptance;
|
||||||
|
|
@ -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 (
|
||||||
|
<div>
|
||||||
|
<HeaderBack title="隐患指派" />
|
||||||
|
<HiddenInfo isShowHeaderBack={false} hiddenId={query.hiddenUUId} id={query.hiddenId} />
|
||||||
|
<Divider orientation="left">隐患确认</Divider>
|
||||||
|
<FormBuilder
|
||||||
|
form={form}
|
||||||
|
loading={props.inspection.assignLoading}
|
||||||
|
onFinish={onSubmit}
|
||||||
|
labelCol={{ span: 6 }}
|
||||||
|
span={24}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "userId",
|
||||||
|
label: "隐患确认人",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: confirmUserList,
|
||||||
|
itemsField: { valueKey: "userId", labelKey: "userName" },
|
||||||
|
componentProps: {
|
||||||
|
onChange: (value) => {
|
||||||
|
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 },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(Assign);
|
||||||
|
|
@ -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 (
|
||||||
|
<div>
|
||||||
|
<HeaderBack title="隐患指派" />
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "隐患描述", dataIndex: "hiddenDesc" },
|
||||||
|
{ title: "隐患状态", dataIndex: "state", render: (_, record) => getLabelName({ list: HIDDEN_STATE_ENUM, status: record.state }) },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
width: 150,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../HiddenView?hiddenId=${record.hiddenId}&id=${record.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`./assign?inspectionId=${query.inspectionId}&id=${query.id}&hiddenUUId=${record.hiddenId}&hiddenId=${record.id}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
指派
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(HiddenList);
|
||||||
|
|
@ -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 (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "inspectionSubject",
|
||||||
|
label: "检查题目",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
|
},
|
||||||
|
{ name: "inspectionDeptId", label: "检查部门", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "inspectionUserName", label: "检查人" },
|
||||||
|
{ name: "type", label: "检查类型", render: <DictionarySelectTree dictValue="inspectionType" onlyLastLevel /> },
|
||||||
|
{ name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
||||||
|
{ name: "inspectedDepartmentId", label: "被检查单位", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "inspectedUserName", label: "被检查单位现场负责人" },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "检查题目", dataIndex: "subject" },
|
||||||
|
{ 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: () => "待指派" },
|
||||||
|
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 150,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../viewInfo?id=${record.id}&inspectionId=${record.inspectionId}&isExport=0`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`./hiddenList?id=${record.id}&inspectionId=${record.inspectionId}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
指派
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(List);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Assign(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Assign;
|
||||||
|
|
@ -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 (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "inspectionSubject",
|
||||||
|
label: "检查题目",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
|
},
|
||||||
|
{ name: "inspectionOriginatorUserName", label: "检查发起人" },
|
||||||
|
{ name: "inspectionDeptId", label: "检查部门", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "inspectionUserName", label: "检查人" },
|
||||||
|
{ name: "type", label: "检查类型", render: <DictionarySelectTree dictValue="inspectionType" onlyLastLevel /> },
|
||||||
|
{ name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
||||||
|
{ name: "inspectedDepartmentId", label: "被检查单位", render: <DepartmentSelectTree searchType={props.searchType} /> },
|
||||||
|
{ name: "inspectedUserName", label: "被检查单位现场负责人" },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "检查题目", dataIndex: "subject" },
|
||||||
|
{ 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: () => "被检查单位负责人申辩" },
|
||||||
|
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 200,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../viewInfo?id=${record.id}&inspectionId=${record.inspectionId}&isExport=0`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setDefenseHandlingModalOpen(true);
|
||||||
|
setCurrentId(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
申辩处理
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setDefenseRecordModalOpen(true);
|
||||||
|
setCurrentId(record.inspectionId);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
申辩记录
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
{defenseHandlingModalOpen && (
|
||||||
|
<DefenseHandlingModal
|
||||||
|
id={currentId}
|
||||||
|
onCancel={() => {
|
||||||
|
setDefenseHandlingModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
getData={getData}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{defenseRecordModalOpen && (
|
||||||
|
<DefenseRecordModal
|
||||||
|
id={currentId}
|
||||||
|
onCancel={() => {
|
||||||
|
setDefenseRecordModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<Modal
|
||||||
|
title="申辩处理"
|
||||||
|
width={800}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
onOk={form.submit}
|
||||||
|
loading={uploadFileLoading || props.inspection.defenseLoading}
|
||||||
|
>
|
||||||
|
<FormBuilder
|
||||||
|
form={form}
|
||||||
|
span={24}
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
showActionButtons={false}
|
||||||
|
onFinish={onSubmit}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "status",
|
||||||
|
label: "申辩是否成立",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.RADIO,
|
||||||
|
items: [{ bianma: "1", name: "是" }, { bianma: "2", name: "否" }],
|
||||||
|
componentProps: {
|
||||||
|
onChange: () => {
|
||||||
|
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: (
|
||||||
|
<Signature
|
||||||
|
onConfirm={(value) => {
|
||||||
|
form.setFieldValue("signature", value.file);
|
||||||
|
form.setFieldValue("signatureTime", value.time);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ name: "signatureTime", label: "签字时间", onlyForLabel: true },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<Modal
|
||||||
|
title="申辩记录"
|
||||||
|
width={1200}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
||||||
|
]}
|
||||||
|
loading={downloadFileLoading || downloadGetFileLoading}
|
||||||
|
>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "申辩时间", dataIndex: "createTime", width: 200 },
|
||||||
|
{ title: "申辩描述", dataIndex: "content" },
|
||||||
|
{ title: "申辩状态", dataIndex: "isPass", render: (_, record) => (
|
||||||
|
<>
|
||||||
|
<div>{record.isPass === 0 && "未审批"}</div>
|
||||||
|
<div>{record.isPass === 1 && "通过"}</div>
|
||||||
|
<div>{record.isPass === 2 && "未通过"}</div>
|
||||||
|
</>
|
||||||
|
) },
|
||||||
|
{ title: "签字图片", dataIndex: "signature", render: (_, record) => (record.signature && <Image src={getFileUrl() + record.signature} width={100} height={100} />) },
|
||||||
|
{ title: "申辩附件名称", dataIndex: "name", width: 200 },
|
||||||
|
{ title: "申辩附件", dataIndex: "url", render: (_, record) => (
|
||||||
|
record.url && (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
downloadFile({ url: record.url, name: record.name });
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
下载
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
) },
|
||||||
|
{ title: "检查人签字", dataIndex: "checkSign", render: (_, record) => (record.checkSign && <Image src={getFileUrl() + record.checkSign} width={100} height={100} />) },
|
||||||
|
{ title: "检查人意见", dataIndex: "checkRemarks" },
|
||||||
|
{ title: "审批时间", dataIndex: "checkSignTime", width: 200 },
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
dataSource={list}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const DefenseHandlingModal = Connect([NS_INSPECTION], true)(DefenseHandlingModalComponent);
|
||||||
|
const DefenseRecordModal = Connect([NS_INSPECTION], true)(DefenseRecordModalComponent);
|
||||||
|
export default Connect([NS_INSPECTION], true)(List);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Defense(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Defense;
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import HiddenInfo from "zy-react-library/components/HiddenInfo/gwj";
|
||||||
|
|
||||||
|
function HiddenView() {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<HiddenInfo />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HiddenView;
|
||||||
|
|
@ -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 (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "inspectionSubject",
|
||||||
|
label: "检查题目",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
|
},
|
||||||
|
{ name: "inspectionDeptId", label: "检查部门", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "inspectionUserName", label: "检查人" },
|
||||||
|
{ name: "type", label: "检查类型", render: <DictionarySelectTree dictValue="inspectionType" onlyLastLevel /> },
|
||||||
|
{ name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
||||||
|
{ name: "inspectedDepartmentId", label: "被检查单位", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "inspectedUserName", label: "被检查单位现场负责人" },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "检查题目", dataIndex: "subject" },
|
||||||
|
{ 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: () => "待确认" },
|
||||||
|
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 150,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../viewInfo?id=${record.id}&inspectionId=${record.inspectionId}&isExport=0`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setConfirmModalOpen(true);
|
||||||
|
setCurrentId(record.inspectionId);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
确认
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
{confirmModalOpen && (
|
||||||
|
<ConfirmModal
|
||||||
|
id={currentId}
|
||||||
|
onCancel={() => {
|
||||||
|
setConfirmModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
getData={getData}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<Modal
|
||||||
|
title="检查确认"
|
||||||
|
width={800}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
onOk={form.submit}
|
||||||
|
loading={uploadFileLoading || props.inspection.inspectedLoading}
|
||||||
|
>
|
||||||
|
<FormBuilder
|
||||||
|
form={form}
|
||||||
|
span={24}
|
||||||
|
values={{
|
||||||
|
reviewStatus: "1",
|
||||||
|
}}
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
showActionButtons={false}
|
||||||
|
onFinish={onSubmit}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "reviewStatus",
|
||||||
|
label: "是否申辩",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.RADIO,
|
||||||
|
items: [{ bianma: "2", name: "是" }, { bianma: "1", name: "否" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "userRemarks",
|
||||||
|
label: "申辩内容",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.TEXTAREA,
|
||||||
|
dependencies: ["reviewStatus"],
|
||||||
|
hidden: formValues => !(formValues.reviewStatus === "2"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "files",
|
||||||
|
label: "附件",
|
||||||
|
required: false,
|
||||||
|
render: (<Upload fileType="document" maxCount={1} accept=".pdf" />),
|
||||||
|
dependencies: ["reviewStatus"],
|
||||||
|
hidden: formValues => !(formValues.reviewStatus === "2"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "signature",
|
||||||
|
label: "确认人",
|
||||||
|
required: false,
|
||||||
|
rules: [{ required: true, message: "请签名" }],
|
||||||
|
render: (
|
||||||
|
<Signature
|
||||||
|
onConfirm={(value) => {
|
||||||
|
form.setFieldValue("signature", value.file);
|
||||||
|
form.setFieldValue("signatureTime", value.time);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ name: "signatureTime", label: "签字时间", onlyForLabel: true },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const ConfirmModal = Connect([NS_INSPECTION], true)(ConfirmModalComponent);
|
||||||
|
export default Connect([NS_INSPECTION], true)(List);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Inspected(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Inspected;
|
||||||
|
|
@ -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 (
|
||||||
|
<Modal
|
||||||
|
title="添加发现隐患"
|
||||||
|
width={800}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
onOk={form.submit}
|
||||||
|
>
|
||||||
|
<FormBuilder
|
||||||
|
form={form}
|
||||||
|
span={24}
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
showActionButtons={false}
|
||||||
|
onFinish={onSubmit}
|
||||||
|
options={[
|
||||||
|
{ name: "hiddenDesc", label: "隐患描述", render: FORM_ITEM_RENDER_ENUM.TEXTAREA, span: 24 },
|
||||||
|
{
|
||||||
|
name: "hiddenPart",
|
||||||
|
customizeRender: true,
|
||||||
|
render: (
|
||||||
|
<Form.Item label="隐患部位" required labelCol={{ span: 4 }} wrapperCol={{ span: 20 }}>
|
||||||
|
<div style={{ display: "flex", gap: 10 }}>
|
||||||
|
<Form.Item name="hiddenPart" noStyle rules={[{ required: true, message: "请选择隐患部位" }]}>
|
||||||
|
{
|
||||||
|
hiddenPartType === "select"
|
||||||
|
? <HiddenPartSelectTree />
|
||||||
|
: <Input placeholder="请输入隐患部位" />
|
||||||
|
}
|
||||||
|
</Form.Item>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
if (hiddenPartType === "select")
|
||||||
|
setHiddenPartType("input");
|
||||||
|
if (hiddenPartType === "input")
|
||||||
|
setHiddenPartType("select");
|
||||||
|
form.setFieldValue("hiddenPart", "");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{hiddenPartType === "select" ? "输入" : "选择"}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "hiddenLevel",
|
||||||
|
label: "隐患级别",
|
||||||
|
render: (
|
||||||
|
<HiddenLevelSelectTree
|
||||||
|
isShowNeglect={false}
|
||||||
|
isShowLarger={false}
|
||||||
|
isShowMajor={false}
|
||||||
|
onGetLabel={label => form.setFieldValue("hiddenLevelName", label)}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ name: "hiddenLevelName", label: "隐患级别名称", onlyForLabel: true },
|
||||||
|
{
|
||||||
|
name: "hiddenType",
|
||||||
|
label: "隐患类型",
|
||||||
|
render: (
|
||||||
|
<DictionarySelectTree
|
||||||
|
onlyLastLevel
|
||||||
|
dictValue="hiddenType"
|
||||||
|
onGetLabel={label => 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: <Map required={false} />, span: 24 },
|
||||||
|
{ name: "positionDesc", label: "隐患位置描述", required: false, span: 24 },
|
||||||
|
{
|
||||||
|
name: "hiddenImageFiles",
|
||||||
|
label: "隐患图片",
|
||||||
|
render: (<Upload />),
|
||||||
|
span: 24,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "hiddenVideoFiles",
|
||||||
|
label: "隐患视频",
|
||||||
|
render: (<Upload fileType="video" />),
|
||||||
|
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 },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HiddenAddModal;
|
||||||
|
|
@ -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 (
|
||||||
|
<div>
|
||||||
|
<HeaderBack title={query.id ? "编辑" : "新增"} />
|
||||||
|
<div style={{ paddingBottom: 10 }}>
|
||||||
|
<FormBuilder
|
||||||
|
form={form}
|
||||||
|
values={{
|
||||||
|
situationList: [{ content: undefined }],
|
||||||
|
}}
|
||||||
|
loading={deleteFileLoading || getFileLoading || uploadFileLoading || props.inspection.inspectionLoading}
|
||||||
|
onFinish={values => onSubmit(values, 0)}
|
||||||
|
extraActionButtons={[
|
||||||
|
<Button
|
||||||
|
key="temporaryStorage"
|
||||||
|
onClick={() => {
|
||||||
|
onSubmit(form.getFieldsValue(), 1);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
暂存
|
||||||
|
</Button>,
|
||||||
|
]}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "subject",
|
||||||
|
label: "检查题目",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.RADIO,
|
||||||
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
|
span: 24,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: ["personUnderInspection", "departmentId"],
|
||||||
|
label: "被检查单位",
|
||||||
|
render: (
|
||||||
|
<DepartmentSelectTree
|
||||||
|
searchType={props.searchType}
|
||||||
|
onGetLabel={label => 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: (
|
||||||
|
<PersonnelSelect
|
||||||
|
params={{ departmentId: personUnderInspectionDepartmentId }}
|
||||||
|
onGetLabel={label => form.setFieldValue(["personUnderInspection", "userName"], label)}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ name: ["personUnderInspection", "userName"], label: "被检查单位现场负责人名称", onlyForLabel: true },
|
||||||
|
{ name: "place", label: "检查场所", span: 24 },
|
||||||
|
{
|
||||||
|
name: "type",
|
||||||
|
label: "检查类型",
|
||||||
|
span: 8,
|
||||||
|
render: (
|
||||||
|
<DictionarySelectTree
|
||||||
|
dictValue="inspectionType"
|
||||||
|
onlyLastLevel
|
||||||
|
onGetLabel={label => 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: (
|
||||||
|
<>
|
||||||
|
<Form.List name="inspectorList">
|
||||||
|
{(fields, { add, remove }) => (
|
||||||
|
<>
|
||||||
|
{fields.map((field, index) => (
|
||||||
|
<Row gutter={24} key={field.key}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Form.Item
|
||||||
|
label="检查人员部门"
|
||||||
|
rules={[{ required: true, message: "请选择检查人员部门" }]}
|
||||||
|
name={[field.name, "departmentId"]}
|
||||||
|
>
|
||||||
|
<DepartmentSelectTree
|
||||||
|
onChange={() => {
|
||||||
|
form.setFieldValue(["inspectorList", field.name, "userId"], "");
|
||||||
|
form.setFieldValue(["inspectorList", field.name, "userName"], "");
|
||||||
|
}}
|
||||||
|
onGetLabel={(label) => {
|
||||||
|
form.setFieldValue(["inspectorList", field.name, "departmentName"], label);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="检查人员部门名称" noStyle name={[field.name, "departmentName"]}>
|
||||||
|
<input type="hidden" />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Form.Item label="检查人员" required>
|
||||||
|
<div style={{ display: "flex", gap: 10 }}>
|
||||||
|
<Form.Item
|
||||||
|
noStyle
|
||||||
|
rules={[{ required: true, message: "请选择检查人员" }]}
|
||||||
|
name={[field.name, "userId"]}
|
||||||
|
>
|
||||||
|
<PersonnelSelect
|
||||||
|
params={{ departmentId: inspectorList?.[field.name]?.departmentId || "" }}
|
||||||
|
onGetLabel={label => form.setFieldValue(["inspectorList", field.name, "userName"], label)}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
{
|
||||||
|
index >= 1
|
||||||
|
? <Button type="primary" danger onClick={() => remove(field.name)}>删除</Button>
|
||||||
|
: <Button type="primary" onClick={() => add()}>添加检查人员</Button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label="检查人员名称" noStyle name={[field.name, "userName"]}>
|
||||||
|
<input type="hidden" />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Form.List>
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ label: "检查情况", render: FORM_ITEM_RENDER_ENUM.DIVIDER },
|
||||||
|
{
|
||||||
|
key: "situationList",
|
||||||
|
customizeRender: true,
|
||||||
|
span: 24,
|
||||||
|
render: (
|
||||||
|
<>
|
||||||
|
<Form.List name="situationList">
|
||||||
|
{(fields, { add, remove }) => (
|
||||||
|
<>
|
||||||
|
{fields.map((field, index) => (
|
||||||
|
<Row gutter={24} key={field.key}>
|
||||||
|
<Col span={12}>
|
||||||
|
<Form.Item
|
||||||
|
label="检查情况"
|
||||||
|
rules={[{ required: true, message: "请输入检查情况" }]}
|
||||||
|
name={[field.name, "content"]}
|
||||||
|
>
|
||||||
|
<Input.TextArea placeholder="请输入检查情况" rows={3} />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
<Col span={12}>
|
||||||
|
<Form.Item label="图片">
|
||||||
|
<div style={{ display: "flex", gap: 10 }}>
|
||||||
|
<div style={{ flex: 1 }}>
|
||||||
|
<Form.Item noStyle name={[field.name, "files"]}>
|
||||||
|
<Upload
|
||||||
|
maxCount={1}
|
||||||
|
onGetRemoveFile={(file) => {
|
||||||
|
form.setFieldValue(
|
||||||
|
["situationList", field.name, "deleteFiles"],
|
||||||
|
[...(form.getFieldValue(["situationList", field.name, "deleteFiles"]) || []), file],
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Form.Item>
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
index >= 1
|
||||||
|
? <Button type="primary" danger onClick={() => remove(field.name)}>删除</Button>
|
||||||
|
: <Button type="primary" onClick={() => add()}>添加检查情况</Button>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item name={[field.name, "deleteFiles"]} label="删除的图片" noStyle preserve={false}>
|
||||||
|
<input type="hidden" />
|
||||||
|
</Form.Item>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
))}
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</Form.List>
|
||||||
|
</>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ label: "发现问题", render: FORM_ITEM_RENDER_ENUM.DIVIDER },
|
||||||
|
{
|
||||||
|
key: "hiddenList",
|
||||||
|
customizeRender: true,
|
||||||
|
span: 24,
|
||||||
|
render: (
|
||||||
|
<Table
|
||||||
|
style={{ marginBottom: 20 }}
|
||||||
|
pagination={false}
|
||||||
|
options={false}
|
||||||
|
disabledResizer={true}
|
||||||
|
toolBarRender={() => (
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
onClick={() => {
|
||||||
|
setHiddenAddModalOpen(true);
|
||||||
|
const inspectorList = form.getFieldValue("inspectorList");
|
||||||
|
const newHiddenDiscovererUserList = cloneDeep(inspectorList).filter(item => item && item.userId && item.departmentId);
|
||||||
|
if (!newHiddenDiscovererUserList.some(item => userInfo.id === item.userId)) {
|
||||||
|
newHiddenDiscovererUserList.unshift({
|
||||||
|
departmentId: userInfo.departmentId,
|
||||||
|
departmentName: userInfo.departmentName,
|
||||||
|
userId: userInfo.id,
|
||||||
|
userName: userInfo.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
setHiddenDiscovererUserList(newHiddenDiscovererUserList);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
添加隐患
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
dataSource={hiddenList}
|
||||||
|
columns={[
|
||||||
|
{ title: "问题描述", dataIndex: "hiddenDesc" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
width: 100,
|
||||||
|
render: (_, record, index) => (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
danger
|
||||||
|
onClick={() => {
|
||||||
|
Modal.confirm({
|
||||||
|
title: "提示",
|
||||||
|
content: "确定删除该隐患吗?",
|
||||||
|
onOk: async () => {
|
||||||
|
if (record.hiddenId) {
|
||||||
|
deleteHiddenIds.current.push(record.hiddenId);
|
||||||
|
}
|
||||||
|
setHiddenList(hiddenList.filter((_, i) => i !== index));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ 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: (
|
||||||
|
<Signature
|
||||||
|
url={signatureFilePath}
|
||||||
|
onConfirm={(value) => {
|
||||||
|
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 },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{
|
||||||
|
hiddenAddModalOpen && (
|
||||||
|
<HiddenAddModal
|
||||||
|
hiddenDiscovererUserList={hiddenDiscovererUserList}
|
||||||
|
onCancel={() => setHiddenAddModalOpen(false)}
|
||||||
|
onConfirm={values => setHiddenList([...hiddenList, values])}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(Add);
|
||||||
|
|
@ -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 (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "inspectionSubject",
|
||||||
|
label: "检查题目",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
|
},
|
||||||
|
{ name: "inspectionOriginatorUserName", label: "检查发起人" },
|
||||||
|
{ name: "inspectionDeptId", label: "检查部门", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "inspectionUserName", label: "检查人员" },
|
||||||
|
{ name: "type", label: "检查类型", render: <DictionarySelectTree dictValue="inspectionType" onlyLastLevel /> },
|
||||||
|
{ name: "inspectedDepartmentId", label: "被检查单位", render: <DepartmentSelectTree searchType={props.searchType} /> },
|
||||||
|
{ 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}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
headerTitle={(
|
||||||
|
<Spin spinning={props.inspection.inspectionCountLoading}>
|
||||||
|
<Space
|
||||||
|
size={10}
|
||||||
|
style={{
|
||||||
|
padding: "8px 20px",
|
||||||
|
border: "1px solid #abdcff",
|
||||||
|
backgroundColor: "#f0faff",
|
||||||
|
borderRadius: "4px",
|
||||||
|
color: "#515a6e",
|
||||||
|
fontSize: "14px",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<div>
|
||||||
|
安全检查总数:
|
||||||
|
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.safetyCount}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
环保检查总数:
|
||||||
|
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.environmentalCount}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
综合检查总数:
|
||||||
|
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.comprehensiveCount}</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
涉及隐患总数:
|
||||||
|
<span style={{ color: "#2d8cf0", fontWeight: 700 }}>{count.hiddenCount}</span>
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</Spin>
|
||||||
|
)}
|
||||||
|
toolBarRender={() => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
icon={<AddIcon />}
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push("./add");
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
icon={<ExportIcon />}
|
||||||
|
onClick={() => {
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
导出
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
)}
|
||||||
|
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) => (
|
||||||
|
<Space>
|
||||||
|
{(record.status === -1 || record.status === 600) && (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`./add?id=${record.id}&inspectionId=${record.inspectionId}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
{
|
||||||
|
record.status !== -1 && (
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setFlowModalOpen(true);
|
||||||
|
setCurrentId(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
流程图
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../viewInfo?id=${record.id}&inspectionId=${record.inspectionId}`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
danger
|
||||||
|
onClick={() => onDelete(record.id)}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
{
|
||||||
|
flowModalOpen && (
|
||||||
|
<FlowModal
|
||||||
|
id={currentId}
|
||||||
|
onCancel={() => {
|
||||||
|
setFlowModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<Modal
|
||||||
|
title="查看流程图"
|
||||||
|
width={1000}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<ReactFlowProvider>
|
||||||
|
<div style={{ width: "100%", height: 500 }}>
|
||||||
|
<style>
|
||||||
|
{`
|
||||||
|
.react-flow__attribution {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
|
<ReactFlow
|
||||||
|
nodes={nodes}
|
||||||
|
edges={edges}
|
||||||
|
fitView
|
||||||
|
preventScrolling={false}
|
||||||
|
connectionMode="loose"
|
||||||
|
zoomOnScroll={true}
|
||||||
|
zoomOnPinch={true}
|
||||||
|
panOnScroll={true}
|
||||||
|
panOnScrollSpeed={0.5}
|
||||||
|
connectionLineOptions={{
|
||||||
|
type: "straight",
|
||||||
|
style: { stroke: "transparent", strokeWidth: 0 },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
</ReactFlow>
|
||||||
|
</div>
|
||||||
|
</ReactFlowProvider>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const FlowModal = Connect([NS_INSPECTION], true)(FlowModalComponent);
|
||||||
|
export default Connect([NS_INSPECTION], true)(List);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Inspection(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Inspection;
|
||||||
|
|
@ -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 (
|
||||||
|
<div style={{ padding: 20 }}>
|
||||||
|
<Search
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "inspectionSubject",
|
||||||
|
label: "检查题目",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.SELECT,
|
||||||
|
items: INSPECTION_QUESTION_ENUM,
|
||||||
|
},
|
||||||
|
{ name: "inspectionDeptId", label: "检查部门", render: <DepartmentSelectTree /> },
|
||||||
|
{ name: "inspectionUserName", label: "检查人" },
|
||||||
|
{ name: "type", label: "检查类型", render: <DictionarySelectTree dictValue="inspectionType" onlyLastLevel /> },
|
||||||
|
{ name: "checkTime", label: "检查时间", render: FORM_ITEM_RENDER_ENUM.DATE_RANGE },
|
||||||
|
{ name: "inspectedDepartmentId", label: "被检查单位", render: <DepartmentSelectTree searchType={props.searchType} /> },
|
||||||
|
{ name: "inspectedUserName", label: "被检查单位现场负责人" },
|
||||||
|
]}
|
||||||
|
form={form}
|
||||||
|
onFinish={getData}
|
||||||
|
/>
|
||||||
|
<Table
|
||||||
|
columns={[
|
||||||
|
{ title: "检查题目", dataIndex: "subject" },
|
||||||
|
{ 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: () => "待核实" },
|
||||||
|
{ title: "发现隐患数", dataIndex: "hiddenNumber" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
fixed: "right",
|
||||||
|
width: 150,
|
||||||
|
render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
props.history.push(`../viewInfo?id=${record.id}&inspectionId=${record.inspectionId}&isExport=0`);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setVerifyModalOpen(true);
|
||||||
|
setCurrentId(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
核实
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
{...tableProps}
|
||||||
|
/>
|
||||||
|
{verifyModalOpen && (
|
||||||
|
<VerifyModal
|
||||||
|
id={currentId}
|
||||||
|
onCancel={() => {
|
||||||
|
setVerifyModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
getData={getData}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<Modal
|
||||||
|
title="检查核实"
|
||||||
|
width={1000}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
onOk={form.submit}
|
||||||
|
loading={uploadFileLoading || props.inspection.inspectorLoading}
|
||||||
|
>
|
||||||
|
<FormBuilder
|
||||||
|
form={form}
|
||||||
|
span={24}
|
||||||
|
values={{
|
||||||
|
status: "1",
|
||||||
|
}}
|
||||||
|
labelCol={{ span: 8 }}
|
||||||
|
showActionButtons={false}
|
||||||
|
onFinish={onSubmit}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
name: "status",
|
||||||
|
label: "检查人核实",
|
||||||
|
render: FORM_ITEM_RENDER_ENUM.RADIO,
|
||||||
|
items: [{ bianma: "1", name: "通过" }, { bianma: "2", name: "不通过" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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: "请签名" }],
|
||||||
|
render: (
|
||||||
|
<Signature
|
||||||
|
onConfirm={(value) => {
|
||||||
|
form.setFieldValue("signature", value.file);
|
||||||
|
form.setFieldValue("signatureTime", value.time);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{ name: "signatureTime", label: "签字时间", onlyForLabel: true },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const VerifyModal = Connect([NS_INSPECTION], true)(VerifyModalComponent);
|
||||||
|
export default Connect([NS_INSPECTION], true)(List);
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Inspector(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Inspector;
|
||||||
|
|
@ -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 (
|
||||||
|
<div>
|
||||||
|
<HeaderBack title="查看" />
|
||||||
|
<Spin spinning={props.inspection.inspectionLoading || getFileLoading}>
|
||||||
|
<div style={{ padding: 20, paddingBottom: 0 }} ref={contentRef}>
|
||||||
|
<Divider orientation="left">
|
||||||
|
{info.subject}
|
||||||
|
现场安全检查记录
|
||||||
|
</Divider>
|
||||||
|
<Descriptions
|
||||||
|
column={2}
|
||||||
|
bordered
|
||||||
|
labelStyle={{ width: 200 }}
|
||||||
|
items={[
|
||||||
|
{ label: "被检查单位", children: info.inspectedPartyConfirmation.departmentName },
|
||||||
|
{ label: "被检查单位现场负责人", children: info.inspectedPartyConfirmation.userName },
|
||||||
|
{ label: "检查场所", children: info.place, span: 2 },
|
||||||
|
{ label: "牵头检查部门", children: info.currentInspectorUser.departmentName },
|
||||||
|
{ label: "检查人员", children: info.currentInspectorUser.userName },
|
||||||
|
{ label: "检查类型", children: info.typeName },
|
||||||
|
{ label: "检查时间", children: `${info.timeStart}至${info.timeEnd}` },
|
||||||
|
{ label: "记录填写时间", children: info.createTime, span: 2 },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<Divider orientation="left">检查情况</Divider>
|
||||||
|
<Descriptions
|
||||||
|
column={2}
|
||||||
|
bordered
|
||||||
|
labelStyle={{ width: 200 }}
|
||||||
|
items={
|
||||||
|
info.content.map(item =>
|
||||||
|
[
|
||||||
|
{ label: "检查情况", children: item.content },
|
||||||
|
{ label: "图片", children: (<PreviewImg files={item.files} />) },
|
||||||
|
],
|
||||||
|
).flat()
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Divider orientation="left">发现问题</Divider>
|
||||||
|
<Table
|
||||||
|
className="print-no-use"
|
||||||
|
dataSource={hiddenList || []}
|
||||||
|
disabledResizer={true}
|
||||||
|
pagination={false}
|
||||||
|
options={false}
|
||||||
|
columns={[
|
||||||
|
{ title: "隐患描述", dataIndex: "hiddenDesc" },
|
||||||
|
{ title: "隐患部位", dataIndex: "hiddenPartName" },
|
||||||
|
{ title: "操作", render: (_, record) => (
|
||||||
|
<Space>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setHiddenViewModalOpen(true);
|
||||||
|
setHiddenId(record.id);
|
||||||
|
setHiddenUUId(record.hiddenId);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
查看
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="link"
|
||||||
|
onClick={() => {
|
||||||
|
setFlowModalOpen(true);
|
||||||
|
setCurrentId(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
流程图
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
) },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<table className="print-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>序号</th>
|
||||||
|
<th>隐患描述</th>
|
||||||
|
<th>隐患部位</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{
|
||||||
|
(hiddenList || []).map((item, index) => (
|
||||||
|
<tr key={item.id}>
|
||||||
|
<td>{index + 1}</td>
|
||||||
|
<td>{item.hiddenDesc}</td>
|
||||||
|
<td>{item.hiddenPartName}</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<Divider orientation="left">检查人员审核情况</Divider>
|
||||||
|
<Table
|
||||||
|
className="print-no-use"
|
||||||
|
dataSource={info.inspectorVerificationList}
|
||||||
|
disabledResizer={true}
|
||||||
|
pagination={false}
|
||||||
|
options={false}
|
||||||
|
columns={[
|
||||||
|
{ title: "审核人员", dataIndex: "userName" },
|
||||||
|
{ title: "审核意见", dataIndex: "userRemarks" },
|
||||||
|
{ title: "签字", render: (_, record) => (record.signature && <PreviewImg files={[record.signature]} />) },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
<table className="print-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>序号</th>
|
||||||
|
<th>审核人员</th>
|
||||||
|
<th>审核意见</th>
|
||||||
|
<th>签字</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{
|
||||||
|
info.inspectorVerificationList.map((item, index) => (
|
||||||
|
<tr key={item.id}>
|
||||||
|
<td>{index + 1}</td>
|
||||||
|
<td>{item.userName}</td>
|
||||||
|
<td>{item.userRemarks}</td>
|
||||||
|
<td>{item.signature && <img src={getFileUrl() + item.signature} alt="" width={100} height={100} />}</td>
|
||||||
|
</tr>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<Divider orientation="left">被检查单位现场负责人确认情况</Divider>
|
||||||
|
<Descriptions
|
||||||
|
column={1}
|
||||||
|
bordered
|
||||||
|
labelStyle={{ width: 200 }}
|
||||||
|
items={[
|
||||||
|
{ label: "被检查单位现场负责人(签字)", children: (<PreviewImg files={[]} />) },
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={{ marginTop: 20, paddingBottom: 20, textAlign: "center" }}>
|
||||||
|
<Space>
|
||||||
|
<Button type="primary" onClick={handlePrint}>打印</Button>
|
||||||
|
{query.isExport !== "0" && <Button type="primary">导出</Button>}
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
</Spin>
|
||||||
|
{hiddenViewModalOpen && (
|
||||||
|
<HiddenViewModal
|
||||||
|
id={hiddenId}
|
||||||
|
hiddenId={hiddenUUId}
|
||||||
|
onCancel={() => {
|
||||||
|
setHiddenViewModalOpen(false);
|
||||||
|
setHiddenId("");
|
||||||
|
setHiddenUUId("");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
{flowModalOpen && (
|
||||||
|
<FlowModal
|
||||||
|
id={currentId}
|
||||||
|
onCancel={() => {
|
||||||
|
setFlowModalOpen(false);
|
||||||
|
setCurrentId("");
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
function HiddenViewModal(props) {
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title="查看隐患"
|
||||||
|
width={1000}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<HiddenInfo id={props.id} hiddenId={props.hiddenId} />
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 (
|
||||||
|
<Modal
|
||||||
|
title="查看流程图"
|
||||||
|
width={1000}
|
||||||
|
open
|
||||||
|
maskClosable={false}
|
||||||
|
onCancel={props.onCancel}
|
||||||
|
footer={[
|
||||||
|
<Button key="cancel" onClick={props.onCancel}>取消</Button>,
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<ReactFlowProvider>
|
||||||
|
<div style={{ width: "100%", height: 500 }}>
|
||||||
|
<style>
|
||||||
|
{`
|
||||||
|
.react-flow__attribution {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
</style>
|
||||||
|
<ReactFlow
|
||||||
|
nodes={nodes}
|
||||||
|
edges={edges}
|
||||||
|
fitView
|
||||||
|
preventScrolling={false}
|
||||||
|
connectionMode="loose"
|
||||||
|
zoomOnScroll={true}
|
||||||
|
zoomOnPinch={true}
|
||||||
|
panOnScroll={true}
|
||||||
|
panOnScrollSpeed={0.5}
|
||||||
|
connectionLineOptions={{
|
||||||
|
type: "straight",
|
||||||
|
style: { stroke: "transparent", strokeWidth: 0 },
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
</ReactFlow>
|
||||||
|
</div>
|
||||||
|
</ReactFlowProvider>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const FlowModal = Connect([NS_INSPECTION], true)(FlowModalComponent);
|
||||||
|
|
||||||
|
export default Connect([NS_INSPECTION], true)(View);
|
||||||
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function BranchCompany(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default BranchCompany;
|
||||||
|
|
@ -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) && (
|
||||||
|
<Component
|
||||||
|
detail={{ componentKey: process.env.app.appKey }}
|
||||||
|
appKey={process.env.app.appKey}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import AcceptanceAcceptance from "../../../BranchCompany/Acceptance/Acceptance";
|
||||||
|
|
||||||
|
function Acceptance(props) {
|
||||||
|
return <AcceptanceAcceptance {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Acceptance;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import AcceptanceHiddenList from "../../../BranchCompany/Acceptance/HiddenList";
|
||||||
|
|
||||||
|
function HiddenList(props) {
|
||||||
|
return <AcceptanceHiddenList {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default HiddenList;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import AcceptanceList from "../../../BranchCompany/Acceptance/List";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
return <AcceptanceList searchType="all" {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default List;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Acceptance(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Acceptance;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import DefenseList from "../../../BranchCompany/Defense/List";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
return <DefenseList searchType="all" {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default List;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Defense(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Defense;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import InspectionAdd from "../../../BranchCompany/Inspection/Add";
|
||||||
|
|
||||||
|
function Add(props) {
|
||||||
|
return <InspectionAdd searchType="all" source="4" {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Add;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import InspectionList from "../../../BranchCompany/Inspection/List";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
return <InspectionList searchType="all" {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default List;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Inspection(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Inspection;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import InspectorList from "../../../BranchCompany/Inspector/List";
|
||||||
|
|
||||||
|
function List(props) {
|
||||||
|
return <InspectorList searchType="all" {...props} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default List;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Inspector(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Inspector;
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
import ViewInfoA from "../../BranchCompany/ViewInfo";
|
||||||
|
|
||||||
|
function ViewInfo() {
|
||||||
|
return <ViewInfoA />;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ViewInfo;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
function Supervision(props) {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
{props.children}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Supervision;
|
||||||
|
|
@ -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 (
|
||||||
|
<ConfigProvider
|
||||||
|
theme={{
|
||||||
|
token: this.token,
|
||||||
|
algorithm: this.algorithm,
|
||||||
|
}}
|
||||||
|
locale={language}
|
||||||
|
prefixCls={window.process.env.app.antd["ant-prefix"]}
|
||||||
|
>
|
||||||
|
<App style={{ height: "100%" }}>
|
||||||
|
<AppMiddle {...this.props} />
|
||||||
|
</App>
|
||||||
|
</ConfigProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function AppMiddle(props) {
|
||||||
|
return (
|
||||||
|
<InjectContext.Provider value={App.useApp()}>
|
||||||
|
{process.env.NODE_ENV === "development"
|
||||||
|
? props.children
|
||||||
|
: (
|
||||||
|
<Interceptor>
|
||||||
|
{props.children}
|
||||||
|
</Interceptor>
|
||||||
|
)}
|
||||||
|
</InjectContext.Provider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
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")
|
||||||
|
? (
|
||||||
|
<Component appKey={process.env.app.appKey}>
|
||||||
|
{this.props.children}
|
||||||
|
</Component>
|
||||||
|
)
|
||||||
|
: this.props.children;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
export default function () {
|
||||||
|
return (
|
||||||
|
<h1>
|
||||||
|
底座微应用模板,技术文档:
|
||||||
|
<a rel="noreferrer noopener" target="_blank" href="https://www.yuque.com/buhangjiecheshen-ymbtb/qc0093/gxdun1dphetcurko">https://www.yuque.com/buhangjiecheshen-ymbtb/qc0093/gxdun1dphetcurko</a>
|
||||||
|
</h1>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -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 (
|
||||||
|
<div style={{ padding: "10px", textAlign: "center" }}>
|
||||||
|
<div style={{ fontSize: "16px" }}>{flowItem.flowList[0]}</div>
|
||||||
|
{flowItem.flowList.slice(1).map((item, index) => (
|
||||||
|
<div key={index} style={{ fontSize: "16px", marginTop: "5px" }}>{item}</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
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 };
|
||||||
|
};
|
||||||
|
|
@ -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/"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue