|
|
|
@ -1,20 +1,5 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div class="list-container">
|
|
|
|
|
<ul class="product-status">
|
|
|
|
|
<li v-for="(item, index) in opts.status" :key="index">
|
|
|
|
|
<el-button
|
|
|
|
|
:type="state.condition.productStatus.includes(item.value) ? 'primary' : 'default'"
|
|
|
|
|
@click="handleStatus(item.value)"
|
|
|
|
|
>
|
|
|
|
|
<span>
|
|
|
|
|
{{ item.label }}
|
|
|
|
|
</span>
|
|
|
|
|
<span>(</span>
|
|
|
|
|
<span class="num">{{ summary[index] || 0 }}</span>
|
|
|
|
|
<span>)</span>
|
|
|
|
|
</el-button>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<TableList
|
|
|
|
|
v-loading="loading"
|
|
|
|
|
:code="code"
|
|
|
|
@ -54,7 +39,6 @@
|
|
|
|
|
const code = computed(() => store.state.product.code);
|
|
|
|
|
const list = computed(() => _.cloneDeep(store.state.product.list));
|
|
|
|
|
const total = computed(() => store.state.product.total);
|
|
|
|
|
const summary = computed(() => store.state.product.summary);
|
|
|
|
|
const opts = computed(() => store.state.product.opts);
|
|
|
|
|
if (!unref(opts).init) {
|
|
|
|
|
store.dispatch('product/load');
|
|
|
|
@ -65,7 +49,6 @@
|
|
|
|
|
condition: {
|
|
|
|
|
name: null,
|
|
|
|
|
categoryId: null,
|
|
|
|
|
productStatus: [],
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
watch(
|
|
|
|
@ -75,40 +58,12 @@
|
|
|
|
|
},
|
|
|
|
|
{ immediate: true, deep: true }
|
|
|
|
|
);
|
|
|
|
|
watch(
|
|
|
|
|
() => state.condition.productStatus,
|
|
|
|
|
() => {
|
|
|
|
|
handleSearch();
|
|
|
|
|
},
|
|
|
|
|
{ deep: true }
|
|
|
|
|
);
|
|
|
|
|
const handleReset = () => {
|
|
|
|
|
state.condition = {
|
|
|
|
|
name: null,
|
|
|
|
|
categoryId: null,
|
|
|
|
|
productStatus: [],
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
const handleStatus = (status) => {
|
|
|
|
|
let index = state.condition.productStatus.indexOf(status);
|
|
|
|
|
if (index === -1) {
|
|
|
|
|
if (status === 0) {
|
|
|
|
|
state.condition.productStatus = [0];
|
|
|
|
|
} else {
|
|
|
|
|
state.condition.productStatus.push(status);
|
|
|
|
|
state.condition.productStatus = state.condition.productStatus.filter((item) => item > 0);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (status !== 0) {
|
|
|
|
|
state.condition.productStatus.splice(index, 1);
|
|
|
|
|
if (state.condition.productStatus.length) {
|
|
|
|
|
state.condition.productStatus = state.condition.productStatus.filter((item) => item > 0);
|
|
|
|
|
} else {
|
|
|
|
|
state.condition.productStatus = [0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const handleSearch = async () => {
|
|
|
|
|
loading.value = true;
|
|
|
|
|
await store.dispatch('product/search');
|
|
|
|
@ -242,14 +197,5 @@
|
|
|
|
|
.common-list {
|
|
|
|
|
flex-shrink: 1;
|
|
|
|
|
}
|
|
|
|
|
.product-status {
|
|
|
|
|
display: flex;
|
|
|
|
|
margin-bottom: @layout-space;
|
|
|
|
|
li {
|
|
|
|
|
+ li {
|
|
|
|
|
margin-left: @layout-space;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|