keep-alive

This commit is contained in:
2023-06-29 18:42:36 +08:00
parent 5aa63a973b
commit a49a28370b
5 changed files with 23 additions and 15 deletions

View File

@@ -3,9 +3,7 @@
<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>
<keep-alive :include="keepAlive" > <router-view/>
<router-view/>
</keep-alive>
</div> </div>
</template> </template>
@@ -26,7 +24,7 @@ export default {
} }
}, },
computed: { computed: {
...mapGetters(['showToast', 'showAlert', 'loading', 'keepAlive']) ...mapGetters(['showToast', 'showAlert', 'loading'])
} }
} }
</script> </script>

View File

@@ -6,13 +6,16 @@
/> />
<div class="body-container"> <div class="body-container">
<div class="main-container"> <div class="main-container">
<router-view></router-view> <keep-alive :include="keepAlive" >
<router-view/>
</keep-alive>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { mapGetters } from 'vuex'
import jxHeader from '@components/header.vue' import jxHeader from '@components/header.vue'
export default { export default {
components: { components: {
@@ -25,7 +28,8 @@ export default {
title () { title () {
let res = ['半成品入库', '半成品入库查询', '半成品出库', '半成品出库查询', '半成品盘点', '半成品盘点查询', '半成品拼盘查询', '物料查询'][Number(this.$route.meta.guidePath) - 1] let res = ['半成品入库', '半成品入库查询', '半成品出库', '半成品出库查询', '半成品盘点', '半成品盘点查询', '半成品拼盘查询', '物料查询'][Number(this.$route.meta.guidePath) - 1]
return res return res
} },
...mapGetters(['keepAlive'])
}, },
methods: { methods: {
switchColor (type) { switchColor (type) {

View File

@@ -22,7 +22,7 @@
</div> </div>
</div> </div>
<div class="search-item_2 flexend"> <div class="search-item_2 flexend">
<button class="button button--primary">快速查询</button> <button class="button button--primary" @click="_getMaterial">快速查询</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> <button class="button button--primary" @click="colseUp">关闭</button>
@@ -41,7 +41,7 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr v-for="(e, i) in dataList" :key="i"> <tr v-for="(e, i) in dataList" :key="i" :class="{'selected_icon': pkId === e.material_code}" @click="toRadio(e)">
<td>{{ i+1 }}</td> <td>{{ i+1 }}</td>
<td>{{e.material_code}}</td> <td>{{e.material_code}}</td>
<td>{{e.material_name}}</td> <td>{{e.material_name}}</td>
@@ -62,7 +62,9 @@ export default {
options1: [], options1: [],
value1: '', value1: '',
val1: '', val1: '',
dataList: [] dataList: [{material_code: '1'}],
pkId: '',
pkObj: {}
} }
}, },
created () { created () {
@@ -76,6 +78,10 @@ export default {
}, },
colseUp () { colseUp () {
this.$router.push('/semifinishedinstore') this.$router.push('/semifinishedinstore')
},
toRadio (e) {
this.pkId = this.pkId === e.material_code ? '' : e.material_code
this.pkObj = this.pkId === e.material_code ? e : {}
} }
} }
} }

View File

@@ -37,7 +37,7 @@
<div class="search-item"> <div class="search-item">
<div class="search-label">规格</div> <div class="search-label">规格</div>
<div class="filter_input_wraper"> <div class="filter_input_wraper">
<input type="text" class="filter-input"> <input type="text" class="filter-input" v-model="val2">
</div> </div>
</div> </div>
<div class="search-item"> <div class="search-item">
@@ -107,7 +107,8 @@ export default {
value2: '', value2: '',
options3: [], options3: [],
value3: '', value3: '',
val1: '' val1: '',
val2: ''
} }
}, },
beforeRouteLeave (to, from, next) { beforeRouteLeave (to, from, next) {

View File

@@ -106,11 +106,10 @@ export default new Router({
}, { }, {
path: '/semifinishedcomposesearch', path: '/semifinishedcomposesearch',
component: semiFinishedComposeSearch, component: semiFinishedComposeSearch,
meta: {guidePath: '7'}
}, {
path: '/matersearch',
component: materSearch,
meta: {guidePath: '8'} meta: {guidePath: '8'}
}, {
path: '/materSearch',
component: materSearch
}] }]
}, },
{ {