dialog-inspectionChamber.vue 3.0 KB

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