forked from dyf/dyf-vue-ui
设备增加蓝牙字段
This commit is contained in:
@ -4,5 +4,44 @@ export interface deviceQuery extends PageQuery {
|
||||
deviceImei: string;
|
||||
deviceType: string;
|
||||
deviceStatus: string;
|
||||
|
||||
bluetoothName?: string; // 蓝牙名称查询字段
|
||||
}
|
||||
|
||||
export interface deviceForm {
|
||||
id?: string | number;
|
||||
deviceName: string;
|
||||
deviceMac?: string;
|
||||
deviceImei?: string;
|
||||
deviceType: string;
|
||||
devicePic?: string;
|
||||
image?: string | File;
|
||||
remark?: string;
|
||||
password?: string;
|
||||
customerId?: string | number;
|
||||
bluetoothName?: string; // 蓝牙名称字段
|
||||
}
|
||||
|
||||
export interface deviceVO {
|
||||
id: string | number;
|
||||
deviceName: string;
|
||||
deviceMac?: string;
|
||||
deviceImei?: string;
|
||||
deviceType: string;
|
||||
devicePic?: string;
|
||||
deviceStatus: number;
|
||||
bindingStatus: number;
|
||||
remark?: string;
|
||||
createTime?: string;
|
||||
createByName?: string;
|
||||
customerName?: string;
|
||||
customerId?: string | number;
|
||||
typeName?: string;
|
||||
bluetoothName?: string; // 蓝牙名称字段
|
||||
}
|
||||
|
||||
export interface deviceTypeOption {
|
||||
id: string | number;
|
||||
typeName: string;
|
||||
value: string | number;
|
||||
communicationMode?: string;
|
||||
}
|
@ -165,6 +165,13 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="showMacField">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="蓝牙名称" prop="bluetoothName">
|
||||
<el-input v-model="form.bluetoothName" placeholder="请输入蓝牙名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="showImeiField">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="设备IMEI" prop="deviceImei">
|
||||
@ -268,7 +275,7 @@
|
||||
|
||||
<script setup name="User" lang="ts">
|
||||
import api from '@/api/equipmentManagement/device/index';
|
||||
import { deviceForm, deviceQuery, deviceVO } from '@/api/equipmentManagement/device/types';
|
||||
import { deviceForm, deviceQuery, deviceVO, deviceTypeOption } from '@/api/equipmentManagement/device/types';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const deviceDist = ref<deviceVO[]>();
|
||||
import { to } from 'await-to-js';
|
||||
@ -277,7 +284,7 @@ import { getBearerToken } from '@/utils/auth'
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
|
||||
const ids = ref<Array<number | string>>([]);
|
||||
const ids = ref<deviceVO[]>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
@ -309,7 +316,8 @@ const initFormData: deviceForm = {
|
||||
remark: '',
|
||||
id: '',
|
||||
deviceType: "",
|
||||
image: ''
|
||||
image: '',
|
||||
bluetoothName: '' // 蓝牙名称字段
|
||||
};
|
||||
|
||||
const initData: PageData<deviceForm, deviceQuery> = {
|
||||
@ -333,8 +341,8 @@ const initData: PageData<deviceForm, deviceQuery> = {
|
||||
],
|
||||
}
|
||||
};
|
||||
const data = reactive<PageData<deviceVO, deviceQuery>>(initData);
|
||||
const { queryParams, form, rules } = toRefs<PageData<deviceVO, deviceQuery>>(data);
|
||||
const data = reactive<PageData<deviceForm, deviceQuery>>(initData);
|
||||
const { queryParams, form, rules } = toRefs<PageData<deviceForm, deviceQuery>>(data);
|
||||
/** 查询设备列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
@ -593,6 +601,10 @@ const submitForm = async () => {
|
||||
if (form.value.deviceImei) {
|
||||
formData.append('deviceImei', form.value.deviceImei);
|
||||
}
|
||||
// 添加蓝牙名称字段(仅蓝牙设备)
|
||||
if (form.value.bluetoothName) {
|
||||
formData.append('bluetoothName', form.value.bluetoothName);
|
||||
}
|
||||
// 根据操作类型设置URL和方法
|
||||
const isAdd = !form.value.id; // 注意这里逻辑反了,应该是没有id时是新增
|
||||
const res = await request({
|
||||
|
Reference in New Issue
Block a user