feat:设备使用记录
This commit is contained in:
73
components/checkbox-switch/checkbox-switch.vue
Normal file
73
components/checkbox-switch/checkbox-switch.vue
Normal file
@@ -0,0 +1,73 @@
|
||||
<!-- components/checkbox-switch.vue -->
|
||||
<template>
|
||||
<view class="custom-checkbox" @click="toggle" :class="{ 'custom-checkbox--checked': modelValue }">
|
||||
<!-- 这里可以用一个图标,或者用CSS绘制一个方框 -->
|
||||
<view class="custom-checkbox__icon">
|
||||
<!-- 示例:使用一个简单的对勾符号 -->
|
||||
<up-icon v-if="modelValue" name="checkbox-mark" color="#FFF" size="15"></up-icon>
|
||||
</view>
|
||||
<text class="custom-checkbox__label" v-if="$slots.default">
|
||||
<slot></slot>
|
||||
</text>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
// 1. 定义并接收 props,将其解构赋值
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
})
|
||||
|
||||
// 定义 emits
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
// 2. 在函数中使用 props.modelValue
|
||||
const toggle = () => {
|
||||
emit('update:modelValue', !props.modelValue)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.custom-checkbox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
padding: 8rpx;
|
||||
|
||||
&__icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 2rpx solid #c8c9cc;
|
||||
border-radius: 6rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-right: 10rpx;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
&__icon-text {
|
||||
font-size: 24rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
&__label {
|
||||
font-size: 28rpx;
|
||||
color: #606266;
|
||||
}
|
||||
|
||||
// 选中状态的样式
|
||||
&--checked &__icon {
|
||||
background-color: #2979ff;
|
||||
border-color: #2979ff;
|
||||
}
|
||||
|
||||
&--checked &__label {
|
||||
color: #2979ff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -49,7 +49,8 @@
|
||||
class="da-tree-item__label"
|
||||
:class="'da-tree-item__label--' + item.checkedStatus"
|
||||
@click="handleLabelClick(item)"
|
||||
><text>{{ item.label }} </text><text class="da-tree-item__label--append" v-if="item.append">{{ item.append }}</text></view
|
||||
><text>{{ item.label }} </text
|
||||
><text class="da-tree-item__label--append" v-if="item.append">{{ item.append }}</text></view
|
||||
>
|
||||
</view>
|
||||
</scroll-view>
|
||||
@@ -1154,8 +1155,8 @@ export default defineComponent({
|
||||
flex: 1;
|
||||
margin-left: 2px;
|
||||
color: #555;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&--2 {
|
||||
color: var(--theme-color, #007aff);
|
||||
|
||||
@@ -86,8 +86,7 @@ const getPageData = () => {
|
||||
pageNo: 1,
|
||||
pageSize: 999,
|
||||
collectDeviceType: 'balance',
|
||||
deviceStatus: '0',
|
||||
isEnable: '1',
|
||||
deviceStatus: "{\"Enable\":\"1\"}",
|
||||
deployLocation: deployLocation.value === '全部' ? '' : deployLocation.value
|
||||
})
|
||||
.then(res => {
|
||||
|
||||
@@ -125,13 +125,13 @@ const changeNums = (item, index) => {
|
||||
}
|
||||
|
||||
// 检查小数位数限制
|
||||
let decimal = props.numKeyboardParam?.decimal ?? -1
|
||||
const parts = nums.value.split('.')
|
||||
if (parts.length === 2 && decimal !== -1) {
|
||||
if (parts[1].length >= decimal) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
// let decimal = props.numKeyboardParam?.decimal ?? -1
|
||||
// const parts = nums.value.split('.')
|
||||
// if (parts.length === 2 && decimal !== -1) {
|
||||
// if (parts[1].length >= decimal) {
|
||||
// return false
|
||||
// }
|
||||
// }
|
||||
|
||||
nums.value += inputChar
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user