品类OA问题与审核详情解密参数问题
This commit is contained in:
@ -3,26 +3,43 @@ import React, { useState, useEffect } from 'react';
|
||||
import { useLocation } from 'umi'; // 或者 'react-router-dom'
|
||||
import ResultModal from './components/ResultModal';
|
||||
import ViewModal from './components/ViewModal';
|
||||
import { refreshDictCache } from '@/servers/api/login';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
|
||||
const ViewReviewPage: React.FC = () => {
|
||||
const [modalVisible, setModalVisible] = useState(false); // 控制弹窗
|
||||
const [modalRecord, setModalRecord] = useState<any>(null);
|
||||
|
||||
|
||||
// 解析url参数 ?id=xxx
|
||||
const location = useLocation();
|
||||
useEffect(() => {
|
||||
// 获取id参数
|
||||
const params = new URLSearchParams(location.search);
|
||||
const id = params.get('id');
|
||||
if (id) {
|
||||
setModalRecord({ id }); // 只传id也可以,后面可以根据id扩展更多参数
|
||||
const base64 = params.get('code');
|
||||
console.log(base64);
|
||||
|
||||
if (!base64) return;
|
||||
// 解码
|
||||
const decodedStr = atob(base64);
|
||||
// 再次转成参数
|
||||
const p2 = new URLSearchParams(decodedStr);
|
||||
if (p2.get('id')) {
|
||||
if (!sessionStorage.getItem('dict')) {
|
||||
refreshDictCache().then((res) => {
|
||||
if (res.code == 200) {
|
||||
sessionStorage.setItem('dict', JSON.stringify(res.data))
|
||||
}
|
||||
})
|
||||
}
|
||||
const nowStr = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
||||
sessionStorage.setItem('userId', `${p2.get('userId')}_${nowStr}` )
|
||||
setModalRecord({ id: p2.get('id') });
|
||||
setModalVisible(true);
|
||||
}
|
||||
}, [location.search]);
|
||||
}, []);
|
||||
|
||||
|
||||
return (
|
||||
<div style={{padding: '20px'}}>
|
||||
<div style={{ padding: '20px' }}>
|
||||
{/* 其他页面内容 */}
|
||||
<ViewModal
|
||||
visible={modalVisible}
|
||||
|
@ -548,7 +548,7 @@ const CreateModal: React.FC<{ visible: boolean; onCancel: () => void; }> = ({ vi
|
||||
|
||||
<Form.Item wrapperCol={{ offset: 6 }}>
|
||||
<Button type="primary" htmlType="submit" style={{ marginRight: 8 }} disabled={submitting}>
|
||||
{admissionMethod === 'online' ? '确认' : admissionMethod === 'offline' ? '提交审批' : '提交'}
|
||||
{admissionMethod === 'online' ? '确认' : admissionMethod === 'scattered' ? '提交审批' : '提交'}
|
||||
|
||||
</Button>
|
||||
<Button
|
||||
|
@ -9,8 +9,8 @@ import type { DictItem } from '@/servers/api/dicts';
|
||||
const { Option } = Select;
|
||||
|
||||
const approveTypeOptions = [
|
||||
{ label: '是', value: 'online' },
|
||||
{ label: '否', value: 'offline' },
|
||||
{ label: '是', value: 'offline' },
|
||||
{ label: '否', value: 'online' },
|
||||
];
|
||||
|
||||
function collectCheckedWithParents(
|
||||
@ -354,7 +354,7 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
|
||||
|
||||
<Form.Item shouldUpdate={(prev, curr) => prev.approveType !== curr.approveType}>
|
||||
{() => {
|
||||
const isAttachmentRequired = form.getFieldValue('approveType') === 'online';
|
||||
const isAttachmentRequired = form.getFieldValue('approveType') === 'offline';
|
||||
|
||||
return (
|
||||
<Form.Item
|
||||
|
@ -129,7 +129,6 @@ const CategoryAddModal: React.FC<Props> = ({ visible, onCancel, onSuccess }) =>
|
||||
setCheckedKeys([]);
|
||||
setExpandedKeys([]);
|
||||
form.resetFields();
|
||||
setFileList([])
|
||||
}
|
||||
init(visible)
|
||||
}, [visible, form]);
|
||||
@ -186,7 +185,6 @@ const collectCheckedWithParents = (nodes: TreeNodeType[], checked: string[]): st
|
||||
library(submitData).then((res) => {
|
||||
if (res.code == 200) {
|
||||
form.resetFields();
|
||||
setFileList([])
|
||||
message.success('提交成功');
|
||||
onSuccess && onSuccess();
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ import { getSupplierPage, detail, apply, uploadFile } from "../services";
|
||||
import tableProps from '@/utils/tableProps'
|
||||
import { useSupplierDetailModal } from '@/components/SupplierDetailModalContext/SupplierDetailModalContext';
|
||||
const approveTypeOptions = [
|
||||
{ label: '是', value: 'online' },
|
||||
{ label: '否', value: 'offline' },
|
||||
{ label: '是', value: 'offline' },
|
||||
{ label: '否', value: 'online' },
|
||||
];
|
||||
|
||||
// 供应商类型
|
||||
@ -330,7 +330,7 @@ const SupplierAddModal: React.FC<{
|
||||
</Form.Item>
|
||||
<Form.Item shouldUpdate={(prev, curr) => prev.approveType !== curr.approveType}>
|
||||
{() => {
|
||||
const isAttachmentRequired = form.getFieldValue('approveType') === 'online';
|
||||
const isAttachmentRequired = form.getFieldValue('approveType') === 'offline';
|
||||
|
||||
return (
|
||||
<Form.Item
|
||||
|
@ -69,6 +69,7 @@ request.interceptors.request.use((url, options) => {
|
||||
...(options.headers || {}),
|
||||
...(token ? { Authorization: `Bearer ${token}` } : {}),
|
||||
...(userId ? { Mall3Check: `${userId}` } : {}),
|
||||
...(userId ? { userId: `${userId}` } : {}),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Reference in New Issue
Block a user