Browse Source

表单流程弹框

dev
巴林闲侠 2 years ago
parent
commit
d1d6d7c696
  1. 2
      api/app/lib/controllers/workOrder/index.js
  2. 5
      web/client/index.ejs
  3. 4
      web/client/index.html
  4. 14
      web/client/src/components/workflow/index.jsx
  5. 0
      web/client/src/components/workflow/view.jsx
  6. 2
      web/client/src/layout/actions/global.js
  7. 26
      web/client/src/sections/workOrder/containers/jobOrder.jsx
  8. 3
      web/client/src/utils/index.js
  9. 10
      web/client/src/utils/webapi.js
  10. 16
      web/config.js
  11. 4
      web/package.json
  12. 5
      web/routes/attachment/index.js

2
api/app/lib/controllers/workOrder/index.js

@ -17,7 +17,7 @@ async function getEnabledWorkflowProcess (ctx) {
workflow_process workflow_process
RIGHT JOIN workflow_group RIGHT JOIN workflow_group
ON workflow_process.group_id = workflow_group.id ON workflow_process.group_id = workflow_group.id
AND workflow_group.name = '销售' AND workflow_group.name = '竞聘考核'
WHERE WHERE
workflow_process.deleted = 0 workflow_process.deleted = 0
AND workflow_process.is_enable = 1 AND workflow_process.is_enable = 1

5
web/client/index.ejs

@ -6,12 +6,13 @@
<meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" /> <meta name="viewport" content="minimum-scale=1, initial-scale=1, width=device-width" />
<!-- <meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy"> --> <!-- <meta content="upgrade-insecure-requests" http-equiv="Content-Security-Policy"> -->
<link rel="shortcut icon" href="/assets/images/favicon.ico"> <link rel="shortcut icon" href="/assets/images/favicon.ico">
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script> <script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
<script>LA.init({ id: "Jo4eTlZVqgx3uwqm", ck: "Jo4eTlZVqgx3uwqm" })</script> <script>LA.init({ id: "Jo4eTlZVqgx3uwqm", ck: "Jo4eTlZVqgx3uwqm" })</script>
<script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_19077_11.559b91c217b8ddc76c0c4b1397d84d48.es5.js"></script> <script src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_19077_11.559b91c217b8ddc76c0c4b1397d84d48.es5.js"
async></script>
</head> </head>
<body> <body>

4
web/client/index.html

@ -10,8 +10,8 @@
<script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script> <script charset="UTF-8" id="LA_COLLECT" src="//sdk.51.la/js-sdk-pro.min.js"></script>
<script>LA.init({ id: "Jo4eTlZVqgx3uwqm", ck: "Jo4eTlZVqgx3uwqm" })</script> <script>LA.init({ id: "Jo4eTlZVqgx3uwqm", ck: "Jo4eTlZVqgx3uwqm" })</script>
<!-- <script <script
src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_19077_11.559b91c217b8ddc76c0c4b1397d84d48.es5.js"></script> --> src="https://lf1-cdn-tos.bytegoofy.com/obj/iconpark/icons_19077_11.559b91c217b8ddc76c0c4b1397d84d48.es5.js" async></script>
</head> </head>
<body> <body>

14
web/client/src/components/workflow/index.js → web/client/src/components/workflow/index.jsx

@ -14,7 +14,7 @@ import './index.less'
const { confirm } = Modal; const { confirm } = Modal;
const WorkFlowModal = (props) => { const WorkFlowModal = (props) => {
const { successCallBack = () => { }, title, visible, clientHeight, postData, processId, user, dispatch } = props; const { successCallBack = () => { }, title, visible, clientHeight, postData, processId, user, dispatch, webEmis } = props;
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [ifShowMessage, setIfShowMessage] = useState(true); const [ifShowMessage, setIfShowMessage] = useState(true);
const [webUrl, setWebUrl] = useState(null); const [webUrl, setWebUrl] = useState(null);
@ -65,14 +65,14 @@ const WorkFlowModal = (props) => {
const handelDeny = () => { const handelDeny = () => {
// dispatch(delDraft(draftId)).then(res => { // dispatch(delDraft(draftId)).then(res => {
// if (res.success) { // if (res.success) {
// Notification.success('稿'); // Notification.success({title:'稿'});
// const { onCancel } = props; // const { onCancel } = props;
// onCancel && onCancel(); // onCancel && onCancel();
// setLoading(false); // setLoading(false);
// setCustomVisible(false); // setCustomVisible(false);
// setDraftId(null); // setDraftId(null);
// } else { // } else {
// Notification.error('稿'); // Notification.error({title:'稿'});
// } // }
// }) // })
} }
@ -87,19 +87,19 @@ const WorkFlowModal = (props) => {
let data = JSON.parse(event.data); let data = JSON.parse(event.data);
const { type, isSaveDraft, setIntervalSave, draftId, msg } = data; const { type, isSaveDraft, setIntervalSave, draftId, msg } = data;
if (msg) { if (msg) {
Notification.success(msg) Notification.success({ title: msg })
} }
setDraftId(draftId); setDraftId(draftId);
if (type == 'saveSuccess' && successCallBack) { if (type == 'saveSuccess' && successCallBack) {
if (ifShowMessage) { if (ifShowMessage) {
if (isSaveDraft) { if (isSaveDraft) {
if (setIntervalSave) { if (setIntervalSave) {
Notification.success('60秒,表单暂存草稿成功'); Notification.success({ title: '60秒,表单暂存草稿成功' });
} else { } else {
Notification.success(<span>保存草稿成功可在<a onClick={() => handelApprovalCenter("save")}>审批中心/保存待发</a>查看详情</span>, 10); Notification.success(<span>保存草稿成功可在<a onClick={() => handelApprovalCenter("save")}>审批中心/保存待发</a>查看详情</span>, 10);
} }
} else { } else {
Notification.success('提交成功,可在【审批中心/由我发起】查看详情'); Notification.success({ title: '提交成功,可在【审批中心/由我发起】查看详情' });
successCallBack(); successCallBack();
} }
// //
@ -189,9 +189,11 @@ const WorkFlowModal = (props) => {
function mapStateToProps (state) { function mapStateToProps (state) {
const { auth, global } = state; const { auth, global } = state;
console.log(global);
return { return {
user: auth.user, user: auth.user,
clientHeight: global.clientHeight, clientHeight: global.clientHeight,
webEmis: global.webEmis
} }
} }

0
web/client/src/components/workflow/view.js → web/client/src/components/workflow/view.jsx

2
web/client/src/layout/actions/global.js

@ -48,6 +48,7 @@ export function initApiRoot () {
pomsNotebook: res.pomsNotebook, pomsNotebook: res.pomsNotebook,
dcWeb: res.dcWeb, dcWeb: res.dcWeb,
qiniu: res.qiniu, qiniu: res.qiniu,
webEmis: res.webEmis,
} }
}) })
}); });
@ -60,7 +61,6 @@ export function pepProject (pepProjectId) {
type: PEPPROJECTID, type: PEPPROJECTID,
payload: { payload: {
pepProjectId: pepProjectId, pepProjectId: pepProjectId,
} }
} }
} }

