73 lines
1.6 KiB
JavaScript
73 lines
1.6 KiB
JavaScript
|
/*
|
|||
|
* @Author: Kane
|
|||
|
* @Date: 2023-02-06 14:12:11
|
|||
|
* @LastEditors: Kane
|
|||
|
* @LastEditTime: 2023-02-06 15:52:55
|
|||
|
* @FilePath: /IT工具综合平台/src/utils/api/LocalStorage.js
|
|||
|
* @Description: 初始化localStorage中保存的值。
|
|||
|
*
|
|||
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
|||
|
*/
|
|||
|
|
|||
|
//常量
|
|||
|
const REQUIREMRNT_UI = "requirement_ui";
|
|||
|
|
|||
|
//需求管理模块
|
|||
|
function loadRequirementUI()
|
|||
|
{
|
|||
|
// debugger;
|
|||
|
|
|||
|
let requirementUI = null;
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
requirementUI = JSON.parse(window.localStorage.getItem(REQUIREMRNT_UI));
|
|||
|
}
|
|||
|
catch (error)
|
|||
|
{
|
|||
|
console.log("转换requirement-ui失败:", error);
|
|||
|
requirementUI = {};
|
|||
|
}
|
|||
|
|
|||
|
//如果之前不存在,json转换结果也会是null
|
|||
|
if (requirementUI === null)
|
|||
|
{
|
|||
|
requirementUI = {};
|
|||
|
}
|
|||
|
|
|||
|
if (requirementUI.selected_status === undefined)
|
|||
|
{
|
|||
|
requirementUI.selected_status = [];
|
|||
|
}
|
|||
|
|
|||
|
if (requirementUI.title === undefined)
|
|||
|
{
|
|||
|
requirementUI.title = "";
|
|||
|
}
|
|||
|
|
|||
|
if (requirementUI.serial_no === undefined)
|
|||
|
{
|
|||
|
requirementUI.serial_no = "";
|
|||
|
}
|
|||
|
|
|||
|
if (requirementUI.request_people === undefined)
|
|||
|
{
|
|||
|
requirementUI.request_people = "";
|
|||
|
}
|
|||
|
|
|||
|
if (requirementUI.commit_start_date === undefined)
|
|||
|
{
|
|||
|
requirementUI.commit_start_date = new Date();
|
|||
|
requirementUI.commit_start_date.setMonth(0);
|
|||
|
requirementUI.commit_start_date.setDate(1);
|
|||
|
}
|
|||
|
|
|||
|
if (requirementUI.commit_end_date === undefined)
|
|||
|
{
|
|||
|
requirementUI.commit_end_date = new Date();
|
|||
|
}
|
|||
|
|
|||
|
return requirementUI;
|
|||
|
}
|
|||
|
|
|||
|
export { loadRequirementUI };
|