| | |
| | | <el-form-item label="设备"> |
| | | <el-select |
| | | :model-value="modelValue" |
| | | @change="handleChange" |
| | | @update:model-value="handleChange" |
| | | placeholder="设备" |
| | | size="small" |
| | | class="w-120" |
| | | > |
| | | <el-option |
| | | v-for="(s, i) in deviceList" |
| | | v-for="(s, i) in deviceOptions" |
| | | :key="i" |
| | | :label="s.label" |
| | | :value="s.value" |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { deviceList } from '@/constant/device-type'; |
| | | |
| | | export default { |
| | | props: { |
| | | type: String, |
| | |
| | | return {}; |
| | | }, |
| | | computed: { |
| | | deviceList() { |
| | | const t = this.type ? this.type : '0a'; |
| | | return [1, 2, 3].map((v) => { |
| | | const text = `${t}000000000${v}`; |
| | | return { |
| | | label: text, |
| | | value: text |
| | | }; |
| | | }); |
| | | deviceOptions() { |
| | | return deviceList(this.type); |
| | | } |
| | | }, |
| | | watch: { |
| | | deviceList(nV, oV) { |
| | | deviceOptions(nV, oV) { |
| | | if (nV != oV) { |
| | | this.handleChange(nV[0].value); |
| | | } |
| | |
| | | } |
| | | }, |
| | | mounted() { |
| | | this.handleChange(this.deviceList[0].value); |
| | | this.handleChange(this.deviceOptions[0].value); |
| | | } |
| | | }; |
| | | </script> |