26
web/client/src/sections/workOrder/containers/jobOrder.jsx

@ -2,7 +2,8 @@ import React, { useEffect, useState } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import moment from 'moment'; import moment from 'moment';
import { WorkflowModal } from "$components" import { WorkflowModal } from "$components"
import { Card, Typography, Space, Button } from '@douyinfe/semi-ui'; import { EmisRequest, EmisApiTable } from "$utils"
import { Card, Notification, Space, Button } from '@douyinfe/semi-ui';
import { IconArticle } from '@douyinfe/semi-icons'; import { IconArticle } from '@douyinfe/semi-icons';
import '../style.less' import '../style.less'
@ -34,8 +35,27 @@ const JobOrder = (props) => {
`创建时间:${moment(p.createTime || p.updateTime).format('YYYY-MM-DD HH:mm:ss')}` `创建时间:${moment(p.createTime || p.updateTime).format('YYYY-MM-DD HH:mm:ss')}`
} }
onClick={() => { onClick={() => {
setLaunchProcessId(p.id) EmisRequest.get(EmisApiTable.getProcessByName, {
setWorkflowModalVisible(true) name: decodeURIComponent(p.name),
resource: p.id
}).then(res => {
console.log(res);
if (res) {
// if (res.deleted) {
// Notification.error({ title: '退' })
// } else if (res.isEdited) {
// Notification.error({ title: '退' })
// } else if (!res.isEnable) {
// Notification.error({ title: '退' })
// } else
if (res.id) {
setLaunchProcessId(res.id)
setWorkflowModalVisible(true)
}
} else {
Notification.error({ title: `获取指定流程失败` });
}
})
}} }}
> >
<div> <div>

3
web/client/src/utils/index.js

