picking.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="ele-body">
  3. <el-form
  4. inline
  5. ref="formRef"
  6. :show-error-message="false"
  7. class="form-wrapper"
  8. >
  9. <el-card>
  10. <div class="page-title">
  11. <el-page-header @back="$router.go(-1)">
  12. <div slot="content" class="pageContent">
  13. <div>{{ title }}领料</div>
  14. </div>
  15. </el-page-header>
  16. <el-button type="primary" @click="handleReport">一键报工</el-button>
  17. </div>
  18. <header-title title="工单信息">
  19. <el-form-item label="执行人工号">
  20. <el-input></el-input>
  21. </el-form-item>
  22. <el-form-item label="执行日期">
  23. <el-input></el-input>
  24. </el-form-item>
  25. </header-title>
  26. <ele-pro-table
  27. :columns="orderColumns"
  28. :datasource="orderList"
  29. cache-key="picking-table"
  30. >
  31. <template v-slot:toolbar>
  32. <el-link type="primary" @click="addOrder">加入工单</el-link>
  33. </template>
  34. <template v-slot:action="{ $index }">
  35. <el-link type="danger" @click="delOrder($index)">删除</el-link>
  36. </template>
  37. </ele-pro-table>
  38. <header-title title="物料信息"> </header-title>
  39. <ele-pro-table
  40. :columns="materialColumns"
  41. :datasource="materialList"
  42. cache-key="picking-table-material"
  43. >
  44. <template v-slot:toolbar>
  45. <el-link type="primary" @click="addMaterial">添加物料</el-link>
  46. </template>
  47. <template v-slot:action="{ $index }">
  48. <el-link type="danger" @click="delMaterial($index)">删除</el-link>
  49. </template>
  50. <template v-slot:warehouse="{ row }">
  51. <el-select v-model="row.w">
  52. <el-option>ss</el-option>
  53. </el-select>
  54. </template>
  55. <template v-slot:requireNum="{ row }">
  56. <el-input v-model="row.c"></el-input>
  57. </template>
  58. </ele-pro-table>
  59. </el-card>
  60. </el-form>
  61. <orderDailog ref="orderDailogRef" @success="orderSuccess" />
  62. <ChooseMaterial ref="ChooseMaterialRef" @success="materialSuccess" />
  63. </div>
  64. </template>
  65. <script>
  66. import Extrusion from './components/report/Extrusion';
  67. import Drying from './components/report/Drying';
  68. import Heating from './components/report/Heating';
  69. import HalfAdded from './components/report/HalfAdded';
  70. import Processing from './components/report/Processing';
  71. import Package from './components/report/Package';
  72. import Warehousing from './components/report/Warehousing';
  73. import Sinter from './components/report/Sinter';
  74. import Furnace from './components/report/Furnace';
  75. import orderDailog from './components/order-dailog';
  76. import ChooseMaterial from '@/components/material/ChooseMaterial';
  77. import { batchSave } from '@/api/produceOrder';
  78. export default {
  79. components: {
  80. orderDailog,
  81. ChooseMaterial,
  82. Extrusion,
  83. Drying,
  84. Heating,
  85. HalfAdded,
  86. Processing,
  87. Package,
  88. Sinter,
  89. Furnace,
  90. Warehousing
  91. },
  92. data () {
  93. return {
  94. descriptionsShow: true,
  95. activeName: '1',
  96. orderColumns: [
  97. {
  98. label: '工单号',
  99. prop: 'code'
  100. },
  101. {
  102. label: '产品编码',
  103. prop: 'productCode'
  104. },
  105. {
  106. label: '产品名称',
  107. prop: 'productName'
  108. },
  109. {
  110. label: '牌号',
  111. prop: 'brandNo'
  112. },
  113. {
  114. label: '型号',
  115. prop: 'model'
  116. },
  117. {
  118. label: '要求成型数量',
  119. prop: 'formingNum'
  120. },
  121. {
  122. label: '要求成型重量',
  123. prop: 'formingWeight'
  124. },
  125. {
  126. label: '未成型数量',
  127. prop: 'a',
  128. formatter: (row) => {
  129. return row.formingNum - row.formedNum;
  130. }
  131. },
  132. {
  133. label: '未成型重量',
  134. prop: 'a',
  135. formatter: (row) => {
  136. return row.formingWeight - row.formedWeight;
  137. }
  138. },
  139. {
  140. label: '计划开始时间',
  141. prop: 'planStartTime'
  142. },
  143. {
  144. label: '实际开始时间',
  145. prop: 'startTime'
  146. },
  147. {
  148. slot: 'action',
  149. label: '操作'
  150. }
  151. ],
  152. orderList: [],
  153. materialList: [],
  154. materialColumns: [
  155. {
  156. label: '序号',
  157. type: 'index',
  158. width: 55
  159. },
  160. {
  161. label: '编码',
  162. prop: 'a'
  163. },
  164. {
  165. label: '名称',
  166. prop: 'a'
  167. },
  168. {
  169. label: '类型',
  170. prop: 'a'
  171. },
  172. {
  173. label: '单位',
  174. prop: 'a'
  175. },
  176. {
  177. label: '牌号',
  178. prop: 'a'
  179. },
  180. {
  181. label: '型号',
  182. prop: 'a'
  183. },
  184. {
  185. label: '规格',
  186. prop: 'a'
  187. },
  188. {
  189. slot: 'requireNum',
  190. label: '需求数量'
  191. },
  192. {
  193. slot: 'warehouse',
  194. label: '仓库'
  195. },
  196. {
  197. slot: 'action',
  198. label: '操作',
  199. prop: 'a'
  200. }
  201. ]
  202. };
  203. },
  204. computed: {
  205. title () {
  206. return this.$route.query.name;
  207. }
  208. },
  209. methods: {
  210. addOrder () {
  211. this.$refs.orderDailogRef.open(this.orderList.slice(0));
  212. },
  213. orderSuccess (list) {
  214. this.orderList = list;
  215. },
  216. materialSuccess (list) {
  217. this.orderList = list;
  218. },
  219. addMaterial () {
  220. this.$refs.ChooseMaterialRef.open(this.materialList.slice(0));
  221. },
  222. materialSuccess (list) {
  223. const obj = {};
  224. this.materialList = [...this.materialList, ...list].reduce(
  225. (next, pre) => {
  226. if (!obj[pre.id]) {
  227. obj[pre.id] = true;
  228. next.push(pre);
  229. }
  230. },
  231. []
  232. );
  233. },
  234. delMaterial (index) {
  235. this.$confirm('是否删除', '提示')
  236. .then(() => {
  237. this.materialList.splice(index, 1);
  238. })
  239. .catch(() => {});
  240. },
  241. delOrder (index) {
  242. this.$confirm('是否删除', '提示')
  243. .then(() => {
  244. this.orderList.splice(index, 1);
  245. })
  246. .catch(() => {});
  247. },
  248. async handleReport () {
  249. this.$refs.formRef.validate(async (value) => {
  250. if (value) {
  251. await batchSave();
  252. }
  253. });
  254. }
  255. }
  256. };
  257. </script>
  258. <style lang="scss" scoped>
  259. .el-tabs {
  260. margin-top: 20px;
  261. }
  262. .el-button {
  263. margin-top: 10px;
  264. }
  265. .slideUp-icon {
  266. transform: rotate(-90deg);
  267. }
  268. .slideDown-icon {
  269. transform: rotate(90deg);
  270. }
  271. .form-wrapper {
  272. :deep(.el-form-item) {
  273. margin-bottom: 0;
  274. }
  275. }
  276. </style>