张同海 6 months ago
commit 3e399acc6d

@ -12,11 +12,14 @@
:row="row"
></ActionBar>
</div>
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
<div>
<input class="ds-tb-check" type="checkbox" v-model="allCheck" :indeterminate="someCheck">
<hot-table ref="hotTb" :data="list" :settings="settings"></hot-table>
</div>
</div>
</template>
<script lang="ts" setup>
import { defineProps, ref, watch, computed, unref, defineComponent, onMounted, reactive, nextTick } from 'vue'
import { defineProps, ref, watch, watchEffect, computed, unref, defineComponent, onMounted, reactive, nextTick } from 'vue'
//
import { GetFeeCurrencySelectList, GetFeeCodeSelectList } from '/@/api/common'
import { HotTable } from '@handsontable/vue3';
@ -53,6 +56,10 @@
feeEnName: ''
}
const list = ref([])
//
const allCheck = ref(false)
//
const someCheck = ref(false)
//
const columns = [
{
@ -62,6 +69,10 @@
width: 32,
className: "htCenter",
readOnly: false
}, {
title: '序号',
width: 130,
readOnly: true
}, {
title: '业务编号',
width: 130,
@ -324,6 +335,45 @@
}
})
})
watchEffect(() => {
//
if (allCheck.value) {
list.value.forEach(item => {
item.selected = true
})
} else {
//
list.value.forEach(item => {
item.selected = false
})
}
})
watch(
list.value, (val) => {
let a = 0
let b = 0
val.forEach(item => {
if (item.selected) {
a += 1
} else {
b += 1
}
})
if (a == 0) {
allCheck.value = false
}
if (b == 0) {
allCheck.value = true
}
if (a != 0 && b != 0) {
someCheck.value = true
} else {
someCheck.value = false
}
}, {
deep: true
}
)
</script>
<style lang='scss'>
@ -334,25 +384,6 @@
background-color: #ffffff;
padding: 0;
margin-top: 10px;
.htCore {
thead {
tr {
height: 36px;
background: #fafafa;
th {
line-height: 34px;
background: #fafafa;
}
}
}
tbody {
tr {
td {
line-height: 30px;
}
}
}
}
}
.handsontableInput {
line-height: 30px;

@ -46,4 +46,31 @@ h5 {
color: #79868c;
}
}
}
// handsontable checkbox
.ds-tb-check {
position: absolute;
z-index: 199;
left: 15px;
margin-top: 14px;
}
.htCore {
thead {
tr {
height: 36px;
background: #fafafa;
th {
line-height: 34px;
background: #fafafa;
}
}
}
tbody {
tr {
td {
line-height: 30px;
}
}
}
}
Loading…
Cancel
Save