品类树型选择做成组件、所有组织树型增加名称模糊查询、供应商消息 改为 消息通知 、品类库,取消注
This commit is contained in:
@ -1,55 +1,83 @@
|
||||
// ViewReviewPage.tsx
|
||||
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 { encryptWithRsa } from '@/utils/encryptWithRsa'
|
||||
|
||||
import { encryptWithRsa } from '@/utils/encryptWithRsa';
|
||||
|
||||
const ViewReviewPage: React.FC = () => {
|
||||
const [modalVisible, setModalVisible] = useState(false); // 控制弹窗
|
||||
const [modalRecord, setModalRecord] = useState<any>(null);
|
||||
|
||||
const [modalVisible, setModalVisible] = useState<boolean>(false);
|
||||
const [modalRecord, setModalRecord] = useState<{ id: string } | null>(null);
|
||||
const [type, setType] = useState<string>(''); // 空串即可
|
||||
|
||||
useEffect(() => {
|
||||
const params = new URLSearchParams(location.search);
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const base64 = params.get('code');
|
||||
console.log(base64);
|
||||
|
||||
if (!base64) return;
|
||||
// 解码
|
||||
const decodedStr = atob(base64);
|
||||
// 再次转成参数
|
||||
const p2 = new URLSearchParams(decodedStr);
|
||||
if (p2.get('id')) {
|
||||
|
||||
try {
|
||||
// 解码
|
||||
const decodedStr = atob(base64);
|
||||
const p2 = new URLSearchParams(decodedStr);
|
||||
|
||||
const id = p2.get('id') ?? '';
|
||||
const code = p2.get('code') ?? '';
|
||||
const userId = p2.get('userId') ?? '';
|
||||
|
||||
if (!id) return;
|
||||
|
||||
setType(code); // code 现在一定是 string
|
||||
|
||||
// 初始化字典
|
||||
if (!sessionStorage.getItem('dict')) {
|
||||
refreshDictCache().then((res) => {
|
||||
if (res.code == 200) {
|
||||
sessionStorage.setItem('dict', JSON.stringify(res.data))
|
||||
if (res?.code === 200) {
|
||||
sessionStorage.setItem('dict', JSON.stringify(res.data));
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
sessionStorage.setItem('userId', encryptWithRsa(p2.get('userId')))
|
||||
setModalRecord({ id: p2.get('id') });
|
||||
|
||||
// 只有在 userId 存在时再加密保存
|
||||
if (userId) {
|
||||
sessionStorage.setItem('userId', encryptWithRsa(userId));
|
||||
}
|
||||
|
||||
setModalRecord({ id });
|
||||
setModalVisible(true);
|
||||
} catch (err) {
|
||||
// atob 或者 URLSearchParams 解析失败
|
||||
console.error('解析 code 失败:', err);
|
||||
}
|
||||
}, []);
|
||||
|
||||
|
||||
/**
|
||||
* SUPPLIER_ACCESS_APPROVAL("supplierAccessApproval", "供应商准入审批"),
|
||||
* SUPPLIER_CATEGORY_ACCESS_APPROVAL("supplierCategoryAccessApproval", "供应商品类准入审批"),
|
||||
* SUPPLIER_INFO_CHANGE_APPROVAL("supplierInfoChangeApproval", "供应商信息变更审批"),
|
||||
* BLACKLIST_APPROVAL("blacklistApproval", "黑名单审批"),
|
||||
* EXIT_APPROVAL("exitApproval", "退出审批"),
|
||||
* CATEGORY_LIBRARY_APPROVAL("categoryLibraryApproval", "品类库审批"),
|
||||
* CATEGORY_LIBRARY_SUPPLIER_APPROVAL("categoryLibrarySupplierApproval","品类库供应商入库审批"),
|
||||
* EVALUATION_APPROVAL("evaluationApproval", "评价审批");
|
||||
*/
|
||||
|
||||
return (
|
||||
<div style={{ padding: '20px' }}>
|
||||
{/* 其他页面内容 */}
|
||||
<ViewModal
|
||||
visible={modalVisible}
|
||||
record={modalRecord}
|
||||
onCancel={() => setModalVisible(false)}
|
||||
/>
|
||||
<ResultModal
|
||||
visible={modalVisible}
|
||||
record={modalRecord}
|
||||
onCancel={() => setModalVisible(false)}
|
||||
/>
|
||||
{/* 供应商准入审批, 供应商品类准入审批 */}
|
||||
{['supplierAccessApproval', 'supplierCategoryAccessApproval'].includes(type) && (
|
||||
<>
|
||||
<ViewModal
|
||||
visible={modalVisible}
|
||||
record={modalRecord ?? undefined}
|
||||
onCancel={() => setModalVisible(false)}
|
||||
/>
|
||||
<ResultModal
|
||||
visible={modalVisible}
|
||||
record={modalRecord ?? undefined}
|
||||
onCancel={() => setModalVisible(false)}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user