const station = {
  state: {
    stationIp: sessionStorage.getItem('stationIp') ? sessionStorage.getItem('stationIp') : '',
    stationNumber: sessionStorage.getItem('stationNumber') ? sessionStorage.getItem('stationNumber') : '',
    stationName: sessionStorage.getItem('stationName') ? sessionStorage.getItem('stationName') : '',
    classesID: sessionStorage.getItem('classesID') ? sessionStorage.getItem('classesID') : '',
    MesWebCode: sessionStorage.getItem('MesWebCode') ? sessionStorage.getItem('MesWebCode') : '',
    classes: sessionStorage.getItem('classes') ? sessionStorage.getItem('classes') : '',
    engineValue: JSON.parse(sessionStorage.getItem('engineValue')) ? JSON.parse(sessionStorage.getItem('engineValue')) : {},
    statusValue: JSON.parse(sessionStorage.getItem('statusValue')) ? JSON.parse(sessionStorage.getItem('statusValue')) : {},
    qualityDataHeade: JSON.parse(sessionStorage.getItem('qualityDataHeade')) ? JSON.parse(sessionStorage.getItem('qualityDataHeade')) : {},
    stationStatus: 0,
    plcStatus: true,
    turnLineWorkStatus: 0, // 转线工件
    tempDataObject: JSON.parse(sessionStorage.getItem('tempDataObject')) ? JSON.parse(sessionStorage.getItem('tempDataObject')) : {
      MA010Temperature: '', // MA010温度
      setTemperatureForm: '', // MA010 设置温度
      ShowBackWorkBox: '', // 返修弹窗
      emptyTrayGo: '', // 空托盘放行
      CodeNumber: '', // 当前程序号
      NowBoltCount: 0, // 当前拧紧螺栓数
      CodeNumberWorkNumber: '', // 当前程序号下的第几课螺栓
      J07MA080BarCodeCheckBrushWriting: '', // 通知刷新铭牌列表
      SetButtomShouOrHide: 0, // 通知刷新功能按钮
      FlushOverWorkList: 0, // 通知刷新完工列表
      WatchMA080barCode: '',
      MaterialList_Dif_Resources_MA050: '', // MA050 换型首台 进间隙抽检
      BindRecordRefresh: 0,
      oilTestPlcIsManual: 0, // 注油测试PLC手自动点
      oilTestResult: 0, // 注油测试结果
      oilTestEnd: 0, // 注油测试 测试完成点
      BarCodeData: '' // 当前工位记录扫码值 显示到右下角
    }, // 临时数据对象 用于存储各种PLC的临时信号
    stationUserCount: sessionStorage.getItem('stationUserCount') ? sessionStorage.getItem('stationUserCount') : '',
    stationUserName: sessionStorage.getItem('stationUserName') ? sessionStorage.getItem('stationUserName') : '',
    stationNameUsed: sessionStorage.getItem('stationNameUsed') ? sessionStorage.getItem('stationNameUsed') : ''
  },
  mutations: {
    // 设置临时变量时需要传入key value格式对象进行赋值
    // isCut 参数用于判断是否需要自动切换 可以给自动转换一次
    set_tempDataObject(state, itemObj) {
      // 先设为''做一次差异，防止监视属性检测不到，而后在改为设置的值
      state.tempDataObject[itemObj.key] = ''
      sessionStorage.setItem('tempDataObject', JSON.stringify(state.tempDataObject))
      setTimeout(() => {
        state.tempDataObject[itemObj.key] = itemObj.value
        sessionStorage.setItem('tempDataObject', JSON.stringify(state.tempDataObject))
      }, 0)
    },
    set_statusValue(state, statusValue) {
      sessionStorage.setItem('statusValue', JSON.stringify(statusValue))
      state.statusValue = statusValue
    },
    set_qualityDataHeader(state, qualityDataHeade) {
      sessionStorage.setItem('statusValue', JSON.stringify(qualityDataHeade))
      state.qualityDataHeade = qualityDataHeade
    },
    set_stationIp(state, stationIp) {
      sessionStorage.setItem('stationIp', stationIp)
      state.stationIp = stationIp
    },
    set_stationNumber(state, stationNumber) {
      sessionStorage.setItem('stationNumber', stationNumber)
      state.stationNumber = stationNumber
    },
    set_stationName(state, stationName) {
      sessionStorage.setItem('stationName', stationName)
      state.stationName = stationName
    },
    set_classesID(state, classesID) {
      sessionStorage.setItem('classesID', classesID)
      state.classesID = classesID
    },
    set_stationUserName(state, stationUserName) {
      sessionStorage.setItem('stationUserName', stationUserName)
      state.stationUserName = stationUserName
    },
    set_stationUserCount(state, stationUserCount) {
      sessionStorage.setItem('stationUserCount', stationUserCount)
      state.stationUserCount = stationUserCount
    },
    set_classes(state, classes) {
      sessionStorage.setItem('classes', classes)
      state.classes = classes
    },
    set_MesWebCode(state, MesWebCode) {
      sessionStorage.setItem('MesWebCode', MesWebCode)
      state.MesWebCode = MesWebCode
    },
    set_engineValue(state, engineValue) {
      sessionStorage.setItem('engineValue', JSON.stringify(engineValue))
      state.engineValue = engineValue
    },
    set_stationStatus(state, stationStatus) {
      state.stationStatus = stationStatus
    },
    set_plcStatus(state, plcStatus) {
      state.plcStatus = plcStatus
    },
    set_turnLineWorkStatus(state, turnLineWorkStatus) {
      state.turnLineWorkStatus = turnLineWorkStatus
    }
  }
}
export default station
