提交 dffc1441 authored 作者: 钟是志's avatar 钟是志
...@@ -16,13 +16,14 @@ export default class AuditPage extends Component { ...@@ -16,13 +16,14 @@ export default class AuditPage extends Component {
componentDidMount() {} componentDidMount() {}
handleButtonSet = () => { handleButtonSet = () => {
const { hasBatchAudit, batchAuditButtonName, noNeedForm } = this.props; const { hasBatchAudit, batchAuditButtonName, noNeedForm, tab2Buttons = [] } = this.props;
return { return {
tab1: [ tab1: [
hasBatchAudit hasBatchAudit
? { ? {
type: 'audit', type: 'audit',
component: 'RenderComponent', component: 'RenderComponent',
key: 'audit',
render: ({ selectRows, getPage }) => { render: ({ selectRows, getPage }) => {
const disabled = !selectRows || !Array.isArray(selectRows) || !selectRows.length; const disabled = !selectRows || !Array.isArray(selectRows) || !selectRows.length;
function handleClick(onShow) { function handleClick(onShow) {
...@@ -42,9 +43,14 @@ export default class AuditPage extends Component { ...@@ -42,9 +43,14 @@ export default class AuditPage extends Component {
onShow(); onShow();
} }
return ( return (
<AuditModal selectRows={selectRows} getPage={getPage} noNeedForm={noNeedForm}> <AuditModal selectRows={selectRows}
getPage={getPage}
noNeedForm={noNeedForm}
key={'audit'}
>
{({ onShow }) => ( {({ onShow }) => (
<ButtonDiy <ButtonDiy
key={'audit'}
name={batchAuditButtonName || '批量审核'} name={batchAuditButtonName || '批量审核'}
handleClick={() => handleClick(onShow)} handleClick={() => handleClick(onShow)}
disabled={disabled} disabled={disabled}
...@@ -56,7 +62,7 @@ export default class AuditPage extends Component { ...@@ -56,7 +62,7 @@ export default class AuditPage extends Component {
} }
: false, : false,
].filter((i) => i), ].filter((i) => i),
tab2: [], tab2: tab2Buttons,
}; };
}; };
......
...@@ -4,19 +4,22 @@ ...@@ -4,19 +4,22 @@
* 钟是志 * 钟是志
* *
* */ * */
import React, { Component } from 'react'; import React, { Component, useEffect, useState } from 'react';
import AuditPage from './index'; import AuditPage from './index';
export default class BatchAudit extends Component { export default function BatchAudit(props) {
constructor(props) { // const { workId } = props;
super(props); // const [show, setShow] = useState(true);
} // useEffect(() => {
// if (workId) {
componentDidMount() { // setShow(false);
// setTimeout(() => {
} // setShow(true);
// }, 100);
render() { // }
return <AuditPage {...this.props} hasBatchAudit={true} />; // }, [workId]);
} // if(!show){
// return null;
// }
return <AuditPage {...props} hasBatchAudit={true}/>;
} }
...@@ -5,13 +5,14 @@ ...@@ -5,13 +5,14 @@
* *
* */ * */
import React from 'react'; import React, { useContext } from 'react';
import * as service from '../publicApiService'; import * as service from '../publicApiService';
import AuditPage from './AuditPage'; import AuditPage from './AuditPage';
import * as destructionFunc from '../destruction'; import * as destructionFunc from '../destruction';
import { Link } from 'dva/router'; import { Link } from 'dva/router';
import { CreateC } from '../../ExportComponent/ActiveMenuComponent';
export default class Index extends React.Component { class Index extends React.Component {
static defaultProps = { static defaultProps = {
hasBatchAudit: false, // 是否有批量审核按钮 默认关掉 如果有需要再在外面包一层 2020年5月6日 18:44:11 钟是志 hasBatchAudit: false, // 是否有批量审核按钮 默认关掉 如果有需要再在外面包一层 2020年5月6日 18:44:11 钟是志
batchAuditButtonName: '批量审核', // 如果需要批量审核 则直接用 BatchAudit.js 文件 batchAuditButtonName: '批量审核', // 如果需要批量审核 则直接用 BatchAudit.js 文件
...@@ -19,7 +20,6 @@ export default class Index extends React.Component { ...@@ -19,7 +20,6 @@ export default class Index extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
let pathname = this.props.location.pathname; let pathname = this.props.location.pathname;
this.state = { this.state = {
columns: [], columns: [],
...@@ -39,12 +39,19 @@ export default class Index extends React.Component { ...@@ -39,12 +39,19 @@ export default class Index extends React.Component {
getFormDetail = (workId) => { getFormDetail = (workId) => {
const { dataBaseId } = this.state; const { dataBaseId } = this.state;
service.getFormDetail(workId).then((response) => { service.getFormDetail(workId)
.then((response) => {
if (typeof response.unifiedServicePatternModel === 'undefined') { if (typeof response.unifiedServicePatternModel === 'undefined') {
return false; return false;
} }
destructionFunc.destructionGetDetail(response).then((x) => { destructionFunc.destructionGetDetail(response)
const { addFields, tableInfo, allConfigSetInfo, searchCondition } = x; .then((x) => {
const {
addFields,
tableInfo,
allConfigSetInfo,
searchCondition
} = x;
this.setState( this.setState(
{ {
addFields, addFields,
...@@ -61,8 +68,14 @@ export default class Index extends React.Component { ...@@ -61,8 +68,14 @@ export default class Index extends React.Component {
}; };
giveDetailColumns = () => { giveDetailColumns = () => {
const { columns, workId, dataBaseId, addFields, tableInfo } = this.state; const {
const { showPrint } = this.props; columns,
workId,
dataBaseId,
addFields,
tableInfo
} = this.state;
const { showPrint, routerConfig } = this.props;
const process_status = columns.find((x) => { const process_status = columns.find((x) => {
return x.name === 'process_status'; return x.name === 'process_status';
}); });
...@@ -86,7 +99,7 @@ export default class Index extends React.Component { ...@@ -86,7 +99,7 @@ export default class Index extends React.Component {
record, record,
addFields, addFields,
tableInfo, tableInfo,
showPrint, showPrint: showPrint || routerConfig.showPrint === '1',
}, },
}}> }}>
详情 详情
...@@ -101,18 +114,22 @@ export default class Index extends React.Component { ...@@ -101,18 +114,22 @@ export default class Index extends React.Component {
getColumn = () => { getColumn = () => {
const { workId } = this.state; const { workId } = this.state;
service.getColumns(workId).then((response) => { service.getColumns(workId)
if(!response || !Array.isArray(response)){ .then((response) => {
if (!response || !Array.isArray(response)) {
response = []; response = [];
} }
for (let item of response) {
if (item.dataIndex === 'taskName' && !item.width) {
item.width = 200;
}
if (item.dataIndex === 'createTime' && !item.width) {
item.width = 200;
}
}
response = response.filter((x) => { response = response.filter((x) => {
return x.title !== '流程进度'; return x.title !== '流程进度';
}); });
// for(let item of response){
// if(!item.width){
// // item.width = 90; // 给一个默认宽度
// }
// }
if (response && response.length) { if (response && response.length) {
this.setState( this.setState(
{ {
...@@ -132,7 +149,8 @@ export default class Index extends React.Component { ...@@ -132,7 +149,8 @@ export default class Index extends React.Component {
if (workId) { if (workId) {
this.getColumn(); this.getColumn();
} else { } else {
service.getId(pathname).then((x) => { service.getId(pathname)
.then((x) => {
this.setState( this.setState(
{ {
workId: x.workId, workId: x.workId,
...@@ -156,7 +174,13 @@ export default class Index extends React.Component { ...@@ -156,7 +174,13 @@ export default class Index extends React.Component {
allConfigSetInfo, allConfigSetInfo,
tableInfo, tableInfo,
} = this.state; } = this.state;
const { hasBatchAudit, batchAuditButtonName, showPrint, noNeedForm } = this.props; const {
hasBatchAudit,
batchAuditButtonName,
showPrint,
noNeedForm,
tab2Buttons = []
} = this.props;
if (!workId) { if (!workId) {
return null; return null;
} }
...@@ -173,7 +197,15 @@ export default class Index extends React.Component { ...@@ -173,7 +197,15 @@ export default class Index extends React.Component {
batchAuditButtonName={batchAuditButtonName} batchAuditButtonName={batchAuditButtonName}
showPrint={showPrint} showPrint={showPrint}
noNeedForm={noNeedForm} noNeedForm={noNeedForm}
tab2Buttons={tab2Buttons}
/> />
); );
} }
} }
export default function Pr(props) {
const { routerConfig } = useContext(CreateC);
return (
<Index {...props} routerConfig={routerConfig}/>
);
}
...@@ -44,6 +44,7 @@ export default class Detail extends Component { ...@@ -44,6 +44,7 @@ export default class Detail extends Component {
if (!id) { if (!id) {
id = getUrlInfo()?.id; id = getUrlInfo()?.id;
} }
console.log(id);
this.state = { this.state = {
id, id,
showAll: props.from !== 'onestopApp2.0' showAll: props.from !== 'onestopApp2.0'
...@@ -82,7 +83,6 @@ export default class Detail extends Component { ...@@ -82,7 +83,6 @@ export default class Detail extends Component {
// 贵建把打印预览显示出来 // 贵建把打印预览显示出来
showPrint = true; showPrint = true;
} }
console.log(showPrint);
let iframeUrl = `${url[0]}/#/IframeForDetail?id=${id}&token=${getToken()}`; let iframeUrl = `${url[0]}/#/IframeForDetail?id=${id}&token=${getToken()}`;
if (showPrint) { if (showPrint) {
iframeUrl = iframeUrl + '&showPrint=true'; iframeUrl = iframeUrl + '&showPrint=true';
...@@ -91,6 +91,7 @@ export default class Detail extends Component { ...@@ -91,6 +91,7 @@ export default class Detail extends Component {
iframeUrl = config.gateWayPort + `/portal/#/showAuditIframe?id=${id}&hasSingle=false&token=${getToken()}&isPrint=false`; iframeUrl = config.gateWayPort + `/portal/#/showAuditIframe?id=${id}&hasSingle=false&token=${getToken()}&isPrint=false`;
} }
// iframeUrl = `http://localhost:8000/onestop/IframeForDetail?id=${id}&token=${getToken()}`; // iframeUrl = `http://localhost:8000/onestop/IframeForDetail?id=${id}&token=${getToken()}`;
// console.log(showPrint);
return ( return (
<PageHeaderWrapper title=''> <PageHeaderWrapper title=''>
<Shell> <Shell>
......
...@@ -3,7 +3,8 @@ import PageHeaderWrapper from '@/components/PageHeaderWrapper'; ...@@ -3,7 +3,8 @@ import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import Shell from '@/baseComponent/Shell'; import Shell from '@/baseComponent/Shell';
import { getToken, setToken } from '@/utils/authority'; import { getToken, setToken } from '@/utils/authority';
import config from '@/config/config'; import config from '@/config/config';
import { getOneStopConfig } from '@/webPublic/zyd_public/utils/utils'; import { getOneStopConfig, isJSON } from '@/webPublic/zyd_public/utils/utils';
import router from 'umi/router';
const getUrlInfo = (param) => { const getUrlInfo = (param) => {
let url = window.document.location.href.toString(); let url = window.document.location.href.toString();
...@@ -46,7 +47,8 @@ export default class Detail extends Component { ...@@ -46,7 +47,8 @@ export default class Detail extends Component {
window.addEventListener( window.addEventListener(
'message', 'message',
(event) => { (event) => {
if (event && event.data && event.data.indexOf && event.data.indexOf('iframeDetailHeight') > -1) { if (event && event.data && event.data.indexOf) {
if(event.data.indexOf('iframeDetailHeight') > -1){ // 高度修改事件
let height = Number(event.data.split('-')[1]); let height = Number(event.data.split('-')[1]);
// console.log(height); // console.log(height);
const iframe = document.getElementById('applyIframeId'); const iframe = document.getElementById('applyIframeId');
...@@ -54,14 +56,36 @@ export default class Detail extends Component { ...@@ -54,14 +56,36 @@ export default class Detail extends Component {
iframe.height = height; iframe.height = height;
} }
} }
if(event.data.indexOf('routerChange') > -1){ // 路由改变事件
let jsonData = event.data.split('-')[1];
if(isJSON(jsonData)){
let changeData = JSON.parse(jsonData);
router[changeData.type](changeData.arg);
console.log(changeData);
}
}
}
}, },
false, false,
); );
} }
// static getDerivedStateFromProps(nextProps, prevState) {
// if(nextProps.workId && prevState.id && nextProps.workId !== prevState.id){
// return {
// id: nextProps.workId,
// };
// }else{
// return null;
// }
// // ...
// }
render() { render() {
const { id } = this.state; const { id } = this.state;
let iframeUrl = `${config.gateWayPort}/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`; let iframeUrl = `${config.gateWayPort}/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`;
// iframeUrl = `https://yx.bpi.edu.cn/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`;
// iframeUrl = `http://localhost:8022/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`; // iframeUrl = `http://localhost:8022/portal/#/showSmartFormOnly?id=${id}&token=${getToken()}&isShow=true`;
return ( return (
<PageHeaderWrapper title=""> <PageHeaderWrapper title="">
......
...@@ -42,7 +42,6 @@ export default class Detail extends Component { ...@@ -42,7 +42,6 @@ export default class Detail extends Component {
render() { render() {
const { id, showAll } = this.state; const { id, showAll } = this.state;
const url = config.onestopPC.split('/#/'); const url = config.onestopPC.split('/#/');
// console.log(url);
const iframeUrl = `${url[0]}/#/IFrameSnapshot?token=${getToken()}`; const iframeUrl = `${url[0]}/#/IFrameSnapshot?token=${getToken()}`;
// iframeUrl = `http://localhost:8000/onestop/IframeForDetail?id=${id}&token=${getToken()}`; // iframeUrl = `http://localhost:8000/onestop/IframeForDetail?id=${id}&token=${getToken()}`;
return ( return (
......
...@@ -359,9 +359,9 @@ export function handleColumns(columns) { ...@@ -359,9 +359,9 @@ export function handleColumns(columns) {
if (isJSON(text)) { if (isJSON(text)) {
text = JSON.parse(text); text = JSON.parse(text);
} }
if (item.extendType === 'qrCode' && text && typeof text === 'string') { if (item.extendType === 'qrCode') {
if (text && typeof text === 'string' && text) {
let url = text.replace('{window.location.origin}', config.gateWayPort); let url = text.replace('{window.location.origin}', config.gateWayPort);
console.log(url);
const clickUrl = () => { const clickUrl = () => {
Modal.info({ Modal.info({
title: item.title, title: item.title,
...@@ -380,6 +380,10 @@ export function handleColumns(columns) { ...@@ -380,6 +380,10 @@ export function handleColumns(columns) {
}); });
}; };
return (<a onClick={clickUrl}>查看</a>); return (<a onClick={clickUrl}>查看</a>);
} else {
return <span>暂无</span>;
}
} }
if (item.extendType === 'file' && typeof text === 'string') { if (item.extendType === 'file' && typeof text === 'string') {
let url = text.includes('http') ? text : config.sqlFormsServer + text; let url = text.includes('http') ? text : config.sqlFormsServer + text;
...@@ -406,7 +410,10 @@ export function handleColumns(columns) { ...@@ -406,7 +410,10 @@ export function handleColumns(columns) {
text.files.length text.files.length
) { ) {
return text.files.map((file, index) => { return text.files.map((file, index) => {
let url = file.path.includes('http') ? file.path : config.sqlFormsServer + file.path; if(typeof file.path !== 'string' ){
return null;
}
let url = file.path && file.path.includes('http') ? file.path : config.sqlFormsServer + file.path;
return ( return (
<a href={url} target={'_blank'} key={file.name} style={{ marginRight: '10px' }}> <a href={url} target={'_blank'} key={file.name} style={{ marginRight: '10px' }}>
{file.name} {file.name}
...@@ -422,7 +429,6 @@ export function handleColumns(columns) { ...@@ -422,7 +429,6 @@ export function handleColumns(columns) {
item.render = (text, record) => { item.render = (text, record) => {
if (!isNaN(Number(text)) && Number(text) > 10000000) { if (!isNaN(Number(text)) && Number(text) > 10000000) {
text = Number(text); text = Number(text);
if (item.dataFormatStrWeb) { if (item.dataFormatStrWeb) {
...@@ -431,10 +437,10 @@ export function handleColumns(columns) { ...@@ -431,10 +437,10 @@ export function handleColumns(columns) {
} }
return moment(text) return moment(text)
.format(format[item.dataType]); .format(format[item.dataType]);
}else if(typeof text === 'string' && text.length > 5){ } else if (typeof text === 'string' && text.length > 5) {
return moment(text).format(item.dataFormatStrWeb || 'YYYY-MM-DD'); return moment(text)
} .format(item.dataFormatStrWeb || 'YYYY-MM-DD');
else { } else {
return ''; return '';
} }
}; };
......
...@@ -6,33 +6,46 @@ ...@@ -6,33 +6,46 @@
* callback 提交完成后执行回调函数 * callback 提交完成后执行回调函数
* form form表单控件 * form form表单控件
*/ */
import React, { useState } from "react"; import React, { useState } from 'react';
import { Modal, message } from "antd"; import { Modal, message } from 'antd';
import { preHandle } from "@/webPublic/one_stop_public/utils/myutils"; import { preHandle } from '@/webPublic/one_stop_public/utils/myutils';
import { connect } from "dva"; import { connect } from 'dva';
import Btn from "./pagesBtn"; import Btn from './pagesBtn';
import styles from "./styles.less"; import styles from './styles.less';
import ModalDiy from "@/baseComponent/ModalDiy"; import ModalDiy from '@/baseComponent/ModalDiy';
import { callbackSubmitData } from "@/webPublic/one_stop_public/models/callbackExamineProcess"; import { callbackSubmitData } from '@/webPublic/one_stop_public/models/callbackExamineProcess';
import { getToken } from "@/utils/authority"; import { getToken } from '@/utils/authority';
import { isJSON } from "@/webPublic/zyd_public/utils/utils"; import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import { uaaRequest } from "@/webPublic/one_stop_public/utils/request"; import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
import AuditProcessOneByOne
from '@/webPublic/FormInsertDiy/AuditButton/pagesBtn/AuditProcessOneByOne';
function AuditButton(props) { function AuditButton(props) {
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
const [modalContent, setModalContent] = useState(""); const [modalContent, setModalContent] = useState('');
const [isSubmitLoading, setSubmitLoading] = useState(false); const [isSubmitLoading, setSubmitLoading] = useState(false);
const [affairOkParams, setAffairParams] = useState({}); const [affairOkParams, setAffairParams] = useState({});
const [showProcessModal, setShowProcessModal] = useState(false); // 增加进度条 1条数据1条数据的调用接口
const { callback } = props;
function affairOk() { function affairOk() {
// 有taskIds属性时,是批量审核, // 有taskIds属性时,是批量审核,
const { dispatch, callback, data, form, taskIds, selectRows } = props; const {
const { oldKey, btnValue } = affairOkParams; dispatch,
if (window.stuSigningAuditXueShengChu && btnValue === "0") { data,
form,
taskIds,
selectRows
} = props;
const {
oldKey,
btnValue
} = affairOkParams;
if (window.stuSigningAuditXueShengChu && btnValue === '0') {
// 黔南就业学生处批量审批签章 特殊处理 专门为黔南签章批量审核搞的函数 // 黔南就业学生处批量审批签章 特殊处理 专门为黔南签章批量审核搞的函数
// 应该是点击同意才执行这个全局函数. // 应该是点击同意才执行这个全局函数.
window.stuSigningAuditXueShengChu({ window.stuSigningAuditXueShengChu({
userNowInfo: (isJSON(localStorage.getItem("user")) && JSON.parse(localStorage.getItem("user"))) || {}, userNowInfo: (isJSON(localStorage.getItem('user')) && JSON.parse(localStorage.getItem('user'))) || {},
buttonInfo: data?.btns && data?.btns.length ? data?.btns.find((x) => x.value === btnValue) : {}, buttonInfo: data?.btns && data?.btns.length ? data?.btns.find((x) => x.value === btnValue) : {},
token: getToken(), token: getToken(),
selectRows, selectRows,
...@@ -51,14 +64,14 @@ function AuditButton(props) { ...@@ -51,14 +64,14 @@ function AuditButton(props) {
setVisible, setVisible,
setSubmitLoading, setSubmitLoading,
remark: { remark: {
setVisible: "关闭弹窗的方法", setVisible: '关闭弹窗的方法',
setSubmitLoading: "显示为加载中", setSubmitLoading: '显示为加载中',
path: " 代码在学工的这里面 src/webPublic/FormInsertDiy/AuditButton/index.js", path: ' 代码在学工的这里面 src/webPublic/FormInsertDiy/AuditButton/index.js',
message: "蚂蚁金服的message 用来展示进度条. 不懂问我", message: '蚂蚁金服的message 用来展示进度条. 不懂问我',
Modal: "蚂蚁金服的Modal 用来提示审核已完成", Modal: '蚂蚁金服的Modal 用来提示审核已完成',
callback: "执行完了的回调函数", callback: '执行完了的回调函数',
else: "其他参数打印出来自己看看", else: '其他参数打印出来自己看看',
uaaRequest: "调一站式的接口的方法" uaaRequest: '调一站式的接口的方法'
} }
}); });
return true; return true;
...@@ -69,6 +82,7 @@ function AuditButton(props) { ...@@ -69,6 +82,7 @@ function AuditButton(props) {
setSubmitLoading(true); setSubmitLoading(true);
preHandle(values); preHandle(values);
let payload = { let payload = {
// 批量 和 单个审批 都用这段代码
taskIds: taskIds || [data.taskId], // 接口里面的taskId 任务Id taskIds: taskIds || [data.taskId], // 接口里面的taskId 任务Id
code: taskIds ? undefined : data.code, code: taskIds ? undefined : data.code,
// 审核相关内容 // 审核相关内容
...@@ -81,13 +95,19 @@ function AuditButton(props) { ...@@ -81,13 +95,19 @@ function AuditButton(props) {
apiData: data, apiData: data,
taskFormKey: data?.taskFormKey, taskFormKey: data?.taskFormKey,
userNowInfo: userNowInfo:
(isJSON(localStorage.getItem("user")) && JSON.parse(localStorage.getItem("user"))) || {}, (isJSON(localStorage.getItem('user')) && JSON.parse(localStorage.getItem('user'))) || {},
buttonInfo, buttonInfo,
token: getToken() token: getToken()
}; };
payload = callbackSubmitData(payload); payload = callbackSubmitData(payload);
console.log(payload);
setVisible(false);
setShowProcessModal(payload);
return false;
dispatch({ dispatch({
type: "affair/getExamineProcess", type: 'affair/getExamineProcess',
payload, payload,
callback: (val) => { callback: (val) => {
setSubmitLoading(false); setSubmitLoading(false);
...@@ -118,46 +138,55 @@ function AuditButton(props) { ...@@ -118,46 +138,55 @@ function AuditButton(props) {
* 根据不同值,返回对应样式 * 根据不同值,返回对应样式
*/ */
function getStyle(key, value) { function getStyle(key, value) {
if (key === "examine") { if (key === 'examine') {
switch (value) { switch (value) {
case 1: case 1:
return [`${styles.btn_margin}`, `${styles.btn}`, `${styles.btn_reject}`].join(" "); return [`${styles.btn_margin}`, `${styles.btn}`, `${styles.btn_reject}`].join(' ');
case 2: case 2:
return [`${styles.btn_margin}`, `${styles.btn}`, `${styles.btn_no}`].join(" "); return [`${styles.btn_margin}`, `${styles.btn}`, `${styles.btn_no}`].join(' ');
case 0: case 0:
return "deafalut"; return 'deafalut';
case "1": case '1':
return [`${styles.btn_margin}`, `${styles.btn}`, `${styles.btn_reject}`].join(" "); return [`${styles.btn_margin}`, `${styles.btn}`, `${styles.btn_reject}`].join(' ');
case "2": case '2':
return [`${styles.btn_margin}`, `${styles.btn}`, `${styles.btn_no}`].join(" "); return [`${styles.btn_margin}`, `${styles.btn}`, `${styles.btn_no}`].join(' ');
case "0": case '0':
return "deafalut"; return 'deafalut';
default: default:
return "deafalut"; return 'deafalut';
} }
} else { } else {
return "deafalut"; return 'deafalut';
} }
} }
function showModal(str, key, value) { function showModal(str, key, value) {
const { data, form } = props; const {
data,
form
} = props;
const buttonInfo = data?.btns && data?.btns.length ? data?.btns.find((x) => x.value === value) : {}; const buttonInfo = data?.btns && data?.btns.length ? data?.btns.find((x) => x.value === value) : {};
const values = form.getFieldsValue(); const values = form.getFieldsValue();
if(buttonInfo?.documentation){ if (buttonInfo?.documentation) {
let needAuditInfo = isJSON(buttonInfo.documentation) && JSON.parse(buttonInfo.documentation)?.needAuditInfo; let needAuditInfo = isJSON(buttonInfo.documentation) && JSON.parse(buttonInfo.documentation)?.needAuditInfo;
if(needAuditInfo && !values.reason){ if (needAuditInfo && !values.reason) {
message.warning('请输入审批理由'); message.warning('请输入审批理由');
return ; return;
} }
} }
setModalContent(`确定${str}吗?`); setModalContent(`确定${str}吗?`);
setAffairParams({ oldKey: key, btnValue: value }); setAffairParams({
oldKey: key,
btnValue: value
});
setVisible(true); setVisible(true);
} }
const { const {
data: { isHandle, btns } data: {
isHandle,
btns
}
} = props; } = props;
if (!isHandle || !Array.isArray(btns) || btns.length < 1) return null; if (!isHandle || !Array.isArray(btns) || btns.length < 1) return null;
return ( return (
...@@ -181,10 +210,23 @@ function AuditButton(props) { ...@@ -181,10 +210,23 @@ function AuditButton(props) {
handleCancel={hideModal} handleCancel={hideModal}
handleOk={affairOk} handleOk={affairOk}
confirmLoading={isSubmitLoading}> confirmLoading={isSubmitLoading}>
<div style={{ fontSize: 16, textAlign: "center", height: 150, lineHeight: "150px" }}> <div style={{
fontSize: 16,
textAlign: 'center',
height: 150,
lineHeight: '150px'
}}>
{modalContent} {modalContent}
</div> </div>
</ModalDiy> </ModalDiy>
{
showProcessModal &&
<AuditProcessOneByOne payloadData={showProcessModal}
callBack={callback}
setShowProcessModal={setShowProcessModal}
/>
}
</> </>
); );
} }
......
import React, { useState, useEffect, useRef } from 'react';
import { Modal, Progress,message } from 'antd';
import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
import styles from './styles.less';
export default function AuditProcessOneByOne({
payloadData = {},
callBack = () => {
},
setShowProcessModal,
}) {
if (!Array.isArray(payloadData?.taskIds) || !payloadData.taskIds.length) {
return null;
}
const [success, setS] = useState(0);
const [error, setE] = useState(0);
const resInfo = useRef();
const taskIds = payloadData.taskIds;
const total = taskIds.length;
async function getData(){
for (let g = 0; g < taskIds.length; g++) {
const res = await returnPromise({
...payloadData,
taskIds: [taskIds[g]],
});
if (res) {
setS((v) => v + 1);
} else {
setE((v) => v + 1);
}
resInfo.current = res;
}
}
useEffect(() => {
getData();
}, []);
useEffect(() => {
if (success + error === total) {
callBack(resInfo.current);
}
}, [success, error]);
const percent = Math.floor(((success + error) / total) * 100);
return (
<Modal title={'批量审核'}
visible={true}
width={1200}
footer={null}
onCancel={() => {
if(success + error !== total){
message.warning('审核正在进行中,请勿关闭');
}else{
setShowProcessModal(false);
}
}}
>
<div className={styles.juzhong}>
<Progress percent={percent}
type='circle'
status={error === total ? 'exception' : success + error === total ? 'success ' : ''}
strokeColor={{
'0%': '#108ee9',
'100%': '#87d068',
}}
/>
<div >
{
success + error === total ? `审核完成, 成功${success}条, 失败${error}条` : `正在进行审核 共${total}条数据, 成功${success}条, 失败${error}条`
}
</div>
</div>
</Modal>
);
}
let i = 0;
function returnPromise(data) {
// return new Promise((resolve, reject) => {
// i++;
// if (i % 2 > 0) {
// resolve(true);
// } else {
// resolve(false);
// }
// });
return uaaRequest('/UnifiedAppFormApi/examineProcess', data);
}
...@@ -21,3 +21,7 @@ ...@@ -21,3 +21,7 @@
border:1px solid #FF9B00; border:1px solid #FF9B00;
} }
} }
.juzhong{
display: grid;
justify-items: center;
}
...@@ -14,13 +14,6 @@ function AuditModal({ form, selectRows, children, getPage, noNeedForm }) { ...@@ -14,13 +14,6 @@ function AuditModal({ form, selectRows, children, getPage, noNeedForm }) {
message.info(`提交${res ? '成功' : '失败'}!`); message.info(`提交${res ? '成功' : '失败'}!`);
setVisible(false); setVisible(false);
getPage(); getPage();
// 19684 优秀学生奖学金---班主任审核页面--弹框提醒优化处理 禅道bug
// ModalInfo(`提交${res ? '成功' : '失败'}!`, {
// onOk: () => {
// setVisible(false);
// getPage();
// },
// });
} }
const [data, setData] = useState(null); const [data, setData] = useState(null);
...@@ -82,6 +75,7 @@ function AuditModal({ form, selectRows, children, getPage, noNeedForm }) { ...@@ -82,6 +75,7 @@ function AuditModal({ form, selectRows, children, getPage, noNeedForm }) {
width={900} width={900}
visible={visible} visible={visible}
title="批量审核" title="批量审核"
maskClosable={false}
footer={footer} footer={footer}
onCancel={() => setVisible(false)}> onCancel={() => setVisible(false)}>
<Spin spinning={loading}> <Spin spinning={loading}>
......
import React from "react"; import React, { useEffect, useState, createContext } from 'react';
import CheckRecord from "@/webPublic/FormInsertDiy/ExportComponent/CheckRecord"; // 查询类 import CheckRecord from '@/webPublic/FormInsertDiy/ExportComponent/CheckRecord'; // 查询类
import Apply from "@/webPublic/FormInsertDiy/AffairPage/ApplyPage"; // 申请 import Apply from '@/webPublic/FormInsertDiy/AffairPage/ApplyPage'; // 申请
import BatchAudit from "@/webPublic/FormInsertDiy/AffairPage/AuditPage/BatchAudit"; // 批量审批 import BatchAudit from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/BatchAudit'; // 批量审批
import Audit from "@/webPublic/FormInsertDiy/AffairPage/AuditPage/index.js"; // 审批 import Audit from '@/webPublic/FormInsertDiy/AffairPage/AuditPage/index.js'; // 审批
import Detail from "@/webPublic/FormInsertDiy/AffairPage/Detail"; //详情 import Detail from '@/webPublic/FormInsertDiy/AffairPage/Detail'; //详情
import { Modal, message, notification, Popconfirm } from 'antd'; import { Modal, message, notification, Popconfirm } from 'antd';
import { connect } from 'dva';
export const CreateC = createContext({
routerConfig: {},
});
window.iframeParentComponent = { window.iframeParentComponent = {
Modal, Modal,
message, message,
notification, notification,
Popconfirm Popconfirm,
}; };
export default function ActiveMenuComponent({ function ActiveMenuComponent({
routerConfig, routerConfig,
...otherProps ...otherProps
}) { }) {
const { component = "", appId } = routerConfig; const {
component = '',
appId
} = routerConfig;
const { location } = otherProps;
const record = location?.state?.record;
const [show, setShow] = useState(false);
useEffect(
() => {
if (appId || record.id) {
setShow(false);
setTimeout(() => {
setShow(true);
}, 100);
}
},
[appId, record],
);
if (!show) {
return null;
}
let Res = <div>暂无此功能</div>;
switch (component) { switch (component) {
case "CheckRecord": // 查询类应用 case 'CheckRecord': // 查询类应用
return <CheckRecord workId={appId} Res = <CheckRecord workId={appId}/>;
break;
case 'Apply': // 申请类
Res = <Apply workId={appId} {...otherProps} />;
break;
case 'Audit': // 审批类
Res = <Audit workId={appId} {...otherProps} />;
break;
case 'BatchAudit': // 批量审批
Res = <BatchAudit workId={appId}
{...otherProps}
/>; />;
case "Apply": // 申请类 详情是 iframe break;
return <Apply case 'Detail': // 详情
workId={appId} {...otherProps}/>; Res = <Detail {...otherProps} />;
case "Audit": // 审批类 详情是 iframe break;
return <Audit
workId={appId} {...otherProps}/>;
case "BatchAudit": // 批量审批 详情是 iframe
return <BatchAudit
workId={appId} {...otherProps}/>;
case "Detail": // 详情 iframe
return <Detail
{...otherProps} {...otherProps}/>;
default: default:
console.log(component, "没有找到此组件"); break;
return <div>暂无此功能</div>;
} }
return (
<CreateC.Provider value={{
routerConfig,
}}>
{Res}
</CreateC.Provider>
);
} }
export default connect(({}) => {
return {};
})(ActiveMenuComponent);
import React from "react"; import React, { useEffect, useState } from "react";
import CheckRecord2 from "@/webPublic/FormInsertDiy/AffairPage/IframeFor2.0"; // 2.0的 查询类 应用 直接iframe 嵌入 import CheckRecord2 from "@/webPublic/FormInsertDiy/AffairPage/IframeFor2.0"; // 2.0的 查询类 应用 直接iframe 嵌入
import Apply from "@/webPublic/FormInsertDiy/AffairPage/ApplyPage"; // 申请 import Apply from "@/webPublic/FormInsertDiy/AffairPage/ApplyPage"; // 申请
import BatchAudit from "@/webPublic/FormInsertDiy/AffairPage/AuditPage/BatchAudit"; // 批量审批 import BatchAudit from "@/webPublic/FormInsertDiy/AffairPage/AuditPage/BatchAudit"; // 批量审批
...@@ -12,9 +12,24 @@ export default function ActiveMenuComponent2({ ...@@ -12,9 +12,24 @@ export default function ActiveMenuComponent2({
...otherProps ...otherProps
}) { }) {
const { component = "", appId } = routerConfig; const { component = "", appId } = routerConfig;
const [show, setShow] = useState(true);
useEffect(() => {
if(appId){
setShow(false);
setTimeout(() => {
setShow(true);
}, 1000);
}
}, [appId]);
if(!show){
return null;
}
switch (component) { switch (component) {
case "CheckRecord": // 查询类应用 case "CheckRecord": // 查询类应用
console.log(appId);
return <CheckRecord2 workId={appId} {...otherProps} />; return <CheckRecord2 workId={appId} {...otherProps} />;
case "Apply": // 申请类 case "Apply": // 申请类
return <Apply return <Apply
......
...@@ -15,6 +15,7 @@ function OtherCheckRecord({ workId, ...otherProps }) { ...@@ -15,6 +15,7 @@ function OtherCheckRecord({ workId, ...otherProps }) {
const id = workId || getOneStopConfig(pathname); const id = workId || getOneStopConfig(pathname);
useEffect(() => { useEffect(() => {
setData(undefined); setData(undefined);
console.log(id);
fetchTemplateById(id).then(res => { fetchTemplateById(id).then(res => {
if (res) setData({ ...res, content: '{}' }); if (res) setData({ ...res, content: '{}' });
}); });
......
...@@ -5,11 +5,13 @@ import ButtonDiy from '@/baseComponent/ButtonDiy'; ...@@ -5,11 +5,13 @@ import ButtonDiy from '@/baseComponent/ButtonDiy';
import config from '@/config/config'; import config from '@/config/config';
import { connect } from 'dva'; import { connect } from 'dva';
import { exportExcel } from 'xlsx-oc'; // import { exportExcel } from 'xlsx-oc';
import { getToken } from '@/utils/authority'; import { getToken } from '@/utils/authority';
const Step = Steps.Step; const Step = Steps.Step;
const TabPane = Tabs.TabPane; const TabPane = Tabs.TabPane;
const exportExcel = CLIENT_TYPE == 'mobile' ? null : require('xlsx-oc').exportExcel;
// const exportExcel = null;
@connect(({ DataObj, loading }) => ({ @connect(({ DataObj, loading }) => ({
DataObj, DataObj,
...@@ -181,6 +183,10 @@ export default class ImportUtil extends React.PureComponent { ...@@ -181,6 +183,10 @@ export default class ImportUtil extends React.PureComponent {
this.setState({ currentKey: activeKey }); this.setState({ currentKey: activeKey });
}; };
exportError = (column, dataSource) => { exportError = (column, dataSource) => {
if(!exportExcel){
message.info('暂不支持此功能');
return null;
}
var _headers = []; var _headers = [];
for (var i = 0; i < column.length; i++) { for (var i = 0; i < column.length; i++) {
_headers.push({ k: column[i].dataIndex, v: column[i].title }); _headers.push({ k: column[i].dataIndex, v: column[i].title });
......
/**
* 判断是否为JSON文本
* @param {string} str 是否为json文本
*/
export function isJSON(str) {
if (typeof str == 'string') {
try {
JSON.parse(str);
if (typeof JSON.parse(str) === 'number') {
return false;
}
return true;
} catch (e) {
return false;
}
}
}
/**
* 2022年7月19日
* 钟是志
* 一站式接口为了应付北电科的鉴权 按欢哥搞的 把接口地址进行一次转换
* 禅道 28321 一站式接口越权处理
* */
import { getToken } from '@/webPublic/one_stop_public/utils/getToken';
import { isJSON } from '@/webPublic/one_stop_public/2022beidianke/isJSON';
import { strToBinary } from '@/webPublic/one_stop_public/Base16/strToBinary';
import { binaryToStr } from '@/webPublic/one_stop_public/Base16/binaryToStr';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
import md5 from 'js-md5';
const urlInfo = getUrlInfo();
if(!!urlInfo.visitor){
sessionStorage.setItem('visitor_client', JSON.stringify(true));
}
const isTest = urlInfo.test;
const visitor_client = sessionStorage.getItem('visitor_client') === 'true';
function getApi(apiUrl) {
const token = getToken();
const data = {
url: apiUrl,
};
if((!token || token.length < 11) && visitor_client){
data.client = 'client_' + md5(navigator.appVersion); // 访客模式
}else{
data.token = token;
}
const datasCode = strToBinary(JSON.stringify(data));
let file = new File([datasCode], 'fileParams.jpeg', {
type: 'image/jpeg',
});
let datasTrue = {
fileParams: file,
bin: true,
rbin: true,
// token: getToken(),
};
const formData = new FormData();
for (let key in datasTrue) {
formData.append(key, datasTrue[key]);
}
return fetch(window.CONFIG.API_ACTION_PATH + '/safe/pub/getApis', {
headers: {
Accept: 'application/json',
},
method: 'POST',
credentials: 'omit',
mode: 'cors',
body: formData,
})
.then((res) => {
return res.json();
}).then((res) => {
if (res.rbin && isJSON(binaryToStr(res.rbin))) {
const u = JSON.parse(binaryToStr(res.rbin)).url;
const newUrl = window.CONFIG.API_ACTION_PATH + '/apis/' + md5(u);
setLocalStorageTransformApi(apiUrl, u); // 存入缓存
return {
transformApi: newUrl,
headersApi: u,
};
} else {
return false;
}
});
}
function getLocalStorageTransformApi(api = '') {
const storage = localStorage.getItem('oneStopTransformApi');
if (storage && isJSON(storage)) {
let d = JSON.parse(storage);
return d;
} else {
return {};
}
}
function setLocalStorageTransformApi(api = '', transformApi = '') {
let t = getToken();
// if((!t || t.length < 11) && visitor_client){
// t = md5(navigator.appVersion);
// }
let old = getLocalStorageTransformApi();
if (old[t]) {
old[t][api] = transformApi;
} else {
old = {};
old[t] = {};
old[t][api] = transformApi;
}
localStorage.setItem('oneStopTransformApi', JSON.stringify(old));
}
export async function getTransformApi(url) { //
let apiUrl = '';
let needTransform = true;
const t = getToken();
const TRANSFORM_BIN = window.CONFIG?.TRANSFORM_BIN;
if(!TRANSFORM_BIN){
needTransform = false;
}
if (needTransform && url && typeof url === 'string' && url.indexOf('/onestop') > -1 && url.includes(window.CONFIG.API_ACTION_PATH)) {
apiUrl = url.replace(window.CONFIG.API_ACTION_PATH, '');
} else {
return new Promise((resolve, reject) => {
resolve({
transformApi: url,
headersApi: undefined,
});
});
}
if (!visitor_client && (!t || t.length < 11 || !needTransform)) { // 没有token 或者没有开启二进制加密 且不是访客模式 直接返回
return new Promise((resolve, reject) => {
resolve({
transformApi: url,
headersApi: undefined,
});
});
} else {
const storage = getLocalStorageTransformApi();
if(storage && storage[t] && storage[t][apiUrl]){
return new Promise((resolve) => {
const apis = storage[t][apiUrl];
resolve({
transformApi: window.CONFIG.API_ACTION_PATH + '/apis/' + md5(apis),
headersApi: apis,
})
});
}
return new Promise((resolve) => {
return getApi(apiUrl).then((g) => {
resolve({
transformApi: g.transformApi,
headersApi: g.headersApi,
});
});
});
}
}
...@@ -10,6 +10,8 @@ import Btn from '../pagesBtn'; ...@@ -10,6 +10,8 @@ import Btn from '../pagesBtn';
import MyModal from '../Modal'; import MyModal from '../Modal';
import styles from './styles.less'; import styles from './styles.less';
import stylesList from './styles-in-line'; import stylesList from './styles-in-line';
import { checkNeedFormValidateFieldsAndScroll } from '@/webPublic/one_stop_public/DetailForAudit/splitDetailSplit';
const { TextArea } = Input; const { TextArea } = Input;
export default class userButton extends Component { export default class userButton extends Component {
constructor() { constructor() {
...@@ -115,7 +117,12 @@ export default class userButton extends Component { ...@@ -115,7 +117,12 @@ export default class userButton extends Component {
* 用于确认用户输入 * 用于确认用户输入
*/ */
postUser = () => { postUser = () => {
const { key, btnValue, value, checked } = this.state; const {
key,
btnValue,
value,
checked
} = this.state;
this.props.affairOk(key, btnValue, value, checked); this.props.affairOk(key, btnValue, value, checked);
}; };
...@@ -133,17 +140,49 @@ export default class userButton extends Component { ...@@ -133,17 +140,49 @@ export default class userButton extends Component {
this.setState({ checked: e.target.checked }); this.setState({ checked: e.target.checked });
}; };
checkAndShowModal(item = {}) {
const {
form,
btns
} = this.props;
const showM = () => {
this.showModal(item.name, item.key, item.value);
return true;
};
if (form && form.validateFieldsAndScroll) {
let checkSumbitInfo = checkNeedFormValidateFieldsAndScroll({ // 检查是否必须填写表单值
btns,
btnValue: item.value,
});
if (!checkSumbitInfo) { // 如果不需要校验 直接提交数据
return showM();
} else {
form.validateFieldsAndScroll((err, values) => {
if (!err) {
return showM();
}
});
}
} else {
return showM();
}
}
render() { render() {
const { visibleOk, value, user } = this.state; const {
visibleOk,
value,
user
} = this.state;
const { const {
btns, btns,
isSecond, isSecond,
isSumbitLoading, isSumbitLoading,
addition, // 附件按钮 只负责显示 addition, // 附件按钮 只负责显示
Sign, // 判断是否有签名 Sign, // 判断是否有签名
form,
} = this.props; } = this.props;
return ( return (
<> <>
<div className={styles.btn_page} id={'form_btns_list'}> <div className={styles.btn_page} id={'form_btns_list'}>
...@@ -154,9 +193,7 @@ export default class userButton extends Component { ...@@ -154,9 +193,7 @@ export default class userButton extends Component {
<Btn <Btn
get="8" get="8"
key={index} key={index}
btnOne={() => { btnOne={this.checkAndShowModal.bind(this, item)}
this.showModal(item.name, item.key, item.value);
}}
text={item.name} text={item.name}
style={className} style={className}
/> />
...@@ -173,13 +210,13 @@ export default class userButton extends Component { ...@@ -173,13 +210,13 @@ export default class userButton extends Component {
handleCancel={this.handleCancelOk}> handleCancel={this.handleCancelOk}>
<div style={stylesList.is_ok}> <div style={stylesList.is_ok}>
<p style={stylesList.header}> <p style={stylesList.header}>
<span style={{...stylesList.headerSpan, ...stylesList.headerSpan_1}}> <span style={{ ...stylesList.headerSpan, ...stylesList.headerSpan_1 }}>
{isSecond ? '当前状态' : '审批结果'} {isSecond ? '当前状态' : '审批结果'}
</span> </span>
{this.getUser()} {this.getUser()}
</p> </p>
<div style={stylesList.body}> <div style={stylesList.body}>
<span style={{...stylesList.body_span, ...stylesList.body_span_1}}> <span style={{ ...stylesList.body_span, ...stylesList.body_span_1 }}>
{isSecond ? '发起说明' : '审批说明'} {isSecond ? '发起说明' : '审批说明'}
</span> </span>
<span id={'textarea_shen_pi_li_you'}> <span id={'textarea_shen_pi_li_you'}>
...@@ -187,17 +224,21 @@ export default class userButton extends Component { ...@@ -187,17 +224,21 @@ export default class userButton extends Component {
value={value} value={value}
onChange={this.onChange} onChange={this.onChange}
placeholder={isSecond ? '请输入发起说明' : '请输入审批理由'} placeholder={isSecond ? '请输入发起说明' : '请输入审批理由'}
style={{ width: 380, height: 120, color: '#7F8B95' }} style={{
width: 380,
height: 120,
color: '#7F8B95'
}}
/> />
</span> </span>
</div> </div>
{Sign ? ( {Sign ? (
<div style={stylesList.body}> <div style={stylesList.body}>
<span style={{...stylesList.body_span, ...stylesList.body_span_1}}> <span style={{ ...stylesList.body_span, ...stylesList.body_span_1 }}>
使用签名 使用签名
</span> </span>
<span style={{...stylesList.body_span}}> <span style={{ ...stylesList.body_span }}>
<Checkbox defaultChecked={user.isUseBackImage} onChange={this.onChange1} /> <Checkbox defaultChecked={user.isUseBackImage} onChange={this.onChange1}/>
</span> </span>
</div> </div>
) : ( ) : (
......
...@@ -9,8 +9,10 @@ import { getToken } from '../../utils/token'; ...@@ -9,8 +9,10 @@ import { getToken } from '../../utils/token';
import config from '@/webPublic/one_stop_public/config'; import config from '@/webPublic/one_stop_public/config';
import FormdataWrapper from '../../utils/object-to-formdata-custom'; import FormdataWrapper from '../../utils/object-to-formdata-custom';
import ButtonDiy from '../ButtonDiy/ButtonDiy'; import ButtonDiy from '../ButtonDiy/ButtonDiy';
import { giveFilePostData, giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16'; import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16';
import SelectModal from '@/webPublic/one_stop_public/App/ExportCurrentInfo/SelectModal'; import SelectModal from '@/webPublic/one_stop_public/App/ExportCurrentInfo/SelectModal';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
/** /**
* *
* 2019/02/21 修改导出方式为fetch * 2019/02/21 修改导出方式为fetch
...@@ -48,16 +50,14 @@ export default class ExportCurrentInfo extends React.Component { ...@@ -48,16 +50,14 @@ export default class ExportCurrentInfo extends React.Component {
} }
exportData = () => { exportData = () => {
let downloadUrl = config.httpServer + '/DataObjApi/exportCurrent?'; let downloadUrl = config.httpServer + '/DataObjApi/exportCurrent';
const token = getToken() != null && getToken() != 'null' ? getToken() : '0000';
downloadUrl = `${downloadUrl}token=${token}`;
let param = { let param = {
dataObjId: this.props.objId, dataObjId: this.props.objId,
query: this.props.query, query: this.props.query,
custom: this.props.custom, custom: this.props.custom,
sql: this.props.sql, sql: this.props.sql,
index: this.props.index, index: this.props.index,
// token: getToken(),
}; };
if(this.props.openSelectFieldsModal){ // 26598 自定义数据导出---导出字段调整,,,注意数据权限 if(this.props.openSelectFieldsModal){ // 26598 自定义数据导出---导出字段调整,,,注意数据权限
...@@ -72,13 +72,17 @@ export default class ExportCurrentInfo extends React.Component { ...@@ -72,13 +72,17 @@ export default class ExportCurrentInfo extends React.Component {
this.downloadFile(downloadUrl, param); this.downloadFile(downloadUrl, param);
}; };
downloadFile(url, params) { downloadFile = async (url, params) => {
this.setState({ confirmLoading: true }); this.setState({ confirmLoading: true });
let newApi = giveFilePostDataInfoForTrue(params, url); let newApi = giveFilePostDataInfoForTrue(params, url);
fetch(newApi.url, { if(newApi && newApi.datas){
newApi.datas.token = getToken();
}
const { transformApi, headersApi } = await getTransformApi(newApi.url);
fetch(transformApi, {
method: 'POST', method: 'POST',
body: FormdataWrapper(newApi.datas, body: FormdataWrapper(newApi.datas),
), ...getHeaders('', headersApi),
}) })
.then((res) => { .then((res) => {
if (res.status != '200') { if (res.status != '200') {
......
...@@ -22,6 +22,7 @@ import OrderItem from './OrderItem'; ...@@ -22,6 +22,7 @@ import OrderItem from './OrderItem';
import FormdataWrapper from '../utils/object-to-formdata-custom'; import FormdataWrapper from '../utils/object-to-formdata-custom';
import ButtonDiy from './ButtonDiy/ButtonDiy'; import ButtonDiy from './ButtonDiy/ButtonDiy';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
const Option = Select.Option; const Option = Select.Option;
var keyX = 1; var keyX = 1;
...@@ -366,6 +367,7 @@ export default class ExportInfo extends React.Component { ...@@ -366,6 +367,7 @@ export default class ExportInfo extends React.Component {
fetch(url, { fetch(url, {
method: 'POST', method: 'POST',
body: FormdataWrapper(params), body: FormdataWrapper(params),
...getHeaders()
}) })
.then((res) => { .then((res) => {
if (res.status != '200') { if (res.status != '200') {
......
...@@ -8,16 +8,14 @@ import config from '@/webPublic/one_stop_public/config'; ...@@ -8,16 +8,14 @@ import config from '@/webPublic/one_stop_public/config';
import { connect } from 'dva'; import { connect } from 'dva';
import { getMessage, getModal } from '@/webPublic/one_stop_public/utils/utils'; import { getMessage, getModal } from '@/webPublic/one_stop_public/utils/utils';
import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16'; import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
const Modal = getModal(); const Modal = getModal();
const message = getMessage(); const message = getMessage();
const Step = Steps.Step; const Step = Steps.Step;
const TabPane = Tabs.TabPane; const TabPane = Tabs.TabPane;
// const exportExcel = CLIENT_TYPE == 'mobile' ? null : require('xlsx-oc').exportExcel;
const exportExcel = CLIENT_TYPE == 'mobile' ? null : require('xlsx-oc').exportExcel; let tempCallback = () => {};
let tempCallback = () => {
};
@connect(({ DataObj, loading }) => ({ @connect(({ DataObj, loading }) => ({
DataObj, DataObj,
...@@ -90,15 +88,18 @@ export default class ImportUtil extends React.PureComponent { ...@@ -90,15 +88,18 @@ export default class ImportUtil extends React.PureComponent {
} }
if (current === 3) { if (current === 3) {
console.log('current === 3'); console.log('current === 3');
this.setState({ this.setState(
{
current: current, current: current,
isShow: true, isShow: true,
}, () => { },
() => {
if (tempCallback && typeof tempCallback === 'function') { if (tempCallback && typeof tempCallback === 'function') {
tempCallback(); tempCallback();
tempCallback = null; tempCallback = null;
} }
}); },
);
} }
} }
...@@ -198,24 +199,30 @@ export default class ImportUtil extends React.PureComponent { ...@@ -198,24 +199,30 @@ export default class ImportUtil extends React.PureComponent {
}, },
}); });
}; };
changePane = (activeKey) => { changePane = (activeKey) => {
this.setState({ currentKey: activeKey }); this.setState({ currentKey: activeKey });
}; };
exportError = (column, dataSource) => {
if (exportExcel == null) { // exportError = (column, dataSource) => {
message.info('当前终端暂不支持此功能'); // if (exportExcel == null) {
return; // message.info('当前终端暂不支持此功能');
} // return;
var _headers = []; // }
for (var i = 0; i < column.length; i++) { // var _headers = [];
_headers.push({ k: column[i].dataIndex, v: column[i].title }); // for (var i = 0; i < column.length; i++) {
} // _headers.push({
for (var j = 0; j < dataSource.length; j++) { // k: column[i].dataIndex,
dataSource[j].index = j + 1; // v: column[i].title,
} // });
exportExcel(_headers, dataSource); // }
}; // for (var j = 0; j < dataSource.length; j++) {
downloadFile = () => { // dataSource[j].index = j + 1;
// }
// exportExcel(_headers, dataSource);
// };
downloadFile = async () => {
this.setState({ confirmLoading: true }); this.setState({ confirmLoading: true });
const { objId, fileName, importParams, importConfig } = this.props; const { objId, fileName, importParams, importConfig } = this.props;
...@@ -224,16 +231,23 @@ export default class ImportUtil extends React.PureComponent { ...@@ -224,16 +231,23 @@ export default class ImportUtil extends React.PureComponent {
importConfig: importConfig ? JSON.stringify(importConfig) : null, importConfig: importConfig ? JSON.stringify(importConfig) : null,
objId, objId,
fileName, fileName,
token: getToken(),
}; };
let url = `${config.httpServer}/DataObjApi/importTemplateDownload`; let url = `${config.httpServer}/DataObjApi/importTemplateDownload`;
let newParams = giveFilePostDataInfoForTrue(params, url); let newParams = giveFilePostDataInfoForTrue(params, url);
fetch(newParams.url, { if (newParams && newParams.datas) {
newParams.datas.token = getToken();
}
const { transformApi, headersApi } = await getTransformApi(newParams.url);
fetch(transformApi, {
method: 'POST', method: 'POST',
body: FormdataWrapper(newParams.datas), body: FormdataWrapper(newParams.datas),
headers: {
apis: headersApi,
},
}) })
.then((res) => { .then((res) => {
if (res.status != '200') { console.log(res.status);
if (res.status != 200 && res.status !== 202) {
return res.json(); return res.json();
} else { } else {
return res.blob(); return res.blob();
...@@ -255,6 +269,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -255,6 +269,7 @@ export default class ImportUtil extends React.PureComponent {
} }
}) })
.catch((err) => { .catch((err) => {
console.error(err);
message.error(`网络请求超时`); message.error(`网络请求超时`);
}) })
.finally(() => { .finally(() => {
...@@ -361,13 +376,13 @@ export default class ImportUtil extends React.PureComponent { ...@@ -361,13 +376,13 @@ export default class ImportUtil extends React.PureComponent {
<Step key={item.title} title={item.title} /> <Step key={item.title} title={item.title} />
))} ))}
</Steps> </Steps>
<div className='steps-content'>{steps[this.state.current].content}</div> <div className="steps-content">{steps[this.state.current].content}</div>
<div className={styles.button}> <div className={styles.button}>
{this.state.current < steps.length - 1 && {this.state.current < steps.length - 1 &&
this.state.current !== 0 && ( this.state.current !== 0 && (
<ButtonDiy <ButtonDiy
name={this.state.current == 3 ? '确认导入' : '下一步'} name={this.state.current == 3 ? '确认导入' : '下一步'}
type='primary' type="primary"
disabled={this.state.current != 3 && this.state.isNextDisabled} disabled={this.state.current != 3 && this.state.isNextDisabled}
// className='primaryBlue' // className='primaryBlue'
handleClick={() => this.next()} handleClick={() => this.next()}
...@@ -377,8 +392,8 @@ export default class ImportUtil extends React.PureComponent { ...@@ -377,8 +392,8 @@ export default class ImportUtil extends React.PureComponent {
{this.state.current > 0 && ( {this.state.current > 0 && (
<ButtonDiy <ButtonDiy
style={{ marginLeft: 8 }} style={{ marginLeft: 8 }}
name='上一步' name="上一步"
className='defaultBlue' className="defaultBlue"
handleClick={() => this.prev()} handleClick={() => this.prev()}
/> />
)} )}
...@@ -397,13 +412,13 @@ export default class ImportUtil extends React.PureComponent { ...@@ -397,13 +412,13 @@ export default class ImportUtil extends React.PureComponent {
<div className={styles.buttonDown}> <div className={styles.buttonDown}>
<Upload {...props}> <Upload {...props}>
<Button> <Button>
<Icon type='upload' /> <Icon type="upload" />
点击上传 点击上传
</Button> </Button>
</Upload> </Upload>
<ButtonDiy <ButtonDiy
name={'下载模板'} name={'下载模板'}
type='primary' type="primary"
// className='primaryBlue' // className='primaryBlue'
handleClick={() => this.downloadFile()} handleClick={() => this.downloadFile()}
loading={this.state.confirmLoading} loading={this.state.confirmLoading}
...@@ -412,7 +427,7 @@ export default class ImportUtil extends React.PureComponent { ...@@ -412,7 +427,7 @@ export default class ImportUtil extends React.PureComponent {
) : ( ) : (
<Upload {...props}> <Upload {...props}>
<Button> <Button>
<Icon type='upload' /> <Icon type="upload" />
重新上传 重新上传
</Button> </Button>
</Upload> </Upload>
...@@ -432,21 +447,21 @@ export default class ImportUtil extends React.PureComponent { ...@@ -432,21 +447,21 @@ export default class ImportUtil extends React.PureComponent {
activeKey={this.state.currentKey} activeKey={this.state.currentKey}
key={this.state.ch} key={this.state.ch}
onChange={this.changePane} onChange={this.changePane}
type='card'> type="card">
{this.state.errData && this.state.errData.length == 0 ? ( {this.state.errData && this.state.errData.length == 0 ? (
'' ''
) : ( ) : (
<TabPane tab={<span style={{ color: 'red' }}>验证错误列表</span>} key='1'> <TabPane tab={<span style={{ color: 'red' }}>验证错误列表</span>} key="1">
<Button {/*<Button
style={{ marginTop: 5, marginBottom: 5 }} style={{ marginTop: 5, marginBottom: 5 }}
type='danger' type='danger'
onClick={this.exportError.bind(this, column1, this.state.errData)}> onClick={this.exportError.bind(this, column1, this.state.errData)}>
导出错误信息 导出错误信息
</Button> </Button>*/}
<Table <Table
columns={column1} columns={column1}
size='small' size="small"
style={{ overflow: 'auto' }} style={{ overflow: 'auto' }}
dataSource={this.state.errData} dataSource={this.state.errData}
bordered={true} bordered={true}
...@@ -454,17 +469,20 @@ export default class ImportUtil extends React.PureComponent { ...@@ -454,17 +469,20 @@ export default class ImportUtil extends React.PureComponent {
/> />
</TabPane> </TabPane>
)} )}
<TabPane tab={<span style={{ color: 'green' }}>验证成功列表</span>} key='2'> <TabPane tab={<span style={{ color: 'green' }}>验证成功列表</span>} key="2">
<Button {/*<Button
style={{ marginTop: 5, marginBottom: 5 }} style={{
type='primary' marginTop: 5,
marginBottom: 5,
}}
type="primary"
onClick={this.exportError.bind(this, column2, this.state.sucData)}> onClick={this.exportError.bind(this, column2, this.state.sucData)}>
导出正确信息 导出正确信息
</Button> </Button>*/}
<Table <Table
columns={column2} columns={column2}
size='small' size="small"
style={{ overflow: 'auto' }} style={{ overflow: 'auto' }}
dataSource={this.state.sucData} dataSource={this.state.sucData}
bordered={true} bordered={true}
......
...@@ -22,6 +22,7 @@ import OrderItem from './OrderItem'; ...@@ -22,6 +22,7 @@ import OrderItem from './OrderItem';
import FormdataWrapper from '../utils/object-to-formdata-custom'; import FormdataWrapper from '../utils/object-to-formdata-custom';
import ButtonDiy from './ButtonDiy/ButtonDiy'; import ButtonDiy from './ButtonDiy/ButtonDiy';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
const Option = Select.Option; const Option = Select.Option;
var keyX = 1; var keyX = 1;
...@@ -293,6 +294,7 @@ export default class SearchInfo extends React.Component { ...@@ -293,6 +294,7 @@ export default class SearchInfo extends React.Component {
fetch(url, { fetch(url, {
method: 'POST', method: 'POST',
body: FormdataWrapper(params), body: FormdataWrapper(params),
...getHeaders(),
}) })
.then((res) => { .then((res) => {
if (res.status != '200') { if (res.status != '200') {
......
...@@ -8,6 +8,7 @@ import styles from '../Ability.css'; ...@@ -8,6 +8,7 @@ import styles from '../Ability.css';
import FormdataWrapper from '../../utils/object-to-formdata-custom'; import FormdataWrapper from '../../utils/object-to-formdata-custom';
import ButtonDiy from '../ButtonDiy/ButtonDiy'; import ButtonDiy from '../ButtonDiy/ButtonDiy';
import { nameSpan, nameSpan3, nameSpan2 } from './config'; import { nameSpan, nameSpan3, nameSpan2 } from './config';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
const Option = Select.Option; const Option = Select.Option;
const FormItem = Form.Item; const FormItem = Form.Item;
...@@ -277,6 +278,8 @@ export default class StatisticsInfo extends React.Component { ...@@ -277,6 +278,8 @@ export default class StatisticsInfo extends React.Component {
fetch(url, { fetch(url, {
method: 'POST', method: 'POST',
body: FormdataWrapper(params), body: FormdataWrapper(params),
...getHeaders(),
}) })
.then((res) => { .then((res) => {
if (res.status != '200') { if (res.status != '200') {
......
import { apiRequest } from '@/webPublic/one_stop_public/utils/request';
import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import baseX from 'base-x';
import encryptApiList from '@/webPublic/one_stop_public/Base16/encryptApiList';
var BASE16 = '0123456789abcdef';
var bs16 = baseX(BASE16);
function checkOpenBase16() {
const is_open_base14 = sessionStorage.getItem('is_open_base16')
? JSON.parse(sessionStorage.getItem('is_open_base16'))
: false;
return is_open_base14;
}
export function Base16Encode(value) {
const is_open_base14 = checkOpenBase16();
if (is_open_base14) {
if (!value) {
return null;
} else {
let newV = new Buffer(value); // 快
const r = bs16.encode(newV); // 慢
return r;
}
}
return value;
}
function giveKey(key, datas) {
if (datas && datas[key]) {
datas[key] = Base16Encode(datas[key]);
}
return datas;
}
export async function countAllValues(datas, item) {
if (item.setNull) {
datas.allValues = JSON.stringify({});
} else {
if (item.query) {
if (datas?.sqlKey.length < 13) {
const response = await apiRequest('/SqlManageEntityApi/findParamsKey', {
sqlKey: datas.sqlKey,
});
if (!response || (Array.isArray(response) && response.length === 0)) {
datas.allValues = JSON.stringify({});
} else {
const x = (isJSON(datas.allValues) && JSON.parse(datas.allValues)) || {};
const y = {};
for (let i of response) {
if (x[i]) {
y[i] = x[i];
}
datas.allValues = JSON.stringify(y);
}
}
} else {
datas.allValues = JSON.stringify({});
}
}
}
return datas;
}
export async function giveBase16EncodeAsync(datas, url) {
if (!checkOpenBase16()) {
return datas;
}
if (url && typeof url === 'string') {
for (let item of encryptApiList) {
if (url.indexOf(item.api) > -1) {
for (let g of item.key) {
if (datas[g] && item.filterEmpty && item.filterEmpty.includes(g)) {
// 压缩代码功能暂时屏蔽
/***
// console.log(datas[g]);
// console.log('%c加密数据压缩前字段' + g + '= ', 'color: red;');
// console.log('%c'+ datas[g] , 'color: red;');
// datas[g] = datas[g].replace(/\r/g, ' ').replace(/\t/g, ' ').replace(/\n/g, ' ').replace(/\s\s+/g, ' ');
// console.log('%c加密数据压缩后字段' + g + '= ', 'color: orange;');
// console.log('%c'+ datas[g] , 'color: orange;');
***/
}
if (g === 'allValues' && typeof datas[g] !== 'undefined') {
datas = await countAllValues(datas, item); // 循环中 不要写await
datas = giveKey('allValues', datas);
} else {
// console.log(g, datas);
datas = giveKey(g, datas);
}
}
if (item.yinShe) {
// 映射参数字段.
datas.isBase = true;
for (let oldKey in item.yinShe) {
let newKey = item.yinShe[oldKey];
// if(typeof datas[oldKey] !== 'undefined'){
datas[newKey] = datas[oldKey];
delete datas[oldKey];
// }
}
}
return datas;
}
}
}
return datas;
}
import encryptApiList, { resBinaryApiList } from '@/webPublic/one_stop_public/Base16/encryptApiList';
import { getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token';
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
import { qqCw } from '@/webPublic/one_stop_public/utils/request';
import { getHeaders, isJSON } from '@/webPublic/zyd_public/utils/utils';
import { deepCopy } from '@/webPublic/one_stop_public/utils/myutils';
import { countAllValues } from '@/webPublic/one_stop_public/Base16/SplitBase16Index';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
import { strToBinary } from './strToBinary'; // 字符串转二进制 混淆代码
import { binaryToStr } from './binaryToStr'; // 二进制字符串转JSON字符串 混淆代码
const test = !!(getUrlInfo().test);
function formatDatas(datas, url = '') {
let datasCode = JSON.stringify(datas);
const openIsBinary = window.CONFIG?.IS_BINARY;
if (test) {
console.log(url, datas);
}
if (openIsBinary) {
datasCode = strToBinary(datasCode);
}
let file = new File([datasCode], 'fileParams.jpeg', {
type: 'image/jpeg',
});
let datasTrue = {
fileParams: file,
};
if (openIsBinary) {
datasTrue.bin = true;
if (window.CONFIG?.ALL_R_BIN) {
datasTrue.rbin = true;
} else {
let findIndexA = resBinaryApiList.findIndex(g => {
return url.includes(g.api);
});
if (findIndexA >= 0) {
datasTrue.rbin = true;
}
}
}
return datasTrue;
}
export async function giveFilePostData(datas, url) {
for (let i in datas) {
if (
datas[i] === null ||
(Array.isArray(datas[i]) && datas[i].length === 0) ||
datas[i] === undefined
) {
delete datas[i];
}
}
if (url && typeof url === 'string') {
for (let item of encryptApiList) {
if ((window.CONFIG?.ALLBIN && url.indexOf('/onestop/') > -1) || url.indexOf(item.api) > -1) {
const roleGroup = getUserInfo().groupsId;
if (url.indexOf('http') > -1) {
url = url.replace('/onestop/', `/onestop/safe/${roleGroup}/`);
} else {
url = url.replace(url, `/safe/${roleGroup}/` + url);
url = url.replaceAll('//', '/');
}
datas = await countAllValues(datas, item);
return new Promise((resolve, reject) => {
resolve({
datas: formatDatas(datas, url),
url,
});
});
}
}
}
return new Promise((resolve, reject) => {
resolve(datas);
return datas;
});
}
function testPromise(d) {
return new Promise((resolve, reject) => {
resolve(d);
});
}
export async function requestFileInfo(url, datas) {
// for (let i = 0; i < 100; i++) {
// datas = await testPromise(datas);
// }
const formData = new FormData();
if (getToken()) {
datas.token = getToken();
}
for (let key in datas) {
formData.append(key, datas[key]);
}
if (!url || typeof url !== 'string') {
return false;
}
let trueUrl = url && url.indexOf('http') > -1 ? url : queryApiActionPath() + url;
if (test) {
console.log('转换前', trueUrl);
}
const {transformApi, headersApi } = await getTransformApi(trueUrl);
if (test) {
console.log('转换后' + transformApi, headersApi);
}
return fetch(transformApi, {
headers: {
Accept: 'application/json',
...getHeaders(transformApi).headers,
apis: headersApi,
// axxx: `select * from user123 where id = 1`,
},
method: 'POST',
credentials: 'omit',
mode: 'cors',
body: formData,
})
.then(res => {
if (res.status === 401) {
qqCw({
title: '登录过期401',
customErrMsg: '登录已过期,请重新登录',
});
return false;
}
if (res.status === 404) {
qqCw({
title: 'http404报错',
customErrMsg: '请联系系统管理员',
});
return false;
}
return res.json();
})
.then(res => {
if (res && typeof res === 'object' && res.rbin) {
res = binaryToStr(res.rbin);
if (isJSON(res)) {
res = JSON.parse(res);
}
}
if (res && res.errCode) {
qqCw({
msg: res.errMsg || res.message,
customErrMsg: res.customErrMsg,
});
return false;
}
if (test) {
console.log({
url,
res,
});
}
return res;
});
}
export function giveFilePostDataInfoForTrue(datas, url) {
if (!window.CONFIG?.IS_SAFE) {
return {
datas,
url,
};
}
datas = deepCopy(datas);
for (let i in datas) {
if (
datas[i] === null ||
(Array.isArray(datas[i]) && datas[i].length === 0) ||
datas[i] === undefined
) {
delete datas[i];
}
}
if (url) {
const roleGroup = getUserInfo().groupsId;
if (url.indexOf('http') > -1) {
url = url.replace('/onestop/', `/onestop/safe/${roleGroup}/`);
} else {
url = url.replace(url, `/safe/${roleGroup}/` + url);
url = url.replaceAll('//', '/');
}
return {
datas: formatDatas(datas, url),
url,
};
}
}
/**
* 二进制字符串转JSON字符串
* */
export function binaryToStr(binaryStr = '') {
let res = '';
if (binaryStr) {
binaryStr = binaryStr.replaceAll('.', '1');
binaryStr = binaryStr.replaceAll('-', '0');
let strListArr = binaryStr.split('_');
for (let i = 0; i < strListArr.length; i++) {
let item = strListArr[i];
res += String.fromCharCode(parseInt(item, 2));
}
}
return res;
}
...@@ -6,6 +6,9 @@ const encryptApiList = [ ...@@ -6,6 +6,9 @@ const encryptApiList = [
{ {
api: 'UnifiedServicePatternApi/updateForm', api: 'UnifiedServicePatternApi/updateForm',
}, },
{
api: 'getApis',
},
{ {
api: 'UnifiedServicePatternApi/getDetail', api: 'UnifiedServicePatternApi/getDetail',
}, },
...@@ -144,7 +147,10 @@ const resBinaryApiList = [ ...@@ -144,7 +147,10 @@ const resBinaryApiList = [
{ {
api: 'SqlManageEntityApi/find', api: 'SqlManageEntityApi/find',
}, },
] {
api: 'getApis',
},
];
export { resBinaryApiList }; export { resBinaryApiList };
......
import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
export default function getOneStopUploadUrl(){
return queryApiActionPath() + '/upload';
}
import baseX from 'base-x'; import { queryIsSafe } from '@/webPublic/one_stop_public/utils/queryConfig';
import { apiRequest, qqCw } from '../utils/request';
import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import {
queryApiActionPath,
queryIsBinary,
queryIsSafe,
} from '@/webPublic/one_stop_public/utils/queryConfig';
import { getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token';
import encryptApiList, { resBinaryApiList } from './encryptApiList';
import { uploadFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem'; import { uploadFile } from '@/webPublic/one_stop_public/libs/PictureSignature/ShowItem';
import { deepCopy } from '@/webPublic/one_stop_public/utils/myutils'; import {
Base16Encode,
var BASE16 = '0123456789abcdef'; giveBase16EncodeAsync,
var bs16 = baseX(BASE16); } from './SplitBase16Index';
import { giveFilePostData, giveFilePostDataInfoForTrue, requestFileInfo } from './binaryEncode';
function checkOpenBase16() {
const is_open_base14 = sessionStorage.getItem('is_open_base16')
? JSON.parse(sessionStorage.getItem('is_open_base16'))
: false;
return is_open_base14;
}
export function Base16Encode(value) {
const is_open_base14 = checkOpenBase16();
if (is_open_base14) {
if (!value) {
return null;
} else {
let newV = new Buffer(value); // 快
const r = bs16.encode(newV); // 慢
return r;
}
}
return value;
}
const giveKey = (key, datas) => {
if (datas && datas[key]) {
datas[key] = Base16Encode(datas[key]);
}
return datas;
};
const countAllValues = async (datas, item) => {
if (item.setNull) {
datas.allValues = JSON.stringify({});
} else {
if (item.query) {
if (datas?.sqlKey.length < 13) {
const response = await apiRequest('/SqlManageEntityApi/findParamsKey', {
sqlKey: datas.sqlKey,
});
if (!response || (Array.isArray(response) && response.length === 0)) {
datas.allValues = JSON.stringify({});
} else {
const x = (isJSON(datas.allValues) && JSON.parse(datas.allValues)) || {};
const y = {};
for (let i of response) {
if (x[i]) {
y[i] = x[i];
}
datas.allValues = JSON.stringify(y);
}
}
} else {
datas.allValues = JSON.stringify({});
}
}
}
return datas;
};
export function requestFileInfo(url, datas) {
const formData = new FormData();
if (getToken()) {
datas.token = getToken();
}
for (let key in datas) {
formData.append(key, datas[key]);
}
if (!url || typeof url !== 'string') {
console.log(url);
return false;
}
return fetch(url && url.indexOf('http') > -1 ? url : queryApiActionPath() + url, {
headers: {
Accept: 'application/json',
// Authorization: `bearer ${getToken()}`,
},
method: 'POST',
credentials: 'omit',
mode: 'cors',
body: formData,
})
.then(res => {
if (res.status === 401) {
qqCw({
title: '登录过期401',
customErrMsg: '登录已过期,请重新登录',
});
return false;
}
if (res.status === 404) {
qqCw({
title: 'http404报错',
customErrMsg: '请联系系统管理员',
});
return false;
}
// console.log(res.status);
return res.json();
})
.then(res => {
if (res && typeof res === 'object' && res.rbin) {
res = binaryToStr(res.rbin);
if (isJSON(res)) {
res = JSON.parse(res);
}
// console.log(res);
}
if (res && res.errCode) {
qqCw({
msg: res.errMsg || res.message,
customErrMsg: res.customErrMsg,
});
return false;
}
if(window.location.origin.indexOf('localhost') > -1){
console.log({
datas,
url,
res,
});
}
return res;
});
}
function formatDatas(datas, url = '') {
let datasCode = JSON.stringify(datas);
const openIsBinary = window.CONFIG?.IS_BINARY;
if (openIsBinary) {
datasCode = strToBinary(datasCode);
}
let file = new File([datasCode], 'fileParams.jpeg', {
type: 'image/jpeg',
});
let datasTrue = {
fileParams: file,
};
if (openIsBinary) {
datasTrue.bin = true;
if(window.CONFIG?.ALLBIN){
datasTrue.rbin = true;
}else{
let findIndexA = resBinaryApiList.findIndex(g => {
return url.includes(g.api);
});
if (findIndexA >= 0) {
datasTrue.rbin = true;
}
}
}
return datasTrue;
}
export function giveFilePostDataInfoForTrue(datas, url) {
if (!window.CONFIG?.IS_SAFE) {
return {
datas,
url,
};
}
datas = deepCopy(datas);
for (let i in datas) {
if (
datas[i] === null ||
(Array.isArray(datas[i]) && datas[i].length === 0) ||
datas[i] === undefined
) {
delete datas[i];
}
}
if (url) {
const roleGroup = getUserInfo().groupsId;
if (url.indexOf('http') > -1) {
url = url.replace('/onestop/', `/onestop/safe/${roleGroup}/`);
} else {
url = url.replace(url, `/safe/${roleGroup}/` + url);
url = url.replaceAll('//', '/');
}
return {
datas: formatDatas(datas, url),
url,
};
}
}
/**
* 字符串转二进制
* */
function strToBinary(str) {
let result = [];
let list = str.split('');
for (let i = 0; i < list.length; i++) {
if (i !== 0) {
result.push('_');
}
let item = list[i];
let binaryStr = item.charCodeAt()
.toString(2);
result.push(binaryStr);
}
let resultStr = result.join('');
resultStr = resultStr.replaceAll('0', '-').replaceAll('1', '.');
return resultStr;
}
/** export { Base16Encode, requestFileInfo, giveFilePostDataInfoForTrue };
* 二进制字符串转JSON字符串
* */
function binaryToStr(binaryStr = '') {
let res = '';
if (binaryStr) {
binaryStr = binaryStr.replaceAll('.', '1');
binaryStr = binaryStr.replaceAll('-', '0');
let strListArr = binaryStr.split('_');
for (let i = 0; i < strListArr.length; i++) {
let item = strListArr[i];
res += String.fromCharCode(parseInt(item, 2));
}
}
return res;
}
function giveFilePostData(datas, url) {
for (let i in datas) {
if (
datas[i] === null ||
(Array.isArray(datas[i]) && datas[i].length === 0) ||
datas[i] === undefined
) {
delete datas[i];
}
}
if (url && typeof url === 'string') {
for (let item of encryptApiList) {
if (url.indexOf(item.api) > -1 || Window.CONFIG?.ALLBIN) {
const roleGroup = getUserInfo().groupsId;
if (url.indexOf('http') > -1) {
url = url.replace('/onestop/', `/onestop/safe/${roleGroup}/`);
} else {
url = url.replace(url, `/safe/${roleGroup}/` + url);
url = url.replaceAll('//', '/');
}
return new Promise((resolve, reject) => {
resolve({
datas: formatDatas(datas, url),
url,
});
});
}
}
}
return new Promise((resolve, reject) => {
resolve(datas);
return datas;
});
}
export async function giveBase16EnCode(datas, url) { export async function giveBase16EnCode(datas, url) {
// 全局加解密函数. // 全局加解密函数.
if (queryIsSafe()) { if (queryIsSafe() && url) {
return giveFilePostData(datas, url); return giveFilePostData(datas, url);
} }
if (!checkOpenBase16()) { return giveBase16EncodeAsync(datas, url);
return datas;
}
if (url && typeof url === 'string') {
for (let item of encryptApiList) {
if (url.indexOf(item.api) > -1) {
for (let g of item.key) {
if (datas[g] && item.filterEmpty && item.filterEmpty.includes(g)) {
// 压缩代码功能暂时屏蔽
/***
// console.log(datas[g]);
// console.log('%c加密数据压缩前字段' + g + '= ', 'color: red;');
// console.log('%c'+ datas[g] , 'color: red;');
// datas[g] = datas[g].replace(/\r/g, ' ').replace(/\t/g, ' ').replace(/\n/g, ' ').replace(/\s\s+/g, ' ');
// console.log('%c加密数据压缩后字段' + g + '= ', 'color: orange;');
// console.log('%c'+ datas[g] , 'color: orange;');
***/
}
if (g === 'allValues' && typeof datas[g] !== 'undefined') {
datas = await countAllValues(datas, item); // 循环中 不要写await
datas = giveKey('allValues', datas);
} else {
// console.log(g, datas);
datas = giveKey(g, datas);
}
}
if (item.yinShe) {
// 映射参数字段.
datas.isBase = true;
for (let oldKey in item.yinShe) {
let newKey = item.yinShe[oldKey];
// if(typeof datas[oldKey] !== 'undefined'){
datas[newKey] = datas[oldKey];
delete datas[oldKey];
// }
}
}
return datas;
}
}
}
return datas;
} }
/**
* 字符串转二进制
* */
export function strToBinary(str) {
let result = [];
let list = str.split('');
for (let i = 0; i < list.length; i++) {
if (i !== 0) {
result.push('_');
}
let item = list[i];
let binaryStr = item.charCodeAt()
.toString(2);
result.push(binaryStr);
}
let resultStr = result.join('');
resultStr = resultStr.replaceAll('0', '-').replaceAll('1', '.');
return resultStr;
}
...@@ -41,9 +41,8 @@ import { queryApiVersion, queryApiActionPath } from '@/webPublic/one_stop_public ...@@ -41,9 +41,8 @@ import { queryApiVersion, queryApiActionPath } from '@/webPublic/one_stop_public
import { isJSON } from '@/webPublic/zyd_public/utils/utils'; import { isJSON } from '@/webPublic/zyd_public/utils/utils';
import HistoryFormList from '@/webPublic/one_stop_public/DetailForAudit/HistoryFormList'; import HistoryFormList from '@/webPublic/one_stop_public/DetailForAudit/HistoryFormList';
@Form.create()
@connect() @connect()
export default class DetailSplit extends Component { class DetailSplit extends Component {
constructor() { constructor() {
super(); super();
this.state = { this.state = {
...@@ -87,7 +86,6 @@ export default class DetailSplit extends Component { ...@@ -87,7 +86,6 @@ export default class DetailSplit extends Component {
userInfo: '', // 得到用户数据 userInfo: '', // 得到用户数据
setData: '', // 配置的数据 setData: '', // 配置的数据
countersignModal: '', // 开启加签弹框函数 countersignModal: '', // 开启加签弹框函数
nextAuditInfo: {}, // 最新的节点的审核人信息
isAllPrint: false, isAllPrint: false,
}; };
window.callbackSubmitInfoZhiYong = undefined; window.callbackSubmitInfoZhiYong = undefined;
...@@ -162,6 +160,7 @@ export default class DetailSplit extends Component { ...@@ -162,6 +160,7 @@ export default class DetailSplit extends Component {
code: code || null, // 表单值 code: code || null, // 表单值
handleUser: handleUser || null, // 处理人 handleUser: handleUser || null, // 处理人
taskId, // 多任务流程会使用到,后续改为必须传入 taskId, // 多任务流程会使用到,后续改为必须传入
lite: true,
}, },
callback: val => { callback: val => {
if (this.props.changeData) { if (this.props.changeData) {
...@@ -175,27 +174,14 @@ export default class DetailSplit extends Component { ...@@ -175,27 +174,14 @@ export default class DetailSplit extends Component {
label: item.taskName, label: item.taskName,
value: item.formKey, value: item.formKey,
}); });
// checkedConfimList.push(item.formKey);
}); });
} }
if (val.code) { if (val && !val.taskInfo) {
permRequest('/UnifiedAppFormApi/getAll', { permRequest('/UnifiedAppFormApi/getTaskInfos', { // 获取每一步的审核人.
keyWords: val.code, id: queryId ? queryId : id, // 审批表Id
pageNo: 1,
pageSize: 10,
}) })
.then(res => { .then(res => {
if (res && res.rows && res.rows.length) { val.taskInfo = res.taskInfo;
let thisAuditData = res.rows[0];
if (thisAuditData?.nextUsers?.endsWith(',')) {
thisAuditData.nextUsers = thisAuditData.nextUsers.slice(0, -1);
}
this.setState({
nextAuditInfo: thisAuditData,
});
}
});
}
this.setState( this.setState(
{ {
data: val, data: val,
...@@ -238,6 +224,10 @@ export default class DetailSplit extends Component { ...@@ -238,6 +224,10 @@ export default class DetailSplit extends Component {
}, },
); );
});
}
}, },
}); });
...@@ -315,12 +305,12 @@ export default class DetailSplit extends Component { ...@@ -315,12 +305,12 @@ export default class DetailSplit extends Component {
callback(); callback();
} }
let checkSumbitInfo = checkNeedFormValidateFieldsAndScroll({ let checkSumbitInfo = checkNeedFormValidateFieldsAndScroll({ // 检查是否必填表单值
btns, btns,
btnValue, btnValue,
}); });
let needWriteAuditInfo = checkNeedWriteAuditInfo({ let needWriteAuditInfo = checkNeedWriteAuditInfo({ // 检查是否必填审批理由
btns, btns,
btnValue, btnValue,
}); });
...@@ -432,7 +422,6 @@ export default class DetailSplit extends Component { ...@@ -432,7 +422,6 @@ export default class DetailSplit extends Component {
paddingBottom, paddingBottom,
setData, setData,
isSign, isSign,
nextAuditInfo,
isAllPrint, isAllPrint,
} = this.state; } = this.state;
const { showPrint } = this.props; const { showPrint } = this.props;
...@@ -576,7 +565,8 @@ export default class DetailSplit extends Component { ...@@ -576,7 +565,8 @@ export default class DetailSplit extends Component {
</div> </div>
</div> </div>
</div> </div>
{isLoading ? ( {isLoading ?
(
<> <>
<Card style={{ width: '100%' }}> <Card style={{ width: '100%' }}>
{!isCloseUserDetail && ( {!isCloseUserDetail && (
...@@ -752,8 +742,8 @@ export default class DetailSplit extends Component { ...@@ -752,8 +742,8 @@ export default class DetailSplit extends Component {
<p>审批人员: {data.nextUsers}</p> <p>审批人员: {data.nextUsers}</p>
) )
} }
{queryApiVersion() !== '2.0' && ['处理中', '待处理'].includes(item.status) && !!nextAuditInfo.nextUsers && ( {queryApiVersion() !== '2.0' && ['处理中', '待处理'].includes(item.status) && !!item.nextUsers && (
<p>审批人员: {nextAuditInfo.nextUsers}</p> <p>审批人员: {item.nextUsers}</p>
)} )}
<p>审批流程:{item.name}</p> <p>审批流程:{item.name}</p>
<p className={styles.steps_body}>审批状态:{item.status}</p> <p className={styles.steps_body}>审批状态:{item.status}</p>
...@@ -867,6 +857,7 @@ export default class DetailSplit extends Component { ...@@ -867,6 +857,7 @@ export default class DetailSplit extends Component {
isSumbitLoading={isSumbitLoading} isSumbitLoading={isSumbitLoading}
isSecond={isSecond} isSecond={isSecond}
affairOk={this.affairOk} affairOk={this.affairOk}
form={this.props.form}
btns={btns} btns={btns}
addition={ addition={
<> <>
...@@ -980,3 +971,11 @@ export default class DetailSplit extends Component { ...@@ -980,3 +971,11 @@ export default class DetailSplit extends Component {
); );
} }
} }
export default function Index(props){
console.log(window.zdyTableTemplateWillMountProps?.formCreateOptions);
const DetailSplitFormNew = Form.create(
window.zdyTableTemplateWillMountProps?.formCreateOptions || undefined,
)(DetailSplit);
return <DetailSplitFormNew {...props}/>;
}
...@@ -35,7 +35,6 @@ export default class GetDetail extends Component { ...@@ -35,7 +35,6 @@ export default class GetDetail extends Component {
render() { render() {
const {id} = this.state; const {id} = this.state;
console.log(this.props.showPrint);
const { const {
detailInfoDivStyle = { detailInfoDivStyle = {
backgroundColor: '#FFFFFF', backgroundColor: '#FFFFFF',
......
...@@ -11,7 +11,6 @@ import { openToast } from '@/webPublic/one_stop_public/DetailForAudit/components ...@@ -11,7 +11,6 @@ import { openToast } from '@/webPublic/one_stop_public/DetailForAudit/components
import { connect } from 'dva'; import { connect } from 'dva';
import ZdyTable from '@/webPublic/one_stop_public/Table'; import ZdyTable from '@/webPublic/one_stop_public/Table';
import { preHandle } from '@/webPublic/one_stop_public/utils/myutils'; import { preHandle } from '@/webPublic/one_stop_public/utils/myutils';
import router from 'umi/router';
import { isEmpty } from 'lodash'; import { isEmpty } from 'lodash';
import { callbackApplyData } from '@/webPublic/one_stop_public/models/callbackExamineProcess'; import { callbackApplyData } from '@/webPublic/one_stop_public/models/callbackExamineProcess';
import { isJSON } from '@/webPublic/one_stop_public/tableCompon/Split_Index/staticInfo'; import { isJSON } from '@/webPublic/one_stop_public/tableCompon/Split_Index/staticInfo';
......
...@@ -5,9 +5,31 @@ ...@@ -5,9 +5,31 @@
*/ */
import React, { Component } from 'react'; import React, { Component } from 'react';
import SignatureCanvas from 'react-signature-canvas'; import SignatureCanvas from 'react-signature-canvas';
import { message, Button } from 'antd'; import { message, Button, Modal } from 'antd';
import config from '@/webPublic/one_stop_public/config'; import config from '@/webPublic/one_stop_public/config';
import reqwest from 'reqwest'; import reqwest from 'reqwest';
import { getToken, getUserInfo } from '@/webPublic/one_stop_public/utils/token';
import { uaaRequest } from '@/webPublic/one_stop_public/utils/request';
import { getOneStopMyInfo } from '@/webPublic/one_stop_public/utils/utils';
import styles from './mobileSign.less';
// 保存签名 到用户基础信息上
function saveSign(url) {
if (typeof url !== 'string' || url.length < 15) {
return true;
}
const userInfo = getUserInfo();
uaaRequest('/UserApi/saveMySysBackgroundImage', {
username: userInfo.stuNo,
backgroundImageUrl: userInfo.backgroundImageUrl || 'fakeBackgroundImageUrl', // 假数据
isUseBackImage: userInfo.isUseBackImage || false,
userSign: url,
})
.then((g) => {
getOneStopMyInfo();
return true;
});
}
function dataURLtoBlob(toDataURL) { function dataURLtoBlob(toDataURL) {
var arr = toDataURL.split(','), var arr = toDataURL.split(','),
...@@ -27,17 +49,17 @@ function blobToFile(Blob, fileName) { ...@@ -27,17 +49,17 @@ function blobToFile(Blob, fileName) {
return Blob; return Blob;
} }
export default class Index extends Component { export default class Signature extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
const value = props.value; const value = props.value;
this.state = { this.state = {
url: value, url: value || getUserInfo().userSign,
showModal: false,
}; };
} }
triggerChange = (changedValue) => { triggerChange = (changedValue) => {
// Should provide an event to pass value to Form.
const onChange = this.props.onChange; const onChange = this.props.onChange;
if (onChange) { if (onChange) {
onChange(changedValue); onChange(changedValue);
...@@ -46,12 +68,11 @@ export default class Index extends Component { ...@@ -46,12 +68,11 @@ export default class Index extends Component {
componentWillReceiveProps(nextProps) { componentWillReceiveProps(nextProps) {
// Should be a controlled component. // Should be a controlled component.
if ('value' in nextProps) { if ('value' in nextProps && nextProps.value) {
const value = nextProps.value; const value = nextProps.value;
if (value !== this.state.url) {
this.setState({ url: value }); this.setState({ url: value });
}
//
} }
} }
...@@ -73,6 +94,7 @@ export default class Index extends Component { ...@@ -73,6 +94,7 @@ export default class Index extends Component {
this.triggerChange(null); this.triggerChange(null);
}; };
trim = () => { trim = () => {
message.info('正在保存签名,请等待');
const formData = new FormData(); const formData = new FormData();
const xx = dataURLtoBlob(this.sigCanvas.toDataURL('image/png')); const xx = dataURLtoBlob(this.sigCanvas.toDataURL('image/png'));
const file = blobToFile(xx, 'sign.png'); const file = blobToFile(xx, 'sign.png');
...@@ -80,95 +102,196 @@ export default class Index extends Component { ...@@ -80,95 +102,196 @@ export default class Index extends Component {
return; return;
} }
formData.append('file', file, 'sign.png'); formData.append('file', file, 'sign.png');
formData.append('token', getToken());
reqwest({ reqwest({
url: config.uploadUrl, url: config.uploadUrl,
method: 'post', method: 'post',
processData: false, processData: false,
data: formData, data: formData,
success: (url) => { success: (url) => {
if (!('value' in this.props)) { /**
this.setState({ url: url }); * 这里的成功 是走的下面的 error
} * */
this.triggerChange(url); // console.log('22334455');
// if (!('value' in this.props)) {
// this.setState({ url: url });
// }
// this.triggerChange(url);
//
message.success('保存成功'); message.success('保存成功');
}, },
error: (e) => { error: (e) => {
if (e.status == 200) { if (e.status === 200) {
const urlP = e.response;
saveSign(urlP);
message.success('保存成功'); message.success('保存成功');
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState({ url: e.response }); this.setState({ url: e.response });
} }
this.changeShowModal();
this.triggerChange(e.response); this.triggerChange(e.response);
} else { } else {
message.error('保存失败'); message.error('保存失败');
} }
}, },
}); });
//let trimmedCanvas = this.sigCanvas.getTrimmedCanvas();
// this.setState({trimmedDataURL: this.sigCanvas.toDataURL('image/png')})
}; };
render() { componentDidMount() {
const { if (!this.props.value && this.state.url) {
width, setTimeout(() => {
height, this.triggerChange(this.state.url);
} = this.props; }, 2000);
}
}
changeShowModal = () => {
this.setState({
showModal: !this.state.showModal,
});
};
// 移动端签名组件
MobileSign = () => {
const { url } = this.state; const { url } = this.state;
if (url) {
return <div className={styles.mobileSign}>
<Button type={'primary'}
onClick={this.changeShowModal}
className={styles.reSign}
>
重新签名
</Button>
<img src={config.httpServer + url} style={{}}
/>
</div>;
} else {
return <div className={styles.mobileSign2}>
<Button type={'primary'} onClick={this.changeShowModal}>
点击开始签名
</Button>
</div>;
}
};
MobileModal = () => {
const { showModal } = this.state;
const height = 300;
const width = window.screen.width - 50;
return ( return (
<div id='canvas_signature' style={{ showModal && <Modal className={styles.mobileModal}
width: '100%', width={'100vw'}
height: '100%', onCancel={this.changeShowModal}
marginLeft: 5, visible={true}
}}> onOk={this.trim}
<div title={'签名'}
style={{ bodyStyle={{
width: width, minHeight: '350px',
textAlign: 'center', padding: '24px 12px',
height: height, }}
border: '1px dashed gray', >
position: 'relative', <div className={styles.borderDiv}>
}}>
{url ? (
<img src={config.httpServer + url} style={{
width: width,
height: height,
}} />
) : (
<SignatureCanvas <SignatureCanvas
penColor='black' penColor="black"
ref={(ref) => { ref={(ref) => {
this.sigCanvas = ref; this.sigCanvas = ref;
}} }}
canvasProps={{ canvasProps={{
width: width || 400, width: width + 'px',
height: height || 200, height: height + 'px',
className: 'sigCanvas', className: 'sigCanvas',
}} }}
/> />
)}
<div style={{
position: 'absolute',
left: 5,
bottom: 5,
}}>
{url ? (
<Button type='danger' size='small' onClick={this.delete}>
重写
</Button>
) : (
<>
<Button style={{ marginLeft: 12 }} type='danger' size='small' onClick={this.clear}>
清除
</Button>
<Button style={{ marginLeft: 12 }} onClick={this.trim} size='small' type='primary'>
保存
</Button>
</>
)}
</div>
</div> </div>
</Modal>);
};
WebModal = () => {
const { showModal } = this.state;
const height = 300;
const width = 600;
return (
showModal && <Modal className={styles.mobileModal}
width={700}
onCancel={this.changeShowModal}
visible={true}
onOk={this.trim}
title={'签名'}
bodyStyle={{
minHeight: '350px',
padding: '24px 12px',
}}
>
<div className={styles.borderDiv}>
<SignatureCanvas
penColor="black"
ref={(ref) => {
this.sigCanvas = ref;
}}
canvasProps={{
width: width + 'px',
height: height + 'px',
className: 'sigCanvas',
}}
/>
</div> </div>
); </Modal>);
};
WebSign = () => {
const {
width,
height,
} = this.props;
// console.log(this.props);
const { url } = this.state;
if (url) {
return <div className={styles.webSign}>
<Button type={'primary'}
onClick={this.changeShowModal}
>
重新签名
</Button>
<img src={config.httpServer + url} style={{
height,
width,
}}
/>
</div>;
} else {
return <div className={styles.mobileSign2}>
<Button type={'primary'} onClick={this.changeShowModal}>
点击开始签名
</Button>
</div>;
}
return null;
};
render() {
// console.log('签名组件');
const {
width,
height,
get,
} = this.props;
const { url } = this.state;
if (get === 'mobile') {
// const MobileSign = this.MobileSign;
// const MobileModal = this.MobileModal;
return <>
<this.MobileSign/>
<this.MobileModal/>
</>;
} else {
return <>
<this.WebSign/>
<this.WebModal/>
</>;
}
} }
} }
.mobileSign2{
text-align: center;
}
.mobileModal{
//width: 100vw;
min-height: 70vh;
}
.borderDiv{
border: 1px solid #555;
margin-top: 20px;
}
.mobileSign{
position: relative;
text-align: center;
img{
max-width: 85%;
max-height: 300px;
border: 1px solid #f2f2f2;
margin-top: 10px;
}
}
.webSign{
position: relative;
text-align: left;
margin-left: 20px;
img{
border: 1px solid #f2f2f2;
}
}
...@@ -388,6 +388,7 @@ export default class ZdyTable extends Component { ...@@ -388,6 +388,7 @@ export default class ZdyTable extends Component {
} }
const data = datas[tr.key]; const data = datas[tr.key];
const all = []; const all = [];
if(data && data.item){
for (var i = 0; i < data.items.length; i++) { for (var i = 0; i < data.items.length; i++) {
const row = data.items[i]; const row = data.items[i];
const r = []; const r = [];
...@@ -401,6 +402,8 @@ export default class ZdyTable extends Component { ...@@ -401,6 +402,8 @@ export default class ZdyTable extends Component {
} }
all.push(r); all.push(r);
} }
}
sheetData[tr.title] = all; sheetData[tr.title] = all;
}; };
...@@ -834,7 +837,7 @@ export default class ZdyTable extends Component { ...@@ -834,7 +837,7 @@ export default class ZdyTable extends Component {
<table <table
style={{ style={{
overflow: 'auto', overflow: 'auto',
margin: max * width > 550 ? 'auto' : '', margin: max * width > 550 ? '1px auto' : '', // 禅道 27868
marginBottom: isWebPrint ? (isWebPrintEnd ? '5px' : 0) : '1px', marginBottom: isWebPrint ? (isWebPrintEnd ? '5px' : 0) : '1px',
...style, ...style,
}} }}
...@@ -852,11 +855,16 @@ export default class ZdyTable extends Component { ...@@ -852,11 +855,16 @@ export default class ZdyTable extends Component {
return; return;
} }
if (cell.uuid) { if (cell.uuid) {
// debugger; if(cell.content){
cell.content = { cell.content = {
...cell.content, ...cell.content,
...getActiveJson(currentFormKey, cell.uuid), ...getActiveJson(currentFormKey, cell.uuid),
}; };
if(window.zdyTableTemplateWillMountProps?.allDisabled){
cell.content.disabled = true;
}
}
// 27282 双选会报名后管理员修改举办时间 但是单位申请信息么有随着更新 // 27282 双选会报名后管理员修改举办时间 但是单位申请信息么有随着更新
} }
......
export default function getActiveJson(formKey = '', uuid = ''){ export default function getActiveJson(formKey = '', uuid = ''){
if(!formKey || !uuid){ if(!formKey || !uuid){
return {}; return undefined;
} }
if(window.smartFormGlobalProps?.activeJsonConfig && window.smartFormGlobalProps.activeJsonConfig[formKey]){ if(window.smartFormGlobalProps?.activeJsonConfig && window.smartFormGlobalProps.activeJsonConfig[formKey]){
return window.smartFormGlobalProps.activeJsonConfig[formKey][uuid] || {}; return window.smartFormGlobalProps.activeJsonConfig[formKey][uuid] || undefined;
} }
return {}; return undefined;
} }
import React from 'react'; import React from 'react';
import moment from 'moment'; import moment from 'moment';
import { Modal, message, notification, Tooltip, Spin, Popover, Popconfirm } from 'antd'; import { Modal, message, notification, Tooltip, Spin, Popover, Popconfirm } from 'antd';
import md5 from 'js-md5';
import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16'; import { giveFilePostDataInfoForTrue } from '@/webPublic/one_stop_public/Base16';
import { import {
getSpanJson, getSpanJson,
...@@ -9,9 +9,11 @@ import { ...@@ -9,9 +9,11 @@ import {
getColumnsDataRealize, getColumnsDataRealize,
getColumnsSqlKeyRealize, getColumnsSqlKeyRealize,
getWord, getWord,
getFileAndShow,
renderContentAll, renderContentAll,
renderContentRow, renderContentRow, downloadFile, getListWord
} from './globalFunction'; } from './globalFunction';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
export function giveSmartFormGlobalProps({ export function giveSmartFormGlobalProps({
fromStart = false, fromStart = false,
...@@ -22,7 +24,7 @@ export function giveSmartFormGlobalProps({ ...@@ -22,7 +24,7 @@ export function giveSmartFormGlobalProps({
data = {}, data = {},
nextUsers = {}, // nextUsers = {}, //
calculateFlowData = [], // 移动端使用 用于分块块 禅道 23933 移动端全表单后审核步骤的显示问题优化 calculateFlowData = [], // 移动端使用 用于分块块 禅道 23933 移动端全表单后审核步骤的显示问题优化
}) { }) {
window.smartFormGlobalProps = { window.smartFormGlobalProps = {
fromStart, fromStart,
hasSingle, hasSingle,
...@@ -39,21 +41,40 @@ export function giveSmartFormGlobalProps({ ...@@ -39,21 +41,40 @@ export function giveSmartFormGlobalProps({
getColumnsDataRealize, getColumnsDataRealize,
getColumnsSqlKeyRealize, getColumnsSqlKeyRealize,
getWord, getWord,
getFileAndShow,
getListWord,
downloadFile,
renderContentAll, renderContentAll,
renderContentRow, renderContentRow,
getTransformApi,
md5,
remark: { remark: {
'giveFilePostDataInfoForTrue(params, url) ': `将接口参数 二进制文件化 并返回新的接口地址与参数';`, downloadFile: '下载文件函数.',
'getSpanJson(mergeKey, data, eliminateStr)': `列表获取纵向合并数据 ;参数-> mergeKey : 需要合并的表头key data : 列表数据 eliminateStr : 需要忽略合并的数据`, 'giveFilePostDataInfoForTrue(params, url) ':
'getColumns(columns)': `获取ant表头的属性 ;参数->columns : ant的表头`, `将接口参数 二进制文件化 并返回新的接口地址与参数';`,
'getColumnsDataRealize({data, mergeKey, columns, styles, defect, fileName, ext , eliminateStr})': `下载列表合并的数据;参数-> 前三个必填data, mergeKey, columns`, 'getSpanJson(mergeKey, data, eliminateStr)':
'getColumnsSqlKeyRealize({sqlKey, columns, styles, fileName, ext})': `下载列表表头合并的数据;参数->前两个个必填sqlKey, columns`, `列表获取纵向合并数据 ;参数-> mergeKey : 需要合并的表头key data : 列表数据 eliminateStr : 需要忽略合并的数据`,
'getWord({templatePath,params, title, allValues, listConfig, ext})': `下载文档地址 ;参数->前五个必填 templatePath,params, title, allValues, listConfig`, 'getColumns(columns)':
'renderContentAll(value, row, index, key, spanData, cloumnNames) ': `ant表头横向、纵向合并 ;参数->所有必填 value, row, index, key, spanData, cloumnNames 实例:render:(value, row, index)=>{return renderContentAll(value, row, index,"inst_name",spanData,cloumnNames)}`, `获取ant表头的属性 ;参数->columns : ant的表头`,
'renderContentRow(value, row, index, key, spanData, cloumnNames) ': `ant表头纵向合并 ;参数->所有必填 value, row, index, key, spanData, cloumnNames 实例:render:(value, row, index)=>{return renderContentRow(value, row, index,"inst_name",spanData,cloumnNames)}`, 'getColumnsDataRealize({data, mergeKey, columns, styles, defect, fileName, ext , eliminateStr})':
`下载列表合并的数据;参数-> 前三个必填data, mergeKey, columns`,
'getColumnsSqlKeyRealize({sqlKey, columns, styles, fileName, ext})':
`下载列表表头合并的数据;参数->前两个个必填sqlKey, columns`,
'getWord({templatePath,params, title, allValues, listConfig, ext})':
`下载文档地址 ;参数->前五个必填 templatePath,params, title, allValues, listConfig`,
'getFileAndShow({templatePath,params, title, allValues, listConfig, ext})':
`下载一个文件并直接展示出来地址 ;参数->前五个必填 templatePath,params, title, allValues, listConfig`,
'getListWord({templatePath,paramsList, title,sonTitleKey, allValuesKey, listConfig, ext,sonExt})':
`批量下载文档地址 ;参数->前五个必填 templatePath,paramsList, title,sonTitleKey, allValuesKey`,
'renderContentAll(value, row, index, key, spanData, cloumnNames) ':
`ant表头横向、纵向合并 ;参数->所有必填 value, row, index, key, spanData, cloumnNames 实例:render:(value, row, index)=>{return renderContentAll(value, row, index,"inst_name",spanData,cloumnNames)}`,
'renderContentRow(value, row, index, key, spanData, cloumnNames) ':
`ant表头纵向合并 ;参数->所有必填 value, row, index, key, spanData, cloumnNames 实例:render:(value, row, index)=>{return renderContentRow(value, row, index,"inst_name",spanData,cloumnNames)}`,
'getTransformApi': '接口转换函数用于一站式接口地址加密',
md5: 'md5加密函数',
}, },
}, },
activeJsonConfig: { activeJsonConfig: {}, // 27282 双选会报名后管理员修改举办时间 但是单位申请信息么有随着更新
}, // 27282 双选会报名后管理员修改举办时间 但是单位申请信息么有随着更新
publicComponent: { publicComponent: {
React, React,
Modal, Modal,
......
...@@ -7,6 +7,7 @@ import moment from 'moment'; ...@@ -7,6 +7,7 @@ import moment from 'moment';
import { giveSmartFormGlobalProps } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps'; import { giveSmartFormGlobalProps } from '@/webPublic/one_stop_public/Table/giveSmartFormGlobalProps';
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils'; import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
const test = getUrlInfo().test;
export default function prepareShow(postData = {}, content = '') { export default function prepareShow(postData = {}, content = '') {
// 模板挂载前执行的公式 // 模板挂载前执行的公式
...@@ -18,12 +19,13 @@ export default function prepareShow(postData = {}, content = '') { ...@@ -18,12 +19,13 @@ export default function prepareShow(postData = {}, content = '') {
window.beforeAuditSubmit = undefined; // 流程审批时执行的异步回调函数 这里清空 防止泄露 window.beforeAuditSubmit = undefined; // 流程审批时执行的异步回调函数 这里清空 防止泄露
window.callbackApplyDataInfoZhiYong = undefined; // 流程发起时执行的同步函数 这里清空 防止泄露 window.callbackApplyDataInfoZhiYong = undefined; // 流程发起时执行的同步函数 这里清空 防止泄露
window.callbackSubmitInfoZhiYong = undefined; // 流程审批时执行的回调函数 这里清空 防止泄露 window.callbackSubmitInfoZhiYong = undefined; // 流程审批时执行的回调函数 这里清空 防止泄露
window.zdyTableTemplateWillMountProps = true;
window.message = message; window.message = message;
window.Modal = Modal; window.Modal = Modal;
window.moment = moment; window.moment = moment;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(agg?.unifiedServicePatternModel?.id); // 表单id; console.log(agg?.unifiedServicePatternModel?.id); // 表单id;
if (agg?.unifiedServicePatternModel?.id && window.location.href.indexOf('localhost') > -1) { if (agg?.unifiedServicePatternModel?.id && (window.location.href.indexOf('localhost') > -1 || test)) {
const SystemConfig = window.specialImportantSystemConfig || {}; const SystemConfig = window.specialImportantSystemConfig || {};
console.log('%c' + `${SystemConfig?.gateWayPort}/onestop/#/admin/processServices/modelConfig/templateDetail/designById?id=${agg.unifiedServicePatternModel.id}&token=${getToken()}`, 'color: green;background: white;font-size: 14px'); console.log('%c' + `${SystemConfig?.gateWayPort}/onestop/#/admin/processServices/modelConfig/templateDetail/designById?id=${agg.unifiedServicePatternModel.id}&token=${getToken()}`, 'color: green;background: white;font-size: 14px');
console.log('%c' + `${SystemConfig?.gateWayPort}/wisdomSchool/#/designFormByUrl?id=${agg.unifiedServicePatternModel.id}&token=${getToken()}`, 'color: green;background: white;font-size: 14px'); console.log('%c' + `${SystemConfig?.gateWayPort}/wisdomSchool/#/designFormByUrl?id=${agg.unifiedServicePatternModel.id}&token=${getToken()}`, 'color: green;background: white;font-size: 14px');
...@@ -40,9 +42,9 @@ export default function prepareShow(postData = {}, content = '') { ...@@ -40,9 +42,9 @@ export default function prepareShow(postData = {}, content = '') {
(isJSON(localStorage.getItem('user')) && JSON.parse(localStorage.getItem('user'))) || {}, (isJSON(localStorage.getItem('user')) && JSON.parse(localStorage.getItem('user'))) || {},
templateData: agg, templateData: agg,
}; };
let newFunc = new Function('props', g); let newFunc = new Function('props', g);
console.log('开始执行templateWillMount公式'); console.log('开始执行templateWillMount公式');
window.zdyTableTemplateWillMountInit = true;
try { try {
newFunc(p) // 返回一个promise newFunc(p) // 返回一个promise
.then(res => { .then(res => {
......
...@@ -3,6 +3,9 @@ import { message } from 'antd'; ...@@ -3,6 +3,9 @@ import { message } from 'antd';
import baseClone from './deepclone/baseClone'; import baseClone from './deepclone/baseClone';
import empty from './deepclone/isEmpty'; import empty from './deepclone/isEmpty';
import intersection from './deepclone/intersection'; import intersection from './deepclone/intersection';
import { isJSON } from '@/webPublic/one_stop_public/2022beidianke/isJSON';
export { isJSON };
/** /**
* 校验 开始时间必须在结束时间之前的函数 * 校验 开始时间必须在结束时间之前的函数
* */ * */
...@@ -71,23 +74,7 @@ export function randomStr() { ...@@ -71,23 +74,7 @@ export function randomStr() {
.toString(36) .toString(36)
.substr(2); .substr(2);
} }
/**
* 判断是否为JSON文本
* @param {string} str 是否为json文本
*/
export function isJSON(str) {
if (typeof str == 'string') {
try {
JSON.parse(str);
if (typeof JSON.parse(str) === 'number') {
return false;
}
return true;
} catch (e) {
return false;
}
}
}
/** /**
* 随机生成数字 * 随机生成数字
* @param {最小数} minNum * @param {最小数} minNum
......
/** /**
* web端文件预览功能 * web端文件预览功能
*/ */
import React, {Component} from 'react'; import React, { Component } from 'react';
import {checkIsImage} from '@/webPublic/one_stop_public/libs/UploadCom'; import { checkIsImage } from '@/webPublic/one_stop_public/libs/UploadCom';
import { getModal, getPopconfirm, isFromIframe } from '@/webPublic/one_stop_public/utils/utils'; import { getModal, getPopconfirm, isFromIframe } from '@/webPublic/one_stop_public/utils/utils';
const FileViewer = CLIENT_TYPE === 'mobile' ? null : require('react-file-viewer'); // const FileViewer = CLIENT_TYPE === 'mobile' ? null : require('react-file-viewer');
const FileViewer = null;
const Modal = getModal(); const Modal = getModal();
const Popconfirm = getPopconfirm(); const Popconfirm = getPopconfirm();
...@@ -20,7 +21,7 @@ export default class index extends Component { ...@@ -20,7 +21,7 @@ export default class index extends Component {
} }
showModal = () => { showModal = () => {
if(isFromIframe()){ if (isFromIframe()) {
return false; return false;
} }
this.setState({ this.setState({
...@@ -40,18 +41,26 @@ export default class index extends Component { ...@@ -40,18 +41,26 @@ export default class index extends Component {
}); });
}; };
download = () => { download = () => {
let {path, pathName} = this.props; let {
if(window?.parent?.open && typeof window.parent.open === 'function'){ path,
pathName
} = this.props;
if (window?.parent?.open && typeof window.parent.open === 'function') {
window.parent.open(path, '_blank'); window.parent.open(path, '_blank');
}else{ } else {
window.open(path, '_blank'); window.open(path, '_blank');
} }
}; };
render() { render() {
let {path, pathName, width, height} = this.props; let {
path,
pathName,
width,
height
} = this.props;
const {visible} = this.state; const { visible } = this.state;
let isShow = false; let isShow = false;
let type; let type;
let isImg = checkIsImage(pathName); let isImg = checkIsImage(pathName);
...@@ -76,15 +85,17 @@ export default class index extends Component { ...@@ -76,15 +85,17 @@ export default class index extends Component {
<> <>
{isShow ? ( {isShow ? (
<Popconfirm <Popconfirm
title='查看附件' title="查看附件"
onConfirm={this.download} onConfirm={this.download}
okText='下载' okText="下载"
onCancel={this.showModal} onCancel={this.showModal}
cancelText={ isFromIframe() ? '取消' : '预览'}> cancelText={isFromIframe() ? '取消' : '预览'}>
{isImg ? ( {isImg ? (
<img <img
ref={(node)=>{ this.imageDom = node;}} ref={(node) => {
this.imageDom = node;
}}
style={{ style={{
width: width ? width : '100px', width: width ? width : '100px',
height: height ? height : 'auto', height: height ? height : 'auto',
...@@ -93,13 +104,13 @@ export default class index extends Component { ...@@ -93,13 +104,13 @@ export default class index extends Component {
alt={pathName} alt={pathName}
/> />
) : ( ) : (
<a target='_blank' href={path}> <a target="_blank" href={path}>
{pathName} {pathName}
</a> </a>
)} )}
</Popconfirm> </Popconfirm>
) : ( ) : (
<a target='_blank' href={path}> <a target="_blank" href={path}>
{pathName} {pathName}
</a> </a>
)} )}
...@@ -130,12 +141,16 @@ export default class index extends Component { ...@@ -130,12 +141,16 @@ export default class index extends Component {
<a onClick={this.download}> <a onClick={this.download}>
下载文件 下载文件
</a> </a>
{FileViewer && ( {
!!checkIsImage(path) &&
<img src={path} style={{ maxWidth: '100%', }}/>
}
{/* {FileViewer && (
<FileViewer <FileViewer
fileType={type} fileType={type}
filePath={path} filePath={path}
/> />
)} )}*/}
</div> </div>
)} )}
</Modal> </Modal>
......
...@@ -16,8 +16,15 @@ export default class ChildForm extends React.Component { ...@@ -16,8 +16,15 @@ export default class ChildForm extends React.Component {
triggerChange = (changedValue) => { triggerChange = (changedValue) => {
// Should provide an event to pass value to Form. // Should provide an event to pass value to Form.
const onChange = this.props.onChange; const onChange = this.props.onChange;
console.log('ChildForm', changedValue);
if (onChange) { if (onChange) {
if(changedValue && typeof changedValue === 'object' && !Object.keys(changedValue).length){
onChange(changedValue);
// onChange(null);
}else{
onChange(changedValue); onChange(changedValue);
}
} }
}; };
...@@ -125,10 +132,16 @@ export default class ChildForm extends React.Component { ...@@ -125,10 +132,16 @@ export default class ChildForm extends React.Component {
const span = json.span || 24; const span = json.span || 24;
const gutter = json.gutter != null ? json.gutter : 0; const gutter = json.gutter != null ? json.gutter : 0;
const rights = this.props.rights; const rights = this.props.rights;
// console.log(datasAll); // console.log(datasAll);
if (datas == null) { if (datas == null) {
return <div>还没有配置子表单key</div>; return <div>还没有配置子表单key</div>;
} }
if(!objs){
return null;
}
if (isMobile) { if (isMobile) {
return ( return (
<WingBlank size="lg"> <WingBlank size="lg">
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
* 2019年10月23日 * 2019年10月23日
* 移动端日期选择封装 * 移动端日期选择封装
*/ */
import React, {Component} from 'react'; import React, { Component } from 'react';
import {DatePicker, List, Button, InputItem, Toast} from 'antd-mobile'; import { DatePicker, List, Toast } from 'antd-mobile';
import moment from 'moment'; import moment from 'moment';
export default class MobileDate extends Component { export default class MobileDate extends Component {
...@@ -16,12 +16,12 @@ export default class MobileDate extends Component { ...@@ -16,12 +16,12 @@ export default class MobileDate extends Component {
}; };
} }
triggerChange = (changedValue) => { triggerChange = changedValue => {
// Should provide an event to pass value to Form. // Should provide an event to pass value to Form.
const onChange = this.props.onChange; const onChange = this.props.onChange;
// console.log(changedValue);
if (onChange) { if (onChange) {
onChange(changedValue); onChange([...changedValue]);
} }
}; };
...@@ -29,17 +29,17 @@ export default class MobileDate extends Component { ...@@ -29,17 +29,17 @@ export default class MobileDate extends Component {
// Should be a controlled component. // Should be a controlled component.
if ('value' in nextProps) { if ('value' in nextProps) {
const value = nextProps.value; const value = nextProps.value;
this.setState({dates: value}); this.setState({ dates: value });
} }
} }
handelStartChange = (date) => { handelStartChange = date => {
const {dates} = this.state; const { dates } = this.state;
if (dates.length === 0) { if (dates.length === 0) {
dates.push(moment(date.valueOf())); dates.push(moment(date.valueOf()));
} else { } else {
if(dates.length === 2){ if (dates.length === 2) {
if (moment(date.valueOf()).isAfter(dates[1], 'second')) { if (moment(date.valueOf()).isAfter(dates[1], 'second')) {
Toast.fail('结束时间必须在开始时间之后', 1); Toast.fail('结束时间必须在开始时间之后', 1);
return false; return false;
...@@ -49,17 +49,16 @@ export default class MobileDate extends Component { ...@@ -49,17 +49,16 @@ export default class MobileDate extends Component {
} }
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState({dates}); this.setState({ dates });
} }
this.triggerChange(dates); this.triggerChange(dates);
}; };
handelEndChange = (date) => { handelEndChange = date => {
const {dates} = this.state; const { dates } = this.state;
if (dates.length === 0) { if (dates.length === 0) {
dates.push(null); dates.push(null);
dates.push(moment(date.valueOf())); dates.push(moment(date.valueOf()));
} else if (dates.length === 1) { } else if (dates.length === 1) {
if (dates[0].isAfter(moment(date.valueOf()), 'second')) { if (dates[0].isAfter(moment(date.valueOf()), 'second')) {
Toast.fail('结束时间必须在开始时间之后', 1); Toast.fail('结束时间必须在开始时间之后', 1);
...@@ -76,25 +75,25 @@ export default class MobileDate extends Component { ...@@ -76,25 +75,25 @@ export default class MobileDate extends Component {
dates[1] = moment(date.valueOf()); dates[1] = moment(date.valueOf());
} }
if (!('value' in this.props)) { if (!('value' in this.props)) {
this.setState({dates}); this.setState({ dates });
} }
this.triggerChange(dates); this.triggerChange(dates);
}; };
MustSpan = () => { MustSpan = () => {
const { required } = this.props; const { required } = this.props;
if(required){ if (required) {
return <span style={{color: 'red'}}>* </span>; return <span style={{ color: 'red' }}>* </span>;
}else{ } else {
return null; return null;
} }
}; };
render() { render() {
let {dates} = this.state; let { dates } = this.state;
const { format, showTime } = this.props; const { format, showTime } = this.props;
let mode = 'datetime'; let mode = 'datetime';
if(!showTime){ if (!showTime) {
mode = 'date'; mode = 'date';
} }
const startTime = dates.length > 0 ? dates[0] && dates[0].valueOf() : null; const startTime = dates.length > 0 ? dates[0] && dates[0].valueOf() : null;
...@@ -108,33 +107,41 @@ export default class MobileDate extends Component { ...@@ -108,33 +107,41 @@ export default class MobileDate extends Component {
<DatePicker <DatePicker
// value={this.state.date} // value={this.state.date}
extra={ extra={
<span style={{fontSize: 14}}> <span style={{ fontSize: 14 }}>
{!!startTime {!!startTime
? moment(startTime).format(format ? format : 'YYYY-MM-DD HH:mm:ss') ? moment(startTime).format(format ? format : 'YYYY-MM-DD HH:mm:ss')
: '请选择时间'} : '请选择时间'}
</span> </span>
} }
locale={{okText: '确定', dismissText: '取消'}} locale={{
okText: '确定',
dismissText: '取消',
}}
value={!!startTime ? new Date(startTime) : null} value={!!startTime ? new Date(startTime) : null}
format={format ? format : 'YYYY-MM-DD HH:mm:ss'} format={format ? format : 'YYYY-MM-DD HH:mm:ss'}
mode={mode} mode={mode}
onChange={(date) => this.handelStartChange(date)}> onChange={date => this.handelStartChange(date)}
>
<List.Item arrow="horizontal">{MustSpan}开始时间</List.Item> <List.Item arrow="horizontal">{MustSpan}开始时间</List.Item>
</DatePicker> </DatePicker>
<DatePicker <DatePicker
// value={this.state.date} // value={this.state.date}
extra={ extra={
<span style={{fontSize: 14}}> <span style={{ fontSize: 14 }}>
{!!endTime {!!endTime
? moment(endTime).format(format ? format : 'YYYY-MM-DD HH:mm:ss') ? moment(endTime).format(format ? format : 'YYYY-MM-DD HH:mm:ss')
: '请选择时间'} : '请选择时间'}
</span> </span>
} }
value={!!endTime ? new Date(endTime) : null} value={!!endTime ? new Date(endTime) : null}
locale={{okText: '确定', dismissText: '取消'}} locale={{
okText: '确定',
dismissText: '取消',
}}
mode={mode} mode={mode}
format={format ? format : 'YYYY-MM-DD HH:mm:ss'} format={format ? format : 'YYYY-MM-DD HH:mm:ss'}
onChange={(date) => this.handelEndChange(date)}> onChange={date => this.handelEndChange(date)}
>
<List.Item arrow="horizontal">{MustSpan}结束时间</List.Item> <List.Item arrow="horizontal">{MustSpan}结束时间</List.Item>
</DatePicker> </DatePicker>
</div> </div>
......
import React from "react"; import React from 'react';
import {queryApiActionPath} from "@/webPublic/one_stop_public/utils/queryConfig"; import { queryApiActionPath } from '@/webPublic/one_stop_public/utils/queryConfig';
import {getToken} from "@/webPublic/one_stop_public/utils/token"; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { isFromIframe } from '@/webPublic/one_stop_public/utils/utils'; import { isFromIframe } from '@/webPublic/one_stop_public/utils/utils';
import getOneStopUploadUrl from '@/webPublic/one_stop_public/Base16/getOneStopUploadUrl';
const oneSetItemP = { const oneSetItemP = {
marginBottom: 0, marginBottom: 0,
...@@ -10,7 +11,13 @@ const oneSetItemP = { ...@@ -10,7 +11,13 @@ const oneSetItemP = {
let startX = 0; let startX = 0;
let startY = 0; let startY = 0;
const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => { const ShowItem = ({
basicUrl,
type,
x,
y,
...otherInfo
}) => {
switch (type) { switch (type) {
case 'image': case 'image':
return ( return (
...@@ -53,14 +60,14 @@ const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => { ...@@ -53,14 +60,14 @@ const ShowItem = ({ basicUrl, type, x, y, ...otherInfo }) => {
export const dragEventList = (setOtherProps, otherProps) => { export const dragEventList = (setOtherProps, otherProps) => {
let draggedRef = null; let draggedRef = null;
let documentThis = isFromIframe() ? window?.parent?.document : document; let documentThis = isFromIframe() ? window?.parent?.document : document;
documentThis.onmousedown = function(evt){ documentThis.onmousedown = function (evt) {
startX = evt.offsetX; startX = evt.offsetX;
startY = evt.offsetY; startY = evt.offsetY;
} };
documentThis.addEventListener( documentThis.addEventListener(
'dragstart', 'dragstart',
function(event) { function (event) {
// 保存拖动元素的引用(ref.) // 保存拖动元素的引用(ref.)
draggedRef = event.target; draggedRef = event.target;
event.target.style.opacity = 0.2; event.target.style.opacity = 0.2;
...@@ -91,13 +98,14 @@ export const dragEventList = (setOtherProps, otherProps) => { ...@@ -91,13 +98,14 @@ export const dragEventList = (setOtherProps, otherProps) => {
// 阻止默认动作(如打开一些元素的链接) // 阻止默认动作(如打开一些元素的链接)
event.preventDefault(); event.preventDefault();
// 将拖动的元素到所选择的放置目标节点中 // 将拖动的元素到所选择的放置目标节点中
let infoClientRect = documentThis.getElementById('dropZone').getBoundingClientRect(); let infoClientRect = documentThis.getElementById('dropZone')
.getBoundingClientRect();
// console.log(startX, typeof startX, startY); // console.log(startX, typeof startX, startY);
// return ; // return ;
let leftNew = Math.ceil(event.clientX - infoClientRect.left) - startX; let leftNew = Math.ceil(event.clientX - infoClientRect.left) - startX;
let topNew = Math.ceil(event.clientY - infoClientRect.top) - startY; let topNew = Math.ceil(event.clientY - infoClientRect.top) - startY;
// console.log(leftNew, topNew); // console.log(leftNew, topNew);
if(leftNew < 0 || leftNew > infoClientRect.width || topNew < 0 || topNew > infoClientRect.height){ if (leftNew < 0 || leftNew > infoClientRect.width || topNew < 0 || topNew > infoClientRect.height) {
console.log('拖拽到了图片区域外部,不能进行拖拽'); console.log('拖拽到了图片区域外部,不能进行拖拽');
return false; return false;
} }
...@@ -106,7 +114,7 @@ export const dragEventList = (setOtherProps, otherProps) => { ...@@ -106,7 +114,7 @@ export const dragEventList = (setOtherProps, otherProps) => {
let item = otherProps.signConfig.find((g) => { let item = otherProps.signConfig.find((g) => {
return g.key === key; return g.key === key;
}); });
if(!item){ if (!item) {
return false; return false;
} }
item.x = leftNew; item.x = leftNew;
...@@ -114,23 +122,25 @@ export const dragEventList = (setOtherProps, otherProps) => { ...@@ -114,23 +122,25 @@ export const dragEventList = (setOtherProps, otherProps) => {
setOtherProps({ setOtherProps({
...otherProps, ...otherProps,
signConfig: otherProps.signConfig, signConfig: otherProps.signConfig,
}) });
draggedRef.style.left = leftNew; // `${left}px`; draggedRef.style.left = leftNew; // `${left}px`;
draggedRef.style.top = topNew; // `${top}px`; draggedRef.style.top = topNew; // `${top}px`;
return true; return true;
}, },
false, false,
); );
} };
export const uploadFile = (file) => { export const uploadFile = (file) => {
let url = queryApiActionPath() + '/upload?token=' + getToken(); let url = getOneStopUploadUrl();
const formData = new FormData(); const formData = new FormData();
formData.append('file', file); formData.append('file', file);
formData.append('token', getToken());
return fetch(url, { return fetch(url, {
method: 'POST', method: 'POST',
headers: { headers: {
Accept: '*/*', Accept: '*/*',
Authorization: `bearer ${getToken()}`,
}, },
body: formData, body: formData,
}) })
...@@ -139,8 +149,8 @@ export const uploadFile = (file) => { ...@@ -139,8 +149,8 @@ export const uploadFile = (file) => {
}) })
.then((res) => { .then((res) => {
return res; return res;
}) });
} };
// 将图片宽度确定 高度按比例调整后返回一张新的图片 // 将图片宽度确定 高度按比例调整后返回一张新的图片
...@@ -148,14 +158,14 @@ export const zipImage = (path, fileName, limitWidth = 1200) => { ...@@ -148,14 +158,14 @@ export const zipImage = (path, fileName, limitWidth = 1200) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let image = new Image(); //新建一个img标签(还没嵌入DOM节点) let image = new Image(); //新建一个img标签(还没嵌入DOM节点)
let imageUrl = queryApiActionPath() + path; let imageUrl = queryApiActionPath() + path;
image.setAttribute("crossOrigin",'Anonymous'); image.setAttribute('crossOrigin', 'Anonymous');
image.src = imageUrl; image.src = imageUrl;
image.onload = () => { image.onload = () => {
const canvas = document.createElement('canvas'); const canvas = document.createElement('canvas');
const context = canvas.getContext('2d'); const context = canvas.getContext('2d');
const imageWidth = limitWidth; const imageWidth = limitWidth;
const ratio = image.width / limitWidth; // 按宽度固定 压缩图片 const ratio = image.width / limitWidth; // 按宽度固定 压缩图片
if(ratio === 1 || isNaN(ratio)){ if (ratio === 1 || isNaN(ratio)) {
resolve(path); resolve(path);
return true; return true;
} }
...@@ -179,10 +189,11 @@ export const zipImage = (path, fileName, limitWidth = 1200) => { ...@@ -179,10 +189,11 @@ export const zipImage = (path, fileName, limitWidth = 1200) => {
return new File([u8arr], filename, { type: mime }); return new File([u8arr], filename, { type: mime });
}; };
let file = dataURLtoFile(data, fileName); let file = dataURLtoFile(data, fileName);
uploadFile(file).then((res) => { uploadFile(file)
if(res){ .then((res) => {
if (res) {
resolve(res); resolve(res);
}else{ } else {
resolve(path); resolve(path);
} }
}); });
...@@ -194,4 +205,4 @@ export const zipImage = (path, fileName, limitWidth = 1200) => { ...@@ -194,4 +205,4 @@ export const zipImage = (path, fileName, limitWidth = 1200) => {
}; };
export default ShowItem export default ShowItem;
...@@ -43,9 +43,9 @@ export default class TableList extends React.Component { ...@@ -43,9 +43,9 @@ export default class TableList extends React.Component {
static getDerivedStateFromProps(nextProps, prevState) { static getDerivedStateFromProps(nextProps, prevState) {
// ... // ...
if('value' in nextProps){ if('value' in nextProps){
return {...nextProps.value}; return {...nextProps.value}; // 更新state
} }
return null; return null; //不需要更新任何state
} }
componentDidUpdate(prevProps, prevState) { componentDidUpdate(prevProps, prevState) {
...@@ -63,7 +63,7 @@ export default class TableList extends React.Component { ...@@ -63,7 +63,7 @@ export default class TableList extends React.Component {
} }
render() { render() {
const { isTree, json } = this.props; const { isTree, json, uuid } = this.props;
const { showNo } = this.state; const { showNo } = this.state;
if(showNo){ if(showNo){
return null; return null;
...@@ -84,6 +84,7 @@ export default class TableList extends React.Component { ...@@ -84,6 +84,7 @@ export default class TableList extends React.Component {
rights={this.props.rights || []} rights={this.props.rights || []}
objCode={this.props.objCode} objCode={this.props.objCode}
isFormCom={true} isFormCom={true}
uuid={uuid}
sql={this.props.sql} sql={this.props.sql}
/> />
) : ( ) : (
...@@ -102,6 +103,7 @@ export default class TableList extends React.Component { ...@@ -102,6 +103,7 @@ export default class TableList extends React.Component {
rights={this.props.rights || []} rights={this.props.rights || []}
objCode={this.props.objCode} objCode={this.props.objCode}
isFormCom={true} isFormCom={true}
uuid={uuid}
sql={this.props.sql} sql={this.props.sql}
/> />
); );
......
...@@ -21,7 +21,7 @@ export function checkIsImage(path) { ...@@ -21,7 +21,7 @@ export function checkIsImage(path) {
} }
let p = path.toLowerCase(); let p = path.toLowerCase();
let find = ['.jpg', '.png', '.jpeg', '.bmp', '.gif', '.bmp', '.svg'].find((x) => { let find = ['.jpg', '.png', '.jpeg', '.bmp', '.gif', '.bmp', '.svg'].find((x) => {
return path.indexOf(x) > -1; return p.indexOf(x) > -1;
}); });
return !!find; return !!find;
} }
...@@ -197,7 +197,7 @@ class UploadCom extends React.Component { ...@@ -197,7 +197,7 @@ class UploadCom extends React.Component {
<Icon type="upload" /> <Icon type="upload" />
{btnName ? btnName : '上传附件'} {btnName ? btnName : '上传附件'}
</Button> </Button>
{this.otherProps?.limitImageInfo && <div>{this.otherProps?.limitImageInfo}</div>} {this.otherProps?.limitImageInfo && <div style={this.otherProps?.limitImageInfoStyle || {}}>{this.otherProps?.limitImageInfo}</div>}
</> </>
)} )}
</Upload> </Upload>
......
...@@ -6,6 +6,7 @@ import styles from "./style.less"; ...@@ -6,6 +6,7 @@ import styles from "./style.less";
import { checkIsImage } from "./UploadCom"; import { checkIsImage } from "./UploadCom";
import Viewer from "react-viewer"; import Viewer from "react-viewer";
import { getToken } from '@/webPublic/one_stop_public/utils/token'; import { getToken } from '@/webPublic/one_stop_public/utils/token';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils';
// 为黔南职院单独写的 上传组件 用于 bug 20576 个人就业信息/求职创业补贴申报,201801010006 119242 上传图片加限制,跟签约派遣上传图片加限制一样 // 为黔南职院单独写的 上传组件 用于 bug 20576 个人就业信息/求职创业补贴申报,201801010006 119242 上传图片加限制,跟签约派遣上传图片加限制一样
...@@ -101,6 +102,7 @@ export default class UploadComDiyForQnZy extends React.Component { ...@@ -101,6 +102,7 @@ export default class UploadComDiyForQnZy extends React.Component {
name: "file", name: "file",
multiple: isMultiple, multiple: isMultiple,
accept: accept, accept: accept,
...getHeaders(),
action: config.uploadUrl, action: config.uploadUrl,
showUploadList: false, showUploadList: false,
onChange: this.changeUrl, onChange: this.changeUrl,
......
...@@ -194,8 +194,13 @@ ...@@ -194,8 +194,13 @@
@TableThemeColor: #5e9ede; @TableThemeColor: #5e9ede;
@TableThemeBgColor: #e6f7ff; @TableThemeBgColor: #e6f7ff;
// padding: 6px 12px 0 12px; // padding: 6px 12px 0 12px;
tbody{
min-height: 1px;
}
:global { :global {
.ant-table-placeholder{ // 28413 毕业生跟踪信息/跟踪调查表(公司填报)统计线条优化
margin-top: 1px;
}
.ant-table-thead > tr > th { .ant-table-thead > tr > th {
padding: 0 12px; padding: 0 12px;
height: 50px; height: 50px;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
} }
} }
.tableAlert { .tableAlert {
margin-bottom: 16px; margin-bottom: 16px;
} }
......
...@@ -86,3 +86,6 @@ ...@@ -86,3 +86,6 @@
.hidden{ .hidden{
margin: 0px; margin: 0px;
} }
.mobelDiv{
width: auto;
}
export default function countWidth({
json,
uuid,
}) {
let showDiv = 500;
if (json.twidth) {
// 列表宽度配置项 在 组件的 扩展的配置里面
showDiv = json.twidth;
console.log(showDiv);
return showDiv;
}
if (document.getElementsByClassName('ant-layout-content')?.length) {
// 这是大学工项目 容器元素的宽度
showDiv = document.getElementsByClassName('ant-layout-content')[0].clientWidth - 100;
// console.log(showDiv);
}
if (document.querySelector('#mobelDiv')) {
showDiv = document.querySelector('#mobelDiv')?.parentNode.clientWidth;
// 这个是一站式的元素的宽度
}
changeVisitor(json, uuid);
return showDiv;
}
/**
* json
* uuid
* 变动观察器
* 解决禅道 28008 生源地统计页面显示调整
*/
function changeVisitor(json, uuid) {
if (!uuid) {
return null;
}
let dom = document.querySelector(`td[data-cell-id="${uuid}"]`);
if (!dom) {
return null;
}
const targetNode = dom;
// 配置器的配置:需要监听的变动
const config = {
characterData: true, // 监视指定目标节点或子节点树中节点所包含的字符数据的变化 无默认值。
subtree: true, // 观察后代节点,默认为 false
childList: true, // 观察目标子节点的变化,是否有添加或者删除
};
// 变动时回调
const callback = function (mutations) {
if(!json.twidth){
let dxx = document.querySelector(`td[data-cell-id="${uuid}"] .mobelDivClassName`);
if(dxx && dxx.style.width === '500px'){
dxx.style.width = document.querySelector(`td[data-cell-id="${uuid}"] .mobelDivClassName`)?.parentNode.clientWidth + 'px';
}
}
};
// 创建一个MutationObserver实例
const observer = new MutationObserver(callback);
// 监听目标节点
observer.observe(targetNode, config);
// observer.disconnect()
}
/**
* 钟是志
* 27900 毕业去向管理/单位改签管理---老师新增时,保存反应延迟,会导致重复数据
* 2022年6月26日
* */
import React, { useEffect, useState } from 'react';
import { Button } from 'antd';
export default function ButtonDiy(props) {
const {
loading,
onClick,
...ev
} = props;
const [loadingThis, setLoading] = useState(false);
useEffect(() => {
setLoading(loading);
}, [loading]);
const topOnClick = (e) => {
console.log(e);
return onClick(e, setLoading);
};
return (
<Button loading={loadingThis}
type="primary"
onClick={topOnClick}
{...ev}
/>
);
}
This source diff could not be displayed because it is too large. You can view the blob instead.
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论