export default {
  state: {
    template: {},
    active: 0,
    activeItem: '',
    component: 'SelectTemplate',
    templateList: [],
    form: {},
    patentList: []
  },

  mutations: {
    SET_TEMPLATE: (state, template) => {
      state.template = template
    },
    SET_CLEAR_PATENT: (state, patentList) => {
      state.form.patentList = []
    },
    SET_TEMPLATE_LIST: (state, templateList) => {
      state.templateList = templateList
    },
    SET_ACTIVE: (state, active) => {
      state.active = active
    },
    SET_ACTIVE_ITEM: (state, activeItem) => {
      state.activeItem = activeItem
    },
    SET_COMPONENT: (state, component) => {
      state.component = component
    },
    SET_FORM: (state, form) => {
      if (form) {
        state.form = form
      } else {
        state.form = {
          templateId: null,
          name: '',
          remark: '',
          projectId: null,
          patentList: [],
          patentKey: null
        }
      }
    },
    SET_PATENT_LIST: (state, patentList) => {
      state.patentList = patentList
    },
  }
}
