From 5f9a36518ab30e6fdfbdb4b589a446614beeba5c Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 1 Jun 2023 10:58:59 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E8=BF=90=E7=BB=B4=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=9A=84=E5=8D=95=E6=95=B0=E6=8D=AE=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/workOrder/index.js | 53 +++++- api/app/lib/routes/workOrder/index.js | 4 + web/client/assets/images/fs-logo.png | Bin 0 -> 4146 bytes web/client/src/components/index.js | 5 +- web/client/src/components/workflow/index.jsx | 32 ++-- web/client/src/components/workflow/view.jsx | 166 ++++++++---------- web/client/src/layout/actions/global.js | 1 + web/client/src/layout/reducers/global.js | 2 + .../workOrder/containers/jobOrder.jsx | 9 +- web/config.js | 7 +- web/package.json | 2 +- web/routes/attachment/index.js | 3 +- 12 files changed, 163 insertions(+), 121 deletions(-) create mode 100644 web/client/assets/images/fs-logo.png diff --git a/api/app/lib/controllers/workOrder/index.js b/api/app/lib/controllers/workOrder/index.js index 456b763..16c65f4 100644 --- a/api/app/lib/controllers/workOrder/index.js +++ b/api/app/lib/controllers/workOrder/index.js @@ -34,6 +34,57 @@ async function getEnabledWorkflowProcess (ctx) { } } +async function basicDataAllProject (ctx) { + try { + const { models } = ctx.fs.dc; + + const proRes = await models.ProjectCorrelation.findAndCountAll({ + where: { + del: false, + }, + order: [['updateTime', 'desc']], + }) + + let pepProjectIds = new Set() + for (let p of proRes.rows) { + if (p.pepProjectId) { + pepProjectIds.add(p.pepProjectId) + } + } + + const pepProjectRes = pepProjectIds.size ? + await clickHouse.projectManage.query( + ` + SELECT + t_pim_project.id AS id, + t_pim_project.project_name AS project_name, + t_pim_project.isdelete AS isdelete + FROM t_pim_project + WHERE id IN (${[...pepProjectIds].join(',')}, -1) + ` + ).toPromise() : + [] + const list = proRes.map(p => { + const corPro = pepProjectRes.find(pp => pp.id == p.pepProjectId) || {} + return { + value: p.id, + label: corPro.project_name || p.name, + disabled: corPro.isdelete == 1 + } + }) + + ctx.status = 200; + ctx.body = list + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} + module.exports = { - getEnabledWorkflowProcess + getEnabledWorkflowProcess, + basicDataAllProject }; \ No newline at end of file diff --git a/api/app/lib/routes/workOrder/index.js b/api/app/lib/routes/workOrder/index.js index fc669e4..c7004d1 100644 --- a/api/app/lib/routes/workOrder/index.js +++ b/api/app/lib/routes/workOrder/index.js @@ -5,4 +5,8 @@ const workOrder = require('../../controllers/workOrder'); module.exports = function (app, router, opts) { app.fs.api.logAttr['GET/workflow/process/enabled'] = { content: '获取工作流可用表单', visible: true }; router.get('/workflow/process/enabled', workOrder.getEnabledWorkflowProcess); + + // 单一数据源 + app.fs.api.logAttr['GET/basic-data/workflow/single/allProject'] = { content: '查询所有项目', visible: false }; + router.get('/basic-data/workflow/single/allProject', workOrder.basicDataAllProject); }; \ No newline at end of file diff --git a/web/client/assets/images/fs-logo.png b/web/client/assets/images/fs-logo.png new file mode 100644 index 0000000000000000000000000000000000000000..44814f38fe67067a9e79e03f91eb651a35986b98 GIT binary patch literal 4146 zcmV-25Y6w2P)Px^>`6pHRCr$Pod@uBM_I<7M^F#}ftW!A1VW9HPz4bkNTeeZs)B(D2^|BXAV!cj zG^0r9O(66hfzV4rG@&RcD$PO_QHpdzCy(>H?zyw~+;i?dxBdV3Bln&8=1cC`vuF3+ zXWxD6eohh{SoA2{k36u3yc_Kz9Pkd5i?D0gb}u+kgA$4PoxS+zfN%VyB>r^KPErnF z;DOwv2IY5c|Ma#@Cdm~gJwVcZB)J;b4wT!nNE;f*)`GH`Z<61a^rRgqH-vyK>~?8T zCb^WP*GszO2Ih5+q|4g=eiEeQ2PIvtd}k*qH^A_1>T(rOwk6m)=k+Puhg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3BFGs_hBQ0wseRX9Euy&6928hnq_?KuL;JtxTg5oV^#4 zl0jD%GYjyJ0!$SD`^_kKXmmlE9-EEWc z-elHbeAIqQ$`df2PVdM`7SG`sveQZH?@uGuqV_B z%CfW2?MT)gN)v_pOG-*^aHxx$2+>_3$xSP%{rb9)edyqZv`Yfx@zarGNQxedga46n zbn2EZN!ft%leQ^`<$VhNDJ2*L$`TF3QpRmV7!a!+osV=uGTXnEgcLM%K{hdeBhl)+ zMGtA`Hzr{|WQ!Br;O}unr+gDUgI?79pYWy4 z0VPM|_zs$?EdZ#mf*FBwPG2bd7!M77!8XRi!c^(eZ?=up0aQr;Gi_7oG(|n2WOFsf z1BF`jF%*=|%@&VEk8J#u<)~&}WVZKRzeutSfF_fi#M!R#c7_>~{Ej4inN%3!I0uLb zCNjz~wDyc@P@>Fo0|Uk3NQ*_q^`%yI2PL5vWF%n<4FToC@APpu33?Zc#=;YN z3ybuiu4IQEP=K>2X_1L#o^R*HQm!Qdfb86qD6 z<7#}{$6lebeG&iRwm+1leY?WE@qFHPQx7t)ZSV8_24#_qjguKkj@ychVW}IcnHKBoh&xa#1a=I4RnU$TA(B}iCgH4wn@?$QStdUmosn#6Vslk$LShV8+9b<~)8Mhy6-OQKbFg63@2cYQEHX>JK zL%oL@ZrfPoY$OaQE~=$A9Ka4XWasgB-t)eHM~9t3s9#nyDA_-`jPFaI`L9>-554VO7aKWw~T$Y$qwI1%Kcu()xW=~>!DX3SxJ@S zF36hRZ=3YFUfO|jW!CR|2ipwFu1uo0*lw;&?o;~FOWW?7&)|REcW&s_O*=D-e=TfIEz&cW?KdG1{It)BJ&0pp&}>k7nj-~a#s07*qoM6N<$f { - const { successCallBack = () => { }, title, visible, clientHeight, postData, processId, user, dispatch, webEmis } = props; + const { successCallBack = () => { }, title, visible, clientHeight, postData, processId, user, dispatch, webEmis, webOa } = props; const [loading, setLoading] = useState(true); const [ifShowMessage, setIfShowMessage] = useState(true); - const [webUrl, setWebUrl] = useState(null); const [customVisible, setCustomVisible] = useState(false); const [draftId, setDraftId] = useState(); const iframeRef = React.createRef(); @@ -47,11 +46,9 @@ const WorkFlowModal = (props) => { } const handelApprovalCenter = (activeKey) => { - RouteRequest.get(RouteTable.getWebUrl + `?sys=emisWebUrl`).then(res => { - if (res.url) { - window.open(res.url + "/approval/center?activeKey=" + activeKey); - } - }); + if (webOa) { + window.open(webOa + "/approval/center?activeKey=" + activeKey); + } } const handelOk = () => { @@ -112,31 +109,22 @@ const WorkFlowModal = (props) => { } //监听message事件 window.addEventListener('message', receiveMessageFromIndex, false); - //获取企业统一认证管理平台web的URL - if (!webUrl) { - RouteRequest.get(RouteTable.getEmisWebUrl).then(res => { - if (res.url) { - setWebUrl(res.url); - } - }); - } + }, []) + console.log(webEmis, processId); return (
@@ -152,7 +140,7 @@ const WorkFlowModal = (props) => { - {webUrl && processId ? : ''} - -
-
- + return ( +
+ + +
+
+ + + | + 让世间万物拥有感知,服务人类社会于美好 + + +
+
+ + {webEmis && processId ? : ''} + +
+
+
-
*/} -
+ + - ) + ) } -function mapStateToProps(state) { - const { auth, global } = state; - return { - user: auth.user, - clientHeight: global.clientHeight, - } +function mapStateToProps (state) { + const { auth, global } = state; + return { + user: auth.user, + clientHeight: global.clientHeight, + webEmis: global.webEmis, + webOa: global.webOa + } } export default connect(mapStateToProps)(WorkFlowViewModal); \ No newline at end of file diff --git a/web/client/src/layout/actions/global.js b/web/client/src/layout/actions/global.js index b8bb3cd..f85270e 100644 --- a/web/client/src/layout/actions/global.js +++ b/web/client/src/layout/actions/global.js @@ -49,6 +49,7 @@ export function initApiRoot () { dcWeb: res.dcWeb, qiniu: res.qiniu, webEmis: res.webEmis, + webOa: res.webOa, } }) }); diff --git a/web/client/src/layout/reducers/global.js b/web/client/src/layout/reducers/global.js index 5873b24..84be4a5 100644 --- a/web/client/src/layout/reducers/global.js +++ b/web/client/src/layout/reducers/global.js @@ -50,6 +50,8 @@ function global (state = { pomsNotebook: payload.pomsNotebook, dcWeb: payload.dcWeb, qiniu: payload.qiniu, + webEmis: payload.webEmis, + webOa: payload.webOa, }).toJS(); case PEPPROJECTID: return Immutable.fromJS(state).merge({ diff --git a/web/client/src/sections/workOrder/containers/jobOrder.jsx b/web/client/src/sections/workOrder/containers/jobOrder.jsx index ddb69ab..e318f37 100644 --- a/web/client/src/sections/workOrder/containers/jobOrder.jsx +++ b/web/client/src/sections/workOrder/containers/jobOrder.jsx @@ -1,7 +1,7 @@ import React, { useEffect, useState } from 'react'; import { connect } from 'react-redux'; import moment from 'moment'; -import { WorkflowModal } from "$components" +import { WorkflowModal, WorkFlowViewModal } from "$components" import { EmisRequest, EmisApiTable } from "$utils" import { Card, Notification, Space, Button } from '@douyinfe/semi-ui'; import { IconArticle } from '@douyinfe/semi-icons'; @@ -27,6 +27,7 @@ const JobOrder = (props) => { workflowProcess.map(p => { return ( { ) }) } - { setWorkflowModalVisible(false) }} successCallBack={() => { setWorkflowModalVisible(false) }} + /> */} + ) diff --git a/web/config.js b/web/config.js index 356d192..8ac8a60 100644 --- a/web/config.js +++ b/web/config.js @@ -15,7 +15,8 @@ args.option(['u', 'api-url'], 'webapi的URL'); args.option('apiPomsUrl', 'webapi的URL 外网可访问'); args.option('apiAnxinyunUrl', '安心云 api'); args.option('apiEmisUrl', '企业管理 api'); -args.option('webEmisUrl', '企业管理 web'); +args.option('webEmisUrl', '统一认证 web - 统一认证 配置表单的'); +args.option('webOaUrl', 'OA web - 项企填表单的'); args.option('iotVcmpWeb', 'IOT 视频服务'); args.option('pomsMonitor', '运维监控 web'); args.option('pomsKubesphere', 'kubesphere web'); @@ -39,6 +40,7 @@ const API_URL = process.env.API_URL || flags.apiUrl; const API_POMS_URL = process.env.API_POMS_URL || flags.apiPomsUrl; const API_EMIS_URL = process.env.API_EMIS_URL || flags.apiEmisUrl; const WEB_EMIS_URL = process.env.WEB_EMIS_URL || flags.webEmisUrl; +const WEB_OA_URL = process.env.WEB_OA_URL || flags.webOaUrl; const API_ANXINYUN_URL = process.env.API_ANXINYUN_URL || flags.apiAnxinyunUrl; const IOT_VIDEO_WEB = process.env.IOT_VIDEO_WEB || flags.iotVcmpWeb; const POMS_MONITOR = process.env.POMS_MONITOR || flags.pomsMonitor; @@ -59,7 +61,7 @@ const ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMA if ( !API_URL - || !API_EMIS_URL || !WEB_EMIS_URL + || !API_EMIS_URL || !WEB_EMIS_URL || !WEB_OA_URL || !API_ANXINYUN_URL || !POMS_MONITOR || !DC_WEB || !ANXINCLOUD_QINIU_AK || !ANXINCLOUD_QINIU_SK || !ANXINCLOUD_QINIU_BUCKET_RESOURCE || !ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || !IOT_VIDEO_WEB) { @@ -106,6 +108,7 @@ const product = { opts: { apiUrl: API_POMS_URL, webEmis: WEB_EMIS_URL, + webOa: WEB_OA_URL, iotVcmpWeb: IOT_VIDEO_WEB, pomsMonitor: POMS_MONITOR, pomsKubesphere: POMS_KUBESPHERE, diff --git a/web/package.json b/web/package.json index 83f661d..4484060 100644 --- a/web/package.json +++ b/web/package.json @@ -7,7 +7,7 @@ "test": "mocha", "start-vite": "cross-env NODE_ENV=developmentVite 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.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", + "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:1112 --webOaUrl http://10.8.30.161:8668 --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", "build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js", "build": "cross-env NODE_ENV=production&&webpack --config webpack.config.prod.js" diff --git a/web/routes/attachment/index.js b/web/routes/attachment/index.js index 48b16ef..b4e88ef 100644 --- a/web/routes/attachment/index.js +++ b/web/routes/attachment/index.js @@ -19,7 +19,7 @@ module.exports = { entry: function (app, router, opts) { const getApiRoot = async function (ctx) { - const { apiUrl, iotVcmpWeb, pomsMonitor, pomsKubesphere, pomsAmbari, pomsKowl, pomsPghero, pomsEs, pomsNotebook, dcWeb, qiniu, webEmis, } = opts; + const { apiUrl, iotVcmpWeb, pomsMonitor, pomsKubesphere, pomsAmbari, pomsKowl, pomsPghero, pomsEs, pomsNotebook, dcWeb, qiniu, webEmis, webOa } = opts; ctx.status = 200; ctx.body = { @@ -35,6 +35,7 @@ module.exports = { dcWeb: dcWeb, qiniu: qiniu, webEmis, + webOa, }; }; From e6983c2fbf32671c05ea2bf18bc04774dcfca19c Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 1 Jun 2023 12:15:45 +0800 Subject: [PATCH 2/9] =?UTF-8?q?fix=20=E5=8D=95=E4=B8=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/workOrder/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/app/lib/controllers/workOrder/index.js b/api/app/lib/controllers/workOrder/index.js index 16c65f4..af14c0c 100644 --- a/api/app/lib/controllers/workOrder/index.js +++ b/api/app/lib/controllers/workOrder/index.js @@ -37,7 +37,8 @@ async function getEnabledWorkflowProcess (ctx) { async function basicDataAllProject (ctx) { try { const { models } = ctx.fs.dc; - + const { userId, pepUserId, userInfo, pepUserInfo } = ctx.fs.api + console.log('userId', userId); const proRes = await models.ProjectCorrelation.findAndCountAll({ where: { del: false, @@ -62,8 +63,9 @@ async function basicDataAllProject (ctx) { FROM t_pim_project WHERE id IN (${[...pepProjectIds].join(',')}, -1) ` - ).toPromise() : + ).toPromise() || [] : [] + console.log('pepProjectRes', pepProjectRes); const list = proRes.map(p => { const corPro = pepProjectRes.find(pp => pp.id == p.pepProjectId) || {} return { From 96b15817f6a3ed497d8f65d1a6c152698c66f76b Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 1 Jun 2023 14:28:45 +0800 Subject: [PATCH 3/9] =?UTF-8?q?fix=20=E5=8D=95=E4=B8=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=85=8D=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/config.js | 3 ++- web/client/src/components/workflow/index.jsx | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/api/config.js b/api/config.js index d56d4ee..46055d0 100644 --- a/api/config.js +++ b/api/config.js @@ -160,7 +160,8 @@ const product = { { p: '/alarm/service/api', o: 'POST' }, //后端服务告警入库 { p: '/data/continuity/api', o: 'POST' }, //数据连续性监控入库 { p: '/page/performance/api', o: 'POST' }, //页面加载性能入库 - { p: '/alarm/video/added_log', o: 'POST' } + { p: '/alarm/video/added_log', o: 'POST' }, + { p: '/basic-data/workflow/single/allProject', o: 'GET' }, ], // 不做认证的路由,也可以使用 exclude: ["*"] 跳过所有路由 apMergeDeVeAnxinProjectId: AP_MERGE_DEVE_ANXINPROJECT_ID, anxinCloud: { diff --git a/web/client/src/components/workflow/index.jsx b/web/client/src/components/workflow/index.jsx index 12ad985..603ef15 100644 --- a/web/client/src/components/workflow/index.jsx +++ b/web/client/src/components/workflow/index.jsx @@ -150,6 +150,7 @@ const WorkFlowModal = (props) => { allowTransparency="true" ref={iframeRef} src={`${webEmis}/process/${processId}/apply?token=${user.token}`} + // src={`${webEmis}/process/${processId}/apply?token=${user.token}`} width={'100%'} style={{ height: '100vh' }} frameBorder="0" From e79696b6cbda6e7ce3fb8caae54c2b501aa30605 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 1 Jun 2023 15:04:08 +0800 Subject: [PATCH 4/9] =?UTF-8?q?debug=20=E5=8D=95=E4=B8=80=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=BA=90=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/workOrder/index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/api/app/lib/controllers/workOrder/index.js b/api/app/lib/controllers/workOrder/index.js index af14c0c..6585501 100644 --- a/api/app/lib/controllers/workOrder/index.js +++ b/api/app/lib/controllers/workOrder/index.js @@ -37,8 +37,7 @@ async function getEnabledWorkflowProcess (ctx) { async function basicDataAllProject (ctx) { try { const { models } = ctx.fs.dc; - const { userId, pepUserId, userInfo, pepUserInfo } = ctx.fs.api - console.log('userId', userId); + const proRes = await models.ProjectCorrelation.findAndCountAll({ where: { del: false, @@ -78,7 +77,7 @@ async function basicDataAllProject (ctx) { ctx.status = 200; ctx.body = list } catch (error) { - ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; ctx.body = { message: typeof error == 'string' ? error : undefined From 7c078f8d72186eb4346dacd1f30a1ea3c0dfe67a Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 1 Jun 2023 15:19:46 +0800 Subject: [PATCH 5/9] =?UTF-8?q?fix=20=E5=8D=95=E4=B8=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/workOrder/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/app/lib/controllers/workOrder/index.js b/api/app/lib/controllers/workOrder/index.js index 6585501..62472cc 100644 --- a/api/app/lib/controllers/workOrder/index.js +++ b/api/app/lib/controllers/workOrder/index.js @@ -37,7 +37,8 @@ async function getEnabledWorkflowProcess (ctx) { async function basicDataAllProject (ctx) { try { const { models } = ctx.fs.dc; - + const { clickHouse } = ctx.app.fs + const proRes = await models.ProjectCorrelation.findAndCountAll({ where: { del: false, From c561472a3875c7f2e2ba2b59dc8c968c296aa530 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 1 Jun 2023 15:39:57 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix=20=E5=8D=95=E4=B8=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/workOrder/index.js | 8 ++++---- web/client/src/components/workflow/index.jsx | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/api/app/lib/controllers/workOrder/index.js b/api/app/lib/controllers/workOrder/index.js index 62472cc..a78fda0 100644 --- a/api/app/lib/controllers/workOrder/index.js +++ b/api/app/lib/controllers/workOrder/index.js @@ -38,8 +38,8 @@ async function basicDataAllProject (ctx) { try { const { models } = ctx.fs.dc; const { clickHouse } = ctx.app.fs - - const proRes = await models.ProjectCorrelation.findAndCountAll({ + + const proRes = await models.ProjectCorrelation.findAll({ where: { del: false, }, @@ -65,8 +65,8 @@ async function basicDataAllProject (ctx) { ` ).toPromise() || [] : [] - console.log('pepProjectRes', pepProjectRes); - const list = proRes.map(p => { + + const list = proRes.map(p => { const corPro = pepProjectRes.find(pp => pp.id == p.pepProjectId) || {} return { value: p.id, diff --git a/web/client/src/components/workflow/index.jsx b/web/client/src/components/workflow/index.jsx index 603ef15..12ad985 100644 --- a/web/client/src/components/workflow/index.jsx +++ b/web/client/src/components/workflow/index.jsx @@ -150,7 +150,6 @@ const WorkFlowModal = (props) => { allowTransparency="true" ref={iframeRef} src={`${webEmis}/process/${processId}/apply?token=${user.token}`} - // src={`${webEmis}/process/${processId}/apply?token=${user.token}`} width={'100%'} style={{ height: '100vh' }} frameBorder="0" From fc912232e78d57b601526c2936ece57fb2d5ae49 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 1 Jun 2023 15:55:49 +0800 Subject: [PATCH 7/9] =?UTF-8?q?fix=20=E5=8D=95=E4=B8=80=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=BA=90=E8=8E=B7=E5=8F=96=E9=A1=B9=E7=9B=AE=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/workOrder/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/app/lib/controllers/workOrder/index.js b/api/app/lib/controllers/workOrder/index.js index a78fda0..4479687 100644 --- a/api/app/lib/controllers/workOrder/index.js +++ b/api/app/lib/controllers/workOrder/index.js @@ -47,7 +47,7 @@ async function basicDataAllProject (ctx) { }) let pepProjectIds = new Set() - for (let p of proRes.rows) { + for (let p of proRes) { if (p.pepProjectId) { pepProjectIds.add(p.pepProjectId) } @@ -66,7 +66,7 @@ async function basicDataAllProject (ctx) { ).toPromise() || [] : [] - const list = proRes.map(p => { + const list = proRes.map(p => { const corPro = pepProjectRes.find(pp => pp.id == p.pepProjectId) || {} return { value: p.id, From 3bee7b70d9482515828b3830c02d6cff12d11199 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 1 Jun 2023 18:04:34 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/workOrder/index.js | 1 + web/client/src/components/workflow/index.jsx | 61 +++++---- .../workOrder/containers/jobOrder.jsx | 124 ++++++++++-------- web/client/src/utils/webapi.js | 2 + 4 files changed, 102 insertions(+), 86 deletions(-) diff --git a/api/app/lib/controllers/workOrder/index.js b/api/app/lib/controllers/workOrder/index.js index 4479687..4fe4164 100644 --- a/api/app/lib/controllers/workOrder/index.js +++ b/api/app/lib/controllers/workOrder/index.js @@ -21,6 +21,7 @@ async function getEnabledWorkflowProcess (ctx) { WHERE workflow_process.deleted = 0 AND workflow_process.is_enable = 1 + order by workflow_process.update_time desc `).toPromise() ctx.status = 200; diff --git a/web/client/src/components/workflow/index.jsx b/web/client/src/components/workflow/index.jsx index 12ad985..a1e8868 100644 --- a/web/client/src/components/workflow/index.jsx +++ b/web/client/src/components/workflow/index.jsx @@ -2,9 +2,9 @@ import React from 'react'; import { connect } from 'react-redux'; -import { Modal, Spin, Notification, Row } from '@douyinfe/semi-ui'; +import { Modal, Spin, Notification, Row, Space, Button } from '@douyinfe/semi-ui'; import { RouteTable } from '../../utils/webapi'; -import { RouteRequest } from '@peace/utils'; +import { EmisRequest, EmisApiTable } from '$utils'; import { useState } from 'react'; import { useEffect } from 'react'; import { IconClose } from '@douyinfe/semi-icons'; @@ -14,7 +14,7 @@ import './index.less' const { confirm } = Modal; const WorkFlowModal = (props) => { - const { successCallBack = () => { }, title, visible, clientHeight, postData, processId, user, dispatch, webEmis, webOa } = props; + const { successCallBack = () => { }, title, visible, clientHeight, postData, processId, user, dispatch, webEmis, webOa, onCancel } = props; const [loading, setLoading] = useState(true); const [ifShowMessage, setIfShowMessage] = useState(true); const [customVisible, setCustomVisible] = useState(false); @@ -25,7 +25,6 @@ const WorkFlowModal = (props) => { if (draftId) { setCustomVisible(false); } else { - const { onCancel } = props; onCancel && onCancel(); setLoading(false); } @@ -60,18 +59,13 @@ const WorkFlowModal = (props) => { } const handelDeny = () => { - // dispatch(delDraft(draftId)).then(res => { - // if (res.success) { - // Notification.success({title:'删除草稿成功'}); - // const { onCancel } = props; - // onCancel && onCancel(); - // setLoading(false); - // setCustomVisible(false); - // setDraftId(null); - // } else { - // Notification.error({title:'删除草稿失败,请联系管理员'}); - // } - // }) + EmisRequest.delete(EmisApiTable.delDraftUrl.replace('{draftId}', draftId)).then(res => { + Notification.success({ title: '删除草稿成功' }); + onCancel && onCancel(); + setLoading(false); + setCustomVisible(false); + setDraftId(null); + }) } const cancel = () => { @@ -84,6 +78,7 @@ const WorkFlowModal = (props) => { let data = JSON.parse(event.data); const { type, isSaveDraft, setIntervalSave, draftId, msg } = data; if (msg) { + console.log(msg); Notification.success({ title: msg }) } setDraftId(draftId); @@ -109,7 +104,6 @@ const WorkFlowModal = (props) => { } //监听message事件 window.addEventListener('message', receiveMessageFromIndex, false); - }, []) console.log(webEmis, processId); @@ -124,7 +118,7 @@ const WorkFlowModal = (props) => { hasCancel={false} footer={null} wrapClassName='process_modal_wrap' - onCancel={showConfirm} + // onCancel={showConfirm} >
@@ -158,16 +152,27 @@ const WorkFlowModal = (props) => {
{ - customVisible ?
-
-

此表单已保存为草稿,是否需要保留

-
    -
  • handelOk()}>是
  • -
  • handelDeny()}>否
  • -
  • cancel()}>取消
  • -
-
-
: '' + customVisible ? + + + + + + + } + > + + : '' }
diff --git a/web/client/src/sections/workOrder/containers/jobOrder.jsx b/web/client/src/sections/workOrder/containers/jobOrder.jsx index e318f37..21dfa5d 100644 --- a/web/client/src/sections/workOrder/containers/jobOrder.jsx +++ b/web/client/src/sections/workOrder/containers/jobOrder.jsx @@ -3,96 +3,104 @@ import { connect } from 'react-redux'; import moment from 'moment'; import { WorkflowModal, WorkFlowViewModal } from "$components" import { EmisRequest, EmisApiTable } from "$utils" -import { Card, Notification, Space, Button } from '@douyinfe/semi-ui'; +import { Card, Notification, Space, Button, Spin } from '@douyinfe/semi-ui'; import { IconArticle } from '@douyinfe/semi-icons'; import '../style.less' const { Meta } = Card; const JobOrder = (props) => { - const { dispatch, actions, user, workflowProcess } = props + const { dispatch, actions, user, workflowProcess, clientHeight } = props const { workOrder } = actions const [workflowModalVisible, setWorkflowModalVisible] = useState(false) const [launchProcessId, setLaunchProcessId] = useState(null) + const [formStateRequestingIndex, setFormStateRequestingIndex] = useState(false) useEffect(() => { dispatch(workOrder.getEnabledWorkflowProcess()) }, []) return ( -
- { - workflowProcess.map(p => { - return ( - { - EmisRequest.get(EmisApiTable.getProcessByName, { - 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) +
+
+ { + workflowProcess.map((p, index) => { + return ( + { + if (formStateRequestingIndex) return; + setFormStateRequestingIndex(index + 1) + EmisRequest.get(EmisApiTable.getProcessByName, { + name: decodeURIComponent(p.name), + resource: p.id + }).then(res => { + setFormStateRequestingIndex(false) + 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: `获取指定流程失败` }); } - } else { - Notification.error({ title: `获取指定流程失败` }); - } - }) - }} - > -
- - } - /> -
-
- ) - }) - } - {/* +
+ {p.name} + } + avatar={ + + } + /> +
+ + ) + }) + } +
+ { setWorkflowModalVisible(false) }} successCallBack={() => { setWorkflowModalVisible(false) }} - /> */} - + {/* + /> */}
) } function mapStateToProps (state) { const { auth, global, workflowProcess } = state; + console.log(global); return { user: auth.user, actions: global.actions, - workflowProcess: workflowProcess.data || [] + workflowProcess: workflowProcess.data || [], + clientHeight: global.clientHeight }; } diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index 2c3261a..b9999ec 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -86,6 +86,8 @@ export const ApiTable = { export const EmisApiTable = { //通过流程名称查找指定流程 getProcessByName: 'workflow/process/name', + //删除草稿 + delDraftUrl: 'process/drafts/{draftId}', } export const RouteTable = { From 21a33a82aa3bb0254ef1d435be7fc9dd77119fe3 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 2 Jun 2023 13:52:03 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E8=A1=A8=E5=8D=95=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E4=B8=AD=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/workOrder/containers/jobOrder.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/src/sections/workOrder/containers/jobOrder.jsx b/web/client/src/sections/workOrder/containers/jobOrder.jsx index 21dfa5d..20f0a90 100644 --- a/web/client/src/sections/workOrder/containers/jobOrder.jsx +++ b/web/client/src/sections/workOrder/containers/jobOrder.jsx @@ -66,7 +66,7 @@ const JobOrder = (props) => {
{p.name} + {p.name} } avatar={