master
xy 2 years ago
parent 0dc9a56031
commit 27127f0ef5

@ -93,12 +93,21 @@ export default {
} }
}, },
methods: { methods: {
typeSelect (i) { typeSelect ({ value }) {
if (this.$store.state.reception.select.leixing == i.value) { let leixing = this.$store.state.reception.select.leixing ? this.$store.state.reception.select.leixing.split(',') : []
this.$store.commit('reception/SET_SELECTED',{ key: 'leixing',value: '' }) if (leixing.find(i => i == value)) {
leixing.splice(leixing.indexOf(leixing.find(i => i == value)), 1)
this.$store.commit('reception/SET_SELECTED',{ key: 'leixing',value: leixing.toString() })
} else { } else {
this.$store.commit('reception/SET_SELECTED',{ key: 'leixing',value: i.value }) leixing.push(value)
this.$store.commit('reception/SET_SELECTED',{ key: 'leixing',value: leixing.toString() })
}
if (this.$route.fullPath === '/index/home') {
this.$router.push('/index/list1') this.$router.push('/index/list1')
return
}
if (this.$route.fullPath === '/index/list1') {
window.getMaterial()
} }
}, },
@ -120,8 +129,9 @@ export default {
}, },
computed: { computed: {
isSelectedType () { isSelectedType () {
return function (i) { return function ({ value }) {
return i.value == this.$store.state.reception.select.leixing let leixing = this.$store.state.reception.select.leixing ? this.$store.state.reception.select.leixing.split(',') : []
return leixing.find(i => i == value)
} }
}, },

@ -23,6 +23,22 @@ const mutations = {
SET_SELECTED: (state, { key, value, refresh = false }) => { SET_SELECTED: (state, { key, value, refresh = false }) => {
if (refresh) { if (refresh) {
for(let key in state.select) { for(let key in state.select) {
if (key === 'page') {
state.select[key] = 1
continue
}
if (key === 'page_size') {
state[key] = 10
continue
}
if (key === 'table_name') {
state[key] = 'materials'
continue
}
if (key === 'sort_type') {
state[key] = 'desc'
continue
}
state.select[key] = '' state.select[key] = ''
} }
} }

@ -291,13 +291,12 @@ export default {
console.log(this.labelGroup); console.log(this.labelGroup);
}, },
toList ({ tag, dept, leixing, sort_name }) { toList ({ tag, dept, sort_name }) {
console.log(111, sort_name, leixing) console.log(111, sort_name)
tag?.id ? this.$store.commit('reception/SET_SELECTED',{ key: 'tag_id', value: tag.id, refresh: true }) : '' tag?.id ? this.$store.commit('reception/SET_SELECTED',{ key: 'tag_id', value: tag.id, refresh: true }) : ''
dept?.id ? this.$store.commit('reception/SET_SELECTED',{ key: 'dept_id', value: dept.id, refresh: true }) : '' dept?.id ? this.$store.commit('reception/SET_SELECTED',{ key: 'dept_id', value: dept.id, refresh: true }) : ''
leixing ? this.$store.commit('reception/SET_SELECTED',{ key: 'leixing', value: leixing }) : ''
sort_name ? this.$store.commit('reception/SET_SELECTED',{ key: 'sort_name', value: sort_name, refresh: true }) : '' sort_name ? this.$store.commit('reception/SET_SELECTED',{ key: 'sort_name', value: sort_name, refresh: true }) : ''
this.$router.push(`/index/list1?${this.$store.getters.select}`) this.$router.push('/index/list1')
} }
}, },
computed: { computed: {

@ -25,7 +25,10 @@
<div> <div>
<div class="list" v-if="list.length > 0"> <div class="list" v-if="list.length > 0">
<div class="list__item" v-for="i in list" :key="i.id"> <div class="list__item" v-for="i in list" :key="i.id">
<div class="list__item--pre" v-if="$store.state.reception.select.leixing == 5"> <div
class="list__item--pre"
v-if="$store.state.reception.select.leixing == 5"
>
{{ i.wenjian }}{{ i.nianfen }}{{ i.bianhao }} {{ i.wenjian }}{{ i.nianfen }}{{ i.bianhao }}
</div> </div>
<div class="list__item--name">{{ i.biaoti }}</div> <div class="list__item--name">{{ i.biaoti }}</div>
@ -180,20 +183,25 @@ export default {
}; };
}, },
methods: { methods: {
typeSelect(i) { typeSelect({ value }) {
if (this.$store.state.reception.select.leixing == i.value) { let leixing = this.$store.state.reception.select.leixing
? this.$store.state.reception.select.leixing.split(",")
: [];
if (leixing.find((i) => i == value)) {
leixing.splice(leixing.indexOf(leixing.find((i) => i == value)), 1);
this.$store.commit("reception/SET_SELECTED", { this.$store.commit("reception/SET_SELECTED", {
key: "leixing", key: "leixing",
value: "", value: leixing.toString(),
}); });
} else { } else {
leixing.push(value);
this.$store.commit("reception/SET_SELECTED", { this.$store.commit("reception/SET_SELECTED", {
key: "leixing", key: "leixing",
value: i.value, value: leixing.toString(),
}); });
} }
this.getMaterial() this.getMaterial();
}, },
async getMaterial() { async getMaterial() {
@ -229,26 +237,36 @@ export default {
}, },
computed: { computed: {
isSelectedType() { isSelectedType() {
return function (i) { return function ({ value }) {
return i.value == this.$store.state.reception.select.leixing; let leixing = this.$store.state.reception.select.leixing
? this.$store.state.reception.select.leixing.split(",")
: [];
return leixing.find((i) => i == value);
}; };
}, },
type() { type() {
return ( return this.formType
this.formType.find( .filter((i) =>
(i) => i.value === this.$store.state.reception.select.leixing (this.$store.state.reception.select.leixing
)?.label || "全部文件" ? this.$store.state.reception.select.leixing.split(",")
); : []
).find((j) => j == i.value)
)
.map((i) => i.label)
.toString();
}, },
}, },
mounted() { mounted() {
this.getMaterial(); this.getMaterial();
}, },
created() {
window.getMaterial = this.getMaterial;
},
beforeRouteEnter(to, from, next) { beforeRouteEnter(to, from, next) {
next(vm => { next((vm) => {
vm.getMaterial() vm.getMaterial();
}) });
}, },
}; };
</script> </script>

Loading…
Cancel
Save