dialog-daywork-choice.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 infos = ref([])
  28. const emit = defineEmits(['handleSelectDaywork'])
  29. // onLoad(() => {
  30. // })
  31. function open(data) {
  32. lotList.value = data.map(v => ({
  33. text: v.lotCode,
  34. value: v.lotCode,
  35. }))
  36. infos.value = data
  37. baseDialog.value.open();
  38. }
  39. function handleLotChange() {
  40. console.log("选中", selectedLot.value);
  41. }
  42. function handleStart() {
  43. const info = infos.value.find(e => e.lotCode === selectedLot.value)
  44. emit('handleSelectDaywork', info);
  45. close()
  46. }
  47. function close() {
  48. baseDialog.value.close()
  49. }
  50. defineExpose({
  51. open
  52. })
  53. </script>
  54. <style lang="scss">
  55. .dialog-body {
  56. .equipment-container {
  57. height: 300rpx;
  58. overflow: auto;
  59. flex-wrap: wrap;
  60. justify-content: flex-start;
  61. margin: 24rpx 0 0 7%;
  62. .item {
  63. width: 236rpx;
  64. height: 60rpx;
  65. text-align: center;
  66. line-height: 60rpx;
  67. border-radius: 6rpx;
  68. margin: 16rpx;
  69. flex: 0 0 40%;
  70. border: 1px solid #000000;
  71. }
  72. .selected {
  73. background-color: #1684fc;
  74. color: #FFF;
  75. }
  76. }
  77. .add-btn-container {
  78. margin-top: 32rpx;
  79. .btn {
  80. flex: 1;
  81. }
  82. }
  83. .switch {
  84. font-size: 26rpx;
  85. align-items: center;
  86. justify-content: space-between;
  87. margin: 16rpx;
  88. }
  89. .userList {
  90. border: 1rpx solid #1684fc;
  91. border-radius: 8rpx;
  92. max-height: 300rpx;
  93. overflow: auto;
  94. width: 100%;
  95. .showUser {
  96. justify-content: flex-start;
  97. flex-wrap: wrap;
  98. .user {
  99. border: 1rpx solid #999;
  100. border-radius: 8rpx;
  101. width: 150rpx;
  102. height: 50rpx;
  103. text-align: center;
  104. line-height: 50rpx;
  105. margin: 10rpx;
  106. overflow: auto;
  107. }
  108. }
  109. }
  110. .selectedUserList {
  111. width: 100%;
  112. justify-content: flex-start;
  113. flex-wrap: wrap;
  114. .selectedUser {
  115. border: 1rpx solid #999;
  116. border-radius: 8rpx;
  117. width: 150rpx;
  118. height: 50rpx;
  119. text-align: center;
  120. line-height: 50rpx;
  121. margin: 20rpx 20rpx 0 0;
  122. justify-content: space-around;
  123. }
  124. }
  125. }
  126. </style>