122 lines
2.7 KiB
Vue
122 lines
2.7 KiB
Vue
<template>
|
|
<view class="page_container addreplacement_box">
|
|
<uni-forms border :modelValue="formData" label-position="left">
|
|
<uni-forms-item label="仪表类型">
|
|
<uni-data-checkbox v-model="formData.type" :localdata="items"></uni-data-checkbox>
|
|
</uni-forms-item>
|
|
<uni-forms-item label="设备编号">
|
|
<view class="flex items-center justify-between">
|
|
<uni-easyinput
|
|
class="flex-1"
|
|
:input-border="false"
|
|
v-model="formData.deviceCode"
|
|
placeholder="请输入设备号"
|
|
:clearable="true"
|
|
>
|
|
</uni-easyinput>
|
|
<uni-icons @tap="handleScan" size="48rpx" type="scan" color="#737373"></uni-icons>
|
|
</view>
|
|
</uni-forms-item>
|
|
<uni-forms-item label="房屋号">
|
|
<uni-easyinput
|
|
:inputBorder="false"
|
|
@tap="handleClick"
|
|
disabled
|
|
v-model="houseName"
|
|
placeholderStyle="color: #999999"
|
|
placeholder="请选择安装房屋"
|
|
>
|
|
<template #right>
|
|
<uni-icons type="forward" color="#737373"></uni-icons>
|
|
</template>
|
|
</uni-easyinput>
|
|
</uni-forms-item>
|
|
</uni-forms>
|
|
|
|
<view class="action_btn" @tap="handleSubmit">
|
|
<text>提 交</text>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { ref } from 'vue'
|
|
import { onLoad } from '@dcloudio/uni-app'
|
|
const formData = ref({
|
|
type: 1,
|
|
deviceCode: '',
|
|
houseId: ''
|
|
})
|
|
const items = [
|
|
{
|
|
text: '水表',
|
|
value: 1
|
|
},
|
|
{
|
|
text: '电表',
|
|
value: 2
|
|
}
|
|
]
|
|
|
|
const houseName = ref('')
|
|
/** 处理 安装房屋 */
|
|
function handleClick() {
|
|
uni.navigateTo({
|
|
url: '/pageSubPack/instrument/checkouthouse',
|
|
events: {
|
|
backData: data => {
|
|
houseName.value = data.HouseName
|
|
formData.value.houseId = data.Houseid
|
|
}
|
|
}
|
|
})
|
|
}
|
|
/** 处理 扫码 */
|
|
function handleScan() {
|
|
// 允许从相机和相册扫码
|
|
uni.scanCode({
|
|
success: function (res) {
|
|
formData.value.deviceCode = res.result
|
|
}
|
|
})
|
|
}
|
|
|
|
function handleSubmit() {
|
|
console.log(formData.value)
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.addreplacement_box {
|
|
background: #ffffff;
|
|
|
|
&:deep(.uni-forms-item) {
|
|
display: flex;
|
|
align-items: center;
|
|
height: 90rpx;
|
|
line-height: 90rpx;
|
|
padding: 0;
|
|
border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
|
|
}
|
|
&:deep(.uni-easyinput__content) {
|
|
background: none !important;
|
|
}
|
|
|
|
.action_btn {
|
|
width: 670rpx;
|
|
height: 80rpx;
|
|
background: #4d5dfa;
|
|
border-radius: 8rpx;
|
|
|
|
text-align: center;
|
|
|
|
margin-top: 300rpx;
|
|
|
|
font-weight: 400;
|
|
font-size: 28rpx;
|
|
color: #ffffff;
|
|
line-height: 80rpx;
|
|
}
|
|
}
|
|
</style>
|