dialog-selectInspectionChamber.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <dialog-base ref="baseDialog" title="仪器室选择">
  3. <view class="list-container">
  4. <view class="" style="margin: 0 20rpx 20rpx 0;width: 88%;">
  5. <uni-section title="请选择仪器室" title-font-size="32rpx" style="margin: 0 0 0 -16rpx;">
  6. <uni-data-select v-model="inspectionChamber" :localdata="inspectionChamberList"
  7. :clear="false"
  8. style="margin: 0 0 0 16rpx;outline: 2rpx solid #999999;border-radius: 10rpx;"></uni-data-select>
  9. </uni-section>
  10. </view>
  11. </view>
  12. <view class="add-btn-container uni-row">
  13. <button type="default" class="btn" @click="handleConfirm">确认</button>
  14. </view>
  15. </dialog-base>
  16. </template>
  17. <script setup>
  18. import {
  19. ref,
  20. getCurrentInstance
  21. } from 'vue'
  22. import {
  23. onLoad
  24. } from '@dcloudio/uni-app'
  25. import {
  26. store
  27. } from '@/store/index.js'
  28. import {getInspectionChamber} from '@/api/business/processInspection.js'
  29. const baseDialog = ref(null)
  30. const inspectionChamberList = ref([])
  31. const inspectionChamber = ref(null)
  32. const inspectionChamberId = ref(0)
  33. const emit = defineEmits(['handleSelectInspectionChamber'])
  34. onLoad(() => {
  35. })
  36. function open() {
  37. resetPage();
  38. baseDialog.value.open();
  39. init();
  40. }
  41. function resetPage() {
  42. inspectionChamberList.value = []
  43. inspectionChamber.value = null;
  44. }
  45. defineExpose({
  46. open
  47. })
  48. function close() {
  49. inspectionChamberList.value = []
  50. inspectionChamber.value = null;
  51. baseDialog.value.close()
  52. }
  53. function init() {
  54. inspectionChamberId.value = store.processInspection.inspectionChamberId
  55. handleGetInspectionChamberList();
  56. }
  57. function handleConfirm() {
  58. console.log(inspectionChamber.value)
  59. emit('handleSelectInspectionChamber', inspectionChamber.value);
  60. close()
  61. }
  62. // function handleChange() {
  63. // handleGetTurnoverListByDId(curDept.value);
  64. // }
  65. function handleGetInspectionChamberList() {
  66. getInspectionChamber({id:inspectionChamberId.value}).then(res => {
  67. if(res.rows.length >0) {
  68. inspectionChamberList.value = res.rows.map(info => {
  69. return { value: info.id, text: info.chamberName };
  70. });
  71. inspectionChamber.value = inspectionChamberList.value[0].value
  72. }else {
  73. inspectionChamberList.value = []
  74. inspectionChamber.value = null;
  75. }
  76. });
  77. }
  78. </script>
  79. <style lang="scss">
  80. .dialog-body {
  81. .list-container {
  82. width: 100%;
  83. .list-title {
  84. margin-top: 24rpx;
  85. .label {
  86. font-size: 32rpx;
  87. }
  88. }
  89. .turnArea {
  90. flex-wrap: wrap;
  91. height: auto;
  92. max-height: 200rpx;
  93. overflow: auto;
  94. }
  95. .btn {
  96. margin-top: 24rpx;
  97. .middle-btn {
  98. margin-right: 32rpx;
  99. align-items: center;
  100. justify-content: center;
  101. padding-left: 0;
  102. height: 80rpx;
  103. width: 220rpx;
  104. border-radius: 8rpx;
  105. background-color: #FFFFFF;
  106. border: 1px solid #999999;
  107. background-color: #FFFFFF;
  108. }
  109. .label {
  110. font-size: 24rpx;
  111. color: #000000;
  112. }
  113. .active {
  114. border-color: #1684fc;
  115. background-color: rgb(236, 245, 255);
  116. .label {
  117. color: #1684fc;
  118. }
  119. }
  120. }
  121. }
  122. .add-btn-container {
  123. margin-top: 32rpx;
  124. .btn {
  125. flex: 1;
  126. background-color: #1684fc;
  127. color: #FFFFFF;
  128. }
  129. }
  130. }
  131. </style>