浏览代码

add gfmis

master
Alex Cheung 1年前
父节点
当前提交
21fb7135da
共有 2 个文件被更改,包括 43 次插入2 次删除
  1. +39
    -1
      src/layout/MainLayout/Header/index.js
  2. +4
    -1
      src/utils/ApiPathConst.js

+ 39
- 1
src/layout/MainLayout/Header/index.js 查看文件

@@ -43,6 +43,8 @@ import Profile from './HeaderContent/Profile';
import "assets/style/navbarStyles.css";
import { isUserLoggedIn, isGLDLoggedIn, isPrimaryLoggedIn } from "utils/Utils";
import { handleLogoutFunction } from 'auth/index';
import * as HttpUtils from "utils/HttpUtils";
import * as UrlUtils from "utils/ApiPathConst"

// assets
// import { MenuFoldOutlined,MenuOutlined } from '@ant-design/icons';
@@ -70,6 +72,34 @@ function Header(props) {
navigate('/login');
};

const getXML = () => () => {
HttpUtils.get({
url: UrlUtils.GEN_GFMIS_XML + "/today?online=true",
params:{},
onSuccess: (responseData) => {
console.log(responseData)
const parser = new DOMParser();
const xmlDoc = parser.parseFromString(responseData, 'application/xml');
const filename = xmlDoc.querySelector('FileHeader').getAttribute('H_Filename');
const blob = new Blob([responseData], { type: 'application/xml' });
// Create a download link
const link = document.createElement('a');
link.href = URL.createObjectURL(blob);
link.download = filename+'.xml';

// Append the link to the document body
document.body.appendChild(link);

// Programmatically click the link to trigger the download
link.click();

// Clean up the link
document.body.removeChild(link);
}
});
// open(UrlUtils.GEN_GFMIS_XML + "/today?online=true")
}

const loginContent = (
isGLDLoggedIn() ?
<div id="adminContent">
@@ -83,7 +113,15 @@ function Header(props) {
<Link className="proof" to='/proof/search'><Typography variant={"headerTitle1"} sx={{ ml: 2 }}>Proof</Typography></Link>
</li>
<li>
<Link className="payment" to='/paymentPage/search'><Typography variant={"headerTitle1"} sx={{ ml: 2 }}>Payment</Typography></Link>
<Link className="client" ><Typography variant={"headerTitle1"} sx={{ ml: 2 }}>Payment</Typography><KeyboardArrowDownIcon /></Link>
<ul className='dropdown'>
<li>
<Link className="payment" to='/paymentPage/search'><Typography variant={"headerTitle1"} sx={{ ml: 2 }}>Payment Record</Typography></Link>
</li>
<li>
<Link className="downloadXML" onClick={getXML()} ><Typography variant={"headerTitle1"} sx={{ ml: 2 }}>Download XML</Typography></Link>
</li>
</ul>
</li>
<li>
<Link className="client" ><Typography variant={"headerTitle1"} sx={{ ml: 2 }}>Client</Typography><KeyboardArrowDownIcon /></Link>


+ 4
- 1
src/utils/ApiPathConst.js 查看文件

@@ -112,4 +112,7 @@ export const GET_SMART_LOGIN = apiPath+'/smart/login'; //POST


//gen report
export const GEN_GAZETTE_PROOF = apiPath+'/proof/gazetteProof'; //POST
export const GEN_GAZETTE_PROOF = apiPath+'/proof/gazetteProof'; //POST

//gen report
export const GEN_GFMIS_XML = apiPath+'/gfmis'; //GET

正在加载...
取消
保存