代码优化
This commit is contained in:
parent
862a230753
commit
2394bc38a8
|
|
@ -1,13 +1,15 @@
|
|||
import user from './modules/user';
|
||||
import addProject from './modules/addProject';
|
||||
import user from './modules/user'
|
||||
import addProject from './modules/addProject'
|
||||
import workbench from './modules/workbench'
|
||||
|
||||
import Vue from 'vue';
|
||||
import Vuex from 'vuex';
|
||||
import Vue from 'vue'
|
||||
import Vuex from 'vuex'
|
||||
Vue.use(Vuex)
|
||||
|
||||
export default new Vuex.Store({
|
||||
modules: {
|
||||
user,
|
||||
addProject
|
||||
}
|
||||
addProject,
|
||||
workbench,
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
// 状态
|
||||
const state = {
|
||||
tempList1: [],
|
||||
tempList2: [],
|
||||
tempList3: [],
|
||||
tempList4: [],
|
||||
tempList5: [],
|
||||
tempList6: [],
|
||||
tempList7: [],
|
||||
tempList8: [],
|
||||
}
|
||||
|
||||
// 修改
|
||||
const mutations = {
|
||||
SET_TEMP_LIST_1(state, list) {
|
||||
state.tempList1 = list
|
||||
},
|
||||
SET_TEMP_LIST_2(state, list) {
|
||||
state.tempList2 = list
|
||||
},
|
||||
SET_TEMP_LIST_3(state, list) {
|
||||
state.tempList3 = list
|
||||
},
|
||||
SET_TEMP_LIST_4(state, list) {
|
||||
state.tempList4 = list
|
||||
},
|
||||
SET_TEMP_LIST_5(state, list) {
|
||||
state.tempList5 = list
|
||||
},
|
||||
SET_TEMP_LIST_6(state, list) {
|
||||
state.tempList6 = list
|
||||
},
|
||||
SET_TEMP_LIST_7(state, list) {
|
||||
state.tempList7 = list
|
||||
},
|
||||
SET_TEMP_LIST_8(state, list) {
|
||||
state.tempList8 = list
|
||||
},
|
||||
}
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state,
|
||||
mutations,
|
||||
}
|
||||
|
|
@ -404,7 +404,6 @@ export default {
|
|||
},
|
||||
{ id: 13, name: '预警管理', componentName: 'ThirteenModel' },
|
||||
],
|
||||
tempList: [],
|
||||
tempList1: [],
|
||||
tempList2: [],
|
||||
tempList3: [],
|
||||
|
|
@ -422,6 +421,36 @@ export default {
|
|||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
const store = this.$store.state.workbench
|
||||
|
||||
console.log(store, '保存的信息')
|
||||
if (store.tempList1.length > 0) {
|
||||
this.tempList1 = store.tempList1
|
||||
}
|
||||
if (store.tempList2.length > 0) {
|
||||
this.tempList2 = store.tempList2
|
||||
}
|
||||
if (store.tempList3.length > 0) {
|
||||
this.tempList3 = store.tempList3
|
||||
}
|
||||
if (store.tempList4.length > 0) {
|
||||
this.tempList4 = store.tempList4
|
||||
}
|
||||
if (store.tempList5.length > 0) {
|
||||
this.tempList5 = store.tempList5
|
||||
}
|
||||
if (store.tempList6.length > 0) {
|
||||
this.tempList6 = store.tempList6
|
||||
}
|
||||
if (store.tempList7.length > 0) {
|
||||
this.tempList7 = store.tempList7
|
||||
}
|
||||
if (store.tempList8.length > 0) {
|
||||
this.tempList8 = store.tempList8
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
onStart() {},
|
||||
onEnd(e) {
|
||||
|
|
@ -491,6 +520,7 @@ export default {
|
|||
if (newValue.length > 1) {
|
||||
this.tempList1 = this.tempList1.splice(this.tempList1.length - 1, 1)
|
||||
this.completeList.push(newValue)
|
||||
// console.log('----')
|
||||
}
|
||||
|
||||
// if(newValue === 0 )
|
||||
|
|
@ -565,6 +595,21 @@ export default {
|
|||
},
|
||||
deep: true,
|
||||
},
|
||||
isSave: {
|
||||
handler(newValue) {
|
||||
if (newValue) {
|
||||
this.$store.commit('workbench/SET_TEMP_LIST_1', this.tempList1)
|
||||
this.$store.commit('workbench/SET_TEMP_LIST_2', this.tempList2)
|
||||
this.$store.commit('workbench/SET_TEMP_LIST_3', this.tempList3)
|
||||
this.$store.commit('workbench/SET_TEMP_LIST_4', this.tempList4)
|
||||
this.$store.commit('workbench/SET_TEMP_LIST_5', this.tempList5)
|
||||
this.$store.commit('workbench/SET_TEMP_LIST_6', this.tempList6)
|
||||
this.$store.commit('workbench/SET_TEMP_LIST_7', this.tempList7)
|
||||
this.$store.commit('workbench/SET_TEMP_LIST_8', this.tempList8)
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
@handleExitEdit="handleExitEdit"
|
||||
@handleSubmit="handleSubmit"
|
||||
/>
|
||||
<WorkbenchTemp ref="WorkbenchTempRef" :idEdit="idEdit" />
|
||||
<WorkbenchTemp ref="WorkbenchTempRef" :idEdit="idEdit" :isSave="isSave" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue