PrintLabelOperate.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view style="padding: 3px;">
  3. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;margin-top: 5px;">
  4. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">交验单号:</text>
  5. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{deliverDtlMd.deliverNo}}</text>
  6. </view>
  7. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  8. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">采购订单:</text>
  9. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{deliverDtlMd.purchaseOrder}}</text>
  10. </view>
  11. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  12. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">物料号:</text>
  13. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{deliverDtlMd.materialCode}}</text>
  14. </view>
  15. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  16. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">物料名称:</text>
  17. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{deliverDtlMd.materialName}}</text>
  18. </view>
  19. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 2px;">
  20. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">规格型号/图号:</text>
  21. <text style="align-self: center;font-size: 35rpx;word-wrap: break-word;width: 200px;font-weight: bold;">{{deliverDtlMd.materialSpec}}</text>
  22. </view>
  23. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px;">
  24. <text style="align-self: center;font-size: 35rpx;color: darkslategray;">交验单数量:</text>
  25. <text style="align-self: center;font-size: 40rpx;font-weight: bold;">{{deliverDtlMd.qty}}</text>
  26. </view>
  27. <view class="text" style="align-self: center;font-size: 35rpx;color: darkslategray;padding: 1px;">BN/SN 生成模式:</view>
  28. <uni-data-checkbox style="align-self: center;font-size: 35rpx;padding: 5px;" v-model="radio1" :localdata="sex" @change="change"></uni-data-checkbox>
  29. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px; ">
  30. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 250rpx;">BN码(批次号):</text>
  31. <input class="uni-input" style="margin-right: 5px;font-size: 40rpx;font-weight: bold;" :disabled="isBnInputDisabled" v-model="BnCode" :focus="foucusIndex === 0" placeholder="请输入BN码(批次号)" />
  32. </view>
  33. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px; ">
  34. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 250rpx;">SN码(序列号):</text>
  35. <input class="uni-input" style="margin-right: 5px;font-size: 40rpx;font-weight: bold;" :disabled="isSnInputDisabled" v-model="SnCode" :focus="foucusIndex === 1" placeholder="请输入SN码(序列号)" />
  36. </view>
  37. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px; ">
  38. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 250rpx;">标签默认数量:</text>
  39. <input class="uni-input" type="number" style="margin-right: 5px;font-size: 40rpx;font-weight: bold;" v-model="PrintShowQty"/>
  40. </view>
  41. <view style="flex-direction: row;flex-direction: row;display: flex;padding: 1px; ">
  42. <text style="align-self: center;font-size: 35rpx;color: darkslategray;width: 250rpx;">标签打印张数:</text>
  43. <input class="uni-input" type="number" style="margin-right: 5px;font-size: 40rpx;font-weight: bold;" v-model="PrintLabelNum"/>
  44. </view>
  45. <button type="primary" style="margin-top: 4px;" @click="resetCondition">重 置</button>
  46. <button type="primary" style="margin-top: 4px;" @click="submitResult">打印标签</button>
  47. </view>
  48. </template>
  49. <script>
  50. export default {
  51. data() {
  52. return {
  53. radio1: 0,
  54. deliverDtlMd: {},
  55. SnCode: '',
  56. BnCode: '',
  57. PrintLabelNum: 1,
  58. PrintShowQty: 1,
  59. foucusIndex: 1,
  60. sex: [{
  61. text: '系统自动生成',
  62. value: 0
  63. }, {
  64. text: '扫码生成',
  65. value: 1
  66. }],
  67. isBnInputDisabled: true,
  68. isSnInputDisabled: true
  69. }
  70. },
  71. onUnload() {
  72. },
  73. onLoad() {
  74. uni.$once('sendDeliverDtlData', (data) => {
  75. this.deliverDtlMd = data
  76. })
  77. if(!this.radio1) {
  78. this.isSnInputDisabled = true
  79. this.isBnInputDisabled = true
  80. this.foucusIndex = 2
  81. }
  82. else {
  83. this.isSnInputDisabled = false
  84. this.isBnInputDisabled = false
  85. this.foucusIndex = 0
  86. }
  87. },
  88. methods: {
  89. async submitResult() {
  90. if(this.radio1){
  91. if(this.isEmptyStr(this.BnCode)) {
  92. uni.showToast({
  93. title: 'BN码不能为空!',
  94. icon: 'none',
  95. duration: 1000
  96. })
  97. return;
  98. }
  99. if(this.isEmptyStr(this.SnCode)) {
  100. uni.showToast({
  101. title: 'SN码不能为空!',
  102. icon: 'none',
  103. duration: 1000
  104. })
  105. return;
  106. }
  107. }
  108. let tmpMd = {};
  109. tmpMd.Mc = this.deliverDtlMd.materialCode;
  110. tmpMd.Pn = this.deliverDtlMd.materialSpec;
  111. tmpMd.Name = this.deliverDtlMd.materialName;
  112. tmpMd.Qty = this.deliverDtlMd.qty;
  113. tmpMd.Unit = "";
  114. tmpMd.Po = this.deliverDtlMd.purchaseOrder;
  115. tmpMd.BnOrSnGenerationMode = !Boolean(this.radio1);
  116. tmpMd.PrintLabelNum = this.PrintLabelNum;
  117. tmpMd.PrintShowQty = this.PrintShowQty;
  118. if(this.radio1) {
  119. tmpMd.Sn = this.SnCode;
  120. tmpMd.Bn = this.BnCode;
  121. }
  122. let parm = {
  123. url : '/business/SapDeliverRecord/AddPrintLabelRecord',
  124. data: tmpMd,
  125. method: 'POST',
  126. isHaveToken : true
  127. }
  128. let retData = await getApp().RequestData(parm)
  129. if(retData.isSuccess) {
  130. if(retData.data.code == 200) {
  131. uni.showLoading({
  132. title: '发送打印数据成功!!',
  133. mask: true
  134. });
  135. setTimeout(function () {
  136. uni.hideLoading();
  137. uni.navigateBack({
  138. url: '/pages/Inspect/PrintLabelDtl'
  139. });
  140. }, 1000);
  141. }
  142. else {
  143. uni.showToast({
  144. title: '提交数据失败!' + retData.data.msg,
  145. icon: 'none',
  146. duration: 1000,
  147. mask: true
  148. })
  149. }
  150. }
  151. else {
  152. uni.showToast({
  153. title: '接口异常!' + retData.retMsg,
  154. icon: 'none',
  155. duration: 1000,
  156. mask: true
  157. })
  158. }
  159. },
  160. isEmptyStr(s) {
  161. if (s == undefined || s === '') {
  162. return true
  163. }
  164. return false
  165. },
  166. resetCondition() {
  167. this.SnCode = ''
  168. this.BnCode = ''
  169. this.radio1 = 0
  170. },
  171. change(e){
  172. if(!this.radio1) {
  173. this.isBnInputDisabled = true
  174. this.isSnInputDisabled = true
  175. this.foucusIndex = 2
  176. }
  177. else {
  178. this.isBnInputDisabled = false
  179. this.isSnInputDisabled = false
  180. setTimeout(() => {
  181. this.foucusIndex = 0;
  182. }, 150)
  183. }
  184. }
  185. }
  186. }
  187. </script>
  188. <style lang="scss">
  189. @import '@/common/uni-nvue.css';
  190. </style>