diff --git a/pc4mobx/hrmSalary/apis/archive.js b/pc4mobx/hrmSalary/apis/archive.js
index 39444557..c02e8e68 100644
--- a/pc4mobx/hrmSalary/apis/archive.js
+++ b/pc4mobx/hrmSalary/apis/archive.js
@@ -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);
+ }))
+}
\ No newline at end of file
diff --git a/pc4mobx/hrmSalary/pages/salaryFile/index.js b/pc4mobx/hrmSalary/pages/salaryFile/index.js
index 06341d88..26028179 100644
--- a/pc4mobx/hrmSalary/pages/salaryFile/index.js
+++ b/pc4mobx/hrmSalary/pages/salaryFile/index.js
@@ -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
@@ -133,7 +152,7 @@ export default class SalaryFile extends React.Component {
const menu2 = (
);
@@ -153,7 +172,7 @@ export default class SalaryFile extends React.Component {
placement="topLeft"
/>
导入
- 导出
+ {this.handleExportAll()}}>导出全部
@@ -207,16 +226,16 @@ export default class SalaryFile extends React.Component {
this.state.modalVisiable &&
{}}
+ 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}
diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js
index 89b6b4f0..a90287ef 100644
--- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js
+++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/programme/index.js
@@ -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();
}
diff --git a/pc4mobx/hrmSalary/stores/salaryFile.js b/pc4mobx/hrmSalary/stores/salaryFile.js
index 07715817..a7dbbd1c 100644
--- a/pc4mobx/hrmSalary/stores/salaryFile.js
+++ b/pc4mobx/hrmSalary/stores/salaryFile.js
@@ -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)
+ }
+
}
\ No newline at end of file