
import * as types from './mutation-types';

const mutations = {
  [types.DEL_TABLE_ITEM] (state, item) {
    state.table_cur_item = item
  },
  [types.SET_ROUTE_CACHE] (state, item) {
    state.route_cache = item
  },

  [types.SET_TABLE_DATA] (state, data) {
    state.setTableData = data
  },
  [types.DEL_TABLE_DATA] (state, payload) {
    state.setTableData.splice(payload.idx, 1)
    state.setTableJs = payload.row
  },
  [types.CL_TABLE_DATA] (state, payload) {
    state.isClTableData = !state.isClTableData
  },
  setDictionaryData (state, data) {
    let flag = false
    state.dictionary.forEach((item) => {
      if (item.typeCode == data.typeCode) {
        flag = true
        return false
      }
    })
    if (!flag) {
      state.dictionary.push(data)
    }
  },
  setUser (state, data) {
    state.user = data
  },
  setDragDialogOrderNo (state, data) {
    state.dragDialogOrderNo.push(data)
    state.dragDialogOrderNo = [...new Set(state.dragDialogOrderNo)]
  },
  setCurrentDragDialog (state, data) {
    state.currentDragDialog = data
  },
  taskCurrentOrder (state, data) {
    state.taskCurrentOrder = data
  },
  taskCurrentProcess (state, data) {
    state.currentProcess = data
  },
  [types.SET_INITSTARTTIME] (state, data) {
    state.initStartTime = data || ""
  },
  [types.SET_INITENDTIME] (state, data) {
    state.initEndTime = data || ""
  },
  [types.SQL_TYPE] (state, data) {
    state.SQL_TYPE = data
  },
  setFilterArea (state, data) {
    state.filterArea = data
  },
  setToken (state, data) {
    state.token = data
  },


}

export default mutations
