12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- const state = {
- title: '统计报表',
- level: 0,
- value: ''
- }
- const mutations = {
- SET_TITLE: (state, title) => {
- state.title = title
- },
- SET_LEVEL: (state, level) => {
- state.level = level
- },
- SET_VALUE: (state, value) => {
- state.value = value
- }
- }
- const levels = ['统计报表', '数据详情']
- const actions = {
- init({ commit, state }, payload) {
- return new Promise((resolve, reject) => {
- commit('SET_TITLE', levels[0])
- commit('SET_LEVEL', 0)
- })
- },
- next({ commit, state }, payload) {
- return new Promise((resolve, reject) => {
- const level = state.level + 1
- commit('SET_TITLE', levels[level])
- commit('SET_LEVEL', level)
- resolve(level)
- })
- },
- pre({ commit, state }, payload) {
- return new Promise((resolve, reject) => {
- const level = state.level - 1
- commit('SET_TITLE', levels[level])
- commit('SET_LEVEL', level)
- resolve(level)
- })
- },
- gValue({ commit, state }, payload) {
- return new Promise((resolve, reject) => {
- commit('SET_VALUE', payload)
- resolve()
- })
- }
- }
- export default {
- namespaced: true,
- state,
- mutations,
- actions
- }
|