边带管理

This commit is contained in:
cool 2024-03-27 17:14:18 +08:00
parent efc4321811
commit 76341e0716
2 changed files with 65 additions and 3 deletions

View File

@ -0,0 +1,62 @@
<template>
<el-select v-model="currentOption" placeholder="请选择" style="width: 100%" @change="handleChange">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
<script>
import { getDictSelectList } from '@/api/public'
export default {
name: 'SidebandTypeSelect',
props: ['bindValue', 'disabled', 'change'],
data() {
return {
options: []
}
},
computed: {
currentOption: {
get() {
return this.bindValue
},
set(val) {
this.$emit('update:bindValue', val)
}
}
},
mounted() {
this.getList()
},
methods: {
getList() {
getDictSelectList(600).then(res => {
this.options = res.data.map(item => {
const { id, name } = item
return {
value: id,
label: name
}
})
this.$nextTick(() => {
if (this.options?.length && this.currentOption && this.options.find(item => item.value === this.currentOption)) {
this.handleChange(this.currentOption)
}
})
})
},
handleChange(value) {
const target = this.options.find(item => item.value === value)
this.$emit('change', target)
}
}
}
</script>
<style scoped lang="less"></style>

View File

@ -81,7 +81,7 @@
<el-input v-model="temp.bdIp" placeholder="边带IP" :maxlength="50" />
</el-form-item>
<el-form-item label="边带类型:" prop="bdType">
<SidebandSelect :bind-value.sync="temp.bdType" />
<SidebandTypeSelect :bind-value.sync="temp.bdType" />
</el-form-item>
<el-form-item label="设备类型:" prop="typeCode">
<DeviceSelect :bind-value.sync="temp.typeCode" />
@ -110,7 +110,7 @@
import Pagination from '@/components/Pagination/index.vue'
import SidebandChildTable from '@/views/device/sideband/components/SidebandChildTable.vue'
import ProjectSelect from '@/views/device/sideband/components/ProjectSelect.vue'
import SidebandSelect from '@/views/device/sideband/components/SidebandSelect.vue'
import SidebandTypeSelect from '@/views/device/sideband/components/SidebandTypeSelect.vue'
import DeviceSelect from '@/views/device/sideband/components/DeviceSelect.vue'
import GtSelect from '@/views/device/sideband/components/GtSelect.vue'
@ -133,7 +133,7 @@ const defaultTmp = {
bidCode: ''
}
export default {
components: { Pagination, SidebandChildTable, ProjectSelect, SidebandSelect, DeviceSelect, GtSelect },
components: { Pagination, SidebandChildTable, ProjectSelect, DeviceSelect, GtSelect, SidebandTypeSelect },
data() {
return {
tableKey: 0,