index.vue 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <template>
  2. <el-select v-model="equipCatId" value-key="EquipmentCatId" style="width: 100%" filterable placeholder="请选择设备类别">
  3. <el-option-group>
  4. <el-option
  5. v-for="item in dataList"
  6. :key="item.equipCatId"
  7. :label="item.equipCatTitle"
  8. :value="item.equipCatId"
  9. />
  10. </el-option-group>
  11. </el-select>
  12. </template>
  13. <script>
  14. import { getEquipmentCatByList } from '@/api/aqpt/equipmentCatApi'
  15. export default {
  16. name: 'EquipmentCatSelector',
  17. components: { },
  18. props: {
  19. value: {
  20. type: Number,
  21. default: undefined
  22. }
  23. },
  24. data() {
  25. return {
  26. equipCatId: undefined,
  27. dataList: []
  28. }
  29. },
  30. watch: {
  31. value(val) {
  32. this.EquipCatId = val
  33. },
  34. EquipCatId(val) {
  35. this.$emit('input', val)
  36. }
  37. },
  38. created() {
  39. this.initEquipCatData()
  40. },
  41. mounted() {},
  42. methods: {
  43. // 检查表清单
  44. initEquipCatData() {
  45. getEquipmentCatByList().then((resp) => {
  46. const { data } = resp
  47. this.dataList = data
  48. }).catch((error) => {
  49. console.log(error)
  50. })
  51. }
  52. }
  53. }
  54. </script>