diff --git a/pc4mobx/hrmSalary/pages/payroll/index.js b/pc4mobx/hrmSalary/pages/payroll/index.js index 9b705f33..ed0c68ab 100644 --- a/pc4mobx/hrmSalary/pages/payroll/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/index.js @@ -66,11 +66,11 @@ export default class Payroll extends React.Component { if (!isEdit) { this.setState({ currentStep: this.state.currentStep + 1 }, () => { setReplenishSalaryTemplateSalaryItemSet(data.replenishSalaryTemplateSalaryItemSet); - window.localStorage.setItem("salary-template-showset", JSON.stringify(salaryTemplateShowSet)); + window.localStorage.setItem("salary-showset", JSON.stringify(salaryTemplateShowSet)); }); } else { setReplenishSalaryTemplateSalaryItemSet(data.replenishSalaryTemplateSalaryItemSet); - window.localStorage.setItem("salary-template-showset", JSON.stringify(salaryTemplateShowSet)); + window.localStorage.setItem("salary-showset", JSON.stringify(salaryTemplateShowSet)); } } }); @@ -81,7 +81,7 @@ export default class Payroll extends React.Component { const { fetchSavePayroll } = payrollStore; fetchSavePayroll().then(() => { window.localStorage.removeItem("template-basedata"); - window.localStorage.removeItem("salary-template-showset"); + window.localStorage.removeItem("salary-showset"); this.setState({ currentStep: 0, stepSlideVisible: false }); }); }; @@ -174,7 +174,7 @@ export default class Payroll extends React.Component { handlePreview = () => { const { payrollStore: { templateBaseData, salaryTemplateShowSet, salaryItemSet } } = this.props; window.localStorage.setItem("template-basedata", JSON.stringify(templateBaseData)); - window.localStorage.setItem("salary-template-showset", JSON.stringify(salaryTemplateShowSet)); + window.localStorage.setItem("salary-showset", JSON.stringify(salaryTemplateShowSet)); window.localStorage.setItem("salaryItemSet", JSON.stringify(salaryItemSet)); window.open("/spa/hrmSalary/static/index.html#/main/hrmSalary/templatePreview"); }; @@ -210,7 +210,7 @@ export default class Payroll extends React.Component { selectedTab: 0 }, () => { window.localStorage.removeItem("template-basedata"); - window.localStorage.removeItem("salary-template-showset"); + window.localStorage.removeItem("salary-showset"); }); }); }; @@ -411,7 +411,7 @@ export default class Payroll extends React.Component { steps={steps} onCancel={() => { window.localStorage.removeItem("template-basedata"); - window.localStorage.removeItem("salary-template-showset"); + window.localStorage.removeItem("salary-showset"); this.setState({ stepSlideVisible: false }); }} customOperate={ @@ -511,7 +511,7 @@ export default class Payroll extends React.Component { } onClose={() => this.setState({ editSlideVisible: false }, () => { window.localStorage.removeItem("template-basedata"); - window.localStorage.removeItem("salary-template-showset"); + window.localStorage.removeItem("salary-showset"); this.setState({ selectedTab: 0 }); })} /> diff --git a/pc4mobx/hrmSalary/pages/payroll/stepForm/showSettingForm.js b/pc4mobx/hrmSalary/pages/payroll/stepForm/showSettingForm.js index 2baa38de..ef34deed 100644 --- a/pc4mobx/hrmSalary/pages/payroll/stepForm/showSettingForm.js +++ b/pc4mobx/hrmSalary/pages/payroll/stepForm/showSettingForm.js @@ -82,7 +82,7 @@ export default class ShowSettingForm extends React.Component { render() { const { payrollStore, id } = this.props; - const salaryTemplateShowSetStorage = id ? "{}" : window.localStorage.getItem("salary-template-showset") || "{}"; + const salaryTemplateShowSetStorage = id ? "{}" : window.localStorage.getItem("salary-showset") || "{}"; const { salaryTemplateShowSet } = payrollStore; const { salaryItemSet } = payrollStore; const { diff --git a/pc4mobx/hrmSalary/pages/payroll/templatePreview/computerTemplate/index.js b/pc4mobx/hrmSalary/pages/payroll/templatePreview/computerTemplate/index.js index 111a08a6..3d4a0ee4 100644 --- a/pc4mobx/hrmSalary/pages/payroll/templatePreview/computerTemplate/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/templatePreview/computerTemplate/index.js @@ -22,8 +22,8 @@ export default class ComputerTemplate extends React.Component { componentWillMount() { if (this.props.isPreview) return; - let salaryTemplateShowSetStr = window.localStorage.getItem("salary-template-showset"); - let salaryItemSetStr = window.localStorage.getItem("salaryItemSet"); + let salaryTemplateShowSetStr = window.localStorage.getItem("salary-showset") || "{}"; + let salaryItemSetStr = window.localStorage.getItem("salaryItemSet") || "{}"; this.setState({ salaryItemSet: JSON.parse(salaryItemSetStr), salaryTemplateShowSet: JSON.parse(salaryTemplateShowSetStr) diff --git a/pc4mobx/hrmSalary/pages/payroll/templatePreview/phoneTemplate/index.js b/pc4mobx/hrmSalary/pages/payroll/templatePreview/phoneTemplate/index.js index 70629c32..8e90a5b6 100644 --- a/pc4mobx/hrmSalary/pages/payroll/templatePreview/phoneTemplate/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/templatePreview/phoneTemplate/index.js @@ -24,7 +24,7 @@ export default class PhoneTemplate extends React.Component { componentWillMount() { if(this.props.isPreview) return; - let salaryTemplateShowSetStr = window.localStorage.getItem("salary-template-showset"); + let salaryTemplateShowSetStr = window.localStorage.getItem("salary-showset"); let salaryItemSetStr = window.localStorage.getItem("salaryItemSet"); this.setState({ salaryItemSet: JSON.parse(salaryItemSetStr), diff --git a/pc4mobx/hrmSalary/single.js b/pc4mobx/hrmSalary/single.js index 988ea681..516834ad 100644 --- a/pc4mobx/hrmSalary/single.js +++ b/pc4mobx/hrmSalary/single.js @@ -31,8 +31,10 @@ class Root extends React.Component { componentWillMount() { top.$(".ant-message").remove(); allStore.taxAgentStore.getPermission(); - window.localStorage.removeItem("template-basedata"); - window.localStorage.removeItem("salary-template-showset"); + if(window.location.hash.indexOf("payroll")!== -1){ + window.localStorage.removeItem("template-basedata"); + window.localStorage.removeItem("salary-showset"); + } } render() { diff --git a/pc4mobx/hrmSalary/stores/payroll.js b/pc4mobx/hrmSalary/stores/payroll.js index 69c36548..6f98abe1 100644 --- a/pc4mobx/hrmSalary/stores/payroll.js +++ b/pc4mobx/hrmSalary/stores/payroll.js @@ -187,7 +187,7 @@ export class payrollStore { @action getPayrollShowForm = (id = "") => { const params = { id }; - const salaryTemplateShowSetStorage = window.localStorage.getItem("salary-template-showset") || "{}"; + const salaryTemplateShowSetStorage = window.localStorage.getItem("salary-showset") || "{}"; API.getPayrollShowForm(params).then(res => { if (res.status) { if (id !== "") {