|
|
@@ -47,9 +47,9 @@
|
|
|
:class="{
|
|
|
first: index === 0 || index === 1,
|
|
|
last: index === group.items.length - 1 || index === group.items.length - 2,
|
|
|
- selected: isSelected(item),
|
|
|
+ selected: isSelected(item, group.type),
|
|
|
}"
|
|
|
- @click="handleSelect(item)"
|
|
|
+ @click="handleSelect(item, group.type)"
|
|
|
>
|
|
|
<text class="project-name">{{ item.name }}</text>
|
|
|
</view>
|
|
|
@@ -143,8 +143,10 @@ const groupedData = computed(() => {
|
|
|
return result
|
|
|
})
|
|
|
|
|
|
-const isSelected = (item: ReportTemplate): boolean => {
|
|
|
- return localSelectedTemplates.value.some((template) => template.templateId === item.templateId)
|
|
|
+const isSelected = (item: ReportTemplate, groupType: string): boolean => {
|
|
|
+ return localSelectedTemplates.value.some(
|
|
|
+ (template) => template.templateId === item.templateId && template.feeCalcType === groupType,
|
|
|
+ )
|
|
|
}
|
|
|
|
|
|
const selectedItems = computed(() => {
|
|
|
@@ -192,22 +194,23 @@ const checkExistingTemplates = (templates: ReportTemplate[]) => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const handleSelect = (item: ReportTemplate) => {
|
|
|
+const handleSelect = (item: ReportTemplate, groupType: string) => {
|
|
|
if (hadTemplateId.value === item.templateId && item.reportType === 100) {
|
|
|
uni.showToast({ title: '该主报告已存在', icon: 'none' })
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ const selectedItem = { ...item, feeCalcType: groupType }
|
|
|
const index = localSelectedTemplates.value.findIndex(
|
|
|
- (template) => template.templateId === item.templateId,
|
|
|
+ (template) => template.templateId === item.templateId && template.feeCalcType === groupType,
|
|
|
)
|
|
|
if (index > -1) {
|
|
|
localSelectedTemplates.value.splice(index, 1)
|
|
|
} else {
|
|
|
- localSelectedTemplates.value.push(item)
|
|
|
+ localSelectedTemplates.value.push(selectedItem)
|
|
|
}
|
|
|
|
|
|
- emit('setIds', item, 'CheckProject')
|
|
|
+ emit('setIds', selectedItem, 'CheckProject')
|
|
|
emit('change', selectedItems.value)
|
|
|
}
|
|
|
|
|
|
@@ -236,6 +239,7 @@ const handleConfirm = async () => {
|
|
|
const itemList = selected.map((item) => ({
|
|
|
connectId: item.connectId,
|
|
|
fee: item.fee,
|
|
|
+ feeCalcType: item.feeCalcType,
|
|
|
orderItemId: props.equipData?.taskOrderItem?.id,
|
|
|
templateId: item.templateId,
|
|
|
type: props.equipData?.taskOrderItem?.boilerType,
|