添加设备表单的设备型号改为下拉框,并且添加通道

master
赵太阳 2026-04-08 23:03:43 +08:00
parent 1b0f71b9db
commit 69b227ec7f
2 changed files with 28 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{ {
"name" : "海驰24", "name" : "海驰24",
"appid" : "__UNI__C30329B", "appid" : "__UNI__F8B45C3",
"description" : "111", "description" : "111",
"versionName" : "1.2.6", "versionName" : "1.2.6",
"versionCode" : 106, "versionCode" : 106,

View File

@ -17,7 +17,7 @@
</view> </view>
<view class="info-row"> <view class="info-row">
<text class="label">设备型号</text> <text class="label">设备型号</text>
<text class="value">{{ item.deviceModel || '-' }}</text> <text class="value">{{ getDeviceModelLabel(item.deviceModel) || '-' }}</text>
</view> </view>
</view> </view>
</view> </view>
@ -62,7 +62,14 @@
<view class="form-item"> <view class="form-item">
<text class="form-label">设备型号</text> <text class="form-label">设备型号</text>
<input class="form-input" v-model="form.deviceModel" placeholder="请输入设备型号" /> <picker class="form-picker" @change="onModelChange" :value="modelIndex" :range="deviceModels" range-key="label">
<view class="picker-value">{{ modelIndex !== -1 ? deviceModels[modelIndex].label : '请选择设备型号' }}</view>
</picker>
</view>
<view class="form-item">
<text class="form-label">通道</text>
<input class="form-input" v-model="form.channel" placeholder="请输入通道" />
</view> </view>
<view class="form-item"> <view class="form-item">
@ -101,12 +108,19 @@ export default {
], ],
typeIndex: -1, typeIndex: -1,
deviceModels: [
{ label: '单机(IPC)', value: '1' },
{ label: '主机(NVR)', value: '2' }
],
modelIndex: -1,
form: { form: {
deviceCode: '', deviceCode: '',
deviceName: '', deviceName: '',
deviceType: '', deviceType: '',
deviceBrand: '', deviceBrand: '',
deviceModel: '', deviceModel: '',
channel: '',
remark: '' remark: ''
} }
} }
@ -129,6 +143,11 @@ export default {
goBack() { goBack() {
uni.navigateBack(); uni.navigateBack();
}, },
getDeviceModelLabel(modelValue) {
if (!modelValue && modelValue !== 0) return '';
const match = this.deviceModels.find(m => m.value == modelValue);
return match ? match.label : modelValue;
},
fetchDeviceList() { fetchDeviceList() {
this.loading = true; this.loading = true;
getDeviceList(this.storeId).then(res => { getDeviceList(this.storeId).then(res => {
@ -158,9 +177,11 @@ export default {
deviceType: '', deviceType: '',
deviceBrand: '', deviceBrand: '',
deviceModel: '', deviceModel: '',
channel: '',
remark: '' remark: ''
}; };
this.typeIndex = -1; this.typeIndex = -1;
this.modelIndex = -1;
this.$refs.addPopup.open(); this.$refs.addPopup.open();
}, },
closeAddDialog() { closeAddDialog() {
@ -170,6 +191,10 @@ export default {
this.typeIndex = e.detail.value; this.typeIndex = e.detail.value;
this.form.deviceType = this.deviceTypes[this.typeIndex].value; this.form.deviceType = this.deviceTypes[this.typeIndex].value;
}, },
onModelChange(e) {
this.modelIndex = e.detail.value;
this.form.deviceModel = this.deviceModels[this.modelIndex].value;
},
submitAdd() { submitAdd() {
if (!this.form.deviceCode) { if (!this.form.deviceCode) {
return uni.showToast({ title: '请输入设备编号', icon: 'none' }); return uni.showToast({ title: '请输入设备编号', icon: 'none' });