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