master
xy 2 years ago
parent 0dc9a56031
commit 27127f0ef5

@ -93,12 +93,21 @@ export default {
}
},
methods: {
typeSelect (i) {
if (this.$store.state.reception.select.leixing == i.value) {
this.$store.commit('reception/SET_SELECTED',{ key: 'leixing',value: '' })
typeSelect ({ 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',{ key: 'leixing',value: leixing.toString() })
} 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')
return
}
if (this.$route.fullPath === '/index/list1') {
window.getMaterial()
}
},
@ -120,8 +129,9 @@ export default {
},
computed: {
isSelectedType () {
return function (i) {
return i.value == this.$store.state.reception.select.leixing
return function ({ value }) {
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 }) => {
if (refresh) {
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] = ''
}
}

@ -291,13 +291,12 @@ export default {
console.log(this.labelGroup);
},
toList ({ tag, dept, leixing, sort_name }) {
console.log(111, sort_name, leixing)
toList ({ tag, dept, sort_name }) {
console.log(111, sort_name)
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 }) : ''
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 }) : ''
this.$router.push(`/index/list1?${this.$store.getters.select}`)
this.$router.push('/index/list1')
}
},
computed: {

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

Loading…
Cancel
Save