更新
This commit is contained in:
parent
27127509d7
commit
c2dc69cf77
|
@ -42,3 +42,11 @@ export function delHardwareVersion(id) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询全部硬件版本列表
|
||||
export function listAllHardwareVersion() {
|
||||
return request({
|
||||
url: '/bst/hardwareVersion/all',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
<template>
|
||||
<el-cascader
|
||||
v-model="selectValue"
|
||||
:placeholder="placeholder"
|
||||
filterable
|
||||
@change="handleChange"
|
||||
style="width: 100%;"
|
||||
:options="options"
|
||||
:show-all-levels="false"
|
||||
:props="{
|
||||
emitPath: false,
|
||||
multiple: multiple,
|
||||
expandTrigger: 'hover',
|
||||
value: 'id',
|
||||
label: 'version',
|
||||
checkStrictly: checkStrictly
|
||||
}"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listAllHardwareVersion } from "@/api/bst/hardwareVersion";
|
||||
|
||||
export default {
|
||||
name: "HardwareVersionSelect",
|
||||
props: {
|
||||
value: {
|
||||
type: [String, Array],
|
||||
default: null
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "请选择硬件版本"
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
multiple: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 是否严格的遵守父子节点不互相关联
|
||||
checkStrictly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
data: [],
|
||||
options: [],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
selectValue: {
|
||||
get() {
|
||||
return this.value;
|
||||
},
|
||||
set(val) {
|
||||
this.$emit("input", val);
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getOptions();
|
||||
},
|
||||
methods: {
|
||||
getOptions() {
|
||||
listAllHardwareVersion().then(response => {
|
||||
this.data = response.data;
|
||||
this.options = this.handleTree(response.data, "id", "parentId", "children");
|
||||
});
|
||||
},
|
||||
handleChange(value) {
|
||||
if (!this.multiple) {
|
||||
let find = this.data.find(item => item.id == value);
|
||||
this.$emit("change", find);
|
||||
} else {
|
||||
let filtered = this.data.filter(item => value.includes(item.id));
|
||||
this.$emit("change", filtered);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -9,12 +9,24 @@
|
|||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="80px" v-loading="loading">
|
||||
<el-row>
|
||||
<form-col :span="span" label="MAC" prop="mac">
|
||||
<el-input v-model="form.mac" placeholder="请输入设备Mac号" :disabled="form.id != null"/>
|
||||
</form-col>
|
||||
<form-col :span="span" label="SN" prop="sn">
|
||||
<el-input v-model="form.sn" placeholder="请输入设备SN号" :disabled="form.id != null" />
|
||||
</form-col>
|
||||
<template v-if="isSysAdmin()">
|
||||
<form-col :span="span" label="MAC" prop="mac">
|
||||
<el-input v-model="form.mac" placeholder="请输入设备Mac号" :disabled="form.id != null"/>
|
||||
</form-col>
|
||||
<form-col :span="span" label="SN" prop="sn">
|
||||
<el-input v-model="form.sn" placeholder="请输入设备SN号" :disabled="form.id != null" />
|
||||
</form-col>
|
||||
<form-col :span="span" label="硬件版本" prop="hardwareVersionId">
|
||||
<hardware-version-select
|
||||
v-model="form.hardwareVersionId"
|
||||
@change="onChangeHardwareVersion"
|
||||
style="width: 100%;"
|
||||
/>
|
||||
<el-alert v-if="form.hardwareVersionInstructions" type="info" style="line-height: 1.3em;" :closable="false">
|
||||
{{form.hardwareVersionInstructions | dv}}
|
||||
</el-alert>
|
||||
</form-col>
|
||||
</template>
|
||||
<form-col :span="span" label="所属用户" prop="mchId" v-if="checkPermi(['system:user:list'])">
|
||||
<user-input v-model="form.mchId" :text.sync="form.mchName" @change="onChangeMch"/>
|
||||
</form-col>
|
||||
|
@ -48,10 +60,18 @@ import AreaRemoteSelect from '@/components/Business/Area/AreaRemoteSelect.vue';
|
|||
import {RoleKeys} from '@/utils/enums';
|
||||
import { mapGetters } from 'vuex';
|
||||
import ModelRemoteSelect from '@/components/Business/Model/ModelRemoteSelect.vue';
|
||||
import HardwareVersionSelect from '@/components/Business/HardwareVersion/HardwareVersionSelect.vue';
|
||||
|
||||
|
||||
export default {
|
||||
name: 'DeviceEditDialog',
|
||||
components: { FormCol, UserInput, AreaRemoteSelect, ModelRemoteSelect },
|
||||
components: {
|
||||
FormCol,
|
||||
UserInput,
|
||||
AreaRemoteSelect,
|
||||
ModelRemoteSelect,
|
||||
HardwareVersionSelect,
|
||||
},
|
||||
dicts: ['device_status', 'device_lock_status', 'device_iot_status', 'device_online_status'],
|
||||
props: {
|
||||
visible: {
|
||||
|
@ -108,6 +128,9 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
onChangeHardwareVersion(version) {
|
||||
this.form.hardwareVersionInstructions = version?.instructions;
|
||||
},
|
||||
onChangeMch(mch) {
|
||||
if (this.form.modelId != null) {
|
||||
this.form.modelId = null;
|
||||
|
|
|
@ -424,6 +424,7 @@ export default {
|
|||
{key: 'sn', visible: true, label: '设备', minWidth: null, sortable: true, overflow: false, align: 'left', width: "220"},
|
||||
{key: 'vehicleNum', visible: true, label: '车辆', minWidth: null, sortable: true, overflow: false, align: 'left', width: null},
|
||||
{key: 'mchName', visible: true, label: '归属', minWidth: null, sortable: true, overflow: false, align: 'left', width: null},
|
||||
{key: 'hardwareVersion', visible: true, label: '版本', minWidth: null, sortable: true, overflow: false, align: 'left', width: null},
|
||||
{key: 'signalStrength', visible: true, label: '信号', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'satellites', visible: true, label: '卫星', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
{key: 'lockStatus', visible: true, label: '锁状态', minWidth: null, sortable: true, overflow: false, align: 'center', width: null},
|
||||
|
|
Loading…
Reference in New Issue
Block a user