@ -2,7 +2,7 @@
import { isAuthorized } from './func'; import { isAuthorized } from './func';
import { AuthorizationCode } from './authCode'; import { AuthorizationCode } from './authCode';
import { import {
ApiTable, RouteTable, ApiTable, EmisApiTable, RouteTable,
AxyRequest, EmisRequest, AxyRequest, EmisRequest,
basicAction, RouteRequest basicAction, RouteRequest
} from './webapi' } from './webapi'
@ -13,6 +13,7 @@ export {
RouteTable, RouteTable,
ApiTable, ApiTable,
EmisApiTable,
AxyRequest, AxyRequest,
EmisRequest, EmisRequest,
basicAction, basicAction,

10
web/client/src/utils/webapi.js

@ -1,11 +1,13 @@
"use strict"; "use strict";
import { ProxyRequest, customWebUtils } from "@peace/utils"; import { ProxyRequest, customWebUtils } from "@peace/utils";
export const AxyRequest = new ProxyRequest("_axy"); const userKey = "pomsUser";
export const EmisRequest = new ProxyRequest("_emis")
export const AxyRequest = new ProxyRequest("_axy", userKey);
export const EmisRequest = new ProxyRequest("_emis", userKey);
export const webUtils = new customWebUtils({ export const webUtils = new customWebUtils({
userKey: 'pomsUser' userKey: userKey
}); });
const { basicAction, RouteRequest } = webUtils const { basicAction, RouteRequest } = webUtils
export { export {
@ -83,7 +85,7 @@ export const ApiTable = {
// 项企的接口 // 项企的接口
export const EmisApiTable = { export const EmisApiTable = {
//通过流程名称查找指定流程 //通过流程名称查找指定流程
getProcessByName: '/workflow/process/name', getProcessByName: 'workflow/process/name',
} }
export const RouteTable = { export const RouteTable = {

16
web/config.js

@ -15,6 +15,7 @@ args.option(['u', 'api-url'], 'webapi的URL');
args.option('apiPomsUrl', 'webapi的URL 外网可访问'); args.option('apiPomsUrl', 'webapi的URL 外网可访问');
args.option('apiAnxinyunUrl', '安心云 api'); args.option('apiAnxinyunUrl', '安心云 api');
args.option('apiEmisUrl', '企业管理 api'); args.option('apiEmisUrl', '企业管理 api');
args.option('webEmisUrl', '企业管理 web');
args.option('iotVcmpWeb', 'IOT 视频服务'); args.option('iotVcmpWeb', 'IOT 视频服务');
args.option('pomsMonitor', '运维监控 web'); args.option('pomsMonitor', '运维监控 web');
args.option('pomsKubesphere', 'kubesphere web'); args.option('pomsKubesphere', 'kubesphere web');
@ -37,6 +38,7 @@ const flags = args.parse(process.argv);
const API_URL = process.env.API_URL || flags.apiUrl; const API_URL = process.env.API_URL || flags.apiUrl;
const API_POMS_URL = process.env.API_POMS_URL || flags.apiPomsUrl; const API_POMS_URL = process.env.API_POMS_URL || flags.apiPomsUrl;
const API_EMIS_URL = process.env.API_EMIS_URL || flags.apiEmisUrl; const API_EMIS_URL = process.env.API_EMIS_URL || flags.apiEmisUrl;
const WEB_EMIS_URL = process.env.WEB_EMIS_URL || flags.webEmisUrl;
const API_ANXINYUN_URL = process.env.API_ANXINYUN_URL || flags.apiAnxinyunUrl; const API_ANXINYUN_URL = process.env.API_ANXINYUN_URL || flags.apiAnxinyunUrl;
const IOT_VIDEO_WEB = process.env.IOT_VIDEO_WEB || flags.iotVcmpWeb; const IOT_VIDEO_WEB = process.env.IOT_VIDEO_WEB || flags.iotVcmpWeb;
const POMS_MONITOR = process.env.POMS_MONITOR || flags.pomsMonitor; const POMS_MONITOR = process.env.POMS_MONITOR || flags.pomsMonitor;
@ -57,6 +59,7 @@ const ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMA
if ( if (
!API_URL !API_URL
|| !API_EMIS_URL || !WEB_EMIS_URL
|| !API_ANXINYUN_URL || !API_ANXINYUN_URL
|| !POMS_MONITOR || !DC_WEB || !POMS_MONITOR || !DC_WEB
|| !ANXINCLOUD_QINIU_AK || !ANXINCLOUD_QINIU_SK || !ANXINCLOUD_QINIU_BUCKET_RESOURCE || !ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || !IOT_VIDEO_WEB) { || !ANXINCLOUD_QINIU_AK || !ANXINCLOUD_QINIU_SK || !ANXINCLOUD_QINIU_BUCKET_RESOURCE || !ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || !IOT_VIDEO_WEB) {
@ -80,6 +83,12 @@ const product = {
host: API_ANXINYUN_URL, host: API_ANXINYUN_URL,
match: /^\/_axy\//, match: /^\/_axy\//,
} }
}, {
entry: require('./middlewares/proxy').entry,
opts: {
host: API_EMIS_URL,
match: /^\/_emis\//,
}
}, { }, {
entry: require('./middlewares/attachment').entry, entry: require('./middlewares/attachment').entry,
opts: { opts: {
@ -92,16 +101,11 @@ const product = {
maxSize: 20971520, // 20M maxSize: 20971520, // 20M
uploadPath: 'other' uploadPath: 'other'
} }
}, {
entry: require('./middlewares/proxy').entry,
opts: {
host: API_EMIS_URL,
match: /^\/_emis\//,
}
}, { }, {
entry: require('./routes').entry, entry: require('./routes').entry,
opts: { opts: {
apiUrl: API_POMS_URL, apiUrl: API_POMS_URL,
webEmis: WEB_EMIS_URL,
iotVcmpWeb: IOT_VIDEO_WEB, iotVcmpWeb: IOT_VIDEO_WEB,
pomsMonitor: POMS_MONITOR, pomsMonitor: POMS_MONITOR,
pomsKubesphere: POMS_KUBESPHERE, pomsKubesphere: POMS_KUBESPHERE,

4
web/package.json

@ -7,7 +7,7 @@
"test": "mocha", "test": "mocha",
"start-vite": "cross-env NODE_ENV=developmentVite npm run start-params", "start-vite": "cross-env NODE_ENV=developmentVite npm run start-params",
"start": "cross-env NODE_ENV=development npm run start-params", "start": "cross-env NODE_ENV=development npm run start-params",
"start-params": "node server -p 5600 -u http://localhost:4600 --apiPomsUrl http://localhost:4600 --apiAnxinyunUrl http://10.8.30.112:4100 --apiEmisUrl http://10.8.30.112:14000 --qnak 5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu --qnsk w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5 --qnbkt anxinyun-test --qndmn http://test.resources.anxinyun.cn --iotVcmpWeb https://mediaconsole.ngaiot.com --pomsMonitor http://monitor.anxinyun.cn/goto/PaEDLE84z?orgId=1 --pomsKubesphere https://k8sadmin.anxinyun.cn/ --pomsAmbari https://ambari.anxinyun.cn/ --pomsKowl https://kafka.anxinyun.cn/ --pomsPghero https://pghero.anxinyun.cn/ --pomsEs https://esc.anxinyun.cn/ --pomsNotebook https://inotebook.anxinyun.cn/ --dcWeb https://fsiot-oamss.anxinyun.cn", "start-params": "node server -p 5600 -u http://localhost:4600 --apiPomsUrl http://localhost:4600 --apiAnxinyunUrl http://10.8.30.112:4100 --apiEmisUrl http://10.8.30.161:1111 --webEmisUrl http://10.8.30.161:1111 --qnak 5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu --qnsk w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5 --qnbkt anxinyun-test --qndmn http://test.resources.anxinyun.cn --iotVcmpWeb https://mediaconsole.ngaiot.com --pomsMonitor http://monitor.anxinyun.cn/goto/PaEDLE84z?orgId=1 --pomsKubesphere https://k8sadmin.anxinyun.cn/ --pomsAmbari https://ambari.anxinyun.cn/ --pomsKowl https://kafka.anxinyun.cn/ --pomsPghero https://pghero.anxinyun.cn/ --pomsEs https://esc.anxinyun.cn/ --pomsNotebook https://inotebook.anxinyun.cn/ --dcWeb https://fsiot-oamss.anxinyun.cn",
"deploy": "export NODE_ENV=production&& npm run build && node server", "deploy": "export NODE_ENV=production&& npm run build && node server",
"build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js", "build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js",
"build": "cross-env NODE_ENV=production&&webpack --config webpack.config.prod.js" "build": "cross-env NODE_ENV=production&&webpack --config webpack.config.prod.js"
@ -83,4 +83,4 @@
"webpack-dev-server": "^3.11.2", "webpack-dev-server": "^3.11.2",
"webpack-hot-middleware": "^2.25.0" "webpack-hot-middleware": "^2.25.0"
} }
} }

5
web/routes/attachment/index.js

@ -19,7 +19,7 @@ module.exports = {
entry: function (app, router, opts) { entry: function (app, router, opts) {
const getApiRoot = async function (ctx) { const getApiRoot = async function (ctx) {
const { apiUrl, iotVcmpWeb, pomsMonitor, pomsKubesphere, pomsAmbari, pomsKowl, pomsPghero, pomsEs, pomsNotebook, dcWeb, qiniu } = opts; const { apiUrl, iotVcmpWeb, pomsMonitor, pomsKubesphere, pomsAmbari, pomsKowl, pomsPghero, pomsEs, pomsNotebook, dcWeb, qiniu, webEmis, } = opts;
ctx.status = 200; ctx.status = 200;
ctx.body = { ctx.body = {
@ -33,7 +33,8 @@ module.exports = {
pomsMonitor: pomsMonitor, pomsMonitor: pomsMonitor,
pomsNotebook: pomsNotebook, pomsNotebook: pomsNotebook,
dcWeb: dcWeb, dcWeb: dcWeb,
qiniu: qiniu qiniu: qiniu,
webEmis,
}; };
}; };

Loading…
Cancel
Save