semiProductBom.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">物料明细 ({{list.length || 0}})个</view>
  5. <view class="btn_box rx-cc" v-if="deviceList.length > 1" @click="bindDevice">绑定设备</view>
  6. </view>
  7. <u-list @scrolltolower="scrolltolower" class="z_list" style="height: 100% !important;">
  8. <view class="material rx-ss" v-for="(mate, idx) in list" :key="idx">
  9. <view class="left rx-ss" @click="getDelete(idx)" v-if='workOrderId'>
  10. <uni-icons custom-prefix="iconfont" type="icon-shanchu" size="20" color="#fa3534"></uni-icons>
  11. </view>
  12. <view class="content_table">
  13. <view class="item rx-sc"
  14. v-if='(mate.rootCategoryLevelId == 23 || mate.rootCategoryLevelId == 2) && mate.isConsumable == 1'>
  15. <view class="rx ">
  16. <view class="lable rx-cc">编码</view>
  17. <view class="content">{{ mate.code }}</view>
  18. </view>
  19. </view>
  20. <view class="item rx-bc"
  21. v-if='(mate.rootCategoryLevelId == 23 || mate.rootCategoryLevelId == 2) && mate.isConsumable == 0'
  22. @click="handleCheck(idx, mate)">
  23. <view class="rx ">
  24. <view class="lable rx-cc">编码</view>
  25. <view class="content">{{ mate.code }}</view>
  26. </view>
  27. <view class="rx-cc ww20" v-if="deviceList.length > 1">
  28. <image class="check" v-if="mate.check" src='../../../../static/check.png'></image>
  29. <image class="check" v-if="!mate.check" src='../../../../static/check_no.png'></image>
  30. </view>
  31. </view>
  32. <view class="item" >
  33. <view class="lable rx-cc">名称</view>
  34. <view class="content">{{mate.name}} <text v-if="[2, 23].includes(Number(mate.rootCategoryLevelId))"> ({{mate.rootCategoryLevelId == 2 ? '在制品' : mate.rootCategoryLevelId == 23 ? '半成品' : '' }}) </text></view>
  35. </view>
  36. <view class="item" v-for="(itm, index) in tableH(mate.rootCategoryLevelId)" :key="index">
  37. <view class="lable rx-cc">{{ itm.label }}</view>
  38. <view class="content">{{ mate[itm.prop] }}</view>
  39. </view>
  40. <view class="item" v-if='mate.isConsumable == 1'>
  41. <view class="lable rx-cc">包装库存</view>
  42. <view class="content">{{ mate.packingCountBase }}/ {{ mate.minUnit}}</view>
  43. </view>
  44. <view class="item rx-sc" v-if='mate.isConsumable == 0'>
  45. <view class="rx ww50">
  46. <view class="lable rx-cc">{{ currentTaskDiagram.isFirstTask == 1 ? '物料重量': '上道重量' }}</view>
  47. <view class="content" v-if="currentTaskDiagram.isFirstTask == 1">
  48. {{mate.extInfo.weight || 0}} {{ mate.extInfo.weightUnit}} </view>
  49. <view class="content" v-if="currentTaskDiagram.isFirstTask == 0">
  50. {{mate.extInfo.newWeight || 0}} {{ mate.extInfo.weightUnit}} </view>
  51. </view>
  52. <view class="rx ww50">
  53. <view class="lable ww80 rx-cc">刻码</view>
  54. <view class="content">{{mate.extInfo.engrave}}</view>
  55. </view>
  56. </view>
  57. <view class="item" v-if='mate.isConsumable == 0'>
  58. <view class="lable rx-cc">物料代号</view>
  59. <view class="content">{{mate.extInfo.materielCode}}</view>
  60. </view>
  61. <view class="item" v-if='mate.isConsumable == 0'>
  62. <view class="lable rx-cc">客户代号</view>
  63. <view class="content">{{mate.extInfo.clientCode}}</view>
  64. </view>
  65. <view class="item" v-if='mate.isConsumable == 0 && deviceList.length > 1'>
  66. <view class="lable rx-cc">设备</view>
  67. <view class="content content_num">
  68. <zxz-uni-data-select :localdata="deviceList" v-model="mate.deviceId" dataValue='id'
  69. format='{name}-{codeNumber}' @change=" e => mate.deviceName = e.name + e.codeNumber"
  70. dataKey="id" filterable :clear='false'></zxz-uni-data-select>
  71. </view>
  72. </view>
  73. <view class="item rx-sc" v-if='mate.isConsumable == 0'>
  74. <view class="rx ww50">
  75. <view class="lable rx-cc">位置</view>
  76. <view class="content content_num ">
  77. <input class="uni-input" v-model='mate.extInfo.position'></input>
  78. </view>
  79. </view>
  80. <view class="rx ww50">
  81. <view class="lable rx-cc ww80">数量</view>
  82. <view class="content content_num ">
  83. <input class="uni-input" v-model="mate.feedQuantity" type="digit"></input>
  84. <view class="unit ">/{{mate.unit}}</view>
  85. </view>
  86. </view>
  87. </view>
  88. <view class="item" v-if='mate.isConsumable == 1'>
  89. <view class="lable rx-cc">数量</view>
  90. <view class="content content_num">
  91. <input class="uni-input" v-model="mate.feedQuantity" type="digit"></input>
  92. <view class="unit">/{{mate.unit}}</view>
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </u-list>
  98. <SearchPopup mode="center" v-if='deviveShow'>
  99. <template v-slot:list>
  100. <view class="search_list">
  101. <u-form labelPosition="left" :model="formData" labelWidth="180" labelAlign="left" class="baseForm">
  102. <u-form-item label="绑定设备:" class="required-form" borderBottom prop="assetType">
  103. <zxz-uni-data-select :localdata="deviceList" v-model="formData.deviceId" dataValue='id'
  104. format='{name}-{codeNumber}' @change="e => formData.deviceName = e.name + e.codeNumber"
  105. dataKey="id" filterable :clear='false'></zxz-uni-data-select>
  106. </u-form-item>
  107. </u-form>
  108. </view>
  109. </template>
  110. <template v-slot:operate>
  111. <view class="operate_box rx-bc">
  112. <u-button size="small" class="u-reset-button" @click="deviceClose">
  113. 取消
  114. </u-button>
  115. <u-button type="success" size="small" class="u-reset-button" @click="deviceOk">
  116. 确定
  117. </u-button>
  118. </view>
  119. </template>
  120. </SearchPopup>
  121. </view>
  122. </template>
  123. <script>
  124. import {
  125. tableHeader
  126. } from './feedBom.js'
  127. import SearchPopup from '../../components/searchPopup.vue'
  128. export default {
  129. components: {
  130. SearchPopup
  131. },
  132. props: {
  133. workOrderId: {
  134. type: String,
  135. default: ''
  136. },
  137. list: {
  138. type: Array,
  139. default: () => []
  140. },
  141. equipmentList: {
  142. type: Array,
  143. default: () => []
  144. },
  145. currentTaskDiagram: {
  146. type: Object,
  147. default: () => {}
  148. },
  149. },
  150. watch: {
  151. equipmentList: {
  152. immediate: true,
  153. deep: true,
  154. handler(newVal) {
  155. this.deviceList = newVal
  156. }
  157. },
  158. },
  159. data() {
  160. return {
  161. deviceList: [],
  162. deviveShow: false,
  163. formData: {
  164. deviceId: null,
  165. deviceName: null,
  166. }
  167. }
  168. },
  169. created() {
  170. },
  171. methods: {
  172. tableH(type) {
  173. return tableHeader(type)
  174. },
  175. getDelete(idx) {
  176. this.list.splice(idx, 1)
  177. },
  178. scrolltolower() {},
  179. handleCheck(idx, it) {
  180. this.$set(this.list[idx], 'check', !it.check)
  181. },
  182. bindDevice() {
  183. this.deviveShow = true
  184. },
  185. deviceOk() {
  186. let arr = this.list.filter(e => {
  187. return e.check
  188. })
  189. if (arr.length <= 0) {
  190. uni.showToast({
  191. icon: 'none',
  192. title: '请先勾选半成品'
  193. })
  194. return false
  195. }
  196. if (!this.formData.deviceId) {
  197. uni.showToast({
  198. icon: 'none',
  199. title: '请先选择设备'
  200. })
  201. return false
  202. }
  203. this.list.forEach(e => {
  204. if (e.check) {
  205. e['deviceId'] = this.formData.deviceId
  206. e['deviceName'] = this.formData.deviceName
  207. }
  208. })
  209. this.$forceUpdate()
  210. this.deviceClose()
  211. },
  212. deviceClose() {
  213. this.formData.deviceName = null
  214. this.formData.deviceId = null
  215. this.deviveShow = false
  216. },
  217. }
  218. }
  219. </script>
  220. <style lang="scss" scoped>
  221. .title_box {
  222. margin-top: 20rpx;
  223. .name {
  224. font-size: 28rpx;
  225. font-style: normal;
  226. font-weight: 400;
  227. color: $theme-color;
  228. padding-left: 20rpx;
  229. position: relative;
  230. &:before {
  231. position: absolute;
  232. content: '';
  233. left: 0rpx;
  234. top: 0rpx;
  235. bottom: 0rpx;
  236. width: 4rpx;
  237. height: 28rpx;
  238. background: $theme-color;
  239. margin: auto;
  240. }
  241. }
  242. .btn_box {
  243. padding: 0 18rpx;
  244. height: 48rpx;
  245. background: $theme-color;
  246. font-size: 26rpx;
  247. font-style: normal;
  248. font-weight: 400;
  249. font-size: 24rpx;
  250. color: #fff;
  251. border-radius: 4rpx;
  252. .scan {
  253. width: 34rpx;
  254. height: 34rpx;
  255. margin-right: 12rpx;
  256. }
  257. }
  258. }
  259. .material {
  260. margin-top: 10rpx;
  261. .left {
  262. width: 40rpx;
  263. }
  264. .zdy_check {
  265. width: 30rpx;
  266. height: 30rpx;
  267. border: 2rpx solid #c8c9cc;
  268. border-radius: 4rpx;
  269. }
  270. .check_active {
  271. background: $theme-color;
  272. border: 2rpx solid $theme-color;
  273. /deep/ .u-icon__icon {
  274. color: #fff !important;
  275. }
  276. }
  277. .content_table {
  278. width: 680rpx;
  279. border: 2rpx solid $border-color;
  280. .item {
  281. display: flex;
  282. border-bottom: 2rpx solid $border-color;
  283. .lable {
  284. width: 132rpx;
  285. text-align: center;
  286. background-color: #F7F9FA;
  287. font-size: 26rpx;
  288. border-right: 2rpx solid $border-color;
  289. flex-shrink: 0;
  290. }
  291. .ww80 {
  292. width: 80rpx;
  293. }
  294. .content {
  295. width: 518rpx;
  296. min-height: 64rpx;
  297. font-size: 28rpx;
  298. line-height: 28rpx;
  299. font-style: normal;
  300. font-weight: 400;
  301. padding: 18rpx 8rpx;
  302. box-sizing: border-box;
  303. word-wrap: break-word;
  304. flex-grow: 1 !important;
  305. }
  306. .content_num {
  307. display: flex;
  308. align-items: center;
  309. padding: 0 4rpx;
  310. /deep/ .uni-input-input {
  311. width: 200rpx;
  312. border: 2rpx solid #F0F8F2;
  313. background: #F0F8F2;
  314. color: $theme-color;
  315. }
  316. .unit {
  317. padding: 0 4rpx;
  318. font-size: 24rpx;
  319. color: #404446;
  320. }
  321. }
  322. .ww400 {
  323. /deep/ .uni-input-input {
  324. width: 400rpx;
  325. }
  326. }
  327. .pd4 {
  328. padding: 4rpx 8rpx;
  329. }
  330. &:last-child {
  331. border-bottom: none;
  332. }
  333. }
  334. .ww55 {
  335. width: 55%;
  336. }
  337. .ww45 {
  338. width: 45%;
  339. }
  340. .ww50 {
  341. width: 50%;
  342. }
  343. .ww80 {
  344. width: 80%;
  345. }
  346. .ww20 {
  347. width: 20%;
  348. }
  349. .check {
  350. width: 30rpx;
  351. height: 30rpx;
  352. }
  353. }
  354. }
  355. .z_list {
  356. max-height: 2000rpx;
  357. }
  358. .search_list {
  359. min-height: 100rpx;
  360. width: 90vw;
  361. /deep/ .baseForm {
  362. padding: 0 20rpx;
  363. }
  364. }
  365. .operate_box {
  366. padding: 10rpx 32rpx;
  367. /deep/ .u-button {
  368. width: 40%;
  369. }
  370. }
  371. </style>