sampleBom.vue 8.2 KB

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