plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.0 KiB

  1. <template>
  2. <div>
  3. <el-select v-bind="$attrs" v-on="$listeners" :value="value" style="width: 100%" @change="changeDictData">
  4. <el-option v-for="(item, index) in options" :key="index" :label="item.dictLabel" :value="item.dictValue" :disabled="item.status === 'N'"></el-option>
  5. </el-select>
  6. </div>
  7. </template>
  8. <script>
  9. import {selectDictDataList} from "../../../api/dict";
  10. export default {
  11. name:'dict-data-select',
  12. model:{
  13. prop:'value',
  14. event:'change'
  15. },
  16. props:{
  17. dictType: {
  18. type: String,
  19. required: true
  20. },
  21. value:{
  22. required: true,
  23. }
  24. },
  25. data () {
  26. return {
  27. options: []
  28. }
  29. },
  30. created () {
  31. this.initOption()
  32. },
  33. methods: {
  34. //初始化options
  35. async initOption () {
  36. let params = {
  37. site:this.$store.state.user.site,
  38. dictType:this.dictType
  39. }
  40. let {data} = await selectDictDataList(params);
  41. this.options = data.rows;
  42. },
  43. changeDictData(val){
  44. this.$emit('change',val)
  45. }
  46. }
  47. }
  48. </script>