index.vue 1.2 KB

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