2024-02-29 08:59:44 +08:00
|
|
|
<template>
|
|
|
|
<page-meta :page-style="'overflow:'+(visible?'hidden':'visible')"></page-meta>
|
|
|
|
<uni-popup ref="popup" type="center" :mask-click="false">
|
|
|
|
<scroll-view scroll-y style="width: 100vw;height: 100vh;">
|
|
|
|
<view :style="{padding: this.CustomBar + 15 + 'px 15px 15px 15px'}">
|
|
|
|
<checkbox-group @change="change">
|
|
|
|
<view v-for="(item,index) in withSelectMeasuresList" :key="index" style="display: flex;margin-top: 15upx">
|
2024-02-29 11:22:06 +08:00
|
|
|
<checkbox :value="item[rowKey]" :checked="item.check"/>
|
2024-02-29 08:59:44 +08:00
|
|
|
<view style="padding-left: 10upx;">{{ item.PROTECTIVE_MEASURES }}</view>
|
|
|
|
</view>
|
|
|
|
</checkbox-group>
|
|
|
|
</view>
|
|
|
|
<view class="cu-bar btn-group" style="margin-top: 50upx;">
|
|
|
|
<button class="cu-btn bg-blue margin-tb-sm lg" @click="determine">确定</button>
|
|
|
|
<button class="cu-btn bg-grey margin-tb-sm lg" @click="close">关闭</button>
|
|
|
|
</view>
|
|
|
|
</scroll-view>
|
|
|
|
</uni-popup>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import uniPopup from '@/components/more-select/uni-popup/uni-popup.vue';
|
|
|
|
import {basePath, loginUser} from "@/common/tool";
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
uniPopup,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
visible: {
|
|
|
|
type: Boolean,
|
|
|
|
required: true,
|
|
|
|
default: false
|
|
|
|
},
|
|
|
|
measuresList: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
default: () => []
|
|
|
|
},
|
|
|
|
value: {
|
|
|
|
type: Array,
|
|
|
|
required: true,
|
|
|
|
default: () => []
|
|
|
|
},
|
|
|
|
index: {
|
|
|
|
type: Number,
|
|
|
|
required: true,
|
|
|
|
default: 0
|
2024-02-29 11:22:06 +08:00
|
|
|
},
|
|
|
|
rowKey: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
default: ''
|
2024-02-29 08:59:44 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
selectValue: [],
|
|
|
|
withSelectMeasuresList: [],
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
visible: {
|
|
|
|
handler(newValue) {
|
|
|
|
if (newValue) {
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.popup.open()
|
|
|
|
})
|
|
|
|
this.getWithSelectMeasuresList()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
immediate: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
getSelectedMeasuresList() {
|
|
|
|
const index = this.index
|
|
|
|
const value = this.value
|
|
|
|
const allSelectedMeasuresList = []
|
|
|
|
const currentIndexSelectedMeasuresList = []
|
|
|
|
for (let i = 0; i < value.length; i++) {
|
|
|
|
for (let j = 0; j < value[i].selectMeasures.length; j++) {
|
|
|
|
allSelectedMeasuresList.push(value[i].selectMeasures[j])
|
|
|
|
if (i === index) {
|
|
|
|
currentIndexSelectedMeasuresList.push({...value[i].selectMeasures[j], check: true})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {allSelectedMeasuresList, currentIndexSelectedMeasuresList}
|
|
|
|
},
|
|
|
|
getWithSelectMeasuresList() {
|
|
|
|
const {allSelectedMeasuresList, currentIndexSelectedMeasuresList} = this.getSelectedMeasuresList()
|
|
|
|
const withSelectMeasuresList = [...this.measuresList]
|
|
|
|
if (allSelectedMeasuresList.length > 0) {
|
|
|
|
for (let i = 0; i < allSelectedMeasuresList.length; i++) {
|
|
|
|
for (let j = 0; j < withSelectMeasuresList.length; j++) {
|
2024-02-29 11:22:06 +08:00
|
|
|
if (allSelectedMeasuresList[i][this.rowKey] === withSelectMeasuresList[j][this.rowKey]) {
|
2024-02-29 08:59:44 +08:00
|
|
|
withSelectMeasuresList.splice(j, 1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
withSelectMeasuresList.push(...currentIndexSelectedMeasuresList)
|
|
|
|
this.withSelectMeasuresList = withSelectMeasuresList
|
|
|
|
},
|
|
|
|
change(event) {
|
|
|
|
this.selectValue = event.detail.value
|
|
|
|
},
|
|
|
|
close() {
|
|
|
|
this.selectValue = []
|
|
|
|
this.withSelectMeasuresList = []
|
|
|
|
this.$emit('update:visible', false)
|
|
|
|
this.$refs.popup.close()
|
|
|
|
},
|
|
|
|
determine() {
|
|
|
|
const value = []
|
|
|
|
const selectValue = this.selectValue
|
|
|
|
const withSelectMeasuresList = this.withSelectMeasuresList
|
|
|
|
for (let i = 0; i < selectValue.length; i++) {
|
|
|
|
for (let j = 0; j < withSelectMeasuresList.length; j++) {
|
2024-02-29 11:22:06 +08:00
|
|
|
if (selectValue[i] === withSelectMeasuresList[j][this.rowKey]) {
|
2024-02-29 08:59:44 +08:00
|
|
|
value.push(withSelectMeasuresList[j])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.value[this.index].selectMeasures = value
|
|
|
|
this.$emit('input', [...this.value])
|
|
|
|
this.close()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
|
|
</style>
|