提交 9ff5a504 authored 作者: 钟是志's avatar 钟是志

优化代码

上级 3d131ce3
...@@ -15,7 +15,6 @@ function OtherCheckRecord({ workId, ...otherProps }) { ...@@ -15,7 +15,6 @@ 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: '{}' });
}); });
......
...@@ -44,6 +44,9 @@ const checkNeedWriteAuditInfo = ({ btns, btnValue }) => { ...@@ -44,6 +44,9 @@ const checkNeedWriteAuditInfo = ({ btns, btnValue }) => {
return needWrite; return needWrite;
}; };
/**
* 流程审批 提交数据
* */
const submitValues = ({ const submitValues = ({
values, values,
isCloseFlowPath, isCloseFlowPath,
...@@ -166,7 +169,7 @@ const submitValues = ({ ...@@ -166,7 +169,7 @@ const submitValues = ({
return false; return false;
} }
if (res && res.content && isJSON(res.content)) { if (res && res.content && isJSON(res.content)) {
payload.taskForm = res.content; payload.taskForm = res.content; // 替换表单数据
} }
beforeAuditSubmitFunc(payload); // 提交数据到审批接口 beforeAuditSubmitFunc(payload); // 提交数据到审批接口
}); });
......
...@@ -30,7 +30,7 @@ export default function prepareShow(postData = {}, content = '', otherParams = { ...@@ -30,7 +30,7 @@ export default function prepareShow(postData = {}, content = '', otherParams = {
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 && (test || getUserInfo().stuNo === 'admin')) { if (agg?.unifiedServicePatternModel?.id && (test || getUserInfo().stuNo === 'admin')) {
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');
......
...@@ -137,7 +137,7 @@ export default class ChildForm extends React.Component { ...@@ -137,7 +137,7 @@ export default class ChildForm extends React.Component {
if (!objs) { if (!objs) {
return null; return null;
} }
console.log(this.props.form.getFieldsValue()); // console.log(this.props.form.getFieldsValue());
if (isMobile) { if (isMobile) {
return ( // 2022年11月24日 姚新国说的 把干掉两翼留白 解决北电科工作情况考核 移动端样式的问题 return ( // 2022年11月24日 姚新国说的 把干掉两翼留白 解决北电科工作情况考核 移动端样式的问题
......
...@@ -9,144 +9,150 @@ import { getUserInfo } from '@/webPublic/one_stop_public/utils/token'; ...@@ -9,144 +9,150 @@ import { getUserInfo } from '@/webPublic/one_stop_public/utils/token';
const { TextArea } = Input; const { TextArea } = Input;
function EditDrawer(props) { function EditDrawer(props) {
const { dispatch, templateData, TEMPLATE } = props; const { dispatch, templateData, TEMPLATE } = props;
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
const [showEdit, setShowEdit] = useState(process.env.NODE_ENV === 'development'); const [showEdit, setShowEdit] = useState(process.env.NODE_ENV === 'development');
const saveTimeOut = useRef(); const saveTimeOut = useRef();
const [lowCodeEdit, setLowCodeEdit] = useState({}); const [lowCodeEdit, setLowCodeEdit] = useState({});
useEffect( useEffect(
() => { () => {
if (templateData) { if (templateData) {
setLowCodeEdit({ ...templateData }); setLowCodeEdit({ ...templateData });
} }
}, },
[templateData], [templateData],
); );
const onClose = () => { const onClose = () => {
setShowEdit(!showEdit); setShowEdit(!showEdit);
}; };
const handleSaveTemplate = () => { const handleSaveTemplate = () => {
lowCodeEdit.updateTime = moment().format('YYYY-MM-DD HH:mm:ss'); lowCodeEdit.updateTime = moment().format('YYYY-MM-DD HH:mm:ss');
const content = JSON.stringify(lowCodeEdit); const content = JSON.stringify(lowCodeEdit);
message.info('正在保存数据,请耐心等待'); message.info('正在保存数据,请耐心等待');
setLoading(true); setLoading(true);
dispatch({ dispatch({
type: 'lowCode_design/saveTemplateApi', type: 'lowCode_design/saveTemplateApi',
payload: { payload: {
name: lowCodeEdit.name, name: lowCodeEdit.name,
content, content,
TEMPLATE, TEMPLATE,
}, },
callback: () => { callback: () => {
saveTimeOut.current = null; saveTimeOut.current = null;
setLoading(false); setLoading(false);
}, },
}); });
}; };
const changeKey = (value, key) => { const changeKey = (value, key) => {
let newCodeEdit = lowCodeEdit; let newCodeEdit = lowCodeEdit;
newCodeEdit[key] = value; newCodeEdit[key] = value;
setLowCodeEdit(newCodeEdit); setLowCodeEdit(newCodeEdit);
}; };
// TODO localStorage 事件中获取的state 不是最新的. // TODO localStorage 事件中获取的state 不是最新的.
const handleLocalStorageSave = (e) => { const handleLocalStorageSave = (e) => {
if (e.key === 'save-low-code-local') { if (e.key === 'save-low-code-local') {
const newV = e.newValue; const newV = e.newValue;
if (newV && newV.length > 20) { if (newV && newV.length > 20) {
changeKey(newV, 'beforeShow'); changeKey(newV, 'beforeShow');
if (!saveTimeOut.current) { if (!saveTimeOut.current) {
saveTimeOut.current = window.setTimeout(() => { saveTimeOut.current = window.setTimeout(() => {
message.info('正在保存'); message.info('正在保存');
handleSaveTemplate(); handleSaveTemplate();
}, 500); }, 500);
} }
} }
} }
}; };
useEffect( useEffect(
() => { () => {
if (lowCodeEdit?.beforeShow) { if (lowCodeEdit?.beforeShow) {
window.addEventListener('storage', handleLocalStorageSave); window.addEventListener('storage', handleLocalStorageSave);
} }
return () => { return () => {
window.removeEventListener('storage', handleLocalStorageSave); window.removeEventListener('storage', handleLocalStorageSave);
}; };
}, },
[lowCodeEdit.beforeShow], [lowCodeEdit.beforeShow],
); );
const editFullScreen = () => { const editFullScreen = () => {
localStorage.setItem('edit-low-code-local', JSON.stringify(lowCodeEdit)); localStorage.setItem('edit-low-code-local', JSON.stringify(lowCodeEdit));
if(process.env.NODE_ENV === 'development'){ if (process.env.NODE_ENV === 'development') {
window.open('http://scjoyedu.eicp.net:51352/wisdomSchool/#/quanPingBianji?id=' + lowCodeEdit.TEMPLATE); window.open(
} 'http://scjoyedu.eicp.net:51352/wisdomSchool/#/quanPingBianji?id=' + lowCodeEdit.TEMPLATE,
window.open(window.location.origin + '/wisdomSchool/#/quanPingBianji?id=' + lowCodeEdit.TEMPLATE); );
}; }
window.open(
window.location.origin + '/wisdomSchool/#/quanPingBianji?id=' + lowCodeEdit.TEMPLATE,
);
};
return ( return (
<> <>
<Drawer <Drawer
title="编辑" title="编辑"
placement="right" placement="right"
onClose={onClose} onClose={onClose}
visible={showEdit} visible={showEdit}
width={700} width={700}
maskClosable={false}> maskClosable={false}>
<TextArea <TextArea
autoSize={{ autoSize={{
minRows: 5, minRows: 5,
maxRows: 10, maxRows: 10,
}} }}
value={JSON.stringify(templateData, null, '\t')} value={JSON.stringify(templateData, null, '\t')}
disabled={true} disabled={true}
style={{ marginBottom: '20px' }} style={{ marginBottom: '20px' }}
/> />
{ {loading ? (
loading ? '正在保存中请勿编辑' : '正在保存中请勿编辑'
<> ) : (
挂载前执行 <>
<ButtonDiy name={'全屏编辑'} handleClick={editFullScreen} type={'danger'} /> 挂载前执行
<TextArea <ButtonDiy name={'全屏编辑'} handleClick={editFullScreen} type={'danger'} />
autoSize={{ <TextArea
minRows: 10, autoSize={{
maxRows: 15, minRows: 10,
}} maxRows: 15,
defaultValue={lowCodeEdit?.beforeShow || ''} }}
onChange={(e) => { defaultValue={lowCodeEdit?.beforeShow || ''}
changeKey(e.target.value, 'beforeShow'); onChange={(e) => {
}} changeKey(e.target.value, 'beforeShow');
// readOnly={true} }}
style={{ marginBottom: '20px' }} // readOnly={true}
/> style={{ marginBottom: '20px' }}
<Button onClick={handleSaveTemplate} type={'primary'}> />
保存 <Button onClick={handleSaveTemplate} type={'primary'}>
</Button> 保存
</> </Button>
} </>
</Drawer> )}
<div </Drawer>
data-edit-point={'EditDrawer'} <div
className={styles.editPoint} data-edit-point={'EditDrawer'}
style={{ className={styles.editPoint}
display: getUserInfo().stuNo === 'admin' ? 'block' : 'none', style={{
}} display: getUserInfo().stuNo === 'admin' ? 'block' : 'none',
onClick={() => { }}
setShowEdit(!showEdit); onClick={() => {
}} setShowEdit(!showEdit);
>模板编辑</div> }}>
</> 模板编辑
); </div>
</>
);
} }
export default connect(({ lowCode_design }) => { export default connect(({ lowCode_design }) => {
return { return {
templateData: lowCode_design.templateData, templateData: lowCode_design.templateData,
}; };
})(EditDrawer); })(EditDrawer);
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论