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