|
|
@@ -62,7 +62,7 @@
|
|
|
v-for="(pro, proIndex) in item.collectionInfos"
|
|
|
:key="proIndex"
|
|
|
:class="{ active: chooseIds.includes(pro.id) }"
|
|
|
- @click="choose(pro.id, pro)"
|
|
|
+ @click="choose(pro.id, item)"
|
|
|
>
|
|
|
<img
|
|
|
class="icon"
|
|
|
@@ -179,6 +179,21 @@ export default {
|
|
|
this.collections = list
|
|
|
.map(item => {
|
|
|
if (item.collectionInfos && item.collectionInfos.length > 1) {
|
|
|
+ if (!this.info.audit) {
|
|
|
+ let tags = [...this.rule.keys()];
|
|
|
+ let need = 0;
|
|
|
+ tags.forEach(tag => {
|
|
|
+ if (item.name.indexOf(tag) !== -1) {
|
|
|
+ need = this.rule.get(tag);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ num: 0,
|
|
|
+ showMore: false,
|
|
|
+ need
|
|
|
+ };
|
|
|
+ }
|
|
|
return {
|
|
|
...item,
|
|
|
num: 0,
|
|
|
@@ -199,6 +214,21 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
+ rule() {
|
|
|
+ let rule = { ...this.info.rule };
|
|
|
+ let tags = new Map();
|
|
|
+ if (!this.info.audit) {
|
|
|
+ rule.and.forEach(item => {
|
|
|
+ let num = 0;
|
|
|
+ if (tags.has(item.detail.tag.name)) {
|
|
|
+ num = tags.get(item.detail.tag.name);
|
|
|
+ }
|
|
|
+ num += item.detail.num;
|
|
|
+ tags.set(item.detail.tag.name, num);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return tags;
|
|
|
+ },
|
|
|
canNext() {
|
|
|
return this.needChoose === 0 || this.chooseIds.length === this.needChoose;
|
|
|
},
|
|
|
@@ -367,7 +397,9 @@ export default {
|
|
|
chooseIds.splice(index, 1);
|
|
|
}
|
|
|
} else if (this.needNum > 0 || this.needChoose === 0) {
|
|
|
- if (info.collections) {
|
|
|
+ if (info.need && this.getChooseNum(info.collectionInfos) >= info.need) {
|
|
|
+ this.$toast(`该藏品只能选择${info.need}个`);
|
|
|
+ } else if (info.collections) {
|
|
|
info.num = this.needNum;
|
|
|
chooseIds = [...chooseIds, ...info.collections.slice(0, info.num)];
|
|
|
} else {
|