sampleBom.vue 8.7 KB

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