dialog-inspectionChamber.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. if(store.processInspection != null && store.processInspection.inspectionChamberId != 0) {
  55. inspectionChamberId.value = store.processInspection.inspectionChamberId
  56. }
  57. handleGetInspectionChamberList();
  58. }
  59. function handleConfirm() {
  60. console.log(inspectionChamber.value)
  61. emit('handleSelectInspectionChamber', inspectionChamber.value);
  62. close()
  63. }
  64. // function handleChange() {
  65. // handleGetTurnoverListByDId(curDept.value);
  66. // }
  67. function handleGetInspectionChamberList() {
  68. getInspectionChamber().then(res => {
  69. if(res.rows.length >0) {
  70. inspectionChamberList.value = res.rows.map(info => {
  71. return { value: info.id, text: info.chamberName };
  72. });
  73. inspectionChamber.value = inspectionChamberList.value[0].value
  74. }else {
  75. inspectionChamberList.value = []
  76. inspectionChamber.value = null;
  77. }
  78. });
  79. }
  80. </script>
  81. <style lang="scss">
  82. .dialog-body {
  83. .list-container {
  84. width: 100%;
  85. .list-title {
  86. margin-top: 24rpx;
  87. .label {
  88. font-size: 32rpx;
  89. }
  90. }
  91. .turnArea {
  92. flex-wrap: wrap;
  93. height: auto;
  94. max-height: 200rpx;
  95. overflow: auto;
  96. }
  97. .btn {
  98. margin-top: 24rpx;
  99. .middle-btn {
  100. margin-right: 32rpx;
  101. align-items: center;
  102. justify-content: center;
  103. padding-left: 0;
  104. height: 80rpx;
  105. width: 220rpx;
  106. border-radius: 8rpx;
  107. background-color: #FFFFFF;
  108. border: 1px solid #999999;
  109. background-color: #FFFFFF;
  110. }
  111. .label {
  112. font-size: 24rpx;
  113. color: #000000;
  114. }
  115. .active {
  116. border-color: #1684fc;
  117. background-color: rgb(236, 245, 255);
  118. .label {
  119. color: #1684fc;
  120. }
  121. }
  122. }
  123. }
  124. .add-btn-container {
  125. margin-top: 32rpx;
  126. .btn {
  127. flex: 1;
  128. background-color: #1684fc;
  129. color: #FFFFFF;
  130. }
  131. }
  132. }
  133. </style>