diff --git a/.gitignore b/.gitignore index 3c3629e..379f712 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ node_modules +.idea +.vscode + diff --git a/README.md b/README.md index e997b24..f63f63b 100644 --- a/README.md +++ b/README.md @@ -8,35 +8,16 @@ 泛微前端脚手架--组织架构图 -#### 软件架构 -软件架构说明 +#### 版本1.0 已封版 + +该版本组织分为2套数据 采用单向同步的方式 + +#### 功能介绍 + +组织架构图 +组织分权 +人员卡片等自定义功能 -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +#### 迭代计划 +由于当前版本两套数据不好管理 下版计划将数据源统一换成ecology数据源 \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c1b56dd..b6ac895 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "packages": { "": { "dependencies": { + "baidu-template-pro": "^1.0.0", "dom-to-image": "^2.6.0", "file-saver": "^2.0.5", "lodash": "^4.17.21", @@ -12,6 +13,7 @@ "rc-org-chart": "^1.0.6", "react-org-tree": "^1.0.0", "react-orgchart": "^1.0.5", + "react-router-dom": "5.1", "yargs": "^15.0.2" } }, @@ -301,6 +303,11 @@ "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" }, + "node_modules/baidu-template-pro": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/baidu-template-pro/-/baidu-template-pro-1.0.0.tgz", + "integrity": "sha512-gnw6uvCn4CvZZ9d1Tu+a0B7BjQuNXvDcxsJk7bwxTpNutj6JFIxcy2sS0rB2/0/t9GwatoEIXd8HV0qkXpdRow==" + }, "node_modules/base64-arraybuffer": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", @@ -547,6 +554,22 @@ "loose-envify": "^1.0.0" } }, + "node_modules/dva/node_modules/react-router-dom": { + "version": "4.3.1", + "resolved": "https://registry.npmmirror.com/react-router-dom/-/react-router-dom-4.3.1.tgz", + "integrity": "sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==", + "dependencies": { + "history": "^4.7.2", + "invariant": "^2.2.4", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.1", + "react-router": "^4.3.1", + "warning": "^4.0.1" + }, + "peerDependencies": { + "react": ">=15" + } + }, "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz", @@ -855,6 +878,20 @@ "dom-walk": "^0.1.0" } }, + "node_modules/mini-create-react-context": { + "version": "0.3.3", + "resolved": "https://registry.npmmirror.com/mini-create-react-context/-/mini-create-react-context-0.3.3.tgz", + "integrity": "sha512-TtF6hZE59SGmS4U8529qB+jJFeW6asTLDIpPgvPLSCsooAwJS7QprHIFTqv9/Qh3NdLwQxFYgiHX5lqb6jqzPA==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", + "dependencies": { + "@babel/runtime": "^7.12.1", + "tiny-warning": "^1.0.3" + }, + "peerDependencies": { + "prop-types": "^15.0.0", + "react": "^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" + } + }, "node_modules/mini-store": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/mini-store/-/mini-store-2.0.0.tgz", @@ -1624,16 +1661,37 @@ } }, "node_modules/react-router-dom": { - "version": "4.3.1", - "resolved": "https://registry.npmmirror.com/react-router-dom/-/react-router-dom-4.3.1.tgz", - "integrity": "sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==", + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/react-router-dom/-/react-router-dom-5.1.2.tgz", + "integrity": "sha512-7BPHAaIwWpZS074UKaw1FjVdZBSVWEk8IuDXdB+OkLb8vd/WRQIpA4ag9WQk61aEfQs47wHyjWUoUGGZxpQXew==", "dependencies": { - "history": "^4.7.2", - "invariant": "^2.2.4", + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", "loose-envify": "^1.3.1", - "prop-types": "^15.6.1", - "react-router": "^4.3.1", - "warning": "^4.0.1" + "prop-types": "^15.6.2", + "react-router": "5.1.2", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + }, + "peerDependencies": { + "react": ">=15" + } + }, + "node_modules/react-router-dom/node_modules/react-router": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/react-router/-/react-router-5.1.2.tgz", + "integrity": "sha512-yjEuMFy1ONK246B+rsa0cUam5OeAQ8pyclRDgpxuSCrAlJ1qN9uZ5IgyKC7gQg0w8OM50NXHEegPh/ks9YuR2A==", + "dependencies": { + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", + "hoist-non-react-statics": "^3.1.0", + "loose-envify": "^1.3.1", + "mini-create-react-context": "^0.3.0", + "path-to-regexp": "^1.7.0", + "prop-types": "^15.6.2", + "react-is": "^16.6.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" }, "peerDependencies": { "react": ">=15" @@ -2213,6 +2271,11 @@ } } }, + "baidu-template-pro": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/baidu-template-pro/-/baidu-template-pro-1.0.0.tgz", + "integrity": "sha512-gnw6uvCn4CvZZ9d1Tu+a0B7BjQuNXvDcxsJk7bwxTpNutj6JFIxcy2sS0rB2/0/t9GwatoEIXd8HV0qkXpdRow==" + }, "base64-arraybuffer": { "version": "1.0.2", "resolved": "https://registry.npmmirror.com/base64-arraybuffer/-/base64-arraybuffer-1.0.2.tgz", @@ -2402,6 +2465,21 @@ "react-router-dom": "^4.1.2", "react-router-redux": "5.0.0-alpha.9", "redux": "^3.7.2" + }, + "dependencies": { + "react-router-dom": { + "version": "4.3.1", + "resolved": "https://registry.npmmirror.com/react-router-dom/-/react-router-dom-4.3.1.tgz", + "integrity": "sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==", + "requires": { + "history": "^4.7.2", + "invariant": "^2.2.4", + "loose-envify": "^1.3.1", + "prop-types": "^15.6.1", + "react-router": "^4.3.1", + "warning": "^4.0.1" + } + } } }, "dva-core": { @@ -2699,6 +2777,15 @@ "dom-walk": "^0.1.0" } }, + "mini-create-react-context": { + "version": "0.3.3", + "resolved": "https://registry.npmmirror.com/mini-create-react-context/-/mini-create-react-context-0.3.3.tgz", + "integrity": "sha512-TtF6hZE59SGmS4U8529qB+jJFeW6asTLDIpPgvPLSCsooAwJS7QprHIFTqv9/Qh3NdLwQxFYgiHX5lqb6jqzPA==", + "requires": { + "@babel/runtime": "^7.12.1", + "tiny-warning": "^1.0.3" + } + }, "mini-store": { "version": "2.0.0", "resolved": "https://registry.npmmirror.com/mini-store/-/mini-store-2.0.0.tgz", @@ -3400,16 +3487,36 @@ } }, "react-router-dom": { - "version": "4.3.1", - "resolved": "https://registry.npmmirror.com/react-router-dom/-/react-router-dom-4.3.1.tgz", - "integrity": "sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==", + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/react-router-dom/-/react-router-dom-5.1.2.tgz", + "integrity": "sha512-7BPHAaIwWpZS074UKaw1FjVdZBSVWEk8IuDXdB+OkLb8vd/WRQIpA4ag9WQk61aEfQs47wHyjWUoUGGZxpQXew==", "requires": { - "history": "^4.7.2", - "invariant": "^2.2.4", + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", "loose-envify": "^1.3.1", - "prop-types": "^15.6.1", - "react-router": "^4.3.1", - "warning": "^4.0.1" + "prop-types": "^15.6.2", + "react-router": "5.1.2", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + }, + "dependencies": { + "react-router": { + "version": "5.1.2", + "resolved": "https://registry.npmmirror.com/react-router/-/react-router-5.1.2.tgz", + "integrity": "sha512-yjEuMFy1ONK246B+rsa0cUam5OeAQ8pyclRDgpxuSCrAlJ1qN9uZ5IgyKC7gQg0w8OM50NXHEegPh/ks9YuR2A==", + "requires": { + "@babel/runtime": "^7.1.2", + "history": "^4.9.0", + "hoist-non-react-statics": "^3.1.0", + "loose-envify": "^1.3.1", + "mini-create-react-context": "^0.3.0", + "path-to-regexp": "^1.7.0", + "prop-types": "^15.6.2", + "react-is": "^16.6.0", + "tiny-invariant": "^1.0.2", + "tiny-warning": "^1.0.0" + } + } } }, "react-router-redux": { diff --git a/package.json b/package.json index 1c4b3b4..91bd08d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "dependencies": { + "baidu-template-pro": "^1.0.0", "dom-to-image": "^2.6.0", "file-saver": "^2.0.5", "lodash": "^4.17.21", @@ -7,6 +8,7 @@ "rc-org-chart": "^1.0.6", "react-org-tree": "^1.0.0", "react-orgchart": "^1.0.5", + "react-router-dom": "5.1", "yargs": "^15.0.2" } } diff --git a/pc4backstage/integration/apis/Alymail.js b/pc4backstage/integration/apis/Alymail.js new file mode 100644 index 0000000..5006cfa --- /dev/null +++ b/pc4backstage/integration/apis/Alymail.js @@ -0,0 +1,27 @@ +import {WeaTools} from "ecCom"; + +//基本信息 +export const getForm = (params={}) => WeaTools.callApi("/api/integration/mail/getALYMailBaseSetForm", "POST", params); +export const getOperate = (params={}) => WeaTools.callApi("/api/integration/mail/getALYMailOperation", "POST", params); + +// 日志 +export const getLogMenus = (params={}) => WeaTools.callApi("/api/integration/mail/getMailLogRightMenu", "POST", params); +export const getLogCondition = (params={}) => WeaTools.callApi("/api/integration/mail/getMailLogCondition ", "POST", params); +export const getLogDatas = (params={}) => WeaTools.callApi("/api/integration/mail/getMailLogList", "POST", params); + +// 基础信息页面 +export const getMailList = (params={}) => WeaTools.callApi("/api/integration/mail/getMailList ", "POST", params); +export const getMailListConditions = (params={}) => WeaTools.callApi("/api/integration/mail/getMailListConditions ", "POST", params); +export const getMailSaveOperation = (params={}) => WeaTools.callApi("/api/integration/mail/getMailSaveOperation", "POST", params); +export const getMailOperation = (params={}) => WeaTools.callApi("/api/integration/mail/getMailOperation", "POST", params); +export const getMailDeleteOperation = (params={}) => WeaTools.callApi("/api/integration/mail/getMailDeleteOperation", "POST", params); +// mailMasterId: +export const getMailEditSetForm = (params={}) => WeaTools.callApi("/api/integration/mail/getMailEditSetForm", "POST", params); +// mailType:1 +export const getMailAddSetForm = (params={}) => WeaTools.callApi("/api/integration/mail/getMailAddSetForm", "POST", params); +// 切换下拉框 +export const getMailSelectSetForm = (params={}) => WeaTools.callApi("/api/integration/mail/getMailSelectSetForm", "POST", params); + +// 日志清理tab页 +export const getLogSettingFields = params => WeaTools.callApi(`/api/integration/mail/getMailLogSetting`, 'POST', params); +export const saveLogSetting = params => WeaTools.callApi(`/api/integration/mail/getMailLogSave`, 'POST', params); \ No newline at end of file diff --git a/pc4backstage/integration/apis/AuthenticationCenterService.js b/pc4backstage/integration/apis/AuthenticationCenterService.js new file mode 100644 index 0000000..880c444 --- /dev/null +++ b/pc4backstage/integration/apis/AuthenticationCenterService.js @@ -0,0 +1,59 @@ +import { WeaTools } from 'ecCom'; + +export const getBaseInfoForm = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getBaseInfoForm', 'POST', params); +}; +export const getBaseInfoFormOperation = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getBaseInfoFormOperation', 'POST', params); +}; +export const getRegisterAppList = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppList', 'POST', params); +}; +export const getRegisterAppRightMenu = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppRightMenu', 'POST', params); +}; +export const getRegisterAppEditForm = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppEditForm', 'POST', params); +}; +export const getRegisterAppOperation = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppOperation', 'POST', params); +}; +export const getRegisterAppDataMappingEditForm = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingEditForm', 'POST', params); +}; +export const getRegisterAppDataMappingImportForm = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingImportForm', 'POST', params); +}; +export const getRegisterAppDataMappingList = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingList', 'POST', params); +}; +export const getRegisterAppDataMappingRightMenu = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingRightMenu', 'POST', params); +}; +export const getRegisterAppDataMappingCondition = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingCondition', 'POST', params); +}; +export const getRegisterAppDataMappingOperation = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingOperation', 'POST', params); +}; +export const getRegisterAppLoginLogList = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppLoginLogList', 'POST', params); +}; +export const getRegisterAppLoginLogCondition = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppLoginLogCondition', 'POST', params); +}; +export const checkUserMappingLoginIdUnique = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/checkUserMappingLoginIdUnique', 'POST', params); +}; +export const checkUserMappingAppLoginIdUnique = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/checkUserMappingAppLoginIdUnique', 'POST', params); +}; +export const getRegisterAppShareList = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppShareList', 'POST', params); +}; +export const getRegisterAppShareForm = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppShareForm', 'POST', params); +}; +export const getRegisterAppCondition = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppCondition', 'POST', params); +}; \ No newline at end of file diff --git a/pc4backstage/integration/apis/AuthenticationSourceService.js b/pc4backstage/integration/apis/AuthenticationSourceService.js new file mode 100644 index 0000000..d24aa2f --- /dev/null +++ b/pc4backstage/integration/apis/AuthenticationSourceService.js @@ -0,0 +1,17 @@ +import { WeaTools } from 'ecCom'; + +export const getAuthenticationSourceList = params => { + return WeaTools.callApi('/api/integration/authenticationsource/getAuthenticationSourceList', 'POST', params); +}; +export const getAuthenticationSourceRightMenu = params => { + return WeaTools.callApi('/api/integration/authenticationsource/getAuthenticationSourceRightMenu', 'POST', params); +}; +export const getAuthenticationSourceCondition = params => { + return WeaTools.callApi('/api/integration/authenticationsource/getAuthenticationSourceCondition', 'POST', params); +}; +export const getAuthenticationSourceForm = params => { + return WeaTools.callApi('/api/integration/authenticationsource/getAuthenticationSourceForm', 'POST', params); +}; +export const getAuthenticationSourceOperation = params => { + return WeaTools.callApi('/api/integration/authenticationsource/getAuthenticationSourceOperation', 'POST', params); +}; \ No newline at end of file diff --git a/pc4backstage/integration/apis/Cas.js b/pc4backstage/integration/apis/Cas.js new file mode 100644 index 0000000..b65ee32 --- /dev/null +++ b/pc4backstage/integration/apis/Cas.js @@ -0,0 +1,16 @@ +import { WeaTools } from 'ecCom'; + +// 保存 +export const save = params => { + return WeaTools.callApi('/api/integration/cas/save', 'POST', params); +}; + +// 删除 +export const deleteAPI = params => { + return WeaTools.callApi('/api/integration/cas/delete', 'POST', params); +}; + +// 获取新建表单 +export const getForm = params => { + return WeaTools.callApi('/api/integration/cas/getForm', 'POST', params); +}; \ No newline at end of file diff --git a/pc4backstage/integration/apis/CommonService.js b/pc4backstage/integration/apis/CommonService.js new file mode 100644 index 0000000..a9921ca --- /dev/null +++ b/pc4backstage/integration/apis/CommonService.js @@ -0,0 +1,7 @@ +import { WeaTools } from 'ecCom'; + +export const checkTableFieldValueUnique = params => WeaTools.callApi('/api/integration/common1/checkTableFieldValueUnique', 'POST', params); +export const checkCasIsDeployed = params => WeaTools.callApi('/api/integration/common1/checkCasIsDeployed', 'POST', params); +export const checkValidateCode = params => WeaTools.callApi('/api/integration/common1/checkValidateCode', 'POST', params); +export const checkNonstandardStatus = params => WeaTools.callApi('/api/integration/common1/checkNonstandardStatus', 'GET', params); +export const checkIsHasOrganization = params => WeaTools.callApi('/api/common/hrmcommon/getManageDetachEnable', 'POST', params); diff --git a/pc4backstage/integration/apis/DataShowService.js b/pc4backstage/integration/apis/DataShowService.js new file mode 100644 index 0000000..9d137bc --- /dev/null +++ b/pc4backstage/integration/apis/DataShowService.js @@ -0,0 +1,98 @@ +import {WeaTools} from 'ecCom'; + +export const getDataShowList = params => { + return WeaTools.callApi('/api/integration/datashow/getDataShowList', 'POST', params); +}; + +export const getDataShowRightMenu = params => { + return WeaTools.callApi('/api/integration/datashow/getDataShowRightMenu', 'POST', params); +}; + +export const getDataShowCondition = params => { + return WeaTools.callApi('/api/integration/datashow/getDataShowCondition', 'POST', params); +}; + +export const getDataShowEditForm = params => { + return WeaTools.callApi('/api/integration/datashow/getDataShowEditForm', 'POST', params); +}; + + +export const getDataShowEditForm4E7 = params => { + return WeaTools.callApi('/api/integration/datashow/getDataShowEditForm4E7', 'POST', params); +}; + +export const getDataShowOperation4E7 = params => { + return WeaTools.callApi('/api/integration/datashow/getDataShowOperation4E7', 'POST', params); +}; + +export const getDataShowOperation = params => { + return WeaTools.callApi('/api/integration/datashow/getDataShowOperation', 'POST', params); +}; + +//获取测试的form +export const getDataShowTestForm = params => { + return WeaTools.callApi('/api/integration/datashow/getDataShowTestForm', 'POST', params); +}; + +//校验数据源是否可连接 +export const checkDataSource = params => { + return WeaTools.callApi('/api/integration/datashow/checkDataSource', 'POST', params); +}; +//校验数据库【查询SQL语句】是否能正常执行并返回查询结果 +export const checkSqlOrProc = params => { + return WeaTools.callApi('/api/integration/datashow/checkSqlOrProc', 'POST', params); +}; + +//判断数据库主键字段存不存在 +export const checkKeyField = params => { + return WeaTools.callApi('/api/integration/datashow/checkKeyField', 'POST', params); +}; + +//校验数据库【字段设置】中的【字段】项是否在【查询SQL语句】或【回显SQL语句】中存在 +export const checkFieldSetting = params => { + return WeaTools.callApi('/api/integration/datashow/checkFieldSetting', 'POST', params); +}; + +//校验数据库【字段设置】中的【转换方法】是否返回查询结果 +export const checkTranSql = params => { + return WeaTools.callApi('/api/integration/datashow/checkTranSql', 'POST', params); +}; + +//webservice接口返回内容是否是XML格式 +export const checkIsXmlDocument = params => { + return WeaTools.callApi('/api/integration/datashow/checkIsXmlDocument', 'POST', params); +}; + +//效验 自定义地址 是否可访问 +export const checkURLS = params => { + return WeaTools.callApi('/api/integration/datashow/checkURLS', 'POST', params); +}; + +//保存表单值 +export const saveFormParam = params => { + return WeaTools.callApi('/api/integration/datashow/saveFormParam', 'POST', params); +}; + +//查询参数form +export const getSqlTextForm = params => { + return WeaTools.callApi('/api/integration/datashow/getSqlTextForm', 'POST', params); +}; + +//获取首页的测试数据 +export const getIndexTest = (testId) => { + return WeaTools.callApi(`/api/integration/datashow/test/${testId}`, 'GET'); +}; + +// 缓存管理页面 +export const getDataShowCacheSetCondition = params => WeaTools.callApi('/api/integration/datashow/getDataShowCacheSetCondition', 'POST', params); +export const getDataShowCacheSetRightMenu = params => WeaTools.callApi('/api/integration/datashow/getDataShowCacheSetRightMenu', 'POST', params); +export const getDataShowCacheSetList = params => WeaTools.callApi('/api/integration/datashow/getDataShowCacheSetList', 'POST', params); +export const getDataShowCacheOperation = params => WeaTools.callApi('/api/integration/datashow/getDataShowCacheOperation', 'POST', params); + +// 缓存数据管理 +export const getDataShowCacheDataCondition = params => WeaTools.callApi('/api/integration/datashow/getDataShowCacheDataCondition', 'POST', params); +export const getDataShowCacheDataList = params => WeaTools.callApi('/api/integration/datashow/getDataShowCacheDataList', 'POST', params); +export const getDataShowCacheDataRightMenu = params => WeaTools.callApi('/api/integration/datashow/getDataShowCacheDataRightMenu', 'POST', params); + +// 缓存数据新建form接口 +export const getDataShowCacheDataForm = params => WeaTools.callApi('/api/integration/datashow/getDataShowCacheDataForm', 'POST', params); diff --git a/pc4backstage/integration/apis/Exchange.js b/pc4backstage/integration/apis/Exchange.js new file mode 100644 index 0000000..20e6bdc --- /dev/null +++ b/pc4backstage/integration/apis/Exchange.js @@ -0,0 +1,16 @@ +import { WeaTools } from 'ecCom' + +export const getBaseMenus = params => WeaTools.callApi('/api/integration/exchange/getExchangeRightMenu','POST', params); +export const getBaseInfoForm = params => WeaTools.callApi('/api/integration/exchange/GetFormCmd','GET', params); +export const getBaseInfoFormOperation = params => WeaTools.callApi('/api/integration/exchange/DoSaveCmd','POST', params); + +//log +export const getExchangeLogList = params => WeaTools.callApi('/api/integration/exchange/getExchangeLogList','POST', params); +export const getExchangeCondition = params => WeaTools.callApi('/api/integration/exchange/getExchangeCondition','POST', params); + +//USER +export const doSaveUserAndPwd = params => WeaTools.callApi('/api/integration/exchange/doSaveUserAndPwd','POST', params); +export const doOperationlimit = params => WeaTools.callApi('/api/integration/exchange/doOperationlimit','POST', params); + +//Range +export const getExchangelimitsList = params => WeaTools.callApi('/api/integration/exchange/getExchangelimitsList','POST', params); diff --git a/pc4backstage/integration/apis/HRSyncService.js b/pc4backstage/integration/apis/HRSyncService.js new file mode 100644 index 0000000..1ec55d2 --- /dev/null +++ b/pc4backstage/integration/apis/HRSyncService.js @@ -0,0 +1,74 @@ +import { WeaTools } from 'ecCom'; + +const getHrSyncSettingsForm = params => { + return WeaTools.callApi('/api/integration/hrsync/getHrSyncSettingsForm', 'POST', params); +}; +const getHrSyncSettingsRightMenu = params => { + return WeaTools.callApi('/api/integration/hrsync/getHrSyncSettingsRightMenu', 'POST', params); +}; +const getHrSyncSettingsOperation = params => { + return WeaTools.callApi('/api/integration/hrsync/getHrSyncSettingsOperation', 'POST', params, 'json', true); +} +const getHrSyncDataSyncForm = params => { + return WeaTools.callApi('/api/integration/hrsync/getHrSyncDataSyncForm', 'POST', params); +} + +const getHrSyncDataSyncRightMenu = params => { + return WeaTools.callApi('/api/integration/hrsync/getHrSyncDataSyncRightMenu', 'POST', params); +} + +const getHrSyncDataSyncOperation = params => { + return WeaTools.callApi('/api/integration/hrsync/getHrSyncDataSyncOperation', 'POST', params); +} + +const getHrSyncSettingsImportForm = params => { + return "";// WeaTools.callApi('/api/integration/hrsync/getHrSyncSettingsImportForm', 'POST', params); + +} + +// 日志高级搜索 +const getListConditions = params => { + return WeaTools.callApi('/api/integration/hrsync/getListConditions', 'POST', params); +} + +// 日志列表 +const getLogList = params => { + return WeaTools.callApi('/api/integration/hrsync/getLogList', 'POST', params); +} + +// 详情页列表 +const getLogDetailList = params => { + return WeaTools.callApi('/api/integration/hrsync/getLogDetailList', 'POST', params); +} + +// 详情页高级搜索 +const getLogDetailListConditions = params => { + return WeaTools.callApi('/api/integration/hrsync/getLogDetailListConditions', 'POST', params); +} + +// 详情页高级搜索 +const getLogTab = params => { + return WeaTools.callApi('/api/integration/hrsync/getLogTab', 'POST', params); +} + +const getRealError = params => { + return WeaTools.callApi('/api/integration/hrsync/getRealError', 'POST', params); +} + + + +export { + getHrSyncSettingsForm, + getHrSyncSettingsRightMenu, + getHrSyncSettingsOperation, + getHrSyncDataSyncForm, + getHrSyncDataSyncRightMenu, + getHrSyncDataSyncOperation, + getHrSyncSettingsImportForm, + getListConditions, + getLogList, + getLogDetailListConditions, + getLogDetailList, + getLogTab, + getRealError +} diff --git a/pc4backstage/integration/apis/Imrtx.js b/pc4backstage/integration/apis/Imrtx.js new file mode 100644 index 0000000..3801829 --- /dev/null +++ b/pc4backstage/integration/apis/Imrtx.js @@ -0,0 +1,24 @@ +import { WeaTools } from 'ecCom'; + +// 保存| 初始化 +export const save = (params, cb) => { + cb && cb(); + return WeaTools.callApi('/api/integration/imrtx/save', 'POST', params); +}; + +// 获取新建表单 +export const getForm = params => { + return WeaTools.callApi('/api/integration/imrtx/getForm', 'POST', params); +}; + +// 获取高级搜索条件 +export const getCondition = params => { + return WeaTools.callApi('/api/integration/imsynlog/getListConditions', 'POST', params); +}; + +// 获取列表 +export const getTable = params => { + return WeaTools.callApi('/api/integration/imsynlog/getLogList', 'POST', params); +}; + +export const getPassWord = params => WeaTools.callApi('/api/integration/imrtx/getPassWord', 'POST', params); \ No newline at end of file diff --git a/pc4backstage/integration/apis/LDAPInit.js b/pc4backstage/integration/apis/LDAPInit.js new file mode 100644 index 0000000..de2231b --- /dev/null +++ b/pc4backstage/integration/apis/LDAPInit.js @@ -0,0 +1,9 @@ +import {WeaTools} from 'ecCom'; + +export const getForm = (params) => { + return WeaTools.callApi("/api/integration/ldap/getDataMigrationForm", 'POST', params); +}; + +export const save = (params) => { + return WeaTools.callApi("/api/integration/ldap/dataMigration", 'POST', params); +}; \ No newline at end of file diff --git a/pc4backstage/integration/apis/Ldap.js b/pc4backstage/integration/apis/Ldap.js new file mode 100644 index 0000000..8fe5aa5 --- /dev/null +++ b/pc4backstage/integration/apis/Ldap.js @@ -0,0 +1,98 @@ +import {WeaTools} from 'ecCom'; + +//保存LDAP基础信息,type=add添加,type=edit修改 +export const saveBase = (type,params) => { + return WeaTools.callApi('/api/integration/ldap/' + type, 'POST', params); +}; + +//删除LDAP信息 +export const deleteLdap = (params) => { + return WeaTools.callApi('/api/integration/ldap/delete', 'POST', params); +}; + +//配置定时任务 +export const configSchedule = (params) => { + return WeaTools.callApi("/api/integration/ldap/schedule", 'POST', params); +}; + +//配置同步节点及映射信息 +export const configSync = (ldapId, type, params) => { + let url = ldapId + '/' + type; + return WeaTools.callApi('/api/integration/ldap/config/' + url + '/sync', 'POST', params); +}; + +//配置映射关系 +export const configMapping = (ldapId,type,params) => { + let url = ldapId + '/' + type; + return WeaTools.callApi('/api/integration/ldap/config/' + url + '/mapping', 'POST', params); +}; + +//获取模板信息 +export const getTemplate = (type) => { + return WeaTools.callApi('/api/integration/ldap/template/' + type, 'GET', {}); +}; + +//获取数据转换方法信息 +export const getFormart = (type) => { + return WeaTools.callApi('/api/integration/ldap/formart/' + type, 'GET', {}); +}; + +//执行同步 +export const runSync = (ldapId,type,params) => { + let url = type + '/' + ldapId; + return WeaTools.callApi('/api/integration/ldap/' + url, 'POST',params); +}; + +//查看同步日志 +export const showSyncLog = (ldapId,params) =>{ + return WeaTools.callApi('/api/integration/ldap/synclog/' + ldapId, 'GET',params); +} + +export const getBase = (ldapId, type) => { + return WeaTools.callApi(`/api/integration/ldap/test/${ldapId}/${type}`, 'GET'); +}; + +//获取基础信息维护控件 +export const getFields = (apiUrl, params) => { + return WeaTools.callApi(apiUrl + '/getFields', 'GET', params); +} + +//获取右键菜单 +export const getRightMenu = (apiUrl, params) => { + return WeaTools.callApi(apiUrl + '/getRightMenu', 'GET', params); +}; + +//删除LDAP自定义接口信息 +export const deleteCustomInterface = (params) => { + return WeaTools.callApi('/api/integration/ldap/deleteCustomInterface', 'POST', params); +}; + +//保存LDAP自定义接口基础信息,type=addCustomInterface添加,type=editCustomInterface修改 +export const saveCustomInterfaceBase = (type,params) => { + return WeaTools.callApi('/api/integration/ldap/' + type, 'POST', params); +}; + +//删除LDAP同步日志接口信息 +export const deleteLdapSyncLog = (params) => { + return WeaTools.callApi('/api/integration/ldap/deleteSyncLogs', 'POST', params); +}; + +// 指定部门确定接口 +export const updateUserInfo = (params) => { + return WeaTools.callApi('/api/integration/ldap/updateUserInfo', 'POST', params); +} + +// 合并用户确定接口 +export const mergeUserInfo = (params) => { + return WeaTools.callApi('/api/integration/ldap/mergeUserInfo', 'POST', params); +} + +// 批量合并点击测试 +export const getTestMatchData = (params) => { + return WeaTools.callApi('/api/integration/ldap/getTestMatchData', 'POST', params); +} + +// 批量合并点击合并 +export const batchMergeUserInfo = (params) => { + return WeaTools.callApi('/api/integration/ldap/batchMergeUserInfo', 'POST', params); +} \ No newline at end of file diff --git a/pc4backstage/integration/apis/NC.js b/pc4backstage/integration/apis/NC.js new file mode 100644 index 0000000..3706c9c --- /dev/null +++ b/pc4backstage/integration/apis/NC.js @@ -0,0 +1,5 @@ +import { WeaTools } from 'ecCom' + +export const getMenuList = params => { + return WeaTools.callApi('/api/integration/productmenu/getMenuList','GET', params); +} \ No newline at end of file diff --git a/pc4backstage/integration/apis/OAuth2Service.js b/pc4backstage/integration/apis/OAuth2Service.js new file mode 100644 index 0000000..8a49833 --- /dev/null +++ b/pc4backstage/integration/apis/OAuth2Service.js @@ -0,0 +1,53 @@ +import { WeaTools } from 'ecCom'; + +export const getBaseInfoForm = params => { + return WeaTools.callApi('/api/integration/oauth2_client/getBaseInfoForm', 'POST', params); +}; +export const getBaseInfoFormOperation = params => { + return WeaTools.callApi('/api/integration/oauth2_client/getBaseInfoFormOperation', 'POST', params); +}; +export const doTest = params => { + return WeaTools.callApi('/api/integration/oauth2_client/doTest', 'POST', params); +}; +// export const getRegisterAppList = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppList', 'POST', params); +// }; +// export const getRegisterAppRightMenu = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppRightMenu', 'POST', params); +// }; +// export const getRegisterAppEditForm = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppEditForm', 'POST', params); +// }; +// export const getRegisterAppOperation = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppOperation', 'POST', params); +// }; +// export const getRegisterAppDataMappingEditForm = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingEditForm', 'POST', params); +// }; +// export const getRegisterAppDataMappingImportForm = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingImportForm', 'POST', params); +// }; +// export const getRegisterAppDataMappingList = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingList', 'POST', params); +// }; +// export const getRegisterAppDataMappingRightMenu = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingRightMenu', 'POST', params); +// }; +// export const getRegisterAppDataMappingCondition = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingCondition', 'POST', params); +// }; +// export const getRegisterAppDataMappingOperation = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingOperation', 'POST', params); +// }; +// export const getRegisterAppLoginLogList = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppLoginLogList', 'POST', params); +// }; +// export const getRegisterAppLoginLogCondition = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppLoginLogCondition', 'POST', params); +// }; +// export const checkUserMappingLoginIdUnique = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/checkUserMappingLoginIdUnique', 'POST', params); +// }; +// export const checkUserMappingAppLoginIdUnique = params => { +// return WeaTools.callApi('/api/integration/authenticationcenter/checkUserMappingAppLoginIdUnique', 'POST', params); +// }; \ No newline at end of file diff --git a/pc4backstage/integration/apis/SamlService.js b/pc4backstage/integration/apis/SamlService.js new file mode 100644 index 0000000..7cea3d6 --- /dev/null +++ b/pc4backstage/integration/apis/SamlService.js @@ -0,0 +1,20 @@ +import { WeaTools } from 'ecCom'; + +export const getBaseInfoForm = params => { + return WeaTools.callApi('/api/integration/saml/getBaseInfoForm', 'POST', params); +}; +export const getBaseInfoFormOperation = params => { + return WeaTools.callApi('/api/integration/saml/getBaseInfoFormOperation', 'POST', params); +}; + +export const getDetailInfoForm = params => { + return WeaTools.callApi('/api/integration/saml/getDetailInfoForm', 'POST', params); +}; +export const getDetailInfoFormOperation = params => { + return WeaTools.callApi('/api/integration/saml/getDetailInfoFormOperation', 'POST', params); +}; + +export const getConfigurationResult = params => { + return WeaTools.callApi('/api/integration/saml/getConfigurationResult', 'POST', params); +}; + diff --git a/pc4backstage/integration/apis/Schedule.js b/pc4backstage/integration/apis/Schedule.js new file mode 100644 index 0000000..8ca7d27 --- /dev/null +++ b/pc4backstage/integration/apis/Schedule.js @@ -0,0 +1,92 @@ +import { WeaTools } from "ecCom"; + +// ./api/integration/web/Schedule?methed=? + +// methed: +// 根据标识(即id) 删除计划任务:getDelateScheduleById +// 查询计划任务:getFindSchedule +// 检查 用户及计划任务类:doCheckSchedule +// 批量删除计划任务:getBatchDel +// 编辑计划任务:doEditSchedule +// 添加计划任务:doAddSchedule + +const API = { + getFormRightMenus: params => + WeaTools.callApi( + "/api/integration/schedule/getFormRightMenus", + "POST", + params + ), + getListRightMenus: params => + WeaTools.callApi( + "/api/integration/schedule/getListRightMenus", + "POST", + params + ), + getList: params => + WeaTools.callApi("/api/integration/schedule/getList", "POST", params), + getListConditions: params => + WeaTools.callApi( + "/api/integration/schedule/getListConditions", + "POST", + params + ), + getForm: params => + WeaTools.callApi("/api/integration/schedule/getForm", "POST", params), + insert: params => + WeaTools.callApi("/api/integration/schedule/insert", "POST", params, "json", true), + update: params => + WeaTools.callApi("/api/integration/schedule/update", "POST", params), + delete: params => + WeaTools.callApi("/api/integration/schedule/delete", "POST", params), + batchDelete: params => + WeaTools.callApi("/api/integration/schedule/batchDelete", "POST", params), + getListConditions: params => + WeaTools.callApi("/api/integration/schedule/getListConditions", "POST", params), + // 系统日志 + getSelectLog: params => + WeaTools.callApi("/api/integration/schedule/getSelectLog", "POST", params), + // 运行日志 + doRunLog: params => + WeaTools.callApi("/api/integration/schedule/doRunLog", "POST", params), + // 运行日志 search advance + getLogListConditions: params => + WeaTools.callApi("/api/integration/schedule/getLogListConditions", "POST", params), + // 系统日志 + getSysLog: params => + WeaTools.callApi("/api/common/log/viewexp", "POST", params), + getdata: params => + WeaTools.callApi("/api/common/log/getdata", "GET", params), + trans: params => + WeaTools.callApi("/api/common/log/audit/trans", "GET", params), + getSysLogConditions: params => + WeaTools.callApi("/api/common/log/view", "POST", params), + // 运行 + start: params => + WeaTools.callApi("/api/integration/schedule/start", "POST", params), + // 禁止 + stop: params => + WeaTools.callApi("/api/integration/schedule/stop", "POST", params), + // 禁止 + pause: params => + WeaTools.callApi("/api/integration/schedule/pause", "POST", params), + // 禁止 + resume: params => + WeaTools.callApi("/api/integration/schedule/resume", "POST", params), + getTriggerList: params => + WeaTools.callApi("/api/integration/schedule/triggerList", "POST", params), + getScheduleRunLogCondition: params => + WeaTools.callApi("/api/integration/schedule/getScheduleRunLogCondition", "POST", params), + getScheduleMonitorCondition: params => + WeaTools.callApi("/api/integration/schedule/getScheduleMonitorCondition", "POST", params), + getScheduleSysLogCondition: params => + WeaTools.callApi("/api/integration/schedule/getScheduleSysLogCondition", "POST", params), + immediatelyRun: params => + WeaTools.callApi("/api/integration/schedule/immediatelyRun", "POST", params), + test: params => + WeaTools.callApi("/api/integration/schedule/test", "POST", params), + viewDetail: params => + WeaTools.callApi("/api/common/log/viewdetail", 'GET', params) +}; + +export default API; diff --git a/pc4backstage/integration/apis/TencentMailService.js b/pc4backstage/integration/apis/TencentMailService.js new file mode 100644 index 0000000..c953d3a --- /dev/null +++ b/pc4backstage/integration/apis/TencentMailService.js @@ -0,0 +1,29 @@ +import {WeaTools} from 'ecCom'; + +export const getTencentMailList = params => { + return WeaTools.callApi('/api/integration/tencentmail/getTencentMailList', 'POST', params); +}; +export const getTencentMailRightMenu = params => { + return WeaTools.callApi('/api/integration/tencentmail/getTencentMailRightMenu', 'POST', params); +}; +export const getTencentMailCondition = params => { + return WeaTools.callApi('/api/integration/tencentmail/getTencentMailCondition', 'POST', params); +}; +export const getBaseSetForm = params => { + return WeaTools.callApi('/api/integration/tencentmail/getBaseSetForm', 'POST', params); +}; +export const getTencentMailAddForm = params => { + return WeaTools.callApi('/api/integration/tencentmail/getTencentMailAddForm', 'POST', params); +}; +export const getTencentMailOperation = params => { + return WeaTools.callApi('/api/integration/tencentmail/getTencentMailOperation', 'POST', params); +}; +export const getTencentMailLogList = params => { + return WeaTools.callApi('/api/integration/tencentmail/getTencentMailLogList', 'POST', params); +}; +export const getTencentMailLogRightMenu = params => { + return WeaTools.callApi('/api/integration/tencentmail/getTencentMailLogRightMenu', 'POST', params); +}; +export const getTencentMailLogCondition = params => { + return WeaTools.callApi('/api/integration/tencentmail/getTencentMailLogCondition', 'POST', params); +}; diff --git a/pc4backstage/integration/apis/TodoCenterService.js b/pc4backstage/integration/apis/TodoCenterService.js new file mode 100644 index 0000000..5b365cb --- /dev/null +++ b/pc4backstage/integration/apis/TodoCenterService.js @@ -0,0 +1,100 @@ +import { WeaTools } from 'ecCom'; + +export const getOfsInfoList = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoList', 'POST', params); +}; +export const getOfsInfoRightMenu = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoRightMenu', 'POST', params); +}; +export const getOfsInfoCondition = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoCondition', 'POST', params); +}; +export const getWorkflowList = params => { + return WeaTools.callApi('/api/integration/todocenter/getWorkflowList', 'POST', params); +}; +export const getWorkflowRightMenu = params => { + return WeaTools.callApi('/api/integration/todocenter/getWorkflowRightMenu', 'POST', params); +}; +export const getWorkflowCondition = params => { + return WeaTools.callApi('/api/integration/todocenter/getWorkflowCondition', 'POST', params); +}; +export const getOfsLogList = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsLogList', 'POST', params); +}; +export const getOfsLogCondition = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsLogCondition', 'POST', params); +}; +export const getOfsSettingForm = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsSettingForm', 'POST', params); +}; +export const getOfsSettingOperation = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsSettingOperation', 'POST', params); +}; +export const getWorkflowViewForm = params => { + return WeaTools.callApi('/api/integration/todocenter/getWorkflowViewForm', 'POST', params); +}; +export const getWorkflowOperation = params => { + return WeaTools.callApi('/api/integration/todocenter/getWorkflowOperation', 'POST', params); +}; +export const getOfsInfoAddForm = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoAddForm', 'POST', params); +}; +export const getOfsInfoOperation = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoOperation', 'POST', params); +}; +export const getOfsInfoLogList = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoLogList', 'POST', params); +}; +export const getOfsInfoLogRightMenu = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoLogRightMenu', 'POST', params); +}; +export const getOfsInfoLogCondition = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoLogCondition', 'POST', params); +}; +export const getOfsInfoWorkflowList = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoWorkflowList', 'POST', params); +}; +export const getOfsInfoWorkflowRightMenu = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoWorkflowRightMenu', 'POST', params); +}; +export const getOfsInfoWorkflowCondition = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoWorkflowCondition', 'POST', params); +}; +export const getOfsInfoWorkflowTypeList = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoWorkflowTypeList', 'POST', params); +}; +export const getOfsInfoWorkflowTypeRightMenu = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoWorkflowTypeRightMenu', 'POST', params); +}; +export const getOfsInfoWorkflowTypeCondition = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoWorkflowTypeCondition', 'POST', params); +}; +export const getOfsInfoWorkflowTypeEditForm = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoWorkflowTypeEditForm', 'POST', params); +}; +export const getOfsInfoWorkflowTypeOperation = params => { + return WeaTools.callApi('/api/integration/todocenter/getOfsInfoWorkflowTypeOperation', 'POST', params); +}; +export const getofsWorkflowShareList = params => { + return WeaTools.callApi('/api/integration/todocenter/getofsWorkflowShareList', 'POST', params); +}; +export const getofsWorkflowShareForm = params => { + return WeaTools.callApi('/api/integration/todocenter/getofsWorkflowShareForm', 'POST', params); +}; +export const getNetworkIPColumnsSet = () => { + return WeaTools.callApi('/api/integration/todocenter/getNetworkIPColumnsSet', 'POST'); +}; + +//短信提醒 +export const getSmstemplate = params => WeaTools.callApi('/api/integration/todocenter/getSmstemplate', 'POST', params); +export const resetSmstemplate = params => WeaTools.callApi('/api/integration/todocenter/resetSmstemplate', 'POST', params); +export const saveSmstemplate = params => WeaTools.callApi('/api/integration/todocenter/saveSmstemplate', 'POST', params); +// 自定义 +export const getOfsCustomDefinition = params => WeaTools.callApi('/api/integration/todocenter/getOfsCustomDefinition', 'POST', params); +export const saveOfsCustomDefinition = params => WeaTools.callApi('/api/integration/todocenter/ofsCustomDefinitionOperation', 'POST', params); +// 流程注册 +export const getWorkflowViewFormEdit = params => WeaTools.callApi('/api/integration/todocenter/getWorkflowViewFormEdit', 'POST', params); +export const ReceiveRequestInfoByJson = params => WeaTools.callApi('/rest/ofs/ReceiveRequestInfoByJson', 'POST', params, "text"); +export const OfsHrmResourceTransfer = params => WeaTools.callApi('/api/integration/todocenter/OfsHrmResourceTransfer', 'POST', params); +export const OfsDataOperation = params => WeaTools.callApi('/api/integration/todocenter/OfsDataOperation', 'POST', params); + diff --git a/pc4backstage/integration/apis/TodoClientService.js b/pc4backstage/integration/apis/TodoClientService.js new file mode 100644 index 0000000..d5f9ed0 --- /dev/null +++ b/pc4backstage/integration/apis/TodoClientService.js @@ -0,0 +1,32 @@ +import { WeaTools } from 'ecCom'; + +export const getOfsSendList = params => { + return WeaTools.callApi('/api/integration/todoclient/getOfsSendList', 'POST', params); +}; +export const getOfsSendRightMenu = params => { + return WeaTools.callApi('/api/integration/todoclient/getOfsSendRightMenu', 'POST', params); +}; +export const getOfsSendCondition = params => { + return WeaTools.callApi('/api/integration/todoclient/getOfsSendCondition', 'POST', params); +}; +export const getOfsSendForm = params => { + return WeaTools.callApi('/api/integration/todoclient/getOfsSendForm', 'POST', params); +}; +export const getOfsSendOperation = params => { + return WeaTools.callApi('/api/integration/todoclient/getOfsSendOperation', 'POST', params); +}; +export const getOfsSendWhiteWorkflowList = params => { + return WeaTools.callApi('/api/integration/todoclient/getOfsSendWhiteWorkflowList', 'POST', params); +}; +export const getOfsSendWhiteHrmList = params => { + return WeaTools.callApi('/api/integration/todoclient/getOfsSendWhiteHrmList', 'POST', params); +}; +export const getOfsSendWhiteWorkflowForm = params => { + return WeaTools.callApi('/api/integration/todoclient/getOfsSendWhiteWorkflowForm', 'POST', params); +}; +export const getAuth = params => { + return WeaTools.callApi('/api/integration/todoclient/isAll', 'POST', params); + +}; +export const getOfsSendMessageTypeForm = params => WeaTools.callApi('/api/integration/todoclient/getOfsSendMessageTypeForm', 'POST', params); +export const getOfsSendMessageTypeOperationCmd = params => WeaTools.callApi('/api/integration/todoclient/getOfsSendMessageTypeOperationCmd', 'POST', params); \ No newline at end of file diff --git a/pc4backstage/integration/apis/Webservice.js b/pc4backstage/integration/apis/Webservice.js new file mode 100644 index 0000000..119db27 --- /dev/null +++ b/pc4backstage/integration/apis/Webservice.js @@ -0,0 +1,46 @@ +import { WeaTools } from "ecCom"; + +// 高级搜索 +export const getConditions = params => { + return WeaTools.callApi("/api/integration/webservice/getListConditions", "POST", params); +}; + +// 分页列表 +export const getList = params => { + return WeaTools.callApi("/api/integration/webservice/getList", "POST", params); +}; + +// 右键菜单 +export const getRightMenu = params => { + return WeaTools.callApi("/api/integration/webservice/getListRightMenus", "POST", params); +}; + +//新建表单保存、删除按钮 +export const getFormRightMenus = params => { + return WeaTools.callApi("/api/integration/webservice/getFormRightMenus", "POST", params); +}; + +// 获取新建表单 +export const getForm = params => { + return WeaTools.callApi("/api/integration/webservice/getForm", "POST", params); +}; + +//删除 +export const delList = params => { + return WeaTools.callApi("/api/integration/webservice/batchDelete", "POST", params); +} + +//解析WSDL/检查更新 +export const parseWSDL = params => { + return WeaTools.callApi("/api/integration/webservice/parseWSDL", "POST", params); +} + +//测试 +export const doTest = params => { + return WeaTools.callApi("/api/integration/webservice/doTest", "POST", params); +} + +//保存 +export const doSave = params => { + return WeaTools.callApi('/api/integration/webservice/doSave','POST',params); +} \ No newline at end of file diff --git a/pc4backstage/integration/apis/WhiteListService.js b/pc4backstage/integration/apis/WhiteListService.js new file mode 100644 index 0000000..1eff259 --- /dev/null +++ b/pc4backstage/integration/apis/WhiteListService.js @@ -0,0 +1,82 @@ +import { WeaTools } from 'ecCom'; + +export const getRegisterFilterList = params => { + return WeaTools.callApi('/api/integration/whitelist/getRegisterFilterList', 'POST', params); +}; +export const getWhiteList = params => { + return WeaTools.callApi('/api/integration/whitelist/getWhiteList', 'POST', params); +}; +export const getBaseInfoForm = params => { + return WeaTools.callApi('/api/integration/whitelist/getBaseInfoForm', 'POST', params); +}; +export const getBaseInfoFormOperation = params => { + return WeaTools.callApi('/api/integration/whitelist/getBaseInfoFormOperation', 'POST', params); +}; +export const getRegisterFilterForm = params => { + return WeaTools.callApi('/api/integration/whitelist/getRegisterFilterForm', 'POST', params); +}; +export const getRegisterFilterFormOperation = params => { + return WeaTools.callApi('/api/integration/whitelist/getRegisterFilterFormOperation', 'POST', params); +}; +export const getRegisterFilterRightMenu = params => { + return WeaTools.callApi('/api/integration/whitelist/getRegisterFilterRightMenu', 'POST', params); +}; +export const getWhiteListRightMenu = params => { + return WeaTools.callApi('/api/integration/whitelist/getWhiteListRightMenu', 'POST', params); +}; +export const getBaseInfoCondition = params => { + return WeaTools.callApi('/api/integration/whitelist/getBaseInfoCondition', 'POST', params); +}; +export const getRegisterFilterCondition = params => { + return WeaTools.callApi('/api/integration/whitelist/getRegisterFilterCondition', 'POST', params); +}; +export const getWhiteListMappingOperation = params => { + return WeaTools.callApi('/api/integration/whitelist/getWhiteListMappingOperation', 'POST', params); +}; +export const getRegisterFilterSelectedWhiteList = params => { + return WeaTools.callApi('/api/integration/whitelist/getRegisterFilterSelectedWhiteList', 'POST', params); +}; +export const getRegisterFilterId = params => { + return WeaTools.callApi('/api/integration/whitelist/getRegisterFilterId', 'POST', params); +}; +export const getRegisterFilterisValid = params => { + return WeaTools.callApi('/api/integration/whitelist/getRegisterFilterisValid', 'POST', params); +}; + +//以下暂不使用 +export const getRegisterAppEditForm = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppEditForm', 'POST', params); +}; +export const getRegisterAppOperation = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppOperation', 'POST', params); +}; +export const getRegisterAppDataMappingEditForm = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingEditForm', 'POST', params); +}; +export const getRegisterAppDataMappingImportForm = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingImportForm', 'POST', params); +}; +export const getRegisterAppDataMappingList = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingList', 'POST', params); +}; +export const getRegisterAppDataMappingRightMenu = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingRightMenu', 'POST', params); +}; +export const getRegisterAppDataMappingCondition = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingCondition', 'POST', params); +}; +export const getRegisterAppDataMappingOperation = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppDataMappingOperation', 'POST', params); +}; +export const getRegisterAppLoginLogList = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppLoginLogList', 'POST', params); +}; +export const getRegisterAppLoginLogCondition = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/getRegisterAppLoginLogCondition', 'POST', params); +}; +export const checkUserMappingLoginIdUnique = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/checkUserMappingLoginIdUnique', 'POST', params); +}; +export const checkUserMappingAppLoginIdUnique = params => { + return WeaTools.callApi('/api/integration/authenticationcenter/checkUserMappingAppLoginIdUnique', 'POST', params); +}; \ No newline at end of file diff --git a/pc4backstage/integration/apis/WorkflowArchiveService.js b/pc4backstage/integration/apis/WorkflowArchiveService.js new file mode 100644 index 0000000..6e4aa4f --- /dev/null +++ b/pc4backstage/integration/apis/WorkflowArchiveService.js @@ -0,0 +1,115 @@ +import {WeaTools} from 'ecCom'; + +export const getArchiveRegisterList = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterList', 'POST', params); +}; +export const getArchiveRegisterRightMenu = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterRightMenu', 'POST', params); +}; +export const getArchiveRegisterCondition = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterCondition', 'POST', params); +}; +export const getArchiveLogList = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveLogList', 'POST', params); +}; +export const getArchiveLogRightMenu = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveLogRightMenu', 'POST', params); +}; +export const getArchiveLogCondition = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveLogCondition', 'POST', params); +}; +export const getArchiveConfigFTPList = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigFTPList', 'POST', params); +}; +export const getArchiveConfigFTPRightMenu = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigFTPRightMenu', 'POST', params); +}; +export const getArchiveConfigLocalList = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigLocalList', 'POST', params); +}; +export const getArchiveConfigLocalRightMenu = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigLocalRightMenu', 'POST', params); +}; +export const getArchiveConfigDatabaseList = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigDatabaseList', 'POST', params); +}; +export const getArchiveConfigDatabaseRightMenu = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigDatabaseRightMenu', 'POST', params); +}; +export const getArchiveConfigSchemeList = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigSchemeList', 'POST', params); +}; +export const getArchiveConfigSchemeRightMenu = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigSchemeRightMenu', 'POST', params); +}; +export const getArchiveRegisterAddForm = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterAddForm', 'POST', params); +}; +export const getArchiveRegisterEditForm = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterEditForm', 'POST', params); +}; +export const getArchiveRegisterEditFormFieldXMLMapping = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterEditFormFieldXMLMapping', 'POST', params); +}; +export const getArchiveRegisterEditFormFieldDBMapping = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterEditFormFieldDBMapping', 'POST', params); +}; +export const getArchiveRegisterEditFormLogList = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterEditFormLogList', 'POST', params); +}; +export const getArchiveRegisterEditFormLogCondition = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterEditFormLogCondition', 'POST', params); +}; +export const getArchiveRegisterEditFormLogRightMenu = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterEditFormLogRightMenu', 'POST', params); +}; +export const getArchiveRegisterOperation = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveRegisterOperation', 'POST', params); +}; +export const getArchiveConfigFTPAddForm = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigFTPAddForm', 'POST', params); +}; +export const getArchiveConfigFTPEditForm = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigFTPEditForm', 'POST', params); +}; +export const getArchiveConfigFTPOperation = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigFTPOperation', 'POST', params); +}; +export const getArchiveConfigLocalAddForm = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigLocalAddForm', 'POST', params); +}; +export const getArchiveConfigLocalEditForm = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigLocalEditForm', 'POST', params); +}; +export const getArchiveConfigLocalOperation = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigLocalOperation', 'POST', params); +}; +export const getArchiveConfigDatabaseAddForm = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigDatabaseAddForm', 'POST', params); +}; +export const getArchiveConfigDatabaseEditForm = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigDatabaseEditForm', 'POST', params); +}; +export const getArchiveConfigDatabaseOperation = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigDatabaseOperation', 'POST', params); +}; +export const getArchiveConfigSchemeAddFormXML = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigSchemeAddFormXML', 'POST', params); +}; +export const getArchiveConfigSchemeEditFormXML = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigSchemeEditFormXML', 'POST', params); +}; +export const getArchiveConfigSchemeOperationXML = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigSchemeOperationXML', 'POST', params); +}; +export const getArchiveConfigSchemeAddFormDB = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigSchemeAddFormDB', 'POST', params); +}; +export const getArchiveConfigSchemeEditFormDB = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigSchemeEditFormDB', 'POST', params); +}; +export const getArchiveConfigSchemeOperationDB = params => { + return WeaTools.callApi('/api/integration/workflowarchive/getArchiveConfigSchemeOperationDB', 'POST', params); +}; + + diff --git a/pc4backstage/integration/apis/WorkflowFlowService.js b/pc4backstage/integration/apis/WorkflowFlowService.js new file mode 100644 index 0000000..9d1df82 --- /dev/null +++ b/pc4backstage/integration/apis/WorkflowFlowService.js @@ -0,0 +1,200 @@ +import { WeaTools } from 'ecCom'; + + +// 流程接口注册高级搜索 +export const getInterfaceRegisterCondition = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterCondition', 'POST', params); +}; + +// 流程接口部署高级搜索 +export const getInterfaceDeploymentCondition = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceDeploymentCondition', 'POST', params); +}; + +// 右键菜单 +export const getRightMenus = (params,param) => { + let api = "/api/integration/workflowflow/getInterfaceDeploymentRightMenu"; + if(params===0) { + api = "/api/integration/workflowflow/getInterfaceRegisterRightMenu"; + } + return WeaTools.callApi(api, 'POST', param); +}; + +// 流程接口注册列表 +export const getInterfaceRegisterList = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterList', 'POST', params); +} +// 流程接口部署列表 +export const getInterfaceDeploymentList = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceDeploymentList', 'POST', params); +} + + +// 流程接口注册DML表单 +export const getInterfaceRegisterDMLAddForm = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterDMLAddForm', 'POST', params); +} +export const getInterfaceRegisterDMLEditForm = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterDMLEditForm', 'POST', params); +} +// 流程接口注册Webservice表单 +export const getInterfaceRegisterWebserviceAddForm = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterWebserviceAddForm', 'POST', params); +} +export const getInterfaceRegisterWebserviceOperation = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterWebserviceOperation', 'POST', params); +} + +//注册ESB表单 +export const getInterfaceRegisterESBAddForm = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterESBAddForm', 'POST', params); +} + +//根据ESB服务id和version获取对应的分页列表数据 +export const getESBPublishParam = params => { + return WeaTools.callApi('/api/integration/workflowflow/getESBPublishParam', 'POST', params); +} + +//根据传入的esbid和版本以及actionid获取规则数据 +export const getESBReturnContralDatas = params => { + return WeaTools.callApi('/api/integration/workflowflow/getESBReturnContralData', 'POST', params); +} + +//根据传入的规则id删除ESB返回控制规则 +export const deleteESBReturnContralData = params => { + return WeaTools.callApi('/api/integration/workflowflow/deleteESBReturnContralData', 'POST', params); +} + +//ESB接口增删改提交动作处理 +export const getInterfaceRegisterESBOperation = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterESBOperation', 'POST', params); +} + +//根据参数获取对应的下拉选项ESB +export const getlinkageSelectForESB = params => { + return WeaTools.callApi('/api/integration/workflowflow/getlinkageSelectForESB', 'POST', params); +} + +// 注册DML接口增删改提交动作处理 +export const getInterfaceRegisterDMLOperation = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterDMLOperation', 'POST', params); +} + +export const getInterfaceRegisterCustomOperation = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterCustomOperation', 'POST', params); +} +export const getInterfaceDeploymentOperation = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceDeploymentOperation', 'POST', params); +} +export const getInterfaceRegisterCustomAddForm = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterCustomAddForm', 'POST', params); +} +export const getInterfaceRegisterCustomAddFormOnline = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterCustomAddFormOnline', 'POST', params); +} +export const getInterfaceRegisterRunLogList = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterRunLogList', 'POST', params); +} +export const getInterfaceRegisterRunLogCondition = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceRegisterRunLogCondition', 'POST', params); +} +export const getInterfaceDeploymentAddForm = params => { + return WeaTools.callApi('/api/integration/workflowflow/getInterfaceDeploymentAddForm', 'POST', params); +} + +export const getDataShowOperation = params => { + return WeaTools.callApi('/api/integration/datashow/getDataShowOperation', 'POST', params); +}; + + +// ESB + +export const getESBRightMenu = params => { + return WeaTools.callApi('/api/integration/esbaction/base/getFQRightMenu', 'GET', params); +} + +export const getESBFields = params => { + return WeaTools.callApi('/api/integration/esbaction/base/getFields', 'GET', params); +} + +export const getESBRequestDatas = params => { + return WeaTools.callApi('/api/integration/esbaction/getEventRequestData', 'GET', params); +} + +export const getESBDetailFields = params => { + return WeaTools.callApi('/api/integration/esbaction/base/getDetailFields', 'GET', params); +} + +export const getSelectData = params => { + return WeaTools.callApi('/api/integration/esbaction/getSelectData', 'GET', params); +} + +export const getWorkflowMainFields = params => { + return WeaTools.callApi('/api/integration/esbaction/base/getMainFields', 'GET', params); +} + +export const saveAction = params => { + return WeaTools.callApi('/api/integration/esbaction/saveAction', 'POST', params); +} + +export const delectAction = params => { + return WeaTools.callApi('/api/integration/esbaction/deleteAction', 'POST', params); +} + +export const checkEsbService = params => { + return WeaTools.callApi('/api/integration/esbaction/checkEsbService', 'GET', params); +} + +//获取测试结果信息 +export const getBase = (type,testId) => { + return WeaTools.callApi(`/api/integration/workflowaction/test/${type}/${testId}`, 'GET'); +}; + +//获取预览信息 +export const getPreview = (type,testId) => { + return WeaTools.callApi(`/api/integration/workflowaction/test/preview/${type}/${testId}`, 'GET'); +}; + +//获取基础信息维护控件 +export const getFields = (apiUrl, params) => { + return WeaTools.callApi(apiUrl + '/getFields', 'GET', params); +}; +//获取右键菜单 +export const getRightMenu = (apiUrl, params) => { + return WeaTools.callApi(apiUrl + '/getRightMenu', 'GET', params); +}; + + +//获取右键菜单 +export const getRightMenu2 = (apiUrl, params) => { + return WeaTools.callApi(apiUrl + '/getRightMenu2', 'GET', params); +}; + +//保存表单参数 +export const saveParam =(params,type,testId)=>{ + return WeaTools.callApi(`/api/integration/workflowaction/test/saveParam/${type}/${testId}`, 'POST', params); +}; + +//检测表单参数 +export const checkHasParam=(type,testId)=>{ + return WeaTools.callApi(`/api/integration/workflowaction/test/checkHasParam/${type}/${testId}`, 'POST'); +}; + +// 建模对接 +export const getFormModuleField = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/base/getFields', 'GET', params); +export const getFormModuleMainFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/base/getMainFields', 'GET', params); +export const getFormModuleSelectData = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/getSelectData', 'GET', params); +export const getFormModuleDetailFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/base/getDetailFields', 'GET', params); +export const getFormModuleFunFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/base/getFunFields', 'GET', params); +export const getFormModuleSave = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/saveAction', 'POST', params); +export const getFormModuleAutoMappingFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/automapping/getFields', 'GET', params); +export const getFormModuleAutoMapping = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/getTableFields', 'GET', params); +export const getFormModuleRequestDatas = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/getEventRequestData', 'GET', params); +// 字段联动 +export const getFormModuleFieldInfo = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/base/getFields', 'GET', params); +export const getFormModuleFieldSelectData = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/getSelectData', 'GET', params); +export const getFormModuleFieldMainFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/base/getMainFields', 'GET', params); +export const getFormModuleFieldDetailFields = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/base/getDetailFields', 'GET', params); +export const getFormModuleFieldSave = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/saveAction', 'POST', params); +export const getFormModuleFieldRequestDatas = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/getEventRequestData', 'GET', params); +export const getFormModuleFieldAutoMapping = (params) => WeaTools.callApi('/api/integration/formmodule/esbaction/field/getTableFields', 'GET', params); diff --git a/pc4backstage/integration/apis/WorkflowTriggerService.js b/pc4backstage/integration/apis/WorkflowTriggerService.js new file mode 100644 index 0000000..7a2292e --- /dev/null +++ b/pc4backstage/integration/apis/WorkflowTriggerService.js @@ -0,0 +1,44 @@ +import {WeaTools} from 'ecCom'; + +export const getTriggerList = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerList', 'POST', params); +}; +export const getTriggerRightMenu = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerRightMenu', 'POST', params); +}; +export const getTriggerCondition = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerCondition', 'POST', params); +}; +export const getTriggerIntervalSetForm = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerIntervalSetForm', 'POST', params); +}; +export const getTriggerAddForm = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerAddForm', 'POST', params); +}; +export const getTriggerEditDetailForm = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerEditDetailForm', 'POST', params); +}; +export const getTriggerOperation = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerOperation', 'POST', params); +}; +export const getTriggerTest = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerTest', 'POST', params); +}; +export const getTriggerCheckWorkflowForm = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerCheckWorkflowForm', 'POST', params); +}; +export const getTriggerLogList = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerLogList', 'POST', params); +}; +export const getTriggerLogRightMenu = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerLogRightMenu', 'POST', params); +}; +export const getTriggerLogCondition = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerLogCondition', 'POST', params); +}; +export const getTriggerResetFormFieldMapping = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerResetFormFieldMapping', 'POST', params); +}; +export const getTriggerEditDetailAttachmentSetForm = params => { + return WeaTools.callApi('/api/integration/workflowtrigger/getTriggerEditDetailAttachmentSetForm', 'POST', params); +}; diff --git a/pc4backstage/integration/apis/accountSetting.js b/pc4backstage/integration/apis/accountSetting.js new file mode 100644 index 0000000..b621c28 --- /dev/null +++ b/pc4backstage/integration/apis/accountSetting.js @@ -0,0 +1,28 @@ +import { WeaTools } from 'ecCom'; + +// 所有账号的显示页面 +const getForm = params => { + return WeaTools.callApi('/api/integration/accountsetting/getForm', 'POST', params); +}; + +// 保存接口 +const doSave = params => { + return WeaTools.callApi('/api/integration/accountsetting/doSave', 'POST', params); +}; + +// 单个账号的显示页面 +const getSysid = id => { + return WeaTools.callApi(`/api/integration/accountsetting/${id}`, 'GET'); +} + +// 右键菜单 +const getRightMenu = params => { + return WeaTools.callApi('/api/integration/accountsetting/getRightMenu', 'POST', params); +} + +export { + getForm, + doSave, + getSysid, + getRightMenu +} \ No newline at end of file diff --git a/pc4backstage/integration/apis/coremail.js b/pc4backstage/integration/apis/coremail.js new file mode 100644 index 0000000..52bba2f --- /dev/null +++ b/pc4backstage/integration/apis/coremail.js @@ -0,0 +1,93 @@ +import { WeaTools } from 'ecCom'; + +const Method = { + Post: "POST", + Get: "GET" +} + +const APIList = [{ + // 基础信息(表单信息) + name: "getFields", + path: "/coremail/base/getFields", + type: Method.Get +}, { + // 基础信息菜单信息(标题、按钮等信息) + name: "baseGetRightMenu", + path: "/coremail/base/getRightMenu", + type: Method.Get +}, { + // 同步日志列表 + name: "getDatas", + path: "/coremail/log/getDatas", + type: Method.Get +}, { + // 同步日志菜单信息(标题,按钮等信息) + name: "logGetRightMenu", + path: "/coremail/log/getRightMenu", + type: Method.Get +}, { + // 同步日志高级查询表单 + name: "getCondition", + path: "/coremail/log/getCondition", + type: Method.Get +}, { + name: "init", + path: "/newcoremail/init", + type: Method.Post +}, { + name: "test", + path: "/newcoremail/test", + type: Method.Post +}, { + name: "save", + path: "/newcoremail/save", + type: Method.Post +}, { + name: "getCoreMailList", + path: "/newcoremail/getCoreMailList", + type: Method.Post +}, { + name: "getCoreMailRightMenu", + path: "/newcoremail/getCoreMailRightMenu", + type: Method.Post +}, { + name: "getCoremailMailAddForm", + path: "/newcoremail/getCoremailMailAddForm", + type: Method.Post +}, { + name: "getCoreMailSaveOperation", + path: "/newcoremail/getCoreMailSaveOperation", + type: Method.Post +}, { + name: "getCoreMailCondition", + path: "/newcoremail/getCoreMailCondition", + type: Method.Post +}, { + name: "getCoreMailDelete", + path: "/newcoremail/getCoreMailDelete", + type: Method.Post +} , { + name: "getCoreMailOperation", + path: "/newcoremail/getCoreMailOperation", + type: Method.Post +} +] + +const API = (function () { + const Obj = {}; + APIList.map(item => { + Obj[item.name] = (params) => { + return WeaTools.callApi(`/api/integration${item.path}`, item.type, params); + } + }) + return Obj; +})(); + + +API.view = params => { + return WeaTools.callApi('/api/common/log/view', 'POST', params); +} + + +export default API; + diff --git a/pc4backstage/integration/apis/dataSource.js b/pc4backstage/integration/apis/dataSource.js new file mode 100644 index 0000000..46f1546 --- /dev/null +++ b/pc4backstage/integration/apis/dataSource.js @@ -0,0 +1,117 @@ +import { WeaTools } from "ecCom"; + +const Method = { + post: "POST", + get: "GET" +}; + +const datasource = [ + { + name: "getFormRightMenus", + type: Method.post + }, + { + name: "getList", + type: Method.post + }, + { + name: "insert", + type: Method.post + }, + { + name: "update", + type: Method.post + }, + { + name: "delete", + type: Method.post + }, + { + name: "getForm", + type: Method.post + }, + { + name: "batchDelete", + type: Method.post + }, + { + name: "getListConditions", + type: Method.post + }, + { + name: "getListRightMenus", + type: Method.post + }, + { + name: "test", + type: Method.post + }, + { + name: "listTest", + type: Method.post + }, + { + name: "getIsCluster", + type: Method.post + } +]; + +const datasourcetype = [ + { + name: "getFormRightMenus", + type: Method.post + }, + { + name: "getList", + type: Method.post + }, + { + name: "insert", + type: Method.post + }, + { + name: "update", + type: Method.post + }, + { + name: "delete", + type: Method.post + }, + { + name: "getForm", + type: Method.post + }, + { + name: "batchDelete", + type: Method.post + }, +]; + +const API = () => { + const objDatasource = {}; + datasource.map(item => { + objDatasource[item.name] = params => + WeaTools.callApi( + `/api/integration/datasource/${item.name}`, + item.type, + params + ); + }); + + const objDatasourcetype = {}; + datasourcetype.map(item => { + objDatasourcetype[item.name] = params => + WeaTools.callApi( + `/api/integration/datasourcetype/${item.name}`, + item.type, + params + ); + }); + + return { + datasource: objDatasource, + datasourcetype: objDatasourcetype + }; +}; + +export default API(); diff --git a/pc4backstage/integration/apis/delegateClient.js b/pc4backstage/integration/apis/delegateClient.js new file mode 100644 index 0000000..665bd0f --- /dev/null +++ b/pc4backstage/integration/apis/delegateClient.js @@ -0,0 +1,12 @@ +import { WeaTools } from 'ecCom'; + +// 获取form表单 +const getBaseInfoForm = params => WeaTools.callApi('/api/integration/delegate_client/getBaseInfoForm', 'POST', params); + +// 对form表单操作的接口 +const getBaseInfoOperation = params => WeaTools.callApi('/api/integration/delegate_client/getBaseInfoFormOperation', 'POST', params); + +export { + getBaseInfoForm, + getBaseInfoOperation +} \ No newline at end of file diff --git a/pc4backstage/integration/apis/login.js b/pc4backstage/integration/apis/login.js new file mode 100644 index 0000000..0e9393b --- /dev/null +++ b/pc4backstage/integration/apis/login.js @@ -0,0 +1,68 @@ +import { + WeaTools +} from 'ecCom' + +export const getAuth = (params) => { + return WeaTools.callApi('/api/integration/Outter/operateUserRight', 'POST', params); +} + +export const operateSysForm = (params) => { + return WeaTools.callApi('/api/integration/Outter/operateSysForm', 'POST', params); +} + +//测试预览 +export const getPreviewUrl = (params) => { + return WeaTools.callApi('/api/integration/OutterLogin/getPreviewUrl', 'POST', params); +}; + +export const operateEncryptForm = (params) => { + return WeaTools.callApi('/api/integration/Outter/operateEncryptForm', 'POST', params); +} + +export const getOutterSysList = (params) => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysList', 'POST', params); +} + +export const getOutterEncryptList = (params) => { + return WeaTools.callApi('/api/integration/Outter/getOutterEncryptList', 'POST', params); +} + +export const getDefaultEntranceUrl = (params) => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysDefaultEntranceUrl', 'POST', params); +} + +export const operateShareForm = (params) => { + return WeaTools.callApi('/api/integration/Outter/operateShareForm', 'POST', params); +} + +export const getCustomEncryptClass = (params) => { + return WeaTools.callApi('/api/integration/Outter/GetCustomEncryptClass', 'POST', params); +} + +export const getOutterSysIsNeedPwdAndIv = (params) => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysIsNeedPwdAndIv', 'POST', params); +} + +export const checkTableFieldValueUnique = (params) => { + return WeaTools.callApi('/api/integration/common1/checkTableFieldValueUnique', 'POST', params); +} + +export const getNetworkIPColumnsSet = () => { + return WeaTools.callApi('/api/integration/todocenter/getNetworkIPColumnsSet', 'POST'); +}; + +export const createSecretKey = () => { + return WeaTools.callApi('/api/integration/Outter/createSecretKey', 'POST'); +}; + +export const getOutterTypeList = (params) => { + return WeaTools.callApi('/api/integration/Outter/getOutterTypeList', 'POST', params); +}; + +export const getOutterTypeShowOrder = (params) => { + return WeaTools.callApi('/api/integration/Outter/getOutterTypeShowOrder', 'POST', params); +}; + +export const operateTypeForm = (params) => { + return WeaTools.callApi('/api/integration/Outter/operateTypeForm', 'POST', params); +}; \ No newline at end of file diff --git a/pc4backstage/integration/apis/outter.js b/pc4backstage/integration/apis/outter.js new file mode 100644 index 0000000..c8e547e --- /dev/null +++ b/pc4backstage/integration/apis/outter.js @@ -0,0 +1,59 @@ +import {WeaTools} from 'ecCom'; + +export const getOutterSysList = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysList', 'POST', params); +}; +export const getOutterSysShareList = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysShareList', 'POST', params); +}; +export const getOutterEncryptList = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterEncryptList', 'POST', params); +}; +export const getOutterSysRightMenu = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysRightMenu', 'POST', params); +}; +export const getOutterEncryptRightMenu = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterEncryptRightMenu', 'POST', params); +}; +export const getOutterSysNewForm = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysNewForm', 'POST', params); +}; +export const getOutterSysIpAddressOperates = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysIpAddressOperates', 'POST', params); +}; +export const getOutterSysTypeNameOperates = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysTypeNameOperates', 'POST', params); +}; +export const getOutterSysEncryptTypeOperates = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysEncryptTypeOperates', 'POST', params); +}; +export const getOutterSysEncryptClassOperates = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysEncryptClassOperates', 'POST', params); +}; +export const getOutterSysIsNeedPwdAndIv = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysIsNeedPwdAndIv', 'POST', params); +}; +export const getOutterSysDefaultEntranceUrl = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysDefaultEntranceUrl', 'POST', params); +}; +export const getOutterSysShowOrder = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysShowOrder', 'POST', params); +}; +export const operateOutterEncrypt = params => { + return WeaTools.callApi('/api/integration/Outter/operateOutterEncrypt', 'POST', params); +}; +export const getOutterEncryptEditForm = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterEncryptEditForm', 'POST', params); +}; +export const getOutterEncryptClassTestForm = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterEncryptClassTestForm', 'POST', params); +}; +export const GetCustomEncryptClass = params => { + return WeaTools.callApi('/api/integration/Outter/GetCustomEncryptClass', 'POST', params); +}; +export const operateOutterSys = params => { + return WeaTools.callApi('/api/integration/Outter/operateOutterSys', 'POST', params); +}; +export const getOutterSysEditForm = params => { + return WeaTools.callApi('/api/integration/Outter/getOutterSysEditForm', 'POST', params); +}; \ No newline at end of file diff --git a/pc4backstage/integration/apis/webseal.js b/pc4backstage/integration/apis/webseal.js new file mode 100644 index 0000000..beb38f7 --- /dev/null +++ b/pc4backstage/integration/apis/webseal.js @@ -0,0 +1,16 @@ +import { WeaTools } from 'ecCom'; + +// 保存 +export const save = params => { + return WeaTools.callApi('/api/integration/webseal/save', 'POST', params); +}; + +// 提交 +export const complete = params => { + return WeaTools.callApi('/api/integration/webseal/submit', 'POST', params); +}; + +// 获取新建表单 +export const getForm = params => { + return WeaTools.callApi('/api/integration/webseal/getForm', 'POST', params); +}; \ No newline at end of file diff --git a/pc4backstage/integration/components/CoremailPortal.js b/pc4backstage/integration/components/CoremailPortal.js new file mode 100644 index 0000000..36c2883 --- /dev/null +++ b/pc4backstage/integration/components/CoremailPortal.js @@ -0,0 +1,122 @@ +import React, {Component} from 'react'; +import {inject, observer} from "mobx-react"; +import {toJS} from 'mobx'; +import {Table} from 'antd'; +import {WeaLocaleProvider} from "ecCom"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("coremailPortal") +@observer +class Main extends Component { + componentDidMount() { + const {from, coremailPortal} = this.props; + let params = {}; + if (from == 'portal') { + params = this.props.params; + coremailPortal.init('/api/integration/coremail/datas/top', params.esetting); + } else { + params = JSON.parse(this.props.location.query.jsonstr); + // 获取location 的参数走接口; + coremailPortal.init('/api/integration/coremail/datas/more', params.esetting); + } + // 根据配置信息设置columns + let fieldcolumnList = ['subject', 'coreMailUser', 'createtime']; + // let fieldcolumnList = ['coreMailTitle', 'coreMailUser', 'coreMailTime']; + if (params && params.fieldcolumnList) { + fieldcolumnList = params.fieldcolumnList + } + + let fieldcolumnwidths = { + subject: '30%', + coreMailUser: '30%', + createtime: '30%', + } + + if (params && params.fieldcolumnwidths) { + fieldcolumnwidths = params.fieldcolumnwidths; + } + + let eContentHintText = '您有 $NoReadCnt$ 封未读邮件,$LoginLinkStart$请登录查看$LoginLinkEnd$!'; + let eContentUnreadMailQuantityColor = 'red'; + let eContentSingleSignOnLinkColor = 'red'; + if (params && params.esetting) { + const {esetting} = params; + if (esetting.eContentHintText) { + eContentHintText = esetting.eContentHintText; + } + + if (esetting.eContentUnreadMailQuantityColor) { + eContentUnreadMailQuantityColor = esetting.eContentUnreadMailQuantityColor; + eContentSingleSignOnLinkColor = esetting.eContentSingleSignOnLinkColor; + } + } + + + const state = { + columns: this.getColums(fieldcolumnList, fieldcolumnwidths), + eContentHintText, + eContentUnreadMailQuantityColor, + eContentSingleSignOnLinkColor, + } + coremailPortal.setState(state); + } + + getColums(fieldcolumnList, fieldcolumnwidths) { + const names = { + subject: getLabel(344, '主题'), + coreMailUser: getLabel(129935, '发送人'), + createtime: getLabel(129936, '发送时间'), + } + let columns = []; + fieldcolumnList && fieldcolumnList.forEach((item) => { + let col = { + key: item, + dataIndex: item, + title: names[item], + width: fieldcolumnwidths[item], + } + if ('subject' == item) { + col.render = (text, record, index) => {text} + } + columns.push(col); + }) + return columns; + } + + renderText(state = {}, res = {}) { + let text = state.eContentHintText.replace('$NoReadCnt$', + `${res.unReadCount}`) + .replace('$LoginLinkStart$', + ``) + .replace('$LoginLinkEnd$', ''); + return
+ } + + render() { + const {coremailPortal} = this.props; + const {loaded} = coremailPortal; + // const state = toJS(coremailPortal.state); + const res = toJS(coremailPortal.res); + + return (
+ { + loaded && !res.status &&
res.ext && window.open(res.ext)} + > + {res.error} +
+ } + { + loaded && res.status &&
+ {this.renderText(coremailPortal.state, res.data)} + + + } + ); + } +} + +export default Main; + diff --git a/pc4backstage/integration/components/CustomClient.js b/pc4backstage/integration/components/CustomClient.js new file mode 100644 index 0000000..42267ea --- /dev/null +++ b/pc4backstage/integration/components/CustomClient.js @@ -0,0 +1,125 @@ +// import React, { Component } from 'react'; +// import { +// WeaTableEditable +// } from "ecCom"; + +// export default class CustomClient extends Component { +// constructor(props) { +// super(props); +// props.getInstance && props.getInstance(this); +// this.state = { +// datas: [ +// { +// id: "1", +// textarea: "50", +// datepicker: "2018-07-11", +// check: "0", +// }, +// { +// id: "2", +// textarea: "50", +// datepicker: "2017-07-11", +// check: "1", +// } +// ], +// title: ["Demo"], +// /* ======================= 列配置数据 ======================= */ +// columns: [ +// { +// title: ( +// +// WeaTextarea +// +// ), +// rowSpan: 2, +// width: "6%", +// dataIndex: "textarea", +// com: [ +// { +// type: "TEXTAREA", +// key: "textarea", +// hasHiddenField: true, +// defaultValue: "defaultValue" +// } +// ] +// }, +// { +// title: ( +// +// WeaDatePicker +// +// ), +// rowSpan: 1, +// dataIndex: "datepicker", +// com: [{ type: "DATEPICKER", key: "datepicker" }] +// }, +// { +// title: ( +// +// check +// +// ), +// dataIndex: "check", +// com: [{ type: "checkbox", key: "check" }] +// } +// ], +// showTitle: true, +// showCopy: false, +// showCollapse: true, +// buttonsType: "inline", +// } +// } + +// onSave = () => { +// const { +// datas=[] +// } = this.state; + +// // 做自己的保存的操作 +// console.log('do self save operation'); +// // 添加span,最终在第三个步骤条显示的是span +// let newDatas = datas.map(data => { +// data && Object.keys(data) && Object.keys(datas).forEach(key => { +// if(key === "check") { +// data[`${key}span`] = (data[key] == '1' ? 'Y' : 'N'); +// } +// }) +// return data; +// }) +// return { +// rowKeys: (this.props && this.props.datas) ? this.props.datas : [], // 选中的文件keys +// datas: newDatas || [] //需要回显在第三步“选择”列的数据 +// } +// } + +// onCancel = () => { + +// // 做自己清除的操作 +// console.log('do self clean operation'); + +// return { +// rowKeys: [], // 选中的文件keys +// datas: [] //需要回显在第三步“选择”列的数据 +// }; +// } + +// render() { +// return ( +//
+// {/* 可通过 this.props 获取传递过来的参数 this.props.datas */} +//
+// { +// this.props.datas +// ? JSON.stringify(this.props.datas) +// : "" +// } +//
+// {/* 要展示的内容 */} +// this.setState({datas})} +// /> +//
+// ) +// } +// } diff --git a/pc4backstage/integration/components/CustomClient/index.js b/pc4backstage/integration/components/CustomClient/index.js new file mode 100644 index 0000000..893c8e9 --- /dev/null +++ b/pc4backstage/integration/components/CustomClient/index.js @@ -0,0 +1,555 @@ +// import React, { Component } from 'react'; +// import { +// WeaTableEditable, +// WeaLocaleProvider, +// WeaCheckbox, +// WeaHelpfulTip, +// WeaTools, +// } from "ecCom"; +// import './index.less'; + +// const {getLabel} = WeaLocaleProvider; + +// export default class CustomClient extends Component { +// constructor(props) { +// super(props); +// props.getInstance && props.getInstance(this); +// this.state = { +// titles: [], +// datas: props.datas || [], +// tableInfo: { +// rowKey: "fileid", +// title: ["CUSTOMPAGE"], +// showTitle: true, +// showCopy: false, +// showCollapse: true, +// buttonsType: "inline", +// showCollapse: true, +// showAdd: false, +// showDelete: false +// }, +// viewColumns: [{ +// title: getLabel(0, "名称"), +// width: "20%", +// dataIndex: "name", +// com: [ +// { +// type: "INPUT", +// key: "name", +// viewAttr: 1 +// } +// ] +// }, { +// title: +// {getLabel(0, "导入类型")} +// +// , +// width: "15%", +// dataIndex: "importtype", +// com: [ +// { +// type: "SELECT", +// key: "importtype", +// viewAttr: 1, +// options: [ +// { key: "0", showname: getLabel(0, "新增") }, +// { key: "1", showname: getLabel(0, "更新") } +// ] +// } +// ] +// }, { +// title: getLabel(0, "是否创建表单"), +// width: "10%", +// dataIndex: "createForm", +// com: [ +// { +// type: "CHECKBOX", +// key: "createForm", +// display: "switch", +// viewAttr: 1, +// defaultValue: "0", +// helpfulTip: getLabel(507312, '使用系统中原有对应表单新增路径')+","+getLabel(509522, '只对自定义表单生效'), +// } +// ] +// }, { +// title: getLabel(509448, "需要更新的路径"), +// width: "25%", +// dataIndex: "workflowid", +// com: [ +// { +// type: "BROWSER", +// key: "workflowid", +// browserConditionParam: { type: -99991 }, +// viewAttr: 1, +// } +// ] +// }, { +// title: +// {getLabel(0, "导入基础数据")} +// +// , +// width: "10%", +// dataIndex: "importBase", +// com: [ +// { +// type: "CHECKBOX", +// key: "importBase", +// display: "switch", +// defaultValue: "0", +// viewAttr: 1, +// } +// ] +// }, { +// title: +// {getLabel(0, "导入集成数据")} +// +// , +// dataIndex: "importIntegration", +// width: "10%", +// com: [ +// { +// type: "checkbox", +// key: "importIntegration", +// display: "switch", +// viewAttr: 1, +// defaultValue: "0" +// } +// ] +// }], +// columns: [{ +// title: getLabel(0, "名称"), +// width: "20%", +// dataIndex: "name", +// com: [ +// { +// type: "INPUT", +// key: "name", +// viewAttr: 1 +// } +// ] +// }, { +// title: +// {getLabel(0, "导入类型")} +// +// , +// width: "15%", +// dataIndex: "importtype", +// com: [ +// { +// type: "SELECT", +// key: "importtype", +// options: [ +// { key: "0", showname: getLabel(0, "新增") }, +// { key: "1", showname: getLabel(0, "更新") } +// ] +// } +// ] +// }, { +// title: getLabel(0, "是否创建表单"), +// width: "10%", +// dataIndex: "createForm", +// com: [ +// { +// type: "CHECKBOX", +// key: "createForm", +// display: "switch", +// defaultValue: "0", +// } +// ] +// }, { +// title: getLabel(509448, "需要更新的路径"), +// width: "25%", +// dataIndex: "workflowid", +// com: [ +// { +// type: "BROWSER", +// key: "workflowid", +// browserConditionParam: { type: -99991 }, +// viewAttr: 1, +// } +// ] +// }, { +// title: +// {getLabel(0, "导入基础数据")} +// +// , +// width: "10%", +// dataIndex: "importBase", +// com: [ +// { +// type: "CHECKBOX", +// key: "importBase", +// display: "switch", +// defaultValue: "0" +// } +// ] +// }, { +// title: +// {getLabel(0, "导入集成数据")} +// +// , +// dataIndex: "importIntegration", +// width: "10%", +// com: [ +// { +// type: "checkbox", +// key: "importIntegration", +// display: "switch", +// defaultValue: "0" +// } +// ] +// }], +// selectedRowKeys: [], +// createFormRead: { +// workflowid: { +// com: [{ +// type: "BROWSER", +// key: "workflowid", +// browserConditionParam: { type: -99991 }, +// viewAttr: 2 +// }] +// }, +// createForm: { +// com: [{ +// type: "CHECKBOX", +// key: "createForm", +// display: "switch", +// defaultValue: "0", +// viewAttr: 1, +// helpfulTip: getLabel(507312, '使用系统中原有对应表单新增路径')+","+getLabel(509522, '只对自定义表单生效') +// }] +// } +// }, +// } +// } + +// componentDidMount() { +// WeaTools.callApi('/api/workflow/workflowImport/getImportNewForm', 'POST').then(result => { +// if(result.titles) { +// this.setState({ +// titles: result.titles || [], +// viewColumns: [{ +// title: getLabel(0, "名称"), +// width: "20%", +// dataIndex: "name", +// com: [ +// { +// type: "INPUT", +// key: "name", +// viewAttr: 1 +// } +// ] +// }, { +// title: +// {getLabel(0, "导入类型")} +// +// , +// width: "15%", +// dataIndex: "importtype", +// com: [ +// { +// type: "SELECT", +// key: "importtype", +// viewAttr: 1, +// options: [ +// { key: "0", showname: getLabel(0, "新增") }, +// { key: "1", showname: getLabel(0, "更新") } +// ] +// } +// ] +// }, { +// title: getLabel(0, "是否创建表单"), +// width: "10%", +// dataIndex: "createForm", +// com: [ +// { +// type: "CHECKBOX", +// key: "createForm", +// display: "switch", +// viewAttr: 1, +// defaultValue: "0", +// helpfulTip: getLabel(507312, '使用系统中原有对应表单新增路径')+","+getLabel(509522, '只对自定义表单生效'), +// } +// ] +// }, { +// title: getLabel(509448, "需要更新的路径"), +// width: "25%", +// dataIndex: "workflowid", +// com: [ +// { +// type: "BROWSER", +// key: "workflowid", +// browserConditionParam: { type: -99991 }, +// viewAttr: 1, +// } +// ] +// }, { +// title: +// {getLabel(0, "导入基础数据")} +// +// , +// width: "10%", +// dataIndex: "importBase", +// com: [ +// { +// type: "CHECKBOX", +// key: "importBase", +// display: "switch", +// defaultValue: "0", +// viewAttr: 1, +// } +// ] +// }, { +// title: +// {getLabel(0, "导入集成数据")} +// +// , +// dataIndex: "importIntegration", +// width: "10%", +// com: [ +// { +// type: "checkbox", +// key: "importIntegration", +// display: "switch", +// viewAttr: 1, +// defaultValue: "0" +// } +// ] +// }], +// columns: [{ +// title: getLabel(0, "名称"), +// width: "20%", +// dataIndex: "name", +// com: [ +// { +// type: "INPUT", +// key: "name", +// viewAttr: 1 +// } +// ] +// }, { +// title: +// {getLabel(0, "导入类型")} +// +// , +// width: "15%", +// dataIndex: "importtype", +// com: [ +// { +// type: "SELECT", +// key: "importtype", +// options: [ +// { key: "0", showname: getLabel(0, "新增") }, +// { key: "1", showname: getLabel(0, "更新") } +// ] +// } +// ] +// }, { +// title: getLabel(0, "是否创建表单"), +// width: "10%", +// dataIndex: "createForm", +// com: [ +// { +// type: "CHECKBOX", +// key: "createForm", +// display: "switch", +// defaultValue: "0", +// } +// ] +// }, { +// title: getLabel(509448, "需要更新的路径"), +// width: "25%", +// dataIndex: "workflowid", +// com: [ +// { +// type: "BROWSER", +// key: "workflowid", +// browserConditionParam: { type: -99991 }, +// viewAttr: 1, +// } +// ] +// }, { +// title: +// {getLabel(0, "导入基础数据")} +// +// , +// width: "10%", +// dataIndex: "importBase", +// com: [ +// { +// type: "CHECKBOX", +// key: "importBase", +// display: "switch", +// defaultValue: "0" +// } +// ] +// }, { +// title: +// {getLabel(0, "导入集成数据")} +// +// , +// dataIndex: "importIntegration", +// width: "10%", +// com: [ +// { +// type: "checkbox", +// key: "importIntegration", +// display: "switch", +// defaultValue: "0" +// } +// ] +// }], +// }) +// } +// }) +// } + +// componentWillReceiveProps(nextProps) { +// this.setState({ +// datas: nextProps.datas, +// selectedRowKeys: [] +// }) +// }; + +// onSave = () => { +// const { +// datas, +// tableInfo, +// selectedRowKeys=[] +// } = this.state, { +// rowKey +// } = tableInfo; + +// let saveDatas = []; +// datas && datas.forEach(data => { +// if(selectedRowKeys.includes(data[rowKey])) { +// saveDatas.push(data); +// } +// }) +// return { +// datas: saveDatas, +// } +// } + +// getColumns = (columns=[]) => { +// columns && columns.forEach((column, index) => { +// if(column.dataIndex === "createForm") { +// columns[index].com = [{ +// type: 'CUSTOM', +// key: column.dataIndex, +// render: (text, record, index, onEdit) => { +// return
+// onEdit({ record, index, key: column.dataIndex, value })} +// /> +// { +// record[column.dataIndex] != '1' +// ? +// : null +// } +//
; +// } +// }]; +// } +// }) +// return columns; +// } + +// getCells = (datas=[]) => { +// const { +// createFormRead, +// } = this.state; + +// let cells = []; + +// datas && datas.forEach(data => { +// if(data.importtype == '1') { +// cells.push({ +// fileid: data.fileid, +// ...createFormRead +// }) +// } +// }) +// return cells; +// } + +// willEdit = (datas=[], editData) => { +// const { +// key, +// value, +// index, +// } = editData; + +// if(key === "importtype") { +// if(value == '0') { +// datas[index] = { +// ...datas[index], +// workflowid: "", +// updatePathInput: "" //需要到时候看传递的数据格式怎么约定 +// } +// }else if(value == '1') { +// datas[index] = { +// ...datas[index], +// createForm: "0" +// } +// } +// }else if(key === "workflowid") { +// const {browserDatas=[]} = editData; +// if(browserDatas && browserDatas.length) { +// const {id="", name=""} = browserDatas[0]; +// datas[index] = { +// ...datas[index], +// updatePathInput: name, +// workflowid: id +// } +// } +// } +// this.setState({datas}); +// } + +// // 重新渲染数据 +// renderDatas = (datas=[]) => { +// return datas && datas.map(data => { +// return { +// ...data, +// workflowidspan: data.updatePathInput +// } +// }) +// } + +// render() { +// const { +// datas, +// columns, +// viewColumns +// } = this.state; + +// return ( +// this.willEdit(datas, editData)} +// onRowSelect={selectedRowKeys => { +// this.setState({selectedRowKeys}); +// }} +// getRowSelection={v => { +// if(this.props.viewAttr == 1) { +// return false; +// } +// }} +// onChange={(datas) => { +// this.setState({ +// datas +// }); +// }} +// /> +// ) +// } +// } diff --git a/pc4backstage/integration/components/CustomClient/index.less b/pc4backstage/integration/components/CustomClient/index.less new file mode 100644 index 0000000..f348f9b --- /dev/null +++ b/pc4backstage/integration/components/CustomClient/index.less @@ -0,0 +1,10 @@ +// div.inte-type-custom-page{ +// tbody.ant-table-tbody { +// span.wea-helpful-tip { +// position: relative !important; +// right: -10px !important; +// top: 0px !important; +// // margin-left: 5px; +// } +// } +// } \ No newline at end of file diff --git a/pc4backstage/integration/components/Exchange/NewShare.js b/pc4backstage/integration/components/Exchange/NewShare.js new file mode 100644 index 0000000..81ee674 --- /dev/null +++ b/pc4backstage/integration/components/Exchange/NewShare.js @@ -0,0 +1,306 @@ +import React, { Component } from 'react'; +import { + WeaDialog, + WeaRightMenu, + WeaFormItem, + WeaLocaleProvider +} from "ecCom"; +import { + WeaSwitch +} from "comsMobx"; +import { + inject, + observer +} from "mobx-react"; +import {toJS} from "mobx"; +import { + Button +} from "antd"; +import { + onCheck +} from "../../util/IntegrationUtil"; + +const {getLabel} = WeaLocaleProvider; + +@inject("ExchangeStore") +@observer +export default class NewShare extends Component { + getRightMenus = () => { + return [{ + type: "primary", + key: "BTN_SAVE", + icon: , + content: getLabel(30986, '保存'), + onClick: () => this.onMenuClick("BTN_SAVE") + }]; + } + + getBtns = () => { + return []; + } + + hideShareField = (params) => { + const { + permissiontype, + jobtitlelevel, + } = params; + + let temp; + + if (permissiontype == '1') { + temp = ['sharevalue6', 'sharevalue5', 'sharevalue2', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '6') { + temp = ['sharevalue1', 'sharevalue5', 'sharevalue2', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '3') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue2', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '5') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue2', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '2') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '7') { + if (jobtitlelevel == '1') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue2', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (jobtitlelevel == '2') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue2', 'jobtitlesharevalue3']; + } + if (jobtitlelevel == '3') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue2', 'jobtitlesharevalue2']; + } + } + window.e9HideFormFieldKeys = temp; + } + + onMenuClick = (type="") => { + const{ + ExchangeStore + } = this.props, { + doOperationlimit, + shareForm, + } = ExchangeStore; + if(type === "BTN_SAVE") { + const params = shareForm.getFormParams(); + this.hideShareField(params); + onCheck(shareForm, () => { + doOperationlimit({ + operate: "addShare", + ...params + }); + }) + } + } + + getForm = (form, condition=[]) => { + const { + permissiontype, + } = form.getFormParams(), { + isFormInit, + } = form; + + let arr = []; + isFormInit && condition.forEach(c => { + c && c.items && c.items.forEach(field => { + const key = field.domkey[0]; + if (this.filter({ + permissiontype, + key + })) { + return + } + + arr.push( + this.handleChange(cb)}/> + ) + + arr = [...arr, this.add({ + permissiontype, + key, + form, + })]; + + + }) + }) + return
{arr}
+ } + + filter = (params) => { + const { + permissiontype, + key + } = params; + + if (key == 'sharevalue2' || key == 'rolelevel' || key == 'jobtitlelevel' || key == 'jobtitlesharevalue2' || key == 'jobtitlesharevalue3') { + return true + } + + if (permissiontype == '1' && !(key == 'permissiontype' || key == 'sharevalue1' || key == 'seclevel')) { + return true + } + + if (permissiontype == '6' && !(key == 'permissiontype' || key == 'sharevalue6' || key == 'seclevel')) { + return true + } + + if (permissiontype == '3' && !(key == 'permissiontype' || key == 'seclevel')) { + return true + } + + if (permissiontype == '5' && !(key == 'permissiontype' || key == 'sharevalue5')) { + return true + } + + if (permissiontype == '2' && !(key == 'permissiontype' || key == 'seclevel')) { + return true + } + + if (permissiontype == '7' && !(key == 'permissiontype' || key == 'sharevalue7')) { + return true + } + } + + add = (params) => { + const { + permissiontype, + key, + form, + } = params; + + let temp = []; + if (permissiontype == '2' && key == 'permissiontype') { + temp.push(this.getRole(form)); + } + if (permissiontype == '7' && key == 'sharevalue7') { + temp.push(this.getPost(form)); + } + + return temp + } + + handleChange = (cb) => { + + } + + getRole = (form) => { + const { + ExchangeStore + } = this.props, { + role + } = toJS(ExchangeStore.status); + + return ( + + {role.map((field, index) => { + return ( + this.handleChange(cb)}/> + ) + })} + + ) + } + + getPost = (form) => { + const { + ExchangeStore + } = this.props, { + post + } = toJS(ExchangeStore.status), { + jobtitlelevel + } = form.getFormParams(); + + let temp; + if (jobtitlelevel == '1') { + temp = post.slice(0, 1) + } + if (jobtitlelevel == '2') { + temp = post.slice(0, 2) + } + if (jobtitlelevel == '3') { + temp = post.slice(0, 1).concat(post.slice(2)) + } + + return ( + + {temp.map((field, index) => { + return ( + this.handleChange(cb)}/> + ) + })} + + ) + } + + render() { + const{ + ExchangeStore + } = this.props, { + status, + shareForm, + } = ExchangeStore, { + showShareForm, + shareFormCondition, + collectParams + } = toJS(status); + + return ( + ExchangeStore.setState({showShareForm: false})} + buttons={this.getBtns()} + moreBtn={{ + datas: this.getRightMenus(), + collectParams + }} + > + + {this.getForm(shareForm, shareFormCondition)} + + + ) + } +} diff --git a/pc4backstage/integration/components/Exchange/SyncDataRange.js b/pc4backstage/integration/components/Exchange/SyncDataRange.js new file mode 100644 index 0000000..ced4358 --- /dev/null +++ b/pc4backstage/integration/components/Exchange/SyncDataRange.js @@ -0,0 +1,177 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import { + WeaTab, + WeaDialog, + WeaRightMenu, + WeaButtonIcon, + WeaLocaleProvider, +} from "ecCom"; +import { + WeaTableNew, +} from "comsMobx"; +import { + onCheck, + doConfirm +} from "../../util/IntegrationUtil"; +import NewShare from './NewShare'; + +const getLabel = WeaLocaleProvider.getLabel; +const { WeaTable } = WeaTableNew; + +@inject("ExchangeStore") +@observer +class SyncDataRange extends React.Component { + constructor(props) { + super(props); + this.state = { + buttonLoading: false + }; + } + + componentDidMount() { + const { ExchangeStore } = this.props; + ExchangeStore.doLoginURLInit(); + this.setState({ + buttonLoading: false + }); + } + + componentWillReceiveProps(nextProps) { + const { ExchangeStore } = this.props; + if (this.props.location && nextProps.location && this.props.location.key !== nextProps.location.key) { + ExchangeStore.doLoginURLInit(); + this.setState({ + buttonLoading: false + }); + } + } + + /** + * 关闭弹窗 + */ + handleCancle = () => { + const { + ExchangeStore + } = this.props; + + ExchangeStore.setState({ + showSyncDataRange: false + }); + } + + /** + * 按钮的显示和事件 + */ + onMenuClick = (type) => { + const { + ExchangeStore + } = this.props, { + loginURLForm, + doOperationlimit, + } = ExchangeStore; + if(type && "BTN_SAVE" === type.toLocaleUpperCase()) { + onCheck(loginURLForm, () => { + this.setState({buttonLoading: true}); + doOperationlimit({...loginURLForm.getFormParams(), operate: "SaveUserAndPwd"}, (result) => { + this.setState({buttonLoading: false}); + }); + }); + } + }; + + getBtns = (datas=[], disabled) => { + const { + ExchangeStore + } = this.props; + + return [ + this.onMenuClick("SHARE_ADD")} + buttonType='add' type="primary" />, + this.onMenuClick("SHARE_DELETE")} + buttonType='del' type="primary" /> + ] + }; + + getRightMenu = (datas=[], disabled) => { + const { + ExchangeStore + } = this.props; + return datas && datas.map(data => { + return { + ...data, + icon: , + disabled: data.key === "SHARE_ADD" ? disabled : (disabled || toJS(ExchangeStore.authStore.selectedRowKeys).length === 0), + onClick: () => this.onMenuClick(data.key) + } + }) + } + + onMenuClick = (type) => { + const { + ExchangeStore + } = this.props, { + doOperationlimit, + authStore + } = ExchangeStore, { + selectedRowKeys + } = toJS(authStore); + + if("SHARE_DELETE" === type) { + doConfirm(getLabel(385625, '确定要删除选择的记录吗?'), () => { + doOperationlimit({operate: "delShare", id: selectedRowKeys}); + }) + }else if("SHARE_ADD" === type) { + ExchangeStore.setState({showShareForm: true}); + doOperationlimit({operate: "getAddShareForm"}); + } + } + + render() { + const { + ExchangeStore + } = this.props, { + status, + authStore, + } = ExchangeStore, { + dataRangeMenus, + authLoading, + collectParams, + showSyncDataRange + } = toJS(status); + return ( + + + + + + + + ); + } +} + +export default SyncDataRange; diff --git a/pc4backstage/integration/components/Exchange/UserLoginURL.js b/pc4backstage/integration/components/Exchange/UserLoginURL.js new file mode 100644 index 0000000..15f3b7c --- /dev/null +++ b/pc4backstage/integration/components/Exchange/UserLoginURL.js @@ -0,0 +1,171 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import { + Button, +} from "antd"; +import { + WeaTop, + WeaFormItem, + WeaRightMenu, + WeaNewScroll, + WeaSearchGroup, + WeaLocaleProvider, +} from "ecCom"; +import { + WeaSwitch, +} from "comsMobx"; +import NoRight from "../../public/NoRight"; +import { + onCheck, + getForm +} from "../../util/IntegrationUtil"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("ExchangeStore") +@observer +class UserLoginURL extends React.Component { + constructor(props) { + super(props); + this.state = { + buttonLoading: false + }; + } + + componentDidMount() { + const { ExchangeStore } = this.props; + ExchangeStore.doLoginURLInit(); + this.setState({ + buttonLoading: false + }); + } + + componentWillReceiveProps(nextProps) { + const { ExchangeStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + ExchangeStore.doLoginURLInit(); + this.setState({ + buttonLoading: false + }); + } + } + + /** + * 按钮的显示和事件 + */ + onMenuClick = (type) => { + const { + ExchangeStore + } = this.props, { + loginURLForm, + doOperationlimit, + } = ExchangeStore; + if(type && "BTN_SAVE" === type.toLocaleUpperCase()) { + onCheck(loginURLForm, () => { + this.setState({buttonLoading: true}); + doOperationlimit({...loginURLForm.getFormParams(), operate: "SaveUserAndPwd"}, (result) => { + this.setState({buttonLoading: false}); + }); + }); + } + }; + + getBtns = (datas=[]) => { + return datas && datas.map(data => ); + }; + + getRightMenu = (datas=[]) => { + return datas && datas.map(data => { + return { + ...data, + disabled: this.state.buttonLoading, + onClick: () => this.onMenuClick(data.key) + } + }) + } + + getForm = (form, datas=[]) => { + const { + isFormInit + } = form; + const formParams = form.getFormParams(); + let group = []; + isFormInit && datas && datas.forEach((c, index) => { + let items = []; + c && c.items && c.items.forEach(fields => { + let key = fields.domkey[0]; + items.push({ + com: ( + + + ), + colSpan: 1, + hide: form.isHide(fields, (keys, allParams) => { + let bool = false; + fields && fields.showWhere && fields.showWhere.length > 0 && fields.showWhere.forEach(w => { + if(!bool){ + let show = false; + for(let val of w.value){ + if(allParams[w.domkey] == val){ + show = true; + break; + } + } + bool = !show; + } + }) + return bool; + }) + }); + }) + group.push() + }); + return group; + } + + render() { + const { + ExchangeStore + } = this.props, { + status, + loginURLForm, + } = ExchangeStore, { + urlMenus, + loginURLLoading, + loginURLhasRight, + urlCollectParams, + loginURLCondition, + } = toJS(status); + return ( + loginURLLoading + ? null + : loginURLhasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns(urlMenus)} + showDropIcon={true} + dropMenuDatas={this.getRightMenu(urlMenus)} + dropMenuProps={{collectParams: urlCollectParams}} + /> + + {getForm(loginURLForm, loginURLCondition, true, null, null, null, this && this.props && this.props.ecId || '', "integrationExchangeLoginUrlForm")} + + + : + ); + } +} + +export default UserLoginURL; diff --git a/pc4backstage/integration/components/Exchange/index.js b/pc4backstage/integration/components/Exchange/index.js new file mode 100644 index 0000000..716658d --- /dev/null +++ b/pc4backstage/integration/components/Exchange/index.js @@ -0,0 +1,393 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import { + Button, + message +} from "antd"; +import { + WeaTop, + WeaTab, + WeaFormItem, + WeaRightMenu, + WeaNewScroll, + WeaHelpfulTip, + WeaSearchGroup, + WeaLocaleProvider, +} from "ecCom"; +import { + WeaSwitch, + WeaTableNew +} from "comsMobx"; +import NoRight from "../../public/NoRight"; +import NonStand from "../../public/NonStand"; +import { + onCheck, + getSearchBtns, + getAdvancedItem, +} from "../../util/IntegrationUtil"; +import copy from 'copy-to-clipboard'; +import CronExp from '../../public/CronExp'; +import SyncDataRange from './SyncDataRange'; + +const { WeaTable } = WeaTableNew; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("ExchangeStore") +@observer +class Exchange extends React.Component { + constructor(props) { + super(props); + this.state = { + selectedKey: 0, + visiable: false, + showSearchAd: false + }; + } + + componentDidMount() { + const { ExchangeStore } = this.props; + ExchangeStore.doInit(); + this.setState({ + showSearchAd: false + }); + } + + componentWillReceiveProps(nextProps) { + const { ExchangeStore } = this.props; + if (this.props.location && nextProps.location && this.props.location.key !== nextProps.location.key) { + ExchangeStore.doInit(); + this.setState({ + showSearchAd: false + }); + } + } + + // tab高级搜索 + getSearchBtns = () => { + const { + ExchangeStore + } = this.props, { + searchForm + } = ExchangeStore; + return getSearchBtns( + this.onSearch, + () => searchForm.reset(), + () => this.setState({showSearchAd: false}), + this && this.props && this.props.ecId || '', + "integrationExchange", + ); + } + + getAdvancedItem = () => { + const { + ExchangeStore + } = this.props, { + searchForm, + status + } = ExchangeStore, { + searchCondition + } = toJS(status); + + return getAdvancedItem( + searchForm, + searchCondition, + this.onSearch, + false, + this && this.props && this.props.ecId || '', + "integrationExchange", + ) + } + + onSearch = () => { + const { + ExchangeStore + } = this.props, { + searchForm, + getExchangeLogList + } = ExchangeStore; + + getExchangeLogList({...searchForm.getFormParams()}); + this.setState({showSearchAd: false}); + } + + /** + * 按钮的显示和事件 + */ + onMenuClick = (type) => { + const { + ExchangeStore + } = this.props, { + form, + tableStore, + getBaseInfoFormOperation, + } = ExchangeStore; + if(type && ["SAVE", "TEST"].includes(type.toLocaleUpperCase())) { + let params = form.getFormParams(), hideFormFields = []; + if(params.syndirection && !params.syndirection.includes('1')) { + hideFormFields.push("cronexpr"); + } + if(params.logintype == 2) { + let hideFields = ["username", "password"]; + hideFormFields = hideFormFields.concat(hideFields); + } + window.e9HideFormFieldKeys = hideFormFields; + onCheck(form, () => { + if(type === "TEST") { + params = Object.assign({}, params, {operate: "test"}); + getBaseInfoFormOperation(params); + }else { + getBaseInfoFormOperation(Object.assign({}, params, {operate: "checkCron"}), () => { + params = Object.assign({}, params, {operate: "save"}); + getBaseInfoFormOperation(params); + }); + } + }); + }else if(type === "BTN_COLUMN") { + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + }; + + getBtns = (datas=[], disabled, selectedKey="0") => { + if(selectedKey == 0) { + return datas && datas.map(data => ); + }else { + return []; + } + }; + + getRightMenu(datas=[], disabled, selectedKey="0") { + if(selectedKey == 0) { + return datas && datas.map(data => { + return { + ...data, + disabled, + icon: , + onClick: () => this.onMenuClick(data.key) + } + }) + } else { + return [{ + key: "BTN_COLUMN", + icon: , + content: `${getLabel(32535, "显示列定制")}`, + onClick: () => this.onMenuClick("BTN_COLUMN") + }]; + } + } + + // 点击复制路径 + copyURL = (url) => { + if (copy(url)) { + message.success(getLabel('126081', '地址已经复制成功,您可以使用Ctrl+v粘贴')); + } + } + + // 设置数据同步的范围 + setSynDataRange = () => { + const { + ExchangeStore + } = this.props, { + doOperationlimit, + getExchangelimitsList + } = ExchangeStore; + + ExchangeStore.setState({ + showSyncDataRange: true + }); + doOperationlimit({operate: "getButtons"}); + getExchangelimitsList(); + } + + getForm = (form, datas=[]) => { + const { + isFormInit + } = form; + const formParams = form.getFormParams(); + let group = []; + isFormInit && datas && datas.forEach((c, index) => { + let items = []; + c && c.items && c.items.forEach(fields => { + let key = fields.domkey[0]; + items.push({ + com: ( + {fields.label} : fields.label} + labelCol={{span: fields.labelcol}} + wrapperCol={{span: fields.fieldcol}} + error={form.getError(fields)} + tipPosition="bottom" + > + { + key === "syndatarange" + ? + : key === "cronexpr" + ? form.updateFields({[key]: v.trim() || '0 0 * * * ?'})} + /> + : + { + if(["syndirection", "datatpye"].includes(key)) { + if(!form.getFormParams()[key]) { + form.updateFields({[key]: formParams[key] == "1" ? "2" : "1"}); + } + } + }} /> + { + key === "userloginurl" + ? + : key === "day" + ? {getLabel('1925','天')} + : null + } + + } + + ), + colSpan: 1, + hide: form.isHide(fields, (keys, allParams) => { + let bool = false, key = fields.domkey[0]; + ["userloginurl"].includes(key) && allParams.logintype != '2' && (bool = true); + ["username", "password"].includes(key) && allParams.logintype != '1' && (bool = true); + ["cronexpr"].includes(key) && (!allParams.syndirection.includes('1')) && (bool = true); + fields && fields.showWhere && fields.showWhere.length > 0 && fields.showWhere.forEach(w => { + if(!bool){ + let show = false; + for(let val of w.value){ + if(allParams[w.domkey] == val){ + show = true; + break; + } + } + bool = !show; + } + }) + return bool; + }) + }); + if(["userloginurl"].includes(key) && formParams.logintype == '2') { + items.push({ + com:
{getLabel('517422','请管理员将【用户登录地址】作为菜单地址新增菜单,以供普通用户进行登录绑定Exchange')}。
+ }) + } + }) + group.push() + }); + return group; + } + + // 切换tab页 + handleTabChange = (selectedKey) => { + const { + ExchangeStore + } = this.props, { + status, + getBaseInfo, + getExchangeLogInfo, + } = ExchangeStore; + + if(selectedKey == 0) { + getBaseInfo(); + }else if(selectedKey == 1) { + getExchangeLogInfo(); + } + ExchangeStore.setState({ + selectedKey + }); + } + + render() { + const { + ExchangeStore + } = this.props, { + form, + status, + hasRight, + tableStore, + } = ExchangeStore, { + menus, + loading, + tabDatas, + condition, + selectedKey, + buttonStatus, + collectParams, + advancedHeight, + hasNonStandard, + nonStandLoading, + } = toJS(status), { + showSearchAd + } = this.state; + return (nonStandLoading + ? null + : hasNonStandard + ? loading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns(menus, buttonStatus, selectedKey)} + showDropIcon={true} + dropMenuDatas={this.getRightMenu(menus, buttonStatus, selectedKey)} + dropMenuProps={{collectParams}} + /> + this.setState({showSearchAd: !showSearchAd})} + hideSearchAd={() => this.setState({showSearchAd: false})} + onChange={this.handleTabChange} + /> + + { + selectedKey == 0 + ? this.getForm(form, condition) + : selectedKey == 1 + ? + : null + } + + + + : + : + ); + } +} + +export default Exchange; diff --git a/pc4backstage/integration/components/Home.js b/pc4backstage/integration/components/Home.js new file mode 100644 index 0000000..b96c80c --- /dev/null +++ b/pc4backstage/integration/components/Home.js @@ -0,0 +1,23 @@ +import {WeaLocaleProvider} from 'ecCom'; + +class Home extends React.Component { + constructor(props) { + super(props); + this.state = { + iframeStyle: {display: "none"} + } + } + + render() { + return ( +
+ + + {this.props.children} + +
+ ) + } +} + +export default Home diff --git a/pc4backstage/integration/components/LDAPInit/index.js b/pc4backstage/integration/components/LDAPInit/index.js new file mode 100644 index 0000000..17f5fbe --- /dev/null +++ b/pc4backstage/integration/components/LDAPInit/index.js @@ -0,0 +1,119 @@ +import React from 'react'; +import {toJS} from 'mobx'; +import {inject, observer} from "mobx-react"; +import {WeaRightMenu, WeaTop, WeaFormItem, WeaSearchGroup, WeaLocaleProvider, WeaNewScroll} from 'ecCom'; +import {WeaSwitch} from "comsMobx"; +import {Button, Spin} from 'antd'; + +const {getLabel} = WeaLocaleProvider; + +@inject("ldapInit") +@observer +export default class LDAPInit extends React.Component{ + constructor(props) { + super(props); + } + + componentDidMount() { + const {ldapInit} = this.props; + ldapInit.getForm(); + } + + componentWillReceiveProps(nextProps) { + if(this.props.location.key != nextProps.location.key) { + this.props.ldapInit.getForm(); + } + } + + getRightMenus = () => { + return [{ + key: "init", + icon: , + content: getLabel(20873, "初始化"), + onClick: () => this.onMenuClick("init") + }] + } + + getBtns = () => { + return [ + + ] + } + + onMenuClick = (type) => { + const {ldapInit} = this.props; + const {save, newForm} = ldapInit; + + if(type === "init") { + newForm.validateForm().then(f => { + if(f.isValid) { + save(); + }else { + f.showErrors(); + } + }) + } + } + + getSearch = (form, condition) => { + const {isFormInit} = form; + const formParams = form.getFormParams(); + let group = []; + + isFormInit && condition && condition.map((c, index) => { + let items = []; + c.items && c.items.map(fields => { + items.push({ + com: ( + + ) + }) + }) + group.push() + }) + + return group; + } + + render() { + const {ldapInit} = this.props; + const {status, newForm} = ldapInit; + const {loading, condition} = toJS(status); + const collectParams = { + favname: "LDAP初始化", + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/LDAPInit", + importantlevel: 1 + } + + return ( + + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenus()} + dropMenuProps={{collectParams}} + /> + + + {this.getSearch(newForm, condition)} + + + + ) + } + +} \ No newline at end of file diff --git a/pc4backstage/integration/components/Webservice/index.js b/pc4backstage/integration/components/Webservice/index.js new file mode 100644 index 0000000..a8fd748 --- /dev/null +++ b/pc4backstage/integration/components/Webservice/index.js @@ -0,0 +1,206 @@ +import React from "react"; +import { + toJS, +} from "mobx"; +import { + inject, + observer, +} from "mobx-react"; +import { + WeaLocaleProvider, + WeaLeftRightLayout, + WeaTop, + WeaTab, + WeaRightMenu, +} from "ecCom"; +import { + WeaTableNew, +} from "comsMobx"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import NoRight from "../../public/NoRight"; +import NonStand from "../../public/NonStand"; +import OrganizationTree from '../../public/OrganizationTree'; +import WebServiceCreate from './webServiceCreate'; + +const {WeaTable} = WeaTableNew; +const {getLabel} = WeaLocaleProvider; + +@inject("webservice") +@observer +export default class Main extends React.Component { + constructor(props) { + super(props); + this.state = { + showSearchAd: false, + } + } + + componentDidMount() { + const { webservice } = this.props; + webservice.doInit(); + } + + componentWillReceiveProps(nextProps) { + if (this.props.location.key !== nextProps.location.key) { + const { webservice } = this.props; + webservice.doInit(); + } + } + + // 分权刷新 + refreshData = (id, type) => { + const { + webservice + } = this.props; + if("1" === type) { + // 如果点击的是分部 + webservice.setState({ + subcompanyid: id, + }); + } else{ + webservice.setState({ + subcompanyid: "", + }); + } + webservice.getConditions(webservice.getTableInfo); + } + + getSearchs = () => { + const { webservice } = this.props; + const { status: { condition }, form } = webservice; + return IntegrationUtil.getAdvancedItem( + form, + condition, + this.handleSearchFun, + false, + this && this.props && this.props.ecId || '', + "integrationWebservice" + ); + } + + handleSearchFun = () => { + const { webservice } = this.props; + webservice.setState({ + subcompanyid: webservice.form.getFormParams().subcompanyid1, + }); + webservice.getTableInfo(); + this.setState({ showSearchAd: false }); + } + + getTabButtonsAd = () => { + const { webservice } = this.props; + const { form } = webservice; + return IntegrationUtil.getSearchBtns( + this.handleSearchFun, + () => form.reset(), + () => this.setState({ showSearchAd: false }), + this && this.props && this.props.ecId || '', + "integrationWebservice" + ); + } + + getColumns = (columns) => { + const { webservice } = this.props; + return columns.map(column => { + if (column.dataIndex == 'customname') { + return { + ...column, + render: (text, record, index) => { + return ( webservice.edit(record)}>{record.customname}); + } + } + } else if (column.dataIndex == 'subcompanyid') { + return { + ...column, + render: (text, record, index) => { + return ({record.subcompanyidspan}); + } + } + } else { + return column; + } + }); + } + + render() { + const { + webservice + } = this.props, { + status, + form, + tableStore, + getRightMenuData, + getTopButton, + onOperatesClick, + hasRight, + rightLoading, + } = webservice, { + loading, + advanceHeight, + hasNonStandard, + nonStandLoading, + collectParams, + hasOrganization, + subcompanyid, + } = toJS(status), { + showSearchAd, + } = this.state; + + return (nonStandLoading + ? null + : hasNonStandard + ? rightLoading + ? null + : hasRight + ? + } + iconBgcolor={IntegrationUtil.GeneralTitleColor.iconBgcolor} + showDropIcon={true} + dropMenuDatas={getRightMenuData()} + dropMenuProps={{collectParams}} + loading={loading} + /> + } + > + this.setState({showSearchAd})} + hideSearchAd={() => this.setState({showSearchAd: false})} + searchsAd={this.getSearchs()} + searchsBaseValue={form.getFormParams().customname || ''} + onSearch={this.handleSearchFun} + onSearchChange={value => form.updateFields({customname: {value}})} + /> + + + + + : + : + ); + } +} diff --git a/pc4backstage/integration/components/Webservice/webServiceCreate.js b/pc4backstage/integration/components/Webservice/webServiceCreate.js new file mode 100644 index 0000000..6fb925d --- /dev/null +++ b/pc4backstage/integration/components/Webservice/webServiceCreate.js @@ -0,0 +1,273 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import {checkTableFieldValueUnique} from "../../apis/CommonService"; +import {WeaSwitch} from 'comsMobx' +import { + WeaLocaleProvider, + WeaDialog, + WeaSearchGroup, + WeaButtonIcon, + WeaTableEditable, + WeaRightMenu, + WeaFormItem, + WeaTools, +} from "ecCom"; +import { isEmpty } from 'lodash'; +import { Spin, Button } from 'antd'; + +const { getKey } = WeaTools; +const getLabel = WeaLocaleProvider.getLabel; +const { GeneralTitleColor } = IntegrationUtil; + +@inject("webservice") +@observer +export default class Main extends React.Component { + onCancel = () => { + const { webservice } = this.props; + webservice.doInitCreate(); + } + + getOtherCom = () => { + const { webservice } = this.props; + const { parseWSDL, formCreate } = webservice; + const allParams = formCreate.getFormParams(); + const com = ; + return com; + } + + onChange = (datas) => { + const { webservice } = this.props; + const { setState } = webservice; + setState({wsdlParamData:datas}); + } + + save = () => { + const { webservice } = this.props; + let { status: { wsdlParamData }, formCreate, doSave } = webservice; + wsdlParamData = toJS(wsdlParamData); + const result = this.refs.serviceRegister.doValidate(); + formCreate.validateForm().then(f => { + if (f.isValid) { + if (result.pass) { + wsdlParamData.forEach((v, l) => { + if (v.methodid.indexOf('$') > -1) { + wsdlParamData[l].methodid = '0'; + } + }); + doSave(wsdlParamData); + } + } else { + f.showErrors(); + } + }) + } + + del = () => { + const { webservice } = this.props; + const { delList, status: { webserviceid } } = webservice; + delList({ pointid: webserviceid }, false); + } + + onClick = type => { + const { webservice } = this.props; + const { formCreate, status } = webservice; + let checkParams = { + tableName: 'wsregiste', + fieldName: 'customname', + fieldValue: formCreate.getFormParams().customname.replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: webservice.editRecordId + }; + switch (type) { + case 'BTN_Save': + checkTableFieldValueUnique(checkParams).then(result => { + if(result&&result.isNotUnique) { + formCreate.showError('customname',getLabel('129943','名称已存在')); + }else { + this.save(); + } + }); + break; + case 'BTN_Delete': this.del(); break; + } + } + + getSearchs = (form, datas, needTigger = true, center = true, lableCol, fieldcol, otherCom = null) => { + const { webservice } = this.props; + const { isFormInit } = form; + let group = []; + const formParams = form.getFormParams(); + isFormInit && datas && datas.map((c, index) => { + let items = []; + c.items.map(fields => { + items.push({ + com: ( + + { + if(getKey(fields) === 'customname') { + let checkParams = { + tableName: 'wsregiste', + fieldName: 'customname', + fieldValue: form.getFormParams().customname.replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: webservice.editRecordId + }; + checkTableFieldValueUnique(checkParams).then(result => { + if(result&&result.isNotUnique) { + form.showError('customname',getLabel('129943','名称已存在')); + } + }); + } + }} + /> + {fields.showOtherCom && otherCom} + ), + colSpan: 1 + }) + }); + if (needTigger) { + group.push() + } else { + group.push() + } + }); + return group; + } + + getBtn = () => { + const { webservice } = this.props; + const { rightMenuForm } = webservice.status; + let btnArr = []; + + rightMenuForm && rightMenuForm.map( v => { + if(v.type == 'BTN_Save') { + btnArr.push( + + ) + } + }) + + return btnArr; + } + + getRightMenu = () => { + const { webservice } = this.props; + const { rightMenuForm } = webservice.status; + let btnArr = []; + + rightMenuForm && rightMenuForm.map( v => { + if(v.type == 'BTN_Save') { + btnArr.push({ + key: v.type, + content: v.menuName, + icon: , + onClick: () => this.onClick(v.type), + }) + } + }) + + return btnArr; + } + + render() { + const { + webservice, + } = this.props, { + status: { + type, + visible, + conditionCreate, + loadingCreate, + columns, + showRegister, + analysisWSDL, + selectedRowKeys, + wsdlParamData, + wsdlParamPass, + }, + formCreate, + setState, + addRegister, + delRegister, + } = webservice; + const validator = { + rules: { + methodname: 'required', + }, + errorMessage: { + required: getLabel(385869,'此项必填'), + }, + }, collectParams = { + favname: getLabel(33717, "WebService注册"), + favouritetype: 2, + objid: 0, + importantlevel: 1, + link: 'wui/engine.html#/main/integration/webservice', + }; + const title = type === 'create' ? getLabel('365,33717','新建WebService注册') : getLabel('26473,33717','编辑WebService注册'); + return ( + + + {this.getSearchs(formCreate, toJS(conditionCreate), true, true, 7, 16, this.getOtherCom())} + +
+ setState({ showRegister })} + customComponent={[ + , + , + ]}> setState({ selectedRowKeys })} + columns={toJS(columns)} + onChange={this.onChange} /> + +
+
+
+
+ ); + } +} diff --git a/pc4backstage/integration/components/accountSetting.js b/pc4backstage/integration/components/accountSetting.js new file mode 100644 index 0000000..83195bf --- /dev/null +++ b/pc4backstage/integration/components/accountSetting.js @@ -0,0 +1,269 @@ +import React from 'react'; +import { + inject, + observer +} from "mobx-react"; +import { + toJS +} from 'mobx'; +import { + Button, + message +} from 'antd'; +import { + WeaLocaleProvider, + WeaTop, + WeaRightMenu, + WeaFormItem, + WeaSearchGroup, + WeaTools, +} from "ecCom"; +import * as IntegrationUtil from "../util/IntegrationUtil"; +import { + WeaSwitch +} from "comsMobx"; +import { checkValidateCode } from "../apis/CommonService"; +import NoRight from '../public/NoRight'; + +const getLabel = WeaLocaleProvider.getLabel; +const { getKey } = WeaTools; + +@inject("accountSettingStore") +@observer +class Main extends React.Component { + constructor(props) { + super(props); + this.state = { + src: (window.ecologyContentPath || "") + '/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4', + num: 0 + } + } + + componentDidMount() { + const { + accountSettingStore + } = this.props; + const { + doInit, + singleInit + } = accountSettingStore; + + if (this.props.params.id !== undefined) { + singleInit(this.props.params.id); + } else { + doInit(); + } + } + + getDropMenuDatas = () => { + const { + accountSettingStore + } = this.props; + const { + doInit, + buttons + } = accountSettingStore; + const btnArr = []; + toJS(buttons).forEach(item => { + btnArr.push({ + key: item.type, + icon: , + content: item.menuName, + onClick: () => this.clickEvent(item.type) + }) + }) + return btnArr; + } + + getWeaTopBtns = () => { + return [ + + ] + } + + clickEvent = type => { + const { + accountSettingStore + } = this.props; + const { + status, + setStatus, + form, + singleForm, + condition, + doSave, + doInit + } = accountSettingStore; + if("BTN_Save" == type) { + const params = form.getFormParams() || {}; + const otherParams = singleForm.getFormParams(); + + if(this.props.params.id == undefined){ + if(params.validatecode !== undefined) { + if(!(params.validatecode && params.validatecode.trim())) { + message.error(getLabel('390564','"验证码"未填写')); + return; + } + checkValidateCode({validatecode: params.validatecode}).then(result => { + if(result&&result.isValid) { + doSave(this.props.params.id !== undefined ? { ...otherParams, + sysid: this.props.params.id + } : params, doInit); + this.setState({num: this.state.num + 1}, function() { + this.setState({src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}`}) + }) + }else { + form.showError('validatecode',getLabel('129308','无效的验证码!')); + this.setState({num: this.state.num+1}, function() { + this.setState({src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}`}) + }); + return; + } + }) + }else { + doSave(this.props.params.id !== undefined ? { ...otherParams, + sysid: this.props.params.id + } : params, doInit); + this.setState({num: this.state.num + 1}, function() { + this.setState({src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}`}) + }) + } + }else{ + if(otherParams.validatecode !== undefined) { + if(!(otherParams.validatecode && otherParams.validatecode.trim())) { + singleForm.showError('validatecode', getLabel('390564','"验证码"未填写')); + return; + } + checkValidateCode({validatecode: otherParams.validatecode}).then(result => { + if(result&&result.isValid) { + doSave(this.props.params.id !== undefined ? { ...otherParams, + sysid: this.props.params.id + } : params); + this.setState({num: this.state.num + 1}, function() { + this.setState({src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}`}) + }) + }else { + singleForm.showError('validatecode',getLabel('129308','无效的验证码!')); + this.setState({num: this.state.num+1}, function() { + this.setState({src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}`}) + }); + return; + } + }) + }else { + doSave(this.props.params.id !== undefined ? { ...otherParams, + sysid: this.props.params.id + } : params); + this.setState({num: this.state.num + 1}, function() { + this.setState({src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}`}) + }) + } + } + } + } + + getFormSearchs = (form, datas=[]) => { + const { isFormInit } = form; + let group = []; + const formParams = form.getFormParams(); + isFormInit && datas && datas.map((c, index) => { + let items = []; + c.items.map(fields => { + items.push({ + com: ( + + { + getKey(fields) == 'validatecode' + ?
+ + { + this.setState({num: this.state.num+1}, function() { + this.setState({src: `${window.ecologyContentPath || ""}/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4&seriesnum_=${this.state.num}`}) + }) + }}> +
+ : + } +
), + colSpan: 1 + }) + }); + group.push(); + }); + return group; + } + + render() { + const { + accountSettingStore + } = this.props; + const { + status, + form, + condition, + singleForm, + singleCondition, + hasRight + } = accountSettingStore; + const { + loading, + formLoading + } = toJS(status); + + return ( + formLoading + ? null + : hasRight + ? + + } + iconBgcolor={IntegrationUtil.GeneralTitleColor.iconBgcolor} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + dropMenuProps={{ + collectParams: { + favname: `${getLabel("19667", "账号设置")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/129787", + importantlevel: 1 + } + }} + > + {this.props.params.id !== undefined ? ( +
+ {this.getFormSearchs(singleForm, toJS(singleCondition))} +
+ ) : ( +
+ {this.getFormSearchs(form, toJS(condition))} +
+ )} +
+
+ : + ) + } +} + +export default Main; \ No newline at end of file diff --git a/pc4backstage/integration/components/authenticationApp/AppDataMappingEditDialog.js b/pc4backstage/integration/components/authenticationApp/AppDataMappingEditDialog.js new file mode 100644 index 0000000..f9ead74 --- /dev/null +++ b/pc4backstage/integration/components/authenticationApp/AppDataMappingEditDialog.js @@ -0,0 +1,167 @@ +import React from "react"; +import {inject, observer} from "mobx-react"; +import { Button} from "antd"; +import {toJS} from "mobx"; +import {WeaSwitch} from "comsMobx"; +import {WeaDialog, WeaLocaleProvider, WeaTools, WeaSearchGroup, WeaFormItem, WeaRightMenu} from "ecCom"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import {checkUserMappingLoginIdUnique,checkUserMappingAppLoginIdUnique} from "../../apis/AuthenticationCenterService" +const { getKey } = WeaTools; +const getLabel = WeaLocaleProvider.getLabel; + +const store = ["authenticationCenterStore"]; + +@inject(...store) +@observer +export default class AppDataMappingEditDialog extends React.Component { + constructor(props) { + super(props); + this.state = { + collectParams: { + favname: `${getLabel(381908, "统一认证中心")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/AuthenticationCenter", + importantlevel: 1 + } + } + } + + render() { + const {authenticationCenterStore} = this.props; + const status = toJS(authenticationCenterStore.status); + const {collectParams} = this.state; + return authenticationCenterStore.setState({appEditFormDetailDataMappingDialogVisible: false})} + visible={status.appEditFormDetailDataMappingDialogVisible} + style={{width: 700, height: 400}} + hasScroll + moduleName="integration" + buttons={[ + + ]} + moreBtn={{ + datas: this.getRightMenu(), + collectParams: collectParams + }} + > + + { + authenticationCenterStore.registerAppDataMappingEditForm.render({col: 1},{ + onChange: (v)=> { + }, + isHide: (key, formParams) => {} + + },true,(c, idx)=>{ + if(idx==0){ + let items = []; + let bottomDis = 0; + let form = authenticationCenterStore.registerAppDataMappingEditForm; + let formParams = form.getFormParams(); + c.items.map(fields => { + if(getKey(fields) == 'apploginid') { + bottomDis = 15; + }else { + bottomDis = 0; + } + items.push({ + com: ( +
+ + + { + if(getKey(fields) === 'userid') { + let params={userid:form.getFormParams().userid,operation:'getUserInfo'}; + authenticationCenterStore.getRegisterAppDataMappingOperation(params,(result)=>{ + if(result) { + if(result.depname) { + form.updateFields({depname: result.depname}); + } + if(result.subname) { + form.updateFields({subname: result.subname}); + } + if(result.loginid) { + form.updateFields({loginid: result.loginid}); + } + } + }) + } + }} + /> + {/*{getKey(fields)==='account_rules'&&formParams.account_rules>5?:""}*/} + + +
), + colSpan: 1, + hide: form.isHide(fields, (key, formParams) => { + let hide = false; + if ('definebroswerType' == key && formParams.account_rules !== '7') { + hide = true; + } + return hide; + }), + onChange: (v)=> { + + } + }) + }); + + return + } + })} +
+
+ } + + getRightMenu() { + let btnArr = [ + { + key: 'BTN_SAVE', + icon: , + content : `${getLabel(86,'保存')}`, + onClick : () => this.onRightMenuClick('BTN_SAVE') + } + ]; + return btnArr; + } + + onRightMenuClick = (type) => { + const {authenticationCenterStore} = this.props; + const {registerAppEditForm,registerAppDataMappingEditForm} = authenticationCenterStore; + if(type == 'BTN_SAVE'){ + let id=authenticationCenterStore.registerAppDataMappingId||""; + let appid = registerAppEditForm.getFormParams().appid; + let loginid = registerAppDataMappingEditForm.getFormParams().loginid; + let apploginid = registerAppDataMappingEditForm.getFormParams().apploginid; + checkUserMappingLoginIdUnique({appId: appid, idValue: id, loginId: loginid, appLoginId: apploginid}).then(result=>{ + if(result&&result.isNotUnique) { + registerAppDataMappingEditForm.showError('userid',getLabel('31053','已存在,请确认')); + }else{ + checkUserMappingAppLoginIdUnique({appId: appid, idValue: id, loginId: loginid, appLoginId: apploginid}).then(result=>{ + if(result&&result.isNotUnique) { + registerAppDataMappingEditForm.showError('apploginid',getLabel('31053','已存在,请确认')); + return; + }else{ + IntegrationUtil.onCheck(registerAppDataMappingEditForm,function () { + let operation = id==""?"adduser":"edit"; + let params = Object.assign({id:id,appid:appid,operation:operation}, registerAppDataMappingEditForm.getFormParams()); + authenticationCenterStore.getRegisterAppDataMappingOperation(params); + }); + } + }); + } + }); + } + } +} diff --git a/pc4backstage/integration/components/authenticationApp/AppDataMappingImportDialog.js b/pc4backstage/integration/components/authenticationApp/AppDataMappingImportDialog.js new file mode 100644 index 0000000..f144493 --- /dev/null +++ b/pc4backstage/integration/components/authenticationApp/AppDataMappingImportDialog.js @@ -0,0 +1,169 @@ +import { Button } from "antd"; +import { WeaSwitch } from "comsMobx"; +import { WeaDialog, WeaFormItem, WeaLocaleProvider, WeaRightMenu, WeaSearchGroup, WeaUpload } from "ecCom"; +import { toJS } from "mobx"; +import { inject, observer } from "mobx-react"; +import React from "react"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +const getLabel = WeaLocaleProvider.getLabel; + +const store = ["authenticationCenterStore"]; + +@inject(...store) +@observer +export default class AppDataMappingImportDialog extends React.Component { + constructor(props) { + super(props); + this.state = { + file: [], + filelist: [], + collectParams: { + favname: `${getLabel(381908, "统一认证中心")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/AuthenticationCenter", + importantlevel: 1 + } + } + } + + componentDidMount() { + this.setState({ + file: [], + filelist: [], + }) + } + + render() { + const { authenticationCenterStore } = this.props; + const status = toJS(authenticationCenterStore.status); + const {collectParams} = this.state; + + return authenticationCenterStore.setState({ appEditFormDetailDataMappingImportDialogVisible: false })} + visible={status.appEditFormDetailDataMappingImportDialogVisible} + style={{ width: 700, height: 400 }} + hasScroll + moduleName="integration" + buttons={[ + + ]} + moreBtn={{ + datas: this.getRightMenu(), + collectParams: collectParams + }} + > + + { + authenticationCenterStore.registerAppDataMappingImportForm.render({ col: 1, center: true }, { + onChange: (v) => { + }, + isHide: (key, formParams) => { } + + }, true, (c, idx) => { + if (idx == 0) { + let items = []; + let form = authenticationCenterStore.registerAppDataMappingImportForm; + let formParams = form.getFormParams(); + c.items.map((fields, index) => { + if (index === 0) { + items.push({ + com: ( + +
+
+ {this.setState({ file: ids, filelist: list }) }} + > + + +
+
+ {this.state.filelist.length == 0 ?

{getLabel('384040','未选择任何文件')}

: this.state.filelist.map(file =>

{file.filename}

)} +
+
+
), + colSpan: 1, + hide: form.isHide(fields, (key, formParams) => { + let hide = false; + return hide; + }), + }) + + } else { + items.push({ + com: ( + +
+ +
+
), + colSpan: 1, + hide: form.isHide(fields, (key, formParams) => { + let hide = false; + return hide; + }), + }) + } + }); + return + } + })} +
+
+ } + + getRightMenu() { + let btnArr = [ + { + key: 'BTN_SAVE', + icon: , + content: `${getLabel(18596, '导入')}`, + onClick: () => { this.onRightMenuClick('BTN_SAVE') } + } + ]; + return btnArr; + } + + onRightMenuClick = (type) => { + const { authenticationCenterStore } = this.props; + const { registerAppEditForm, registerAppDataMappingImportForm } = authenticationCenterStore; + if (type == 'BTN_SAVE') { + //导入 + IntegrationUtil.onCheck(registerAppDataMappingImportForm, () => { + let operation = "excelImport"; + let params = Object.assign({ appid: registerAppEditForm.getFormParams().appid, operation: operation }, registerAppDataMappingImportForm.getFormParams()); + params.file = JSON.stringify(this.state.file); + params.filelist = JSON.stringify(this.state.filelist); + authenticationCenterStore.getRegisterAppDataMappingOperation(params, (result) => { + authenticationCenterStore.setState({ resultTableHeader: result.resultTableHeader, resultTableData: result.resultTableData }) + authenticationCenterStore.setState({ appEditFormDetailDataMappingImportDialogVisible: false, appEditFormDetailDataMappingImportResultDialogVisible: true }) + }); + }); + + } + + } + +} diff --git a/pc4backstage/integration/components/authenticationApp/AppDataMappingImportResultDialog.js b/pc4backstage/integration/components/authenticationApp/AppDataMappingImportResultDialog.js new file mode 100644 index 0000000..930706b --- /dev/null +++ b/pc4backstage/integration/components/authenticationApp/AppDataMappingImportResultDialog.js @@ -0,0 +1,75 @@ +import React from "react"; +import {inject, observer} from "mobx-react"; +import { Button} from "antd"; +import {toJS} from "mobx"; +import {WeaDialog, WeaLocaleProvider, WeaSearchGroup, WeaRightMenu,WeaTable} from "ecCom"; +const getLabel = WeaLocaleProvider.getLabel; + +const store = ["authenticationCenterStore"]; + +const transformArray = function (origin) { + if (origin.length === 0) { + return false; + } + return Object.keys(origin[0]).map(item => { + return { + title: origin[0][item], + dataIndex: item, + key: item, + } + }) +} + +@inject(...store) +@observer +export default class AppDataMappingImportResultDialog extends React.Component { + render() { + const {authenticationCenterStore} = this.props; + const status = toJS(authenticationCenterStore.status); + const {resultTableHeader,resultTableData} = toJS(status); + + return authenticationCenterStore.setState({appEditFormDetailDataMappingImportResultDialogVisible: false})} + visible={status.appEditFormDetailDataMappingImportResultDialogVisible} + style={{width: 700, height: 600}} + hasScroll + moduleName="integration" + buttons={[ + + ]} + moreBtn={[]} + > + + + + + + + } + + getRightMenu() { + let btnArr = [ + { + key: 'BTN_SAVE', + icon: , + content : `${getLabel(309,'关闭')}`, + onClick : () => {this.onRightMenuClick('BTN_SAVE')} + } + ]; + return btnArr; + } + + onRightMenuClick = (type) => { + const {authenticationCenterStore} = this.props; + if(type == 'BTN_SAVE'){ + //关闭 + authenticationCenterStore.setState({appEditFormDetailDataMappingImportResultDialogVisible: false}); + } + + } + +} diff --git a/pc4backstage/integration/components/authenticationApp/AppEditDetailDialog.js b/pc4backstage/integration/components/authenticationApp/AppEditDetailDialog.js new file mode 100644 index 0000000..24b6dbf --- /dev/null +++ b/pc4backstage/integration/components/authenticationApp/AppEditDetailDialog.js @@ -0,0 +1,791 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { message, Button } from "antd"; +import { toJS } from "mobx"; +import { WeaSwitch, WeaTableNew } from "comsMobx"; +import { WeaDialog, WeaLocaleProvider, WeaSearchGroup, WeaFormItem, WeaRightMenu, WeaTab, WeaNewScroll, WeaButtonIcon, WeaPopoverHrm } from "ecCom"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import AppDataMappingEditDialog from "./AppDataMappingEditDialog"; +import AppDataMappingImportDialog from "./AppDataMappingImportDialog"; +import AppDataMappingImportResultDialog from "./AppDataMappingImportResultDialog"; +import uuid from 'uuid'; +import { checkTableFieldValueUnique } from "../../apis/CommonService"; +import NewShare from "./NewShare"; +import UploadPic from '../../public/UploadPic'; +import copy from 'copy-to-clipboard'; + +const getLabel = WeaLocaleProvider.getLabel; +const { WeaTable } = WeaTableNew; +const store = ["authenticationCenterStore"]; + +@inject(...store) +@observer +export default class AppEditDetailDialog extends React.Component { + constructor(props) { + super(props); + this.state = { + showSearchAd: false, + tokenTopTab: [ + { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(81711, "基本信息")}`, + viewcondition_dt: 0 + } + , { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(131274, "运行日志")}`, + viewcondition_dt: 3 + } + ], + tokenTopTabAll: [ + { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(81711, "基本信息")}`, + viewcondition_dt: 0 + } + , { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(381943, "数据映射")}`, + viewcondition_dt: 2 + } + , { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(131274, "运行日志")}`, + viewcondition_dt: 3 + } + ], + topTab: [ + { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(81711, "基本信息")}`, + viewcondition_dt: 0 + }, { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: getLabel('501806', '授权设置'), + viewcondition_dt: 1 + } + , { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(131274, "运行日志")}`, + viewcondition_dt: 3 + } + ], + topTabAll: [ + { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(81711, "基本信息")}`, + viewcondition_dt: 0 + }, { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: getLabel('501806', '授权设置'), + viewcondition_dt: 1 + } + , { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(381943, "数据映射")}`, + viewcondition_dt: 2 + } + , { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(131274, "运行日志")}`, + viewcondition_dt: 3 + } + ], + collectParams: { + favname: `${getLabel(381908, "统一认证中心")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/AuthenticationCenter", + importantlevel: 1 + } + } + } + + componentWillMount () { + this.setState({ + showSearchAd: false, + }) + } + + render () { + const { + authenticationCenterStore, + } = this.props, { + status, + registerAppEditForm, + tableStore2, + tableStore3, + } = authenticationCenterStore, { + registerAppEditFormCodition, + appEditFormDetailDialogVisible, + registerAppId = "", + editDetailDialogSelectedKey = "0", + } = status, { + collectParams, + } = this.state; + + return + + + {this.getTabComp()} + + { + (registerAppId && editDetailDialogSelectedKey == 0) || (registerAppId == "") + ? this.getForm(registerAppEditForm, toJS(registerAppEditFormCodition)) + : + } + + + + + + + + } + + /** + * 关闭弹窗 + */ + closeEditDialog = () => { + const { authenticationCenterStore } = this.props; + + authenticationCenterStore.setState({ + appEditFormDetailDialogVisible: false, + registerAppId: "", + editDetailDialogSelectedKey: "0", + }); + + this.setState({ + showSearchAd: false, + }) + } + + /** + * 是否渲染weatab组件 + */ + getTabComp = () => { + const { + authenticationCenterStore, + } = this.props, { + status, + } = authenticationCenterStore, { + registerAppId, + editDetailDialogSelectedKey, + } = status, { + showSearchAd, + } = this.state; + + return registerAppId + ? + : null; + } + + /** + * 编辑的时候获取weatab的datas数据 + */ + getTabDatas = () => { + const { + authenticationCenterStore, + } = this.props, { + registerAppEditFormOrg, + } = authenticationCenterStore, { + topTab, + topTabAll, + tokenTopTab, + tokenTopTabAll, + } = this.state, { + account_rules, + auth_type_, + } = registerAppEditFormOrg.getFormParams(); + + if (['6', '7'].includes(account_rules)) { + return (auth_type_ === "TOKEN" ? tokenTopTabAll : topTabAll); + } else { + return (auth_type_ === "TOKEN" ? tokenTopTab : topTab); + } + } + + /** + * weatab高级搜索的方法 + */ + showSearchAd = bool => this.setState({ showSearchAd: bool }); + + hideSearchAd = () => this.setState({ showSearchAd: false }); + + /** + * 高级搜索 + */ + getAdvancedSearch = () => { + const { + authenticationCenterStore + } = this.props, { + searchForm2, + status, + } = authenticationCenterStore, { + condition2 = [], + } = status; + + return IntegrationUtil.getAdvancedItem( + searchForm2, + condition2, + this.onSearch, + false, + this && this.props && this.props.ecId || '', + "IntegrationAuthAppEditDetail", + ); + }; + + onSearch = () => { + const { + authenticationCenterStore + } = this.props, { + status, + } = authenticationCenterStore; + + authenticationCenterStore.getRegisterAppDataMappingList({ id: status.registerAppId }); + this.setState({ showSearchAd: false }); + } + + getTabButtonsAd () { + const { + authenticationCenterStore, + } = this.props; + + return IntegrationUtil.getSearchBtns( + this.onSearch, + () => authenticationCenterStore.searchForm2.reset(), + () => this.setState({ showSearchAd: false }), + this && this.props && this.props.ecId || '', + "IntegrationAuthAppEditDetail", + ); + } + + /** + * weatab切换tab时调用的接口 + */ + onTabChange = v => { + const { + authenticationCenterStore, + } = this.props, { + registerAppId, + } = authenticationCenterStore.status; + + if (v == 2) { + authenticationCenterStore.getRegisterAppDataMappingCondition({}, () => { + authenticationCenterStore.getRegisterAppDataMappingInfo({ id: registerAppId }); + }); + } else if (v == 3) { + authenticationCenterStore.getRegisterAppLoginLogList({ id: registerAppId }); + } else if (v == 0) { + authenticationCenterStore.getRegisterAppEditForm({ id: registerAppId }); + } else if (v == 1) { + authenticationCenterStore.getRegisterAppShareList({ sysid: registerAppId }); + } + authenticationCenterStore.setState({ + editDetailDialogSelectedKey: v, + }); + } + + /** + * weatab的右侧按钮 + */ + getTabButton = () => { + const { + authenticationCenterStore + } = this.props, { + status, + tableStore3, + tableStore2, + } = authenticationCenterStore, { + rightMenus2 = [], + editDetailDialogSelectedKey, + } = status; + + if (editDetailDialogSelectedKey == 2) { + return rightMenus2 && rightMenus2.map((m, index) => ( + + )); + } else if (editDetailDialogSelectedKey == "1") { + return [ + this.onRightMenuClick("share_add")} + />, + this.onRightMenuClick("share_delete")} + /> + ]; + } + return []; + }; + + getIconSize = (form) => { + const { + authenticationCenterStore + } = this.props, { + logoItems = [], + } = toJS(authenticationCenterStore); + return ( + + {logoItems.map((field, index) => { + return ( +
+ + + +
+ ) + })} +
+ ) + } + + getForm = (form, datas) => { + const { + authenticationCenterStore, + } = this.props, { + urllinkimagid = "", + showPic, + registerAppId, + } = authenticationCenterStore.status; + const formParams = form.getFormParams(); + const { isFormInit } = form; + let group = []; + isFormInit && datas && datas.forEach((c, groupI) => { + let items = []; + c.items && c.items.map(fields => { + let domkey = fields.domkey[0]; + if ("logo_width" === domkey) { + return; + } else if (["logo_height"].includes(domkey) && form.getFormParams().auth_type_ != "" && form.getFormParams().auth_type_ != "TOKEN") { + items.push({ + com: this.getIconSize(form), + colSpan: 1, + }) + } else { + if ("service_id" === domkey) { + fields.viewAttr = form.getFormParams().auth_type_ === "OAUTH2" ? 3 : 2; + } + items.push({ + com: ( + + { + domkey === "logo_pic" + ? authenticationCenterStore.setState({ urllinkimagid: id, showPic: false })} + onDel={() => authenticationCenterStore.setState({ urllinkimagid: "", showPic: false })} + /> + :
+ { + if (domkey === 'appid') { + let checkParams = { + tableName: 'weaver_sso_app', + fieldName: 'appid', + fieldValue: form.getFormParams().appid.replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: '' + }; + checkTableFieldValueUnique(checkParams).then(result => { + if (result && result.isNotUnique) { + form.showError('appid', getLabel('387654', '标识已存在')); + } + }); + } + }} /> +
+ {this.getFormOtherComp(domkey, fields, form)} +
+
+ } +
), + colSpan: 1, + hide: form.isHide(fields, (key, allParams) => { + return this.getFormHiddenFields(domkey, allParams); + }) + }) + } + }) + group.push() + }) + return group; + } + + /** + * form按钮的渲染 + */ + getFormOtherComp = (domkey, fields, form) => { + if (domkey === "appid") { + return (); + } else if (domkey === "app_secret_") { + return (); + } else if (domkey === "pub_key") { + return (); + } + } + + /** + * form表单显隐控制 + */ + getFormHiddenFields = (domkey, allParams) => { + const { + authenticationCenterStore, + } = this.props, { + registerAppId, + } = authenticationCenterStore.status; + let hide = false; + + !["isuse", "auth_type_"].includes(domkey) && allParams.auth_type_ == '' && (hide = true); + 'app_secret_' == domkey && allParams.auth_type_ == "CAS" && (hide = true); + ['service_id', "logo_pic", "logo_height", "logo_width"].includes(domkey) && allParams.auth_type_ == "TOKEN" && (hide = true); + ["app_secret_"].includes(domkey) && allParams.auth_type_ == "DELEGATE" && (hide = true); + ['pub_key'].includes(domkey) && ((!registerAppId) || (registerAppId && allParams.auth_type_ != "DELEGATE")) && (hide = true); + 'definebroswerType' == domkey && allParams.account_rules !== '7' && (hide = true); + + return hide; + } + + getBtns = () => { + const { + authenticationCenterStore, + } = this.props, { + status, + registerAppEditForm, + } = authenticationCenterStore, { + editDetailDialogSelectedKey, + registerAppId = "", + } = status; + if (!registerAppId) { + if (registerAppEditForm.getFormParams().auth_type_ === "TOKEN") { + return [ + , + ]; + } else { + return [ + , + , + ]; + } + } else { + if (editDetailDialogSelectedKey == 0) { + return [ + , + ]; + } + } + return []; + } + + getRightMenu = () => { + const { + authenticationCenterStore, + } = this.props, { + status, + registerAppEditForm, + } = authenticationCenterStore, { + rightMenus2, + rowSelectIds2, + registerAppId, + editDetailDialogSelectedKey, + } = status; + + let btnArr = []; + if (editDetailDialogSelectedKey == 0) { + btnArr = [{ + key: 'BTN_SAVE', + icon: , + content: `${getLabel(86, '保存')}`, + onClick: () => { this.onRightMenuClick('BTN_SAVE') } + }]; + if ((!registerAppId) && registerAppEditForm.getFormParams().auth_type_ != "TOKEN") { + btnArr.push({ + key: 'BTN_SAVE_OPEN_SHARE', + icon: , + content: getLabel('521924', '保存并进入授权设置'), + onClick: () => this.onRightMenuClick('BTN_SAVE_OPEN_SHARE') + }) + } + } else if (editDetailDialogSelectedKey == 2) { + rightMenus2 && rightMenus2.forEach(m => { + btnArr.push({ + key: m.type, + icon: , + content: m.menuName, + onClick: () => this.onRightMenuClick(m.type), + disabled: m.menuIcon === 'icon-coms-delete' && rowSelectIds2.length === 0 + }); + }); + btnArr.push({ + key: "BTN_COLUMN", + icon: , + content: `${getLabel(32535, "显示列定制")}`, + onClick: () => this.onRightMenuClick("BTN_COLUMN") + }); + } + return btnArr; + } + + ipv6Test = (value) => { + let reg = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/; + let regV4 = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]|(\*))\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]|(\*))\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]|(\*))\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]|(\*))$/ + + let datas = value.split(','); + for (let i = 0; i < datas.length; i++) { + if (!reg.test(datas[i].trim()) && (!regV4.test(datas[i].trim()))) { + return false; + } + } + return true; + } + + onBaseInfoSave = (type) => { + const { authenticationCenterStore } = this.props; + const { registerAppEditForm, status } = authenticationCenterStore; + const { registerAppId, urllinkimagid = "" } = status; + const formParams = registerAppEditForm.getFormParams(); + + if (formParams.auth_type_ != "OAUTH2") { + let hideFieldsKey = ["service_id"]; + if (["CAS", "DELEGATE"].includes(formParams.auth_type_)) { + hideFieldsKey.push("app_secret_"); + } + window.e9HideFormFieldKeys = hideFieldsKey; + } + let checkParams = { + tableName: 'weaver_sso_app', + fieldName: 'appid', + fieldValue: formParams.appid.replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: '' + }; + IntegrationUtil.checkUnique(checkParams, registerAppEditForm, "appid", "2", registerAppId, () => { + let value = formParams.allow_ip; + let ipv6 = this.ipv6Test(value.trim()); + formParams.logo_pic = urllinkimagid; + IntegrationUtil.onCheck(registerAppEditForm, () => { + if (value.trim() == '' || (value.trim() && ipv6)) { + let params = Object.assign({ id: registerAppId, operation: registerAppId ? "edit" : "add" }, formParams); + authenticationCenterStore.getRegisterAppOperation(params, (record) => { + if ('BTN_SAVE_OPEN_SHARE' === type) { + authenticationCenterStore.setState({ + editDetailDialogSelectedKey: '1', + registerAppId: record.id, + }); + authenticationCenterStore.getRegisterAppShareList({ sysid: record.id }); + } + }, 'BTN_SAVE_OPEN_SHARE' != type); + } else { + registerAppEditForm.showError('allow_ip', getLabel('531149', "ip格式不合法")); + } + }); + }) + } + + onRightMenuClick = (type) => { + const { authenticationCenterStore } = this.props; + const { registerAppEditForm, status, tableStore2, tableStore3 } = authenticationCenterStore; + const { registerAppId, editDetailDialogSelectedKey } = status; + const formParams = registerAppEditForm.getFormParams(); + + if (type === "BTN_COLUMN") { + if (editDetailDialogSelectedKey == 2) { + tableStore2.setColSetVisible(true); + tableStore2.tableColSet(true); + } + } else if ("BTN_SAVE_OPEN_SHARE" === type) { + this.onBaseInfoSave('BTN_SAVE_OPEN_SHARE'); + } else if (type == 'BTN_SAVE') { + this.onBaseInfoSave('BTN_SAVE'); + } else if (type == 'rb_1') { + //注册数据映射 + this.doDataMappingEditById({ randomField0: '', appid: formParams.appid }); + } else if (type == 'rb_2') { + //导入 + authenticationCenterStore.registerAppDataMappingImportForm.reset(); + let params = Object.assign({ id: registerAppId, operation: "import" }, formParams); + authenticationCenterStore.getRegisterAppDataMappingImportForm(params); + authenticationCenterStore.setState({ appEditFormDetailDataMappingImportDialogVisible: true }); + } else if (type == 'rb_3') { + //删除 + if (toJS(tableStore2.selectedRowKeys).length > 0) { + authenticationCenterStore.confirmModal( + `${getLabel(385625, '确定要删除选择的记录吗?')}`, + authenticationCenterStore.getRegisterAppDataMappingOperation, + { + operation: 'delete', id: toJS(tableStore2.selectedRowKeys) + }); + } + } else if (type === "share_delete") { + IntegrationUtil.doConfirm( + getLabel(385625, '确定要删除选择的记录吗?'), + authenticationCenterStore.getRegisterAppShareForm, + { operate: "delShare", sysid: registerAppId, id: toJS(tableStore3.selectedRowKeys) } + ) + } else if (type === "share_add") { + authenticationCenterStore.setState({ + showAddShare: true + }) + authenticationCenterStore.getRegisterAppShareForm({ operate: "getAddShareForm", sysid: registerAppId }); + } + } + + onOperatesClick = (record, index, operate) => { + const { + authenticationCenterStore, + } = this.props, { + registerAppId, + editDetailDialogSelectedKey, + } = authenticationCenterStore.status; + + if (operate.index == "0") { + this.doDataMappingEditById(record); + } else if (operate.index == "1") { + //删除 + if (editDetailDialogSelectedKey == "1") { + IntegrationUtil.doConfirm( + getLabel(15097, '确定要删除吗?'), + authenticationCenterStore.getRegisterAppShareForm, + { operate: "delShare", sysid: registerAppId, id: record.randomFieldId } + ) + } else { + authenticationCenterStore.confirmModal( + `${getLabel(15097, '确定要删除吗?')}`, + authenticationCenterStore.getRegisterAppDataMappingOperation, + { operation: 'delete', id: record.randomField0 } + ); + } + } + }; + + doDataMappingEditById = (record) => { + const { authenticationCenterStore } = this.props; + const { registerAppEditForm } = authenticationCenterStore; + authenticationCenterStore.registerAppDataMappingEditForm.reset(); + authenticationCenterStore.setOperateDataMappingIndex(record.randomField0); + authenticationCenterStore.getRegisterAppDataMappingEditForm({ id: record.randomField0, appid: record.appid, account_rules: registerAppEditForm.getFormParams().account_rules }); + authenticationCenterStore.setState({ appEditFormDetailDataMappingDialogVisible: true }); + } + + getColumns = (columns = []) => { + return columns && columns.map(item => { + if (item.dataIndex === "LoginId") { + item.render = (text, record) => { + return this.doDataMappingEditById(record)}>{text} + } + } + return item; + }) + } +} diff --git a/pc4backstage/integration/components/authenticationApp/NewShare.js b/pc4backstage/integration/components/authenticationApp/NewShare.js new file mode 100644 index 0000000..e99772d --- /dev/null +++ b/pc4backstage/integration/components/authenticationApp/NewShare.js @@ -0,0 +1,361 @@ +import React, { Component } from 'react'; +import { + WeaDialog, + WeaRightMenu, + WeaLocaleProvider, + WeaFormItem, + WeaCheckbox, +} from "ecCom"; +import { + WeaSwitch +} from "comsMobx"; +import { + inject, + observer +} from "mobx-react"; +import {toJS} from "mobx"; +import { + Button +} from "antd"; +import {onCheck} from "../../util/IntegrationUtil"; + +const {getLabel} = WeaLocaleProvider; + +@inject("authenticationCenterStore") +@observer +export default class NewShare extends Component { + constructor(props) { + super(props); + this.state = { + collectParams: { + favname: `${getLabel(381908, "统一认证中心")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/AuthenticationCenter", + importantlevel: 1 + } + } + } + + getRightMenus = () => { + return [{ + type: "primary", + key: "BTN_SAVE", + icon: , + content: getLabel(30986, '保存'), + onClick: () => this.onMenuClick("BTN_SAVE") + }]; + } + + getBtns = () => { + return []; + } + + hideShareField = (params) => { + const { + permissiontype, + jobtitlelevel, + } = params; + + let temp; + + if (permissiontype == '1') { + temp = ['sharevalue6', 'sharevalue5', 'sharevalue2', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '6') { + temp = ['sharevalue1', 'sharevalue5', 'sharevalue2', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '3') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue2', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '5') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue2', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '2') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue7', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (permissiontype == '7') { + if (jobtitlelevel == '1') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue2', 'jobtitlesharevalue2', 'jobtitlesharevalue3']; + } + if (jobtitlelevel == '2') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue2', 'jobtitlesharevalue3']; + } + if (jobtitlelevel == '3') { + temp = ['sharevalue1', 'sharevalue6', 'sharevalue5', 'sharevalue2', 'jobtitlesharevalue2']; + } + } + window.e9HideFormFieldKeys = temp; + } + + onMenuClick = (type="") => { + const{ + authenticationCenterStore + } = this.props, { + getRegisterAppShareForm, + addShareForm, + status, + } = authenticationCenterStore; + if(type === "BTN_SAVE") { + const params = addShareForm.getFormParams(); + this.hideShareField(params); + onCheck(addShareForm, () => { + getRegisterAppShareForm({ + operate: "addShare", + sysid: status.registerAppId, + ...params + }) + }) + } + } + + getForm = (form, condition=[]) => { + const { + permissiontype, + } = form.getFormParams(), { + isFormInit, + } = form; + + let arr = []; + isFormInit && condition.forEach(c => { + c && c.items && c.items.forEach(field => { + const key = field.domkey[0]; + if (this.filter({ + permissiontype, + key + })) { + return + } + + arr.push( + this.handleChange(cb, key, form)}/> + ) + + arr = [...arr, this.add({ + permissiontype, + key, + form, + })]; + }) + }) + return
{arr}
+ } + + filter = (params) => { + const { + permissiontype, + key + } = params; + + if (key == 'sharevalue2' || key == 'rolelevel' || key == 'jobtitlelevel' || key == 'jobtitlesharevalue2' || key == 'jobtitlesharevalue3') { + return true + } + + if (permissiontype == '1' && !(key == 'permissiontype' || key == 'seclevel')) { + return true + } + + if (permissiontype == '6' && !(key == 'permissiontype' || key == 'seclevel')) { + return true + } + + if (permissiontype == '3' && !(key == 'permissiontype' || key == 'seclevel')) { + return true + } + + if (permissiontype == '5' && !(key == 'permissiontype' || key == 'sharevalue5')) { + return true + } + + if (permissiontype == '2' && !(key == 'permissiontype' || key == 'seclevel')) { + return true + } + + if (permissiontype == '7' && !(key == 'permissiontype' || key == 'sharevalue7')) { + return true + } + } + + add = (params) => { + const { + permissiontype, + key, + form, + } = params; + + let temp = []; + if (permissiontype == '2' && key == 'permissiontype') { + temp.push(this.getRole(form)); + } + if (permissiontype == '7' && key == 'sharevalue7') { + temp.push(this.getPost(form)); + } + if ((permissiontype == '6' || permissiontype == '1') && key == 'permissiontype') { + temp.push(this.getContainSubDom(form, permissiontype)); + } + return temp + } + + getContainSubDom = (form, permissiontype) => { + const { + authenticationCenterStore + } = this.props, { + shareFormDepFields, + shareFormSubFields, + } = toJS(authenticationCenterStore); + const temp = permissiontype == "1" ? [...shareFormDepFields] : [...shareFormSubFields]; + return ( + + {temp.map((field, index) => { + return ( + { + index == 0 + ? this.handleChange(cb)}/> + : form.updateFields({has_child: v})} /> + } + + ) + })} + + ) + } + + handleChange = (cb, key, form) => { + if(key === "permissiontype") { + if(['1', '6'].includes(form.getFormParams().permissiontype)) { + form.updateFields({has_child: '0'}); + } + } + } + + getRole = (form) => { + const { + authenticationCenterStore + } = this.props, { + shareFormRole + } = toJS(authenticationCenterStore); + return ( + + {shareFormRole.map((field, index) => { + return ( + this.handleChange(cb)}/> + ) + })} + + ) + } + + getPost = (form) => { + const { + authenticationCenterStore + } = this.props, { + shareFormPost + } = toJS(authenticationCenterStore), { + jobtitlelevel + } = form.getFormParams(); + + let temp; + if (jobtitlelevel == '1') { + temp = shareFormPost.slice(0, 1) + } + if (jobtitlelevel == '2') { + temp = shareFormPost.slice(0, 2) + } + if (jobtitlelevel == '3') { + temp = shareFormPost.slice(0, 1).concat(shareFormPost.slice(2)) + } + + return ( + + {temp.map((field, index) => { + return ( + this.handleChange(cb)}/> + ) + })} + + ) + } + + render() { + const{ + authenticationCenterStore + } = this.props, { + status, + addShareForm, + } = authenticationCenterStore, { + showAddShare, + addShareCondition, + } = toJS(status), { + collectParams + } = this.state; + + return ( + authenticationCenterStore.setState({showAddShare: false})} + buttons={this.getBtns()} + moreBtn={{ + datas: this.getRightMenus(), + collectParams + }} + > + + {this.getForm(addShareForm, addShareCondition)} + + + ) + } +} diff --git a/pc4backstage/integration/components/authenticationApp/index.js b/pc4backstage/integration/components/authenticationApp/index.js new file mode 100644 index 0000000..a593937 --- /dev/null +++ b/pc4backstage/integration/components/authenticationApp/index.js @@ -0,0 +1,304 @@ +import {inject, observer} from "mobx-react"; +import {Button} from "antd"; +import {WeaLocaleProvider, WeaRightMenu, WeaTab, WeaTop} from "ecCom"; +import {WeaLogView, WeaTableNew} from "comsMobx"; +import NoRight from "../../public/NoRight"; +import { + getAdvancedItem, + getSearchBtns, +} from "../../util/IntegrationUtil"; +import AppEditDetailDialog from "./AppEditDetailDialog"; + +const { WeaTable } = WeaTableNew; +const getLabel = WeaLocaleProvider.getLabel; +const WeaLogViewComp = WeaLogView.Component; + +@inject("authenticationCenterStore") +@observer +class AuthenticationCenter extends React.Component { + constructor(props) { + super(props); + this.state = { + visiable: false, + targetId: "", + showSearchAd: false, + searchType: ['base','advanced'], + collectParams: { + favname: getLabel('131607','应用管理'), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/appcenter", + importantlevel: 1 + } + }; + } + + componentDidMount() { + const { authenticationCenterStore } = this.props; + authenticationCenterStore.doAppCenterInit(); + } + + componentWillReceiveProps(nextProps) { + const { authenticationCenterStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + authenticationCenterStore.doAppCenterInit(); + } + } + + /** + * 获取右键菜单 + * @returns {Array} + */ + getRightMenu = () => { + const { + authenticationCenterStore, + } = this.props, { + status, + newForm, + tableStore, + } = authenticationCenterStore, { + rightMenus=[], + } = status, { + selectedRowKeys + } = tableStore, { + isuse, + token_isuse, + oauth2_isuse, + dlgt_isuse, + } = newForm.getFormParams(); + + let btnArr = rightMenus && rightMenus.map(m => { + return { + key: m.type, + icon: , + content: m.menuName, + onClick: () => this.onRightMenuClick(m.type), + disabled: (m.menuIcon==='icon-coms-delete' && selectedRowKeys.length === 0) || (m.menuIcon === "icon-coms-New-Flow" && isuse == 0 && token_isuse == 0&& oauth2_isuse == 0&& dlgt_isuse == 0), + } + }); + //显示列定制 + btnArr.push({ + key: "BTN_COLUMN", + icon: , + content: `${getLabel(32535, "显示列定制")}`, + onClick: () => this.onRightMenuClick("BTN_COLUMN") + }); + return btnArr; + } + + /** + * 获取顶部按钮 + * @returns {Array} + */ + getBtns = () => { + const { + authenticationCenterStore, + } = this.props, { + status, + newForm, + tableStore, + } = authenticationCenterStore, { + rightMenus=[], + } = status, { + selectedRowKeys + } = tableStore, { + isuse, + token_isuse, + oauth2_isuse, + dlgt_isuse, + } = newForm.getFormParams(); + + return rightMenus && rightMenus.map(m => ( + + )); + }; + + /** + * 打开编辑弹窗 + */ + doEditDetailById = (record={}) => { + const { authenticationCenterStore } = this.props; + let tabIndex = record.tabIndex ? record.tabIndex : 0; + + authenticationCenterStore.setState({ + appEditFormDetailDialogVisible: true, + registerAppId: record.id || "", + editDetailDialogSelectedKey: tabIndex, + }); + + if("3" == tabIndex) { + authenticationCenterStore.getRegisterAppLoginLogList({id: record.id}); + } else if("2" == tabIndex) { + authenticationCenterStore.getRegisterAppDataMappingCondition({}, () => { + authenticationCenterStore.getRegisterAppDataMappingInfo({id: record.id}); + }); + } else { + authenticationCenterStore.getRegisterAppEditForm({id: record.id}); + } + } + + /** + * 右键菜单点击事件 + * @param type + */ + onRightMenuClick = (type, record) => { + const { + authenticationCenterStore, + } = this.props, { + tableStore, + confirmModal, + getRegisterAppOperation, + } = authenticationCenterStore; + let id = record ? record.id || "" : tableStore.selectedRowKeys || ""; + + if(type == "rb_1") { + authenticationCenterStore.getRegisterAppEditForm({id}); + authenticationCenterStore.setState({ + appEditFormDetailDialogVisible: true, + registerAppId: "", + editDetailDialogSelectedKey: "0", + }); + } else if(type == "rb_2" || type == "1") { + let title = getLabel(385625, '确定要删除选择的记录吗?'); + + if(type == "1") { + title = getLabel( 15097, '确定要删除吗?'); + } + + confirmModal(title, getRegisterAppOperation, {operation:'delete', id}); + } else if(type == "BTN_COLUMN") { + //显示列定制 + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } else if("0" === type) { + // 编辑 + this.doEditDetailById({id}); + } else if("2" === type) { + //数据映射 + this.doEditDetailById({id, tabIndex: 2}); + } else if("3" === type) { + this.setState({visiable: true, targetId: id}); + } else if("4" === type) { + // 运行日志 + this.doEditDetailById({id, tabIndex: 3}); + } + }; + + /** + * 数据列表行数据的操作项 + * @param record + * @param index + * @param operate + * @param flag + */ + onOperatesClick = (record, index, operate) => this.onRightMenuClick(operate.index, record); + + getColumnsInfo = (datas=[]) => { + return datas && datas.map(data => { + if(data.dataIndex === "appid") { + data.render = (text, record, index) => this.onRightMenuClick("0", record)}>{text}; + } + + return data; + }) + } + + getAdvancedSearch = (form, datas=[]) => { + return getAdvancedItem( + form, + datas, + this.handleSearchFun, + true, + this && this.props && this.props.ecId || '', + "authAppIndex" + ); + }; + + handleSearchFun = () => { + const { authenticationCenterStore } = this.props; + authenticationCenterStore.getRegisterAppList(); + this.setState({ showSearchAd: false }); + } + + getTabButtonsAd = () => { + const { authenticationCenterStore } = this.props; + return getSearchBtns( + this.handleSearchFun, + () => authenticationCenterStore.appCenterForm.reset(), + () => this.setState({ showSearchAd: false }), + this && this.props && this.props.ecId || '', + "authAppIndex", + ); + } + + onCloseLogDialog = () => { + this.setState({ + visiable: false, + targetId: "", + }) + }; + + render() { + const {authenticationCenterStore} = this.props; + const {tableStore, hasRight, logStore, rightLoading, appCenterForm, status} = authenticationCenterStore; + const {appCenterCondition, advanceHeight} = status; + const {collectParams, showSearchAd=false, visiable, targetId, searchType} = this.state; + + return ( + rightLoading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{collectParams}} + > + appCenterForm.updateFields({appid: value})} + showSearchAd={showSearchAd} + setShowSearchAd={() => this.setState({ showSearchAd: !showSearchAd })} + hideSearchAd={() => this.setState({ showSearchAd: false })} + /> + + + + + + : + ); + } +} + +export default AuthenticationCenter; diff --git a/pc4backstage/integration/components/authenticationDelegate/index.js b/pc4backstage/integration/components/authenticationDelegate/index.js new file mode 100644 index 0000000..6b1695e --- /dev/null +++ b/pc4backstage/integration/components/authenticationDelegate/index.js @@ -0,0 +1,202 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import {Button} from "antd"; +import {WeaFormItem, WeaLocaleProvider, WeaRightMenu, WeaSearchGroup, WeaTop} from "ecCom"; +import {WeaSwitch} from "comsMobx"; +import NoRight from "../../public/NoRight"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("authenticationCenterStore") +@observer +class AuthenticationDelegate extends React.Component { + constructor(props) { + super(props); + this.state = { + visiable:false, + collectParams: { + favname: getLabel('521345','Delegate认证'), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/delegate_server", + importantlevel: 1 + } + }; + } + + componentDidMount() { + const { authenticationCenterStore } = this.props; + authenticationCenterStore.doInit(); + } + + componentWillUnmount() { + this.props.authenticationCenterStore.clearStore(); + } + + componentWillReceiveProps(nextProps) { + const { authenticationCenterStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + authenticationCenterStore.doInit(); + } + } + + /** + * 获取右键菜单 + * @returns {Array} + */ + getRightMenu = () => { + return [{ + key: "BTN_BASE_SAVE", + icon: , + content: `${getLabel(30986, '保存')}`, + onClick: () => this.onRightMenuClick("BTN_BASE_SAVE") + }, { + key: 'BTN_TEST', + icon: , + content: `${getLabel(25496, '测试')}`, + onClick: () => this.onRightMenuClick('BTN_TEST') + }]; + } + + /** + * 获取顶部按钮 + * @returns {Array} + */ + getBtns = () => { + return [ + , + + ] + }; + + /** + * 右键菜单点击事件 + * @param type + */ + onRightMenuClick = (type) => { + const { authenticationCenterStore } = this.props; + const { newForm } = authenticationCenterStore; + + IntegrationUtil.onCheck(newForm, () => { + let params = newForm.getFormParams(); + delete params.isuse; + delete params.token_isuse; + delete params.oauth2_isuse; + delete params.spnego_isuse; + + if (type == "BTN_BASE_SAVE") { + params.method = 'weaversso'; + + if(params.dlgt_isuse == "1") { + authenticationCenterStore.getBaseInfoFormOperation({casserverurl: params.loginurl || "", method: 'test', testBeforeSave: true}, (result) => { + if(result.success) { + if(params.dlgt_ec_isuse == '1') { + IntegrationUtil.doConfirm( + getLabel('529602','经检测,需要同时开启Delegate集成(会重新生成Delegate集成配置),保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!'), + authenticationCenterStore.getBaseInfoFormOperation, + params, + ) + } else { + authenticationCenterStore.getBaseInfoFormOperation(params); + } + } + }); + } else { + if(params.dlgt_ec_isuse == '1') { + IntegrationUtil.doConfirm( + getLabel('529601','经检测,需要同时关闭Delegate集成,保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!'), + authenticationCenterStore.getBaseInfoFormOperation, + params + ) + } else { + authenticationCenterStore.getBaseInfoFormOperation(params); + } + } + } else if ("BTN_TEST" === type) { + params = { + method: 'test', + casserverurl: params.loginurl || "", + }; + authenticationCenterStore.getBaseInfoFormOperation(params); + } + }); + }; + + getBaseInfoForm = () => { + const {authenticationCenterStore} = this.props; + const {newForm, status} = authenticationCenterStore; + const {BaseInfoFormFields} = toJS(status); + const {isFormInit} = newForm; + let group = []; + + isFormInit && BaseInfoFormFields && BaseInfoFormFields.forEach(c =>{ + if(['delegate', 'desc'].includes(c.key)) { + let items = []; + c.items && c.items.forEach(fields => { + items.push({ + com:(
+ + + +
), + colSpan:1, + hide: newForm.isHide(fields, (keys, allParams) => { + let bool = false; + !["delegate_desc_", "dlgt_isuse"].includes(fields.domkey[0]) && allParams.dlgt_isuse != '1' && (bool = true); + return bool; + }) + }); + }); + group.push( + ); + } + }); + return group; + } + + render() { + const {authenticationCenterStore} = this.props; + const {hasRight, rightLoading} = authenticationCenterStore; + const {collectParams} = this.state; + + return ( + rightLoading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{collectParams}} + > + {this.getBaseInfoForm()} + + + : + ); + } +} + +export default AuthenticationDelegate; diff --git a/pc4backstage/integration/components/authenticationHelp/index.js b/pc4backstage/integration/components/authenticationHelp/index.js new file mode 100644 index 0000000..5d668c3 --- /dev/null +++ b/pc4backstage/integration/components/authenticationHelp/index.js @@ -0,0 +1,102 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import {WeaLocaleProvider, WeaRightMenu, WeaTab, WeaTop} from "ecCom"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("authenticationCenterStore") +@observer +class AuthenticationCenter extends React.Component { + constructor(props) { + super(props); + this.state = { + visiable:false, + topTab: [ + { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(381910, "配置说明")}`, + viewcondition: 2 + } + ,{ + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(381911, "开发说明")}`, + viewcondition: 3 + } + ], + collectParams: { + favname: getLabel('516460','帮助中心'), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/helpcenter", + importantlevel: 1 + } + }; + } + + componentWillMount() { + this.props.authenticationCenterStore.setState({selectedKey: "2"}); + } + + componentWillUnmount() { + this.props.authenticationCenterStore.clearStore(); + } + + componentDidMount() { + const {authenticationCenterStore} = this.props; + authenticationCenterStore.setState({selectedKey: "2"}) + } + + componentWillReceiveProps(nextProps) { + const {authenticationCenterStore} = this.props; + if (this.props.location.key !== nextProps.location.key) { + authenticationCenterStore.setState({selectedKey: "2"}); + } + } + + render() { + const { authenticationCenterStore } = this.props; + const {status} = authenticationCenterStore; + const {selectedKey} = toJS(status); + const {topTab, collectParams} = this.state; + + return ( + } + iconBgcolor="#1a57a0" + buttons={[]} + showDropIcon={true} + dropMenuDatas={[]} + dropMenuProps={{collectParams}} + > + authenticationCenterStore.setState({selectedKey: v})} + /> + { + selectedKey == 2 ? ( +
+ +
+ ) : selectedKey == 3 ? ( +
+ +
+ ):(
) + } +
+
+ ); + } +} + +export default AuthenticationCenter; diff --git a/pc4backstage/integration/components/authenticationOAuth2/index.js b/pc4backstage/integration/components/authenticationOAuth2/index.js new file mode 100644 index 0000000..b0089a4 --- /dev/null +++ b/pc4backstage/integration/components/authenticationOAuth2/index.js @@ -0,0 +1,203 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import {Button} from "antd"; +import {WeaFormItem, WeaLocaleProvider, WeaRightMenu, WeaSearchGroup, WeaTop, WeaTools} from "ecCom"; +import {WeaSwitch} from "comsMobx"; +import NoRight from "../../public/NoRight"; +import NonStand from "../../public/NonStand"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import PopoverButton from '../../public/PopoverButton'; +import "../../style/webxml.less"; + +const { getKey } = WeaTools; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("authenticationCenterStore") +@observer +class AuthenticationCenter extends React.Component { + constructor(props) { + super(props); + this.state = { + visiable:false, + collectParams: { + favname: getLabel('518323','OAuth2认证'), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/oauth2_server", + importantlevel: 1 + } + }; + } + + componentDidMount() { + const { authenticationCenterStore } = this.props; + authenticationCenterStore.doInit("oauth2"); + } + + componentWillUnmount() { + this.props.authenticationCenterStore.clearStore(); + } + + componentWillReceiveProps(nextProps) { + const { authenticationCenterStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + authenticationCenterStore.doInit("oauth2"); + } + } + + /** + * 获取右键菜单 + * @returns {Array} + */ + getRightMenu = () => { + return [{ + key: "BTN_BASE_SAVE", + icon: , + content: getLabel(30986, '保存'), + onClick: () => this.onRightMenuClick("BTN_BASE_SAVE") + } + , { + key: 'BTN_TEST', + icon: , + content: `${getLabel(25496, '测试')}`, + onClick: () => this.onRightMenuClick('BTN_TEST') + } + ] + } + + /** + * 获取顶部按钮 + * @returns {Array} + */ + getBtns = () => { + return [ + this.onRightMenuClick("BTN_BASE_SAVE")} + />, + + ] + }; + + /** + * 右键菜单点击事件 + * @param type + */ + onRightMenuClick = (type) => { + const { authenticationCenterStore } = this.props; + const { newForm } = authenticationCenterStore; + + if (type == "BTN_BASE_SAVE") { + IntegrationUtil.onCheck(newForm,()=>{ + let params = Object.assign({}, newForm.getFormParams(), {method: 'weaversso'}); + delete params.isuse; + delete params.token_isuse; + delete params.spnego_isuse; + delete params.dlgt_isuse; + if(params.oauth2_isuse == "1") { + authenticationCenterStore.getBaseInfoFormOperation({oauth2_heartbeat_url: params.oauth2_heartbeat_url, method: 'oauth2_test', testBeforeSave: true}, (result) => { + if(result.success) { + if(params.oauth2_client_isuse == '1') { + IntegrationUtil.doConfirm( + getLabel('521937','经检测,需要同时开启OAuth2集成(会重新生成OAuth2集成配置),保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!'), + authenticationCenterStore.getBaseInfoFormOperation, + params, + ) + } else { + authenticationCenterStore.getBaseInfoFormOperation(params); + } + } + }); + }else { + if(params.oauth2_client_isuse == '1') { + IntegrationUtil.doConfirm( + getLabel('521939','经检测,需要同时关闭OAuth2集成,保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!'), + authenticationCenterStore.getBaseInfoFormOperation, + params + ) + } else { + authenticationCenterStore.getBaseInfoFormOperation(params); + } + } + }); + }else if(type == "BTN_TEST") { + let loginurl = newForm.getFormParams().oauth2_heartbeat_url; + let params = {oauth2_heartbeat_url: loginurl, method: 'oauth2_test'}; + authenticationCenterStore.getBaseInfoFormOperation(params); + } + }; + + getBaseInfoForm = () => { + const {authenticationCenterStore} = this.props; + const {newForm, status} = authenticationCenterStore; + const {BaseInfoFormFields} = toJS(status); + const {isFormInit} = newForm; + let group = []; + const formParams = newForm.getFormParams(); + + isFormInit && BaseInfoFormFields && BaseInfoFormFields.map((c, index) =>{ + if(index == 2) { + let items = []; + c.items && c.items.map(fields => { + items.push({ + com:( + + {}} /> + ), + colSpan:1, + hide: newForm.isHide(fields, (keys, allParams) => { + let bool = false; + getKey(fields) != 'oauth2_isuse' && allParams.oauth2_isuse != '1' && (bool = true); + return bool; + }) + }); + }); + group.push(); + } + }); + return group; + } + + render() { + const {authenticationCenterStore} = this.props; + const {hasRight, rightLoading, status} = authenticationCenterStore; + const {hasNonStandard, nonStandLoading} = toJS(status); + const {collectParams} = this.state; + + return (nonStandLoading + ? null + : hasNonStandard + ? rightLoading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{collectParams}} + > + {this.getBaseInfoForm()} + + + : + : + ); + } +} + +export default AuthenticationCenter; diff --git a/pc4backstage/integration/components/authenticationSPNEGO/index.js b/pc4backstage/integration/components/authenticationSPNEGO/index.js new file mode 100644 index 0000000..c39e912 --- /dev/null +++ b/pc4backstage/integration/components/authenticationSPNEGO/index.js @@ -0,0 +1,169 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import {Button} from "antd"; +import {WeaFormItem, WeaLocaleProvider, WeaRightMenu, WeaSearchGroup, WeaTop, WeaTools} from "ecCom"; +import {WeaSwitch} from "comsMobx"; +import NoRight from "../../public/NoRight"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; + +const { getKey } = WeaTools; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("authenticationCenterStore") +@observer +class AuthenticationSPNEGO extends React.Component { + constructor(props) { + super(props); + this.state = { + visiable:false, + collectParams: { + favname: getLabel('521386','SPNEGO认证'), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/spnego", + importantlevel: 1 + } + }; + } + + componentDidMount() { + const { authenticationCenterStore } = this.props; + authenticationCenterStore.doInit(); + } + + componentWillUnmount() { + this.props.authenticationCenterStore.clearStore(); + } + + componentWillReceiveProps(nextProps) { + const { authenticationCenterStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + authenticationCenterStore.doInit(); + } + } + + /** + * 获取右键菜单 + * @returns {Array} + */ + getRightMenu() { + return [{ + key: "BTN_BASE_SAVE", + icon: , + content: `${getLabel(30986, '保存')}`, + onClick: () => this.onRightMenuClick("BTN_BASE_SAVE") + } + ] + } + + /** + * 获取顶部按钮 + * @returns {Array} + */ + getBtns = () => { + return [ + , + ] + }; + + /** + * 右键菜单点击事件 + * @param type + */ + onRightMenuClick = (type) => { + const { authenticationCenterStore } = this.props; + const { newForm } = authenticationCenterStore; + + if (type == "BTN_BASE_SAVE") { + IntegrationUtil.onCheck(newForm,()=>{ + let params = Object.assign({}, newForm.getFormParams(), {method: 'weaversso'}); + delete params.isuse; + delete params.token_isuse; + delete params.oauth2_isuse; + delete params.dlgt_isuse; + authenticationCenterStore.getBaseInfoFormOperation(params); + }); + } + }; + + getBaseInfoForm = () => { + const {authenticationCenterStore} = this.props; + const {newForm, status} = authenticationCenterStore; + const {BaseInfoFormFields, spnegoDescription=""} = toJS(status); + const {isFormInit} = newForm; + let group = []; + const formParams = newForm.getFormParams(); + + isFormInit && BaseInfoFormFields && BaseInfoFormFields.forEach((c, index) =>{ + if(index == 3) { + let items = []; + c.items && c.items.forEach(fields => { + if(fields.domkey[0] != "spnego_desc_") { + items.push({ + com:( + + {}} /> + ), + colSpan:1, + hide: newForm.isHide(fields, (keys, allParams) => { + let bool = false; + getKey(fields) === 'spnego_ds' && allParams.spnego_isuse != '1' && (bool = true); + return bool; + }) + }); + } + }); + group.push(); + } + }); + group.push( + +
+ + ); + return group; + } + + render() { + const {authenticationCenterStore} = this.props; + const {hasRight, rightLoading} = authenticationCenterStore; + const {collectParams} = this.state; + + return ( + rightLoading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{collectParams}} + > + {this.getBaseInfoForm()} + + + : + ); + } +} + +export default AuthenticationSPNEGO; diff --git a/pc4backstage/integration/components/authenticationToken/index.js b/pc4backstage/integration/components/authenticationToken/index.js new file mode 100644 index 0000000..e27fd01 --- /dev/null +++ b/pc4backstage/integration/components/authenticationToken/index.js @@ -0,0 +1,167 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import {WeaFormItem, WeaLocaleProvider, WeaRightMenu, WeaSearchGroup, WeaTop, WeaTools} from "ecCom"; +import {WeaSwitch} from "comsMobx"; +import NoRight from "../../public/NoRight"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import {Button} from "antd"; +import "../../style/webxml.less"; + +const { getKey } = WeaTools; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("authenticationCenterStore") +@observer +class AuthenticationCenter extends React.Component { + constructor(props) { + super(props); + this.state = { + visiable:false, + collectParams: { + favname: getLabel('516738','Token认证'), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/token", + importantlevel: 1 + } + }; + } + + componentDidMount() { + const { authenticationCenterStore } = this.props; + authenticationCenterStore.doInit(); + } + + componentWillUnmount() { + this.props.authenticationCenterStore.clearStore(); + } + + componentWillReceiveProps(nextProps) { + const { authenticationCenterStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + authenticationCenterStore.doInit(); + } + } + + /** + * 获取右键菜单 + * @returns {Array} + */ + getRightMenu() { + return [{ + key: "BTN_BASE_SAVE", + icon: , + content: getLabel(30986, '保存'), + onClick: () => this.onRightMenuClick("BTN_BASE_SAVE") + } + ] + } + + /** + * 获取顶部按钮 + * @returns {Array} + */ + getBtns = () => { + return [ + + ] + }; + + /** + * 右键菜单点击事件 + * @param type + */ + onRightMenuClick = (type) => { + const { authenticationCenterStore } = this.props; + const { newForm } = authenticationCenterStore; + + if (type == "BTN_BASE_SAVE") { + IntegrationUtil.onCheck(newForm,()=>{ + let params = Object.assign({}, newForm.getFormParams(), {method: 'weaversso'}); + delete params.isuse; + delete params.oauth2_isuse; + delete params.spnego_isuse; + delete params.dlgt_isuse; + IntegrationUtil.doConfirm( + getLabel('512788','保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!'), + authenticationCenterStore.getBaseInfoFormOperation, + params + ) + }); + }else if(type == "BTN_TEST") { + let loginurl = newForm.getFormParams().loginurl; + let params = {casserverurl: loginurl, method: 'test'}; + authenticationCenterStore.getBaseInfoFormOperation(params); + } + }; + + getBaseInfoForm = () => { + const {authenticationCenterStore} = this.props; + const {newForm, status} = authenticationCenterStore; + const {BaseInfoFormFields} = toJS(status); + const {isFormInit} = newForm; + let group = []; + const formParams = newForm.getFormParams(); + + isFormInit && BaseInfoFormFields && BaseInfoFormFields.map((c, index) =>{ + if(index == 1) { + let items = []; + c.items && c.items.map(fields => { + items.push({ + com:( + + {}} /> + ), + colSpan:1, + hide: newForm.isHide(fields, (keys, allParams) => { + let bool = false; + getKey(fields) === 'get_token_url' && allParams.token_isuse != '1' && (bool = true); + getKey(fields) === 'check_token_url' && allParams.token_isuse != '1' && (bool = true); + return bool; + }) + }); + }); + group.push(); + } + }); + return group; + } + + render() { + const {authenticationCenterStore} = this.props; + const {hasRight, rightLoading} = authenticationCenterStore; + const {collectParams} = this.state; + + return ( + rightLoading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{collectParams}} + > + {this.getBaseInfoForm()} + + + : + ); + } +} + +export default AuthenticationCenter; diff --git a/pc4backstage/integration/components/authenticationcenter/AppDataMappingEditDialog.js b/pc4backstage/integration/components/authenticationcenter/AppDataMappingEditDialog.js new file mode 100644 index 0000000..4aadcbf --- /dev/null +++ b/pc4backstage/integration/components/authenticationcenter/AppDataMappingEditDialog.js @@ -0,0 +1,167 @@ +// import React from "react"; +// import {inject, observer} from "mobx-react"; +// import { Button} from "antd"; +// import {toJS} from "mobx"; +// import {WeaForm, WeaLogView, WeaNewScroll, WeaSwitch, WeaTableNew} from "comsMobx"; +// import {WeaDialog, WeaLocaleProvider, WeaTools, WeaSearchGroup, WeaFormItem, WeaRightMenu} from "ecCom"; +// import * as IntegrationUtil from "../../util/IntegrationUtil"; +// import {checkUserMappingLoginIdUnique,checkUserMappingAppLoginIdUnique} from "../../apis/AuthenticationCenterService" +// const { getKey } = WeaTools; +// const getLabel = WeaLocaleProvider.getLabel; + +// const store = ["authenticationCenterStore"]; + +// @inject(...store) +// @observer +// export default class AppDataMappingEditDialog extends React.Component { +// constructor(props) { +// super(props); +// this.state = { +// collectParams: { +// favname: `${getLabel(381908, "统一认证中心")}`, +// favouritetype: 1, +// objid: 0, +// link: "wui/engine.html#/integration/AuthenticationCenter", +// importantlevel: 1 +// } +// } +// } + +// render() { +// const {authenticationCenterStore} = this.props; +// const status = toJS(authenticationCenterStore.status); +// const {collectParams} = this.state; +// return authenticationCenterStore.setState({appEditFormDetailDataMappingDialogVisible: false})} +// visible={status.appEditFormDetailDataMappingDialogVisible} +// style={{width: 700, height: 400}} +// hasScroll +// moduleName="integration" +// buttons={[ +// +// ]} +// moreBtn={{ +// datas: this.getRightMenu(), +// collectParams: collectParams +// }} +// > +// +// { +// authenticationCenterStore.registerAppDataMappingEditForm.render({col: 1},{ +// onChange: (v)=> { +// }, +// isHide: (key, formParams) => {} + +// },true,(c, idx)=>{ +// if(idx==0){ +// let items = []; +// let bottomDis = 0; +// let form = authenticationCenterStore.registerAppDataMappingEditForm; +// let formParams = form.getFormParams(); +// c.items.map(fields => { +// if(getKey(fields) == 'apploginid') { +// bottomDis = 15; +// }else { +// bottomDis = 0; +// } +// items.push({ +// com: ( +//
+// +// +// { +// if(getKey(fields) === 'userid') { +// let params={userid:form.getFormParams().userid,operation:'getUserInfo'}; +// authenticationCenterStore.getRegisterAppDataMappingOperation(params,(result)=>{ +// if(result) { +// if(result.depname) { +// form.updateFields({depname: result.depname}); +// } +// if(result.subname) { +// form.updateFields({subname: result.subname}); +// } +// if(result.loginid) { +// form.updateFields({loginid: result.loginid}); +// } +// } +// }) +// } +// }} +// /> +// {/*{getKey(fields)==='account_rules'&&formParams.account_rules>5?:""}*/} +// + +//
), +// colSpan: 1, +// hide: form.isHide(fields, (key, formParams) => { +// let hide = false; +// if ('definebroswerType' == key && formParams.account_rules !== '7') { +// hide = true; +// } +// return hide; +// }), +// onChange: (v)=> { + +// } +// }) +// }); + +// return +// } +// })} +//
+//
+// } + +// getRightMenu() { +// let btnArr = [ +// { +// key: 'BTN_SAVE', +// icon: , +// content : `${getLabel(86,'保存')}`, +// onClick : () => this.onRightMenuClick('BTN_SAVE') +// } +// ]; +// return btnArr; +// } + +// onRightMenuClick = (type) => { +// const {authenticationCenterStore} = this.props; +// const {registerAppEditForm,registerAppDataMappingEditForm, status} = authenticationCenterStore; +// if(type == 'BTN_SAVE'){ +// let id=authenticationCenterStore.registerAppDataMappingId||""; +// let appid = registerAppEditForm.getFormParams().appid; +// let loginid = registerAppDataMappingEditForm.getFormParams().loginid; +// let apploginid = registerAppDataMappingEditForm.getFormParams().apploginid; +// checkUserMappingLoginIdUnique({appId: appid, idValue: id, loginId: loginid, appLoginId: apploginid}).then(result=>{ +// if(result&&result.isNotUnique) { +// registerAppDataMappingEditForm.showError('userid',getLabel('31053','已存在,请确认')); +// }else{ +// checkUserMappingAppLoginIdUnique({appId: appid, idValue: id, loginId: loginid, appLoginId: apploginid}).then(result=>{ +// if(result&&result.isNotUnique) { +// registerAppDataMappingEditForm.showError('apploginid',getLabel('31053','已存在,请确认')); +// return; +// }else{ +// IntegrationUtil.onCheck(registerAppDataMappingEditForm,function () { +// let operation = id==""?"adduser":"edit"; +// let params = Object.assign({id:id,appid:appid,operation:operation}, registerAppDataMappingEditForm.getFormParams()); +// authenticationCenterStore.getRegisterAppDataMappingOperation(params); +// }); +// } +// }); +// } +// }); +// } +// } +// } diff --git a/pc4backstage/integration/components/authenticationcenter/AppDataMappingImportDialog.js b/pc4backstage/integration/components/authenticationcenter/AppDataMappingImportDialog.js new file mode 100644 index 0000000..d0dd2d1 --- /dev/null +++ b/pc4backstage/integration/components/authenticationcenter/AppDataMappingImportDialog.js @@ -0,0 +1,183 @@ +// import { Button } from "antd"; +// import { WeaSwitch } from "comsMobx"; +// import { WeaDialog, WeaFormItem, WeaLocaleProvider, WeaRightMenu, WeaSearchGroup, WeaTools, WeaUpload } from "ecCom"; +// import { toJS } from "mobx"; +// import { inject, observer } from "mobx-react"; +// import React from "react"; +// import * as IntegrationUtil from "../../util/IntegrationUtil"; +// const { getKey } = WeaTools; +// const getLabel = WeaLocaleProvider.getLabel; + +// const store = ["authenticationCenterStore"]; + +// @inject(...store) +// @observer +// export default class AppDataMappingImportDialog extends React.Component { +// constructor(props) { +// super(props); +// this.state = { +// file: [], +// filelist: [], +// collectParams: { +// favname: `${getLabel(381908, "统一认证中心")}`, +// favouritetype: 1, +// objid: 0, +// link: "wui/engine.html#/integration/AuthenticationCenter", +// importantlevel: 1 +// } +// } +// } + +// componentDidMount() { +// this.setState({ +// file: [], +// filelist: [], +// }) +// } + +// render() { +// const { authenticationCenterStore } = this.props; +// const status = toJS(authenticationCenterStore.status); +// const {collectParams} = this.state; + +// return authenticationCenterStore.setState({ appEditFormDetailDataMappingImportDialogVisible: false })} +// visible={status.appEditFormDetailDataMappingImportDialogVisible} +// style={{ width: 700, height: 400 }} +// hasScroll +// moduleName="integration" +// buttons={[ +// +// ]} +// moreBtn={{ +// datas: this.getRightMenu(), +// collectParams: collectParams +// }} +// > +// +// { +// authenticationCenterStore.registerAppDataMappingImportForm.render({ col: 1, center: true }, { +// onChange: (v) => { +// }, +// isHide: (key, formParams) => { } + +// }, true, (c, idx) => { +// if (idx == 0) { +// let items = []; +// let form = authenticationCenterStore.registerAppDataMappingImportForm; +// let formParams = form.getFormParams(); +// c.items.map((fields, index) => { +// if (index === 0) { +// items.push({ +// com: ( +// +//
+//
+// {this.setState({ file: ids, filelist: list }) }} +// > +// +// +//
+//
+// {this.state.filelist.length == 0 ?

{getLabel('384040','未选择任何文件')}

: this.state.filelist.map(file =>

{file.filename}

)} +//
+//
+//
), +// colSpan: 1, +// hide: form.isHide(fields, (key, formParams) => { +// let hide = false; +// return hide; +// }), +// onChange: (v) => { + +// } +// }) + +// } else { +// items.push({ +// com: ( +// +//
+// { +// if (getKey(fields) === 'userid') { +// } +// }} +// /> +//
+ +//
), +// colSpan: 1, +// hide: form.isHide(fields, (key, formParams) => { +// let hide = false; +// return hide; +// }), +// onChange: (v) => { + +// } +// }) +// } +// }); +// return +// } +// })} +//
+//
+// } + +// getRightMenu() { +// let btnArr = [ +// { +// key: 'BTN_SAVE', +// icon: , +// content: `${getLabel(18596, '导入')}`, +// onClick: () => { this.onRightMenuClick('BTN_SAVE') } +// } +// ]; +// return btnArr; +// } + +// onRightMenuClick = (type) => { +// const { authenticationCenterStore } = this.props; +// const { registerAppEditForm, registerAppDataMappingImportForm, status } = authenticationCenterStore; +// if (type == 'BTN_SAVE') { +// //导入 +// IntegrationUtil.onCheck(registerAppDataMappingImportForm, () => { +// let operation = "excelImport"; +// let params = Object.assign({ appid: registerAppEditForm.getFormParams().appid, operation: operation }, registerAppDataMappingImportForm.getFormParams()); +// params.file = JSON.stringify(this.state.file); +// params.filelist = JSON.stringify(this.state.filelist); +// authenticationCenterStore.getRegisterAppDataMappingOperation(params, (result) => { +// authenticationCenterStore.setState({ resultTableHeader: result.resultTableHeader, resultTableData: result.resultTableData }) +// authenticationCenterStore.setState({ appEditFormDetailDataMappingImportDialogVisible: false, appEditFormDetailDataMappingImportResultDialogVisible: true }) +// }); +// }); + +// } + +// } + +// } diff --git a/pc4backstage/integration/components/authenticationcenter/AppDataMappingImportResultDialog.js b/pc4backstage/integration/components/authenticationcenter/AppDataMappingImportResultDialog.js new file mode 100644 index 0000000..aaf959e --- /dev/null +++ b/pc4backstage/integration/components/authenticationcenter/AppDataMappingImportResultDialog.js @@ -0,0 +1,80 @@ +// import React from "react"; +// import {inject, observer} from "mobx-react"; +// import { Button} from "antd"; +// import {toJS} from "mobx"; +// import {WeaForm, WeaLogView, WeaNewScroll, WeaSwitch, WeaTableNew} from "comsMobx"; +// import {WeaDialog, WeaLocaleProvider, WeaTools, WeaSearchGroup, WeaFormItem, WeaRightMenu,WeaTable} from "ecCom"; +// import * as IntegrationUtil from "../../util/IntegrationUtil"; +// const { getKey } = WeaTools; +// const getLabel = WeaLocaleProvider.getLabel; + +// const store = ["authenticationCenterStore"]; + +// const transformArray = function (origin) { +// if (origin.length === 0) { +// return false; +// } +// return Object.keys(origin[0]).map(item => { +// return { +// title: origin[0][item], +// dataIndex: item, +// key: item, +// } +// }) +// } + +// @inject(...store) +// @observer +// export default class AppDataMappingImportResultDialog extends React.Component { +// render() { +// const {authenticationCenterStore} = this.props; +// const status = toJS(authenticationCenterStore.status); +// const {resultTableHeader,resultTableData} = toJS(status); + +// return authenticationCenterStore.setState({appEditFormDetailDataMappingImportResultDialogVisible: false})} +// visible={status.appEditFormDetailDataMappingImportResultDialogVisible} +// style={{width: 700, height: 600}} +// hasScroll +// moduleName="integration" +// buttons={[ +// +// ]} +// moreBtn={[]} +// > +// +// +// +// +// +// +// } + +// getRightMenu() { +// let btnArr = [ +// { +// key: 'BTN_SAVE', +// icon: , +// content : `${getLabel(309,'关闭')}`, +// onClick : () => {this.onRightMenuClick('BTN_SAVE')} +// } +// ]; +// return btnArr; +// } + +// onRightMenuClick = (type) => { +// const {authenticationCenterStore} = this.props; +// const {registerAppEditForm,registerAppDataMappingImportForm, status} = authenticationCenterStore; +// if(type == 'BTN_SAVE'){ +// //关闭 +// authenticationCenterStore.setState({appEditFormDetailDataMappingImportResultDialogVisible: false}); + +// } + +// } + +// } diff --git a/pc4backstage/integration/components/authenticationcenter/AppEditDetailDialog.js b/pc4backstage/integration/components/authenticationcenter/AppEditDetailDialog.js new file mode 100644 index 0000000..e65772a --- /dev/null +++ b/pc4backstage/integration/components/authenticationcenter/AppEditDetailDialog.js @@ -0,0 +1,381 @@ +// import React from "react"; +// import {inject, observer} from "mobx-react"; +// import { Button} from "antd"; +// import {toJS} from "mobx"; +// import {WeaForm, WeaLogView, WeaSwitch, WeaTableNew} from "comsMobx"; +// import {WeaDialog, WeaLocaleProvider, WeaTools, WeaSearchGroup, WeaFormItem, WeaRightMenu,WeaTab,WeaNewScroll,WeaTop,WeaPopoverHrm} from "ecCom"; +// import * as IntegrationUtil from "../../util/IntegrationUtil"; +// import AppDataMappingEditDialog from "./AppDataMappingEditDialog"; +// import AppDataMappingImportDialog from "./AppDataMappingImportDialog"; +// import AppDataMappingImportResultDialog from "./AppDataMappingImportResultDialog"; +// import uuid from 'uuid'; +// import {checkTableFieldValueUnique} from "../../apis/CommonService"; + +// const { getKey } = WeaTools; +// const getLabel = WeaLocaleProvider.getLabel; +// const { WeaTable } = WeaTableNew; +// const store = ["authenticationCenterStore"]; + +// @inject(...store) +// @observer +// export default class AppEditDetailDialog extends React.Component { +// constructor (props) { +// super(props); +// this.state = { +// topTab: [ +// { +// color: "#000000", +// groupid: "flowAll", +// showcount: true, +// title: `${getLabel(81711, "基本信息")}`, +// viewcondition_dt: 0 +// } +// ,{ +// color: "#000000", +// groupid: "flowAll", +// showcount: true, +// title: `${getLabel(131274, "运行日志")}`, +// viewcondition_dt: 2 +// } +// ], +// topTabAll: [ +// { +// color: "#000000", +// groupid: "flowAll", +// showcount: true, +// title: `${getLabel(81711, "基本信息")}`, +// viewcondition_dt: 0 +// } +// ,{ +// color: "#000000", +// groupid: "flowAll", +// showcount: true, +// title: `${getLabel(381943, "数据映射")}`, +// viewcondition_dt: 1 +// } +// ,{ +// color: "#000000", +// groupid: "flowAll", +// showcount: true, +// title: `${getLabel(131274, "运行日志")}`, +// viewcondition_dt: 2 +// } +// ], +// collectParams: { +// favname: `${getLabel(381908, "统一认证中心")}`, +// favouritetype: 1, +// objid: 0, +// link: "wui/engine.html#/integration/AuthenticationCenter", +// importantlevel: 1 +// } +// } +// } + +// render() { +// const {authenticationCenterStore} = this.props; +// const {status, registerAppEditForm, registerAppEditFormOrg, registerAppId, editDetailDialogSelectedKey, tableStore2, tableStore3} = authenticationCenterStore; +// const {showSearchAd2, selectedKey, registerAppEditFormHiddenFields, registerAppEditFormCodition, appEditFormDetailDialogVisible} = toJS(status); +// const {topTab, topTabAll, collectParams} = this.state; + +// return authenticationCenterStore.setState({appEditFormDetailDialogVisible: false})} +// visible={appEditFormDetailDialogVisible} +// style={{width: 900, height: 600}} +// hasScroll +// moduleName="integration" +// buttons={(registerAppEditFormHiddenFields && registerAppEditFormHiddenFields.id == "") || editDetailDialogSelectedKey == 0 +// ? [] : []} +// moreBtn={{datas: this.getRightMenu(), collectParams: collectParams}} +// > +// +// +// { +// registerAppEditFormHiddenFields && registerAppEditFormHiddenFields.id +// ? {authenticationCenterStore.setState({ showSearchAd2: !showSearchAd2 })}} +// hideSearchAd={() => {authenticationCenterStore.setState({ showSearchAd2: false })}} +// onChange={v => { +// if(v == 1) { +// authenticationCenterStore.searchForm2 = new WeaForm(); +// authenticationCenterStore.getRegisterAppDataMappingCondition(); +// authenticationCenterStore.getRegisterAppDataMappingRightMenu(); +// authenticationCenterStore.getRegisterAppDataMappingList({id: registerAppId}); +// }else if(v == 2) { +// authenticationCenterStore.getRegisterAppLoginLogList({id: registerAppId}); +// }else { +// authenticationCenterStore.getRegisterAppEditForm({id: registerAppId}); +// } +// authenticationCenterStore.setEditDetailDialogSelectedKey(v); +// }} +// /> +// : "" +// } +// +// { +// registerAppEditFormHiddenFields && registerAppEditFormHiddenFields.id +// ? editDetailDialogSelectedKey == 0 +// ? this.getForm(registerAppEditForm, registerAppEditFormCodition) +// : +// : this.getForm(registerAppEditForm, registerAppEditFormCodition) +// } +// +// +// +// +// +// +// } + +// getAdvancedSearch = () => { +// const { authenticationCenterStore } = this.props; +// const {searchForm2, status} = authenticationCenterStore; +// const {showSearchAd, selectedKey, condition2} = toJS(status); +// let btns = []; +// btns = IntegrationUtil.getAdvancedSearchs( +// searchForm2, +// condition2, +// false, +// 2 +// ); +// return btns; +// }; + +// getTabButtonsAd() { +// const { authenticationCenterStore } = this.props; +// let searchFun = () => { +// authenticationCenterStore.getRegisterAppDataMappingList({id: authenticationCenterStore.registerAppId}); +// authenticationCenterStore.setState({showSearchAd2: false}); +// }; +// let resetFun = () => authenticationCenterStore.searchForm2.reset(); +// let cancelFun = () => authenticationCenterStore.setState({showSearchAd2: false}); +// return IntegrationUtil.getSearchBtns(searchFun, resetFun, cancelFun); +// } + +// getTabButton = () => { +// const {authenticationCenterStore} = this.props; +// let {rightMenus2, rowSelectIds2} = toJS(authenticationCenterStore.status); +// let btnArr = []; +// let rightDis = 0; +// if(!rightMenus2){return btnArr} +// for (let j = 0, len = rightMenus2.length; j < len; j++) { +// if (j == 4) break; +// if(j == 2) rightDis = 15; +// let m = rightMenus2[j]; +// btnArr.push( +// +// ); +// } +// return btnArr; +// }; + +// getForm = (form, datas) => { +// const formParams = form.getFormParams(); +// const {isFormInit} = form; +// let group = []; + +// isFormInit && datas && datas.forEach(c => { +// let items = []; +// c.items && c.items.map(fields => { +// let domkey = fields.domkey[0]; +// items.push({ +// com: ( +// +// +// { +// if(getKey(fields) === 'appid') { +// let checkParams = { +// tableName: 'weaver_sso_app', +// fieldName: 'appid', +// fieldValue: form.getFormParams().appid.replace(/^(\s*)|(\s*)$/g, ''), +// idName: 'id', +// idValue: '' +// }; +// checkTableFieldValueUnique(checkParams).then(result => { +// if(result && result.isNotUnique) { +// form.showError('appid',getLabel('387654','标识已存在')); +// } +// }); +// } +// }}/> +// {/*{getKey(fields)==='account_rules'&&formParams.account_rules>5?:""}*/} +// {getKey(fields) === "appid" && } +// {getKey(fields) === "app_secret_" && } +// +// ), +// colSpan: 1, +// hide: form.isHide(fields, (key, allParams) => { +// let hide = false; +// 'app_secret_' == domkey && allParams.auth_type_ == "CAS" && (hide = true); +// 'definebroswerType' == domkey && allParams.account_rules !== '7' && (hide = true); +// ["appid", "app_secret_", "appname", "allow_ip", "account_rules", "definebroswerType"].includes(domkey) && allParams.auth_type_ == "" && (hide = true); +// return hide; +// }) +// }) +// }) +// group.push() +// }) +// return group; +// } + +// getRightMenu = () => { +// const {authenticationCenterStore} = this.props; +// let {rightMenus2,rowSelectIds2} = toJS(authenticationCenterStore.status); +// let btnArr = []; +// if(authenticationCenterStore.editDetailDialogSelectedKey==0) { +// btnArr=[ +// { +// key: 'BTN_SAVE', +// icon: , +// content : `${getLabel(86,'保存')}`, +// onClick : () => {this.onRightMenuClick('BTN_SAVE')} +// } +// ]; +// }else if(authenticationCenterStore.editDetailDialogSelectedKey==1) { +// btnArr = []; +// rightMenus2&&rightMenus2.map(m => { +// var btn= { +// key: m.type, +// icon: , +// content: m.menuName, +// onClick: () => this.onRightMenuClick(m.type), +// disabled: m.menuIcon==='icon-coms-delete' && rowSelectIds2.length === 0 +// } ; +// btnArr.push(btn); +// }); +// btnArr.push({ +// key: "BTN_COLUMN", +// icon: , +// content: `${getLabel(32535, "显示列定制")}`, +// onClick: () => this.onRightMenuClick("BTN_COLUMN") +// }); +// } + +// return btnArr; +// } + +// ipv6Test = (value) => { +// let reg = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/; +// let regV4 = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/ + +// let datas = value.split(','); +// for(let i = 0; i < datas.length; i++) { +// if(!reg.test(datas[i].trim()) && (!regV4.test(datas[i].trim()))) { +// return false; +// } +// } +// return true; +// } + +// onRightMenuClick = (type) => { +// const {authenticationCenterStore} = this.props; +// const {registerAppEditForm, status, editDetailDialogSelectedKey, tableStore2} = authenticationCenterStore; +// const {rowSelectIds2, registerAppEditFormHiddenFields} = toJS(authenticationCenterStore.status); +// const formParams = registerAppEditForm.getFormParams(); + +// if(type === "BTN_COLUMN") { +// if(editDetailDialogSelectedKey == 1) { +// authenticationCenterStore.tableStore2.setColSetVisible(true); +// authenticationCenterStore.tableStore2.tableColSet(true); +// } +// } + +// if(type == 'BTN_SAVE'){ +// if(formParams.auth_type_ == "CAS") { +// window.e9HideFormFieldKeys = ["app_secret_"]; +// } +// let checkParams = { +// tableName: 'weaver_sso_app', +// fieldName: 'appid', +// fieldValue: formParams.appid.replace(/^(\s*)|(\s*)$/g, ''), +// idName: 'id', +// idValue: '' +// }; +// checkTableFieldValueUnique(checkParams).then(result => { +// if(result && result.isNotUnique && registerAppEditFormHiddenFields.id == "") { +// registerAppEditForm.showError('appid',getLabel('387654','标识已存在')); +// }else { +// let value = formParams.allow_ip; +// let ipv6 = this.ipv6Test(value.trim()); +// IntegrationUtil.onCheck(registerAppEditForm,function () { +// if(value.trim() == '' || (value.trim() && ipv6)) { +// let params = Object.assign({id: registerAppEditFormHiddenFields.id || "", operation: registerAppEditFormHiddenFields.id ? "edit" : "add"}, formParams); +// authenticationCenterStore.getRegisterAppOperation(params); +// }else { +// registerAppEditForm.showError('allow_ip',getLabel('382232','应用服务器地址非法')); +// } +// }); +// } +// }); +// } + +// if(type == 'rb_1'){ +// //注册数据映射 +// this.doDataMappingEditById({randomField0: '',appid: formParams.appid}); +// } + +// if(type == 'rb_2'){ +// //导入 +// authenticationCenterStore.registerAppDataMappingImportForm.reset(); +// let id=authenticationCenterStore.registerAppId; +// let params = Object.assign({id: id, operation:"import"}, formParams); +// authenticationCenterStore.getRegisterAppDataMappingImportForm(params); +// authenticationCenterStore.setState({ appEditFormDetailDataMappingImportDialogVisible: true }); + +// } + +// if(type == 'rb_3'){ +// //删除 +// if(toJS(tableStore2.selectedRowKeys).length>0) { +// authenticationCenterStore.confirmModal(`${getLabel(385625, '确定要删除选择的记录吗?')}`, authenticationCenterStore.getRegisterAppDataMappingOperation, {operation:'delete', id: toJS(tableStore2.selectedRowKeys)}); +// } +// } +// } + +// onOperatesClick = (record, index, operate) => { +// const { authenticationCenterStore } = this.props; +// const { selectedKey } = toJS(authenticationCenterStore.status); +// if (operate.index == "0") { +// this.doDataMappingEditById(record); +// } +// if (operate.index == "1") { +// //删除 +// authenticationCenterStore.confirmModal(`${getLabel(15097, '确定要删除吗?')}`, authenticationCenterStore.getRegisterAppDataMappingOperation, {operation:'delete',id: record.randomField0}); +// } +// }; + +// doDataMappingEditById(record) { +// const { authenticationCenterStore } = this.props; +// const { registerAppEditForm } = authenticationCenterStore; +// authenticationCenterStore.registerAppDataMappingEditForm.reset(); +// authenticationCenterStore.setOperateDataMappingIndex(record.randomField0); +// authenticationCenterStore.getRegisterAppDataMappingEditForm({ id: record.randomField0,appid:record.appid ,account_rules:registerAppEditForm.getFormParams().account_rules}); +// authenticationCenterStore.setState({ appEditFormDetailDataMappingDialogVisible: true }); +// } + +// } diff --git a/pc4backstage/integration/components/authenticationcenter/AppEditDialog.js b/pc4backstage/integration/components/authenticationcenter/AppEditDialog.js new file mode 100644 index 0000000..4c8e103 --- /dev/null +++ b/pc4backstage/integration/components/authenticationcenter/AppEditDialog.js @@ -0,0 +1,187 @@ +// import React from "react"; +// import {inject, observer} from "mobx-react"; +// import { Button} from "antd"; +// import {toJS} from "mobx"; +// import {WeaForm, WeaLogView, WeaNewScroll, WeaSwitch, WeaTableNew} from "comsMobx"; +// import {WeaDialog, WeaLocaleProvider, WeaTools, WeaSearchGroup, WeaFormItem, WeaRightMenu} from "ecCom"; +// import * as IntegrationUtil from "../../util/IntegrationUtil"; +// import {checkTableFieldValueUnique} from "../../apis/CommonService"; +// const { getKey } = WeaTools; +// const getLabel = WeaLocaleProvider.getLabel; + +// const store = ["authenticationCenterStore"]; + +// @inject(...store) +// @observer +// export default class AppEditDialog extends React.Component { +// render() { +// const {authenticationCenterStore} = this.props; +// const status = toJS(authenticationCenterStore.status); + +// return authenticationCenterStore.setState({appEditFormDialogVisible: false})} +// visible={status.appEditFormDialogVisible} +// style={{width: 700, height: 600}} +// hasScroll +// moduleName="integration" +// buttons={[ +// , +// // , +// ]} +// moreBtn={{ +// datas : this.getRightMenu(), +// collectParams: [] +// }} +// > +// +// { +// authenticationCenterStore.registerAppEditForm.render({col: 1},{ +// onChange: (v)=> {}, +// isHide: (key, formParams) => {} + +// },true,(c, idx)=>{ +// if(idx==0){ +// let items = []; +// let form = authenticationCenterStore.registerAppEditForm; +// let formParams = form.getFormParams(); +// c.items.map(fields => { +// items.push({ +// com: ( +// +// +// { +// if(getKey(fields) === 'appid') { +// let checkParams = { +// tableName: 'weaver_sso_app', +// fieldName: 'appid', +// fieldValue: form.getFormParams().appid.replace(/^(\s*)|(\s*)$/g, ''), +// idName: 'id', +// idValue: '' +// }; +// checkTableFieldValueUnique(checkParams).then(result => { +// if(result&&result.isNotUnique) { +// form.showError('appid',getLabel('387654','标识已存在')); +// // message.error(getLabel('387654','标识已存在')); +// } +// }); +// } +// }} +// /> +// {/*{getKey(fields)==='account_rules'&&formParams.account_rules>5?:""}*/} +// + +// ), +// colSpan: 1, +// hide: form.isHide(fields, (key, formParams) => { +// let hide = false; +// if ('definebroswerType' == key && formParams.account_rules !== '7') { +// hide = true; +// } +// return hide; +// }), +// onChange: (v)=> { +// // console.log(v); +// } +// }) +// }); + +// return +// } +// })} +// +// +// } + +// getRightMenu() { +// let btnArr = [ +// { +// key: 'BTN_SAVE', +// icon: , +// content : `${getLabel(86,'保存')}`, +// onClick : () => {this.onRightMenuClick('BTN_SAVE')} +// } +// // ,{ +// // key: 'BTN_SAVE_AND_OPEN_DETAIL', +// // icon: , +// // content : `${getLabel(125540,'保存后详细设置')}`, +// // onClick : () => {this.onRightMenuClick('BTN_SAVE_AND_OPEN_DETAIL')} +// // } +// ]; +// return btnArr; +// } + +// ipv6Test = (value) => { +// let reg = /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/; +// let regV4 = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/ + +// let datas = value.split(','); +// for(let i = 0; i < datas.length; i++) { +// if(!reg.test(datas[i].trim()) && (!regV4.test(datas[i].trim()))) { +// return false; +// } +// } +// return true; +// } + +// onRightMenuClick = (type) => { +// const {authenticationCenterStore} = this.props; +// const {registerAppEditForm, status} = authenticationCenterStore; +// const {interfaceRegisterCustomFormHiddenFields} = toJS(authenticationCenterStore.status); +// if(type == 'BTN_SAVE'){ +// let checkParams = { +// tableName: 'weaver_sso_app', +// fieldName: 'appid', +// fieldValue: registerAppEditForm.getFormParams().appid.replace(/^(\s*)|(\s*)$/g, ''), +// idName: 'id', +// idValue: '' +// }; +// checkTableFieldValueUnique(checkParams).then(result => { +// if(result&&result.isNotUnique) { +// registerAppEditForm.showError('appid',getLabel('387654','标识已存在')); +// // message.error(getLabel('387654','标识已存在')); +// }else { +// let value = registerAppEditForm.getFormParams().allow_ip; +// let ipv6 = this.ipv6Test(value.trim()); +// IntegrationUtil.onCheck(registerAppEditForm,function () { +// if(value.trim() == '' || (value.trim() && ipv6)) { +// let id=""; +// let operation = "add"; +// let params = Object.assign({id:id,operation:operation}, registerAppEditForm.getFormParams()); +// authenticationCenterStore.getRegisterAppOperation(params); +// }else { +// registerAppEditForm.showError('allow_ip',getLabel('382232','应用服务器地址非法')); +// } +// }); +// } +// }); +// } + +// if(type == 'BTN_SAVE_AND_OPEN_DETAIL'){ +// IntegrationUtil.onCheck(registerAppEditForm,function () { +// let id=""; +// let operation = ("add"); +// let params = Object.assign({id:id,operation:operation}, registerAppEditForm.getFormParams()); +// authenticationCenterStore.getRegisterAppOperation(params,(result)=>{ +// if(result.id) { +// let p={id:result.id,operation:"edit"} +// authenticationCenterStore.getRegisterAppEditForm(p); +// } +// }); +// }); + +// } + +// } + +// } diff --git a/pc4backstage/integration/components/authenticationcenter/index.js b/pc4backstage/integration/components/authenticationcenter/index.js new file mode 100644 index 0000000..a9b6cf4 --- /dev/null +++ b/pc4backstage/integration/components/authenticationcenter/index.js @@ -0,0 +1,206 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import {Button} from "antd"; +import {WeaFormItem, WeaLocaleProvider, WeaRightMenu, WeaSearchGroup, WeaTop, WeaTools} from "ecCom"; +import {WeaSwitch} from "comsMobx"; +import NoRight from "../../public/NoRight"; +import NonStand from "../../public/NonStand"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import PopoverButton from '../../public/PopoverButton'; +import "../../style/webxml.less"; + +const { getKey } = WeaTools; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("authenticationCenterStore") +@observer +class AuthenticationCenter extends React.Component { + constructor(props) { + super(props); + this.state = { + visiable:false, + collectParams: { + favname: getLabel('516737','CAS认证'), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/authenticationcenter", + importantlevel: 1 + } + }; + } + + componentDidMount() { + const { authenticationCenterStore } = this.props; + authenticationCenterStore.doInit("cas"); + } + + componentWillUnmount() { + this.props.authenticationCenterStore.clearStore(); + } + + componentWillReceiveProps(nextProps) { + const { authenticationCenterStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + authenticationCenterStore.doInit("cas"); + } + } + + /** + * 右键菜单点击事件 + * @param type + */ + onRightMenuClick = (type) => { + const { authenticationCenterStore } = this.props; + const { newForm } = authenticationCenterStore; + const {BaseInfoFormHiddenFields} = toJS(authenticationCenterStore.status); + if (type == "BTN_BASE_SAVE") { + IntegrationUtil.onCheck(newForm,()=>{ + let formParams = newForm.getFormParams(); + let params = Object.assign({}, formParams, {method: 'weaversso'}); + delete params.token_isuse; + delete params.oauth2_isuse; + delete params.spnego_isuse; + delete params.dlgt_isuse; + let isOpenCas = BaseInfoFormHiddenFields.isOpenCas; + + // 开启需要检测是否通过 + if(params.isuse == "1") { + authenticationCenterStore.getBaseInfoFormOperation({casserverurl: formParams.loginurl, method: 'test', testBeforeSave: true}, (result) => { + if(result.success) { + if(isOpenCas) { + if(newForm.getFormParams().isuse=="1"){ + authenticationCenterStore.confirmModal(`${getLabel(382221 ,'经检测,需要同时开启CAS客户端,保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!')}`, authenticationCenterStore.getBaseInfoFormOperation , params); + }else{ + authenticationCenterStore.confirmModal(`${getLabel(382222 ,'经检测,需要同时关闭CAS客户端,保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!')}`, authenticationCenterStore.getBaseInfoFormOperation , params); + } + }else{ + IntegrationUtil.doConfirm(getLabel('512788','保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!'), authenticationCenterStore.getBaseInfoFormOperation , params); + } + } + }); + }else { + if(isOpenCas) { + if(newForm.getFormParams().isuse=="1"){ + authenticationCenterStore.confirmModal(`${getLabel( 382221 ,'经检测,需要同时开启CAS客户端,保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!')}`, authenticationCenterStore.getBaseInfoFormOperation , params); + }else{ + authenticationCenterStore.confirmModal(`${getLabel( 382222 ,'经检测,需要同时关闭CAS客户端,保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!')}`, authenticationCenterStore.getBaseInfoFormOperation , params); + } + }else{ + IntegrationUtil.doConfirm(getLabel('512788','保存后将自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!'), authenticationCenterStore.getBaseInfoFormOperation , params); + } + } + }); + }else if(type == "BTN_TEST") { + let loginurl = newForm.getFormParams().loginurl; + let params = {casserverurl: loginurl, method: 'test'}; + authenticationCenterStore.getBaseInfoFormOperation(params); + } + }; + + /** + * 获取右键菜单 + * @returns {Array} + */ + getRightMenu() { + return [{ + key: "BTN_BASE_SAVE", + icon: , + content: getLabel(30986, '保存'), + onClick: () => this.onRightMenuClick("BTN_BASE_SAVE") + }, { + key: 'BTN_TEST', + icon: , + content: `${getLabel(25496, '测试')}`, + onClick: () => this.onRightMenuClick('BTN_TEST') + }] + } + + /** + * 获取顶部按钮 + * @returns {Array} + */ + getBtns = () => { + return [ + this.onRightMenuClick('BTN_BASE_SAVE')} + />, + + ] + }; + + getBaseInfoForm = () => { + const {authenticationCenterStore} = this.props; + const {newForm, status} = authenticationCenterStore; + const {BaseInfoFormFields} = toJS(status); + const {isFormInit} = newForm; + let group = []; + const formParams = newForm.getFormParams(); + + isFormInit && BaseInfoFormFields && BaseInfoFormFields.map((c, index) =>{ + if(index == 0) { + let items = []; + c.items && c.items.map(fields => { + items.push({ + com:( + + {}} /> + ), + colSpan:1, + hide: newForm.isHide(fields, (keys, allParams) => { + let bool = false; + getKey(fields) === 'loginurl' && allParams.isuse != '1' && (bool = true); + getKey(fields) === 'logouturl' && allParams.isuse != '1' && (bool = true); + getKey(fields) === 'oaadress' && allParams.isuse != '1' && (bool = true); + return bool; + }) + }); + }); + group.push(); + } + }); + return group; + } + + render() { + const {authenticationCenterStore} = this.props; + const {hasRight, rightLoading, status: {hasNonStandard, nonStandLoading}} = authenticationCenterStore; + const {collectParams} = this.state; + return ( + nonStandLoading + ? null + : hasNonStandard + ? rightLoading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{collectParams}} + > + {this.getBaseInfoForm()} + + + : + : + ); + } +} + +export default AuthenticationCenter; diff --git a/pc4backstage/integration/components/authenticationsource/EditFormDialog.js b/pc4backstage/integration/components/authenticationsource/EditFormDialog.js new file mode 100644 index 0000000..e80fdcd --- /dev/null +++ b/pc4backstage/integration/components/authenticationsource/EditFormDialog.js @@ -0,0 +1,137 @@ +import React from "react"; +import { + inject, + observer, +} from "mobx-react"; +import { + Button, +} from "antd"; +import { + toJS, +} from "mobx"; +import { + WeaDialog, + WeaLocaleProvider, + WeaRightMenu, +} from "ecCom"; +import { + getForm, + checkUnique, + onCheck, +} from "../../util/IntegrationUtil" + +const {getLabel} = WeaLocaleProvider; + +@inject("authenticationSourceStore") +@observer +export default class EditFormDialog extends React.Component { + + closeDialog = () => { + const {authenticationSourceStore} = this.props; + authenticationSourceStore.setState({showNewFormDialog: false}); + } + + getBtns = () => { + return [ + + ]; + } + + getRightMenu() { + return [{ + key: 'BTN_SAVE', + icon: , + content : `${getLabel(86,'保存')}`, + onClick : () => this.onRightMenuClick('BTN_SAVE') + }]; + } + + onRightMenuClick = (type) => { + const { + authenticationSourceStore, + } = this.props, { + newForm, + status, + } = authenticationSourceStore, { + newFormHiddenFields, + paramsData, + } = toJS(status); + if(type == 'BTN_SAVE'){ + onCheck(newForm, () => { + checkUnique({ + tableName: 'weaver_sso_src', + fieldName: 'name_', + fieldValue: newForm.getFormParams()["name_"].replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: newFormHiddenFields.id, + }, newForm, "name_", name="2", newFormHiddenFields.id, () => { + let formParams = newForm.getFormParams(); + let params = Object.assign({}, newFormHiddenFields, formParams, { + orderNum: typeof(formParams.orderNum) === "object" + ? formParams.orderNum.join && formParams.orderNum.join(",") + ? formParams.orderNum + : "0" + : formParams.orderNum + }); + params.dtinfo_paramsData = JSON.stringify(paramsData); + authenticationSourceStore.getAuthenticationSourceOperation(params); + }); + }) + } + } + + onChangeForm = (form, allParams, fields) => { + const { + authenticationSourceStore, + } = this.props, { + newFormHiddenFields, + } = toJS(authenticationSourceStore.status); + const key = fields.domkey[0], formParams = form.getFormParams(); + if("name_" === key && formParams.name_ && formParams.name_.trim()) { + checkUnique({ + tableName: 'weaver_sso_src', + fieldName: 'name_', + fieldValue: form.getFormParams()[key].replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: newFormHiddenFields.id, + }, form, key, name="2"); + } + if(typeof(form.getFormParams()[key]) === "string") { + form.updateFields({[key]: form.getFormParams()[key] ? form.getFormParams()[key].trim() : ""}); + } + } + + render() { + const { + authenticationSourceStore, + } = this.props, { + status, + newForm, + } = authenticationSourceStore, { + showNewFormDialog, + newFormHiddenFields, + newFormCondition=[], + } = toJS(status); + + return + + {getForm(newForm, newFormCondition, true, this.onChangeForm, this && this.props && this.props.ecId || '', "integrationAuthSourceEditForm")} + + + } +} diff --git a/pc4backstage/integration/components/authenticationsource/index.js b/pc4backstage/integration/components/authenticationsource/index.js new file mode 100644 index 0000000..03ed30d --- /dev/null +++ b/pc4backstage/integration/components/authenticationsource/index.js @@ -0,0 +1,237 @@ +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import {Button} from "antd"; +import {WeaLocaleProvider, WeaRightMenu, WeaTab, WeaTop} from "ecCom"; +import {WeaLogView, WeaTableNew} from "comsMobx"; +import NoRight from "../../public/NoRight"; +import NonStand from "../../public/NonStand"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import EditFormDialog from "./EditFormDialog"; + +const {WeaTable} = WeaTableNew; +const getLabel = WeaLocaleProvider.getLabel; +const WeaLogViewComp = WeaLogView.Component; + +@inject("authenticationSourceStore") +@observer +class TodoClient extends React.Component { + constructor(props) { + super(props); + this.state = { + showSearchAd: false, + visible: false, + targetId: "", + collectParams: { + favname: `${getLabel(521396, "认证源")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/authentication_source", + importantlevel: 1 + } + }; + } + + componentDidMount() { + const { authenticationSourceStore } = this.props; + authenticationSourceStore.doInit(); + } + + componentWillReceiveProps(nextProps) { + const { authenticationSourceStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + authenticationSourceStore.doInit(); + } + } + + getAdvancedSearch = () => { + const {authenticationSourceStore} = this.props; + const {searchForm, status} = authenticationSourceStore; + const {condition} = toJS(status); + return IntegrationUtil.getAdvancedItem(searchForm, condition, this.handleSearchFun, false, this && this.props && this.props.ecId || '', "integrationAuthSource"); + }; + + handleSearchFun = () => { + const { authenticationSourceStore } = this.props; + authenticationSourceStore.getAuthenticationSourceList(); + this.setState({showSearchAd: false}); + } + + getTabButtonsAd = () => { + const { authenticationSourceStore } = this.props; + return IntegrationUtil.getSearchBtns( + this.handleSearchFun, + () => authenticationSourceStore.searchForm.reset(), + () => this.setState({showSearchAd: false}), + this && this.props && this.props.ecId || '', + "integrationAuthSource" + ); + } + + getRightMenu() { + const { + authenticationSourceStore, + } = this.props, { + tableStore, + status, + } = authenticationSourceStore, { + rightMenus, + } = toJS(status); + let btnArr = rightMenus && rightMenus.map(m => { + return { + key: m.type, + icon: , + content: m.menuName, + onClick: () => this.onRightMenuClick(m.type), + disabled: m.type==='rb_2' && toJS(tableStore.selectedRowKeys).length === 0 + }; + }); + btnArr = btnArr.concat([{ + key: "BTN_Log", + icon: , + content: getLabel('83','日志'), + onClick: () => this.onRightMenuClick("4") + }, { + key: "BTN_COLUMN", + icon: , + content: `${getLabel(32535, "显示列定制")}`, + onClick: () => this.onRightMenuClick("BTN_COLUMN") + }]); + return btnArr; + } + + getColumnsInfo = (data) => { + return data && data.map(item => { + if("name_" === item.dbField) { + item.render = (text, record) => this.onRightMenuClick("2", record)}>{text} + } + return item; + }) + } + + onRightMenuClick = (type, record={}) => { + const { + authenticationSourceStore, + } = this.props, { + tableStore, + } = authenticationSourceStore; + if (type == "rb_1") { + authenticationSourceStore.getAuthenticationSourceForm(); + authenticationSourceStore.setState({showNewFormDialog: true}); + }else if (type == "rb_2" || type == "3") { + let title = "3" == type ? getLabel( 15097, '确定要删除吗?') : getLabel(385625, '确定要删除选择的记录吗?'); + let id = "3" == type ? record.randomFieldId : toJS(tableStore.selectedRowKeys); + IntegrationUtil.doConfirm(title, authenticationSourceStore.getAuthenticationSourceOperation, {operation:'delete', id}); + }else if (type == "BTN_COLUMN") { + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + }else if (type == "2") { + authenticationSourceStore.getAuthenticationSourceForm({id: record.randomFieldId}); + authenticationSourceStore.setState({showNewFormDialog: true}); + }else if (type == "4") { + this.setState({ + visible: true, + targetId: record.randomFieldId || "", + }) + } + }; + + getBtns = () => { + const { + authenticationSourceStore, + } = this.props, { + tableStore, + status, + } = authenticationSourceStore, { + rightMenus, + } = toJS(status); + let datas = rightMenus.slice(0, 2); + return datas && datas.map(m => ); + }; + + onOperatesClick = (record, index, operate) => { + this.onRightMenuClick(operate.index, record); + }; + + onCloseLogDialog = () => this.setState({visible: false, targetId: ""}); + + render() { + const { + authenticationSourceStore, + } = this.props, { + searchForm, + tableStore, + status, + hasRight, + rightLoading, + logTable, + } = authenticationSourceStore, { + advanceHeight, + hasNonStandard, + nonStandLoading, + selectedKey=0, + tabDatas=[], + } = toJS(status), { + showSearchAd, + visible, + targetId, + collectParams, + } = this.state; + + return (nonStandLoading + ? null + : hasNonStandard + ? rightLoading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{collectParams}} + /> + this.setState({showSearchAd: !showSearchAd})} + hideSearchAd={() => this.setState({showSearchAd: false})} + searchsBaseValue={searchForm.getFormParams().name_} + onChange={v => authenticationSourceStore.setState({selectedKey: v})} + onSearch={this.handleSearchFun} + onSearchChange={value => searchForm.updateFields({name_: value})} + /> + + + + + : + : + ); + } +} + +export default TodoClient; diff --git a/pc4backstage/integration/components/cas/index.js b/pc4backstage/integration/components/cas/index.js new file mode 100644 index 0000000..bd2f38d --- /dev/null +++ b/pc4backstage/integration/components/cas/index.js @@ -0,0 +1,581 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Button, Spin, Modal } from "antd"; +import NoRight from "../../public/NoRight"; +import NonStand from "../../public/NonStand"; +import WhiteList from '../../public/WhiteList'; +import '../../style/cas.less'; +import { + WeaLocaleProvider, + WeaTop, + WeaTab, + WeaRightMenu, + WeaFormItem, + WeaTools, + WeaSearchGroup, + WeaNewScroll, + WeaHelpfulTip, + WeaInput, + WeaDialog, + WeaCheckbox, +} from "ecCom"; + +import { WeaSwitch } from "comsMobx"; +import DoubleInput from '../doubleInput'; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import PopoverButton from '../../public/PopoverButton'; + +const getLabel = WeaLocaleProvider.getLabel; +@inject("cas") +@inject("whiteListStore") +@observer +export default class Cas extends React.Component { + constructor(props) { + super(props); + this.state = { + editTableSelected: [], + clazz: "weaver.interfaces.sso.cas.AuthenticationFilter", + ticketClazz: "weaver.interfaces.sso.cas.AbstractTicketValidationFilter", + datas: [{ + title: getLabel('513856','登录校验'), + viewcondition: "0" + }, { + title: `Ticket${getLabel('128877','校验')}`, + viewcondition: "1" + }], + selectedKey: "0" + }; + } + + componentDidMount() { + const { cas, whiteListStore } = this.props; + whiteListStore.getRegisterFilterId({filter_clazz: this.state.clazz}, cas.doInit); + } + + onRightMenuClick = (type, recordId) => { + const { cas } = this.props; + const { save, newBaseForm } = cas; + const formParams = newBaseForm.getFormParams(); + switch (type) { + case "save": + save(); + break; + case "test": + if (formParams.isuse == 1) { + Modal.confirm({ + title: `${getLabel(131329,'信息确认')}`, + content: getLabel('514734','部署后会自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!'), + okText: `${getLabel(382958,'确定')}`, + cancelText:`${getLabel(31129,'取消')}`, + onOk: () => this.complete(), + }); + }else { + Modal.confirm({ + title: `${getLabel(131329,'信息确认')}`, + content: getLabel(387003,'是否要关闭CAS?'), + okText: `${getLabel(382958,'确定')}`, + cancelText:`${getLabel(31129,'取消')}`, + onOk: () => this.complete(), + }); + } + break; + } + } + + /** + * 完成 + */ + complete = () => { + const { cas } = this.props; + const { save, newBaseForm } = cas; + const formParams = newBaseForm.getFormParams(); + if (formParams.isuse == '1' && formParams.appauth != 1 && formParams.pcauth != 1) { + Modal.info({ + title: getLabel(15172,'系统提示'), + content: getLabel(386921,'请开启pc认证或手机认证!'), + okText: getLabel(826,'确定'), + onOk:() => {}, + }); + } else { + save(1); + } + } + + getBtns = () => { + const { cas } = this.props; + const { loading } = cas; + let btns = []; + btns = [ + , + this.onRightMenuClick("test")} + />, + ]; + return btns; + } + + getRightMenu() { + const { cas } = this.props; + const { loading } = cas; + let btnArr = [{ + key: "save", + disabled: loading, + icon: , + content: getLabel("86", "保存"), + onClick: () => this.onRightMenuClick("save") + },{ + key: "test", + disabled: loading, + icon: , + // content: , + content: getLabel('514733','部署'), + onClick: () => this.onRightMenuClick("test") + }]; + return btnArr; + } + getColumns = (columns) => { + let cols = []; + columns && columns.forEach((col)=> { + if (col.dataIndex === 'excludeurl') { + col.com = [{ + type: 'CUSTOM', + key: 'excludeurl', + render: (text, record, index, onEdit) => { + return { + onEdit({ + type: 'CUSTOM', + record, + index, + key: 'excludeurl', + value: v + }) + }} + /> + } + }] + cols.push(col); + }else if (col.dataIndex === 'excludedescription') { + col.com = [{ + type: 'CUSTOM', + key: 'excludedescription', + render: (text, record, index, onEdit) => { + return { + onEdit({ + type: 'CUSTOM', + record: { + ...record, + excludedescription: v ? v.trim() : "", + }, + index, + }) + }} + /> + } + }] + cols.push(col); + }else if (col.dataIndex === 'logincheck') { + col.com = [{ + type: 'CHECKBOX', + key: 'logincheck', + render: (text, record, index, onEdit) => { + return { + onEdit({ + type: 'CHECKBOX', + record: { + ...record, + logincheck: v, + }, + index, + }) + }} + /> + } + }] + col.title= + + {col.title}

{getLabel('', '启用登录校验 : 勾选,表示认证排除地址生效,不走CAS认证。')}

+
}/>
+ + cols.push(col); + }else if (col.dataIndex === 'ticketcheck') { + col.com = [{ + type: 'CHECKBOX', + key: 'ticketcheck', + render: (text, record, index, onEdit) => { + return { + onEdit({ + type: 'CHECKBOX', + record: { + ...record, + ticketcheck: v, + }, + index, + }) + }} + /> + } + }] + col.title= + + {col.title}

{getLabel('', '启用Ticket校验:勾选,表示认证排除地址生效,若排除地址后带有ticket则不走Ticket校验。')}

+ }/>
+
+ cols.push(col); + } + + }) + return cols; + } + + tableEditOperate = type => { + const { cas } = this.props; + const { tableEdit } = cas; + switch (type) { + case "add": + tableEdit.doAdd(); + break; + case "del": + tableEdit.doDelete(); + break; + } + }; + + willDelete = (datas, keys) => new Promise((resolve, reject) => { + Modal.confirm({ + title: `${getLabel(131329,'信息确认')}`, + content: `${getLabel(385625,'确定要删除选择的记录吗?')}`, + okText: `${getLabel(382958,'确定')}`, + cancelText:`${getLabel(31129,'取消')}`, + onOk: () => resolve(true), + onCancel: () => resolve(false), + }) + }) + + willAdd = (allDatas, addData) => { + const {cas} = this.props; + const {tableDatas} = toJS(cas.status); + let currentData = []; + + currentData = { + ...addData, + logincheck: '1' + } + + allDatas && allDatas.map((v, index) => { + if(v.key === addData.key) { + allDatas[index] = currentData; + } + }) + + cas.setState({tableDatas: allDatas}); + } + + getTabs = () => { + const {datas, selectedKey, ticketClazz, clazz} = this.state; + return { + let clazz_ = ""; + this.setState({selectedKey: v}); + if(v == 0) { + clazz_ = clazz; + }else if(v == 1) { + clazz_ = ticketClazz; + } + this.props.whiteListStore.getRegisterFilterId({filter_clazz: clazz_}); + }} + /> + } + + getFormSearchs = (form, datas) => { + const { cas } = this.props; + const { res, userAgent } = toJS(cas.status); + const {isFormInit} = form; + let group = []; + const formParams = form.getFormParams(); + isFormInit && datas && datas.forEach((c, idx) => { + let leftDis = idx == 6 ? -17 : 0; + let items = []; + c.items && c.items.forEach(field => { + let hideLabel = false; + let fieldcolSpan = field.fieldcol; + const key = WeaTools.getKey(field); + const bindObj = form.$(key); + if ('DESCRIPTION' == field.conditionType) { + fieldcolSpan = 24; + } + let dom = + if ('casserverurl' == field.domkey[0]) { + dom =
+ {dom} + +
+ }else if ('casserverloginpage' == field.domkey[0] || 'casserverlogoutpage' == field.domkey[0]) { + dom = + }else if ('ecologyurl' == field.domkey[0]) { + dom =
+ {dom} + +
+ }else if ('ecologyloginpage' == field.domkey[0] ) { + dom = + }else if ('appauthAddress' == field.domkey[0]) { + dom =
+ + +
+ hideLabel = false; + }else if('strgy_ua_val' === field.domkey[0]) { + return; + }else if('strgy_ua' === field.domkey[0]) { + let userAgentDom = null; + if(form.getFormParams().strgy_ua == '1') { + userAgentDom = userAgent && userAgent.map((field, index) => { + return
+ + + +
+ }); + } + dom = + {dom} + {userAgentDom} + + }else if('accounttype' === field.domkey[0] && form.getFormParams().accounttype == '7') { + let marginLeft = 15, marginTop = 5, title = ""; + if(field.selectLinkageDatas && field.selectLinkageDatas["7"]) { + if(field.selectLinkageDatas["7"].conditionType.toLocaleLowerCase() == "textarea") { + field.selectLinkageDatas["7"].maxRows = 4; + field.selectLinkageDatas["7"].minRows = 4; + marginLeft = 20; + marginTop = 35; + } + title = field.selectLinkageDatas["7"].helpfulTip; + } + dom = + {dom} + + + } + + items.push({ + com:(
+ + {dom} + +
), + colSpan: 1, + hide: form.isHide(field, (keys, allParams)=> { + let hide = false; + "strgy_ua_val" === field.domkey[0] && allParams.strgy_ua == 0 && (hide = true); + "clusterNodes" === field.domkey[0] && allParams.is_cluster == 0 && (hide = true); + return hide; + }) + }) + }); + if (formParams.isuse == '0' && (idx == 1 || idx == 2 || idx == 3 || idx == 4 || idx == 5)) { + } else { + if (idx !== 5 && idx !== 6) { + group.push() + } else if(idx == 6) { + group.push() + } else if(idx == 5){ + group.push(
) + } + } + }); + return group; + } + /**获取白名单的helpfulTip */ + getWhiteListTip = () => { + return
+

1、{getLabel('514625','点击‘+’如果选择不到需要的白名单地址,可以去【统一白名单地址配置】-【通用白名单】里面进行设置;【统一白名单地址配置】页面需要“统一白名单地址配置”权限')}。

+

2、{getLabel('514627','白名单地址也可以直接在【统一白名单地址配置】-【过滤器白名单】中进行维护,登录校验对应过滤器weaver.interfaces.sso.cas.AuthenticationFilter;Ticket校验对应过滤器weaver.interfaces.sso.cas.AbstractTicketValidationFilter')}。

+
+ } + + getRowSelection = rowSelection => { + const sel = { ...rowSelection }; + sel.getCheckboxProps = record => { + return { disabled: record.viewAttr === '1' }; + }; + return sel; + } + + getDialogBtnsRightMenu() { + const { cas } = this.props; + let btnArr = [{ + key: "test", + icon: , + content: getLabel("25496", "测试"), + onClick: () => cas.telTest() + }]; + return btnArr; + } + + render() { + const { cas, whiteListStore } = this.props; + const { newBaseForm, status,hasRight, rightLoading, loading } = cas; + const { newBaseFormFields, testVisible, hasNonStandard, nonStandLoading } = toJS(status); + return ( + nonStandLoading + ? null + : hasNonStandard + ? rightLoading + ? null + :
+ { + hasRight + ?
+ + + } + iconBgcolor={IntegrationUtil.GeneralTitleColor.iconBgcolor} + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + loading={loading} + dropMenuProps={{ + collectParams: { + favname: `${getLabel(128653, "CAS集成")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/cas", + importantlevel: 1 + } + }} + > + + {this.getFormSearchs(newBaseForm, newBaseFormFields)} + + + + + cas.setState({testVisible: false})} + visible={testVisible} + style={{width: 500, height: 300}} + icon={IntegrationUtil.GeneralTitleColor.icon} + iconBgcolor={IntegrationUtil.GeneralTitleColor.iconBgcolor} + hasScroll + buttons={[ + + ]} + moreBtn={{ + datas: this.getDialogBtnsRightMenu(), + collectParams: { + favname: getLabel("128643", "手机认证"), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/cas", + importantlevel: 1 + } + }} + > + + {cas.telForm.render({col: 1})} + + + { + window.weaPortalPublic && window.weaPortalPublic.WeaSystemSetting && + whiteListStore.getRegisterFilterId({filter_clazz: this.state.clazz}, cas.doInit)} + /> + } +
+ : + } +
+ : + ); + } +} diff --git a/pc4backstage/integration/components/cas/index.jsx b/pc4backstage/integration/components/cas/index.jsx new file mode 100644 index 0000000..3ccbf21 --- /dev/null +++ b/pc4backstage/integration/components/cas/index.jsx @@ -0,0 +1,142 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Button, Menu, Tabs, TopTitle, Tree } from "antd"; +import { + WeaLocaleProvider, + WeaLeftRightLayout, + WeaTop, + WeaTab, + WeaRightMenu, + WeaFormItem, + WeaTools, + WeaSearchGroup +} from "ecCom"; + +import { WeaTableNew, WeaSwitch } from "comsMobx"; + +const { WeaTable } = WeaTableNew; +const { getKey } = WeaTools; + +import * as IntegrationUtil from "../../util/IntegrationUtil"; +const getFormSearchs = (form, datas, needTigger = true, lableCol, fieldcol) => { + const {isFormInit} = form; + let group = []; + const formParams = form.getFormParams(); + isFormInit && datas && datas.map(c =>{ + let items = []; + c.items.map(fields => { + items.push({ + com:( + + + ), + colSpan: 1, + hide: form.isHide(fields, (keys, allParams) => { + let bool = false; + getKey(fields) === 'clusterNodes' && allParams.is_cluster != '1' && (bool = true); + return bool; + }) + }) + }); + if(needTigger){ + group.push() + }else { + group.push() + } + }); + return group; +} + +const getLabel = WeaLocaleProvider.getLabel; +@inject("cas") +@observer +export default class Cas extends React.Component { + componentDidMount() { + const { cas } = this.props; + cas.doInit(); + } + + onRightMenuClick = (type, recordId) => { + const { cas } = this.props; + const { save } = cas; + switch (type) { + case "save": + save(); + break; + } + }; + + getBtns = () => { + const { cas } = this.props; + let btns = []; + btns = [ + , + + ]; + return btns; + }; + + getRightMenu() { + const { imrtx } = this.props; + // const { selectedKey, rightMenus, rightMenus1 } = toJS( + // workflowFlowStore.status + // ); + let btnArr = []; + + return btnArr; + } + + render() { + const { cas } = this.props; + const { newBaseForm, status } = cas; + const { newBaseFormFields } = toJS(status); + return ( +
+ } + iconBgcolor={IntegrationUtil.GeneralTitleColor.iconBgcolor} + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{ + collectParams: { + favname: `${getLabel(131795, "CAS集成")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/inteengine/imrtx", + importantlevel: 1 + } + }} + /> + {getFormSearchs(newBaseForm, newBaseFormFields)} +
+ ); + } +} diff --git a/pc4backstage/integration/components/coremail/AddOrEdit.js b/pc4backstage/integration/components/coremail/AddOrEdit.js new file mode 100644 index 0000000..240f563 --- /dev/null +++ b/pc4backstage/integration/components/coremail/AddOrEdit.js @@ -0,0 +1,120 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { + WeaLocaleProvider, + WeaRightMenu, + WeaFormItem, + WeaDialog, + WeaSearchGroup, +} from "ecCom"; +import {WeaSwitch} from "comsMobx"; +import { + onCheck, +} from "../../util/IntegrationUtil"; +import {Button} from 'antd'; + +const {getLabel} = WeaLocaleProvider; + +@inject("coremailStore") +@observer +export default class AddOrEdit extends React.Component { + + getCondition = (form, datas=[]) => { + const {isFormInit} = form; + let group = []; + + isFormInit && datas && datas.forEach((c, index) => { + let items = []; + c.items && c.items.forEach(fields => { + items.push({ + com: ( + + ), + colSpan: 1 + }) + }); + group.push() + }); + return group; + } + + onMenuClick = () => { + const {coremailStore} = this.props; + const {newForm, getCoreMailSaveOperation} = coremailStore; + + onCheck(newForm, getCoreMailSaveOperation); + } + + onTestDatas=()=>{ + const {coremailStore} = this.props; + const {status, newForm, testCoreMail} = coremailStore; + const {operateIndex} = status; + + onCheck(newForm, () => { + let params = Object.assign({}, newForm.getFormParams(), {coremailid: operateIndex,operate:'test',isFormEdit:'1'}); + testCoreMail(params); + }); + } + + render() { + const { + coremailStore, + } = this.props, { + status, + newForm, + flag, + } = coremailStore, { + coremailDialogVisible, + newFormCondition, + operateIndex, + } = status; + + return ( + coremailStore.setStatus('coremailDialogVisible', false)} + buttons={[, + + ]} + moreBtn={{ + datas: [{ + key: 'BTN_SAVE', + icon: , + content : getLabel(30986, '保存'), + onClick : this.onMenuClick + }], + collectParams: [] + }} + > + , + content : getLabel(30986, '保存'), + onClick : this.onMenuClick + }]} + collectParams={[]} + > + { + flag + ? this.getCondition(newForm, newFormCondition) + : null + } + + + ); + } +} diff --git a/pc4backstage/integration/components/coremail/createAndEdit.js b/pc4backstage/integration/components/coremail/createAndEdit.js new file mode 100644 index 0000000..e69de29 diff --git a/pc4backstage/integration/components/coremail/index.js b/pc4backstage/integration/components/coremail/index.js new file mode 100644 index 0000000..fc78d9a --- /dev/null +++ b/pc4backstage/integration/components/coremail/index.js @@ -0,0 +1,560 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Button, Spin} from "antd"; +import { + WeaLocaleProvider, + WeaTop, + WeaTab, + WeaRightMenu, + WeaFormItem, + WeaSearchGroup, + WeaHelpfulTip +} from "ecCom"; +import { WeaTableNew, WeaSwitch } from "comsMobx"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import Login from "../login/index" +import AddOrEdit from './AddOrEdit'; +import InitializedData from "./initializedData"; +import NonStand from "../../public/NonStand"; + +const { WeaTable } = WeaTableNew; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("coremailStore") +@inject('intelogin') +@observer +export default class DataShow extends React.Component { + constructor(props) { + super(props); + } + + componentDidMount() { + const { initPage } = this.props.coremailStore; + initPage(); + } + + componentWillReceiveProps(nextProps) { + if (this.props.location.key !== nextProps.location.key) { + const { initPage } = this.props.coremailStore; + initPage(); + } + } + + + getDropMenuDatas = () => { + const { coremailStore } = this.props; + const { status,tableStore } = coremailStore; + const { tabSelected, coremailRightMenu=[] } = toJS(status); + const btnArr = []; + // inteLogin + const { intelogin } = this.props; + const { menus } = intelogin; + const { dropMenuDatas } = menus; + const {selectedRowKeys} = toJS(tableStore); + + switch (tabSelected) { + case 0: + coremailRightMenu && coremailRightMenu.map(item => { + btnArr.push({ + key: item.type, + icon: , + content: item.menuName, + onClick: () => this.onRightMenuClick(item.type), + disabled: (item.type != "rb_1" && selectedRowKeys.length === 0)|| + (item.type=="rb_4"&&selectedRowKeys.length == 0) + ||(item.type=="rb_3"&&selectedRowKeys.length == 0) + ||(item.type=="rb_2"&&selectedRowKeys.length == 0), + }) + }) + btnArr.push({ + key: "BTN_COLUMN", + icon: , + content: `${getLabel(32535, "显示列定制")}`, + onClick: () => this.onRightMenuClick("BTN_COLUMN") + }); + break; + case 1: + dropMenuDatas && dropMenuDatas.map(item => { + btnArr.push(item); + }) + break; + case 2: + //显示列定制 + btnArr.push({ + key: "BTN_COLUMN", + icon: , + content: `${getLabel(32535, "显示列定制")}`, + onClick: () => this.onRightMenuClick("BTN_COLUMN") + }); + break; + + } + return btnArr; + } + + getWeaTopBtns = () => { + const { coremailStore } = this.props; + const {status, tableStore} = coremailStore; + const {tabSelected, coremailRightMenu=[]} = toJS(status); + const {selectedRowKeys} = toJS(tableStore); + // inteLogin + const { intelogin } = this.props; + const { menus } = intelogin; + const btns = menus.buttons; + const btnArr = []; + + switch (tabSelected) { + case 0: + coremailRightMenu && coremailRightMenu.forEach(item => { + btnArr.push( + + ) + }) + break; + case 1: + btns && btns.forEach(item => { + btnArr.push(item); + }) + break; + case 2: + break; + } + return btnArr; + } + + getTab = () => { + return [ + { + title: getLabel('505949','集成列表'), + viewcondition: 0 + },{ + title: getLabel('20960','集成登录'), + viewcondition: 1 + },{ + title: getLabel('125928','同步日志'), + viewcondition: 2 + } + ]; + } + + onRightMenuClick = (type, selectedIndex) => { + const { coremailStore } = this.props; + const { save, init, test, pageForm, logFormTable, tableStore, getCoreMailDelete ,getInitalDialog, testCoreMail, status: {tabSelected}} = coremailStore; + const {selectedRowKeys} = toJS(tableStore); + const params = pageForm.getFormParams(); + selectedIndex = selectedIndex != undefined ? selectedIndex : selectedRowKeys; + + switch (type) { + case "BTN_SAVE": + IntegrationUtil.onCheck(pageForm, () => { + save(params) + }) + break; + case "BTN_INIT": + init(params); + break; + case "BTN_TEST": + IntegrationUtil.onCheck(pageForm, () => { + test(params) + }) + break; + case "BTN_COLUMN": + if(tabSelected == 0) { + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + }else if(tabSelected == 2){ + logFormTable.setColSetVisible(true); + logFormTable.tableColSet(true); + } + break; + case "BTN_NEW": + this.onRightMenuClick2("BTN_NEW"); + break; + case "BTN_DEL": + this.onRightMenuClick2("BTN_DEL"); + break; + case "BTN_LOG": + this.onRightMenuClick2("BTN_LOG"); + break; + case "rb_1": + coremailStore.setStatus('coremailDialogVisible', true); + coremailStore.setStatus('operateIndex', ''); + coremailStore.getCoremailMailAddForm(); + break; + case "BTN_EDIT": + coremailStore.setStatus('coremailDialogVisible', true); + coremailStore.setStatus('operateIndex', selectedIndex); + coremailStore.getCoremailMailAddForm(); + break; + case "rb_2": + IntegrationUtil.doConfirm(getLabel(385625, '确定要删除选择的记录吗?'), getCoreMailDelete, {coremailid: selectedIndex}) + break; + case "rb_3": + getInitalDialog(selectedIndex); + break; + case "rb_4": + testCoreMail({coremailid: selectedIndex,operate:'test'}); + break; + } + } + + resetSearchCondition=v=>{ + const { coremailStore } = this.props; + const {listSearchForm,logSearchForm,getCoreMailList,getDatas} = coremailStore; + switch (v) { + case 0: + listSearchForm.reset(); + getCoreMailList(listSearchForm.getFormParams()); + + break; + case 1: + const { + intelogin + } = this.props, { + search, + mainTab, + } = intelogin, { + form + } = mainTab; + form.reset(); + search(); + break; + case 2:; + logSearchForm.reset(); + getDatas(null, true); + break; + } + } + + getSearchAD = () => { + const { coremailStore } = this.props; + const { logSearchForm, logSearchFormConditions=[], status, listSearchForm } = coremailStore; + const { tabSelected, listSearchCondition=[] } = toJS(status); + let searchForm = null, datas = []; + switch (Number(tabSelected)) { + case 0: + searchForm = listSearchForm; + datas = [...listSearchCondition]; + break; + case 2: + searchForm = logSearchForm; + datas = [...toJS(logSearchFormConditions)]; + break; + case 1: + const { intelogin } = this.props; + const { mainTab } = intelogin; + const { + form, + condition=[], + } = mainTab; + searchForm = form; + datas = [...condition]; + break; + } + try { + return IntegrationUtil.getAdvancedItem(searchForm, datas, this.onSearch, false, this && this.props && this.props.ecId || '', "integrationCoremail"); + }catch(err){ + return null; + } + }; + + onSearch = () => { + const { coremailStore } = this.props; + const { status, getDatas, setStatus, getCoreMailList, listSearchForm } = coremailStore; + const { tabSelected } = toJS(status); + + switch (tabSelected) { + case 0: + getCoreMailList(listSearchForm.getFormParams()); + setStatus("searchShow", false); + break; + case 2: + getDatas(null, true); + setStatus("searchShow", false); + break; + case 1: + const { + intelogin + } = this.props, { + search, + } = intelogin; + search(); + setStatus("searchShow", false); + break; + } + } + + getSearchButtonsAd = () => { + const { coremailStore } = this.props; + const { status, setStatus, listSearchForm, logSearchForm } = coremailStore; + const { tabSelected } = toJS(status); + let resetFun = null; + switch (Number(tabSelected)) { + case 0: + resetFun = () => listSearchForm.reset(); + break; + case 2: + resetFun = () => logSearchForm.reset(); + break; + case 1: + const { + intelogin + } = this.props, { + mainTab, + } = intelogin, { + form + } = mainTab; + resetFun = () => form.reset(); + break; + } + return IntegrationUtil.getSearchBtns( + this.onSearch, + resetFun, + () => setStatus("searchShow", false), + this && this.props && this.props.ecId || '', + "integrationCoremail", + ); + }; + + handleSearch = () => { + const { intelogin } = this.props; + const { search } = intelogin; + let params = {} + params.typename = '8';//筛选 + + isPanelShow && changeSearchPanelStatus(false); + getTableInfo(params); + } + + doOnSearchChange = v => { + const { coremailStore } = this.props; + const { status, setStatus, listSearchForm } = coremailStore; + const { tabSelected } = toJS(status); + switch (tabSelected) { + case 0: + listSearchForm.updateFields({systemaddress: v}); + break; + case 1: + const { + intelogin + } = this.props, { + mainTab, + } = intelogin, { + form, + } = mainTab; + form.updateFields({name: v}); + break; + case 2: + setStatus("searchValue", v); + break; + } + } + + doOnSearch = () => { + const { coremailStore } = this.props; + const { status, getDatas, getCoreMailList, listSearchForm } = coremailStore; + const { tabSelected, searchValue } = toJS(status); + // intelogin + const { intelogin } = this.props; + const { search } = intelogin; + switch (tabSelected) { + case 0: + getCoreMailList({systemaddress: listSearchForm.getFormParams().systemaddress}); + break; + case 1: + search(); + break; + case 2: + getDatas({ operatedata: searchValue }); + break; + } + } + + getSearchBaseValue = () => { + const { coremailStore } = this.props; + const { status, listSearchForm } = coremailStore; + const { tabSelected } = toJS(status); + // intelogin + const { + intelogin + } = this.props, { + mainTab, + } = intelogin, { + form + } = mainTab; + return tabSelected == 0 ? listSearchForm.getFormParams().systemaddress : form.getFormParams().name; + } + + getFormSearchs = (pageForm, pageFormConditions=[]) => { + const { isFormInit } = pageForm; + let group = []; + const formParams = pageForm.getFormParams(); + isFormInit && pageFormConditions && pageFormConditions.map((c, index) => { + let items = []; + c && c.items && c.items.map(field => { + let key = field.domkey[0]; + items.push({ + com: ( + + + {key === 'domain' ? + : '' + } + + + ) + }) + }) + group.push() + }) + return group; + } + + // 列表的三个点 + onOperatesClick = (record, index, operate) => { + let selectIndex = record.randomFieldId; + let type = ''; + + switch (Number(operate.index)) { + case 0: + type = 'BTN_EDIT';//编辑 + break; + case 1: + type = 'rb_2';//删除 + break; + case 2: + type = 'rb_4';//测试 + break; + case 3: + type= 'rb_3';//初始化 + break; + } + this.onRightMenuClick(type, selectIndex); + } + + // 列表重定义列 + getColumns = (columns) => { + let newColumns = ''; + + newColumns = columns && columns.map(column => { + let newColumn = column; + newColumn.render = (text, record, index) => { //前端元素转义 + let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; + return ( + newColumn && (newColumn.dataIndex === 'systemaddress'||newColumn.dataIndex === 'coremailsys') + ? this.onRightMenuClick('BTN_EDIT', record.randomFieldId)} dangerouslySetInnerHTML={{__html: valueSpan}}/> + :
+ ) + }; + return newColumn; + }); + return newColumns; + } + + render() { + const { coremailStore } = this.props; + const { status, setStatus, logFormTable, tableStore, initialList, showInitDia} = coremailStore; + const { loading, tabSelected, searchShow, rightLoading, hasNonStandard, nonStandLoading } = toJS(status); + + return (nonStandLoading + ? null + : hasNonStandard + ?
+ + + } + iconBgcolor={IntegrationUtil.GeneralTitleColor.iconBgcolor} + showDropIcon={true} + dropMenuDatas={this.getDropMenuDatas()} + dropMenuProps={{ + collectParams: { + favname: `${getLabel("129787", "CoreMail集成")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/coremail", + importantlevel: 1 + } + }} + > + setStatus("searchShow", e)} + hideSearchAd={() => setStatus("searchShow", false)} + onChange={v =>{this.resetSearchCondition(Number(v)); setStatus("tabSelected", Number(v))}} + onSearchChange={v => { this.doOnSearchChange(v); }} + onSearch={v => this.doOnSearch()} + searchsBaseValue={this.getSearchBaseValue()} + /> + + {tabSelected === 0 && + + } + {tabSelected === 1 && ( +
+ +
)} + {tabSelected === 2 && ( +
+ +
)} +
+ + +
+
+
+ : + ) + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/coremail/initializedData.js b/pc4backstage/integration/components/coremail/initializedData.js new file mode 100644 index 0000000..fe94b78 --- /dev/null +++ b/pc4backstage/integration/components/coremail/initializedData.js @@ -0,0 +1,108 @@ +import React from "react"; +import {inject, observer} from 'mobx-react'; +import {WeaDialog,WeaSearchGroup,WeaProgress,WeaLocaleProvider,WeaNewScroll,WeaRightMenu} from "ecCom"; +import {Button} from 'antd'; +import "./style/default.css" + +import SycnProcess from './sycnProcess' + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("coremailStore") +@inject('intelogin') +@observer +class InitializedData extends React.Component{ + constructor(props) { + super(props); + this.getButtons = this.getButtons.bind(this); + this.getRightMenus = this.getRightMenus.bind(this); + } + + + componentWillUnmount() { + const {coremailStore:cs}= this.props; + cs.clearTimer(); + } + + getButtons(){ + let buttons = []; + return buttons; + } + + getRightMenus(){ + let menus = []; + return menus; + } + + render() { + const footer = []; + const {coremailStore: cs} = this.props; + const {oncancelInit} = cs; + const {showInit} = this.props; + const moreBtn = { + datas: [ + { + key: "1", + disabled: false, + icon: , + content: getLabel('309','关闭') , + onClick: key => oncancelInit() + }, + + ] + }; + let {initialList} = this.props; + if (!initialList) { + initialList = []; + } + return oncancelInit()} + moreBtn={moreBtn} + buttons={this.getButtons()} + > + + { + this.setState({ + scrollTop: e.target.scrollTop, + }) + }} + > + {initialList.length>0? + initialList.map((item, idx) => + +
+ + + +
+
+ ):
+ {getLabel('506794','暂无同步数据!') } +
+ } +
+
+
+ } +} + +export default InitializedData; \ No newline at end of file diff --git a/pc4backstage/integration/components/coremail/style/default.css b/pc4backstage/integration/components/coremail/style/default.css new file mode 100644 index 0000000..ea3c92d --- /dev/null +++ b/pc4backstage/integration/components/coremail/style/default.css @@ -0,0 +1,10 @@ +.int-initial-process{ + margin:5px 0; + +} + + +.int-initial-sycn-item{ + width:80%; + margin:10px auto; +} \ No newline at end of file diff --git a/pc4backstage/integration/components/coremail/sycnProcess.js b/pc4backstage/integration/components/coremail/sycnProcess.js new file mode 100644 index 0000000..a353454 --- /dev/null +++ b/pc4backstage/integration/components/coremail/sycnProcess.js @@ -0,0 +1,49 @@ +import React from "react" +import {WeaLocaleProvider, WeaProgress} from "ecCom"; + +const getLabel = WeaLocaleProvider.getLabel; + +class SycnProcess extends React.Component{ + + constructor(props) { + super(props); + } + + render() { + + const {type, syncData} = this.props; + if(!syncData){ + return ; + } + let tempSyncData = Number(syncData); + let typeName = type === 1 ? getLabel('506795','分部同步') : type === 2 ? getLabel('506796','部门同步') : getLabel('386890','人员同步'); + let stateName =""; + if(tempSyncData){ + if(tempSyncData==100){ + stateName = getLabel('506797', '同步结束'); + }else if(tempSyncData==0){ + stateName = getLabel('506798', '未同步'); + }else if(tempSyncData==-1){ + stateName = getLabel('508158','coremail未启用'); + }else if(tempSyncData==-2){ + stateName = getLabel('508159','coremail同步组织架构开关没开启'); + }else if(tempSyncData==-3){ + stateName = getLabel('508160','同步中出现异常'); + }else if(tempSyncData>0&&tempSyncData<100){ + stateName = getLabel('391133', '同步中'); + }else{ + stateName = getLabel('32104','异常'); + } + } + + return
+
{typeName}:{stateName}
+ { syncData === -1|| tempSyncData< 0 ?
: + } +
+ } + +} + +export default SycnProcess; \ No newline at end of file diff --git a/pc4backstage/integration/components/dataSource/createAndEdit.js b/pc4backstage/integration/components/dataSource/createAndEdit.js new file mode 100644 index 0000000..6e8f7a4 --- /dev/null +++ b/pc4backstage/integration/components/dataSource/createAndEdit.js @@ -0,0 +1,408 @@ +/** + * @description 21.04.25 重构数据源功能 + * @author fyj + */ + +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Spin, Button } from "antd"; +import { WeaSwitch } from "comsMobx"; +import { WeaLocaleProvider, WeaSearchGroup, WeaRightMenu, WeaCheckbox, WeaDialog, WeaFormItem, WeaTools, WeaUpload } from "ecCom"; +import { GeneralTitleColor, checkFormValidator, checkFieldValueUnique } from "../../util/IntegrationUtil.js"; +import { checkTableFieldValueUnique } from "../../apis/CommonService"; + +const getLabel = WeaLocaleProvider.getLabel; +const { getKey } = WeaTools; + +@inject("dataSource") +@observer +export default class CreateOrEditTask extends React.Component { + + constructor(props) { + super(props); + this.state = { + src: '/weaver/weaver.file.MakeValidateCode?notneedvalidate=1&isView=1&validatetype=0&validatenum=4', + num: 0, + collectParams: { + favname: getLabel("28051", "新建模板"), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/blogengine/templateSetCreate", + importantlevel: 1 + } + } + } + + /** + * 获取弹窗的标题 + * @returns title + */ + getDialogTitle = () => { + const { + tab, + dataSourceType={}, + dataSourceCreateAndEdit={} + } = this.props.dataSource; + + if(0 === Number(tab.selectedKey)) { + return (dataSourceCreateAndEdit.isEdit ? getLabel(26473, "编辑") : getLabel(365, "新建")) + getLabel(385388, "数据源"); + } else if(1 === Number(tab.selectedKey)) { + return (dataSourceType.isEdit ? getLabel(26473, "编辑") : getLabel(365, "新建")) + getLabel(15025, "数据库类型"); + } + }; + + /** + * 获取弹窗内的按钮 + * @returns buttons + */ + getDialogBtns = () => { + const { tab, rightmenus } = this.props.dataSource; + const whichRightMenu = [rightmenus.dataSource, rightmenus.dataSourceType][Number(tab.selectedKey)] || []; + + return whichRightMenu.map(m => ( + + )); + }; + + /** + * 获取右键的操作菜单 + * @returns buttons + */ + getDialogBtnsRightMenu = () => { + const { tab, rightmenus } = this.props.dataSource; + const whichRightMenu = [rightmenus.dataSource, rightmenus.dataSourceType][Number(tab.selectedKey)] || []; + + return whichRightMenu.map(item => ( + { + key: item.type, + icon: , + content: item.menuName, + onClick: () => this.onRightMenuClick(item.type) + } + )); + } + + onRightMenuClick = (type) => { + switch (type) { + case "BTN_Save": + this.saveBaseInfo(); + break; + case "BTN_Test": + this.saveBaseInfo(this.testSaveCallBack); + break; + } + } + + /** + * 表单保存之前的必填项处理 + */ + hideFormRequiredFieldKey = () => { + const { dataSourceCreateAndEdit } = this.props.dataSource; + const { form } = dataSourceCreateAndEdit; + const params = form.getFormParams(); + + if (params.iscluster == '1') { + window.e9HideFormFieldKeys = ["host", "port", "dbname", "sortid"]; + } else if(["gs", "dm"].includes(params.type)) { + window.e9HideFormFieldKeys = ["url", "dbname", "sortid"]; + } else { + window.e9HideFormFieldKeys = ["url", "sortid"]; + } + } + + /** + * 处理保存时传递给后端的数据 + * @returns params + */ + handleFormParams = () => { + const { dataSourceCreateAndEdit, source } = this.props.dataSource; + const { form } = dataSourceCreateAndEdit; + const params = form.getFormParams(); + + if(source) { + // 新建保存时添加 typename 分类 + params.typename = source; + } + params.id = dataSourceCreateAndEdit.editId || ''; + params.iscluster = (params.iscluster === "0" ? "1" : "2"); + params.sortid = (typeof(params.sortid) === "object" + ? params.sortid.join && params.sortid.join(",") + ? params.sortid + : "0" + : params.sortid); + + return params; + } + + /** + * 保存 + * @param {function} testSaveCallBack 测试函数 + * @returns + */ + saveBaseInfo = (testSaveCallBack=null) => { + const { tab, dataSourceType, datasourceAPI, dataSourceCreateAndEdit } = this.props.dataSource; + const { form } = dataSourceCreateAndEdit; + // 获取 form 表单提交时传递给接口的数据 + const params = this.handleFormParams(); + + if (Number(tab.selectedKey) === 0) { + if(/^(ecology)$/gi.test(params.pointid)) { + form.showError('pointid', getLabel('519109','ecology不允许作为数据源名称')); + return; + } + + // 隐藏必填项的校验 + this.hideFormRequiredFieldKey(); + + checkFormValidator(form) + .then(() => { + let checkParams = { + tableName: 'datasourcesetting', + fieldName: 'pointid', + fieldValue: form.getFormParams().pointid.replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: dataSourceCreateAndEdit.editId + }; + return checkFieldValueUnique(checkParams, 1); + }) + .then(title => { + if(title) { + form.showError('pointid', title); + } else { + if(dataSourceCreateAndEdit.isEdit || dataSourceType.isEdit) { + if(testSaveCallBack && typeof(testSaveCallBack) === "function") { + params.operate = 'test'; + } + datasourceAPI().update(params, (result) => { + if(result.status != "false") { + typeof(this.props.saveCallBack) === "function" && this.props.saveCallBack(result); + } + }, typeof(testSaveCallBack) != "function"); + } else { + datasourceAPI().insert(params, (result) => { + if(result.status != "false") { + typeof(this.props.saveCallBack) === "function" && this.props.saveCallBack(result); + typeof(testSaveCallBack) === "function" && testSaveCallBack(result.datasourcesettingid); + } + }, typeof(testSaveCallBack) != "function"); + } + } + }) + .catch(reason => { + console.error(reason.message); + }); + } + } + + testSaveCallBack = (datasourcesettingid) => { + const { + dataSourceCreateAndEdit, + datasourceAPI, + getForm + } = this.props.dataSource; + + datasourceAPI().test({datasourcesettingid}, () => { + getForm({ id: datasourcesettingid }); + dataSourceCreateAndEdit.isEdit = true; + dataSourceCreateAndEdit.editId = datasourcesettingid; + }); + } + + getSearchs = (form, datas, hide) => { + const { isFormInit } = form; + const { isclusterAttr, dataSourceCreateAndEdit } = this.props.dataSource; + const group = []; + const formParams = form.getFormParams(); + + isFormInit && datas && datas.forEach((c, index) => { + const items = []; + c && c.items && c.items.forEach(fields => { + const key = fields.domkey[0]; + + if('driverfilename' !== key) { + items.push({ + com: ( + + {"iscluster" === key ? + jdbc:sqlserver://${getLabel('83578', '地址')}:${getLabel('84629', '端口')};DatabaseName=${getLabel('504419','数据库名')}
Oracle:
jdbc:oracle:thin:@${getLabel('83578', '地址')}:${getLabel('84629','端口')}:${getLabel('504419','数据库名')}
MySQL:
jdbc:mysql://${getLabel('83578', '地址')}:${getLabel('84629','端口')}/${getLabel('504419','数据库名')}?useUnicode=true&characterEncoding=utf8
DB2:
jdbc:db2://${getLabel('83578', '地址')}:${getLabel('84629','端口')}/${getLabel('504419','数据库名')}
Sybase:
jdbc:sybase:Tds:${getLabel('83578', '地址')}:${getLabel('84629','端口')}/${getLabel('504419','数据库名')}?charset=cp936
Informix:
jdbc:informix-sqli://${getLabel('83578', '地址')}:${getLabel('84629','端口')}/${getLabel('504419','数据库名')}:INFORMIXSERVER=myserver
Hana:
jdbc:sap://${getLabel('83578', '地址')}:${getLabel('84629','端口')}?reconnect=true`}} />} onChange={v => form.updateFields({iscluster: v})} + onChange={v => form.updateFields({iscluster: v})} + /> + : { + if(getKey(fields) === 'pointid') { + if(v.pointid && v.pointid.value) { + if(/^(ecology)$/gi.test(v.pointid.value)) { + form.showError('pointid', getLabel('519109','ecology不允许作为数据源名称') ); + }else { + let checkParams = { + tableName: 'datasourcesetting', + fieldName: 'pointid', + fieldValue: form.getFormParams().pointid.replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: dataSourceCreateAndEdit.editId + }; + checkFieldValueUnique(checkParams, 1) + .then(title => { + if(title) { + form.showError('pointid', title); + } + }); + } + } + }else if(getKey(fields) === 'dbtype') { + let checkParams = { + tableName: 'datasource_type', + fieldName: 'dbtype', + fieldValue: form.getFormParams().dbtype.replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: '' + }; + checkTableFieldValueUnique(checkParams).then(result => { + if(result&&result.isNotUnique) { + form.showError('dbtype',getLabel('129943','名称已存在')); + } + }); + } + }} + /> + } +
), + colSpan: 1, + hide: form.isHide(fields, (keys, allParams) => { + if (hide) { + return hide(getKey(fields), keys, allParams) + } + }) + }) + }else if(getKey(fields) === 'driverfilename') { + if(fields.datas[0]) { + let params = fields.datas[0]; + Object.assign(params, {imgSrc : ''}) + } + items.push({ + com:( + { + if(arr[0].length === 0) { + document.querySelector('.wea-upload-container').style.display='block'; + form.updateFields({ + driverfilename:'' + }) + }else { + document.querySelector('.wea-upload-container').style.display='none'; + form.updateFields({ + driverfilename: `${arr[0][0].fileid}` + }) + } + }} + /> + ) + }) + } + }); + + group.push( + + ) + }); + return group; + } + + closeDialog = () => { + const { dataSourceCreateAndEdit, dataSourceType } = this.props.dataSource; + + dataSourceCreateAndEdit.show = false; + dataSourceType.show = false; + this.setState({num: 0}); + } + + render() { + const { loading, dataSourceCreateAndEdit, tab, dataSourceType} = this.props.dataSource; + const {collectParams} = this.state; + + return ( + + + + { + Number(tab.selectedKey) === 0 + ? this.getSearchs( + dataSourceCreateAndEdit.form, + toJS(dataSourceCreateAndEdit.conditions), + (key, b, c) => { + switch (key) { + case "host": + case "port": + return c.iscluster == 1; + case "url": + return c.iscluster == 0 || c.iscluster == 2; + case "dbname": + return c.iscluster == 1 || ["gs", "dm"].includes(c.type); + } + return false; + } + ) + : this.getSearchs(dataSourceType.form, toJS(dataSourceType.conditions)) + } + + + + ); + } +} diff --git a/pc4backstage/integration/components/dataSource/index.js b/pc4backstage/integration/components/dataSource/index.js new file mode 100644 index 0000000..38262a2 --- /dev/null +++ b/pc4backstage/integration/components/dataSource/index.js @@ -0,0 +1,553 @@ +/** + * @description 21.04.25 重构数据源功能 + * @author fyj + */ + +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { WeaTableNew, WeaLogView } from "comsMobx"; +import { getSearchBtns, getAdvancedItem, GeneralTitleColor, findOriginFromRoute, showDeleteDataConfirmDialog } from "../../util/IntegrationUtil.js"; +import { + WeaLocaleProvider, + WeaRightMenu, + WeaTop, + WeaTab, + WeaLeftRightLayout, +} from "ecCom"; +import { Button } from "antd"; +import NoRight from "../../public/NoRight"; +import CreateAndEdit from "./createAndEdit.js"; +import OrganizationTree from '../../public/OrganizationTree'; + +const { WeaTable } = WeaTableNew; +const getLabel = WeaLocaleProvider.getLabel; +const WeaLogViewComp = WeaLogView.Component; + +@inject("dataSource") +@observer +export default class DataSource extends React.Component { + + state = { + /** tabData, weatab 的 datas 属性值 */ + tabData: [ + { + title: getLabel("32264", "数据源设置"), + viewcondition: 0 + }, + { + title: getLabel("129690", "数据库类型设置"), + viewcondition: 1 + } + ] + } + + componentWillMount() { + const {dataSource} = this.props; + dataSource.source = findOriginFromRoute(); + } + + componentDidMount() { + this.init(); + } + + componentWillReceiveProps(nextProps) { + if(nextProps.location.key != this.props.location.key) { + this.init(); + } + } + + /** + * 页面挂载后初始化数据,所有初始化的操作都在该方法中进行 + */ + init = () => { + const { init } = this.props.dataSource; + init(); + } + + // 分权刷新 + refreshData = (id, type) => { + const { + dataSource + } = this.props, { + datasourceAPI, + tab, + } = dataSource; + + // 如果点击的是分部 + dataSource.subcompanyid = ('1' === type ? id : ''); + if(tab.selectedKey == 0) { + datasourceAPI().getListConditions(() => { + dataSource.getList(); + datasourceAPI().getListRightMenus(); + }); + } + } + + getTabButtonsAd = () => { + const { dataSource } = this.props; + const { searchAdvance } = dataSource; + return getSearchBtns( + this.handleSearchFun, + () => searchAdvance.form.reset(), + () => searchAdvance.show = false, + this && this.props && this.props.ecId || '', + "integrationDatasource" + ); + }; + + getSearchAD = () => { + const { dataSource } = this.props; + const { form, conditions=[] } = dataSource.searchAdvance; + return getAdvancedItem( + form, + toJS(conditions), + this.handleSearchFun, + false, + this && this.props && this.props.ecId || '', + "integrationDatasource" + ); + }; + + /** + * 获取删除按钮的 disabled + * @returns disabled 获取按钮的 disabled 状态 + */ + getBtnDisabledStatus = () => { + const { + dataSourceTable, + dataSourceType, + tab, + } = this.props.dataSource; + + if (Number(tab.selectedKey) === 0) { + return toJS(dataSourceTable.selectedRowKeys).length === 0; + } else { + return toJS(dataSourceType.table.selectedRowKeys).length === 0; + } + } + + getWeaTopBtns = () => { + const { tab, dropMenuDatas } = this.props.dataSource; + + const disable = this.getBtnDisabledStatus(); + if (Number(tab.selectedKey) === 0) { + return toJS(dropMenuDatas) && toJS(dropMenuDatas).map((item, i) => { + if (i < 2) { + if (item.type === "BTN_BatchDelete") { + return ( + + ) + } else { + return ( + + ) + } + } + }) + } + return []; + } + + getDropMenuDatas = () => { + const { dropMenuDatas, tab, source } = this.props.dataSource; + const btnArr = []; + + toJS(dropMenuDatas) && toJS(dropMenuDatas).forEach((item, i) => { + let disable = false; + if (item.type === "BTN_BatchDelete") { + disable = this.getBtnDisabledStatus(); + } + if (Number(tab.selectedKey) === 1 && i<2) { + }else{ + if(!(Number(tab.selectedKey) === 0 && source && item.type === "BTN_log")) { + btnArr.push({ + key: item.type, + icon: , + content: item.menuName, + disabled: disable, + onClick: () => this.onRightMenuClick(item.type) + }) + } + } + }) + btnArr.push({ + key: "BTN_COLUMN", + icon: , + content: `${getLabel(32535, "显示列定制")}`, + onClick: () => this.onRightMenuClick("BTN_COLUMN") + }); + return btnArr; + } + + onRightMenuClick = (type, record) => { + switch (type) { + case "BTN_Insert": + this.createTask(); + break; + case "BTN_EDIT": + this.doEditById(record); + break; + case "BTN_BatchDelete": + this.deleteData('batch'); + break; + case "BTN_DEL": + this.deleteData('single', record); + break; + case "BTN_TEST": + this.test(record); + break; + case "BTN_log": + this.handleClickBtnLog(record); + break; + case "BTN_COLUMN": + this.handleClickBtnColumn(); + break; + case "BTN_DOWNLOAD": + this.downloadDriver(record); + break; + } + } + + /** + * 下载驱动 + * @param {object} record 操作的当前数据 + */ + downloadDriver = (record) => { + const driverfilename = record.driverfilename || ''; + + if(isNaN(driverfilename)){ + window.location.href = (window.ecologyContentPath || "") + '/resource/DriverFile/'+driverfilename; + }else{ + window.location.href = (window.ecologyContentPath || "") + "/weaver/weaver.file.FileDownload?fileid="+driverfilename+"&download=1"; + } + } + + /** + * 【编辑】按钮对应的事件 + * @param {object} record + */ + doEditById = (record) => { + const { dataSourceCreateAndEdit, dataSourceType, getForm, tab } = this.props.dataSource; + + getForm({ id: record.id }); + if (Number(tab.selectedKey) === 0) { + dataSourceCreateAndEdit.show = true; + dataSourceCreateAndEdit.isEdit = true; + dataSourceCreateAndEdit.editId = record.id; + } else { + dataSourceType.show = true; + dataSourceType.isEdit = true; + dataSourceType.editId = record.id; + } + }; + + /** + * 【测试】 按钮的对应事件 + */ + test = (record) => { + const { datasourceAPI } = this.props.dataSource; + + datasourceAPI().listTest({ id: record.id }); + } + + /** + * 【新建】按钮对应的事件 + */ + createTask = () => { + const { dataSourceCreateAndEdit, dataSourceType, tab, getFormDataSource, getFormDataSourceType, datasourceAPI } = this.props.dataSource; + + if (Number(tab.selectedKey) === 0) { + getFormDataSource({isEdit: "0"}); + datasourceAPI().getFormRightMenus({isEdit: "0"}); + dataSourceCreateAndEdit.isEdit = false; + dataSourceCreateAndEdit.show = true; + } else { + getFormDataSourceType(); + dataSourceType.isEdit = false; + dataSourceType.show = true; + } + }; + + /** + * 【批量删除】 按钮的对应事件 + */ + deleteData = (type, record) => { + const { + dataSourceTable, + datasourceAPI, + datasourcetypeAPI, + dataSourceType, + tab + } = this.props.dataSource; + + showDeleteDataConfirmDialog(type) + .then(() => { + if (Number(tab.selectedKey) === 0) { + if('single' === type) { + datasourceAPI().delete({ pointids: record.pointid, id: record.id }); + } else { + datasourceAPI().batchDelete({ + ids: toJS(dataSourceTable.selectedRowKeysAllPages) + }); + } + } else { + if('single' === type) { + datasourcetypeAPI().delete({ id: record.id }); + } else { + datasourcetypeAPI().batchDelete({ + ids: toJS(dataSourceType.table.selectedRowKeysAllPages) + }); + } + } + }); + }; + + /** + * 【日志】按钮的对应事件 + */ + handleClickBtnLog = (record = {id: ''}) => { + const { + toggleView, + setOperateIndex + } = this.props.dataSource; + + setOperateIndex(record.id); + toggleView(); + } + + /** + * 【显示列定制】按钮的对应事件 + */ + handleClickBtnColumn = () => { + const { + dataSourceType={}, + tab, + dataSourceTable, + } = this.props.dataSource; + + if (Number(tab.selectedKey) === 0) { + dataSourceTable.setColSetVisible(true); + dataSourceTable.tableColSet(true); + } else { + dataSourceType.table.setColSetVisible(true); + dataSourceType.table.tableColSet(true); + } + } + + /** + * 切换 tab 时调用的事件 + * @param {string} v 当前选中的 tab key + */ + handleChangeTab = v => { + const { dataSource } = this.props; + const { tab, datasourceAPI } = dataSource; + + dataSource.subcompanyid = ""; + tab.selectedKey = Number(v); + if(v == 0) { + datasourceAPI().getListConditions(() => { + dataSource.getList(); + datasourceAPI().getListRightMenus(); + }); + } else { + dataSource.getList(); + } + } + + /** + * 快速搜索框输入值联动到 form 表单中 + * @param {string} v 快速搜索框输入的值 + */ + onSearchChange = v => { + const { searchAdvance } = this.props.dataSource; + searchAdvance.form.updateFields({pointid: v}); + } + + /** + * 搜索事件 + */ + handleSearchFun = () => { + const { dataSource } = this.props; + + dataSource.searchAdvance.show = false; + dataSource.subcompanyid = dataSource.searchAdvance.form.getFormParams().subcomId; + dataSource.getList(true); + dataSource.datasourceAPI().getListRightMenus(); + } + + /** + * 设置高级搜索面板是否显示 + * @param {boolean} e + * @returns + */ + setShowSearchAd = e => this.props.dataSource.searchAdvance.show = e; + + /** + * 隐藏高级搜索的面板 + * @returns + */ + hideSearchAd = () => this.props.dataSource.searchAdvance.show = false; + + /** + * 每行数据的操作菜单 + * @param {object} record + * @param {number} recordIndex + * @param {object} operate + * @param {number} opertaeIndex + */ + onOperatesClick = (record, recordIndex, operate, opertaeIndex) => { + const { tab } = this.props.dataSource; + const arr = Number(tab.selectedKey) === 0 ? ['BTN_EDIT', 'BTN_DEL', 'BTN_TEST', 'BTN_log'] : ['BTN_EDIT', 'BTN_EDIT', 'BTN_DEL', 'BTN_DOWNLOAD', 'BTN_log']; + + this.onRightMenuClick(arr[Number(opertaeIndex)], record); + }; + + /** + * 重新渲染列 + * @param {array} columns 列信息 + * @returns + */ + redoColumnsByName = columns => { + const { tab, getTableList } = this.props.dataSource; + + return columns.map(column => { + column.render = (text, record, index) => { + //前端元素转义 + const valueSpan = + record[column.dataIndex] !== undefined + ? record[column.dataIndex] + : record[column.dataIndex + "span"]; + + switch (column.dataIndex.toString()) { + case "pointid": + case "dbtype": + return ( +
this.doEditById(record)} + dangerouslySetInnerHTML={{ __html: valueSpan }} + /> + ); + case "type": + return ( + { + tab.selectedKey = 1; + getTableList(true); + doEditById({id : record.dbtypeid}); + }} + > + {record.typespan} + + ); + case 'subcompanyid': + return ( + + {record.subcompanyidspan} + + ); + default: + return (
); + } + }; + return column; + }); + }; + + /** + * 渲染列表页面 + * @returns 渲染列表页面 + */ + getWhichTable = () => { + const { tab, dataSourceTable, dataSourceType } = this.props.dataSource; + + return ( + + ); + }; + + render() { + const { dataSource } = this.props; + const { + searchAdvance, + tab, + loading, + logStore, + logView, + toggleView, + rightLoading, + operateIndex, + hasOrganization, + subcompanyid, + hasManageDetachableRight, + } = dataSource; + const formParams = searchAdvance.form.getFormParams(); + + return (rightLoading + ? null + : + } + iconBgcolor={GeneralTitleColor.iconBgcolor} + showDropIcon={true} + dropMenuDatas={(!hasManageDetachableRight && tab.selectedKey == 0) ? [] : this.getDropMenuDatas()} + /> + } + > + + { + (!hasManageDetachableRight && tab.selectedKey == 0) + ? + : this.getWhichTable() + } + + + + + ); + } +} diff --git a/pc4backstage/integration/components/datashow/CacheDataManage.js b/pc4backstage/integration/components/datashow/CacheDataManage.js new file mode 100644 index 0000000..32bd3e1 --- /dev/null +++ b/pc4backstage/integration/components/datashow/CacheDataManage.js @@ -0,0 +1,353 @@ +import React, { + Component +} from 'react'; +import { + inject, + observer, +} from "mobx-react"; +import { + WeaTab, + WeaLocaleProvider, + WeaButtonIcon, +} from "ecCom"; +import { + WeaTableNew, +} from "comsMobx"; +import { + getAdvancedItem, + getSearchBtns, + getForm, + onCheck, + checkUnique, + doConfirm, +} from "../../util/IntegrationUtil"; +import DataShowDialog from "./DataShowDialog"; + +const {getLabel} = WeaLocaleProvider; +const {WeaTable} = WeaTableNew; + +@inject("dataShowStore") +@observer +export default class CacheDataManage extends Component { + constructor(props) { + super(props); + this.state = { + searchType: ["base", "advanced"], + showSearchAd: false, + }; + } + + componentWillReceiveProps(nextProps) { + this.setState({ + showSearchAd: false, + }) + } + + componentWillMount() { + this.setState({ + showSearchAd: false, + }) + } + + // 详情页面 + handleChange = (form, allParams, fields) => { + const key = fields.domkey[0]; + + if("keyid" === key) { + this.checkFlagUnique(); + } + } + + checkFlagUnique = (callBack) => { + const { + dataShowStore, + } = this.props, { + newForm, + status, + } = dataShowStore, { + cacheDataDetailOperateInfo={}, + cacheDataDialogTitle, + } = status, { + id, + } = cacheDataDetailOperateInfo; + + let func = () => { + if(callBack && typeof(callBack) === "function") { + callBack(); + } + }; + + let fieldValue = newForm.getFormParams().keyid.replace(/^(\s*)|(\s*)$/g, ''); + if(fieldValue) { + checkUnique({ + tableName: cacheDataDialogTitle, + fieldName: 'keyid', + fieldValue, + idName: 'id', + idValue: id + }, newForm, "keyid", "8", "", func); + } + } + + onDetailMenuClick = (type) => { + const { + dataShowStore, + } = this.props, { + newForm, + status, + } = dataShowStore, { + cacheDataDetailOperateInfo, + } = status; + + if("BTN_SAVE" === type) { + onCheck(newForm, () => this.checkFlagUnique(() => { + dataShowStore.getDataShowCacheOperation({ + ...newForm.getFormParams(), + operate: cacheDataDetailOperateInfo ? "updateCache" : "addCache", + id: cacheDataDetailOperateInfo ? cacheDataDetailOperateInfo.id : "", + }); + })); + } + } + + // Table的一些操作 + onOperatesClick = (record, index, operate, flag) => { + this.onMenuClick(operate.index, record); + }; + + getColumnsInfo = (datas=[]) => { + return datas && datas.map(item => { + if("keyid" === item.dataIndex) { + item.render = (text, record) => this.onMenuClick("0", record)}>{text}; + } + + return item; + }) + } + + getTabButtonsAd = () => { + return getSearchBtns( + this.handleSearchFun, + () => this.props.dataShowStore.cacheDataSearchForm.reset(), + () => this.setState({ showSearchAd: false }), + this && this.props && this.props.ecId || '', + "integrationDatashowCacheDataManage" + ); + } + + // 高级搜索的搜索方法 + handleSearchFun = () => { + const { + dataShowStore, + } = this.props; + + dataShowStore.getCacheDataManageInfo(); + this.setState({ showSearchAd: false }); + } + + getAdvancedSearch = () => { + const { + dataShowStore, + } = this.props, { + cacheDataSearchForm, + status, + } = dataShowStore, { + cacheDataSearchCondition, + } = status; + return getAdvancedItem(cacheDataSearchForm, cacheDataSearchCondition, this.handleSearchFun, false, this && this.props && this.props.ecId || '', "integrationDatashowCacheDataManage"); + }; + + onSearchChange = (value) => { + const { + dataShowStore, + } = this.props, { + cacheDataSearchForm, + } = dataShowStore; + + cacheDataSearchForm.updateFields({key: value}); + } + + getSearchBaseValue = () => { + const { + dataShowStore, + } = this.props, { + cacheDataSearchForm, + } = dataShowStore, { + key, + } = cacheDataSearchForm.getFormParams(); + + return key; + } + + setShowSearchAd = bool => this.setState({showSearchAd: bool}); + + hideSearchAd = () => this.setState({showSearchAd: false}); + + onMenuClick = (type, record) => { + const { + dataShowStore, + } = this.props, { + cacheDataTableStore, + status, + } = dataShowStore, { + selectedRowKeys, + } = cacheDataTableStore, { + cacheDataOperateInfo={}, + } = status; + + let id = record ? record.id : selectedRowKeys; + + if("BTN_NEW" === type) { + dataShowStore.setState({ + cacheDataManageDetailVisible: true, + cacheDataDetailOperateInfo: "", + }); + + dataShowStore.getDataShowCacheDataForm({browsertype: cacheDataOperateInfo ? cacheDataOperateInfo.showname : ""}); + } else if("BTN_DEL" === type || "1" === type) { + let title = getLabel(385625, '确定要删除选择的记录吗?'); + + if("1" === type) { + title = getLabel(15097, '确定要删除吗?'); + } + doConfirm(title, dataShowStore.getDataShowCacheOperation, {operate: "delCache", id, browsertype: cacheDataOperateInfo ? cacheDataOperateInfo.showname : ""}); + } else if("BTN_COLUMN" === type) { + cacheDataTableStore.setColSetVisible(true); + cacheDataTableStore.tableColSet(true); + } else if("0" === type) { + dataShowStore.setState({ + cacheDataManageDetailVisible: true, + cacheDataDetailOperateInfo: record, + }); + + dataShowStore.getDataShowCacheDataForm({ + browsertype: cacheDataOperateInfo ? cacheDataOperateInfo.showname : "", + id, + browsertype: cacheDataOperateInfo ? cacheDataOperateInfo.showname : "", + }); + } + } + + getRightMenus = (datas=[]) => { + const { + dataShowStore, + } = this.props, { + selectedRowKeys, + } = dataShowStore.cacheDataTableStore; + + let rightMenus = datas && datas.map(item => { + if(item.type === "BTN_DEL") { + item.disabled = selectedRowKeys.length === 0; + } + + return { + ...item, + key: item.type, + icon: , + content: item.menuName, + onClick: () => this.onMenuClick(item.type), + }; + }); + + rightMenus.push({ + key: "BTN_COLUMN", + icon: , + content: getLabel(32535, "显示列定制"), + onClick: () => this.onMenuClick("BTN_COLUMN"), + }) + + return rightMenus || []; + } + + getButtons = (datas=[]) => { + const { + dataShowStore, + } = this.props, { + selectedRowKeys, + } = dataShowStore.cacheDataTableStore; + + return datas && datas.map(item => this.onMenuClick(item.type)} + />); + } + + onCancel = () => { + const { + dataShowStore, + } = this.props; + + dataShowStore.setState({ + cacheDataManageVisible: false, + cacheDataOperateInfo: "", + }); + } + + render() { + const { + dataShowStore, + } = this.props, { + status, + cacheDataTableStore, + newForm, + cleanCacheDetailDialogStore, + } = dataShowStore, { + cacheDataManageVisible, + menus=[], + cacheDataDialogTitle, + cacheDataSearchAdvancedHeight, + cacheDataManageDetailVisible, + cacheDetailMenus=[], + cacheDataDetailOperateInfo, + dataShowFormFields, + tabButtonDisabled, + } = status, { + searchType, + showSearchAd, + } = this.state; + + return ( + + + + + {getForm(newForm, dataShowFormFields, true, this.handleChange)} + + + ) + } +} diff --git a/pc4backstage/integration/components/datashow/DataShowDialog.js b/pc4backstage/integration/components/datashow/DataShowDialog.js new file mode 100644 index 0000000..76b189b --- /dev/null +++ b/pc4backstage/integration/components/datashow/DataShowDialog.js @@ -0,0 +1,74 @@ +import React, { + Component + } from 'react'; + import { + WeaDialog, + WeaRightMenu, + } from "ecCom"; + import { + Button, + } from "antd"; + + export default class DataShowDialog extends Component { + + getButton = () => { + const {menus=[], disabled} = this.props; + return menus && menus.map(item => ); + } + + getMenus = () => { + const {menus=[], disabled} = this.props; + return menus && menus.map(item => { + return { + key: item.key || item.type, + icon: , + content: item.content || item.menuName, + disabled, + onClick: () => this.onMenuClick(item.key || item.type), + } + }); + } + + onMenuClick = (type) => { + if(this.props.onMenuClick && typeof(this.props.onMenuClick) === "function") { + this.props.onMenuClick(type); + } + } + + onCancel = () => { + if(this.props.onCancel && typeof(this.props.onCancel) === "function") { + this.props.onCancel(); + } + } + + render() { + return ( + + + {this.props.children} + + + ) + } + } + \ No newline at end of file diff --git a/pc4backstage/integration/components/datashow/IndexTestDialog.js b/pc4backstage/integration/components/datashow/IndexTestDialog.js new file mode 100644 index 0000000..674fc8d --- /dev/null +++ b/pc4backstage/integration/components/datashow/IndexTestDialog.js @@ -0,0 +1,244 @@ +import React from "react"; +import {inject, observer} from "mobx-react"; +import {Button, Row} from "antd"; +import {toJS} from "mobx"; +import { + WeaSearchGroup, + WeaRightMenu, + WeaDialog, + WeaLocaleProvider, + WeaHelpfulTip, + WeaTable as WeaTableTest, + WeaTab, + WeaNewScroll, +} from "ecCom"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("dataShowStore") +@observer +export default class IndexTestDialog extends React.Component { + + getTest = () => { + const {dataShowStore} = this.props; + const {status} = dataShowStore; + const {testInitDatas} = toJS(status); + let testTitle = { + "base": getLabel(82751, "基础设置"), + "field": getLabel(21903, "字段设置"), + }; + let group = []; + for (let key in testInitDatas) { + let items = []; + items.push({ + com: ( + ), + colSpan: 1 + }); + group.push(); + } + return group; + }; + + getColumns = () => { + let columns = [ + { + "title":getLabel(511410, "测试项"), + "dataIndex": "name", + "key": "name", + "width": "30%", + "sorter": true + }, + { + "title": getLabel(509969, "测试内容"), + "dataIndex": "content", + "key": "content", + "width": "40%", + "sorter": true + }, + { + "title": getLabel(503912, "测试结果"), + "dataIndex": "status", + "key": "status", + "width": "30%", + "sorter": true + } + ]; + let datas = []; + columns && columns.forEach(column => { + if(column['key'] === 'status') { + datas.push({ + dataIndex: column['dataIndex'], + key: column['key'], + sorter: column['sorter'], + title: column['title'], + width: column['width'], + render: (text, record) => { + if(text == '1') { + return + }else if(text == '0') { + return ×{record.details !== undefined ? : ''} + }else if(text == '2') { + return !{record.details !== undefined ? : ''} + } + } + }) + } else { + datas.push({ + dataIndex: column['dataIndex'], + key: column['key'], + sorter: column['sorter'], + title: column['title'], + width: column['width'], + }); + } + }); + return datas; + }; + + getTable = () => { + let topinfo = { + "tab": { + "datas": [ + { + "title": getLabel(82743, "基础信息"), + "key": "base" + }, + ], + "keyParam": "key", + "selectedKey": "base", + "advanceHeight": "123" + } + }; + + if (topinfo && topinfo.tab) { + return (); + } + }; + + getButtons = () => { + const {dataShowStore} = this.props; + const {dataShowFormHiddenFields} = toJS(dataShowStore.status); + let id = dataShowFormHiddenFields.id || ""; + let buttoninfo = [ + { + "btnName": getLabel(501169, "编辑"), + "btnType": "primary", + "type": "BTN_EDIT" + } + ]; + + let btnArr = []; + buttoninfo && buttoninfo.forEach(b => { + btnArr.push( + ); + }); + return btnArr; + }; + + getMoreBtn = () => { + const {dataShowStore} = this.props; + const {dataShowFormHiddenFields} = toJS(dataShowStore.status); + let id = dataShowFormHiddenFields.id || ""; + let moreBtninfo = [ + { + "key": "1", + "type": "BTN_EDIT", + "icon": "icon-coms-Preservation", + "btnName": getLabel(501169, "编辑"), + } + ]; + let btnArr = []; + moreBtninfo && moreBtninfo.forEach(m => { + btnArr.push({ + key: m.key, + icon: , + content: m.btnName, + onClick: () =>{ + dataShowStore.initIndexTestDialog(); + dataShowStore.initSqlTestForm(); + dataShowStore.newForm.reset(); + dataShowStore.getDataShowEditForm({ id: id}); + dataShowStore.setState({ showNewFormDialog: true }); + } + }); + }); + return btnArr; + }; + + getRightMenu = () => { + const {dataShowStore} = this.props; + const {dataShowFormHiddenFields} = toJS(dataShowStore.status); + let id = dataShowFormHiddenFields.id || ""; + let menuinfo = [ + { + "menuIcon": "icon-coms-Preservation", + "isTop": "1", + "menuName": getLabel(501169, "编辑"), + "isControl": "0", + "type": "BTN_EDIT" + } + ]; + let btnArr = []; + menuinfo && menuinfo.forEach(m => { + btnArr.push({ + key: m.type, + icon: , + content: m.menuName, + onClick: () => { + dataShowStore.initIndexTestDialog(); + dataShowStore.initSqlTestForm(); + dataShowStore.newForm.reset(); + dataShowStore.getDataShowEditForm({ id: id}); + dataShowStore.setState({ showNewFormDialog: true }); + } + }); + }); + return btnArr; + }; + + render() { + const {dataShowStore, showTestVersion} = this.props; + return ( + { + dataShowStore.initIndexTestDialog(); + dataShowStore.initSqlTestForm(); + }} + buttons={this.getButtons()} + moreBtn={{ + datas: this.getMoreBtn(), + collectParams: [] + }} + > + + + {this.getTable()} + + {this.getTest()} + + + + + ) + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/datashow/NewE7Form.js b/pc4backstage/integration/components/datashow/NewE7Form.js new file mode 100644 index 0000000..9c1ffd4 --- /dev/null +++ b/pc4backstage/integration/components/datashow/NewE7Form.js @@ -0,0 +1,174 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { Button } from "antd"; +import { toJS } from "mobx"; +import { WeaSwitch } from "comsMobx"; +import { + WeaSearchGroup, + WeaFormItem, + WeaRightMenu, + WeaDialog, + WeaLocaleProvider +} from "ecCom"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("dataShowStore") +@observer +export default class NewE7Form extends React.Component { + constructor (props) { + super(props); + this.state = {} + } + + getBtns = () => { + const { + dataShowStore + } = this.props, { + menus=[], + buttonDisabled, + } = dataShowStore.status; + return menus && menus.map(item => ); + } + + getRightMenu = () => { + const { + dataShowStore + } = this.props, { + menus=[], + buttonDisabled + } = dataShowStore.status; + + return menus && menus.map(item => { + return { + key: item.key, + icon: , + content : item.content, + disabled: buttonDisabled, + onClick : () => this.onRightMenuClick(item.key) + }; + }); + } + + onRightMenuClick = (type) => { + const {dataShowStore} = this.props; + const {newE7Form, status} = dataShowStore; + const {dataShowE7FormHiddenFields} = toJS(status); + + + if(type == 'BTN_SAVE'){ + newE7Form.validateForm().then(f=>{ + if(f.isValid){ + //合并hiddenfield参数 + let params = Object.assign(dataShowE7FormHiddenFields, newE7Form.getFormParams()); + params.method = "add"; + dataShowStore.getDataShowOperation4E7(params); + }else{ + f.showErrors(); + this.setState({date: new Date()}); + } + }); + + } + } + + getSearchs = () => { + const {dataShowStore} = this.props; + const {newE7Form, status} = dataShowStore; + const {dataShowE7FormFields} = toJS(status); + const {isFormInit} = newE7Form; + let group = []; + let i = 0; + const formParams = newE7Form.getFormParams(); + isFormInit && dataShowE7FormFields && dataShowE7FormFields.map(c =>{ + let items = []; + + c.items.map(fields => { + items.push({ + com:( + + + {}} /> + ), + colSpan:1, + hide: newE7Form.isHide(fields, (keys, allParams) => { + let bool = false; + return bool; + }) + }); + + }); + if(i==1) { + //说明 + items.push({ + com: ( +
+
1、{getLabel(23953,'浏览按钮字段类型中有自定义单选和自定义多选两种类型字段,所引用的自定义浏览按钮即在此设置,自定义浏览框标识不能重复')};
+
2、{getLabel(23954,'数据源选择——从指定数据源中查找并显示数据')};
+
3、{getLabel(23955,'自定义浏览页面只能显示一个查询条件和两列内容,即所有查询不能超过三个字段')};
+
4、{getLabel(23956,'浏览选择时初始数据按“无条件查询”内容查询数据,条件搜索时按“条件2查询”内容查询数据')};
+
5、{getLabel(23957,'.选择后流程字段保存的是“无条件查询”的第一列的值,流程中显示值是按“条件1查询”内容查询出的第一列的值,第二列的值作为链接的title')};
+
6、{getLabel(23958,'“列1显示名”和“列2显示名”指定无条件查询的第二列和第三列对应的字段说明')};
+
7、{getLabel(23959,'所有查询中的参数变量用?代替')}。
+
+ ), + hide: newE7Form.isHide(newE7Form,(keys, allParams) => { + return ( false ); + }) + }); + + } + group.push(); + i++; + }); + return group; + } + + render() { + const {dataShowStore} = this.props; + const {showNewE7FormDialog} = toJS(dataShowStore.status); + return ( + +
+ { + dataShowStore.setState({showNewE7FormDialog : false}); + dataShowStore.newForm.reset(); + }} + buttons={this.getBtns()} + moreBtn={{ + datas : this.getRightMenu(), + collectParams: [] + }} + > + + + + {this.getSearchs()} + + + + +
+ ) + } +} diff --git a/pc4backstage/integration/components/datashow/NewForm.js b/pc4backstage/integration/components/datashow/NewForm.js new file mode 100644 index 0000000..e4ddf71 --- /dev/null +++ b/pc4backstage/integration/components/datashow/NewForm.js @@ -0,0 +1,1480 @@ +import React from "react"; +import {inject, observer} from "mobx-react"; +import {Button, message, Modal} from "antd"; +import {checkTableFieldValueUnique} from "../../apis/CommonService"; +import {toJS} from "mobx"; +import {WeaSwitch} from "comsMobx"; +import { + WeaTableEdit, + WeaSearchGroup, + WeaInput, + WeaFormItem, + WeaTools, + WeaRightMenu, + WeaDialog, + WeaSelect, + WeaLocaleProvider, + WeaHelpfulTip, + WeaTableEditable, +} from "ecCom"; +import uuid from 'uuid'; +import copy from 'copy-to-clipboard'; +import { + onCheck, + checkUnique, +} from '../../util/IntegrationUtil'; +import PreviewDialog from "./PreviewDialog"; +import SqlTestDialog from "./SqlTestDialog"; +import IndexTestDialog from "./IndexTestDialog"; + +const {getKey} = WeaTools; +const {getLabel} = WeaLocaleProvider; +const {confirm} = Modal; +const {Base64} = WeaTools; + +@inject("dataShowStore") +@observer +export default class NewForm extends React.Component { + constructor(props) { + super(props); + this.state = { + dialogStyle: {width: 1200, height: 700}, + regExpValue: /^(requestid|type|fielddbtype|currenttime|workflowid|wfid|billid|isbill|f_weaver_belongto_userid|f_weaver_belongto_usertype|wfTestStr|fieldid|viewtype|fromModule|wfCreate|_random_)$/gi, + baseConfig: { + validatePass: '', + draggable: true, + showAdd: true, + showDelete: true, + showCopy: false, + showMove: false, + showCollapse: true, + tableProps: {showEmptyText: false, scroll: {x: "auto"}} + }, + esbInitCells: { + new_istitle: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_istitle"}]}, + new_issearch: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_issearch"}]}, + new_isshow: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_isshow"}]}, + new_fieldtype: {com: [{type: "SELECT", viewAttr: 1, hasBorder: true, key: "new_fieldtype", defaultValue: "2", options: [ + {disabled: false, key: "2", selected: true, showname: getLabel('22360', '文字'), visible: true}, + {disabled: false, key: "1", selected: false, showname: getLabel('607', '数字'), visible: true} + ]}]}, + new_width: {com: [{type: "INPUTNUMBER", viewAttr: 1, hasBorder: true, key: "new_width", otherParams: {min: 1}}]}, + new_transql: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_transql"}]}, + new_wokflowfieldname: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_wokflowfieldname"}]}, + }, + esbIsShowTitleOpen: { + new_istitle: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_istitle"}]}, + new_isshow: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_isshow"}]}, + new_issearch: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_issearch"}]}, + new_fieldtype: {com: [{type: "SELECT", viewAttr: 1, hasBorder: true, key: "new_fieldtype", defaultValue: "2", options: [ + {disabled: false, key: "2", selected: true, showname: getLabel('22360', '文字'), visible: true}, + {disabled: false, key: "1", selected: false, showname: getLabel('607', '数字'), visible: true} + ]}]}, + new_wokflowfieldname: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_wokflowfieldname"}]}, + // new_desensitization: {com: [{type: "CHECKBOX", viewAttr: 2, hasBorder: true, key: "new_desensitization"}]}, + }, + esbIsSearchOpen: { + new_fieldname: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_fieldname"}]}, + new_issearch: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_issearch"}]}, + new_width: {com: [{type: "INPUTNUMBER", viewAttr: 1, hasBorder: true, key: "new_width", otherParams: {min: 1}}]}, + new_transql: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_transql"}]}, + }, + esbIsTitleOpen: { + new_fieldname: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_fieldname"}]}, + new_issearch: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_issearch"}]} + }, + initCells: { + new_fieldtype: {com: [{type: "SELECT", viewAttr: 1, className: "inte-datashow-selectStyle", hasBorder: true, key: "new_fieldtype", defaultValue: "2", options: [ + {disabled: false, key: "2", selected: true, showname: getLabel('22360', '文字'), visible: true}, + {disabled: false, key: "1", selected: false, showname: getLabel('607', '数字'), visible: true} + ]}]}, + new_width: {com: [{type: "INPUTNUMBER",viewAttr: 1,hasBorder: true,key: "new_width",otherParams: {min: 1}}]}, + new_transql: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_transql"}]}, + new_wokflowfieldname: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_wokflowfieldname"}]}, + new_isshow: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_isshow"}]}, + }, + isShowTitleOpen: { + new_fieldtype: {com: [{ + type: "SELECT", viewAttr: 1, hasBorder: true, key: "new_fieldtype", defaultValue: "2", options: [ + {disabled: false, key: "2", selected: true, showname: getLabel('22360', '文字'), visible: true}, + {disabled: false, key: "1", selected: false, showname: getLabel('607', '数字'), visible: true} + ] + }]}, + new_isshow: {com: [{type: "CHECKBOX", viewAttr: 1, hasBorder: true, key: "new_isshow"}]}, + new_wokflowfieldname: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_wokflowfieldname"}]}, + // new_desensitization: {com: [{type: "CHECKBOX", viewAttr: 2, hasBorder: true, key: "new_desensitization"}]}, + }, + isSearchOpen: { + new_width: {com: [{type: "INPUTNUMBER",viewAttr: 1,hasBorder: true,key: "new_width", otherParams: {min: 1}}]}, + new_transql: {com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_transql"}]}, + }, + showClass_is_2_newWorkFlowFieldName: { + com: [{type: "INPUT", viewAttr: 1, hasBorder: true, key: "new_wokflowfieldname"}] + }, + // 脱敏设置 + // 允许设置二次验证 + new_desensitization_is_1_cells: { + new_secondAuth: {com: [{type: "CHECKBOX", viewAttr: 2, hasBorder: true, key: "new_secondAuth"}]}, + }, + // 允许进行脱敏显示的设置 + allow_desensitization_cells: { + new_desensitization: {com: [{type: "CHECKBOX", viewAttr: 2, hasBorder: true, key: "new_desensitization"}]}, + } + } + } + + getBtns = () => { + const { + dataShowStore, + } = this.props, { + newForm, + status, + } = dataShowStore, { + dataShowFormHiddenFields, + menus, + buttonDisabled, + } = status; + const formParams = newForm.getFormParams(); + let btns = []; + + menus && menus.forEach(v => { + if('BTN_TEST' === v.key) { + if(!(formParams.datafrom == '4')) { + btns.push(); + } + }else if('BTN_GET_SEARCHPAGE' === v.key) { + if (formParams.showclass == "2" && dataShowFormHiddenFields && dataShowFormHiddenFields.id) { + btns.push(); + } + }else { + btns.push(); + } + }) + + return btns; + } + + getRightMenu = () => { + const { + dataShowStore, + } = this.props, { + newForm, + status, + } = dataShowStore, { + dataShowFormHiddenFields, + menus, + buttonDisabled, + } = status; + const formParams = newForm.getFormParams(); + let btnArr = []; + + menus && menus.forEach(v => { + if('BTN_TEST' === v.key) { + if(!(formParams.datafrom == '4')) { + btnArr.push({ + key: v.key, + icon: , + content: v.content, + disabled: buttonDisabled, + onClick: () => this.onRightMenuClick(v.key) + }) + } + }else if('BTN_GET_SEARCHPAGE' === v.key) { + if (formParams.showclass == "2" && dataShowFormHiddenFields && dataShowFormHiddenFields.id) { + btnArr.push({ + key: v.key, + icon: , + content: v.content, + disabled: buttonDisabled, + onClick: () => this.onRightMenuClick(v.key) + }); + } + }else { + btnArr.push({ + key: v.key, + icon: , + content: v.content, + disabled: buttonDisabled, + onClick: () => this.onRightMenuClick(v.key) + }); + } + }); + + return btnArr; + } + + isValidFieldKey = () => { + const {dataShowStore} = this.props; + const {newForm} = dataShowStore; + const formParams = newForm.getFormParams(); + if(formParams.keyfield && formParams.keyfield.trim()) { + let isValid = /^(requestid|type|fielddbtype|currenttime|workflowid|wfid|billid|isbill|f_weaver_belongto_userid|f_weaver_belongto_usertype|wfTestStr|fieldid|viewtype|fromModule|wfCreate|_random_)$/gi.test(formParams.keyfield); + if(isValid) { + newForm.showError('keyfield', `${formParams.keyfield.trim()}${getLabel('519489','不允许作为主键')}`); + return false; + } + } + return true; + } + + onRightMenuClick = (type) => { + const {dataShowStore} = this.props; + const {newForm, source} = dataShowStore; + const {dataShowFormHiddenFields, WebserviceMethodParameterDatas, specialDatas, WeaTableEdit_MergedFieldData, esbSearchDatas, esbShowDatas} = toJS(dataShowStore.status); + const formParams = newForm.getFormParams(); + let {showname, sqltext, searchById, showclass, showtype, datafrom} = formParams; + + if (['BTN_SAVE', 'BTN_TEST'].includes(type)) { + dataShowStore.setState({type}); + if('BTN_SAVE' === type) { + dataShowStore.setState({buttonDisabled: true}); + } + + //必填的校验 ESB + if (formParams.datafrom != '4' || (formParams.datafrom == "4" && formParams.showtype == "3")) { + let hideFieldKeys = ["esbid", "esbshowid"]; + if(formParams.datafrom == '3' && formParams.showtype == '1' && formParams.unconditionalQuery != '1') { + hideFieldKeys.push('sqltext1'); + } + window.e9HideFormFieldKeys = hideFieldKeys; + } + if (formParams.datafrom == '4' && formParams.showclass == '2') { + window.e9HideFormFieldKeys = ["esbshowid"]; + } + + onCheck(newForm, () => { + // 必填的校验 + if ((!formParams.customhref) && (formParams.showtype == '3' || formParams.datafrom == '2')) { + newForm.showError('customhref', getLabel('507143', '“自定义地址”未填写')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + + if (formParams.datafrom == '3' && (formParams.showtype == '2' || (formParams.showtype == '1' && formParams.unconditionalQuery == '1'))) { + if (!formParams.sqltext1) { + newForm.showError('sqltext1', getLabel('506472', '“无条件查询”未填写')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + if ((!formParams.searchById1) && formParams.showclass != '2') { + newForm.showError('searchById1', getLabel('506473', '“回显查询”未填写')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + } + + if (formParams.datafrom == '1' && (formParams.showtype != '3')) { + if (!formParams.sqltext) { + newForm.showError('sqltext', getLabel('506474', '“查询SQL语句”未填写')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + } + + if (formParams.datafrom == '0' && (formParams.showtype != '3')) { + if (!formParams.wsurl) { + newForm.showError('wsurl', getLabel('507142', '“WebService地址”未填写')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + if (!formParams.wsoperation) { + newForm.showError('wsoperation', getLabel('507141', '“WebService方法”未填写')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + } + + // 当数据来源为数据库时,查询sql不允许以delete开头 + if(datafrom == '1') { + if(sqltext && sqltext.trim() && (!(sqltext.trim().toLowerCase()).startsWith('select'))) { + newForm.showError("sqltext", getLabel('513870','查询SQL语句需要以select开始')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + if(searchById && searchById.trim() && (!(searchById.trim().toLowerCase()).startsWith('select'))) { + newForm.showError("searchById", getLabel('513894','回显SQL语句需要以select开始')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + } + + // 数据来源datafrom为存储过程3的时候,需要检测回显查询searchById1是否含有不允许的字段 + if (formParams.datafrom == '3') { + if (formParams.searchById1) { + if ((/{?[A-Za-z0-9]}/).test(formParams.searchById1)) { + newForm.showError('searchById1', getLabel('506393', '不允许使用人员变量')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + } + } + + // 主键字段不允许设置的值 + if(!this.isValidFieldKey()) { + dataShowStore.setState({buttonDisabled: false}); + return; + } + + // 校验参数设置必填项validator + if (formParams.showtype == 1 || formParams.showclass == 2) { + let result = this.table ? this.table.doValidate() : {}; + this.setState({validatePass: result.pass}) + if (!result.pass) { + dataShowStore.setState({buttonDisabled: false}); + return; + }; + } + + // 参数设置中显示字段设置必填验证 + if (datafrom == "4" && showtype == "1") { + // ESB检测ESB查询服务中的查询参数必须存在于字段设置中 + let esbParamName = [], flag = false; + esbSearchDatas && esbSearchDatas.forEach(data => { + if (data.paramtype === "3") { + flag = true; + if (WeaTableEdit_MergedFieldData && WeaTableEdit_MergedFieldData.find(v => v.new_fieldname === data.paramname)) { + if (WeaTableEdit_MergedFieldData.find(v => v.new_fieldname === data.paramname).new_issearch == 0) { + esbParamName.push(data.paramname); + } + } else { + esbParamName.push(data.paramname); + } + } + }) + if (!flag) { + message.error(getLabel('511544', 'ESB查询服务中至少需要配置一个条件查询字段类型')); + dataShowStore.setState({buttonDisabled: false}); + return; + } else if (flag && esbParamName && esbParamName.length) { + message.error(`${getLabel('511547', '字段设置中需要设置')}【${esbParamName.join(',')}】${getLabel('511549', '查询字段')}`); + dataShowStore.setState({buttonDisabled: false}); + return; + } + } + + //显示标题字段必须要有1个验证 + if (((showclass == "1" && showtype == "1") || showclass == "2")) { + let hasTitleField = false; + if (WeaTableEdit_MergedFieldData && WeaTableEdit_MergedFieldData.length > 0) { + + for (let j = 0, len = WeaTableEdit_MergedFieldData.length; j < len; j++) { + let o = WeaTableEdit_MergedFieldData[j]; + if (o.new_istitle == "1") { + hasTitleField = true; + break; + } + } + } + if (!hasTitleField) { + message.error(getLabel(82993, '请设置标题栏字段')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + // 至少设置一个check框可选 + for (let i = 0; i < WeaTableEdit_MergedFieldData.length; i++) { + let data = WeaTableEdit_MergedFieldData[i]; + if (!(Number(data.new_istitle) || Number(data.new_islist) || Number(data.new_issearch))) { + message.error(getLabel(389329, '请至少设置查询字段或者显示字段')); + dataShowStore.setState({buttonDisabled: false}); + return; + } + } + } + + // 判断字段/XML路径重复 + let newLists = []; + for (let i = 0; i < WeaTableEdit_MergedFieldData.length; i++) { + let data = WeaTableEdit_MergedFieldData[i]; + if (data.new_islist == '1') { + if (newLists.indexOf(data.new_fieldname) != -1) { + message.error(getLabel('389333,18082', '字段/XML路径重复')); + dataShowStore.setState({buttonDisabled: false}); + return; + } else { + newLists.push(data.new_fieldname); + } + } + } + + // 测试的时候新增的一个判断 + if (type === "BTN_TEST") { + let flg = true; + let flg3 = true; + if (formParams.datafrom === '3' && formParams.showtype === '1' && formParams.searchByName && (/[#]+[_a-zA-Z0-9]+[#]/).test(formParams.searchByName)) { + let new_fieldnames = []; + let array = formParams.searchByName.match(/[#]+[_a-zA-Z0-9]+[#]/g); + + for (let i = 0; i < WeaTableEdit_MergedFieldData.length; i++) { + let data = WeaTableEdit_MergedFieldData[i]; + new_fieldnames.push(data.new_fieldname); + array.map(function (value, index) { + value = value.replace(/#/g, ""); + if (data.new_fieldname == value) { + //查询字段 + if (!Number(data.new_issearch)) { + flg3 = false; + } + } + }); + } + //条件查询参数必须在字段设置中字段/XML路径存在 + array.map(function (value, index) { + value = value.replace(/#/g, ""); + if (new_fieldnames.toString().indexOf(value) <= -1) { + flg = false; + } + }); + } + + if (!flg) { + message.error(getLabel('510639', '条件查询参数必须在字段设置中字段/XML路径存在')); + return; + } + if (!flg3) { + message.error(getLabel('510639', '条件查询参数需要在字段设置中的查询字段存在')); + return; + } + } + + // 保存的真正逻辑 标识唯一性检查 + let id = dataShowFormHiddenFields.id || ""; + + checkUnique({ + tableName: 'datashowset', + fieldName: 'showname', + fieldValue: showname.replace(/^(\s*)|(\s*)$/g, ''), + }, newForm, 'showname', '2', id, () => { + let params = Object.assign({}, dataShowFormHiddenFields, { + ...formParams, + sqltext: Base64.encode(sqltext || ""), + searchById: Base64.encode(searchById || ""), + isPhyPage: formParams.isPhyPage != "1" ? "2" : "1", + operator: "save" + }); + if (source && id == "") { + params.typename = source; + } + let datas = WeaTableEdit_MergedFieldData && WeaTableEdit_MergedFieldData.map(data => { + let transSQL = data.new_transql ? data.new_transql : ''; + return Object.assign({}, data, {new_transql: Base64.encode(transSQL)}); + }) + + let searchDatas = esbSearchDatas.concat(specialDatas).map(v => { + if (["pageNo", "startNo", "endNo", "pagesize"].includes(v.paramname.trim())) { + return Object.assign({}, v, {paramtype: "5"}); + } else if(["eventType"].includes(v.paramname.trim())) { + return Object.assign({}, v, {paramtype: "6"}); + } else return v; + }) + + dataShowStore.getDataShowOperation({ + ...params, + type, + dtinfo_MergedFieldData: JSON.stringify(datas), + dtinfo_WebserviceMethodParameterDatas: JSON.stringify(WebserviceMethodParameterDatas), + dtinfo_EsbsearchParameterDatas: JSON.stringify(searchDatas), // esb相关的数据 + dtinfo_EsbshowParameterDatas: JSON.stringify(esbShowDatas), // esb相关的数据 + }); + }, {}, () => { + dataShowStore.setState({buttonDisabled: false}); + }) + }, () => { + dataShowStore.setState({buttonDisabled: false}); + }); + } else if (type == "BTN_GET_SEARCHPAGE") { + this.viewSearchUrl(); + } + }; + + viewSearchUrl = () => { + const {dataShowStore} = this.props; + const {newForm, status} = dataShowStore; + const {dataShowFormHiddenFields} = toJS(status); + + if (newForm.getFormParams().showclass == "2") { + confirm({ + content: (window.ecologyContentPath || "") + "/spa/inte/static/index.html#/main/inte/tab/" + dataShowFormHiddenFields.id, + okText: getLabel("77", "复制"), + cancelText: getLabel(31129, "取消"), + onOk: () => { + if (copy(`${window.ecologyContentPath || ""}/spa/inte/static/index.html#/main/inte/tab/${dataShowFormHiddenFields.id}`)) { + message.success(getLabel('126081', '地址已经复制成功,您可以使用Ctrl+v粘贴')); + } + }, + onCancle: () => { + }, + }) + } else { + message.info(getLabel(32324, '当前展现集成不是查询页面,请重新操作')); + } + } + + willEdit = (datas = [], editData) => { + const {dataShowStore} = this.props; + const formParams = dataShowStore.newForm.getFormParams(); + const {record, key, index, value} = editData; + + if("new_islist" === key) { + if(record.new_fieldname && formParams.keyfield && record.new_fieldname.trim() && formParams.keyfield.trim() && record.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase()) { + datas[index] = { + ...datas[index], + new_desensitization: record.new_desensitization ? '0' : '', + new_secondAuth: record.new_secondAuth ? '0' : '', + } + } else { + if(value == '0') { + datas[index] = { + ...datas[index], + new_istitle: '0', + } + + if(record.new_issearch == '1') { + datas[index] = { + ...datas[index], + new_desensitization: record.new_desensitization ? '0' : '', + new_secondAuth: record.new_secondAuth ? '0' : '', + } + } + } + } + } else if("new_issearch" === key) { + if(record.new_fieldname && formParams.keyfield && record.new_fieldname.trim() && formParams.keyfield.trim() && record.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase()) { + datas[index] = { + ...datas[index], + new_desensitization: record.new_desensitization ? '0' : '', + new_secondAuth: record.new_secondAuth ? '0' : '', + } + } else { + if(value == '0') { + datas[index] = { + ...datas[index], + new_isshow: '0', + new_istitle: '0', + } + } else if(value == '1' && record.new_islist != '1') { + datas[index] = { + ...datas[index], + new_desensitization: record.new_desensitization ? '0' : '', + new_secondAuth: record.new_secondAuth ? '0' : '', + } + } + } + } else if("new_istitle" === key) { + if (value == '1') { + let preIndex = datas.find(data => data.new_istitle == '1' && data.id != record.id); + if (preIndex) { + preIndex.new_istitle = '0'; + } + datas.forEach((data, index) => { + if (data.id === record.id) { + datas[index] = { + ...datas[index], + new_istitle: '1', + new_issearch: '1', + new_islist: '1', + new_desensitization: record.new_desensitization ? '0' : '', + new_secondAuth: record.new_secondAuth ? '0' : '', + } + } + }) + } else { + if(record.new_fieldname && formParams.keyfield && record.new_fieldname.trim() && formParams.keyfield.trim() && record.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase()) { + datas[index] = { + ...datas[index], + new_desensitization: record.new_desensitization ? '0' : '', + new_secondAuth: record.new_secondAuth ? '0' : '', + } + } + } + } else if("new_desensitization" === key) { + // 没有选择脱敏显示的情况下,【二次身份校验】为禁用 + if(value != '1') { + datas[index] = { + ...datas[index], + new_secondAuth: record.new_secondAuth ? '0' : '', + } + } + } else if("new_fieldname" === key) { + // 主键字段不可以进行脱敏显示设置 + if(value && formParams.keyfield && value.trim() && formParams.keyfield.trim() && value.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase()) { + datas[index] = { + ...datas[index], + new_desensitization: record.new_desensitization ? '0' : '', + new_secondAuth: record.new_secondAuth ? '0' : '', + } + } + } + dataShowStore.setState({WeaTableEdit_MergedFieldData: datas}); + }; + + willDelete = (datas, key) => new Promise((resolve, reject) => { + confirm({ + content: getLabel(385625, '确定要删除选择的记录吗?'), + onOk: () => resolve(true), + onCancle: () => resolve(false), + }) + }); + + willEditESB = (allDatas, editDatas, key) => { + const {dataShowStore} = this.props; + const {WeaTableEdit_MergedFieldData} = toJS(dataShowStore.status); + const {key: editKey, value, record} = editDatas; + let mergedDatas = [...WeaTableEdit_MergedFieldData]; + if (editKey == "paramtype") { + allDatas && allDatas.forEach((v, index) => { + if (v.paramname === record.paramname) { + allDatas[index] = { + ...allDatas[index], + paramvalue: "" + } + } + }) + if (value === '3' && record.paramtype != '3' && key === "esbid") { + let index = mergedDatas.findIndex(v => v.new_fieldname === record.paramname && v.new_issearch == '1'); + if (index === -1) { + mergedDatas.push({ + id: uuid(), + new_fieldname: record.paramname, + new_issearch: '1', + new_fieldtype: '2' + }) + } + } + if (value != '3' && record.paramtype == '3' && key === "esbid") { + let index = mergedDatas.findIndex(v => v.new_fieldname === record.paramname && v.new_issearch == '1'); + if (index != -1) { + mergedDatas.splice(index, 1); + } + } + // 只能有一个主键 + if (key === "esbshowid") { + if (value === '3') { + allDatas && allDatas.forEach((v, index) => { + if ((v.paramname != record.paramname) && v.paramtype === '3') { + allDatas[index] = { + ...allDatas[index], + paramtype: '' + } + } + }) + dataShowStore.newForm.updateFields({keyfield: record.paramname}); + } else { + let keyField = allDatas && allDatas.find(v => v.paramtype === "3"); + if (keyField) { + dataShowStore.newForm.updateFields({keyfield: keyField.paramname}); + } else { + dataShowStore.newForm.updateFields({keyfield: ""}); + } + } + } + } + dataShowStore.setState({[key === "esbid" ? "esbSearchDatas" : "esbShowDatas"]: allDatas}); + if (key === "esbid") { + dataShowStore.setState({WeaTableEdit_MergedFieldData: mergedDatas}); + } + }; + + getESBColumns = (columns, key) => { + const {newForm} = this.props.dataShowStore; + const formParams = newForm.getFormParams(); + columns && columns.forEach(v => { + if (v.dataIndex === "paramtype" && key === "esbid") { + let options = [...v.com[0].options]; + if (formParams.showclass === "2") { + let index = options.findIndex(option => option.key === "2"); + options.splice(index, 1); + } + if (formParams.isSupportPaging == 0) { + let index = options.findIndex(option => option.key === "5"); + options.splice(index, 1); + } + v.com[0] = { + type: "custom", + key: v.key, + render: (text, record, index, onEdit) => { + if (["pageNo", "startNo", "endNo", "pagesize", "eventType"].includes(record.paramname)) { + return + } else { + let option = options.slice(0); + // 去除分页参数 + let index1 = option.findIndex(v => v.key === "5"); + if (index1 != -1) { + option.splice(index1, 1); + } + // 去除接口类型 + let idx = option.findIndex(v => v.key === "6"); + if (idx != -1) { + option.splice(idx, 1); + } + return onEdit({ + type: "CUSTOM", + record, + index, + key: v.dataIndex, + value, + })} + /> + } + } + } + } else if (v.dataIndex === "paramvalue") { + v.com[0] = { + type: "custom", + key: v.key, + render: (text, record, index, onEdit) => { + if ((["3", "5"].includes(record.paramtype) && key === "esbid") || (record.paramtype == 3 && key === "esbshowid")) { + return + } else if ((["2", "1", "4"].includes(record.paramtype) && key === "esbid") || (["2", "1"].includes(record.paramtype) && key === "esbshowid")) { + let paramvalue = ""; + try { + paramvalue = record.paramvalue ? JSON.parse(record.paramvalue) : ""; + } catch (err) { + paramvalue = ""; + } + return onEdit({ + type: "CUSTOM", + record, + index, + key: v.dataIndex, + value + })} + /> + } + } + } + } + }) + }; + + getMergedCells = (datas = []) => { + const {newForm} = this.props.dataShowStore; + const { + esbIsTitleOpen, + esbIsShowTitleOpen, + esbIsSearchOpen, + esbInitCells, + initCells, + isShowTitleOpen, + isSearchOpen, + showClass_is_2_newWorkFlowFieldName, + new_desensitization_is_1_cells, + allow_desensitization_cells, + } = this.state; + const formParams = newForm.getFormParams(); + let cells = []; + + if (formParams.datafrom == "4" && formParams.showtype != "3") { + datas && datas.forEach(data => { + let itemCells = {}; + + // 优化之前的写法: 相关任务QC699869 + if(formParams.showclass === "2") { + + itemCells = { + ...itemCells, + new_wokflowfieldname: showClass_is_2_newWorkFlowFieldName, + } + } + + // // 主键字段, 标题栏字段不可以进行脱敏显示设置 + // if((data.new_fieldname && formParams.keyfield && data.new_fieldname.trim() && formParams.keyfield.trim() && data.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase()) || data.new_istitle == '1') { + + // itemCells = { + // ...itemCells, + // ...new_istitle_or_primaryKey_is_1_cells, + // } + // } + + // new_desensitization_is_1,进行二次验证的设置 + if(data.new_desensitization == '1') { + + itemCells = { + ...itemCells, + ...new_desensitization_is_1_cells, + } + } + + if (data.new_istitle == '1' || (data.new_issearch == '1' && data.new_islist == '1')) { + itemCells = { + ...esbIsTitleOpen, + ...itemCells, + } + if(data.new_istitle != '1' && data.new_issearch == '1' && data.new_islist == '1') { + if(!(data.new_fieldname && formParams.keyfield && data.new_fieldname.trim() && formParams.keyfield.trim() && data.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase())) { + itemCells = { + ...itemCells, + ...allow_desensitization_cells, + } + } + } + } else { + if (data.new_issearch == '1') { + itemCells = { + ...esbIsSearchOpen, + ...itemCells, + } + } else if (data.new_islist == '1') { + itemCells = { + ...esbIsShowTitleOpen, + ...itemCells, + }; + if(!(data.new_fieldname && formParams.keyfield && data.new_fieldname.trim() && formParams.keyfield.trim() && data.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase())) { + itemCells = { + ...itemCells, + ...allow_desensitization_cells, + } + } + } else { + itemCells = { + ...esbInitCells, + ...itemCells, + }; + } + } + + if(Object.keys(itemCells) && Object.keys(itemCells).length) { + cells.push({ + id: data.id, + ...itemCells + }); + } + }) + } else { + datas && datas.forEach(data => { + let itemCells = {}; + + // 优化之前的写法: 相关任务QC699869 + if(formParams.showclass === "2") { + + itemCells = { + ...itemCells, + new_wokflowfieldname: showClass_is_2_newWorkFlowFieldName, + } + } + + // // 主键字段, 标题栏字段不可以进行脱敏显示设置 + // if((data.new_fieldname && formParams.keyfield && data.new_fieldname.trim() && formParams.keyfield.trim() && data.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase()) || data.new_istitle == '1') { + + // itemCells = { + // ...itemCells, + // ...new_istitle_or_primaryKey_is_1_cells, + // } + // } + + // new_desensitization_is_1,进行二次验证的设置 + if(data.new_desensitization == '1') { + + itemCells = { + ...itemCells, + ...new_desensitization_is_1_cells, + } + } + if (data.new_istitle == '1' || (data.new_islist == '1' && data.new_issearch == '1')) { + if(data.new_istitle != '1' && data.new_islist == '1' && data.new_issearch == '1') { + if(!(data.new_fieldname && formParams.keyfield && data.new_fieldname.trim() && formParams.keyfield.trim() && data.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase())) { + itemCells = { + ...itemCells, + ...allow_desensitization_cells, + } + } + } + } else { + if (data.new_issearch == '1') { + itemCells = { + ...isSearchOpen, + ...itemCells, + } + } else if (data.new_islist == '1') { + itemCells = { + ...isShowTitleOpen, + ...itemCells, + } + if(!(data.new_fieldname && formParams.keyfield && data.new_fieldname.trim() && formParams.keyfield.trim() && data.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase())) { + itemCells = { + ...itemCells, + ...allow_desensitization_cells, + } + } + } else { + itemCells = { + ...initCells, + ...itemCells, + } + } + } + + if(Object.keys(itemCells) && Object.keys(itemCells).length) { + cells.push({ + id: data.id, + ...itemCells + }); + } + }) + } + + return cells; + }; + + getESBSearchDatas = (flag) => { + const {dataShowStore} = this.props; + const {specialDatas, esbSearchDatas} = toJS(dataShowStore.status); + let datas = [], special = []; + if (flag == 0) { + esbSearchDatas && esbSearchDatas.forEach(v => { + if (!["pageNo", "startNo", "endNo", "pagesize"].includes(v.paramname.trim())) { + datas.push(v); + } else { + special.push(v); + } + }) + } else { + datas = esbSearchDatas.concat(specialDatas); + special = []; + } + dataShowStore.setState({esbSearchDatas: datas, specialDatas: special}); + } + + getMergedDatas = () => { + const {dataShowStore} = this.props; + const {esbSearchDatas, WeaTableEdit_MergedFieldData} = toJS(dataShowStore.status); + let mergedDatas = [...(WeaTableEdit_MergedFieldData || [])]; + + esbSearchDatas && esbSearchDatas.map(record => { + if(record.paramtype == '3') { + let index = mergedDatas && mergedDatas.findIndex(v => v.new_fieldname === record.paramname && v.new_issearch == '1'); + if(index == -1) { + mergedDatas.push({ + id: uuid(), + new_fieldname: record.paramname, + new_issearch: '1', + new_fieldtype: '2' + }) + } + } + }) + dataShowStore.setState({WeaTableEdit_MergedFieldData: mergedDatas}); + } + + getKeyField = () => { + const {dataShowStore} = this.props; + const {esbShowDatas} = toJS(dataShowStore.status); + let keyfield = ""; + + if (esbShowDatas && esbShowDatas.length) { + let keyField = esbShowDatas.find(v => v.paramtype === "3"); + if (keyField) { + keyfield = keyField.paramname; + } + } + return keyfield; + } + + onChangeFields = (key, otherParams) => { + const {dataShowStore} = this.props; + const {newForm, status} = dataShowStore; + const datas = status.WeaTableEdit_MergedFieldData; + const formParams = newForm.getFormParams(); + let keyfield = this.getKeyField(); + + if (key === 'wsurl') { + dataShowStore.getDataShowOperation({wsid: formParams.wsurl, operator: 'getregisteinfo'}, () => { + newForm.updateFields({wsoperation: ""}); + }); + } else if (key === 'wsoperation') { + dataShowStore.getDataShowOperation({methodid: formParams.wsoperation, operator: 'getmethodinfo'}); + } else if (key === "esbid") { + if (formParams.esbid != otherParams.esbid) { + dataShowStore.setState({WeaTableEdit_MergedFieldData: []}); + if (formParams.esbid) { + dataShowStore.getDataShowOperation({esbid: formParams.esbid, operator: "getSearchEsbinfo"}); + } else { + dataShowStore.setState({esbSearchDatas: []}); + } + } + } else if (key === "esbshowid") { + if (formParams.esbshowid != otherParams.esbshowid) { + newForm.updateFields({keyfield: ""}); + if (formParams.esbshowid) { + dataShowStore.getDataShowOperation({esbid: formParams.esbshowid, operator: "getEsbinfo"}); + } else { + dataShowStore.setState({esbShowDatas: []}); + } + } + } else if (key === "isSupportPaging") { + this.getESBSearchDatas(formParams.isSupportPaging); + } else if (key === 'showclass') { + if (formParams.datafrom == '4' && formParams.showtype != '3' && formParams.showclass == '1') { + newForm.updateFields({keyfield}); + } + if (formParams.showclass == '2') { + newForm.updateFields({showtype: "1"}); + if (formParams.datafrom == '4') { + this.getMergedDatas(); + } + } + dataShowStore.getOpenPyhStatus(); + } else if (key === 'showname' && formParams.showname != "") { + let checkParams = { + tableName: 'datashowset', + fieldName: 'showname', + fieldValue: formParams.showname.replace(/^(\s*)|(\s*)$/g, ''), + }; + checkTableFieldValueUnique(checkParams).then(result => { + if (result && result.isNotUnique) { + newForm.showError('showname', getLabel('387654', '标识已存在')); + } + }); + } else if (key === 'datafrom') { + newForm.updateFields({ + sqltext: '', + searchById: '', + sqltext1: '', + searchByName: '', + searchById1: '', + wsurl: '', + wsoperation: '', + wsworkname: '', + customhref: '' + }); + if (formParams.datafrom == '4' && formParams.showtype != '3' && formParams.showclass == '1') { + newForm.updateFields({keyfield}); + } + if (formParams.datafrom == "4" && formParams.showtype == '1') { + this.getMergedDatas(); + } else { + dataShowStore.setState({WeaTableEdit_MergedFieldData: []}) + } + dataShowStore.getOpenPyhStatus(); + } else if (key === "showtype") { + if (formParams.showtype == '2' && formParams.datafrom == '4') { + newForm.updateFields({isSupportPaging: 0}); + this.getESBSearchDatas(0); + } + if (formParams.datafrom == '4' && formParams.showtype != '3' && formParams.showclass == '1') { + newForm.updateFields({keyfield}); + } + if (formParams.showtype == '1' && formParams.datafrom == '4') { + this.getMergedDatas(); + } else { + dataShowStore.setState({WeaTableEdit_MergedFieldData: []}); + } + dataShowStore.getOpenPyhStatus(); + } else if ("datasourceid" === key) { + dataShowStore.getOpenPyhStatus(); + } + } + + // 对主键失去焦点后的信息判断 + checkKeyField = () => { + const {dataShowStore} = this.props; + const {newForm, status} = dataShowStore; + const datas = status.WeaTableEdit_MergedFieldData; + const formParams = newForm.getFormParams(); + + if(this.isValidFieldKey()) { + // 如果字段设置中设置了主键,则不可进行显示设置 + let checkTrue = false; + + datas && datas.forEach((data, index) => { + if(data.new_fieldname && formParams.keyfield && data.new_fieldname.trim() && formParams.keyfield.trim() && data.new_fieldname.trim().toLowerCase() === formParams.keyfield.trim().toLowerCase()) { + checkTrue = true; + datas[index] = { + ...datas[index], + new_desensitization: data.new_desensitization ? '0' : '', + new_secondAuth: data.new_secondAuth ? '0' : '' + } + } + }) + + if(checkTrue) { + dataShowStore.setState({WeaTableEdit_MergedFieldData: datas}); + } + } + } + + getHideFields = (key, allParams) => { + const {showOpenPyh} = this.props.dataShowStore.status; + let bool = false; + + key === 'showtype' && allParams.showclass == '2' && (bool = true); + key === 'datafrom' && (allParams.showtype == '3' && allParams.showclass == '1') && (bool = true); + key === 'datasourceid' && (!['1', '3'].includes(allParams.datafrom) || allParams.showtype == '3') && (bool = true); + key === 'sqltext' && (allParams.showtype == '3' || allParams.datafrom != '1') && (bool = true); + key === 'searchById' && (allParams.showtype == '3' || allParams.datafrom != '1' || allParams.showclass == '2') && (bool = true); + key === 'keyfield' && allParams.showtype == '3' && (bool = true); + key === 'wsurl' && (allParams.datafrom != '0' || allParams.showtype == '3') && (bool = true); + key === 'wsoperation' && (allParams.datafrom != '0' || allParams.showtype == '3') && (bool = true); + key === 'wsworkname' && (allParams.datafrom != '0' || allParams.showtype == '3') && (bool = true); + key === 'parentfield' && (allParams.showtype != '2' || allParams.showclass == "2") && (bool = true); + key === 'showfield' && (allParams.showtype != '2' || allParams.showclass == "2") && (bool = true); + key === 'onlylowestnode' && (allParams.showtype != '2' || allParams.showclass == "2" || (allParams.showtype == '2' && ['3', '4'].includes(allParams.datafrom))) && (bool = true); + key === 'customhref' && (allParams.showtype != '3' && allParams.datafrom != '2') && (bool = true); + key === 'sqltext1' && (allParams.datafrom != '3' || allParams.showtype == '3' || (allParams.datafrom == '3' && allParams.showtype == '1' && allParams.unconditionalQuery != '1')) && (bool = true); + key === 'searchByName' && (allParams.datafrom != '3' || allParams.showtype == '3') && (bool = true); + key === 'searchById1' && (allParams.datafrom != '3' || allParams.showtype == '3') && (bool = true); + key === 'characterset' && (allParams.datafrom != '2') && (bool = true); + key === 'showpageurl' && (allParams.showclass != '1' || allParams.showtype != '1' || allParams.datafrom != '1') && (bool = true); + key === 'searchById1' && (allParams.showclass == '2' && allParams.datafrom == '3') && (bool = true); + key === 'unconditionalQuery' && (allParams.showtype == '2') && (bool = true); + ["isSupportPaging", "esbid", "esbshowid"].includes(key) && (allParams.datafrom != '4' || allParams.showtype == '3') && (bool = true); + ["esbshowid"].includes(key) && (allParams.showclass === "2") && (bool = true); + ["isSupportPaging"].includes(key) && (allParams.showtype === "2" && allParams.datafrom == '4') && (bool = true); + "isPhyPage" === key && (!showOpenPyh) && (bool = true); + + return bool; + } + + getHelpfulTip = (key) => { + if (key === 'isSupportPaging') { + return +

{getLabel('511394', '需要第三方接口支持分页查询,目前分页方式有三种')}:

+

1.{getLabel('511390', '行号方式,最小行号~最大行号;例如 1~20')};

+

2.{getLabel('511391', '页码+数量,例如 第3页,每页数量20')};

+

3.{getLabel('511392', '行号+数量,例如从第20行起获取20条数据')}。

+
+ }/> + } else if (key === 'sqltext') { + return + } else if (key === 'searchById') { + return + } else if (key === 'detailpageurl') { + return + } else if (key === 'customhref') { + return + } else if (key === 'searchById1') { + return + } else if (key === 'searchByName') { + return + } else if (key === 'showpageurl') { + return
+ + {getLabel(506848, '示例下载链接')}: + demo.zip + +
+ } else if(key === "keyfield") { + let title = ""; + if(this.state.regExpValue) { + title = `${this.state.regExpValue}`.replace(/(\/|\^|\(|\)|\$)/g, ''); + title = title.slice(0, title.length-2).split('|').join('、'); + } + return ; + } else { + return null; + } + } + + getParamRowSelection = (rowSelection) => { + const {dataShowStore} = this.props; + const {esbSearchDatas} = toJS(dataShowStore.status); + const sel = {...rowSelection}; + let searchKeys = []; + const formParams = dataShowStore.newForm.getFormParams(); + esbSearchDatas && esbSearchDatas.forEach(data => { + if (data.paramtype == '3') { + searchKeys.push(data.paramname); + } + }) + sel.getCheckboxProps = record => { + if (formParams.datafrom == '4' && formParams.showtype == '1' && searchKeys.includes(record.new_fieldname) && record.new_issearch == 1) { + return {disabled: true}; + } else { + return {disabled: false}; + } + }; + return sel; + } + + getRowSelection = v => false; + + getTableProps = () => { + return {showEmptyText: false, scroll: {x: "auto"}}; + } + + getWsDataChange = (datas) => this.props.dataShowStore.setState({WebserviceMethodParameterDatas: datas}); + + getValidator = () => { + return { + rules: { + new_fieldname: 'required|specialStr', + new_showname: 'required', + new_width: 'minNumber', + new_transql: "sqlValid" + }, + customRegister: [ + { + name: 'minNumber', + rules: (value, requirement, attribute) => { + return /^[0-9]*[1-9][0-9]*$/.test(value); + }, + errorMessage: getLabel('504118', '最小值为1'), + }, + { + name: "specialStr", + rules: (value, record, attr) => { + return (!(/^id$/.test(value) || /^href$/.test(value) || /^desc$/.test(value))) + }, + errorMessage: getLabel('507113', '不能配置此字段') + }, + { + name: "sqlValid", + rules: (value, record, attr) => { + return value.trim().startsWith('select') + }, + errorMessage: getLabel('513895','SQL语句需要以select开始') + } + ] + }; + } + + handleChangeKeyField = v => { + this.props.dataShowStore.newForm.updateFields({keyfield: v}); + this.isValidFieldKey(); + } + + getSearchs = () => { + const { + dataShowStore + } = this.props, { + newForm, + status, + } = dataShowStore, { + dataShowFormFields, + WeaTableEdit_WebserviceParameterSet, + WebserviceMethodParameterDatas, + WeaTableEdit_ESBShowParameterSet, + WeaTableEdit_ESBSearchParameterSet, + WeaTableEdit_MergedSearchFieldAndListField, + WeaTableEdit_MergedFieldData, + formLoading, + esbShowDatas, + esbSearchDatas, + } = toJS(status), { + isFormInit, + } = newForm; + const formParams = newForm.getFormParams(); + let group = []; + + formLoading && isFormInit && dataShowFormFields && dataShowFormFields.forEach((c, i) => { + let items = []; + c && c.items && c.items.forEach(fields => { + let key = fields.domkey[0]; + const dom = this.getHelpfulTip(key); + items.push({ + com: ( + + + { + key === "keyfield" + ? formParams.datafrom == '4' && formParams.showtype != '3' && formParams.showclass == '1' + ? + : newForm.updateFields({keyfield: value})} onBlur={this.checkKeyField}/> + : this.onChangeFields(key, formParams)}/> + } + {dom} + + ), + colSpan: 1, + hide: newForm.isHide(fields, (keys, allParams) => { + return this.getHideFields(fields.domkey[0], allParams); + }) + }); + if (getKey(fields) === "wsworkname" && formParams.wsoperation != "" && formParams.datafrom == "0" && formParams.showtype != '3') { + items.push({ + com: ( + + ), + hide: newForm.isHide(fields, (keys, allParams) => { + return (allParams.datafrom != '0' || WebserviceMethodParameterDatas.length == 0); + }) + }); + } else if (((getKey(fields) === "esbid" && formParams.esbid) || (getKey(fields) === "esbshowid" && formParams.esbshowid && formParams.showclass != "2")) && formParams.datafrom == "4" && formParams.showtype != '3') { + this.getESBColumns(key === "esbid" ? WeaTableEdit_ESBSearchParameterSet : WeaTableEdit_ESBShowParameterSet, key); + items.push({ + com: ( + this.willEditESB(allDatas, editDatas, key)} + onChange={(datas) => dataShowStore.setState({[key === "esbid" ? "esbSearchDatas" : "esbShowDatas"]: datas})} + /> + ), + hide: newForm.isHide(fields, (keys, allParams) => { + return (allParams.datafrom != '4' || (esbSearchDatas.length == 0 && key === "esbid") || (key === "esbshowid" && esbShowDatas.length == 0)); + }) + }); + } + }); + if (i == 1 && (formParams.showtype == 1 || formParams.showclass == 2)) { + group.push(
+ +
) + } + if (i == 0) { + group.push(); + } + }); + return group; + } + + getRef = el => this.table = el; + + getColumnsTips = (WeaTableEdit_MergedSearchFieldAndListField=[]) => { + return WeaTableEdit_MergedSearchFieldAndListField && WeaTableEdit_MergedSearchFieldAndListField.map(c => { + let title = ''; + if (["new_fieldname", "new_transql", "new_width"].includes(c.dataIndex)) { + if (c.dataIndex === "new_fieldname") { + title = getLabel('508146', '不能设置以下三个字段:id,desc,href'); + } else if (c.dataIndex === "new_transql") { + title = getLabel(131015, "参数可设置如下内容,格式为:select 最终字段 from tablename where 条件字段={?currentvalue},{?currentvalue}表示当前值"); + } else if (c.dataIndex === "new_width") { + title =

{getLabel('504070', '1.只能输入正整数。')}

+

{getLabel('504032', '2.输入列宽,按照输入的值显示。不输入时,会自动均分。')}

; + } + c.title =
{c.title}
; + } + return c; + }) + } + + onTableEditDataChange = datas => this.props.dataShowStore.setState({WeaTableEdit_MergedFieldData: datas}) + + onCancel = () => { + const { + dataShowStore, + } = this.props; + + dataShowStore.initSqlTestForm(); + dataShowStore.setState({showNewFormDialog: false}); + dataShowStore.newForm.reset(); + } + + getTitle = () => { + const { + dataShowFormHiddenFields, + } = toJS(this.props.dataShowStore.status); + + return ((dataShowFormHiddenFields && dataShowFormHiddenFields.id) > 0 ? getLabel('26473', '编辑') : getLabel('365', '新建')) + `${getLabel('32303', '数据展现集成')}`; + } + + getMoreBtn = () => { + return { + datas: this.getRightMenu(), + collectParams: [] + } + } + + render() { + const { + dataShowStore, + } = this.props, { + showNewFormDialog, + showPreviewDialog, + showsSqlTextFormDialog2, + showIndexTestDialog2, + } = toJS(dataShowStore.status); + + return ( +
+ + + {this.getSearchs()} + + + + + +
+ ) + } +} diff --git a/pc4backstage/integration/components/datashow/PreviewDialog.js b/pc4backstage/integration/components/datashow/PreviewDialog.js new file mode 100644 index 0000000..7cec982 --- /dev/null +++ b/pc4backstage/integration/components/datashow/PreviewDialog.js @@ -0,0 +1,77 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { Button} from "antd"; +import { toJS } from "mobx"; +import { + WeaRightMenu, + WeaDialog, + WeaLocaleProvider, +} from "ecCom"; + +import './style/index.css'; +import TestForm from "./TestForm"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject("dataShowStore") +@observer +export default class PreviewDialog extends React.Component { + + getLastStep = () =>{ + const {dataShowStore} = this.props; + dataShowStore.initTestFrom(); + dataShowStore.testForm.reset(); + dataShowStore.setState({showsSqlTextFormDialog: true}); + }; + + getRightMenu = () => { + return []; + }; + + + closeDialog = ()=> { + const { + dataShowStore, + } = this.props; + + dataShowStore.initTestFrom(); + dataShowStore.testForm.reset(); + dataShowStore.initSqlTestForm(); + } + + render() { + const {dataShowStore, showDialog} = this.props; + const {status} = dataShowStore; + const {dataShowFormHiddenFields,showIframe,showTextFormButton} = toJS(status); + let show = showIframe?`block`:`none`; + let url = showIframe && dataShowFormHiddenFields ? `${window.ecologyContentPath || ""}/spa/inte/static/index.html#/main/inte/tab/${dataShowFormHiddenFields.id}?from=1` : ``; + + let buttons = showTextFormButton + ? [] + : []; + return ( + + + + +
+ +
+
+
+ ) + } + +} \ No newline at end of file diff --git a/pc4backstage/integration/components/datashow/SqlTestDialog.js b/pc4backstage/integration/components/datashow/SqlTestDialog.js new file mode 100644 index 0000000..9102ad9 --- /dev/null +++ b/pc4backstage/integration/components/datashow/SqlTestDialog.js @@ -0,0 +1,144 @@ +import React from "react"; +import {inject, observer} from "mobx-react"; +import {toJS} from "mobx"; +import * as API from "../../apis/DataShowService"; +import { + WeaTools, + WeaRightMenu, + WeaDialog, + WeaLocaleProvider, +} from "ecCom"; +import {Button} from "antd"; +import SqlTextForm from "./SqlTextForm"; + +const getLabel = WeaLocaleProvider.getLabel; +let Base64 = WeaTools.Base64; +const store = ["dataShowStore"]; + +@inject(...store) +@observer +export default class SqlTestDialog extends React.Component { + + constructor(props) { + super(props); + } + + getRightMenu =() =>{ + + let btn = []; + return btn; + }; + + //检查返回值 + checkValuePROC = (type) => { + const {dataShowStore} = this.props; + const {sqlTextForm, newForm,source} = dataShowStore; + const {form} = sqlTextForm; + const {dataShowFormHiddenFields, WebserviceMethodParameterDatas, WeaTableEdit_MergedFieldData} = toJS(dataShowStore.status); + + let id = dataShowFormHiddenFields.id || ""; + + form.validateForm().then(f => { + if (f.isValid) { + //合并hiddenfield参数 + let sqltextValue = newForm.getFormParams().sqltext ? newForm.getFormParams().sqltext : ''; + let sqltext = Base64.encode(sqltextValue); + let searchByIdValue = newForm.getFormParams().searchById ? newForm.getFormParams().searchById : ''; + let searchById = Base64.encode(searchByIdValue); + let formParams = Object.assign({}, newForm.getFormParams(), { + sqltext: sqltext, + searchById: searchById + }); + let params = Object.assign(dataShowFormHiddenFields, formParams); + params.operator = "save"; + if (source) { + params.typename = source; + } + + let datas = WeaTableEdit_MergedFieldData && WeaTableEdit_MergedFieldData.map(data => { + let transSQL = data.new_transql ? data.new_transql : ''; + return Object.assign({}, data, {new_transql: Base64.encode(transSQL)}); + }); + params.dtinfo_MergedFieldData = JSON.stringify(datas); + params.dtinfo_WebserviceMethodParameterDatas = JSON.stringify(WebserviceMethodParameterDatas); + + //dataShowStore.setState({showsSqlTextFormDialog: false}); + dataShowStore.setState({showTextFormButton: true}); + let checkParams = { + showname: formParams.showname, + sqlTextForm: JSON.stringify(form.getFormParams()), + }; + API.saveFormParam(checkParams).then(result => { + if (result.status === '1') { + //关闭sql表单,不是重置 + //dataShowStore.initSqlTestForm(); + dataShowStore.setState({ + showsSqlTextFormDialog: false, + showsSqlTextFormDialog2:false, + }); + + API.getIndexTest(id).then(result=>{ + if (result.ext === 'true') { + if (result.status) { + //获取测试的form数据 + dataShowStore.getDataShowTestForm(newForm.getFormParams(),dataShowFormHiddenFields, WebserviceMethodParameterDatas,type); + } else { + dataShowStore.setState({ + testInitDatas: result.data.base, + }); + console.log("type================" + type); + if (type == 'INDEX_TEST') { + dataShowStore.setState({ + showIndexTestDialog: true, + }); + } + if (type == 'BTN_TEST') { + dataShowStore.setState({ + showIndexTestDialog2: true, + }); + } + } + } else { + //异常处理 + + } + }); + } + }); + + } else { + f.showErrors(); + this.setState({date: new Date()}); + } + }); + }; + + render() { + const {dataShowStore,showSqlDialog} = this.props; + const{type} = dataShowStore.status; + let buttons = [ + , + ]; + + return ( + + + + + + + ) + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/datashow/SqlTextForm.js b/pc4backstage/integration/components/datashow/SqlTextForm.js new file mode 100644 index 0000000..191afb4 --- /dev/null +++ b/pc4backstage/integration/components/datashow/SqlTextForm.js @@ -0,0 +1,57 @@ +import React from "react"; +import {inject, observer} from "mobx-react"; +import {WeaSwitch} from "comsMobx"; +import {toJS} from "mobx"; +import { + WeaSearchGroup, + WeaFormItem, +} from "ecCom"; + +const store = ["dataShowStore"]; + +@inject(...store) +@observer +export default class SqlTextForm extends React.Component { + + constructor(props) { + super(props); + } + + getItem = () => { + const {dataShowStore} = this.props; + const {sqlTextForm, status} = dataShowStore; + const {} = toJS(status); + const {form, condition} = sqlTextForm; + const {isFormInit} = form; + + let arr = []; + isFormInit && condition && condition.map((c, index) => { + let items = []; + c.items.map((field) => { + items.push({ + com: ( + + + ), + colSpan: 1 + }) + }); + arr.push(); + }); + return
{arr}
+ }; + + render() { + return (
+ {this.getItem()} +
) + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/datashow/TestForm.js b/pc4backstage/integration/components/datashow/TestForm.js new file mode 100644 index 0000000..43d3e18 --- /dev/null +++ b/pc4backstage/integration/components/datashow/TestForm.js @@ -0,0 +1,69 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { WeaSwitch } from "comsMobx"; +import { + WeaFormItem, + WeaTools, +} from "ecCom"; +import './style/index.css'; + +const { getKey } = WeaTools; +const store = ["dataShowStore"]; + + +@inject(...store) +@observer +export default class TestForm extends React.Component{ + + constructor (props) { + super(props); + this.state={}; + } + + getItems = () => { + const {dataShowStore} = this.props; + const {testForm, status} = dataShowStore; + const {dataShowTestFormFields,showXml} = toJS(status); + const {isFormInit} = testForm; + + let group = []; + isFormInit && dataShowTestFormFields && dataShowTestFormFields.forEach(c => { + c && c.items && c.items.forEach(fields => { + let key = fields.domkey[0]; + + // 处理浏览框的图标 + if('BROWSER' === fields.conditionType && fields.browserConditionParam) { + // 设置图标 + fields.browserConditionParam.icon = "icon-coms-integration"; + fields.browserConditionParam.iconBgcolor = "#1a57a0"; + } + + group.push( + + + + ) + }); + }); + + return
{group}
; + }; + + render() { + return ( +
+ {this.getItems()} +
+ ) + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/datashow/index.js b/pc4backstage/integration/components/datashow/index.js new file mode 100644 index 0000000..96b3874 --- /dev/null +++ b/pc4backstage/integration/components/datashow/index.js @@ -0,0 +1,514 @@ +import React from "react"; +import { + inject, + observer, +} from "mobx-react"; +import { + Button, +} from "antd"; +import { + WeaLocaleProvider, + WeaLeftRightLayout, + WeaTop, + WeaTab, + WeaRightMenu, +} from "ecCom"; +import { + WeaTableNew, + WeaLogView, +} from "comsMobx"; +import { + doConfirm, + getAdvancedItem, + getSearchBtns, +} from "../../util/IntegrationUtil"; +import NewForm from "./NewForm"; +import NewE7Form from "./NewE7Form"; +import NoRight from "../../public/NoRight"; +import PreviewDialog from "./PreviewDialog"; +import IndexTestDialog from "./IndexTestDialog"; +import SqlTestDialog from "./SqlTestDialog"; +import OrganizationTree from '../../public/OrganizationTree'; +import CacheDataManage from "./CacheDataManage"; + +const {getLabel} = WeaLocaleProvider; +const {WeaTable} = WeaTableNew; +const WeaLogViewComp = WeaLogView.Component; + +@inject("dataShowStore") +@observer +export default class DataShow extends React.Component { + constructor(props) { + super(props); + this.state = { + visible: false, + targetId: "", + showSearchAd: false, + searchType: ['base','advanced'], + tabDatas: [{ + key: "0", + title: getLabel("526043", "数据展现集成列表") + }, { + key: "1", + title: getLabel("526044", "缓存管理") + }], + }; + } + + // 从NC等产品集成入口进来的数据 + componentWillMount() { + const {dataShowStore} = this.props; + let paramsIndex = location.href.trim() && location.href.trim().indexOf('?'); + if((paramsIndex != -1) && (location.href.trim().indexOf('typename') > paramsIndex) && (location.href.trim().indexOf('from=productEntrance') > paramsIndex)) { + let url = location.href.split('?')[1]; + if(url) { + let params = url.split('&'); + let query = {}; + for(let i = 0; i < params.length; i++) { + query[params[i].split('=')[0]] = params[i].split('=')[1]; + } + dataShowStore.source = (query.typename ? query.typename : ""); + }else { + dataShowStore.source = ""; + } + }else { + dataShowStore.source = ""; + } + } + + // 组件渲染后调用 + componentDidMount() { + const { dataShowStore } = this.props; + dataShowStore.doInit(); + } + + componentWillReceiveProps(nextProps) { + const { dataShowStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + dataShowStore.doInit(); + } + } + + // 分权刷新 + refreshData = (id, type) => { + const { + dataShowStore + } = this.props, { + status, + } = dataShowStore, { + selectedKey, + } = status; + + if("1" === type) { + // 如果点击的是分部 + dataShowStore.setState({ + subcompanyid: id, + }) + } else{ + dataShowStore.setState({ + subcompanyid: "", + }) + } + + if(selectedKey == "1") { + dataShowStore.getCacheManageCondition({}, dataShowStore.getCacheManageListInfo); + } else { + dataShowStore.getDataShowCondition({}, dataShowStore.getDataShowInfo); + } + } + + getBtns = () => { + const { + dataShowStore, + } = this.props, { + status, + tableStore, + } = dataShowStore, { + rightMenus, + selectedKey, + tabButtonDisabled, + } = status, { + selectedRowKeys + } = tableStore; + + return rightMenus && rightMenus.map(m => ); + }; + + getRightMenu = () => { + const { + dataShowStore, + } = this.props, { + status, + tableStore, + } = dataShowStore, { + rightMenus, + selectedKey, + tabButtonDisabled, + } = status; + + let btnArr = rightMenus && rightMenus.map(m => { + return { + key: m.type, + icon: , + content: m.menuName, + onClick: () => this.onRightMenuClick(m.type), + disabled: tabButtonDisabled || (selectedKey == "0" ? (m.menuIcon==='icon-coms-delete' && tableStore.selectedRowKeys.length === 0) : this.getButtonSelectProps(m.type)), + }; + }); + //显示列定制 + btnArr.push({ + key: "BTN_COLUMN", + icon: , + content: getLabel(32535, "显示列定制"), + onClick: () => this.onRightMenuClick("BTN_COLUMN") + }); + return btnArr; + } + + getButtonSelectProps = (type) => { + const { + dataShowStore, + } = this.props, { + tableStore, + } = dataShowStore, { + selectedRowKeys, + datas, + } = tableStore; + let disabled = selectedRowKeys.length === 0, + list = []; + + if(!disabled) { + selectedRowKeys && selectedRowKeys.forEach(key => { + let data = datas && datas.find(data => data.randomFieldId === key); + if(data) { + if(list.indexOf(data.isopencache) == -1) { + list.push(data.isopencache); + } + } + }) + if(list.length > 1) { + disabled = true; + } else { + return (type === "BTN_NEW" && list[0] == "1") || (type === "BTN_DEL" && list[0] == "0"); + } + } + + return disabled; + } + + onRightMenuClick = (type, record=null) => { + const { + dataShowStore, + } = this.props, { + tableStore, + status, + getDataShowCacheOperation, + getCacheDataManageCondition, + getCacheDataManageInfo, + } = dataShowStore, { + selectedKey, + } = status; + const operateKey = record ? record.id : tableStore.selectedRowKeys; + + if("0" == selectedKey) { + if (type == "BTN_NEW") { + dataShowStore.setState({showNewFormDialog: true}); + dataShowStore.getDataShowEditForm({id: ''}); + }else if (type == "BTN_DEL" || type == "2") { + let ids = "", title = ""; + if(type == "2") { + title = getLabel(15097, '确定要删除吗?'); + ids = record.id; + } else { + title = getLabel(385625, '确定要删除选择的记录吗?'); + ids = tableStore.selectedRowKeys; + } + doConfirm( + title, + dataShowStore.getDataShowOperation, + {operator: 'delete', id: ids} + ); + }else if (type == "0") { + dataShowStore.setState({type: 'INDEX_TEST'}); + dataShowStore.getIndexTest(record.id); + }else if (type == "1") { + if(record.browserfrom == '0') { + dataShowStore.getDataShowEditForm4E7({id: record.id, browserid:record.showname}); + dataShowStore.setState({showNewE7FormDialog: true}); + }else { + dataShowStore.getDataShowEditForm({id: record.id}); + dataShowStore.setState({showNewFormDialog: true}); + } + } + } else if ("1" == selectedKey) { + if("0" == type || "BTN_NEW" == type) { + // 开启缓存 + let title = ''; + if('0' == type) { + title = `${getLabel('529052','确定开启缓存吗')}?`; + } else { + title = `${getLabel('529054','确定要开启选择的记录的缓存吗')}?`; + } + doConfirm( + title, + getDataShowCacheOperation, + {operate: "openCache", id: operateKey} + ); + } else if("1" == type || "BTN_DEL" == type) { + // 关闭缓存 + let title = ''; + if('1' == type) { + title = `${getLabel('529051','确定关闭缓存吗')}?` ; + } else { + title = `${getLabel('529053','确定要关闭选择的记录的缓存吗')}?`; + } + doConfirm( + title, + getDataShowCacheOperation, + {operate: "closeCache", id: operateKey} + ); + } else if("2" == type) { + // 缓存数据管理 + dataShowStore.setState({ + cacheDataManageVisible: true, + cacheDataOperateInfo: record, + }) + getCacheDataManageCondition({}, getCacheDataManageInfo); + } else if("3" == type) { + // 系统日志 + this.setState({ + visible: true, + targetId: record ? record.id : "", + }) + } + } + + if (type == "BTN_COLUMN") { + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + } + }; + + getAdvancedSearch = () => { + const { + dataShowStore, + } = this.props, { + searchForm, + status, + } = dataShowStore, { + dataShowConditionInfo + } = status; + return getAdvancedItem(searchForm, dataShowConditionInfo, this.handleSearchFun, false, this && this.props && this.props.ecId || '', "integrationDatashow"); + }; + + handleSearchFun = () => { + const { + dataShowStore, + } = this.props, { + status, + searchForm, + } = dataShowStore, { + selectedKey, + }= status; + + dataShowStore.setState({ + subcompanyid: searchForm.getFormParams().subcompanyid1, + }); + + if(selectedKey == "1") { + dataShowStore.getCacheManageListInfo(); + } else { + dataShowStore.getDataShowInfo(); + } + + this.setState({ showSearchAd: false }); + } + + getTabButtonsAd = () => { + return getSearchBtns( + this.handleSearchFun, + () => this.props.dataShowStore.searchForm.reset(), + () => this.setState({ showSearchAd: false }), + this && this.props && this.props.ecId || '', + "integrationDatashow" + ); + } + + onOperatesClick = (record, index, operate) => { + this.onRightMenuClick(operate.index, record); + }; + + getColumnsInfo = (datas=[]) => { + const {selectedKey} = this.props.dataShowStore.status; + + return datas && datas.map(item => { + if("0" == selectedKey) { + if("id" === item.dataIndex) { + item.render = (text, record) => this.onRightMenuClick("1", record)}>{record.showname}; + } else if(["unconditionalQuery", "physicalPaging", "isPhyPage"].includes(item.dataIndex)) { + item.render = (text, record) => {record[`${item.dataIndex}span`] || record[item.dataIndex]}; + } + } + + if("subcompanyid" === item.dataIndex) { + item.render = (text, record) => {record.subcompanyidspan}; + } + + return item; + }) + } + + setShowSearchAd = (bool) => this.setState({showSearchAd: bool}); + + hideSearchAd = () => this.setState({showSearchAd: false}); + + onSearchChange = value => { + const { + dataShowStore, + } = this.props, { + searchForm, + status, + } = dataShowStore, { + selectedKey, + } = status; + + searchForm.updateFields({[selectedKey == "0" ? "name" : "showname"]: value}) + }; + + getSearchBaseValue = () => { + const { + dataShowStore, + } = this.props, { + searchForm, + status, + } = dataShowStore, { + selectedKey, + } = status; + + const formParams = searchForm.getFormParams(); + + return selectedKey == "0" ? formParams.name : formParams.showname; + } + + onChange = (selectedKey) => { + const { + dataShowStore, + } = this.props; + + if(selectedKey == "1") { + dataShowStore.getCacheManageCondition({}, dataShowStore.getCacheManageListInfo); + } else { + dataShowStore.getDataShowCondition({}, dataShowStore.getDataShowInfo); + } + + dataShowStore.setState({selectedKey}); + } + + // 关闭日志弹窗 + closeLogDialog = () => { + this.setState({ + visible: false, + targetId: "", + }) + } + + render() { + const { + dataShowStore, + } = this.props, { + tableStore, + status, + hasRight, + rightLoading, + logStore, + } = dataShowStore, { + advanceHeight, + showTestFormDialog, + showsSqlTextFormDialog, + showIndexTestDialog, + collectParams, + hasOrganization, + subcompanyid, + selectedKey, + } = status, { + showSearchAd, + searchType, + tabDatas=[], + visible, + targetId, + } = this.state; + + return (rightLoading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{collectParams}} + /> + } + > + + + + + + + + + + + + : + ); + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/datashow/style/index.css b/pc4backstage/integration/components/datashow/style/index.css new file mode 100644 index 0000000..8a73e32 --- /dev/null +++ b/pc4backstage/integration/components/datashow/style/index.css @@ -0,0 +1,16 @@ +.specialCol_dataShow span.wea-field-readonly { + margin-top:10px; + /*line-height: 30px;*/ + word-break: break-all; + +} + +span.inte-datashow-selectStyle>span.child-item { + word-break: keep-all !important; +} + +/* +.specialCol2 span.wea-field-readonly { + cursor:pointer; + line-height: 80px; +}*/ diff --git a/pc4backstage/integration/components/delegateClient/index.js b/pc4backstage/integration/components/delegateClient/index.js new file mode 100644 index 0000000..4b350f5 --- /dev/null +++ b/pc4backstage/integration/components/delegateClient/index.js @@ -0,0 +1,230 @@ +import { + inject, + observer, +} from "mobx-react"; +import { + toJS +} from 'mobx'; +import uuid from 'uuid'; +import { + WeaFormItem, + WeaLocaleProvider, + WeaRightMenu, + WeaSearchGroup, + WeaTop, + WeaNewScroll, +} from "ecCom"; +import { + WeaSwitch, +} from "comsMobx"; +import { + onCheck, + doConfirm, +} from "../../util/IntegrationUtil"; +import { + Button, +} from "antd"; +import NoRight from "../../public/NoRight"; + +const {getLabel} = WeaLocaleProvider; + +@inject("delegateClientStore") +@observer +class DelegateClient extends React.Component { + constructor(props) { + super(props); + this.state = { + collectParams: { + favname: getLabel('528480','Delegate集成'), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/delegate_client", + importantlevel: 1 + } + }; + } + + componentDidMount() { + this.props.delegateClientStore.doInit(); + } + + componentWillUnmount() { + this.props.delegateClientStore.cleanStore(); + } + + componentWillReceiveProps(nextProps) { + const { delegateClientStore } = this.props; + if (this.props.location && nextProps.location && (this.props.location.key !== nextProps.location.key)) { + delegateClientStore.doInit(); + } + } + + /** + * 获取右键菜单 + * @returns {Array} + */ + getRightMenu() { + const { + formLoading + } = this.props.delegateClientStore.status; + + return [{ + key: "BTN_SAVE", + icon: , + content: getLabel(30986, '保存'), + disabled: formLoading, + onClick: () => this.onMenuClick("BTN_SAVE") + }, { + key: "test", + icon: , + content: getLabel('514733','部署'), + disabled: formLoading, + onClick: () => this.onMenuClick("test") + }] + } + + /** + * 获取顶部按钮 + * @returns {Array} + */ + getBtns = () => { + const { + formLoading + } = this.props.delegateClientStore.status; + + return [ + , + + ] + }; + + /** + * 右键菜单点击事件 + * @param type + */ + onMenuClick = (type) => { + const { + delegateClientStore, + } = this.props, { + baseForm, + hiddenFields={}, + } = delegateClientStore; + + if (['BTN_SAVE', 'test'].includes(type)) { + const formParams = baseForm.getFormParams(); + let params = Object.assign({}, formParams, toJS(hiddenFields)); + // 提取保存的公共方法 + let saveMethod = () => { + if('test' === type) { + doConfirm( + getLabel('514734','部署后会自动重启服务,若有失败,请手动重启服务,以确保系统能正常使用!'), + delegateClientStore.getBaseInfoFormOperation, + params, + ) + } else { + delegateClientStore.getBaseInfoFormOperation(params); + } + }; + + if('test' === type) { + params = Object.assign({}, params, {isdeploy: '1'}); + } + + if(formParams.isuse != '1') { + saveMethod(); + } else { + onCheck(baseForm, () => { + if(formParams.isuse == '1' && formParams.ec_isuse != '1' && formParams.em_isuse != '1') { + doConfirm(getLabel('528310','请开启pc认证或移动端认证!')); + return; + } + + saveMethod(); + }); + } + } + }; + + /** + * 渲染form表单 + */ + getBaseInfoForm = (form, datas=[]) => { + const { + isFormInit, + } = form; + let group = []; + + isFormInit && datas && datas.forEach((c, index) =>{ + let items = []; + + if(form.getFormParams().isuse == '1' || ('1' != form.getFormParams().isuse && 'baseInfo' === c.key)) { + c.items && c.items.forEach(fields => { + let key = fields.domkey[0]; + items.push({ + com:( + + + + ), + colSpan:1, + hide: form.isHide(fields, (keys, allParams) => { + let bool = false; + 'customsql' === key && allParams.accounttype != '7' && (bool = true); + return bool; + }) + }); + }); + group.push(); + } + }); + + return group; + } + + render() { + const { + delegateClientStore, + } = this.props, { + status, + baseForm, + } = delegateClientStore, { + hasRight, + loading, + condition, + } = status, { + collectParams, + } = this.state; + + return ( + loading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{collectParams}} + /> + + {this.getBaseInfoForm(baseForm, condition)} + + + : + ); + } +} + +export default DelegateClient; diff --git a/pc4backstage/integration/components/docx/index.js b/pc4backstage/integration/components/docx/index.js new file mode 100644 index 0000000..bbe067d --- /dev/null +++ b/pc4backstage/integration/components/docx/index.js @@ -0,0 +1,231 @@ +import React from 'react' +import {WeaTop, WeaTab, WeaTree, WeaDropMenu, WeaLocaleProvider} from 'ecCom'; +import {Row, Col, Menu, Dropdown, Icon, Button} from 'antd'; +import docxInfo from '../../util/docxInfo.js'; + +const SubMenu = Menu.SubMenu; +const getLabel = WeaLocaleProvider.getLabel; + +export default class Docx extends React.Component { + constructor(props) { + super(props); + this.state = { + version: '', + key: '', + selectedKey: '', + hash: '', + docxHeight: 0, + scrollWidth: 0, + } + this.resize.bind(this); + } + + componentDidMount() { + this.init(); + this.screenChange(); + + try{ + let docxHeight = Number(document.body.clientHeight) + Number(window.screenTop); + let docxWidth = Number(document.body.clientWidth) + Number(window.screenLeft); + document.getElementById('docx').style.height = docxHeight + 'px'; + document.getElementById('docx').style.width = window.screen.width + 'px'; + let topHeight = document.getElementsByClassName('wea-new-top')[0].clientHeight; + document.getElementById('leftPart').style.height = Number(document.body.clientHeight) - Number(topHeight) + 'px'; + let menuWidth = document.getElementsByClassName('wea-drop-menu')[0].clientWidth; + document.getElementById('rightPart').style.height = Number(docxHeight) - Number(topHeight) + 'px'; + let tabHeight = document.getElementsByClassName('wea-tab')[0].clientHeight + 2; + let scrollWidth = (Number(document.body.clientWidth) - Number(menuWidth)) * 0.98 + 'px'; + document.getElementById('srcIframe').style.height = Number(document.body.clientHeight) - Number(topHeight) - Number(tabHeight) + 'px'; + let height = Number(document.getElementsByClassName('wea-tree')[0].clientHeight) + 35 + 'px'; + document.getElementById('treePart').style.height = height + 'px'; + this.setState({ + docxHeight: docxHeight, + docxWidth: docxWidth, + scrollWidth: scrollWidth + }) + }catch(err) { + + } + } + + componentWillUnmount() { + window.removeEventListener('resize',this.resize); + } + +  screenChange() { +     window.addEventListener('resize', this.resize); +  } + + resize = () => { + try{ + document.getElementById('docx').style.height = this.state.docxHeight + 'px'; + document.getElementById('docx').style.width = window.screen.width + 'px'; + let topHeight = document.getElementsByClassName('wea-new-top')[0].clientHeight; + let menuWidth = document.getElementsByClassName('wea-drop-menu')[0].clientWidth; + document.getElementById('leftPart').style.height = Number(document.body.clientHeight) - Number(topHeight) + 'px'; + document.getElementById('rightPart').style.height = Number(this.state.docxHeight) - Number(topHeight) + 'px'; + let tabHeight = document.getElementsByClassName('wea-tab')[0].clientHeight + 2; + let scrollWidth = (Number(document.body.clientWidth) - Number(menuWidth)) * 0.98 + 'px'; + this.setState({ + scrollWidth: scrollWidth + }) + let height = Number(document.getElementsByClassName('wea-tree')[0].clientHeight) + 35 + 'px'; + document.getElementById('treePart').style.height = height + 'px'; + document.getElementById('srcIframe').style.height = Number(document.body.clientHeight) - Number(topHeight) - Number(tabHeight) + 'px'; + }catch(err) {} + } + + scrollToAnchor = (anchorName) => { + if (anchorName) { + let anchorElement = document.getElementById(anchorName); + if(anchorElement) { anchorElement.scrollIntoView(); } + } + } + + init = () => { + this.setState({ + version: 'e8', + showVersion: 'e-cology8.0', + key: 'datasource', + selectedKey: '1', + hash:'', + }) + } + + getMenu = (children) => { + return children.map(child => ( + child.children.length + ? this.handleClick(item)} + >{this.getMenu(child.children)} + : {child.title} + )) + } + + handleClick = (item) => { + item && item.key && this.setState({ + hash: `#${item.key}` + }) + } + + getTopDatas = () => { + let topDatas = []; + + docxInfo[this.state.version] && docxInfo[this.state.version].topTitle && docxInfo[this.state.version].topTitle.map(data => { + if(data && data[this.state.key]) { + data[this.state.key].length && data[this.state.key].map((ds, index) => { + let children = this.getMenu(ds.children) + let menu = ( this.handleClick(key)}>); + menu.props.children = children; + + topDatas.push({ + title: this.state.selectedKey == ds.key + ?
} trigger={['click']}> + + : ds.title, + viewcondition: ds.key + }) + }) + } + }) + return topDatas; + } + + getDatas = () => { + let datas = []; + + docxInfo[this.state.version] && docxInfo[this.state.version].leftTitle && docxInfo[this.state.version].leftTitle.map(title => { + title && datas.push({ + "canClick": true, // 标识节点是否可以点击 (单选 多选模式下生效) + "icon": "", // 图标展示 + "id": title.key, // 节点唯一标识,作为key值。 + "nodeid": title.key, // 节点唯一标识,作为key值(没设置的情况下取id)。 注意: 在单多选模式下,节点的id或者nodeid必须唯一(选中受控) + "isParent": false, // 父节点标识 + "name": title.showName, // 名称 + "dragDisabled": true, // 禁止节点拖拽 + }) + }) + return datas; + } + + handleSelect = (item) => { + item && this.setState({ + version: item.key, + showVersion: item.item.props.children + }) + } + + render() { + const dropMenuDatas = [{ + companyid: 'e8', + name: 'ecology8.0' + }, { + companyid: 'e9', + name: 'ecology9.0' + }] + + return (
+
+ } + iconBgcolor="#1a57a0" + buttons={[]} + showDropIcon={true} + dropMenuDatas={[]} + dropMenuProps={{ + collectParams: { + favname: getLabel('32269',"集成中心") + getLabel('275',"帮助") + getLabel('30041',"文档"), + favouritetype: 1, + objid: 0, + link: (window.ecologyContentPath || "") + "/spa/integration/static4engine/engine.html#/main/integration/docx", + importantlevel: 1 + } + }} + />
+ +
+
+ +
+ this.setState({key, selectedKey: '1'})} + /> + +
+
+ +
+
+ this.setState({selectedKey: v})} + /> +
+ +
+
+ + + ) + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/doubleInput.js b/pc4backstage/integration/components/doubleInput.js new file mode 100644 index 0000000..51bb933 --- /dev/null +++ b/pc4backstage/integration/components/doubleInput.js @@ -0,0 +1,25 @@ +import React, { Component } from 'react'; +import {Row, Col} from "antd"; +import {WeaInput} from 'ecCom'; + +class Main extends Component { + constructor(props) { + super(props); + } + render() { + return ( +
+ + + + + + ); + } +} + +export default Main; \ No newline at end of file diff --git a/pc4backstage/integration/components/email/AddOrEdit.js b/pc4backstage/integration/components/email/AddOrEdit.js new file mode 100644 index 0000000..225c168 --- /dev/null +++ b/pc4backstage/integration/components/email/AddOrEdit.js @@ -0,0 +1,174 @@ +import React, { Component } from 'react'; +import {toJS} from "mobx"; +import {Button, Spin} from "antd"; +import {observer, inject} from "mobx-react"; +import {WeaDialog, WeaLocaleProvider, WeaRightMenu} from 'ecCom'; +import {getForm, onCheck, checkUnique, doConfirm} from '../../util/IntegrationUtil'; + +const {getLabel} = WeaLocaleProvider; + +@inject("alyMail") +@observer +class AddOrEdit extends Component { + + componentWillUnmount() { + const {alyMail} = this.props; + alyMail.closeDialog(); + } + + getButtons = () => { + const {status: {formLoading, buttonDisabled}} = this.props.alyMail; + return [ + , + , + , + ]; + } + + getRightMenus = () => { + const {status: {formLoading, buttonDisabled}} = this.props.alyMail; + return [{ + key: "BTN_SAVE", + icon: , + content: getLabel(30986, "保存"), + disabled: formLoading || buttonDisabled, + onClick: () => this.onMenuClick("BTN_SAVE"), + }, { + key: "BTN_TEST", + icon: , + content: getLabel(25496, "测试"), + disabled: formLoading || buttonDisabled, + onClick: () => this.onMenuClick("BTN_TEST"), + }, { + key: "BTN_INIT", + icon: , + content: getLabel(20873, "初始化"), + disabled: formLoading || buttonDisabled, + onClick: () => this.onMenuClick("BTN_INIT"), + }] + } + + handleMenuClick = (type) => { + const {alyMail} = this.props; + const {form, mailForm, getMailSaveOperation, getMailAddSetForm, status: {operateIndex}} = alyMail; + let params = {} + if(type === "BTN_TEST") { + params = {operate: "test", mailMasterId: operateIndex}; + }else if(type === "BTN_INIT") { + params = {operate: "init", mailMasterId: operateIndex}; + } else if ("BTN_SAVE" === type) { + params = {operate: "save", mailMasterId: operateIndex}; + } + let saveCallBack = (callback) => checkUnique({ + tableName: 'Mail_master', + fieldName: 'syscode', + fieldValue: form.getFormParams().syscode.replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: operateIndex + }, form, "syscode", "2", operateIndex, callback); + onCheck(form, () => { + if(operateIndex == "") { + if("BTN_TEST" === type || "BTN_INIT" === type) { + onCheck(mailForm, () => { + saveCallBack(() => { + getMailSaveOperation({...params, operate: "save"}, (result) => { + alyMail.setState({operateIndex: result.maxId}); + getMailAddSetForm({mailMasterId: result.maxId}, () => getMailSaveOperation({...params, mailMasterId: result.maxId})); + }) + }) + }); + } else { + onCheck(mailForm, () => saveCallBack(() => getMailSaveOperation(params))); + } + }else { + if("BTN_TEST" === type || "BTN_INIT" === type) { + saveCallBack(() => { + getMailSaveOperation({...params, operate: "save"}, () => { + getMailAddSetForm({mailMasterId: operateIndex}, () => getMailSaveOperation(params)); + }) + }) + } else { + saveCallBack(() => getMailSaveOperation(params)); + } + } + }); + } + + onMenuClick = (type) => { + if("BTN_INIT" === type) { + doConfirm(getLabel('519656','确定要初始化吗?'), () => { + this.handleMenuClick(type); + }); + } else { + this.handleMenuClick(type); + } + } + + handleChange = (form, formParams, fields) => { + const {alyMail} = this.props; + const {status: {operateIndex}} = alyMail; + const key = fields.domkey[0]; + if(key === "mailtype") { + alyMail.getMailSelectSetForm(form.getFormParams()); + }else if(key === "syscode") { + const value = form.getFormParams()[key].replace(/^(\s*)|(\s*)$/g, ''); + if(value) { + checkUnique({ + tableName: 'Mail_master', + fieldName: 'syscode', + fieldValue: form.getFormParams()[key].replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: operateIndex + }, form, key, "2", operateIndex); + } + } + } + + otherDom = (form, fields) => { + const key = fields.domkey[0]; + if(key === "email163_pubkey") { + return + }else { + return null; + } + } + + render() { + const {alyMail} = this.props; + const {status: {baseDialogVisible, condition, operateIndex, formLoading, mailFormCondition, mailFormLoading, buttonDisabled}, form, mailForm} = alyMail; + return ( + + + + { + operateIndex + ? (!formLoading) && getForm(form, toJS(condition), true, this.handleChange, this.otherDom) + :
+ {(!formLoading) && getForm(form, toJS(condition), false, this.handleChange)} +
+ {(!mailFormLoading) && getForm(mailForm, toJS(mailFormCondition), false, null, this.otherDom)} +
+
+ } +
+
+
+ ); + } +} + +export default AddOrEdit; \ No newline at end of file diff --git a/pc4backstage/integration/components/email/Header.js b/pc4backstage/integration/components/email/Header.js new file mode 100644 index 0000000..c45a2db --- /dev/null +++ b/pc4backstage/integration/components/email/Header.js @@ -0,0 +1,405 @@ +import React, { Component } from 'react'; +import { + inject, + observer +} from 'mobx-react'; +import {toJS} from "mobx"; +import {WeaRightMenu, WeaTop, WeaTab, WeaLocaleProvider, WeaHelpfulTip, WeaFormItem, WeaSearchGroup} from "ecCom"; +import {Button, Spin} from "antd"; +import {WeaTableNew, WeaSwitch} from "comsMobx"; +import {getSearchBtns, getAdvancedItem} from '../../util/IntegrationUtil'; +import MainTable from "../login/MainTable"; +import isEmpty from 'lodash/isEmpty'; +import CronExp from '../../public/CronExp'; +import '../../style/email.less'; + +const {getLabel} = WeaLocaleProvider; +const {WeaTable} = WeaTableNew; + +@inject('intelogin') +@observer +export default class Header extends Component { + constructor(props) { + super(props); + this.state = { + tabDatas: [ + { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: getLabel('505949','集成列表'), + viewcondition: 0 + } + , { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: getLabel(20960, "集成登录"), + viewcondition: 1 + } + , { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: getLabel(125928, "同步日志"), + viewcondition: 2 + } + , { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: getLabel('516042','日志清理'), + viewcondition: 3 + } + ], + baseRightMenus: [{ + key: "BTN_NEW", + icon: , + content: getLabel('365','新建'), + type: "primary" + }, { + key: "BTN_DELETE", + icon: , + content: getLabel('32136','批量删除'), + type: "primary" + }], + logRightMenus: [{ + key: "BTN_INTERVAL_SAVE", + icon: , + content: getLabel(30986, "保存"), + type: "primary" + }], + showSearchAd: false, + selectedKey: "0" + } + } + + getBtns = () => { + const {selectedKey, baseRightMenus, logRightMenus} = this.state; + const { + intelogin, + initLoading, + } = this.props, { + menus + } = intelogin, { + outTopButtons=[] + } = menus; + let datas = []; + if(selectedKey == 1) { + return outTopButtons.map(item => + + ) + }else { + if(selectedKey == 0) { + datas = [...baseRightMenus]; + }else if(selectedKey == 2) { + datas = [...this.props.rightMenus]; + }else if(selectedKey == 3) { + datas = [...logRightMenus]; + } + return datas.map(item => + ); + } + }; + + getRightMenus = () => { + const {selectedKey, baseRightMenus, logRightMenus} = this.state; + const { + intelogin, + initLoading, + } = this.props, { + menus + } = intelogin, { + dropMenuDatas=[] + } = menus; + + if(selectedKey == 1) { + return dropMenuDatas.map(item => { + if(item.key === "BTN_NEW") { + return { + ...item, + disabled: item.disabled + } + }else { + return { + ...item, + onClick: () => item.onClick({typename: this.props.typename}) + }; + } + }) + }else { + let buttons = [], columnSet = { + key: "BTN_COLUMN", + icon: , + content: getLabel(32535, "显示列定制"), + onClick: () => this.onMenuClick("BTN_COLUMN") + }, logSet = { + key: "BTN_LOG", + icon: , + content: getLabel('83','日志'), + onClick: () => this.onMenuClick("BTN_LOG") + }; + if(selectedKey == 0) { + buttons = [...baseRightMenus]; + buttons.push(logSet); + buttons.push(columnSet); + }else if(selectedKey == 2) { + buttons = [...this.props.rightMenus]; + buttons.push(columnSet); + }else if(selectedKey == 3) { + buttons = [...logRightMenus]; + } + return buttons.map(item => { + return { + ...item, + disabled: this.props.buttonLoading || initLoading || (item.key === "BTN_DELETE" && toJS(this.props.tableStore.selectedRowKeys).length === 0), + onClick: () => this.onMenuClick(item.key) + } + }) + } + } + + onMenuClick = (type, record=null) => { + const {selectedKey} = this.state; + this.props.onMenuClick(selectedKey, type, record); + } + + getButtonAd = () => { + const { + intelogin, + } = this.props, { + mainTab, + } = intelogin, { + form, + } = mainTab; + let resetFun = () => this.state.selectedKey == 0 ? this.props.searchForm1.reset() : this.state.selectedKey == 1 ? form.reset() : this.props.searchForm.reset(); + let closeFun = () => this.setState({showSearchAd: false}); + return getSearchBtns(this.getSearchFun, resetFun, closeFun, this && this.props && this.props.ecId || '', "integrationIntemail"); + } + + getSearchFun = () => { + if(this.state.selectedKey == 1) { + const { + intelogin, + } = this.props; + intelogin.search({type: "mail"}); + } else { + this.props.onSearch(this.state.selectedKey); + } + this.setState({showSearchAd: false}); + } + + onOperatesClick = (record, index, operate) => { + this.onMenuClick(operate.index, record); + }; + + getColumnsInfo = (data) => { + const {selectedKey} = this.state; + if(selectedKey == 0) { + if(!isEmpty(data)) { + for(let index = 0; index < data.length; index++) { + if(data[index].dbField == "syscode") { + data[index].render = (text, record, index) => { + return ( this.onMenuClick("BTN_EDIT", record)}>{text}); + } + } else if(data[index].dataIndex === "mailicon") { + data[index].render = (text, record, index) => { + return record.mailtype == '1' + ?
+ : record.mailtype == '2' + ?
+ : null; + } + } else if(data[index].dataIndex === "isuse") { + data[index].render = (text, record, index) => { + return record.isuse == 0 ? getLabel('21888','未开启') : {getLabel('21889','已开启')}; + } + } else if(data[index].dataIndex === "issync") { + data[index].render = (text, record, index) => { + return record.issync == 0 ? getLabel('21888','未开启') : {getLabel('21889','已开启')}; + } + } + } + } + } + } + + // 日志清理 + getForm = (form, datas=[]) => { + const {isFormInit} = form; + let group = []; + const formParams = form.getFormParams(); + isFormInit && datas && datas.forEach((c, index) => { + let items = []; + c && c.items && c.items.forEach(fields => { + let dom = null, key = fields.domkey[0]; + if(key === "cleanCronExpr") { + dom = form.updateFields({cleanCronExpr: v.trim()})} + />; + } else{ + dom = ; + } + items.push({ + com: ( + + + {dom} + { + key === "cleanType" + ? + : null + } + + ), + colSpan: 1, + hide: form.isHide(fields, (keys, allParams) => { + let bool = false; + fields.domkey[0] != "cleanStatus" && allParams.cleanStatus != 1 && (bool=true); + fields && fields.showWhere && fields.showWhere.length > 0 && fields.showWhere.map(w => { + if(!bool){ + let show = false; + for(let val of w.value){ + if(allParams[w.domkey] == val){ + show = true; + break; + } + } + bool = !show; + } + }) + return bool; + }) + }); + }) + group.push() + }); + return group; + } + + render() { + const { + tabDatas, + showSearchAd, + selectedKey, + } = this.state, { + intelogin, + initLoading, + } = this.props, { + searchsAd, + mainTab, + } = intelogin, { + condition, + } = mainTab; + let advanceHeight = 72, + datas = selectedKey == 0 ? this.props.searchCondition1 : selectedKey == 1 ? condition : this.props.searchCondition, + form = selectedKey == 0 ? this.props.searchForm1 : selectedKey == 1 ? mainTab.form : this.props.searchForm, + searchKey = selectedKey == 1 ? 'name' : this.props.searchKey; + try{ + advanceHeight = Math.ceil(datas[0].items.length/2) * 72; + }catch(err){} + let hasAdSearch = selectedKey != 3; + return ( + +
+ } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenus()} + dropMenuProps={{ + collectParams: this.props.collectParams + }} + /> + form.updateFields({[searchKey]: value})} + onSearch={this.getSearchFun} + showSearchAd={showSearchAd} + setShowSearchAd={showSearchAd => this.setState({showSearchAd})} + hideSearchAd={() => this.setState({showSearchAd: false})} + onChange={v => { + this.setState({selectedKey: v}); + if(v == 1) { + mainTab.form.reset(); + } + if(this.props.onChange && typeof(this.props.onChange) === "function") { + this.props.onChange(v); + } + }} + /> + { + selectedKey == 3 + ?
+ {this.getForm(this.props.form, this.props.condition)} +
+ : selectedKey == 1 + ? this.props.buttonLoading + ? null + : + : + + + } +
+
+ ) + } +} diff --git a/pc4backstage/integration/components/email/index.js b/pc4backstage/integration/components/email/index.js new file mode 100644 index 0000000..4eb7f59 --- /dev/null +++ b/pc4backstage/integration/components/email/index.js @@ -0,0 +1,195 @@ +import React, { Component } from 'react'; +import {toJS} from "mobx"; +import {observer, inject} from "mobx-react"; +import {WeaLocaleProvider} from "ecCom"; +import {WeaForm, WeaLogView} from 'comsMobx'; +import Header from './Header'; +import {onCheck, doConfirm} from '../../util/IntegrationUtil'; +import AddOrEdit from './AddOrEdit'; +import NoRight from "../../public/NoRight"; +import NonStand from "../../public/NonStand"; + +const WeaLogViewComp = WeaLogView.Component; +const {getLabel} = WeaLocaleProvider; + +@inject("alyMail") +@observer +export default class alymail extends Component { + constructor(props) { + super(props); + this.state = { + targetId: "", + visible: false, + } + } + + componentDidMount() { + this.props.alyMail.doInit(); + } + + componentWillReceiveProps(nextProps) { + if(nextProps.location.key != this.props.location.key) { + this.props.alyMail.doInit(); + } + } + + handleChangeTab = (selectedKey) => { + const {alyMail} = this.props; + const {getMailCondition, getLogInfo, getMailList} = alyMail; + + if(selectedKey == 3) { + alyMail.getLogSettingFields(); + }else if(selectedKey == 2) { + getLogInfo(); + }else if(selectedKey == 0) { + getMailCondition(getMailList); + } + } + + onSearch = (selectedKey) => { + const {alyMail} = this.props; + const {searchForm, getLogDatas, getMailList, searchForm1} = alyMail; + + if(selectedKey == 2) { + getLogDatas(searchForm.getFormParams()); + }else if(selectedKey == 0) { + getMailList(searchForm1.getFormParams()); + } + } + + onMenuClick = (selectedKey, type="", record=null) => { + const {alyMail} = this.props; + const {tableStore, getMailAddSetForm, getMailSaveOperation, getMailSelectSetForm, getMailDeleteOperation, logSettingForm, saveLogSetting} = alyMail; + + if(type.toLocaleUpperCase() === "BTN_COLUMN") { + tableStore.setColSetVisible(true); + tableStore.tableColSet(true); + }else { + if(selectedKey == "0") { + let ids = record ? record.randomField0 : toJS(tableStore.selectedRowKeys); + if(type === "BTN_NEW") { + alyMail.setState({ + baseDialogVisible: true, + operateIndex: "", + formLoading: false, + buttonDisabled: false, + }); + alyMail.mailForm = new WeaForm(); + getMailAddSetForm({mailtype: 1}); + getMailSelectSetForm({mailtype: 1}); + }else if(["BTN_DELETE", "1"].includes(type)) { + let content = getLabel(385625, '确定要删除选择的记录吗?'); + if(record) { + content = getLabel(15097, '确定要删除吗?'); + } + doConfirm(content, getMailDeleteOperation, {operate: "delete", mailMasterIds: ids}); + }else if(["BTN_EDIT", "0"].includes(type)) { + alyMail.setState({ + baseDialogVisible: true, + operateIndex: ids, + formLoading: false, + buttonDisabled: false, + }); + getMailAddSetForm({mailMasterId: ids}); + }else if(type === "2") { + getMailSaveOperation({operate: "test", mailMasterId: ids}); + }else if(type === "3") { + let content = getLabel('519656','确定要初始化吗?'); + doConfirm(content, getMailSaveOperation, {operate: "init", mailMasterId: ids}); + }else if(type === "BTN_LOG" || type == "4") { + this.setState({ + visible: true, + targetId: record ? record.randomField0 : "", + }); + } + } else if(selectedKey == "3") { + if(type === "BTN_INTERVAL_SAVE") { + onCheck(logSettingForm, () => { + const formParams = logSettingForm.getFormParams(); + try{ + if(formParams.cleanType == "4") { + if(formParams.cleanCustomValue === undefined) { + logSettingForm.showError("cleanType", getLabel('516269','"日志记录" 未填写')); + }else { + saveLogSetting({ + ...formParams, + }); + } + }else { + saveLogSetting({ + ...formParams, + }); + } + }catch(err) {} + }) + } + } + } + } + + closeLogDialog = () => this.setState({visible: false, targetId: ""}); + + render() { + const {alyMail} = this.props; + const {logSettingForm, form, tableStore, searchForm, logStore, searchForm1, status: { + hasNonStandard, + nonStandLoading, + logSettingCondition, + buttonDisabled, + buttonLoading, + searchCondition, + buttons, + searchCondition1, + hasRightLoading, + hasRight, + baseDialogVisible, + }} = alyMail; + const {visible, targetId} = this.state; + return (nonStandLoading + ? null + : hasNonStandard + ? hasRightLoading + ? null + : hasRight + ?
+
this.handleChangeTab(v)} + /> + + +
+ : + : + ) + } +} diff --git a/pc4backstage/integration/components/homepage/index.js b/pc4backstage/integration/components/homepage/index.js new file mode 100644 index 0000000..2cd9c4d --- /dev/null +++ b/pc4backstage/integration/components/homepage/index.js @@ -0,0 +1,119 @@ +import React from 'react'; +import { inject, observer } from 'mobx-react'; +import { toJS } from 'mobx'; +import { + WeaLocaleProvider, + WeaTop, + WeaTab, + WeaSearchGroup, + WeaAppCenter, + WeaRightMenu, +} from 'ecCom'; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject('homepageStore','routing') +@observer +class IntegrationHomePage extends React.Component { + constructor(props) { + super(props); + } + + componentWillMount() { + const { homepageStore } = this.props; + homepageStore.getApps(); + } + + onClick = datas => { + // const { pathname, basename } = this.props.location; + // const hashname = pathname + basename; + // const urlHashIndex = hashname.indexOf('/integration/'); + + // if(urlHashIndex === -1) { + // return; + // } + + // if(urlHashIndex === 0) { + // weaHistory.push({ pathname: datas.routeUrl }); + // } else { + // const prefix = pathname.substr(0, urlHashIndex); + // weaHistory.push({ pathname: `${prefix}${datas.routeUrl}` }); + // } + + // console.log(this.props.location) + const { routing } = this.props; + window.doEngineThemeAction('onSubMenuClick', { infoId: datas.appid }) + datas.issingle == '0' ? routing.push(datas.routeUrl) : window.open(datas.routeUrl); + } + + render() { + const { homepageStore } = this.props; + const { + loading, + tabDatas, + selectedKey, + functionals, + products, + auth_center_server, + auth_center_client, + auth_center_other + } = homepageStore; + const collectParams = { + favname: getLabel(32269, '集成中心'), + favouritetype: 2, + objid: 0, + importantlevel: 1, + link: 'wui/engine.html#/main/integration/homepage', + }; + let datas = selectedKey == 0 ? toJS(functionals) : selectedKey == 1 ? toJS(products) : []; + return ( + } + iconBgcolor='#1a57a0' + loading={loading} + buttons={[]} + buttonSpace={10} + showDropIcon={true} + dropMenuProps={{ + collectParams: collectParams + }}> + + homepageStore.selectedKey = v} + /> + { + selectedKey == 2 + ?
+ +
+ 1} onClick={this.onClick} /> +
+
+ +
+ 1} onClick={this.onClick} /> +
+
+ +
+ 1} onClick={this.onClick} /> +
+
+
+ : +
+ +
+
+ } +
+
+ ); + } +} + +export default IntegrationHomePage; diff --git a/pc4backstage/integration/components/hrsync/LogList.js b/pc4backstage/integration/components/hrsync/LogList.js new file mode 100644 index 0000000..b7f2a8f --- /dev/null +++ b/pc4backstage/integration/components/hrsync/LogList.js @@ -0,0 +1,268 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import {WeaTableNew} from 'comsMobx'; +import {WeaDialog, WeaLocaleProvider, WeaTab, WeaRightMenu, WeaHelpfulTip} from 'ecCom'; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import uuid from "uuid"; + +const WeaTable = WeaTableNew.WeaTable; +const {getLabel} = WeaLocaleProvider; + +@inject("hrSyncStore") +@observer +export default class LogList extends React.Component { + state = { + selectedKey: 0, + showSearchAd: false, + key: '', + errorTipDialogVisible: false, + } + + // 列表重定义列 + getColumns = (columns) => { + let newColumns = ''; + + newColumns = columns && columns.map(column => { + let newColumn = column; + newColumn.render = (text, record, index) => { //前端元素转义 + let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; + return ( + newColumn && newColumn.dataIndex === 'synDetail' + ? this.handleOpenDetailDialog(record.synDetail)} dangerouslySetInnerHTML={{__html: valueSpan}}/> + :
+ ) + }; + return newColumn; + }); + return newColumns; + } + + handleOpenDetailDialog = (key) => { + const { hrSyncStore } = this.props; + const {getLogDetailList, getLogDetailListConditions, getLogTab} = hrSyncStore; + let type = 0; + // let type = dataSyncForm.getFormParams().type; + + this.setState({key}); + hrSyncStore.setState({detailDialogVisible: true}); + type != 0 ? getLogDetailListConditions({synId: key, synType: type}) : getLogDetailListConditions({synId: key, synType: type, synTypeTab: 1}); + type != 0 ? getLogDetailList({synId: key, synType: type}) : getLogDetailList({synId: key, synType: type, synTypeTab: 1}); + getLogTab({synId: key, synType: type}); + } + + // 同步日志的高级搜索框 + getSearchAd = () => { + const {hrSyncStore} = this.props; + const {detailSearchForm, status} = hrSyncStore; + const {detailSearchFormCondition} = toJS(status); + + return IntegrationUtil.getAdvancedItem( + detailSearchForm, + detailSearchFormCondition, + this.onEnterSearch, + false, + this && this.props && this.props.ecId || '', + "integrationHrSync", + ); + } + + onEnterSearch = () => { + const { hrSyncStore } = this.props; + const {detailSearchForm} = hrSyncStore; + const {key, selectedKey} = this.state; + let type = 0; + this.setState({ showSearchAd: false }); + type != 0 + ? hrSyncStore.getLogDetailList({...detailSearchForm.getFormParams(), synId: key, synType: type}) + : hrSyncStore.getLogDetailList({...detailSearchForm.getFormParams(), synId: key, synType: type, synTypeTab: Number(selectedKey) + 1}); + + } + + // 高级搜索上的按钮 + getTabButtonsAd = () => { + const { hrSyncStore } = this.props; + const {detailSearchForm} = hrSyncStore; + return IntegrationUtil.getSearchBtns( + this.onEnterSearch, + () => detailSearchForm.reset(), + () => this.setState({ showSearchAd: false }), + this && this.props && this.props.ecId || '', + "integrationHrSync", + ); + } + + onSearch = (value) => { + const { hrSyncStore } = this.props; + const {detailSearchForm} = hrSyncStore; + const {key, selectedKey} = this.state; + let type = 0; + + detailSearchForm.updateFields({outpk: value}); + this.setState({ showSearchAd: false }); + type != 0 + ? hrSyncStore.getLogDetailList({outpk: value, synId: key, synType: type}) + : hrSyncStore.getLogDetailList({outpk: value, synId: key, synType: type, synTypeTab: Number(selectedKey) + 1}); + } + + handleChangeTab = (v) => { + const { hrSyncStore } = this.props; + const {getLogDetailList, getLogDetailListConditions, getLogTab} = hrSyncStore; + let type = 0; + // let type = dataSyncForm.getFormParams().type; + const {key} = this.state; + + this.setState({selectedKey: v, uid: uuid()}); + getLogDetailListConditions({synId: key, synType: type, synTypeTab: Number(v) + 1}); + getLogDetailList({synId: key, synType: type, synTypeTab: Number(v) + 1}); + } + + // 详细日志 + getDetailColumns = (columns) => { + let newColumns = ''; + let resultStatus = [getLabel('25009','失败') , getLabel('83326','插入成功') , getLabel('31439','更新成功'), getLabel('20461','删除成功') , getLabel('502844','封存成功'), getLabel('502845','解封成功'), getLabel('127354','警告')]; + + newColumns = columns && columns.map(column => { + let newColumn = column; + newColumn.render = (text, record, index) => { //前端元素转义 + let valueSpan = record[newColumn.dataIndex + "span"] !== undefined ? record[newColumn.dataIndex + "span"] : record[newColumn.dataIndex]; + let title = ''; + if(newColumn && newColumn.dataIndex === 'synState') { + if([0, 6].indexOf(Number(record.synState)) != -1) { + title = record.error.includes('#') ? getLabel(record.error.split('#')[0].trim(), '') : record.error; + } + } + return ( + newColumn && newColumn.dataIndex === 'synState' + ? ([0, 6].indexOf(Number(record.synState)) != -1 ? this.handleOpenErrorTip(record.randomFieldId, record.error)} dangerouslySetInnerHTML={{__html: resultStatus[Number(record.synState)]}}/> + + + :
) + :
+ ) + }; + return newColumn; + }); + return newColumns; + } + + handleOpenErrorTip = (key, error) => { + this.props.hrSyncStore.getRealError({error: key}); + } + + render() { + const { hrSyncStore } = this.props; + const {logTableStore, status, logDetailTableStore, detailSearchForm} = hrSyncStore; + const {detailDialogVisible, detailDialogTab, errorInfo, errorTipDialogVisible} = toJS(status); + const {selectedKey, showSearchAd} = this.state; + + return ( +
+ + {hrSyncStore.setState({detailDialogVisible: false}), this.setState({ + selectedKey: 0, + showSearchAd: false, + key: '', + errorTipDialogVisible: false + })}} + title={getLabel(501519, '同步详情')} + style={{width: 900, height:700}} + hasScroll + buttons={[]} + moreBtn={{ + datas: [], + collectParams: [{ + favname: `${getLabel(33719, "HR同步")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/hrsync", + importantlevel: 1 + }] + }} + > + + { + this.setState({ + showSearchAd: bool + }) + }} + onChange={v => this.handleChangeTab(v)} + onSearch={this.onSearch} + onSearchChange={value => detailSearchForm.updateFields({outpk: value})} + searchsBaseValue={detailSearchForm.getFormParams().outpk} + /> + + + + this.props.hrSyncStore.setState({errorTipDialogVisible: false, errorInfo: ''})} + title={getLabel('22045','详情')} + style={{width: 400, height:200}} + hasScroll + buttons={[]} + moreBtn={{ + datas: [], + collectParams: [{ + favname: `${getLabel(33719, "HR同步")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/hrsync", + importantlevel: 1 + }] + }} + > + +
+
+
+ + +
+ ) + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/hrsync/index.js b/pc4backstage/integration/components/hrsync/index.js new file mode 100644 index 0000000..3dc2681 --- /dev/null +++ b/pc4backstage/integration/components/hrsync/index.js @@ -0,0 +1,959 @@ +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import NoRight from "../../public/NoRight"; +import NonStand from "../../public/NonStand"; +import { Button, Modal, Icon, message, } from "antd"; +import { WeaUpload, WeaTable, WeaDialog, WeaTableEditable, WeaTools, WeaHelpfulTip, WeaLocaleProvider, WeaRightMenu, WeaTab, WeaTop, WeaFormItem, WeaSearchGroup, WeaNewScroll } from "ecCom"; +import { WeaSwitch, WeaForm } from "comsMobx"; +import SyncSetFields from "./partial/SyncSetFields"; +import LogList from './LogList'; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import "./style/index.less" + +const { getKey } = WeaTools; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("hrSyncStore") +@observer +class HrSync extends React.Component { + constructor(props) { + super(props); + this.state = { + syncTableTab: "0", + hasSyncClick: false, + file: [], + filelist: [], + sync: true, + topTab: [ + { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(32783, "集成设置")}`, + viewcondition: 0 + }, + { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(82923, "数据同步")}`, + viewcondition: 1 + }, + { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: `${getLabel(125928, "同步日志")}`, + viewcondition: 2 + } + ] + } + } + + componentDidMount() { + const { hrSyncStore } = this.props; + hrSyncStore.setState({selectedKey: 0}); + hrSyncStore.doInit(); + } + + componentWillReceiveProps(nextProps) { + const { hrSyncStore } = this.props; + if (this.props.location.key !== nextProps.location.key) { + hrSyncStore.setState({selectedKey: 0}); + hrSyncStore.doInit(); + } + } + + getFormSearchs = (form, datas, needTigger = true, lableCol, fieldcol) => { + const { isFormInit } = form; + const { hrSyncStore } = this.props; + const {getHrSyncSettingsOperation, status, webserviceParamValuesData, setWebserviceParamValuesData} = hrSyncStore; + const { WeaTableEdit_WebserviceParameterSet, } = toJS(status); + let group = []; + let className=""; + const formParams = form.getFormParams(); + isFormInit && datas && datas.map((c, index) => { + // render webService WeaTab 同步接口方法 + const { intetype } = form.getFormParams(); + if ([2].includes(index) && intetype === "2") { + const tabs = c.items.map((item, index) => { + return { + color: "#000000", + groupid: "flowAll", + showcount: true, + title: item.label, + viewcondition: index + }; + }) + // webService WeaTab + group.push(
+ this.setState({ syncTableTab: v })} + /> +
) + } + // render 基本信息 同步表设置 同步对应字段设置方法 + let center = true; + if (index === 1) { + center = false; + } + let items = []; + // condition + c.items.map((fields, cIndex) => { + let onChange = (e) => { }; + // 同步表设置 + // subcomtable depttable jobtable hrmtable + + if (["subcomouternew"].includes(getKey(fields))) { + className="hr-syn-table-setting"; + fields.dataParams = { + mouldID: "integration", callSource: "hrsetting", + dmltablename: formParams["subcomtable"], + datasourceid: formParams["dbsource"], + } + } + if (["deptouternew"].includes(getKey(fields))) { + className="hrsync-tablesetting"; + fields.dataParams = { + mouldID: "integration", callSource: "hrsetting", + dmltablename: formParams["depttable"], + datasourceid: formParams["dbsource"] + } + } + if (["jobouternew"].includes(getKey(fields))) { + className="hrsync-tablesetting"; + fields.dataParams = { + mouldID: "integration", callSource: "hrsetting", + dmltablename: formParams["jobtable"], + datasourceid: formParams["dbsource"] + } + } + if (["hrmouternew"].includes(getKey(fields))) { + className="hrsync-tablesetting"; + fields.dataParams = { + mouldID: "integration", callSource: "hrsetting", + dmltablename: formParams["hrmtable"], + datasourceid: formParams["dbsource"] + } + } + + // WEBSERVICE地址 select onchange + if (getKey(fields) === "webserviceurl") { + onChange = (e) => { + getHrSyncSettingsOperation({ operation: "getregisteinfo", webserviceurl: e.webserviceurl.value }, res => { + // update fields + // subcommothod deptmothod jobmothod hrmmethod + status.newFormFields[2].items.forEach(item => { + item.options = res.webserviceMethodsList; + }) + }); + // 清空接口方法 + form.updateFields({ + subcommothod: "", + deptmothod: "", + jobmothod: "", + hrmmethod: "" + }) + // 清空接口方法对应的数据 + webserviceParamValuesData.subWebserviceParamValuesData = []; + webserviceParamValuesData.deptWebserviceParamValuesData = []; + webserviceParamValuesData.jobWebserviceParamValuesData = []; + webserviceParamValuesData.hrmWebserviceParamValuesData = []; + } + // 同步接口方法 + } else if (["subcommothod", "deptmothod", "jobmothod", "hrmmethod"].includes(getKey(fields))) { + onChange = (e) => { + getHrSyncSettingsOperation({ operation: "getmethodinfo", methodid: e[Object.keys(e)[0]]["value"] }, res => { + const { webserviceParamValuesData } = hrSyncStore; + setWebserviceParamValuesData(this.state.syncTableTab, res.WebserviceMethodParameterDatas); + }); + } + } else if (["syncmethodHz"].includes(getKey(fields))) { + fields.otherParams = { + valueIsObject: true + } + } + items.push({ + com: ( + + + + {getKey(fields) === 'defaultPwd' && } + + ), + col: 2, + hide: form.isHide(fields, (keys, allParams) => { + switch (getKey(fields)) { + // 集成方式 数据库 + case "dbsource": + return allParams["intetype"] !== "1"; + // 集成方式 接口方式 + case "webserviceurl": + return allParams["intetype"] !== "2"; + // 集成方式 自定义 + case "custominterface": + return allParams["intetype"] !== "3"; + case "defaultPwd": + case "pwdsynctype": + case "issynrtx": + return allParams["intetype"] === "3"; + case "subcommothod": + return this.state.syncTableTab !== "0"; + case "deptmothod": + return this.state.syncTableTab !== "1"; + case "jobmothod": + return this.state.syncTableTab !== "2"; + case "hrmmethod": + return this.state.syncTableTab !== "3"; + case "syncmethodHz": + return allParams["hrmethod"] === '1'; + } + return false; + }) + }) + }); + let title = ""; + if (needTigger) { + const intetype = form.getFormParams().intetype; + // 集成方式 数据库 + if (intetype === "1" && [2].includes(index)) { + title = ""; + items = []; + } else if (intetype === "2" && [1].includes(index)) { + // 集成方式 接口方式 + title = ""; + items = []; + } else if (intetype === "3" && index !== 0) { + // 集成方式 自定义方式 + title = ""; + items = []; + } else { + title = c.title; + } + // remove 同步接口方法 title + if ([2].includes(index)) { + needTigger = false; + title = ""; + } + group.push() + } else { + group.push() + } + + // WEBSERVICE 明细表 table + if ([2].includes(index) && intetype === "2") { + const whichData = [ + webserviceParamValuesData.subWebserviceParamValuesData, + webserviceParamValuesData.deptWebserviceParamValuesData, + webserviceParamValuesData.jobWebserviceParamValuesData, + webserviceParamValuesData.hrmWebserviceParamValuesData, + ]; + group.push( +
+ { + return false; + }} + showTitle={false} + tableProps={{ + showEmptyText: false, + scroll: { x: "100%" } + }} + datas={toJS(whichData[this.state.syncTableTab])} + columns={WeaTableEdit_WebserviceParameterSet} + onChange={(datas) => { + switch (Number(this.state.syncTableTab)) { + case 0: + webserviceParamValuesData.subWebserviceParamValuesData = datas; + break; + case 1: + webserviceParamValuesData.deptWebserviceParamValuesData = datas; + break; + case 2: + webserviceParamValuesData.jobWebserviceParamValuesData = datas; + break; + case 3: + webserviceParamValuesData.hrmWebserviceParamValuesData = datas; + break; + } + }} + /> +
+ ) + } + }); + return group; + } + + + // 同步日志的高级搜索框 + getSearchAd = () => { + const {hrSyncStore} = this.props; + const {logSearchForm, status} = hrSyncStore; + const {logSearchFormCondition} = toJS(status); + + return IntegrationUtil.getAdvancedItem(logSearchForm, logSearchFormCondition, this.searchFun, false, this && this.props && this.props.ecId || '', "integrationHrSyncIndex"); + } + + searchFun = () => { + const { hrSyncStore } = this.props; + const {logSearchForm} = hrSyncStore; + hrSyncStore.getLogList(logSearchForm.getFormParams()); + hrSyncStore.setState({ showSearchAd: false }); + }; + + getTabButtonsAd() { + const { hrSyncStore } = this.props; + const {logSearchForm} = hrSyncStore; + let resetFun = () => logSearchForm.reset(); + let cancelFun = () => hrSyncStore.setState({showSearchAd: false}); + + return IntegrationUtil.getSearchBtns(this.searchFun, resetFun, cancelFun, this && this.props && this.props.ecId || '', "integrationHrSyncIndex"); + } + + /** + * 获取右键菜单 + * @returns {Array} + */ + getRightMenu() { + const { hrSyncStore } = this.props; + const {newForm, initialNewForm} = hrSyncStore; + const { selectedKey, rightMenus, rightMenusTab2, rowSelectIds, canexport, syncFlag, saveDisabled } = toJS(hrSyncStore.status); + const whichRightMenu = Number(selectedKey) === 0 ? rightMenus : Number(selectedKey) === 1 ? rightMenusTab2 : ''; + + let btnArr = []; + whichRightMenu && whichRightMenu.map(m => { + let btn = { + key: m.type, + icon: , + content: m.menuName, + onClick: () => this.onRightMenuClick(m.type) + }; + if (m.type == "BTN_EXP") { + if (!canexport) { + btn.disabled = true; + } else { + btn.disabled = false; + } + }else if(m.type == 'BTN_EXPDATA') { + btn.disabled = !this.state.hasSyncClick; + }else if(m.type == 'BTN_SYNC') { + btn.disabled = syncFlag; + }else if(m.type === "BTN_SAVE") { + btn.disabled = saveDisabled; + } + if (!(m.menuIcon === 'icon-coms-delete' && rowSelectIds.length === 0)) { + btnArr.push(btn); + } + }); + if (selectedKey === "1") { + if (initialNewForm.getFormParams()["isuselhr"] === "0"){ + return []; + } + if (initialNewForm.getFormParams()["hrmethod"] === "2") { + return []; + } + if(this.state.sync == false) { + return []; + } + } + + if(selectedKey === '2') { + // 添加列定制 + btnArr.push({ + key: "BTN_COLUMN", + icon: , + content: `${getLabel(32535, "显示列定制")}`, + onClick: () => this.onRightMenuClick("BTN_COLUMN") + }); + } + + return btnArr; + } + + getRightMenu2() { + const { hrSyncStore } = this.props; + const { importForm, getHrSyncSettingsOperation } = hrSyncStore; + const { selectedKey, rightMenus, rightMenusTab2, rowSelectIds } = toJS( + hrSyncStore.status + ); + let btnArr = []; + var btn = { + key: 'aaa', + icon: , + content: getLabel("725", "提交"), + onClick: () => { + this.doImport(); + } + }; + btnArr.push(btn); + + return btnArr; + } + + doImport() { + const { hrSyncStore } = this.props; + const { importForm, getHrSyncSettingsOperation } = hrSyncStore; + const { selectedKey, rightMenus, rightMenusTab2, rowSelectIds } = toJS( + hrSyncStore.status + ); + let params = Object.assign({ operation: "import" }, importForm.getFormParams()); + params.file = JSON.stringify(this.state.file); + params.filelist = JSON.stringify(this.state.filelist); + IntegrationUtil.onCheck(importForm, () => { + getHrSyncSettingsOperation(params, () => { + hrSyncStore.setState({ showImportForm: false }); + hrSyncStore.doInit(); + this.setState({filelist:[]}); + }) + }) + } + + /** + * 右键菜单点击事件 + * @param type + */ + getAllPrams = () => { + const { hrSyncStore } = this.props; + const { newForm, SyncSetTable, webserviceParamValuesData } = hrSyncStore; + const params = newForm.getFormParams(); + // 明细表数据 + // webservice 明细表 + const { + subWebserviceParamValuesData, + deptWebserviceParamValuesData, + jobWebserviceParamValuesData, + hrmWebserviceParamValuesData + } = toJS(webserviceParamValuesData); + const { + WeaTableEdit_subSyncFieldData, + WeaTableEdit_deptSyncFieldData, + WeaTableEdit_jobSyncFieldData, + WeaTableEdit_hrmSyncFieldData } = toJS(SyncSetTable); + + const New_WeaTableEdit_jobSyncFieldData = ((params.intetype == 1 && params.jobtable == '') || (params.intetype == 2 && params.jobmothod == "")) ? [] : WeaTableEdit_jobSyncFieldData; + const allParams = { + ...params, + isUnique: true, + subWebserviceParamValuesData: JSON.stringify(subWebserviceParamValuesData), + deptWebserviceParamValuesData: JSON.stringify(deptWebserviceParamValuesData), + jobWebserviceParamValuesData: JSON.stringify(jobWebserviceParamValuesData), + hrmWebserviceParamValuesData: JSON.stringify(hrmWebserviceParamValuesData), + WeaTableEdit_subSyncFieldData: JSON.stringify(WeaTableEdit_subSyncFieldData), + WeaTableEdit_deptSyncFieldData: JSON.stringify(WeaTableEdit_deptSyncFieldData), + WeaTableEdit_jobSyncFieldData: JSON.stringify(New_WeaTableEdit_jobSyncFieldData), + WeaTableEdit_hrmSyncFieldData: JSON.stringify(WeaTableEdit_hrmSyncFieldData) + }; + + [WeaTableEdit_subSyncFieldData, WeaTableEdit_deptSyncFieldData, New_WeaTableEdit_jobSyncFieldData, WeaTableEdit_hrmSyncFieldData].map(datas => { + let allConfig = ''; + + datas && datas.map(data => { + if (allConfig.indexOf(`(#@#)${data.oafieldspan}(#@#)`) < 0) { + allConfig += `(#@#)${data.oafieldspan}(#@#)`; + } else { + Modal.warning({ + title: getLabel("15172", "系统提示"), + content: getLabel('389520',"存在重复属性,请检查") + }) + allParams.isUnique = false; + return + } + }) + }) + + const WebserviceParamValuesData = [] + .concat(subWebserviceParamValuesData.map(item => ({ methodtype: 1, ...item }))) + .concat(deptWebserviceParamValuesData.map(item => ({ methodtype: 2, ...item }))) + .concat(jobWebserviceParamValuesData.map(item => ({ methodtype: 3, ...item }))) + .concat(hrmWebserviceParamValuesData.map(item => ({ methodtype: 4, ...item }))); + const syncFieldData = [] + .concat(WeaTableEdit_subSyncFieldData.map(item => ({ type: 1, ...item }))) + .concat(WeaTableEdit_deptSyncFieldData.map(item => ({ type: 2, ...item }))) + .concat(New_WeaTableEdit_jobSyncFieldData.map(item => ({ type: 3, ...item }))) + .concat(WeaTableEdit_hrmSyncFieldData.map(item => ({ type: 4, ...item }))) + allParams.WebserviceParamValuesData = JSON.stringify(WebserviceParamValuesData); + allParams.syncFieldData = JSON.stringify(syncFieldData); + return allParams; + } + + onRightMenuClick = (type, recordId) => { + const { hrSyncStore } = this.props; + const { + newForm, + dataSyncForm, + getHrSyncDataSyncOperation, + getHrSyncSettingsOperation, updateSyncData, logTableStore, status } = hrSyncStore; + switch (type) { + case "BTN_SAVE": + const allParams = this.getAllPrams(); + if((allParams.intetype == 2) && allParams.jobmothod) { + if(JSON.parse(allParams.WeaTableEdit_jobSyncFieldData).length == 0) { + Modal.warning({ + title: getLabel("15172", "系统提示"), + content: getLabel("32256", "岗位表必须有一个关键匹配标识字段,请选择") + }) + return; + }else { + let WeaTableEdit_jobSyncFieldData = JSON.parse(allParams.WeaTableEdit_jobSyncFieldData); + let keyIndex = WeaTableEdit_jobSyncFieldData.findIndex(data => data.iskeyfield == 1) + if(keyIndex == -1) { + Modal.warning({ + title: getLabel("15172", "系统提示"), + content: getLabel("32256", "岗位表必须有一个关键匹配标识字段,请选择") + }) + return; + } + } + } + if(allParams.isUnique) { + IntegrationUtil.onCheck(newForm, () => { + const result = hrSyncStore.syncSetField.table && hrSyncStore.syncSetField.table.doValidate(); + if (result && (!result.pass)) { + return; + } + // first validate + allParams.checkBeforeSave = true; + getHrSyncSettingsOperation(allParams, (result) => { + if (result && !result.error) { + // and save + delete allParams.checkBeforeSave; + getHrSyncSettingsOperation(allParams, () => { + if(result.ret == true) { + message.success(getLabel(22619, '保存成功')); + hrSyncStore.getHrSyncSettingsForm(); + hrSyncStore.getRightMenu(); + hrSyncStore.getHrSyncSettingsImportForm(); + } + }); + } else { + return; + } + }) + }) + } + break; + case "BTN_EXP": + // 集成设置导出 + const expAllParams = this.getAllPrams(); + Modal.confirm({ + title: getLabel("131329", "信息确认"), + content: getLabel("386087", "同步设置将以sql脚本文件的形式导出,确定要导出吗?"), + onOk: () => { + alert("The inteface named getHrSyncSettingsSqlFile is deleted!"); + /*getHrSyncSettingsOperation({ operation: "export", ...expAllParams }, (result) => { + window.location.href = (window.ecologyContentPath || "") + "/api/integration/hrsync/getHrSyncSettingsSqlFile"; + });*/ + }, + onCancel: () => { } + }) + break + case "BTN_IMP": + // 集成设置导入 + //status.showImportForm = true; + break; + case "BTN_SYNC": + const syncparams = dataSyncForm.getFormParams(); + getHrSyncDataSyncOperation(syncparams, (res) => { + this.setState({ hasSyncClick: true }); + updateSyncData(res); + }); + break; + case "BTN_EXPDATA": + window.location.href = (window.ecologyContentPath || "") + "/weaver/weaver.file.ExcelOut"; + break; + case "BTN_COLUMN": + logTableStore.setColSetVisible(true); + logTableStore.tableColSet(true); + } + }; + + /** + * 获取顶部按钮 + * @returns {Array} + */ + getBtns = () => { + const { hrSyncStore } = this.props; + const { status, newForm, initialNewForm } = hrSyncStore; + const { selectedKey, rightMenus, rightMenusTab2, rowSelectIds, loading, syncLoading, canexport, syncFlag, saveDisabled } = toJS(status); + let btnArr = []; + const whichRightMenu = Number(selectedKey) === 0 ? rightMenus : Number(selectedKey) === 1 ? rightMenusTab2 : []; + if (whichRightMenu) { + for (let j = 0; j < whichRightMenu.length; j++) { + if (j == 3) { + break + } + let m = whichRightMenu[j]; + let btn = null; + if (m.type === "BTN_EXPDATA") { + btn = ; + }else if(m.type === "BTN_SAVE") { + btn = ; + } else { + btn = + ; + } + btnArr.push(btn); + } + } + + // 未启用 数据同步隐藏按钮 + if (selectedKey === "1") { + if (initialNewForm.getFormParams()["isuselhr"] === "0"){ + return []; + } + if (initialNewForm.getFormParams()["hrmethod"] === "2") { + return []; + } + } + return btnArr; + }; + + getDialogBtns = () => { + return [ + ( + + ) + ] + } + + getDataSyncDescription = (form, condition=[]) => { + const {isFormInit} = form; + const formParams = form.getFormParams(); + let group = []; + + isFormInit && condition && condition.map((c, index) => { + let items = []; + c.items.map(fields => { + items.push({ + com: (
+ + + {fields.showOtherCom && otherCom} +
), + colSpan: 1 + }) + }); + group.push() + }) + + return group; + } + + handleChangeTab = (v) => { + const {hrSyncStore} = this.props; + const {initialNewForm, getLogList} = hrSyncStore; + const formParams = initialNewForm.getFormParams(); + + if(v == 1) { + this.setState({hasSyncClick: false, sync: true}); + let content = formParams["isuselhr"] === "0" ? getLabel("386893", "HR同步未启用!") + : formParams["hrmethod"] === "2" ? getLabel("32326", "未启用HR同步手动同步!") : ''; + + if (formParams["isuselhr"] === "0" || formParams["hrmethod"] === "2") { + this.setState({sync: false}); + hrSyncStore.setState({selectedKey: v}); + Modal.warning({ + title: getLabel("15172", "系统提示"), + content: content + }) + return; + } + // 刷新页面 + hrSyncStore.getHrSyncDataSyncForm(); + hrSyncStore.getHrSyncDataSyncRightMenu(); + }else if(v == 0) { + hrSyncStore.newForm = new WeaForm(); + hrSyncStore.initialNewForm = new WeaForm(); + hrSyncStore.getHrSyncSettingsForm(); + hrSyncStore.getRightMenu(); + hrSyncStore.getHrSyncSettingsImportForm(); + }else if(v == 2) { + hrSyncStore.getListConditions(); + getLogList(); + } + hrSyncStore.setState({selectedKey: v}); + } + + render() { + const { hrSyncStore } = this.props; + const { + status, + newForm, + dataSyncForm, + importForm, + syncTable, + hasRight, + rightLoading, + } = hrSyncStore; + const { + syncFieldRelationShipSummaryLabel, + showSearchAd, + newFormFields, + dataSyncFormFields, + selectedKey, + syncLoading, + advanceHeight, + showImportForm, + hasNonStandard, + nonStandLoading, + } = toJS(status); + const { + jobSyncResultHeaderList, + jobSyncResultDataList, + jobTypeSyncResultHeaderList, + jobTypeSyncResultDataList, + deptSyncResultHeaderList, + deptSyncResultDataList, + subSyncResultHeaderList, + subSyncResultDataList, + gwSyncResultHeaderList, + gwSyncResultDataList, + hrmSyncResultHeaderList, + hrmSyncResultDataList, + hqSyncResultHeaderList, + hqSyncResultDataList, + lastLineSyncResultDataList, + } = toJS(syncTable); + const {topTab} = this.state; + return (nonStandLoading + ? null + : hasNonStandard + ? rightLoading + ? null + : hasRight + ? + } + iconBgcolor="#1a57a0" + buttons={this.getBtns()} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{ + collectParams: { + favname: `${getLabel(33719, "HR同步")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/hrsync", + importantlevel: 1 + } + }} + /> + + hrSyncStore.setState({ showSearchAd: !showSearchAd }) + } + hideSearchAd={() => + hrSyncStore.setState({ showSearchAd: false }) + } + onChange={this.handleChangeTab} + onSearch={() => hrSyncStore.getDataShowList()} + onSearchChange={value => { + }} + /> + { + Number(selectedKey) === 2 + ? + : + { + Number(selectedKey) === 0 + ? ( + // 集成设置 +
+ {/* 基本信息 */} + {this.getFormSearchs(newForm, newFormFields)} + {/* 同步对应字段设置方法 */} + {newForm.getFormParams()["intetype"] !== "3" && ( +
+ + {/* 说明 */} + { + return `${syncFieldRelationShipSummaryLabel[item]}
`; + }).join('') + }} /> + }]} + /> +
+ )} + + { + status.showImportForm = false; + }} + buttons={this.getDialogBtns()} + moreBtn={{ + datas: this.getRightMenu2(), + collectParams: { + favname: getLabel("32935", "导入"), + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/hrsync", + importantlevel: 1 + } + }} + > + + {importForm.render({ col: 1 }, { + onChange: () => { } + }, true, (item, index) => { + switch (Number(index)) { + case 0: + return +
+ +
+ { this.setState({ file: ids, filelist: list }) }} + > + + +
+
+ {this.state.filelist.length == 0 ?

{getLabel("384040", "未选择任何文件")}

: this.state.filelist.map(file =>

{file.filename}

)} +
+
+
+
+ case 1: + return {item.items[0].value}
+ }]} + /> + } + })} +
+
+
+ ) + : ( + // 数据同步 +
+ {IntegrationUtil.getFormSearchs(dataSyncForm, [dataSyncFormFields[0]], true, true, "", "", null, this && this.props && this.props.ecId || '', "integrationHrSyncIndex")} + {syncLoading && ( +
+ + {getLabel('386883', '正在同步,请不要离开该页面,请稍后…')} +
+ )} + {!syncLoading && this.state.hasSyncClick && ( + +
+ {subSyncResultDataList.length > 0 && } + {jobSyncResultDataList.length > 0 && } + {jobTypeSyncResultDataList.length > 0 && } + {deptSyncResultDataList.length > 0 && } + {gwSyncResultDataList.length > 0 && } + {hrmSyncResultDataList.length > 0 && } + {hqSyncResultDataList.length > 0 && } + {lastLineSyncResultDataList.length > 0 && lastLineSyncResultDataList[0].lastLine} +
+
+ )} + {!syncLoading && (!this.state.hasSyncClick) && this.getDataSyncDescription(dataSyncForm, [dataSyncFormFields[2]])} +
+ ) + } + + } + + : + : + ); + } +} + +export default HrSync; diff --git a/pc4backstage/integration/components/hrsync/partial/SyncSetFields.js b/pc4backstage/integration/components/hrsync/partial/SyncSetFields.js new file mode 100644 index 0000000..8701da7 --- /dev/null +++ b/pc4backstage/integration/components/hrsync/partial/SyncSetFields.js @@ -0,0 +1,164 @@ + +import React from "react"; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Modal } from "antd"; +import { WeaTableEditable, WeaLocaleProvider, WeaTab, WeaButtonIcon} from "ecCom"; + +const { confirm } = Modal; +const getLabel = WeaLocaleProvider.getLabel; + +// 为了排序 所以写死, 因为是字段名,变了也要改代码,所以无妨 +const syncFileds = ['sub', 'dept', 'job', 'hrm']; + +@inject("hrSyncStore") +@observer +class SyncSetFields extends React.Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "0", + selectedRowDatas:[], + selectedRowKeys: [] + } + } + + getSyncTableEdit = () => { + const { hrSyncStore } = this.props; + const { newForm, SyncSetTable, setSyncSetTable } = hrSyncStore; + const + { WeaTableEdit_subSyncFieldSet, + WeaTableEdit_subSyncFieldData, + WeaTableEdit_hrmSyncFieldSet, + WeaTableEdit_hrmSyncFieldData, + WeaTableEdit_deptSyncFieldSet, + WeaTableEdit_deptSyncFieldData, + WeaTableEdit_jobSyncFieldSet, + WeaTableEdit_jobSyncFieldData, } = toJS(SyncSetTable); + const whichFields = [WeaTableEdit_subSyncFieldSet, WeaTableEdit_deptSyncFieldSet, WeaTableEdit_jobSyncFieldSet, WeaTableEdit_hrmSyncFieldSet]; + const whichDatas = [WeaTableEdit_subSyncFieldData, WeaTableEdit_deptSyncFieldData, WeaTableEdit_jobSyncFieldData, WeaTableEdit_hrmSyncFieldData]; + const params = newForm.getFormParams(); + const whichFather = [params.subcomtable, params.depttable, params.jobtable, params.hrmtable]; + if (whichFields[this.state.selectedKey] && whichFields[this.state.selectedKey][1]) { + if (newForm.getFormParams().intetype === "1") { + whichFields[this.state.selectedKey][1].com[0].browserConditionParam.dataParams = { + datasourceid: params.dbsource, + dmltablename: whichFather[this.state.selectedKey] + } + } else { + whichFields[this.state.selectedKey][1].com[0].type = "INPUT"; + } + } + return ( +
+ { hrSyncStore.syncSetField.table = el }} + rowKey="id" + tableProps={{ + showEmptyText: false, + scroll: {x: "100%"} + }} + showTitle={false} + // showCopy={false} + showAdd={false} + showDelete={false} + showCopy={false} + willDelete={this.willDelete} + selectedRowKeys={this.state.selectedRowKeys} + datas={whichDatas[this.state.selectedKey]} + columns={whichFields[this.state.selectedKey]} + onChange={(datas) => { + setSyncSetTable(this.state.selectedKey, datas) + }} + onRowSelect={v => { + this.setState({selectedRowDatas:v, selectedRowKeys: v}) + }} + validator={{ + rules: { + oafield: 'required', + outfield: 'required', + } + }} + /> +
+ ) + } + + willDelete = (datas, keys) => new Promise((resolve, reject) => { + confirm({ + content: `${getLabel(385625, '确定要删除选择的记录吗?')}`, + onOk: () => resolve(true), + onCancel: () => resolve(false) + }) + }) + + getBtn = () => { + const { hrSyncStore } = this.props; + let btnArr = []; + + btnArr.push( + {hrSyncStore.syncSetField.table.doAdd();}} buttonType='add' type="primary" />, + ); + + if(this.state.selectedKey == 0) { + btnArr.push([ + {hrSyncStore.syncSetField.table.doDelete();}} buttonType='del' type="primary" disabled={this.state.selectedRowDatas.length == 0 ? true : false} /> + ]); + }else if(this.state.selectedKey == 1) { + btnArr.push([ + {hrSyncStore.syncSetField.table.doDelete();}} buttonType='del' type="primary" disabled={this.state.selectedRowDatas.length == 0 ? true : false} /> + ]); + }else if(this.state.selectedKey == 2) { + btnArr.push([ + {hrSyncStore.syncSetField.table.doDelete();}} buttonType='del' type="primary" disabled={this.state.selectedRowDatas.length == 0 ? true : false} /> + ]); + }else if(this.state.selectedKey == 3) { + btnArr.push([ + {hrSyncStore.syncSetField.table.doDelete();}} buttonType='del' type="primary" disabled={this.state.selectedRowDatas.length == 0 ? true : false} /> + ]); + } + + return btnArr; + } + + render() { + const { hrSyncStore } = this.props; + const { status } = hrSyncStore; + const { + showSearchAd, + newFormFields, + dataSyncFormFields, + selectedKey, + syncFieldSettingsGroupLabel + } = toJS(status); + const tabs = [] + for (let i = 0; i < syncFileds.length; i++) { + tabs.push({ + color: "#000000", + groupid: "flowAll", + showcount: true, + title: syncFieldSettingsGroupLabel && syncFieldSettingsGroupLabel[syncFileds[i]], + viewcondition: i + }) + } + return ( +
+ {/* 同步关系设置说明 hrm deptjob*/} + { + this.setState({ selectedKey: v, selectedRowDatas: [], selectedRowKeys: [] }); + }} + className="no-bg" + buttons={this.getBtn()} + /> + {this.getSyncTableEdit()} +
+ ) + } +} +export default SyncSetFields; diff --git a/pc4backstage/integration/components/hrsync/style/index.less b/pc4backstage/integration/components/hrsync/style/index.less new file mode 100644 index 0000000..c896a11 --- /dev/null +++ b/pc4backstage/integration/components/hrsync/style/index.less @@ -0,0 +1,25 @@ +.boring-align { + .wea-form-cell { + padding-left: 10px; + } +} +.no-bg { + .wea-tab-right { + background: none; + } +} + + +/* + 同步表设置start +*/ +.hrsync-tablesetting .ant-col-12 { + width: 33%; +} + +.hrsync-tablesetting .wea-helpful-tip { + z-index: 2; +} +/* + 同步表设置end +*/ diff --git a/pc4backstage/integration/components/imrtx/IMInitDialog.js b/pc4backstage/integration/components/imrtx/IMInitDialog.js new file mode 100644 index 0000000..392e139 --- /dev/null +++ b/pc4backstage/integration/components/imrtx/IMInitDialog.js @@ -0,0 +1,43 @@ +import React from 'react'; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { WeaDialog, WeaProgress, WeaLocaleProvider } from "ecCom"; + +const {getLabel} = WeaLocaleProvider; + +@inject("imrtx") +@observer +export default class Main extends React.Component { + render() { + const { imrtx } = this.props; + const { status } = imrtx; + const { initializeVisible, initializeResult } = toJS(status); + return imrtx.closeInitialize()} + visible={initializeVisible} + style={{width: 500, height: 300}} + moduleName="integration" + > +
+

+ {getLabel('31151', "组织结构同步")} +

+ { + initializeResult.flag == 'error'? +
{initializeResult.errorMessage}
: + + } +


+

+ {getLabel('386890',"人员同步")} +

+ { + initializeResult.flag == 'error'? +
{initializeResult.errorMessage}
: + + } +
+
+ } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/imrtx/index.js b/pc4backstage/integration/components/imrtx/index.js new file mode 100644 index 0000000..d0ae3b0 --- /dev/null +++ b/pc4backstage/integration/components/imrtx/index.js @@ -0,0 +1,321 @@ +import React from "react"; +import {CopyToClipboard} from 'react-copy-to-clipboard'; +import { inject, observer } from "mobx-react"; +import { toJS } from "mobx"; +import { Button, message } from "antd"; +import { WeaTableNew, WeaSwitch } from "comsMobx"; +import * as IntegrationUtil from "../../util/IntegrationUtil"; +import NoRight from "../../public/NoRight"; +import IMInitDialog from './IMInitDialog'; +import { + WeaLocaleProvider, + WeaTop, + WeaTab, + WeaRightMenu, + WeaFormItem, + WeaTools, + WeaSearchGroup, + WeaNewScroll +} from "ecCom"; + +const { WeaTable } = WeaTableNew; +const { getKey } = WeaTools; +const getLabel = WeaLocaleProvider.getLabel; + +@inject("imrtx") +@observer +export default class IMrtx extends React.Component { + constructor(props) { + super(props); + this.state = { + topTab: [ + { + title: `${getLabel(81711, "基本信息")}`, + viewcondition: 0 + }, + { + title: `${getLabel(125928, "同步日志")}`, + viewcondition: 1 + } + ], + collectParams: { + favname: `${getLabel('386889', "IM集成设置")}`, + favouritetype: 1, + objid: 0, + link: "wui/engine.html#/integration/imrtx", + importantlevel: 1 + } + } + } + + componentWillReceiveProps(nextProps) { + const { imrtx } = this.props; + if (this.props.location.key !== nextProps.location.key) { + imrtx.doInit(); + } + } + + componentDidMount() { + const { imrtx } = this.props; + imrtx.doInit(); + } + + getRightMenu() { + const { imrtx } = this.props; + const { selectedKey} = toJS(imrtx.status); + let data = []; + if (selectedKey == 1) { + data = [{ + key: "BTN_COLUMN", + icon: "icon-coms-Custom", + content: getLabel(32535, "显示列定制") + }] + }else { + data = [{ + key: "save", + icon: "icon-coms-Preservation", + content: getLabel(86, "保存") + }, { + key: "test", + icon: "icon-coms-currency-Task", + content: getLabel(25496, "测试") + }, { + key: "initialize", + icon: "icon-coms-operation", + content: getLabel(20873, "初始化") + }] + } + + return data && data.map(v => { + return { + key: v.key, + icon: , + content: v.content, + onClick: () => this.onRightMenuClick(v.key) + } + }) + } + + getAdvancedSearch = () => { + const { imrtx } = this.props; + const { status, searchForm } = imrtx; + const { searchFormFields } = toJS(status); + + return IntegrationUtil.getAdvancedItem( + searchForm, + searchFormFields, + this.handleSearchFun, + false, + this && this.props && this.props.ecId || '', + "integrationImRtx", + ); + }; + + handleSearchFun = () => { + const { imrtx } = this.props; + imrtx.getTable(); + imrtx.setState({ showSearchAd: false }); + } + + getTabButtonsAd() { + const { imrtx } = this.props; + return IntegrationUtil.getSearchBtns( + this.handleSearchFun, + () => imrtx.searchForm.reset(), + () => imrtx.setState({ showSearchAd: false }), + this && this.props && this.props.ecId || '', + "integrationImRtx", + ); + } + + getBtns = () => { + let data = [{ + key: "save", + content: getLabel(86, "保存") + }, { + key: "test", + content: getLabel(25496, "测试") + }, { + key: "initialize", + content: getLabel(20873, "初始化") + }]; + return data.map(v => ); + }; + + + onRightMenuClick = type => { + const { imrtx } = this.props; + const { save, newBaseForm, initialize, status} = imrtx; + const params = newBaseForm.getFormParams(); + const { initializeResult } = toJS(status); + switch (type) { + case "save": + save(params); + break; + case "BTN_COLUMN": + imrtx.tableBaseInfo.setColSetVisible(true); + imrtx.tableBaseInfo.tableColSet(true); + break; + case "initialize": + if (initializeResult && initializeResult.flag && initializeResult.flag == 'syning') { + imrtx.initialize(); + } else { + IntegrationUtil.doConfirm(getLabel(81592, "是否开始同步"), imrtx.initialize); + } + break; + case "test": + params.method = "test"; + save(params); + break; + } + }; + + getFormSearchs = (form, datas) => { + const { imrtx } = this.props; + const { inputfaceOptions, inputface, getPassWord, status: {showOCSPassWord} } = imrtx; + const { isFormInit } = form; + const formParams = form.getFormParams(); + let group = []; + + isFormInit && datas && datas.map((c, index) => { + let items = []; + c.items && c.items.map(fields => { + items.push({ + com: ( + + { + getKey(fields) === "download" + ?
{ + window.location.href = `${location.origin}${fields.helpfulTip}`; + }}>{getLabel(31156, "下载")} + : + { + if(getKey(fields) === 'rtxOrElinkType') { + if(form.getFormParams().rtxOrElinkType=="1"){ + form.updateFields({inputface:inputfaceOptions.ocsInputface}); + getPassWord(); + }else{ + form.updateFields({inputface:inputfaceOptions.rtxInputface}); + } + } + }}/> + { + getKey(fields) === "inputface" + ? message.success(getLabel('126081', '地址已经复制成功,您可以使用Ctrl+v粘贴'))} + > + + + : "" + } + + } + + ), + colSpan: 1, + hide: form.isHide(fields, (keys, allParams)=> { + let hide = true; + let key = keys[0]; + if (allParams.rtxOrElinkType == '0' && ['rtxserverurl','rtxserverouturl','rtxserverport','rtxConnServer','rtxVersion','rtxDenyHrm', + 'rtxOnload','impwd','rtxAlert','userattr', + 'isDownload','download','userattr'].indexOf(key) > -1) { + hide = false; + } else if (allParams.rtxOrElinkType == '1' && ['domainName','rtxserverurl','rtxDenyHrm','rtxOnload','impwd', 'rtxConnServer', + 'rtxAlert','userattr','rtxLoginToOA','isDownload'].indexOf(key) > -1) { + hide = false; + } else if (allParams.rtxOrElinkType == '2' && ['rtxserverurl','rtxDenyHrm', + 'rtxOnload','rtxAlert','isDownload'].indexOf(key) > -1) { + hide = false; + } + if (key =='inputface' && allParams.rtxLoginToOA === '0') { + hide = true; + } else if (key =='inputface' && allParams.rtxLoginToOA === '1' && allParams.rtxOrElinkType == '1') { + hide = false; + } + if (key == 'isusedtx' || key == 'rtxOrElinkType') { + hide = false; + } + allParams.rtxOrElinkType == "1" && key === 'impwd' && showOCSPassWord == 0 && (hide = true); + return hide; + }) + }); + }); + group.push(); + }); + return group; + }; + + render() { + const { imrtx } = this.props; + const { status, tableBaseInfo, newBaseForm,hasRight, rightLoading } = imrtx; + const { selectedKey, showSearchAd, baseFormFields, advanceHeight } = toJS(status); + const { topTab, collectParams } = this.state; + + return ( + !rightLoading &&
+ { + hasRight + ? + } + iconBgcolor={IntegrationUtil.GeneralTitleColor.iconBgcolor} + buttons={selectedKey == 0 ? this.getBtns() : []} + showDropIcon={true} + dropMenuDatas={this.getRightMenu()} + dropMenuProps={{ + collectParams + }} + /> + imrtx.setState({ showSearchAd: !showSearchAd })} + hideSearchAd={() => imrtx.setState({ showSearchAd: false })} + onChange={(v)=> { + imrtx.setState({ selectedKey: v }) + if (v == 1) { + imrtx.getCondition(); + imrtx.searchForm.reset(); + imrtx.getTable(); + } else { + imrtx.getForm(); + } + }} + /> + { + selectedKey == 0 + ? + {this.getFormSearchs(newBaseForm, baseFormFields)} + + : + } + + + : + } +
+ ); + } +} diff --git a/pc4backstage/integration/components/ldap/InputSelect.js b/pc4backstage/integration/components/ldap/InputSelect.js new file mode 100644 index 0000000..15f845b --- /dev/null +++ b/pc4backstage/integration/components/ldap/InputSelect.js @@ -0,0 +1,112 @@ +import React from 'react' +import {Row,Button,Col} from "antd"; +import { WeaLocaleProvider,WeaInput,WeaSelect } from 'ecCom'; +import isEqual from "lodash/isEqual"; +import {toJS} from 'mobx'; +import {inject, observer} from 'mobx-react'; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject('ldapStore') +@observer +export default class InputSelect extends React.Component { + constructor(props) { + super(props); + this.state = { + value: props.value || '', + inputType: props.inputType || 'select', + selectConfig: props.selectConfig || {}, + inputConfig: props.inputConfig || {}, + isMust: props.isMust || false + + } + } + + componentDidMount() { + const { value,inputType,selectConfig,inputConfig,isMust } = this.props; + this.setState({ + value: value || '', + inputType: inputType || 'select', + selectConfig: selectConfig || {}, + inputConfig: inputConfig || {}, + isMust: isMust || false + + }); + } + componentWillReceiveProps(nextProps) { + const { value } = this.props; + const nextValue = nextProps.value; + + const selectConfig = nextProps.selectConfig; + const inputConfig = nextProps.inputConfig; + + if (!isEqual(value, nextValue) && nextValue) { + this.setState({value: nextValue}); + } + this.setState({ + selectConfig: selectConfig || {}, + inputConfig: inputConfig || {} + }); + } + + buttonClick = (inputType,key) => { + this.setState({ + inputType, + value: '', + isMust: false + }); + this.props.onChange && typeof(this.props.onChange) == "function" && this.props.onChange("",key); + } + + render(){ + + const { fieldsName = '',isInput = false, showName = '', customInterface=false} = this.props; + const { value,inputType, isMust} = toJS(this.state); + + let {selectConfig, inputConfig} = toJS(this.state); + + if(isMust){ + return ({showName}); + } else if(isInput || inputType == 'input'){ + inputConfig.value = value; + return ( + { + this.setState({ value ,isMust:false}); + this.props.onChange && typeof(this.props.onChange) == "function" && this.props.onChange(value,fieldsName); + }} + /> + + ); + } else if(!selectConfig || !selectConfig.options || !selectConfig.options.length || selectConfig.options.length == 0){ + inputConfig.value = value; + return ( + { + this.setState({ value ,isMust:false}); + this.props.onChange && typeof(this.props.onChange) == "function" && this.props.onChange(value,fieldsName); + }} + /> + ); + }else{ + selectConfig.value = value; + return ( + { + this.setState({value,isMust:false}); + this.props.onChange && typeof(this.props.onChange) == "function" && this.props.onChange(value,fieldsName); + }} + /> + + ); + } + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/ldap/LdapFilter.js b/pc4backstage/integration/components/ldap/LdapFilter.js new file mode 100644 index 0000000..5c4c642 --- /dev/null +++ b/pc4backstage/integration/components/ldap/LdapFilter.js @@ -0,0 +1,90 @@ +import React from 'react' +import {Button} from "antd"; + +import {WeaLocaleProvider,WeaCheckbox,WeaDialog,WeaTextarea,WeaSearchGroup,WeaFormItem} from "ecCom"; +import isEqual from "lodash/isEqual"; + +const getLabel = WeaLocaleProvider.getLabel; + +export default class LdapFilter extends React.Component { + constructor(props) { + super(props); + this.state = { + value: props.checkValue || '0', + filter: props.filterValue || '', + visible: false + } + } + + componentDidMount() { + const { checkValue, filterValue } = this.props; + this.setState({ + value: checkValue || '0', + filter: filterValue || '' + }); + } + componentWillReceiveProps(nextProps) { + const { checkValue, filterValue } = this.props; + const nextCheckValue = nextProps.checkValue; + const nextFilterValue = nextProps.filterValue; + + if (!isEqual(checkValue, nextCheckValue) && nextCheckValue) { + this.setState({checkValue: nextCheckValue }); + } + if (!isEqual(filterValue, nextFilterValue) && filterValue) { + this.setState({filterValue:nextFilterValue }); + } + } + + render() { + const { checkKey = '',filterKey = '', type = '' ,title = ''} = this.props; + const { value,filter,visible } = this.state; + + let disabled = !(value && value=='1'); + let submit = !(filter && filter!=''); + + return ( + { + this.setState({value:value}); + this.props.onChange && typeof(this.props.onChange) == "function" + && this.props.onChange({[filterKey]:filter},checkKey,value); + + }}> + + + + {this.setState({visible:false});}} + visible={visible} + style={{width: 700, height: 150}} + hasScroll + buttons={[ + , + , + ]} + > + + + { + this.setState({filter:value}); + }} + /> + + + + ); + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/ldap/index.js b/pc4backstage/integration/components/ldap/index.js new file mode 100644 index 0000000..ed66c37 --- /dev/null +++ b/pc4backstage/integration/components/ldap/index.js @@ -0,0 +1,1804 @@ +import React from 'react'; +import List from '../../public/list/components/ListComponent'; +import BaseSet from '../../public/baseSet/components/BaseSetComponent'; +import LdapFilter from './LdapFilter'; +import InputSelect from './InputSelect'; + +import {inject, observer} from 'mobx-react'; +import {toJS} from 'mobx'; +import {Button, message, Row,Modal} from "antd"; +import {WeaDialog, WeaLocaleProvider, WeaRightMenu, WeaNewScroll, WeaTab, WeaTable, WeaSearchGroup, WeaHelpfulTip} from "ecCom"; + +const getLabel = WeaLocaleProvider.getLabel; + +@inject('ldapStore') +@observer +export default class Ldap extends React.Component { + constructor(props) { + super(props); + const {ldapStore} = this.props; + ldapStore.setState({ + baseApiUrl: '/api/integration/ldap/base', + listApiUrl: '/api/integration/ldap/list', + showBase: false, + initList: false, + baseDatas: {}, + key: Math.random().toString(36).substr(2, 6), + baseKey: Math.random().toString(36).substr(2, 6) + }); + } + + componentDidMount() { + this.props.ldapStore.setState({ + selectedKey: "base" + }) + } + + /** + * 列表菜单点击 + * @param type + * @param datas + */ + onListMenuClick = (type, datas) => { + const {ldapStore} = this.props; + const { status, listStore } = ldapStore; + const { selectedKey } = toJS(status); + const { rowSelectIds } = toJS(listStore.status); + if (selectedKey === 'base') { + if (type == 'BTN_ADD') {//新建 + ldapStore.setState({ + showBase: true, + dialogType: "base", + baseApiUrl: '/api/integration/ldap/base', + baseDatas: {} + }); + } + + if (type == 'BTN_BatchDelete') {// 批量删除 + this.batchDelete({ + ldapId: rowSelectIds, + type: "base" + }); + } + } + if (selectedKey === 'custominterface') { + if (type == 'BTN_ADD') {//新建 + ldapStore.setState({ + showBase: true, + dialogType: "custominterface", + baseApiUrl: '/api/integration/ldap/custominterfacebase', + baseDatas: {} + }); + } + if (type == 'BTN_BatchDelete') {// 批量删除 + var ids = toJS(ldapStore.listStore.status.rowSelectIds); + this.batchDelete({ + formartid: ids, + type: "custominterface" + }); + } + } + if(selectedKey === 'useraccount') { + if(type === 'BTN_DESIGN_DEPARTMENT') { + ldapStore.setState({ + showBase: true, + dialogType: "userdesigndepartment", + baseTabKey: "base", + baseApiUrl: '/api/integration/ldap/userdesigndepartment', + baseDatas: { + ldapId: rowSelectIds, + } + }); + }else if (type === "BTN_MERGE_USER") { + ldapStore.setState({ + showBase: true, + dialogType: "useraccountmatchbase", + baseTabKey: "base", + baseApiUrl: '/api/integration/ldap/useraccountmatchbase', + baseDatas: { + ldapId: rowSelectIds, + } + }); + } + } + } + + /** + * 列表行点击 + * @param record + * @param index + * @param operate + * @param flag + */ + onListRowClick = (record, index, operate, flag) => { + const { ldapStore } = this.props; + const { status } = ldapStore; + const { selectedKey } = toJS(status); + if (selectedKey === 'base') { + if (operate && operate.type) { + const {ldapStore} = this.props; + + // 测试 + if(operate.type == 'BTN_TEST') { + ldapStore.baseTableEdit = []; + ldapStore.setState({ + showTestVersion: true, + dialogType: "test", + baseTabKey: "base", + testInitDatas: {}, + errorMessage: '', + baseApiUrl: '/api/integration/ldap/test', + baseDatas: { + ldapId: record.ldapid, + ldapType: record.ldaptype + } + }); + ldapStore.getTestFields(); + ldapStore.getTestMenu(); + ldapStore.getBase('base'); + } else if (operate.type == "BTN_EDIT") { + ldapStore.setState({ + showBase: true, + dialogType: "base", + baseTabKey: "", + baseApiUrl: '/api/integration/ldap/base', + baseDatas: { + ldapId: record.ldapid + } + }); + } else if (operate.type == "BTN_DEL") { + this.deleteLdap({ldapId: record.ldapid}); + + } else if (operate.type == "BTN_PULL") { + ldapStore.baseTableEdit = []; + ldapStore.setState({ + showBase: true, + dialogType: "pull", + baseTabKey: "base", + baseApiUrl: '/api/integration/ldap/pull', + baseDatas: { + ldapId: record.ldapid, + ldapType: record.ldaptype + } + }); + } else if (operate.type == "BTN_PUSH") { + ldapStore.baseTableEdit = []; + ldapStore.setState({ + showBase: true, + dialogType: "push", + baseTabKey: "base", + baseApiUrl: '/api/integration/ldap/push', + baseDatas: { + ldapId: record.ldapid, + ldapType: record.ldaptype + } + }); + } else if (operate.type == "BTN_SYNC_LOG") { + ldapStore.setState({ + showBase: true, + showLogDetail: false, + dialogType: "synclog", + baseApiUrl: '/api/integration/ldap/synclog', + baseDatas: { + ldapId: record.ldapid + } + }); + }else if (operate.type == "BTN_DEL_LOG") { + this.deleteLdap({ + logId: record.logId, + ldapId: record.ldapId + }); + + }else if (operate.type == "BTN_LOG") { + ldapStore.setState({ + logDatas: { + show: true, + targetId: record.ldapid + } + }); + } + } + }else{ + if (operate && operate.type) { + if (operate.type == "BTN_DEL") { + this.deleteLdap({formartid: record.formartid}); + }else if (operate.type == "BTN_EDIT" || operate.type == "BTN_DETAIL") { + ldapStore.baseSetStore.setButtonShowStatus(record.formartlevel); + ldapStore.baseSetStore.setInputModifyType(operate.type); + ldapStore.setState({ + showBase: true, + dialogType: "custominterface", + baseTabKey: "", + baseApiUrl: '/api/integration/ldap/custominterfacebase', + baseDatas: { + formartid: record.formartid + } + }); + }else if(operate.type === "BTN_DESIGN_DEPARTMENT") { + ldapStore.setState({ + showBase: true, + dialogType: "userdesigndepartment", + baseTabKey: "base", + baseApiUrl: '/api/integration/ldap/userdesigndepartment', + baseDatas: { + ldapId: [record.randomFieldId], + } + }); + }else if(operate.type === "BTN_DESIGN_MERGE_USER") { + ldapStore.setState({ + showBase: true, + dialogType: "usermerge", + baseTabKey: "base", + baseApiUrl: '/api/integration/ldap/usermerge', + baseDatas: { + ldapId: record["ID"], + loginid: record["LOGINID"], + ldapType: record.ldaptype + } + }); + } + } + } + } + + /** + * 列表列点击 + * @param record + * @param type + */ + onColumClick = (record, type) => { + const {ldapStore} = this.props; + const { status } = ldapStore; + const { selectedKey } = toJS(status); + + if (selectedKey === 'base') { + if (type && type == "BTN_EDIT") { + ldapStore.setState({ + showBase: true, + dialogType: "base", + baseApiUrl: '/api/integration/ldap/base', + baseDatas: { + ldapId: record.ldapid + } + }); + }else if(type && type == "BTN_DETAIL_LOG"){ + ldapStore.setState({ + showLogDetail: true, + dialogType: "synclogdetail", + baseApiUrl: '/api/integration/ldap/getLogDetial', + baseDatas: { + logId: record.logId + } + }); + } + }else{ + if (type && type == "BTN_EDIT") { + ldapStore.baseSetStore.setButtonShowStatus(record.formartlevel); + ldapStore.setState({ + showBase: true, + dialogType: "custominterface", + baseTabKey: "", + baseApiUrl: '/api/integration/ldap/custominterfacebase', + baseDatas: { + formartid: record.formartid + } + }); + } + } + } + + /** + * 弹框按钮点击 + * @param type + * @param form + * @param tableDatas + * @param refs + */ + onBaseMenuClick = (type, form, tableDatas, refs) => { + const {ldapStore} = this.props; + const {status} = ldapStore; + const {dialogType, baseTabKey, baseDatas} = toJS(status); + if (type && type == "BTN_SAVE") { + if ("base" == dialogType) { + //基础信息保存 + ldapStore.saveBase(form); + } else if ("pull" == dialogType) { + if (!baseTabKey || "" == baseTabKey || "base" == baseTabKey) { + //正向同步,同步节点保存 + this.configPullSync(tableDatas, refs); + } else if ("mapping" == baseTabKey) { + //正向同步,字段映射保存 + this.configPullMapping(tableDatas, refs); + } else if ("sync" == baseTabKey) { + //正向同步,手动同步 + this.runSync("run", form); + } else if("schedule" == baseTabKey) { + ldapStore.configSchedule(form); + } + } else if ("push" == dialogType) { + if (!baseTabKey || "" == baseTabKey || "base" == baseTabKey) { + //反向同步,同步节点保存 + this.configPushSync(tableDatas, refs); + } else if ("mapping" == baseTabKey) { + //反向同步,字段映射保存 + this.configPushMapping(tableDatas, refs); + } else if ("sync" == baseTabKey) { + //反向同步,手动同步 + this.runSync("oarun", form); + } else if("schedule" == baseTabKey) { + ldapStore.configSchedule(form); + } + }else if("custominterface" == dialogType){ + // 自定义接口基础信息保存 + ldapStore.saveCustomInterfaceBase(form); + } + } else if (type && type == "BTN_DEL") { + const {ldapStore} = this.props; + const {status} = ldapStore; + const {baseDatas} = toJS(status); + + if (baseDatas && baseDatas.ldapId) { + this.deleteLdap({ldapId: baseDatas.ldapId}); + } + } else if (type && type == "BTN_BatchDelete_Log") { + const {ldapStore} = this.props; + var ids = toJS(ldapStore.baseSetStore.status.rowSelectIds); + this.batchDelete({ + logId: ids, + type: "synclog" + }); + } else if(type && type === "BTN_CONFIRM") { + if(dialogType === "userdesigndepartment") { + let params = form.getFormParams(); + form.validateForm().then(f => { + if(f.isValid) { + ldapStore.updateUserInfo({...params, userIds: baseDatas.ldapId, subcompanyId: ldapStore.baseSetStore.status.subcompanyId}); + }else { + f.showErrors(); + } + }) + } else if(dialogType === 'usermerge') { + let params = form.getFormParams(); + form.validateForm().then(f => { + if(f.isValid) { + ldapStore.mergeUserInfo({targetId: params.userId , modifyId: baseDatas.ldapId, loginid: baseDatas.loginid}); + }else { + f.showErrors(); + } + }) + } + } else if(type && type === "BTN_CANCLE") { + if(dialogType === "userdesigndepartment" || dialogType === "usermerge") { + ldapStore.setState({ + showBase: false + }) + } + } else if(type && type === "BTN_MATCH_TEST") { + let params = form.getFormParams(); + form.validateForm().then(f => { + if(f.isValid) { + ldapStore.getTestMatchData(params); + }else { + f.showErrors(); + } + }) + } else if(type && type === "BTN_BATCH_MERGE") { + let params = form.getFormParams(); + form.validateForm().then(f => { + if(f.isValid) { + ldapStore.batchMergeUserInfo(params); + }else { + f.showErrors(); + } + }) + } + } + + /** + * 手动同步 + * @param form + */ + runSync = (type, form) => { + + const {ldapStore} = this.props; + form && form.isFormInit && form.validateForm().then(f => { + if (f.isValid) { + if (form.getFormDatas().isSync && form.getFormDatas().isSync.value == "1") { + message.error(getLabel(131202, '该同步正在运行中,不可重复运行,您可以查看运行详情')); + return; + } else { + form.updateFields({ + isSync: "1", + syncLogShow: getLabel(131322, '同步程序正在初始化……') + "\n\r" + }); + } + + ldapStore.runSync(type, form); + + } else { + f.showErrors(); + } + }); + } + + /** + * 配置反向同步字段映射 + * @param tableDatas + * @param refs + */ + configPushMapping = (tableDatas, refs) => { + //反向同步字段映射保存 + + const {ldapStore} = this.props; + const {template, baseTableEdit} = ldapStore; + + //未配置有效的同步节点 + if (!baseTableEdit || !baseTableEdit || baseTableEdit.length <= 0) { + message.error(this.stringFormart(getLabel(131534, '请至%s设置%s'), [getLabel(21952, '同步设置'), getLabel(125555, '同步节点')])); + return; + } + + if (!refs) { + return; + } + + let submitDatas = []; + for (let tableKey of baseTableEdit) { + if (!refs[tableKey] || !refs[tableKey].doValidate().pass) { + return; + } + + let lable = ''; + let templateKey = ''; + if ("pushSubcompanySet" == tableKey) { + lable = getLabel(82267, '分部同步字段对应设置'); + templateKey = "oasubcompany"; + } else if ("pushDepartmentSet" == tableKey) { + lable = getLabel(82268, '部门同步字段对应设置'); + templateKey = "oadepartment"; + } else if ("pushUserSet" == tableKey) { + lable = getLabel(32239, ' 人员同步对应关系设置 '); + templateKey = "oauser"; + } + + //至少配置一个 + if (!tableDatas || !tableDatas[tableKey] || !tableDatas[tableKey].length || tableDatas[tableKey].length <= 0) { + message.error(getLabel(131183, '至少设置一个') + lable); + return; + } + + + let allConfig = ''; + + for (let elem of tableDatas[tableKey].values()) { + //同步域重名检测 + let showName = elem.attributeName; + if (template && template[templateKey] && template[templateKey].options) { + for (let t of template[templateKey].options.values()) { + if (showName == t.key) { + showName = t.showname; + } + } + } + + if(allConfig.indexOf(`(#@#)${showName}(#@#)`) < 0) { + allConfig += `(#@#)${showName}(#@#)`; + }else { + message.error(`${lable}(${showName}) ${getLabel(18082, '重复')}`); + return + } + } + + if("pushSubcompanySet" === tableKey){ + var flag = this.judgeAttributeName("name",tableDatas[tableKey]); + lable = getLabel(82267, '分部同步字段对应设置'); + // if(flag == false){ + // message.error(`${lable}-${getLabel(390997,'请添加LDAP分部名称')}(name)`); + // return; + // } + var oper = this.judgeOperation("name",tableDatas[tableKey]); + var ldapLable = getLabel(391339,'LDAP分部名称'); + if("1" === oper){ + message.error(`${ldapLable}(name)${getLabel(391335,'操作类别为仅添加,则其他对应字段操作类别需设置为仅添加')}`); + return; + } + if("2" === oper){ + message.error(`${ldapLable}(name)${getLabel(391336,'操作类别为仅修改,则其他对应字段操作类别需设置为仅修改')}`); + return; + } + + } + else if("pushDepartmentSet" === tableKey){ + var flag = this.judgeAttributeName("name",tableDatas[tableKey]); + lable = getLabel(82268, '部门同步字段对应设置'); + // if(flag == false){ + // message.error(`${lable}-${getLabel(391000,'请添加LDAP部门名称')}(name)`); + // return; + // } + var oper = this.judgeOperation("name",tableDatas[tableKey]); + var ldapLable = getLabel(391340,'LDAP部门名称'); + if("1" === oper){ + message.error(`${ldapLable}(name)${getLabel(391335,'操作类别为仅添加,则其他对应字段操作类别需设置为仅添加')}`); + return; + } + if("2" === oper){ + message.error(`${ldapLable}(name)${getLabel(391336,'操作类别为仅修改,则其他对应字段操作类别需设置为仅修改')}`); + return; + } + } + else if("pushUserSet" === tableKey){ + var flag = this.judgeAttributeName("sAMAccountName",tableDatas[tableKey]); + lable = getLabel(32239, ' 人员同步对应关系设置 '); + //if(flag == false){ + // message.error(`${lable}-${getLabel(390999,'请添加LDAP用户帐号')}(sAMAccountName)`); + // return; + //} + var oper = this.judgeOperation("sAMAccountName",tableDatas[tableKey]); + var ldapLable = getLabel(391341,'LDAP用户帐号'); + if("1" === oper){ + message.error(`${ldapLable}(name)${getLabel(391335,'操作类别为仅添加,则其他对应字段操作类别需设置为仅添加')}`); + return; + } + if("2" === oper){ + message.error(`${ldapLable}(name)${getLabel(391336,'操作类别为仅修改,则其他对应字段操作类别需设置为仅修改')}`); + return; + } + } + submitDatas.push(...tableDatas[tableKey]); + } + ldapStore.configMapping("push", {mapping: JSON.stringify(submitDatas)}); + } + + /** + * 配置正向同步字段映射 + * @param tableDatas + * @param refs + */ + configPullMapping = (tableDatas, refs) => { + //正向同步字段映射保存 + const {ldapStore} = this.props; + const {status, template, baseTableEdit} = ldapStore; + const {baseDatas} = toJS(status); + + //未配置有效的同步节点 + if (!baseTableEdit || !baseTableEdit || baseTableEdit.length <= 0) { + message.error(this.stringFormart(getLabel(131534, '请至%s设置%s'), [getLabel(21952, '同步设置'), getLabel(125555, '同步节点')])); + ldapStore.baseTableEdit = []; + ldapStore.setState({ + showBase: true, + dialogType: "pull", + baseTabKey: "base", + baseApiUrl: '/api/integration/ldap/pull', + baseDatas: baseDatas + }); + return; + } + + if (!refs) { + return; + } + + let submitDatas = []; + for (let tableKey of baseTableEdit) { + if (!refs[tableKey] || !refs[tableKey].doValidate().pass) { + return; + } + + let lable = ''; + let templateKey = ''; + if ("subcompanySet" == tableKey) { + lable = getLabel(82267, '分部同步字段对应设置'); + templateKey = "subcompany"; + } else if ("departmentSet" == tableKey) { + lable = getLabel(82268, '部门同步字段对应设置'); + templateKey = "department"; + } else if ("userSet" == tableKey) { + lable = getLabel(32239, ' 人员同步对应关系设置 '); + templateKey = "user"; + } + + //至少配置一个 + if (!tableDatas || !tableDatas[tableKey] || !tableDatas[tableKey].length || tableDatas[tableKey].length <= 0) { + message.error(getLabel(131183, '至少设置一个') + lable); + return; + } + + + let allConfig = ''; + for (let elem of tableDatas[tableKey].values()) { + let showName = elem.attributeName; + + if (template && template[templateKey] && template[templateKey].options) { + for (let t of template[templateKey].options.values()) { + if (showName == t.key) { + showName = t.showname; + } + } + } + //同步域重名检测 + if (allConfig.indexOf(`(#@#)${showName}(#@#)`) < 0) { + allConfig += `(#@#)${showName}(#@#)`; + } else { + message.error(`${lable}(${showName}) ${getLabel(18082, '重复')}`); + return + } + } + + if("subcompanySet" === tableKey){ + var flag = this.judgeAttributeName("subcompanyname",tableDatas[tableKey]); + lable = getLabel(82267, '分部同步字段对应设置'); + if(flag == false){ + message.error(`${lable}-${getLabel(390994,'请添加OA分部名称')}(subcompanyname)`); + return; + } + var oper = this.judgeOperation("subcompanyname",tableDatas[tableKey]); + var oaLable = getLabel(391338,'OA分部名称'); + if("1" === oper){ + message.error(`${oaLable}(subcompanyname)${getLabel(391335,'操作类别为仅添加,则其他对应字段操作类别需设置为仅添加')}`); + return; + } + if("2" === oper){ + message.error(`${oaLable}(subcompanyname)${getLabel(391336,'操作类别为仅修改,则其他对应字段操作类别需设置为仅修改')}`); + return; + } + + } + else if("departmentSet" === tableKey){ + var flag = this.judgeAttributeName("departmentmark",tableDatas[tableKey]); + lable = getLabel(82268, '部门同步字段对应设置'); + if(flag == false){ + message.error(`${lable}-${getLabel(390995,'请添加OA部门标识')}(departmentmark)`); + return; + } + var oper = this.judgeOperation("departmentmark",tableDatas[tableKey]); + var oaLable = getLabel(391337,'OA部门标识'); + if("1" === oper){ + message.error(`${oaLable}(departmentmark)${getLabel(391335,'操作类别为仅添加,则其他对应字段操作类别需设置为仅添加')}`); + return; + } + if("2" === oper){ + message.error(`${oaLable}(departmentmark)${getLabel(391336,'操作类别为仅修改,则其他对应字段操作类别需设置为仅修改')}`); + return; + } + } + else if("userSet" === tableKey){ + var flag = this.judgeAttributeName("loginid",tableDatas[tableKey]); + lable = getLabel(32239, ' 人员同步对应关系设置 '); + if(flag == false){ + message.error(`${lable}-${getLabel(390996,'请添加OA用户标识')}(loginid)`); + return; + } + var oper = this.judgeOperation("loginid",tableDatas[tableKey]); + var oaLable = getLabel(391334,'OA用户账号'); + if("1" === oper){ + message.error(`${oaLable}(loginid)${getLabel(391335,'操作类别为仅添加,则其他对应字段操作类别需设置为仅添加')}`); + return; + } + if("2" === oper){ + message.error(`${oaLable}(loginid)${getLabel(391336,'操作类别为仅修改,则其他对应字段操作类别需设置为仅修改')}`); + return; + } + } + submitDatas.push(...tableDatas[tableKey]); + } + + ldapStore.configMapping("pull", {mapping: JSON.stringify(submitDatas)}); + } + + judgeAttributeName = (attrname,arr) => { + var flag = false; + for(let elem of arr.values()){ + if(attrname === elem.attributeName){ + flag = true; + } + } + return flag; + } + + judgeOperation = (attrname,arr) =>{ + let compareOper; + let addOper = []; + let editOper = []; + for(let elem of arr.values()){ + if(attrname === elem.attributeName){ + compareOper = elem.attributeOperation; + continue; + } + if("1" === elem.attributeOperation){ + addOper.push(elem.attributeOperation); + } + if("2" === elem.attributeOperation){ + editOper.push(elem.attributeOperation); + } + if("0" === elem.attributeOperation){ + addOper.push(elem.attributeOperation); + editOper.push(elem.attributeOperation); + } + } + if("1" === compareOper){ + if(editOper.length>0){ + return "1"; + } + } + if("2" === compareOper){ + if(addOper.length>0){ + return "2"; + } + } + } + + stringFormart = function (str, val) { + for (let i = 0; i < val.length; i++) { + str = str.replace("%s", val[i]); + } + return str; + } + + + /** + * 配置正向同步同步节点 + * @param tableDatas + * @param refs + */ + configPullSync = (tableDatas, refs) => { + //正向同步同步节点保存 + //同步节点 必填校验 + if (!refs || !refs.syncSet || !refs.syncSet.doValidate().pass) { + return; + } + + //OU组织类型设置 必填校验 + if (!refs || !refs.attributeSet || !refs.attributeSet.doValidate().pass) { + return; + } + + //至少配置一个同步节点 + if (!tableDatas || !tableDatas.syncSet || !tableDatas.syncSet.length || tableDatas.syncSet.length <= 0) { + message.error(`${getLabel(131183, '至少设置一个')}${getLabel(125555, '同步节点')}`); + return; + } + + let isMustOrg = false; + if (!tableDatas || !tableDatas.attributeSet || !tableDatas.attributeSet.length || tableDatas.attributeSet.length <= 0) { + isMustOrg = true; + } + + let check = true; + let allConfig = ''; + for (let elem of tableDatas.syncSet.values()) { + + //同步域重名检测 + let data = elem.baseDomain.replace(/^(\s*)|(\s*)$/g, ''); + if (allConfig.indexOf(`(#@#)${data}(#@#)`) < 0) { + allConfig += `(#@#)${data}(#@#)`; + } else { + message.error(getLabel(32287, '同步域') + data + getLabel(18082, '重复')); + return + } + + //未设置OU组织类型时,同步节点必须指定部门 + if (isMustOrg && elem.syncOrg == "1" && (!elem.departmentId || elem.departmentId == "" || elem.departmentId == "0")) { + //请设置OU组织类型或为所有的组织结构指定部门 + message.error(`${getLabel(131185, '请设置OU组织类型或为所有的组织结构指定部门!')}`); + return; + } + + if (check && (elem.syncOrg == "1" || elem.syncUser == "1")) { + check = false; + } + } + + // if (check) { + // //同步节点中至少开启一个同步组织结构或用户 + // message.error(`${getLabel(131533, '至少开启一个同步组织结构或用户')}`); + // return; + // } + + let ouConfig = ''; + for(let elem of tableDatas.attributeSet.values()) { + // OU组织类型设置 + let attributeName = elem.attributeName.replace(/^(\s*)|(\s*)$/g, ''); + let attributeValue = elem.attributeValue.replace(/^(\s*)|(\s*)$/g, ''); + if(ouConfig.indexOf(`(#@#)${attributeName}+${attributeValue}(#@#)`) < 0) { + ouConfig += `(#@#)${attributeName}+${attributeValue}(#@#)`; + }else { + message.error(getLabel(82372, 'OU类型的标识属性') + attributeName + ',' + getLabel(129025, '属性值') + attributeValue + getLabel(18082, '重复')); + return + } + } + + //let params = [...tableDatas.syncSet, ...tableDatas.attributeSet]; + let params = { + sync:JSON.stringify(tableDatas.syncSet), + auttibute:JSON.stringify(tableDatas.attributeSet) + }; + const {ldapStore} = this.props; + ldapStore.configSync("pull", params); + } + + /** + * 配置反向同步同步节点 + * @param tableDatas + * @param refs + */ + configPushSync = (tableDatas, refs) => { + //反向同步同步节点保存 + //同步节点 必填校验 + if (!refs || !refs.pushSyncSet || !refs.pushSyncSet.doValidate().pass) { + return; + } + + //OU组织类型设置 必填校验 + if (!refs || !refs.pushAttributeSet || !refs.pushAttributeSet.doValidate().pass) { + return; + } + + //至少配置一个同步节点 + if (!tableDatas || !tableDatas.pushSyncSet || !tableDatas.pushSyncSet.length || tableDatas.pushSyncSet.length <= 0) { + message.error(`${getLabel(131183, '至少设置一个')}${getLabel(125555, '同步节点')}`); + return; + } + + let check = true; + let allOrgConfig = ''; + let allUserConfig = ''; + for (let elem of tableDatas.pushSyncSet.values()) { + if(elem.syncOrg != '0' || elem.syncUser != '0') { + let tempOrgVal = `(#@#)${elem.subcompanyId}(||)${elem.departmentId}(||)${elem.syncOrg}(#@#)`; + let tempUserVal = `(#@#)${elem.subcompanyId}(||)${elem.departmentId}(||)${elem.syncUser}(#@#)`; + //同步域重名检测 + if (allOrgConfig.indexOf(tempOrgVal) < 0 && allUserConfig.indexOf(tempUserVal) < 0) { + allOrgConfig += tempOrgVal; + allUserConfig += tempUserVal; + } else { + message.error(getLabel(125555, '同步节点') + " ( " + elem.subcompanyIdspan + " ) " + getLabel(18082, '重复')); + return + } + + if (check && (elem.syncOrg == "1" || elem.syncUser == "1")) { + check = false; + } + } + } + + if (check) { + //同步节点中至少开启一个同步组织结构或用户 + message.error(`${getLabel(131533, '至少开启一个同步组织结构或用户')}`); + return; + } + + // ou组织类型设置的数据添加showOrder + tableDatas.pushAttributeSet && tableDatas.pushAttributeSet.map((data, index) => { + let attributeName = data.attributeName; + data.showOrder = attributeName === 'subkey' ? '1' : attributeName === 'subValue' ? '2' : attributeName === 'subClass' ? '3' + : attributeName === 'depkey' ? '4' : attributeName === 'depValue' ? '5' : attributeName === 'depClass' ? '6' + : attributeName === 'userkey' ? '7' : attributeName === 'userValue' ? '8' : attributeName === 'userClass' ? '9' : ''; + }) + + let params = { + sync:JSON.stringify(tableDatas.pushSyncSet), + auttibute:JSON.stringify(tableDatas.pushAttributeSet) + }; + //[...tableDatas.pushSyncSet, ...tableDatas.pushAttributeSet]; + const {ldapStore} = this.props; + ldapStore.configSync("push", params); + } + + /** + * 删除LDAP + * @param params + */ + deleteLdap = (params) => { + const {ldapStore} = this.props; + const { status } = ldapStore; + const { selectedKey, dialogType } = toJS(status); + Modal.confirm({ + title: `${getLabel(386786, '信息确认')}`, + content: `${getLabel(15097, '确定要删除吗?')}`, + okText: `${getLabel(16631, '确定')}`, + cancelText: `${getLabel(31129, '取消')}`, + onOk: () => { + if(selectedKey == 'base'){ + if(dialogType == 'synclog' || dialogType == 'synclogdetail'){ + ldapStore.deleteLdapSyncLog(params); + }else{ + ldapStore.deleteLdap(params); + } + }else{ + ldapStore.deleteCustomInterface(params); + } + + }, + }); + } + + /** + * 批量删除 + * + */ + batchDelete = (params) => { + const {ldapStore} = this.props; + Modal.confirm({ + title: `${getLabel(386786, '信息确认')}`, + content: `${getLabel(385625, '确定要删除选择的记录吗?')}`, + okText: `${getLabel(16631, '确定')}`, + cancelText: `${getLabel(31129, '取消')}`, + onOk: () => { + if(params.type == 'custominterface'){ + ldapStore.deleteCustomInterface(params); + }else if(params.type == 'synclog'){ + ldapStore.deleteLdapSyncLog(params); + }else if(params.type == 'base') { + delete params.type; + ldapStore.deleteLdap(params); + } + } + }); + }; + + /** + * 弹框Tab点击 + * @param tabKey + */ + onBaseTabChange = (tabKey) => { + const {ldapStore} = this.props; + const {status, getBase} = ldapStore; + const {dialogType, baseDatas} = toJS(status); + + ldapStore.template = []; + ldapStore.baseTableEdit = []; + if ("pull" == dialogType) { + if (tabKey && tabKey == "base") { + ldapStore.setState({ + baseTabKey: tabKey, + baseApiUrl: '/api/integration/ldap/pull', + }); + } else if (tabKey && tabKey == "mapping") { + ldapStore.initFormart("ldap"); + ldapStore.setState({ + baseTabKey: tabKey, + baseApiUrl: '/api/integration/ldap/pullMapping', + }); + } else if (tabKey && tabKey == "sync") { + ldapStore.setState({ + baseTabKey: tabKey, + baseApiUrl: '/api/integration/ldap/pullSync', + }); + } else if (tabKey && tabKey == "schedule") { + Object.assign(baseDatas, {syncType:dialogType}); + + ldapStore.setState({ + baseDatas: baseDatas, + baseTabKey: tabKey, + baseApiUrl: '/api/integration/ldap/schedule', + }); + } + } else if ("push" == dialogType) { + if (tabKey && tabKey == "base") { + ldapStore.setState({ + baseTabKey: tabKey, + baseApiUrl: '/api/integration/ldap/push', + }); + } else if (tabKey && tabKey == "mapping") { + ldapStore.initFormart("oa"); + ldapStore.setState({ + baseTabKey: tabKey, + baseApiUrl: '/api/integration/ldap/pushMapping', + }); + } else if (tabKey && tabKey == "sync") { + ldapStore.setState({ + baseTabKey: tabKey, + baseApiUrl: '/api/integration/ldap/pushSync', + }); + } else if (tabKey && tabKey == "schedule") { + Object.assign(baseDatas, {syncType:dialogType}); + + ldapStore.setState({ + baseDatas: baseDatas, + baseTabKey: tabKey, + baseApiUrl: '/api/integration/ldap/schedule', + }); + } + } else if("test" == dialogType) { + if(tabKey && tabKey == 'base') { + getBase('base'); + }else if(tabKey && tabKey == 'pull'){ + getBase('pull'); + }else if(tabKey && tabKey == 'push') { + getBase('push'); + } + } + } + + /** + * 列表Tab点击 + * @param tabKey + */ + onTabListChange = (tabKey) => { + const {ldapStore} = this.props; + const {status, getBase} = ldapStore; + + if ("base" == tabKey) { + ldapStore.setState({ + selectedKey: tabKey, + listApiUrl: '/api/integration/ldap/list', + }); + } else if ("custominterface" == tabKey) { + ldapStore.setState({ + selectedKey: tabKey, + listApiUrl: '/api/integration/ldap/custominterface', + }); + } else if("useraccount" == tabKey) { + ldapStore.setState({ + selectedKey: tabKey, + listApiUrl: '/api/integration/ldap/useraccount', + }); + } + } + + willEdit = ( editType, rowKey, datas, result) =>{ + const { + baseTabKey, + } = this.props.ldapStore.status; + const {key,record} = result; + let ret = new Object(); + if(key=="subcompanyId"){ + ret["datas"] = datas.map(data => { + if(data[rowKey] === record[rowKey]) { + ret["cells"] = [{ + [rowKey]: record[rowKey], + departmentId: { + com: [{ + viewAttr: 2, + editType: 1, + label: "", + type: "BROWSER", + browserConditionParam: { + type: "4", + title: getLabel(27511,"部门"), + icon: "icon-coms-hrm", + iconBgcolor: "#217346", + hasAddBtn: false, + hasAdvanceSerach: true, + hasBorder: false, + hideVirtualOrg: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: true, + linkUrl: (window.ecologyContentPath || "") + "/spa/hrm/engine.html#/hrmengine/organization?showTree=false&type=department&id=", + showCheckStrictly: true, + dataParams:{ + subcompanyid1:data.subcompanyId == '' ? '-1' : data.subcompanyId + }, + tabs: [{ + isSearch: false, + key: "2", + name: getLabel(25332,"组织结构"), + selected: false, + showOrder: 0 + },{ + dataParams: { + list: "1" + }, + isSearch: true, + key: "1", + name: getLabel(130619,"按列表"), + selected: false, + showOrder: 0 + }] + }, + key: "departmentId" + }] + } + }]; + //return data; + return { + ...data, + departmentId: "", + departmentIdspan: "" + } + } + return data; + }); + return ret; + } + if(key=="attributeType"){ + ret["datas"] = datas.map(data => { + let attributeObj = {}; + if(["mapping"].includes(baseTabKey)) { + attributeObj = {attributeValue: ""}; + } + if(data[rowKey]===record[rowKey]){ + if(data.attributeType=="1" || data.attributeType=="2") { + data.attributeOperation = "1"; + + } + return { + ...data, + ...attributeObj, + } + } + return { + ...data, + }; + }); + return ret; + } + ret["datas"] = datas; + return ret; + } + + /** + * 初始化TableEdit + * @param editType + */ + initBaseTableEdit = (editType) => { + const {ldapStore} = this.props; + const {baseSetStore} = ldapStore; + + ldapStore.baseTableEdit.push(editType); + let p = []; + let isRun = true; + if ("subcompanySet" == editType || "pushSubcompanySet" == editType) { + let p1 = ldapStore.getTemplate("subcompany"); + let p2 = ldapStore.getTemplate("oasubcompany"); + p.push(p1, p2); + } else if ("departmentSet" == editType || "pushDepartmentSet" == editType) { + + let p1 = ldapStore.getTemplate("department"); + let p2 = ldapStore.getTemplate("oadepartment"); + p.push(p1, p2); + + } else if ("userSet" == editType || "pushUserSet" == editType) { + + let p1 = ldapStore.getTemplate("user"); + let p2 = ""; + if("userSet" == editType) { + p2 = ldapStore.getTemplate("ldapToOauser"); + } else if("pushUserSet" == editType) { + p2 = ldapStore.getTemplate("oauser"); + } + p.push(p1, p2); + } else if ("pushAttributeSet" == editType) { + + let p1 = ldapStore.getTemplate("oaou"); + let p2 = ldapStore.getTemplate("subcompany"); + let p3 = ldapStore.getTemplate("department"); + let p4 = ldapStore.getTemplate("user"); + p.push(p1, p2, p3, p4); + + } else { + isRun = false; + } + Promise.all(p).finally((result) => { + baseSetStore.tableInit(editType); + }); + } + + /** + * 初始化同步节点自定义组件 + * @param editType + * @param com + * @returns {{key, type: {label: string, type: string, viewAttr: string, key: string, width: number}[], render: function(*, *, *, *): *}} + */ + initBaseTableEditColumn = (editType, com) => { + + const {ldapStore} = this.props; + const {status} = ldapStore; + const {baseDatas} = toJS(status); + if (editType && com && com.key) { + if (editType == "syncSet") { + return this.getLdapFilter(com); + } else if (editType == "subcompanySet") { + if (com.key == "attributeName") { + return this.getInputSelect("subcompany", com); + } else if (com.key == "attributeValue") { + return this.getInputSelect("oasubcompany", com); + } + } else if (editType == "departmentSet") { + if (com.key == "attributeName") { + return this.getInputSelect("department", com); + } else if (com.key == "attributeValue") { + return this.getInputSelect("oadepartment", com); + } + } else if (editType == "userSet") { + if (com.key == "attributeName") { + return this.getInputSelect("user", com); + } else if (com.key == "attributeValue") { + return this.getInputSelect("ldapToOauser", com); + } + } else if (editType == "pushAttributeSet") { + return this.getInputSelectOfPush("oaou", com); + + } else if (editType == "pushSubcompanySet") { + if (com.key == "attributeName") { + return this.getInputSelect("oasubcompany", com); + } else if (com.key == "attributeValue") { + return this.getInputSelect("subcompany", com); + } + } else if (editType == "pushDepartmentSet") { + if (com.key == "attributeName") { + return this.getInputSelect("oadepartment", com); + } else if (com.key == "attributeValue") { + return this.getInputSelect("department", com); + } + } else if (editType == "pushUserSet") { + if (com.key == "attributeName") { + return this.getInputSelect("oauser", com); + } else if (com.key == "attributeValue") { + return this.getInputSelect("user", com); + } + } + } + } + + /** + * + * 获取LDAP过虑配置组件 + * + * @param com + * @returns {{key, type: {label: string, type: string, viewAttr: string, key: string, width: number}[], render: function(*, *=, *, *): *}} + */ + getLdapFilter = (com) => { + const {ldapStore} = this.props; + const {status} = ldapStore; + const {baseDatas} = toJS(status); + + if (com.key == "syncOrg") { + let defFilter = '(|(objectClass=organization)(objectClass=organizationalUnit))'; + if ("AD" == baseDatas.ldapType) { + defFilter = "(|(objectClass=organization)(objectClass=organizationalUnit))"; + } + return { + key: com.key, + type: com.type, + render: (text, record, index, onEdit) => ( + { + Object.assign(record, values); + onEdit({record, index, key, value}); + }} + > + ) + } + } else if (com.key == "syncUser") { + let defFilter = '(|(objectClass=user)(objectClass=person))'; + if ("AD" == baseDatas.ldapType) { + defFilter = "(|(objectClass=user)(objectClass=person))"; + } + return { + key: com.key, + type: com.type, + render: (text, record, index, onEdit) => ( + { + Object.assign(record, values); + onEdit({record, index, key, value}); + }} + > + ) + } + } + } + + /** + * 反向同步INPUT、Select切换控件 + * @param type + * @param com + * @returns {{key, type: {label: string, type: string, viewAttr: string, key: string, width: number}[], render: function(*, *, *, *)}} + */ + getInputSelectOfPush = (type, com) => { + const {ldapStore} = this.props; + const {template, formart} = ldapStore; + return { + key: com.key, + type: com.type, + render: (text, record, index, onEdit) => { + let options = []; + let isMust = false; + let showName = ''; + + if (com.key == "attributeValue" && record.attributeType && record.attributeType == "0") { + let valueType; + if ("subValue" == record.attributeName) { + valueType = "subcompany"; + } else if ("depValue" == record.attributeName) { + valueType = "department"; + } else if ("userValue" == record.attributeName) { + valueType = "user"; + } + options = template && template[valueType] && template[valueType].options ? template[valueType].options.slice() : []; + + } else if (com.key == "attributeName") { + if (template && template[type] && template[type].datas && template[type].datas[record.attributeName]) { + isMust = true; + showName = template[type].datas[record.attributeName].showName; + } + } + + let inputType = 'input'; + let value; + if (com.key == 'attributeName') { + value = record.attributeName; + } else if (com.key == 'attributeValue') { + value = record.attributeValue; + } + if (!value || value == "" && options.length > 0) { + inputType = 'select'; + } else { + for (let v of options) { + if (v && v.key && v.key == value) { + inputType = 'select'; + } + } + } + + + return ( { + onEdit({record, index, key, value}); + }} + >); + } + } + } + + /** + * 获取Input、Select切换组件 + * @param type + * @param com + * @returns {{key, type: {label: string, type: string, viewAttr: string, key: string, width: number}[], render: function(*, *=, *, *)}} + */ + getInputSelect = (type, com) => { + const {ldapStore} = this.props; + const {template, formart} = ldapStore; + + return { + key: com.key, + type: com.type, + render: (text, record, index, onEdit) => { + let options = []; + let isMust = false; + let showName = ''; + + if (com.key == "attributeValue") { + if (record.attributeType && record.attributeType == "2") { + options = formart ? formart.slice() : []; + } else { + options = template && template[type] && template[type].options ? template[type].options.slice() : []; + } + } else if (com.key == "attributeName") { + if (template && template[type] && template[type].datas) { + if (template[type].datas[record.attributeName] + && template[type].datas[record.attributeName].isMust == "1") { + isMust = true; + showName = template[type].datas[record.attributeName].showName; + } else { + isMust = false; + let datas = template[type].datas; + for (let op in datas) { + if (datas[op].isMust != "1") { + options.push({ + key: op, + showname: datas[op].showName + }); + } + } + } + } + } + + let inputType = 'input'; + let value; + if (com.key == 'attributeName') { + value = record.attributeName; + } else if (com.key == 'attributeValue') { + value = record.attributeValue; + } + + + for (let v of options) { + if (v && v.key && v.key == value) { + inputType = 'select'; + } + } + + if(!value || (value == '' && options.length > 0) || (value && options.length == 0)) { + inputType ='select'; + } + + // if (!value || value == "" && options.length > 0) { + // inputType = 'select'; + // } else { + // for (let v of options) { + // if (v && v.key && v.key == value) { + // inputType = 'select'; + // } + // } + // } + /** + * 对应字段后面的 切换 按钮,是什么情况下都不会置灰的; + * 字段对应值那儿的 切换 按钮,在数据类型为 自定义接口 和 固定值 时,是置灰的 + */ + return ( { + //如果是属性名,同时修改默认属性值类型、默认属性值 + if (key == "attributeName" && template && template[type] && template[type].datas + && template[type].datas[value]) { + + Object.assign(record, template[type].datas[value]); + if("1" === record.attributeType) { + Object.assign(record,{attributeOperation:"1"}); + } else{ + Object.assign(record,{attributeOperation:"0"}); + } + } + onEdit({record, index, key, value}); + }} + >); + } + } + } + + /** + * 禁用行 + * @param editType + * @param rowSelection + * @returns {{}} + */ + getRowSelection = (editType, rowSelection) => { + const sel = {...rowSelection}; + if (editType == "attributeSet" || editType == "subcompanySet" || editType == "departmentSet" + || editType == "userSet" || editType == "pushSubcompanySet" || editType == "pushDepartmentSet" + || editType == "pushUserSet") { + + sel.getCheckboxProps = record => { + return {disabled: record.isMust == "1"}; + }; + } else if (editType == "pushAttributeSet") { + return undefined; + } + + return sel; + } + + initTableData = (editType,rowKey,datas) =>{ + let ret = new Object(); + let cells = new Array(); + + if(datas){ + for(let data of datas){ + if(data.subcompanyId){ + cells.push({ + [rowKey]: data[rowKey], + departmentId: { + com: [{ + viewAttr: 2, + editType: 1, + label: "", + type: "BROWSER", + browserConditionParam: { + type: "4", + title: getLabel(27511,"部门"), + icon: "icon-coms-hrm", + iconBgcolor: "#217346", + hasAddBtn: false, + hasAdvanceSerach: true, + hasBorder: false, + hideVirtualOrg: false, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: true, + linkUrl: (window.ecologyContentPath || "") + "/spa/hrm/engine.html#/hrmengine/organization?showTree=false&type=department&id=", + showCheckStrictly: true, + dataParams:{ + subcompanyid1:data.subcompanyId + }, + tabs: [{ + isSearch: false, + key: "2", + name: getLabel(25332,"组织结构"), + selected: false, + showOrder: 0 + },{ + dataParams: { + list: "1" + }, + isSearch: true, + key: "1", + name: getLabel(130619,"按列表"), + selected: false, + showOrder: 0 + }] + }, + key: "departmentId" + }] + } + }); + } + } + } + ret.cells = cells; + return ret; + } + + getBase = () => { + const {ldapStore} = this.props; + const {getBase} = ldapStore; + + getBase('base'); + } + + getBtns = () => { + const {ldapStore} = this.props; + const {buttoninfo} = toJS(ldapStore.status); + + let btnArr = []; + buttoninfo && buttoninfo.map(b => { + btnArr.push( + ); + }); + return btnArr; + } + + getMoreBtn = () => { + const {ldapStore} = this.props; + const {moreBtninfo} = toJS(ldapStore.status); + let btnArr = []; + moreBtninfo && moreBtninfo.map(m => { + btnArr.push({ + key: m.key, + icon: , + content: m.btnName, + onClick: () => this.onRightMenuClick(m.type) + }); + }); + return btnArr; + } + + onRightMenuClick = () => { + const {ldapStore} = this.props; + const {topinfo} = toJS(ldapStore.status); + + ldapStore.getBase(topinfo.tab.selectedKey); + } + + getRightMenu = () => { + const {ldapStore} = this.props; + const {menuinfo} = toJS(ldapStore.status); + let btnArr = []; + menuinfo && menuinfo.map(m => { + btnArr.push({ + key: m.type, + icon: , + content: m.menuName, + onClick: () => this.onRightMenuClick(m.type) + }); + }); + return btnArr; + } + + getTab = () => { + const {ldapStore} = this.props; + const {status} = ldapStore; + const {topinfo} = toJS(status); + + if (topinfo && topinfo.tab) { + return ( { + var that = this; + setTimeout(function(){ + topinfo.tab.selectedKey = tabKey; + ldapStore.setState({ + topinfo: topinfo, + testInitDatas: {}, + errorMessage: '', + }); + ldapStore.getBase(tabKey); + }, 300) + }} + />); + } + } + + getColumns = (columns) => { + let datas = []; + + columns && columns.map(column => { + if(column['key'] == 'status') { + datas.push({ + dataIndex: column['dataIndex'], + key: column['key'], + sorter: column['sorter'], + title: column['title'], + render: (text, record) => { + if(text == '1') { + return + }else if(text == '0') { + return ×{record.details != undefined ? : ''} + }else if(text == '2') { + return !{record.details != undefined ? : ''} + } + } + }) + }else { + datas.push({ + dataIndex: column['dataIndex'], + key: column['key'], + sorter: column['sorter'], + title: column['title'] + }) + } + }) + + return datas; + } + + getTest = () => { + const {ldapStore} = this.props; + const {status} = ldapStore; + const {testColumns, testTitle, testInitDatas} = toJS(status); + let group = []; + + for(let key in testInitDatas) { + let items = []; + items.push({ + com: ( + ), + colSpan: 1 + }) + group.push(); + } + + return group; + } + + getErrorMessage = () => { + const {ldapStore} = this.props; + const {status} = ldapStore; + const {errorMessage} = toJS(status); + + return

{errorMessage}

+ } + + render() { + const {ldapStore} = this.props; + const {status, listStore, baseSetStore} = ldapStore; + const {listApiUrl, baseApiUrl, baseDatas, showBase, showLogDetail, key, baseKey, logDatas, testInitDatas, dialogType, showTestVersion, topinfo, collectinfo, errorMessage} = toJS(status); + + return
+ { + ldapStore.setState({ + logDatas: { + show: false, + targetId: '' + } + }); + }} + colums={ + [ + { + type: 'BTN_EDIT', + key: 'ldapid' + }, + { + type: 'BTN_EDIT', + key: 'formartid' + } + ] + } + onMenuClick={this.onListMenuClick} + onRowClick={this.onListRowClick} + onColumClick={this.onColumClick} + onTabListChange={this.onTabListChange} + /> + { + ldapStore.ldapRef = r + }} + key={baseKey} + dialogType={dialogType} + apiUrl={baseApiUrl} + show={showBase} + showLogDetail={showLogDetail} + baseSetStore={baseSetStore} + datas={baseDatas} + initTableData={this.initTableData} + onMenuClick={this.onBaseMenuClick} + onTabChange={this.onBaseTabChange} + initTableEdit={this.initBaseTableEdit} + initCustomColum={this.initBaseTableEditColumn} + getRowSelection={this.getRowSelection} + willEdit={this.willEdit} + onRowClick={this.onListRowClick} + onColumClick={this.onColumClick} + onCancel={() => { + ldapStore.setState({ + showBase: false, + showLogDetail: false + }); + }} + colums={ + [ + { + type: 'BTN_DETAIL_LOG', + key: 'ldapId' + }, + { + type: 'BTN_DETAIL_LOG', + key: 'fileName' + } + ] + } + /> + + ldapStore.setState({showTestVersion: false})} + hasScroll={true} + title={topinfo.title} + icon={topinfo.icon} + iconBgcolor={topinfo.iconColor} + style={{width: 800, height: 600}} + buttons={this.getBtns()} + moreBtn={this.getMoreBtn().length > 0 ? { + datas: this.getMoreBtn(), + collectParams: collectinfo + } : []} + > + + {this.getTab()} + + {errorMessage == '' ? this.getTest() : this.getErrorMessage()} + + + +
+ } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/login/AlgorithmFormSetting.js b/pc4backstage/integration/components/login/AlgorithmFormSetting.js new file mode 100644 index 0000000..3042868 --- /dev/null +++ b/pc4backstage/integration/components/login/AlgorithmFormSetting.js @@ -0,0 +1,279 @@ +import { + inject, + observer, +} from 'mobx-react' +import { + WeaFormItem, + WeaSearchGroup, + WeaLocaleProvider, +} from 'ecCom' +import { + Spin, +} from 'antd' +import { + WeaSwitch +} from 'comsMobx' +const getLabel = WeaLocaleProvider.getLabel + +@inject('intelogin') +@observer +export default class AlgorithmFormSetting extends React.Component { + constructor(props) { + super(props); + } + + componentDidMount() { + this.props.intelogin.getAlgorithmForm(); + } + + componentWillUnmount() { + this.props.intelogin.resetAlgorithmForm(); + } + + getForm = () => { + const { + intelogin + } = this.props, { + algorithmForm, + mainTable, + } = intelogin, { + form, + condition, + } = algorithmForm, { + isFormInit, + } = form, { + isSysAlgorithm + } = mainTable; + + let outterArray = []; + isFormInit && condition.forEach((c, i) => { + let innerArray = [], + eleStyle = (i == 1 ? {margin: "0 -20px"} : {}); + + c && c.items && c.items.forEach(field => { + const key = field.domkey[0]; + + if (i == 0 && this.filter({ + isSysAlgorithm, + key + })) { + return + } + + innerArray.push({ + com: (
+ + + +
), + colSpan: 1 + }) + + if (i == 0) { + innerArray = [...innerArray, { + com: ( + this.add({ + isSysAlgorithm, + key, + form, + }) + ), + colSpan: 1 + }] + } + }) + outterArray.push( + + ) + }) + return outterArray; + } + + filter = (params) => { + const { + isSysAlgorithm, + key + } = params; + + if (!isSysAlgorithm && (key == 'isneedpwd' || key == 'password' || key == 'isneediv' || key == 'ivparam')) { + return true + } + } + + add = (params) => { + const { + isSysAlgorithm, + key, + form, + } = params; + + let temp = []; + if (!isSysAlgorithm && key == 'decryptmethod') { + ['getPwd', 'getIv'].map(f => { + temp.push(this[f]({ + form, + })) + }); + } + + return temp; + } + + getPwd = (params) => { + const { + intelogin + } = this.props, { + algorithmForm + } = intelogin, { + pwd, + isneedpwd, + } = algorithmForm, { + form + } = params; + + return ( + +
+ {pwd.map((field, index) => { + if (isneedpwd !== '1' && index == 1) return + + return ( + this.handleChange(cb)}/> + ) + })} +
+
+ ) + } + + getIv = (params) => { + const { + intelogin + } = this.props, { + algorithmForm + } = intelogin, { + iv, + isneediv + } = algorithmForm, { + form + } = params; + + return ( + +
+ {iv.map((field, index) => { + if (isneediv !== '1' && index == 1) return + + return ( + this.handleChange(cb)}/> + ) + })} +
+
+ ) + } + + handleChange = (cb) => { + const { + intelogin + } = this.props, { + exportafsSelectedValue, + checkTableFieldValueUnique, + mainTable, + algorithmForm, + } = intelogin, { + id + } = mainTable; + + Object.entries(cb).map(arr => { + const key = arr[0], + t = arr[1], + val = Array.isArray(t.value) ? t.value[0] : t.value; + + exportafsSelectedValue({ + val, + key + }); + + (key == 'encryptname') && ['outter_encryptclass_sys', 'outter_encryptclass'].map((v, i) => { + // 加密算法有两个入口,集成设置新建弹窗自定义加密算法入口和加密tab页新建入口,因此校验的时候需要注意 + checkTableFieldValueUnique({ + tableName: v, + fieldName: 'encryptname', + fieldValue: val.replace(/^(\s*)|(\s*)$/g, ''), + idName: 'id', + idValue: algorithmForm.from ? "" : id + }, i, algorithmForm.from); + }) + + }); + } + + render() { + const { + intelogin, + } = this.props, { + algorithmForm, + } = intelogin, { + loading, + } = algorithmForm; + + if (loading) { + return ( +
+ +
+ ) + } else { + return ( +
+ {this.getForm()} +
+ ) + } + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/login/AlgorithmTestForm.js b/pc4backstage/integration/components/login/AlgorithmTestForm.js new file mode 100644 index 0000000..9bb3560 --- /dev/null +++ b/pc4backstage/integration/components/login/AlgorithmTestForm.js @@ -0,0 +1,131 @@ +import { + inject, + observer, +} from 'mobx-react' +import { + WeaSearchGroup, + WeaFormItem, + WeaLocaleProvider, +} from 'ecCom' +import { + WeaSwitch +} from 'comsMobx' +import { + Spin, +} from 'antd' +const getLabel = WeaLocaleProvider.getLabel + +@inject('intelogin') +@observer +export default class AlgorithmTestForm extends React.Component { + constructor(props) { + super(props); + } + + componentDidMount() { + this.props.intelogin.getAlgorithmTestForm() + } + + componentWillUnmount() { + this.props.intelogin.resetAlgorithmTestForm() + } + + getTestResult = () => { + const { + intelogin + } = this.props, { + algorithmTestForm, + } = intelogin, { + testResult + } = algorithmTestForm; + + return testResult && Object.entries(testResult).map(arr => { + return ( +
+ {arr[0]} + { + (arr[1] == '0') + ? + : + } +
+ ) + }); + } + + getForm = () => { + const { + intelogin + } = this.props, { + algorithmTestForm, + } = intelogin, { + condition, + form, + } = algorithmTestForm, { + isFormInit + } = form; + + let outterArray = []; + isFormInit && condition.map((c, i) => { + let innerArray = []; + c.items.map((field) => { + const key = field.domkey[0]; + innerArray.push({ + com: ( + + {} + + ), + colSpan: 1 + }) + }) + outterArray.push() + }) + + return outterArray; + } + + render() { + const { + intelogin + } = this.props, { + algorithmTestForm, + } = intelogin, { + loading, + } = algorithmTestForm; + + + if (loading) { + return ( +
+ +
+ ) + } else { + return ( +
+ + {this.getForm()} +
+ ) + } + + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/login/ErrorDialog.js b/pc4backstage/integration/components/login/ErrorDialog.js new file mode 100644 index 0000000..aca0be8 --- /dev/null +++ b/pc4backstage/integration/components/login/ErrorDialog.js @@ -0,0 +1,47 @@ +import { + inject, + observer +} from 'mobx-react' +import { + WeaDialog, +} from 'ecCom' +import { toJS } from "mobx"; +import { Button } from "antd"; + +@inject('intelogin') +@observer +export default class ErrorDialog extends React.Component { + constructor(props) { + super(props); + this.state = {} + } + + render() { + const {intelogin} = this.props; + const {showErrorDialog,errorMessage} = toJS(intelogin.status); + + let buttons = [ + , + ]; + return ( +
+ { + intelogin.setState({showErrorDialog : false}); + }} + buttons={buttons} + > +
+

{errorMessage}

+
+
+
+ ) + } +} \ No newline at end of file diff --git a/pc4backstage/integration/components/login/Expression.js b/pc4backstage/integration/components/login/Expression.js new file mode 100644 index 0000000..d713bf9 --- /dev/null +++ b/pc4backstage/integration/components/login/Expression.js @@ -0,0 +1,113 @@ +import { + inject, + observer, +} from 'mobx-react' +import { + WeaInput, + WeaNewScroll, + WeaHelpfulTip, + WeaLocaleProvider, +} from 'ecCom' +const getLabel = WeaLocaleProvider.getLabel + +import TextArea from './TextArea'; + +@inject('intelogin') +@observer +export default class Expression extends React.Component { + constructor(props) { + super(props); + } + + componentDidMount() { + this.props.intelogin.getAllParams(); + } + + componentWillUnmount() { + this.props.intelogin.resetExpression(); + } + + + render() { + const { + intelogin + } = this.props, { + expression, + exportDelimiter, + insertDelimiter, + insertParams, + } = intelogin, { + allParams, + value, + } = expression; + + const regExp = /[`~!@#$%^&*()_+<>?:"{},.\/;'[\]·!#¥(——):;“”‘、,|《。》?、【】[\]]/im; + + return ( +
+
+
+
+ + {getLabel(1361, '基本信息')} +
+
+
{getLabel(15636,'表达式')}
+
+