AssetsCard.vue 8.3 KB

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