BaseInfo.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <view class="detail-content">
  3. <view class="list-wrap-1">
  4. <view class="item">
  5. <view class="s1">类型标识</view>
  6. <view class="s2">
  7. {{ baseInfo.assetCode }}
  8. </view>
  9. </view>
  10. <view class="item">
  11. <view class="s1">物品类型</view>
  12. <view class="s2">
  13. {{ getDictValue('物品类型', baseInfo.assetType) }}
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="s1">物品编码</view>
  18. <view class="s2">
  19. {{ baseInfo.assetCode }}
  20. </view>
  21. </view>
  22. <view class="item">
  23. <view class="s1">物品名称</view>
  24. <view class="s2">
  25. {{ baseInfo.assetName }}
  26. </view>
  27. </view>
  28. <view class="item" v-for="(item, index) in uniqueData" :key="index">
  29. <view class="s1">{{ item.label }}</view>
  30. <view class="s2">
  31. {{ baseInfo[item.prop] }}
  32. </view>
  33. </view>
  34. <view class="item">
  35. <view class="s1">分类</view>
  36. <view class="s2">
  37. {{ baseInfo.classificationUrl }}
  38. </view>
  39. </view>
  40. <view class="item">
  41. <view class="s1">计量单位</view>
  42. <view class="s2">
  43. {{ baseInfo.unit }}
  44. </view>
  45. </view>
  46. <view class="item">
  47. <view class="s1">安全库存</view>
  48. <view class="s2">
  49. {{ baseInfo.safeStock }}
  50. </view>
  51. </view>
  52. <view class="item">
  53. <view class="s1">实时库存</view>
  54. <view class="s2">
  55. {{ baseInfo.realInventoryNum }}
  56. </view>
  57. </view>
  58. <view class="item">
  59. <view class="s1">锁单数量</view>
  60. <view class="s2"></view>
  61. </view>
  62. <view class="item">
  63. <view class="s1">空闲数量</view>
  64. <view class="s2"></view>
  65. </view>
  66. <view class="item">
  67. <view class="s1">允许拆包</view>
  68. <view class="s2">
  69. {{ baseInfo.isUnpack ? '是' : '否' }}
  70. </view>
  71. </view>
  72. <view class="item">
  73. <view class="s1">描述</view>
  74. <view class="s2">
  75. {{ baseInfo.description }}
  76. </view>
  77. </view>
  78. </view>
  79. <uni-collapse accordion>
  80. <!-- 模具、物料 -->
  81. <uni-collapse-item :show-animation="true" :open="false" :typeOpen="1" title="匹配产品" v-if="[6, 3].includes(baseInfo.assetType)">
  82. <view class="match-view">
  83. <view class="match-item" v-for="(item, index) in productData" :key="index">
  84. <view>{{ item.informationCode }}</view>
  85. <view>{{ item.informationName }}</view>
  86. </view>
  87. </view>
  88. <u-empty v-if="!productData.length" class="emptyPadding"></u-empty>
  89. </uni-collapse-item>
  90. <!-- 生产设备、产品 -->
  91. <uni-collapse-item :show-animation="true" :open="false" :typeOpen="1" title="匹配模具" v-if="[1, 4].includes(baseInfo.assetType)">
  92. <view class="match-view">
  93. <view class="match-item" v-for="(item, index) in mouldData" :key="index">
  94. <view class="label">{{ item.informationCode }}</view>
  95. <view>{{ item.informationName }}</view>
  96. </view>
  97. </view>
  98. <u-empty v-if="!mouldData.length" class="emptyPadding"></u-empty>
  99. </uni-collapse-item>
  100. <!-- 生产设备 -->
  101. <uni-collapse-item :show-animation="true" :open="false" :typeOpen="1" title="匹配备品备件" v-if="[1].includes(baseInfo.assetType)">
  102. <view class="match-view">
  103. <view class="match-item" v-for="(item, index) in partData" :key="index">
  104. <view class="label">{{ item.informationCode }}</view>
  105. <view>{{ item.informationName }}</view>
  106. </view>
  107. </view>
  108. <u-empty v-if="!partData.length" class="emptyPadding"></u-empty>
  109. </uni-collapse-item>
  110. <!-- 模具、备品备件 -->
  111. <uni-collapse-item :show-animation="true" :open="false" :typeOpen="1" title="匹配设备" v-if="[1].includes(baseInfo.assetType)">
  112. <view class="match-view">
  113. <view class="match-item" v-for="(item, index) in facilityData" :key="index">
  114. <view class="label">{{ item.informationCode }}</view>
  115. <view>{{ item.informationName }}</view>
  116. </view>
  117. </view>
  118. <u-empty v-if="!facilityData.length" class="emptyPadding"></u-empty>
  119. </uni-collapse-item>
  120. </uni-collapse>
  121. </view>
  122. </template>
  123. <script>
  124. import { mapGetters, mapActions } from 'vuex'
  125. import { get } from '@/utils/api.js'
  126. // import { getDetails as getMatchData } from '@/api/stockManagement/itemInformation'
  127. export default {
  128. data() {
  129. return {
  130. productData: [],
  131. mouldData: [],
  132. partData: [],
  133. bomData: [],
  134. facilityData: []
  135. }
  136. },
  137. props: {
  138. baseInfo: {
  139. type: Object,
  140. default: () => ({})
  141. }
  142. },
  143. computed: {
  144. ...mapGetters(['getDictValue']),
  145. uniqueData() {
  146. switch (+this.baseInfo.assetType) {
  147. case 3: //物料
  148. return [{ label: '牌号', prop: 'brandNum' }]
  149. case 8: //耗材
  150. return [
  151. { label: '型号', prop: 'modelType' },
  152. { label: '规格', prop: 'specification' }
  153. ]
  154. case 4: //产品
  155. return [
  156. { label: '牌号', prop: 'brandNum' },
  157. { label: '型号', prop: 'modelType' },
  158. {
  159. label: '标准单重',
  160. prop: 'modelType',
  161. formatter(row) {
  162. if (!row?.extendField) return ''
  163. const extendField = JSON.parse(row.extendField)
  164. return `${extendField.unqualifiedRate || '-'}KG`
  165. }
  166. },
  167. {
  168. label: '不良品率',
  169. prop: 'modelType',
  170. formatter(row) {
  171. if (!row?.extendField) return ''
  172. const extendField = JSON.parse(row.extendField)
  173. return `${extendField.unqualifiedRate || '-'}%`
  174. }
  175. }
  176. ]
  177. case 5: //'周转车'
  178. return [
  179. { label: '规格', prop: 'specification' },
  180. {
  181. label: '材质',
  182. prop: 'texture',
  183. formatter(row) {
  184. if (!row?.extendField) return ''
  185. const extendField = JSON.parse(row.extendField)
  186. return extendField.texture
  187. }
  188. },
  189. {
  190. label: '长宽高',
  191. prop: '',
  192. formatter(row) {
  193. if (!row?.extendField) return ''
  194. const extendField = JSON.parse(row.extendField)
  195. return `${extendField.length || '-'}/${extendField.width || '-'}/${extendField.high || '-'}`
  196. }
  197. }
  198. ]
  199. case 2: //'舟皿'
  200. return [
  201. { label: '规格', prop: 'specification' },
  202. { label: '型号', prop: 'modelType' },
  203. {
  204. label: '角度',
  205. prop: '',
  206. formatter(row) {
  207. if (!row?.extendField) return ''
  208. const extendField = JSON.parse(row.extendField)
  209. return extendField.angle
  210. }
  211. },
  212. {
  213. label: '长宽高',
  214. prop: '',
  215. formatter(row) {
  216. if (!row?.extendField) return ''
  217. const extendField = JSON.parse(row.extendField)
  218. return `${extendField.length || '-'}*${extendField.width || '-'}*${extendField.high || '-'}`
  219. }
  220. }
  221. ]
  222. case 1: //'设备'
  223. return [
  224. { label: '型号', prop: 'modelType' },
  225. { label: '规格', prop: 'specification' }
  226. ]
  227. case 6: //'模具'
  228. return [
  229. { label: '牌号', prop: 'brandNum' },
  230. { label: '型号', prop: 'modelType' },
  231. {
  232. label: '收缩系数',
  233. prop: '',
  234. formatter(row) {
  235. if (!row?.extendField) return ''
  236. const extendField = JSON.parse(row.extendField)
  237. return extendField.shrinkageCoefficient
  238. }
  239. },
  240. {
  241. label: '芯杆数量',
  242. prop: '',
  243. formatter(row) {
  244. if (!row?.extendField) return ''
  245. const extendField = JSON.parse(row.extendField)
  246. return extendField.mandrelNum
  247. }
  248. },
  249. {
  250. label: '模孔数量',
  251. prop: '',
  252. formatter(row) {
  253. if (!row?.extendField) return ''
  254. const extendField = JSON.parse(row.extendField)
  255. return extendField.dieHoleNum
  256. }
  257. },
  258. {
  259. label: '上冲头数量',
  260. prop: '',
  261. formatter(row) {
  262. if (!row?.extendField) return ''
  263. const extendField = JSON.parse(row.extendField)
  264. return extendField.upperPunchNum
  265. }
  266. },
  267. {
  268. label: '下冲头数量',
  269. prop: '',
  270. formatter(row) {
  271. if (!row?.extendField) return ''
  272. const extendField = JSON.parse(row.extendField)
  273. return extendField.lowerPunchNum
  274. }
  275. }
  276. ]
  277. case 7: //'备品备件'
  278. return [
  279. { label: '规格', prop: 'specification' },
  280. { label: '型号', prop: 'modelType' }
  281. ]
  282. }
  283. return []
  284. }
  285. },
  286. created() {
  287. this.requestDict('物品类型')
  288. this._getMatchData()
  289. },
  290. methods: {
  291. ...mapActions('dict', ['requestDict']),
  292. async _getMatchData() {
  293. // const res = await get(
  294. // this.apiUrl + `/information/info/${this.baseInfo.materialId}`
  295. // )
  296. // if (res?.success) {
  297. // for (const key in res.data.informationRelationMap) {
  298. // this.matchList(key, res.data.informationRelationMap)
  299. // }
  300. // }
  301. },
  302. matchList(key, data) {
  303. switch (key) {
  304. case 'w01': {
  305. this.facilityData = data[key]
  306. break
  307. }
  308. case 'w04': {
  309. this.mouldData = data[key]
  310. break
  311. }
  312. case 'w05': {
  313. this.partData = data[key]
  314. break
  315. }
  316. case 'w07': {
  317. this.productData = data[key]
  318. break
  319. }
  320. default:
  321. break
  322. }
  323. }
  324. }
  325. }
  326. </script>
  327. <style lang="scss" scoped>
  328. .list-wrap-1 {
  329. padding: 30rpx;
  330. .item {
  331. color: #000000;
  332. font-size: 28rpx;
  333. padding: 10rpx 0;
  334. display: flex;
  335. justify-content: space-between;
  336. }
  337. .item + .item {
  338. border-top: 1px dashed #555;
  339. }
  340. }
  341. .emptyPadding {
  342. padding: 20rpx 0;
  343. }
  344. .match-view {
  345. display: flex;
  346. flex-wrap: wrap;
  347. justify-content: space-between;
  348. padding: 20rpx;
  349. .match-item {
  350. width: 49%;
  351. display: flex;
  352. justify-content: space-between;
  353. border: 1px solid #ccc;
  354. padding: 0rpx 10rpx;
  355. box-sizing: border-box;
  356. & + .match-item {
  357. margin-left: 2%;
  358. }
  359. > view {
  360. padding: 15rpx 0;
  361. }
  362. .label {
  363. border-right: 1rpx solid #ccc;
  364. padding-right: 5rpx;
  365. }
  366. }
  367. }
  368. </style>