dialog-receipt.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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.deptId);
  94. // })
  95. }
  96. function selectTurnoverDoor(item) {
  97. turnoverDoorChecked.value = item;
  98. placement.value = item;
  99. console.log(placement.value)
  100. }
  101. function handleConfirm() {
  102. if(placement.value){
  103. emit('submit',placement.value);
  104. close();
  105. }else{
  106. uni.showToast({
  107. icon: 'none',
  108. title: '请选择摆放位置'
  109. })
  110. }
  111. }
  112. // function handleChange() {
  113. // handleGetTurnoverListByDId(curDept.value);
  114. // }
  115. function handleGetTurnoverListByDId(depId){
  116. // turnAreaList.value = [];
  117. getTurnoverListByDeptId({
  118. deptId: depId,
  119. }).then(res => {
  120. for (var i = 0; i < res.data.length; i++) {
  121. if(res.data[i].status == 0){
  122. turnAreaList.value[i] = res.data[i];
  123. }
  124. }
  125. })
  126. }
  127. </script>
  128. <style lang="scss">
  129. .dialog-body {
  130. .list-container {
  131. width: 100%;
  132. .list-title {
  133. margin-top: 24rpx;
  134. .label {
  135. font-size: 32rpx;
  136. }
  137. }
  138. .turnArea {
  139. flex-wrap: wrap;
  140. height: auto;
  141. max-height: 200rpx;
  142. overflow: auto;
  143. }
  144. .btn {
  145. margin-top: 24rpx;
  146. .middle-btn {
  147. margin-right: 32rpx;
  148. align-items: center;
  149. justify-content: center;
  150. padding-left: 0;
  151. height: 80rpx;
  152. width: 220rpx;
  153. border-radius: 8rpx;
  154. background-color: #FFFFFF;
  155. border: 1px solid #999999;
  156. background-color: #FFFFFF;
  157. }
  158. .label {
  159. font-size: 24rpx;
  160. color: #000000;
  161. }
  162. .active {
  163. border-color: #1684fc;
  164. background-color: rgb(236, 245, 255);
  165. .label {
  166. color: #1684fc;
  167. }
  168. }
  169. }
  170. }
  171. .add-btn-container {
  172. margin-top: 32rpx;
  173. .btn {
  174. flex: 1;
  175. background-color: #1684fc;
  176. color: #FFFFFF;
  177. }
  178. }
  179. }
  180. </style>