dialog-receipt.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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="curDept" :localdata="deptList" @change="handleChange"
  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 class="list-title">
  12. <text class="label">请选择您存放位置</text>
  13. </view>
  14. <view class="turnArea uni-row" >
  15. <view v-for="(item,index) in turnAreaList" class="btn">
  16. <view :class="{ 'middle-btn': true, 'active': item == turnoverDoorChecked }"
  17. @click="selectTurnoverDoor(item)"><text class="label">{{item.code}}</text></view>
  18. </view>
  19. </view>
  20. </view>
  21. <view class="add-btn-container uni-row">
  22. <button type="default" class="btn" @click="handleConfirm">确认</button>
  23. </view>
  24. </dialog-base>
  25. </template>
  26. <script setup>
  27. import {
  28. ref,
  29. getCurrentInstance
  30. } from 'vue'
  31. import {
  32. onLoad
  33. } from '@dcloudio/uni-app'
  34. import {
  35. getDictInfoByType
  36. } from '@/api/dict/dict.js'
  37. import {
  38. getDayWorkItemList,
  39. saveDayWorkItem
  40. } from '@/api/business/dayWorkItem.js'
  41. import {
  42. getDeptList
  43. } from '@/api/dept/dept.js'
  44. import {
  45. getTurnoverListByDeptId
  46. } from '@/api/business/turnover.js'
  47. import {
  48. store
  49. } from '@/store/index.js'
  50. import {
  51. timestampToTime
  52. } from '@/utils/common.js'
  53. const baseDialog = ref(null)
  54. const turnoverDoorChecked = ref({})
  55. const turnoverArea = ref([])
  56. const curDept = ref(0)
  57. const deptList = ref([]) // 工段列表
  58. const turnAreaList = ref([]) // 周转区列表
  59. const placement = ref(null)
  60. const emit = defineEmits(['submit']);
  61. onLoad(() => {
  62. })
  63. function open() {
  64. resetPage();
  65. baseDialog.value.open();
  66. init();
  67. }
  68. function resetPage(){
  69. deptList.value = [];
  70. turnAreaList.value = [];
  71. curDept.value = 0;
  72. placement.value = null;
  73. }
  74. defineExpose({
  75. open
  76. })
  77. function close() {
  78. baseDialog.value.close()
  79. turnAreaList.value = [];
  80. }
  81. function init() {
  82. // getDeptList({
  83. // isWorkSection: 1,
  84. // tenantId: store.tenantId
  85. // }).then(res => {
  86. // for (var i = 0; i < res.data.length; i++) {
  87. // deptList.value[i] = {
  88. // text: res.data[i].deptName,
  89. // value: res.data[i].deptId,
  90. // }
  91. // }
  92. // curDept.value = res.data[0].deptId;
  93. handleGetTurnoverListByDId(store.curDeptDetails);
  94. // })
  95. }
  96. function selectTurnoverDoor(item) {
  97. turnoverDoorChecked.value = item;
  98. placement.value = item;
  99. console.log(placement.value)
  100. }
  101. function handleConfirm() {
  102. emit('submit',placement.value);
  103. close();
  104. }
  105. // function handleChange() {
  106. // handleGetTurnoverListByDId(curDept.value);
  107. // }
  108. function handleGetTurnoverListByDId(depId){
  109. // turnAreaList.value = [];
  110. getTurnoverListByDeptId({
  111. deptId: depId,
  112. }).then(res => {
  113. for (var i = 0; i < res.data.length; i++) {
  114. if(res.data[i].status == 0){
  115. turnAreaList.value[i] = res.data[i];
  116. }
  117. }
  118. })
  119. }
  120. </script>
  121. <style lang="scss">
  122. .dialog-body {
  123. .list-container {
  124. width: 100%;
  125. .list-title {
  126. margin-top: 24rpx;
  127. .label {
  128. font-size: 32rpx;
  129. }
  130. }
  131. .turnArea {
  132. flex-wrap: wrap;
  133. height: auto;
  134. max-height: 200rpx;
  135. overflow: auto;
  136. }
  137. .btn {
  138. margin-top: 24rpx;
  139. .middle-btn {
  140. margin-right: 32rpx;
  141. align-items: center;
  142. justify-content: center;
  143. padding-left: 0;
  144. height: 80rpx;
  145. width: 220rpx;
  146. border-radius: 8rpx;
  147. background-color: #FFFFFF;
  148. border: 1px solid #999999;
  149. background-color: #FFFFFF;
  150. }
  151. .label {
  152. font-size: 24rpx;
  153. color: #000000;
  154. }
  155. .active {
  156. border-color: #1684fc;
  157. background-color: rgb(236, 245, 255);
  158. .label {
  159. color: #1684fc;
  160. }
  161. }
  162. }
  163. }
  164. .add-btn-container {
  165. margin-top: 32rpx;
  166. .btn {
  167. flex: 1;
  168. background-color: #1684fc;
  169. color: #FFFFFF;
  170. }
  171. }
  172. }
  173. </style>