AssetsCard copy.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="kd-row">
  3. <checkbox-group @change="handleChange">
  4. <label>
  5. <view class="kd-col">
  6. <text class="title">{{ item.assetName }}({{ item.assetCode }})</text>
  7. <uni-icons class="shanchu" v-if="type == 'output'" custom-prefix="iconfont" type="icon-shanchu" size="24" @click="deleteItem" color="#fa3534"></uni-icons>
  8. <text v-if="type == 'input' || isApproval">数量:{{ item.amount }}{{ curUnit }}</text>
  9. </view>
  10. <view class="kd-col" v-if="type === 'output'">
  11. <text>货位 :{{ `${item.outWarehouseAreaName}-${item.outWarehouseAreaGoodsCode}-${item.outGoodsAllocationCode}` }}</text>
  12. </view>
  13. <view class="kd-col">
  14. <text class="col-items">类型:{{}}</text>
  15. <text class="col-items" v-for="(itm, index) in tableHeader" :key="index">
  16. {{ itm.label }}:
  17. <template v-if="itm.formatter">{{ itm.formatter(item) }}</template>
  18. <template v-else>{{ item[itm.prop] }}</template>
  19. </text>
  20. <!-- <text class="col-items"
  21. >最小单元:{{ item.measurementUnit }}{{ item.unit }}/{{
  22. item.minPackUnit
  23. }}</text
  24. > -->
  25. <!-- <text class="col-items">编号:{{ item.num }}</text> -->
  26. </view>
  27. <template v-if="type === 'input' || type == 'detail'">
  28. <view class="kd-col">当前货位 :{{ `${item.outWarehouseAreaName}-${item.outWarehouseAreaGoodsCode}-${item.outGoodsAllocationCode}` }}</view>
  29. <view class="kd-col">调入货位 :{{ `${item.inWarehouseAreaName}-${item.inWarehouseAreaGoodsCode}-${item.inGoodsAllocationCode}` }}</view>
  30. <view style="text-align: right" v-if="type != 'detail'">
  31. <checkbox :checked="item.inputChecked" />
  32. </view>
  33. </template>
  34. <view class="num-box" v-if="type == 'output'">
  35. <view>待调出数量:{{ item.amount }}{{ curUnit }}</view>
  36. <view class="num-common">
  37. <view>选中数量</view>
  38. <u-number-box v-if="item.takeStockPattern" v-model="item.curAmount" :disabled="type == 'detail'" :min="0" :max="+item.amount"></u-number-box>
  39. <text class="text-primary num" @click="handleDetail(item)" v-else>{{ (item.curDetailReqList && item.curDetailReqList.filter(i => i.checked).length) || '选择' }}</text>
  40. </view>
  41. </view>
  42. <!-- <checkbox v-if="type == 'output'" :checked="item.checked" /> -->
  43. <view class="num-common" v-if="!type || type == 'detail'" style="color: #aaaaaa">
  44. <template v-if="type == 'detail'">
  45. <template v-if="isApproval">
  46. <text class="text-primary num" @click="handleDetail(item)">明细</text>
  47. </template>
  48. <template v-else>
  49. 已选数量
  50. <text class="text-primary num" v-if="item.takeStockPattern" @click="handleDetail(item)">{{ item.amount }}{{ curUnit }}</text>
  51. <text class="text-primary num" @click="handleDetail(item)" v-else>
  52. {{ (item.detailReqList && item.detailReqList.filter(i => i.checked || type == 'detail').length) || 0 }}{{ curUnit }}
  53. </text>
  54. </template>
  55. </template>
  56. <template v-else>
  57. '选中数量'
  58. <u-number-box v-if="item.takeStockPattern" v-model="item.amount" :min="0" :max="+item.max"></u-number-box>
  59. <text class="text-primary num" @click="handleDetail(item)" v-else>{{ (item.detailReqList && item.detailReqList.filter(i => i.checked || type == 'detail').length) || '选择' }}</text>
  60. </template>
  61. </view>
  62. </label>
  63. </checkbox-group>
  64. <DetailDialog ref="detailRef" :type="type" />
  65. </view>
  66. </template>
  67. <script>
  68. import { tableHeader } from '../../common'
  69. import DetailDialog from './DetailDialog'
  70. import { mapActions, mapGetters } from 'vuex'
  71. export default {
  72. components: { DetailDialog },
  73. props: {
  74. item: {
  75. type: Object,
  76. default: () => ({})
  77. },
  78. isApproval: {
  79. type: Boolean,
  80. default: false
  81. },
  82. type: String
  83. },
  84. data() {
  85. return {}
  86. },
  87. computed: {
  88. // ...mapGetters(['getDictValue']),
  89. tableHeader() {
  90. return tableHeader(this.item.assetType)
  91. },
  92. curUnit() {
  93. return this.item.isUnpack
  94. ? this.item.unit || (this.item.detailReqList && this.item.detailReqList[0] && this.item.detailReqList[0].unit)
  95. : this.item.minPackUnit || (this.item.detailReqList && this.item.detailReqList[0] && this.item.detailReqList[0].minPackUnit)
  96. }
  97. },
  98. created() {
  99. // this.requestDict('物品类型')
  100. },
  101. methods: {
  102. // ...mapActions('dict', ['requestDict']),
  103. deleteItem() {
  104. this.$emit('deleteItem')
  105. },
  106. handleChange(e) {
  107. if (this.type === 'input') {
  108. this.item.inputChecked = !!e.detail.value.length
  109. } else {
  110. this.$set(this.item, 'checked', !!e.detail.value.length)
  111. }
  112. },
  113. goDetail({ id }) {
  114. // uni.navigateTo({
  115. // url: `/pages/warehouse/enterHouse/details?&id=${id}`
  116. // })
  117. },
  118. handleDetail(item) {
  119. if (this.type === 'detail' && !item.detailReqList?.length) {
  120. return
  121. }
  122. this.$refs.detailRef.open(item, this.cargoSpaceId, res => {
  123. if (this.type === 'output') {
  124. this.$set(item, 'curDetailReqList', res)
  125. } else {
  126. this.$set(
  127. item,
  128. 'detailReqList',
  129. res.filter(i => i.checked)
  130. )
  131. }
  132. })
  133. }
  134. }
  135. }
  136. </script>
  137. <style lang="scss" scoped>
  138. .kd-row {
  139. font-size: 28rpx;
  140. padding: 14rpx 12rpx 6rpx;
  141. border-bottom: 1rpx solid $page-bg;
  142. .kd-col {
  143. display: flex;
  144. justify-content: space-between;
  145. align-items: center;
  146. flex-wrap: wrap;
  147. padding: 2rpx;
  148. color: #aaaaaa;
  149. margin-bottom: 8rpx;
  150. .col-items {
  151. width: 50%;
  152. }
  153. .status {
  154. background-color: $page-bg;
  155. display: inline-block;
  156. padding: 4rpx 10rpx;
  157. border-radius: 18rpx;
  158. }
  159. }
  160. .title {
  161. font-weight: bold;
  162. color: #333333;
  163. }
  164. /deep/.u-number-box {
  165. align-items: stretch;
  166. height: 60rpx;
  167. .u-number-box__input {
  168. width: 80rpx !important;
  169. height: auto !important;
  170. }
  171. .u-number-box__minus,
  172. .u-number-box__plus {
  173. height: auto !important;
  174. }
  175. }
  176. }
  177. .center {
  178. text-align: center;
  179. margin-bottom: 10rpx;
  180. color: #999;
  181. }
  182. .no_data {
  183. position: fixed;
  184. top: 50%;
  185. left: 50%;
  186. transform: translate(-50%, -50%);
  187. color: #999;
  188. font-size: 28rpx;
  189. }
  190. .warehouse {
  191. display: flex;
  192. align-items: center;
  193. }
  194. .arrow {
  195. display: inline-block;
  196. position: relative;
  197. width: 50rpx;
  198. height: 10rpx;
  199. margin: 0 20rpx;
  200. &::after,
  201. &::before {
  202. content: '';
  203. position: absolute;
  204. }
  205. &::after {
  206. border-top: 4rpx solid #aaaaaa;
  207. border-right: 4rpx solid #aaaaaa;
  208. width: 12rpx;
  209. height: 12rpx;
  210. right: 0rpx;
  211. top: -6rpx;
  212. transform: rotate(45deg);
  213. }
  214. &::before {
  215. height: 4rpx;
  216. background-color: #aaaaaa;
  217. width: 50rpx;
  218. }
  219. }
  220. .num-box {
  221. display: flex;
  222. color: #aaaaaa;
  223. justify-content: space-between;
  224. }
  225. .num {
  226. margin-bottom: 5rpx;
  227. display: inline-block;
  228. border: 1rpx solid $j-primary-green;
  229. padding: 8rpx 20rpx;
  230. border-radius: 10rpx;
  231. }
  232. .num-common {
  233. display: flex;
  234. // justify-content: flex-end;
  235. flex-direction: column;
  236. align-items: flex-end;
  237. }
  238. </style>