This commit is contained in:
parent
7104035b17
commit
7c07f6c591
|
|
@ -135,3 +135,28 @@ export const importPreview = (params) => {
|
|||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
}
|
||||
|
||||
// 导入档案
|
||||
export const importSalaryArchive = (params) => {
|
||||
return fetch('/api/bs/hrmsalary/salaryArchive/importSalaryArchive', {
|
||||
method: 'POST',
|
||||
mode: 'cors',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(params)
|
||||
}).then(res => res.json())
|
||||
}
|
||||
|
||||
// 导出档案
|
||||
export const exportSalaryArchive = (ids = "") => {
|
||||
fetch('/api/bs/hrmsalary/salaryArchive/exportList?ids=' + ids).then(res => res.blob().then(blob => {
|
||||
var filename=`薪资档案.xlsx`
|
||||
var a = document.createElement('a');
|
||||
var url = window.URL.createObjectURL(blob);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
a.click();
|
||||
window.URL.revokeObjectURL(url);
|
||||
}))
|
||||
}
|
||||
|
|
@ -73,11 +73,30 @@ export default class SalaryFile extends React.Component {
|
|||
importPreview(params)
|
||||
}
|
||||
|
||||
// 导入档案
|
||||
handleImportFile(params) {
|
||||
const { salaryFileStore: {importSalaryArchive}} = this.props;
|
||||
params.importType = this.state.importType
|
||||
importSalaryArchive(params)
|
||||
}
|
||||
|
||||
|
||||
// 导入完成按钮操作
|
||||
handleImportFinish() {
|
||||
this.setState({modalVisiable: false, step: 0})
|
||||
}
|
||||
|
||||
// 导出全部
|
||||
handleExportAll() {
|
||||
const { salaryFileStore: {exportSalaryArchive}} = this.props;
|
||||
exportSalaryArchive();
|
||||
}
|
||||
|
||||
|
||||
render() {
|
||||
const { salaryFileStore } = this.props;
|
||||
const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = salaryFileStore;
|
||||
const { importType } = salaryFileStore;
|
||||
const { importType, previewColumns, previewDataSource } = salaryFileStore;
|
||||
const { selectedTab, step } = this.state;
|
||||
if (!hasRight && !loading) { // 无权限处理
|
||||
return renderNoright();
|
||||
|
|
@ -105,7 +124,7 @@ export default class SalaryFile extends React.Component {
|
|||
];
|
||||
|
||||
const topTab = [
|
||||
];
|
||||
];
|
||||
|
||||
const renderSearchOperationItem = () => {
|
||||
return <div></div>
|
||||
|
|
@ -133,7 +152,7 @@ export default class SalaryFile extends React.Component {
|
|||
|
||||
const menu2 = (
|
||||
<Menu onClick={handleMenuClick2}>
|
||||
<Menu.Item key="1">导出全部</Menu.Item>
|
||||
<Menu.Item key="1">导出所选</Menu.Item>
|
||||
</Menu>
|
||||
);
|
||||
|
||||
|
|
@ -153,7 +172,7 @@ export default class SalaryFile extends React.Component {
|
|||
placement="topLeft"
|
||||
/>
|
||||
<Dropdown.Button type="primary" style={{marginRight: "10px"}} overlay={menu}>导入</Dropdown.Button>
|
||||
<Dropdown.Button style={{marginRight: "10px"}} overlay={menu2}>导出</Dropdown.Button>
|
||||
<Dropdown.Button style={{marginRight: "10px"}} overlay={menu2} onClick={() => {this.handleExportAll()}}>导出全部</Dropdown.Button>
|
||||
<Button type="default" style={{marginRight: "10px"}} onClick={() => {this.setState({editSlideVisible: true})}}>调薪记录</Button>
|
||||
<WeaInputSearch />
|
||||
</div>
|
||||
|
|
@ -207,16 +226,16 @@ export default class SalaryFile extends React.Component {
|
|||
this.state.modalVisiable &&
|
||||
<ImportModal
|
||||
params={{}}
|
||||
columns={columns}
|
||||
columns={previewColumns}
|
||||
step={step}
|
||||
setStep={this.setStep.bind(this)}
|
||||
slideDataSource={dataSource}
|
||||
slideDataSource={previewDataSource}
|
||||
importResult={{}}
|
||||
onFinish={() => {}}
|
||||
onFinish={() => {this.handleImportFinish()}}
|
||||
previewImport={(params) => {
|
||||
this.handlePreviewImport(params)
|
||||
}}
|
||||
importFile={(params) => {}}
|
||||
importFile={(params) => {this.handleImportFile(params)}}
|
||||
templateLink={"/api/bs/hrmsalary/salaryArchive/downloadTemplate?importType=" + this.state.importType}
|
||||
renderFormComponent={() => {this.renderFormComponent()}}
|
||||
visiable={this.state.modalVisiable}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,8 @@ export default class Programme extends React.Component {
|
|||
const { programmeStore } = this.props;
|
||||
const { loading, hasRight, form, condition, tableStore, showSearchAd, getTableDatas, doSearch, setShowSearchAd } = programmeStore;
|
||||
const { selectedKey, setSelectedKey, getCustomCategoryList, customTableStore,
|
||||
customSelectkey, setCustomSelectkey, requestParams, setRequestParams, formCondition, setCustomNewVisible, customNewVisible } = programmeStore;
|
||||
customSelectkey, setCustomSelectkey, requestParams, setRequestParams, formCondition,
|
||||
setCustomNewVisible, customNewVisible } = programmeStore;
|
||||
if (!hasRight && !loading) { // 无权限处理
|
||||
return renderNoright();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ export class salaryFileStore {
|
|||
@observable loading = true; // 数据加载状态
|
||||
|
||||
@observable importType = [];
|
||||
@observable previewColumns = [];
|
||||
@observable previewDataSource = [];
|
||||
|
||||
|
||||
// 初始化操作
|
||||
|
|
@ -80,7 +82,24 @@ export class salaryFileStore {
|
|||
@action
|
||||
importPreview = (params) => {
|
||||
API.importPreview(params).then(res => {
|
||||
if(res.state) {
|
||||
if(res.status) {
|
||||
let headers = res.data.headers
|
||||
this.previewColumns = headers.map((item, index) => {
|
||||
return {
|
||||
key: index,
|
||||
title: item,
|
||||
dataIndex: index
|
||||
}
|
||||
})
|
||||
|
||||
let list = res.data.list;
|
||||
this.previewDataSource = list.map(item => {
|
||||
let result = {}
|
||||
item.map((i, index) => {
|
||||
result[index] = i
|
||||
})
|
||||
return result;
|
||||
})
|
||||
|
||||
} else {
|
||||
message.error(res.errormsg || "获取数据失败")
|
||||
|
|
@ -88,4 +107,22 @@ export class salaryFileStore {
|
|||
})
|
||||
}
|
||||
|
||||
// 导入档案
|
||||
@action
|
||||
importSalaryArchive = (params) => {
|
||||
API.importSalaryArchive(params).then(res => {
|
||||
if(res.status) {
|
||||
message.success("导入成功")
|
||||
} else {
|
||||
message.error(res.errormsg || "接口异常")
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 导出档案
|
||||
@action
|
||||
exportSalaryArchive = (ids = "") => {
|
||||
API.exportSalaryArchive(ids)
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue