sampleBom.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <template>
  2. <view>
  3. <view class="title_box rx-bc">
  4. <view class="name">取样</view>
  5. </view>
  6. <view class="material ">
  7. <view class="content_table">
  8. <view class="item">
  9. <view class="lable rx-cc">工序名称</view>
  10. <view class="content">
  11. {{item.diagramLast.taskTypeName}}
  12. </view>
  13. </view>
  14. <view class="item rx-sc">
  15. <view class="rx ww55 ">
  16. <view class="lable rx-cc">数量</view>
  17. <view class="content rx-sc">
  18. <view>{{item.formedNum}}</view>
  19. <view class="unit">{{item.unit}}</view>
  20. </view>
  21. </view>
  22. <view class="rx ww45">
  23. <view class="lable rx-cc ww80">重量</view>
  24. <view class="content content_num">
  25. <view>{{item.formedWeight}}</view>
  26. <view class="unit">{{item.weightUnit}}</view>
  27. </view>
  28. </view>
  29. </view>
  30. <view class="item">
  31. <view class="lable rx-cc">取样数量</view>
  32. <view class="content content_num rx-sc">
  33. <view style='width: 300rpx;'>{{ item.sampleNum }}</view>
  34. <view class="unit">{{item.unit}}</view>
  35. <view class="penalize" v-if='!isDetails' @click="penalize">处置
  36. </view>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="content_table2" v-if="item.sampleList.length > 0">
  41. <view class="head row rx-sc">
  42. <view class="item ww15">类型</view>
  43. <view class="item ww20">数量</view>
  44. <view class="item ww55">处置</view>
  45. <view class="item ww15">操作</view>
  46. </view>
  47. <view class="table">
  48. <view class="tr row rx-sc" v-for="(it, index) in item.sampleList" :key='index'>
  49. <view class="item ww15 content_num">
  50. {{ it.selectType == 1 ? '回用' : it.selectType == 2 ? '入库' : '' }}
  51. </view>
  52. <view class="item ww20 content_num">
  53. <input class="uni-input" v-if='!isDetails' v-model="it.num" @input="hendleReuseNum(it)"></input>
  54. <view v-else> {{ it.num }}</view>
  55. </view>
  56. <view class="item ww55 content_num">
  57. <zxz-uni-data-select :localdata="warehouseList" :disabled="isDetails"
  58. v-if='it.selectType != 1' v-model="it.warehouseId" dataValue='id' dataKey="name"
  59. filterable format='{name}'></zxz-uni-data-select>
  60. <view v-if="it.selectType == 1" class="turnover_btn"> </view>
  61. </view>
  62. <view class="item ww15">
  63. <view class="left rx-ss" @click="getDelete(index)">
  64. <uni-icons custom-prefix="iconfont" v-if="!isDetails" type="icon-shanchu" size="20"
  65. color="#fa3534"></uni-icons>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <view class="title_box rx-bc" v-if="isDetails">
  73. <view class="name">报工</view>
  74. </view>
  75. <view class="material " v-if="isDetails">
  76. <view class="content_table">
  77. <view class="item">
  78. <view class="lable rx-cc">合格数量</view>
  79. <view class="content content_num">
  80. <input class="uni-input" v-model="workReportInfo.formedNum" type='digit'></input>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <u-popup :show="show" mode='center' v-if='show' :closeOnClickOverlay='false'>
  86. <view class="popup_box">
  87. <uni-data-select v-model="selectType" :localdata="rangeList"></uni-data-select>
  88. <view class="operate_box rx-sc">
  89. <u-button size="small" class="u-reset-button" @click="cancel">取消</u-button>
  90. <u-button size="small" class="u-reset-button" type="success" @click="save">确定</u-button>
  91. </view>
  92. </view>
  93. </u-popup>
  94. </view>
  95. </template>
  96. <script>
  97. import {
  98. getWarehouseList,
  99. } from '@/api/pda/workOrder.js'
  100. export default {
  101. components: {
  102. },
  103. props: {
  104. item: {
  105. type: Object,
  106. default: () => {}
  107. },
  108. workReportInfo: {
  109. type: Object,
  110. default: () => {}
  111. },
  112. isDetails: {
  113. type: Boolean,
  114. default: false
  115. },
  116. turnoverList: {
  117. type: Array,
  118. default: () => []
  119. }
  120. },
  121. watch: {
  122. turnoverList: {
  123. immediate: true,
  124. deep: true,
  125. handler(newVal) {
  126. console.log(newVal)
  127. this.turnoverCount = 0
  128. newVal.forEach(f => {
  129. if (f.extInfo && f.extInfo.positionList && f.extInfo.positionList.length > 0) {
  130. f.extInfo.positionList.forEach(o => {
  131. if (Object.prototype.hasOwnProperty.call(o, 'sampleNum')) {
  132. this.turnoverCount = this.turnoverCount + Number(o.sampleNum)
  133. this.$set(this.item, 'sampleNum', this.turnoverCount)
  134. }
  135. })
  136. }
  137. })
  138. }
  139. }
  140. },
  141. data() {
  142. return {
  143. warehouseList: [],
  144. show: false,
  145. selectType: null,
  146. rangeList: [{
  147. value: 1,
  148. text: "回用"
  149. },
  150. {
  151. value: 2,
  152. text: "入库"
  153. },
  154. {
  155. value: 3,
  156. text: "损耗"
  157. }
  158. ],
  159. turnoverCount: 0
  160. }
  161. },
  162. created() {
  163. this.getWarehouseListFn()
  164. },
  165. methods: {
  166. getWarehouseListFn() {
  167. getWarehouseList().then(res => {
  168. this.warehouseList = res
  169. })
  170. },
  171. cancel() {
  172. this.selectType = null
  173. this.show = false
  174. },
  175. penalize() {
  176. if (Number(this.item.sampleNum <= 0)) {
  177. uni.showToast({
  178. icon: 'none',
  179. title: '取样数量要大于0, 请先选择周转车'
  180. })
  181. return false
  182. }
  183. this.show = true
  184. },
  185. save() {
  186. this.show = false
  187. if (this.selectType) {
  188. if(this.selectType == 1) {
  189. let isFals = this.item.sampleList.some(m => m.selectType == 1)
  190. if(isFals) {
  191. uni.showToast({
  192. icon: 'none',
  193. title: '已经存在回用类型'
  194. })
  195. return false
  196. } else {
  197. this.$set(this.item, 'showReuseTurnover', true)
  198. this.item.sampleList.push({
  199. selectType: this.selectType,
  200. num: null,
  201. warehouseId: null
  202. })
  203. }
  204. } else {
  205. this.item.sampleList.push({
  206. selectType: this.selectType,
  207. num: null,
  208. warehouseId: null
  209. })
  210. }
  211. } else {
  212. uni.showToast({
  213. icon: 'none',
  214. title: '请先选项处置方法'
  215. })
  216. }
  217. },
  218. getDelete(idx) {
  219. this.item.sampleList.splice(idx, 1)
  220. },
  221. hendleReuseNum(it) {
  222. if(it.selectType == 1) {
  223. this.$set(this.item, 'reuseNum', it.num)
  224. }
  225. },
  226. }
  227. }
  228. </script>
  229. <style lang="scss" scoped>
  230. .title_box {
  231. margin-top: 28rpx;
  232. .name {
  233. font-size: 28rpx;
  234. font-style: normal;
  235. font-weight: 400;
  236. color: $theme-color;
  237. padding-left: 20rpx;
  238. position: relative;
  239. &:before {
  240. position: absolute;
  241. content: '';
  242. left: 0rpx;
  243. top: 0rpx;
  244. bottom: 0rpx;
  245. width: 4rpx;
  246. height: 28rpx;
  247. background: $theme-color;
  248. margin: auto;
  249. }
  250. }
  251. .btn_box {
  252. padding: 0 18rpx;
  253. height: 60rpx;
  254. background: $theme-color;
  255. font-size: 26rpx;
  256. font-style: normal;
  257. font-weight: 400;
  258. font-size: 24rpx;
  259. color: #fff;
  260. border-radius: 4rpx;
  261. .scan {
  262. width: 34rpx;
  263. height: 34rpx;
  264. margin-right: 12rpx;
  265. }
  266. }
  267. }
  268. .material {
  269. margin-top: 10rpx;
  270. .content_table {
  271. width: 100%;
  272. border: 2rpx solid $border-color;
  273. .item {
  274. display: flex;
  275. border-bottom: 2rpx solid $border-color;
  276. .lable {
  277. width: 156rpx;
  278. text-align: center;
  279. background-color: #F7F9FA;
  280. font-size: 26rpx;
  281. border-right: 2rpx solid $border-color;
  282. flex-shrink: 0;
  283. }
  284. .lable150 {
  285. width: 156rpx !important;
  286. font-size: 24rpx;
  287. }
  288. .ww80 {
  289. width: 80rpx;
  290. }
  291. .content {
  292. width: 518rpx;
  293. min-height: 64rpx;
  294. font-size: 28rpx;
  295. line-height: 28rpx;
  296. font-style: normal;
  297. font-weight: 400;
  298. padding: 18rpx 8rpx;
  299. box-sizing: border-box;
  300. word-wrap: break-word;
  301. flex-grow: 1 !important;
  302. .unit {
  303. padding: 0 4rpx;
  304. font-size: 24rpx;
  305. color: #404446;
  306. }
  307. .penalize {
  308. width: 200rpx;
  309. line-height: 60rpx;
  310. background: $theme-color;
  311. font-size: 24rpx;
  312. text-align: center;
  313. color: #fff;
  314. }
  315. }
  316. .pd4 {
  317. padding: 4rpx 8rpx;
  318. }
  319. &:last-child {
  320. border-bottom: none;
  321. }
  322. }
  323. .ww55 {
  324. width: 55%;
  325. }
  326. .ww45 {
  327. width: 45%;
  328. }
  329. }
  330. .content_table2 {
  331. width: 100%;
  332. margin-top: 8rpx;
  333. .row {
  334. width: 100%;
  335. .item {
  336. padding: 8rpx 0;
  337. color: #404446;
  338. font-size: 28rpx;
  339. padding-left: 12rpx;
  340. }
  341. .left {
  342. width: 40rpx;
  343. }
  344. .ww30 {
  345. width: 30%;
  346. }
  347. .ww20 {
  348. width: 20%;
  349. }
  350. .ww35 {
  351. width: 35%;
  352. }
  353. .ww55 {
  354. width: 55%;
  355. }
  356. .ww15 {
  357. width: 15%;
  358. }
  359. .turnover_btn{
  360. color: $theme-color;
  361. font-size: 24rpx;
  362. padding-left: 12rpx;
  363. }
  364. }
  365. .head {
  366. height: 64rpx;
  367. background: #F7F9FA;
  368. border-top: 2rpx solid #E3E5E5;
  369. border-left: 2rpx solid #E3E5E5;
  370. .item {
  371. height: 64rpx;
  372. line-height: 64rpx;
  373. border-right: 2rpx solid #E3E5E5;
  374. box-sizing: border-box;
  375. }
  376. }
  377. .tr {
  378. border-top: 2rpx solid #E3E5E5;
  379. border-left: 2rpx solid #E3E5E5;
  380. .item {
  381. font-size: 24rpx;
  382. min-height: 78rpx;
  383. display: flex;
  384. align-items: center;
  385. border-right: 2rpx solid #E3E5E5;
  386. box-sizing: border-box;
  387. white-space: normal;
  388. word-break: break-all;
  389. }
  390. &:last-child {
  391. border-bottom: 2rpx solid #E3E5E5;
  392. }
  393. }
  394. }
  395. }
  396. .content_num {
  397. display: flex;
  398. align-items: center;
  399. padding: 0 4rpx;
  400. box-sizing: border-box;
  401. /deep/ .uni-input-input {
  402. border: 2rpx solid #F0F8F2;
  403. min-width: 100rpx;
  404. background: #F0F8F2;
  405. color: $theme-color;
  406. box-sizing: border-box;
  407. }
  408. }
  409. .popup_box {
  410. width: 78vw;
  411. padding: 32rpx;
  412. }
  413. .operate_box {
  414. margin-top: 32rpx;
  415. padding: 10rpx 100rpx;
  416. /deep/ .u-button {
  417. width: 160rpx;
  418. }
  419. }
  420. </style>