details.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="bg-f9 lineManagement">
  3. <header-bar :title="submitType === 'add' ? '线边详情' : '线边详情'"></header-bar>
  4. <view class="commons-dtl-box">
  5. <view class="">
  6. <span>产线名称</span> 车间/3ml生产线
  7. </view>
  8. <view class="">
  9. <span>产品名称</span> pp 原料
  10. </view>
  11. <view class="">
  12. <span>线边数量</span> 8000
  13. </view>
  14. </view>
  15. <view style="line-height: 60rpx;font-size: 24rpx;padding: 0 20rpx;">
  16. 今日统计
  17. </view>
  18. <view class="today-num" style="border-bottom: 1px solid #dcdcdc;">
  19. <p>今日领料</p>
  20. <span>3000</span>
  21. </view>
  22. <view class="today-num">
  23. <p>今日消耗</p>
  24. <span>3000</span>
  25. </view>
  26. <view style="line-height: 60rpx;font-size: 24rpx;padding: 0 20rpx;">
  27. 今日明细
  28. </view>
  29. <ul>
  30. <li>
  31. <view>
  32. <span>操作人</span> 张三
  33. </view>
  34. <view>
  35. <span>操作时间</span> 2032-22-11
  36. </view>
  37. <view>
  38. <span>领料数量</span> 1500
  39. </view>
  40. </li>
  41. <li>
  42. <view>
  43. <span>操作人</span> 张三
  44. </view>
  45. <view>
  46. <span>操作时间</span> 2032-22-11
  47. </view>
  48. <view>
  49. <span>领料数量</span> 1500
  50. </view>
  51. </li>
  52. </ul>
  53. <view style="height:200rpx">
  54. </view>
  55. <button class="submit" @click="toSubmit">消耗登记</button>
  56. </view>
  57. </template>
  58. <script>
  59. import headerBar from '../../../components/header-bar/index.vue'
  60. import {formateObjToParamStr} from '../../../util/uitl.js'
  61. import Vue from 'vue'
  62. export default {
  63. components: {
  64. headerBar
  65. },
  66. data() {
  67. return {
  68. form: {
  69. name: '',
  70. type: null,
  71. classifyId: null,
  72. code: null,
  73. unit: null,
  74. introduce: null,
  75. },
  76. types: [{
  77. text: '半成品',
  78. value: '0'
  79. }, {
  80. text: '成品',
  81. value: '1'
  82. }],
  83. rules: {
  84. // 对name字段进行必填验证
  85. name: {
  86. rules: [{
  87. required: true,
  88. errorMessage: '请输入产品名称',
  89. }, ]
  90. },
  91. // 对email字段进行必填验证
  92. type: {
  93. rules: [{
  94. required: true,
  95. errorMessage: '请选择工作人员',
  96. }, ]
  97. },
  98. unit: {
  99. rules: [{
  100. required: true,
  101. errorMessage: '请输入完工数量',
  102. }, ]
  103. },
  104. num: {
  105. rules: [{
  106. required: true,
  107. errorMessage: '请输入本次入库',
  108. }, ]
  109. },
  110. },
  111. submitType: 'add',
  112. treeData: [],
  113. }
  114. },
  115. onLoad(e) {
  116. if (e.id) {
  117. this.form.id = e.id
  118. this.form.remarks = e.remarks
  119. this.form.type = e.type
  120. this.form.name = e.name
  121. this.submitType = 'edit'
  122. }
  123. this.getTree()
  124. },
  125. methods: {
  126. toSubmit(){
  127. uni.navigateTo({
  128. url: '/pages/lineManagement/submit?' + formateObjToParamStr(this.form)
  129. })
  130. },
  131. treeChange() {},
  132. getTree() {
  133. const v = this
  134. v.$post('/api/basics//classify/tree', {
  135. type: 1
  136. }).then(res => {
  137. if (res.code === 200) {
  138. v.treeData = res.data
  139. }
  140. })
  141. },
  142. submitForm() {
  143. const v = this
  144. this.$refs.form.validate().then(res => {
  145. uni.showLoading({
  146. title: '加载中'
  147. });
  148. v.$post('/api/syringe-management/product/' + this.submitType, v.form).then(res => {
  149. if (res.code === 200) {
  150. uni.showToast({
  151. title: this.submitType == 'add' ? '添加成功' : '修改成功',
  152. duration: 1000,
  153. icon: 'success'
  154. })
  155. }
  156. uni.hideLoading()
  157. let pages = getCurrentPages(); // 获取页面栈
  158. let prePage = pages[pages.length - 2]; //获取上一页
  159. prePage.$vm.needRefresh = true; // 需要刷新
  160. setTimeout(() => {
  161. uni.navigateBack(1)
  162. }, 1000)
  163. })
  164. }).catch(err => {
  165. console.log('表单错误信息:', err);
  166. })
  167. },
  168. },
  169. }
  170. </script>
  171. <style lang="less">
  172. .lineManagement{
  173. ul{
  174. background-color: #fff;
  175. font-size: 24rpx;
  176. padding: 10rpx 20rpx;
  177. line-height: 60rpx;
  178. li{
  179. list-style: none;
  180. border-bottom: 1rpx solid #dcdcdc;
  181. span{
  182. display: inline-block;
  183. width: 150rpx;
  184. color: #666;
  185. }
  186. }
  187. }
  188. }
  189. .today-num{
  190. background-color: #fff;
  191. padding:10rpx 20rpx;
  192. font-size: 24rpx;
  193. color: #333;
  194. }
  195. </style>