添加设备表单的设备型号改为下拉框,并且添加通道
parent
1b0f71b9db
commit
69b227ec7f
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name" : "海驰24",
|
||||
"appid" : "__UNI__C30329B",
|
||||
"appid" : "__UNI__F8B45C3",
|
||||
"description" : "111",
|
||||
"versionName" : "1.2.6",
|
||||
"versionCode" : 106,
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
</view>
|
||||
<view class="info-row">
|
||||
<text class="label">设备型号:</text>
|
||||
<text class="value">{{ item.deviceModel || '-' }}</text>
|
||||
<text class="value">{{ getDeviceModelLabel(item.deviceModel) || '-' }}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
|
@ -62,7 +62,14 @@
|
|||
|
||||
<view class="form-item">
|
||||
<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 class="form-item">
|
||||
|
|
@ -101,12 +108,19 @@ export default {
|
|||
],
|
||||
typeIndex: -1,
|
||||
|
||||
deviceModels: [
|
||||
{ label: '单机(IPC)', value: '1' },
|
||||
{ label: '主机(NVR)', value: '2' }
|
||||
],
|
||||
modelIndex: -1,
|
||||
|
||||
form: {
|
||||
deviceCode: '',
|
||||
deviceName: '',
|
||||
deviceType: '',
|
||||
deviceBrand: '',
|
||||
deviceModel: '',
|
||||
channel: '',
|
||||
remark: ''
|
||||
}
|
||||
}
|
||||
|
|
@ -129,6 +143,11 @@ export default {
|
|||
goBack() {
|
||||
uni.navigateBack();
|
||||
},
|
||||
getDeviceModelLabel(modelValue) {
|
||||
if (!modelValue && modelValue !== 0) return '';
|
||||
const match = this.deviceModels.find(m => m.value == modelValue);
|
||||
return match ? match.label : modelValue;
|
||||
},
|
||||
fetchDeviceList() {
|
||||
this.loading = true;
|
||||
getDeviceList(this.storeId).then(res => {
|
||||
|
|
@ -158,9 +177,11 @@ export default {
|
|||
deviceType: '',
|
||||
deviceBrand: '',
|
||||
deviceModel: '',
|
||||
channel: '',
|
||||
remark: ''
|
||||
};
|
||||
this.typeIndex = -1;
|
||||
this.modelIndex = -1;
|
||||
this.$refs.addPopup.open();
|
||||
},
|
||||
closeAddDialog() {
|
||||
|
|
@ -170,6 +191,10 @@ export default {
|
|||
this.typeIndex = e.detail.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() {
|
||||
if (!this.form.deviceCode) {
|
||||
return uni.showToast({ title: '请输入设备编号', icon: 'none' });
|
||||
|
|
|
|||
Loading…
Reference in New Issue