dialog-selectDaywork.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <dialog-base ref="baseDialog" title="请选择批次">
  3. <view>
  4. <uni-section title="批次" type="line">
  5. <uni-data-select v-model="selectedLot" :localdata="lotList" :clear="false"
  6. @change="handleLotChange"></uni-data-select>
  7. </uni-section>
  8. </view>
  9. <view class="add-btn-container uni-row">
  10. <button type="primary" class="btn" @click="handleStart">确定</button>
  11. </view>
  12. </dialog-base>
  13. </template>
  14. <script setup>
  15. import {
  16. ref
  17. } from 'vue'
  18. import {
  19. onLoad
  20. } from '@dcloudio/uni-app'
  21. import {
  22. store
  23. } from '@/store/index.js'
  24. const baseDialog = ref(null)
  25. const selectedLot = ref("")
  26. const lotList = ref([])
  27. const emit = defineEmits(['handleSelectDaywork'])
  28. // onLoad(() => {
  29. // })
  30. function open(data) {
  31. lotList.value = data.map(v => ({
  32. text: v.lotCode,
  33. value: v.lotCode,
  34. }))
  35. selectedLot.value = lotList.value[0].value
  36. baseDialog.value.open();
  37. }
  38. function handleLotChange() {
  39. console.log("选中", selectedLot.value);
  40. }
  41. function handleStart() {
  42. emit('handleSelectDaywork', selectedLot.value);
  43. close()
  44. }
  45. function close() {
  46. baseDialog.value.close()
  47. }
  48. defineExpose({
  49. open
  50. })
  51. </script>
  52. <style lang="scss">
  53. .dialog-body {
  54. .equipment-container {
  55. height: 300rpx;
  56. overflow: auto;
  57. flex-wrap: wrap;
  58. justify-content: flex-start;
  59. margin: 24rpx 0 0 7%;
  60. .item {
  61. width: 236rpx;
  62. height: 60rpx;
  63. text-align: center;
  64. line-height: 60rpx;
  65. border-radius: 6rpx;
  66. margin: 16rpx;
  67. flex: 0 0 40%;
  68. border: 1px solid #000000;
  69. }
  70. .selected {
  71. background-color: #1684fc;
  72. color: #FFF;
  73. }
  74. }
  75. .add-btn-container {
  76. margin-top: 32rpx;
  77. .btn {
  78. flex: 1;
  79. }
  80. }
  81. .switch {
  82. font-size: 26rpx;
  83. align-items: center;
  84. justify-content: space-between;
  85. margin: 16rpx;
  86. }
  87. .userList {
  88. border: 1rpx solid #1684fc;
  89. border-radius: 8rpx;
  90. max-height: 300rpx;
  91. overflow: auto;
  92. width: 100%;
  93. .showUser {
  94. justify-content: flex-start;
  95. flex-wrap: wrap;
  96. .user {
  97. border: 1rpx solid #999;
  98. border-radius: 8rpx;
  99. width: 150rpx;
  100. height: 50rpx;
  101. text-align: center;
  102. line-height: 50rpx;
  103. margin: 10rpx;
  104. overflow: auto;
  105. }
  106. }
  107. }
  108. .selectedUserList {
  109. width: 100%;
  110. justify-content: flex-start;
  111. flex-wrap: wrap;
  112. .selectedUser {
  113. border: 1rpx solid #999;
  114. border-radius: 8rpx;
  115. width: 150rpx;
  116. height: 50rpx;
  117. text-align: center;
  118. line-height: 50rpx;
  119. margin: 20rpx 20rpx 0 0;
  120. justify-content: space-around;
  121. }
  122. }
  123. }
  124. </style>