outassembleDtlNew.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view>
  3. <view class="uni-form-item uni-column">
  4. <view class="uni-flex uni-row">
  5. <view class="title" style="width: 190rpx;">生产令号:</view>
  6. <input class="uni-input" style="font-size: 40rpx;font-weight: bold;color: black;" disabled="true" v-model="bomNo"/>
  7. </view>
  8. <view class="uni-flex uni-row" style="margin-top: 3px;margin-bottom: 3px;">
  9. <view class="title" style="width: 190rpx;">规格型号\图号:</view>
  10. <input class="uni-input" style="margin-right: 5px;" :focus="foucusIndex === 0" v-model="materialSpecCode" placeholder="请输入规格型号\图号" @confirm="confirmFun"/>
  11. </view>
  12. <view class="uni-flex uni-row">
  13. <button type="primary" style="-webkit-flex: 1;flex: 1;margin-left: 5px;" @click="queryFun">查 询</button>
  14. <button type="primary" style="-webkit-flex: 1;flex: 1;margin-left: 5px;margin-right: 5px;" @click="resetCondition">重 置</button>
  15. </view>
  16. </view>
  17. <uni-section title="关键件清单数据:" type="line" style="margin-bottom: 3px;padding: 3px;">
  18. <view class="my-tips-view" v-if="isShowTips">没有查询到关键件清单数据......</view><uni-pagination :total="total" :current="current" :pageSize="pageSize" @change="pageChange" title="标题文字" v-if="!isShowTips" style="margin: 4px;"/>
  19. <view v-if="!isShowTips" style="text-align: center;">
  20. <text class="example-info">数据总量:{{ total }}条,每页数据:{{ pageSize }}</text>
  21. </view>
  22. <view v-for="(newsitem,key) in sapOutTaskList" :key="key">
  23. <view class="myDeliverDetail" @click="myDeliverDetailClick(newsitem)">
  24. <view style="flex-direction: row;flex-direction: row;height: 25px;display: flex;padding: 2px;border-radius: 5px 5px;">
  25. <text style="align-self: center;">物料编号:</text>
  26. <text style="align-self: center;font-size: 30rpx;font-weight: bold;">{{newsitem.materialCode}}</text>
  27. <!-- <text :class="newsitem.keyFlag ? 'keyFlagRed' : 'keyFlagGray'" style="align-self: center;margin-left: 20px;">{{newsitem.keyFlag ? '★' : '■'}}</text> -->
  28. </view>
  29. <view class="line-h"></view>
  30. <view style="flex-direction: row;flex-direction: row;display: flex;-webkit-justify-content: space-between;justify-content: space-between;">
  31. <view>
  32. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  33. <text style="align-self: center;color: #555;font-size: 25rpx;">物料名称:</text>
  34. <text style="align-self: center;font-size: 25rpx;word-wrap: break-word;width: 200px;">{{newsitem.materialName}}</text>
  35. </view>
  36. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  37. <text style="align-self: center;color: #555;font-size: 25rpx;">规格型号/图号:</text>
  38. <text style="align-self: center;font-size: 35rpx;font-weight: bold;color: blue;word-wrap: break-word;width: 200px;">{{newsitem.materialSpec}}</text>
  39. </view>
  40. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  41. <text style="align-self: center;color: #555;font-size: 25rpx;">生产令号:</text>
  42. <text style="align-self: center;font-size: 35rpx;font-weight: bold;color: blue;word-wrap: break-word;width: 200px;">{{newsitem.bomNo}}</text>
  43. </view>
  44. <!-- <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  45. <text style="align-self: center;color: #555;font-size: 25rpx;">BN/SN:</text>
  46. <text style="align-self: center;font-size: 30rpx;font-weight: bold;word-wrap: break-word;width: 200px;">{{newsitem.bnSnCode}}</text>
  47. </view> -->
  48. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  49. <text style="align-self: center;color: #555;font-size: 25rpx;">装配需求数量:</text>
  50. <text style="align-self: center;font-size: 30rpx;font-weight: bold;">{{newsitem.qty}}</text>
  51. </view>
  52. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  53. <text style="align-self: center;color: #555;font-size: 25rpx;">已装配数量:</text>
  54. <text style="align-self: center;font-size: 35rpx;font-weight: bold;color: red;">{{newsitem.assembleQty}}</text>
  55. </view>
  56. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  57. <text style="align-self: center;color: #555;font-size: 25rpx;">创建人:</text>
  58. <text style="align-self: center;font-size: 30rpx;">{{newsitem.createBy}}</text>
  59. </view>
  60. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  61. <text style="align-self: center;color: #555;font-size: 25rpx;">创建时间:</text>
  62. <text style="align-self: center;font-size: 30rpx;">{{newsitem.createTime}}</text>
  63. </view>
  64. </view>
  65. <view v-if="newsitem.assembleQty < newsitem.qty" style="border-radius: 35px;width: 35px; background-color: lime;height: 35px;align-self: center;margin-right: 5px;"></view>
  66. <view v-else style="border-radius: 35px;width: 35px; background-color: lightgray;height: 35px;align-self: center;margin-right: 5px;"></view>
  67. </view>
  68. </view>
  69. </view>
  70. </uni-section>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. bomNo: '',
  78. foucusIndex: 0,
  79. materialSpecCode: '',
  80. isShowTips: true,
  81. sapOutTaskList:[],
  82. current: 1,
  83. total: 0,
  84. pageSize: 10,
  85. }
  86. },
  87. onLoad(option) {
  88. this.bomNo = option.bomNo;
  89. this.queryFun()
  90. uni.$on('addAssembleDtlData', this.addAssembleDtlData)
  91. },
  92. onUnload() {
  93. uni.$off('addAssembleDtlData', this.addAssembleDtlData)
  94. },
  95. methods: {
  96. async queryFun() {
  97. // if(this.isEmptyStr(this.materialSpecCode)) {
  98. // uni.showToast({
  99. // title: '物料信息 不能为空!',
  100. // icon: 'none',
  101. // duration: 1500,
  102. // mask:true,
  103. // })
  104. // this.foucusIndex = 1
  105. // setTimeout(() => {
  106. // this.foucusIndex = 0;
  107. // }, 100)
  108. // return
  109. // }
  110. uni.showLoading({
  111. title: "正在查询...",
  112. mask: true,
  113. })
  114. this.sapOutTaskList = []
  115. let parm = {
  116. url : '/business/SapBomRecord/QuerySapBomRecordListForMaterialSpec',
  117. data: {
  118. BomNo: this.bomNo,
  119. MaterialSpec: this.materialSpecCode,
  120. PageNum: this.current,
  121. PageSize: this.pageSize
  122. },
  123. method: 'POST',
  124. isHaveToken : true
  125. }
  126. let retData = await getApp().RequestData(parm)
  127. // console.log(retData)
  128. if(retData.isSuccess) {
  129. if(retData.data.code == 200) {
  130. let len = retData.data.data.result.length
  131. this.total = retData.data.data.totalNum
  132. this.sapOutTaskList = retData.data.data.result
  133. if(len > 0) {
  134. this.isShowTips = false
  135. }
  136. else {
  137. this.isShowTips = true
  138. this.resetCondition()
  139. }
  140. }
  141. else {
  142. this.isShowTips = true
  143. this.resetCondition()
  144. }
  145. }
  146. else {
  147. this.isShowTips = true
  148. this.resetCondition()
  149. }
  150. uni.hideLoading()
  151. },
  152. resetCondition() {
  153. this.foucusIndex++
  154. // console.log(this.foucusIndex)
  155. this.materialSpecCode = ''
  156. this.sapOutTaskList = []
  157. this.isShowTips = true
  158. setTimeout(() => {
  159. this.foucusIndex = 0;
  160. // console.log('额呵呵呵!!!')
  161. }, 150)
  162. // this.foucusIndex = 0;
  163. },
  164. isEmptyStr(s) {
  165. if (s == undefined || s === '') {
  166. return true
  167. }
  168. return false
  169. },
  170. myDeliverDetailClick(model) {
  171. model.bomNo = this.bomNo;
  172. if(model.assembleQty >= model.qty) {
  173. uni.showToast({
  174. title: '已全部装配完成',
  175. icon: 'error',
  176. mask: true,
  177. duration: 1500
  178. })
  179. } else {
  180. uni.navigateTo({
  181. url: '/pages/Outstore/outassembleOperate',
  182. success() {
  183. uni.$emit('sendCheckedDeliverDtlData',model)
  184. // console.log(model)
  185. }
  186. });
  187. }
  188. },
  189. addAssembleDtlData(data) {
  190. // console.log(data)
  191. this.sapOutTaskList.forEach((item) => {
  192. if(item.id === data.id) {
  193. item.assembleQty += Number(data.assembleNum);
  194. }
  195. })
  196. let isFinish = this.sapOutTaskList.some(x => x.assembleQty < x.qty)
  197. if(!isFinish) {
  198. // console.log(111)
  199. this.resetCondition()
  200. // console.log(1221)
  201. }
  202. else {
  203. this.queryFun()
  204. }
  205. },
  206. confirmFun() {
  207. this.queryFun()
  208. },
  209. pageChange(e) {
  210. this.current = e.current
  211. this.queryFun()
  212. }
  213. }
  214. }
  215. </script>
  216. <style lang="scss">
  217. .my-tips-view {
  218. /* margin-top: 50px; */
  219. text-align: center;
  220. color: #999999;
  221. font-size: 20px;
  222. font-weight: normal;
  223. }
  224. .myDeliverDetail {
  225. border: 1px solid #cccccc;
  226. border-radius: 5px;
  227. margin-top: 1px;
  228. }
  229. .myDeliverDetail:active {
  230. background-color: aliceblue;
  231. }
  232. .line-h {
  233. height: 1rpx;
  234. background-color: #cccccc;
  235. }
  236. .keyFlagRed {
  237. color: red;
  238. }
  239. .keyFlagGray {
  240. color: lightgray;
  241. }
  242. </style>