keep-alive
This commit is contained in:
@@ -3,7 +3,9 @@
|
|||||||
<v-toast v-show="showToast"></v-toast>
|
<v-toast v-show="showToast"></v-toast>
|
||||||
<v-alert v-show="showAlert"></v-alert>
|
<v-alert v-show="showAlert"></v-alert>
|
||||||
<v-loading v-show="loading"></v-loading>
|
<v-loading v-show="loading"></v-loading>
|
||||||
<router-view/>
|
<keep-alive :include="keepAlive" >
|
||||||
|
<router-view/>
|
||||||
|
</keep-alive>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -24,7 +26,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['showToast', 'showAlert', 'loading'])
|
...mapGetters(['showToast', 'showAlert', 'loading', 'keepAlive'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ export default {
|
|||||||
},
|
},
|
||||||
toPage2 (e) {
|
toPage2 (e) {
|
||||||
let url = e.path
|
let url = e.path
|
||||||
|
let name = url.substr(1)
|
||||||
|
if (name === 'semifinishedinstore') {
|
||||||
|
this.$store.dispatch('setKeepAlive', [name])
|
||||||
|
}
|
||||||
this.$router.push(url)
|
this.$router.push(url)
|
||||||
},
|
},
|
||||||
Quit () {
|
Quit () {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<button class="button button--primary">快速查询</button>
|
<button class="button button--primary">快速查询</button>
|
||||||
<button class="button button--primary">确定</button>
|
<button class="button button--primary">确定</button>
|
||||||
<button class="button button--primary">清除</button>
|
<button class="button button--primary">清除</button>
|
||||||
<button class="button button--primary">关闭</button>
|
<button class="button button--primary" @click="colseUp">关闭</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -73,6 +73,9 @@ export default {
|
|||||||
async _getMaterial () {
|
async _getMaterial () {
|
||||||
let res = await getMaterial(this.val1)
|
let res = await getMaterial(this.val1)
|
||||||
this.options1 = [...res.data]
|
this.options1 = [...res.data]
|
||||||
|
},
|
||||||
|
colseUp () {
|
||||||
|
this.$router.push('/semifinishedinstore')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
<div class="search-label">物料</div>
|
<div class="search-label">物料</div>
|
||||||
<div class="filter_input_wraper pointer" @click="searchMater">
|
<div class="filter_input_wraper pointer" @click="searchMater">
|
||||||
<input type="text" class="filter-input" disabled>
|
<input type="text" class="filter-input" disabled v-model="val1">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="search-item">
|
<div class="search-item">
|
||||||
@@ -98,6 +98,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import {getBcpStor, getBillType} from '@config/getData2.js'
|
import {getBcpStor, getBillType} from '@config/getData2.js'
|
||||||
export default {
|
export default {
|
||||||
|
name: 'semifinishedinstore',
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
options1: [],
|
options1: [],
|
||||||
@@ -105,9 +106,19 @@ export default {
|
|||||||
options2: [],
|
options2: [],
|
||||||
value2: '',
|
value2: '',
|
||||||
options3: [],
|
options3: [],
|
||||||
value3: ''
|
value3: '',
|
||||||
|
val1: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeRouteLeave (to, from, next) {
|
||||||
|
if (to.path === '/home' || to.path === '/login') {
|
||||||
|
this.$store.dispatch('setKeepAlive', [])
|
||||||
|
}
|
||||||
|
next()
|
||||||
|
},
|
||||||
|
activated () {
|
||||||
|
// this.val2 = this.$store.getters.materObj.material_name
|
||||||
|
},
|
||||||
created () {
|
created () {
|
||||||
this._getBcpStor()
|
this._getBcpStor()
|
||||||
this._getBillType()
|
this._getBillType()
|
||||||
|
|||||||
@@ -2,18 +2,23 @@ import * as types from '../types'
|
|||||||
import { getStore, setStore } from '@config/utils.js'
|
import { getStore, setStore } from '@config/utils.js'
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
|
keepAlive: [], // 缓存页面
|
||||||
deviceUuid: getStore('deviceUuid') || '',
|
deviceUuid: getStore('deviceUuid') || '',
|
||||||
deviceCode: getStore('deviceCode') || '',
|
deviceCode: getStore('deviceCode') || '',
|
||||||
isProductonplan: getStore('isProductonplan') || ''
|
isProductonplan: getStore('isProductonplan') || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
const getters = {
|
const getters = {
|
||||||
|
keepAlive: state => state.keepAlive,
|
||||||
deviceUuid: state => state.deviceUuid,
|
deviceUuid: state => state.deviceUuid,
|
||||||
deviceCode: state => state.deviceCode,
|
deviceCode: state => state.deviceCode,
|
||||||
isProductonplan: state => state.isProductonplan
|
isProductonplan: state => state.isProductonplan
|
||||||
}
|
}
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
|
setKeepAlive ({commit}, res) {
|
||||||
|
commit(types.SET_KEEP_ALIVE, res)
|
||||||
|
},
|
||||||
setDevice ({commit}, res) {
|
setDevice ({commit}, res) {
|
||||||
setStore('deviceUuid', res.deviceUuid)
|
setStore('deviceUuid', res.deviceUuid)
|
||||||
setStore('deviceCode', res.deviceCode)
|
setStore('deviceCode', res.deviceCode)
|
||||||
@@ -26,6 +31,9 @@ const actions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
|
[types.SET_KEEP_ALIVE] (state, res) {
|
||||||
|
state.keepAlive = res
|
||||||
|
},
|
||||||
[types.DATA_DEVICE] (state, res) {
|
[types.DATA_DEVICE] (state, res) {
|
||||||
state.deviceUuid = res.deviceUuid
|
state.deviceUuid = res.deviceUuid
|
||||||
state.deviceCode = res.deviceCode
|
state.deviceCode = res.deviceCode
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ export const SAVE_USER_INFO = 'SAVE_USER_INFO'
|
|||||||
export const DEL_USER_INFO = 'DEL_USER_INFO'
|
export const DEL_USER_INFO = 'DEL_USER_INFO'
|
||||||
export const SAVE_TOKEN = 'SAVE_TOKEN'
|
export const SAVE_TOKEN = 'SAVE_TOKEN'
|
||||||
|
|
||||||
|
// 缓存页面
|
||||||
|
export const SET_KEEP_ALIVE = 'SET_KEEP_ALIVE'
|
||||||
|
|
||||||
// 数据
|
// 数据
|
||||||
export const DATA_DEVICE = 'DATA_DEVICE'
|
export const DATA_DEVICE = 'DATA_DEVICE'
|
||||||
export const DATA_IS_PROPLAN = 'DATA_IS_PROPLAN'
|
export const DATA_IS_PROPLAN = 'DATA_IS_PROPLAN'
|
||||||
|
|||||||
Reference in New Issue
Block a user