disassemblePlanPop.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <ele-modal
  3. width="80vw"
  4. :visible.sync="visible"
  5. v-if="visible"
  6. :close-on-click-modal="false"
  7. row-key="code"
  8. custom-class="ele-dialog-form"
  9. :title="'计划分解'"
  10. >
  11. <div class="form-wrapper">
  12. <el-form :model="requestData" label-width="0" :show-message="false">
  13. <el-descriptions title="" :column="2" border>
  14. <el-descriptions-item label="计划编号">
  15. {{ formData.code }}</el-descriptions-item
  16. >
  17. <el-descriptions-item label="产品编码">{{
  18. formData.productCode
  19. }}</el-descriptions-item>
  20. <el-descriptions-item label="产品名称">{{
  21. formData.productName
  22. }}</el-descriptions-item>
  23. <el-descriptions-item label="牌号|型号">
  24. {{ formData.brandNo }}|{{ formData.model }}</el-descriptions-item
  25. >
  26. <el-descriptions-item label="批次号">{{
  27. formData.batchNo
  28. }}</el-descriptions-item>
  29. <el-descriptions-item label="工艺路线">{{
  30. formData.produceRoutingName
  31. }}</el-descriptions-item>
  32. <el-descriptions-item label="要求生产数量">{{
  33. formData.requiredFormingNum
  34. }}</el-descriptions-item>
  35. <el-descriptions-item label="要求完成日期">{{
  36. formData.reqMoldTime
  37. }}</el-descriptions-item>
  38. <el-descriptions-item label="生产方式">{{
  39. formData.produceType == 2 ? '加工' : '装配'
  40. }}</el-descriptions-item>
  41. </el-descriptions>
  42. <headerTitle title="BOM信息" class="mt20"> </headerTitle>
  43. <ele-pro-table
  44. ref="table"
  45. :needPage="false"
  46. :columns="columns"
  47. :datasource="bomList"
  48. :selection.sync="selection"
  49. @update:selection="handleSelectionChange"
  50. tool-class="ele-toolbar-actions"
  51. max-height="360px"
  52. >
  53. <template v-slot:toolbar>
  54. <div class="toolbar_box">
  55. <div
  56. ><span>基本数量</span>
  57. <el-input placeholder="请输入" v-model.number="baseCount">
  58. </el-input>
  59. <DictSelection dictName="计量单位" v-model="unit"
  60. /></div>
  61. <el-button type="primary" size="mini" @click="handleAdd"
  62. >新增</el-button
  63. >
  64. </div>
  65. </template>
  66. </ele-pro-table>
  67. <headerTitle title="计划列表" class="mt20"> </headerTitle>
  68. <ele-pro-table
  69. ref="table2"
  70. :needPage="false"
  71. :columns="jsColumns"
  72. :datasource="jhList"
  73. tool-class="ele-toolbar-actions"
  74. max-height="360px"
  75. >
  76. </ele-pro-table>
  77. </el-form>
  78. </div>
  79. <div slot="footer">
  80. <el-button plain @click="cancel">取消</el-button>
  81. <el-button type="primary" @click="confirm">确定</el-button>
  82. </div>
  83. <EquipmentDialog ref="equipmentRefs" @choose="choose"></EquipmentDialog>
  84. </ele-modal>
  85. </template>
  86. <script>
  87. import { deepClone } from '@/utils';
  88. import { getBom } from '@/api/productionPlan/index.js';
  89. import EquipmentDialog from './EquipmentDialog.vue';
  90. export default {
  91. components: {
  92. EquipmentDialog
  93. },
  94. data() {
  95. return {
  96. visible: false,
  97. formData: {},
  98. requestData: {},
  99. bomList: [],
  100. baseCount: '',
  101. unit: '',
  102. selection: [],
  103. jhList: [],
  104. rules: {},
  105. columns: [
  106. {
  107. columnKey: 'selection',
  108. type: 'selection',
  109. width: 45,
  110. align: 'center'
  111. },
  112. {
  113. prop: 'code',
  114. label: '编码',
  115. showOverflowTooltip: true
  116. },
  117. {
  118. prop: 'name',
  119. label: '名称',
  120. showOverflowTooltip: true
  121. },
  122. {
  123. prop: 'dosage',
  124. label: '用量',
  125. showOverflowTooltip: true
  126. },
  127. {
  128. prop: 'unit',
  129. label: '计量单位',
  130. showOverflowTooltip: true
  131. },
  132. {
  133. prop: 'brandNo',
  134. label: '牌号',
  135. align: 'center',
  136. showOverflowTooltip: true
  137. },
  138. {
  139. prop: 'specification',
  140. label: '规格',
  141. align: 'center',
  142. minWidth: 150,
  143. showOverflowTooltip: true
  144. },
  145. {
  146. prop: 'model',
  147. label: '型号',
  148. align: 'center',
  149. showOverflowTooltip: true
  150. },
  151. {
  152. prop: 'versions',
  153. label: '版本'
  154. },
  155. {
  156. prop: 'status ',
  157. label: '状态',
  158. formatter: (row) => {
  159. return this.statusOpt[+row.status];
  160. }
  161. },
  162. {
  163. prop: 'createName',
  164. label: '创建人',
  165. showOverflowTooltip: true
  166. },
  167. {
  168. prop: 'createTime',
  169. label: '创建日期',
  170. showOverflowTooltip: true
  171. }
  172. ],
  173. statusOpt: {
  174. '': '全部',
  175. 0: '已停用',
  176. 1: '已发布'
  177. },
  178. jsColumns: [
  179. {
  180. prop: 'productCode',
  181. label: '产品编码',
  182. align: 'center',
  183. minWidth: 140
  184. },
  185. {
  186. prop: 'productName',
  187. label: '产品名称',
  188. align: 'center',
  189. minWidth: 140
  190. },
  191. {
  192. prop: 'brandNo',
  193. label: '牌号',
  194. align: 'center',
  195. showOverflowTooltip: true
  196. },
  197. {
  198. prop: 'specification',
  199. label: '规格',
  200. align: 'center',
  201. minWidth: 150,
  202. showOverflowTooltip: true
  203. },
  204. {
  205. prop: 'model',
  206. label: '型号',
  207. align: 'center',
  208. showOverflowTooltip: true
  209. },
  210. {
  211. prop: 'produceRoutingName',
  212. label: '工艺路线',
  213. align: 'center',
  214. minWidth: 120
  215. },
  216. {
  217. prop: 'requiredFormingNum',
  218. label: '要求生产数量',
  219. align: 'center',
  220. slot: 'requiredFormingNum'
  221. },
  222. {
  223. prop: 'unit',
  224. label: '计量单位',
  225. showOverflowTooltip: true
  226. },
  227. ],
  228. };
  229. },
  230. methods: {
  231. open(row) {
  232. this.formData = deepClone(row);
  233. this.getBomList();
  234. },
  235. getBomList() {
  236. let params = {
  237. categoryId: this.formData.categoryId,
  238. bomType: this.formData.produceType,
  239. pageNum: 1,
  240. size: -1
  241. };
  242. getBom(params).then((res) => {
  243. this.bomList = res?.bomList || [];
  244. (this.baseCount = res.baseCount),
  245. (this.unit = res.unit),
  246. (this.visible = true);
  247. });
  248. },
  249. handleSelectionChange() {
  250. console.log(this.selection);
  251. let _arr = []
  252. _arr = this.selection.map(m => {
  253. let _num = this.formData.requiredFormingNum / this.baseCount * m.dosage;
  254. _num = _num.toFixed(3);
  255. return {
  256. productCode: m.code,
  257. productName: m.name,
  258. brandNo: m.brandNo,
  259. specification: m.specification,
  260. model: m.model,
  261. produceRoutingId: '',
  262. produceRoutingName: '',
  263. requiredFormingNum: _num,
  264. unit: this.unit,
  265. }
  266. })
  267. this.jhList = _arr;
  268. },
  269. handleAdd() {
  270. this.$refs.equipmentRefs.open();
  271. },
  272. choose(list) {
  273. console.log(list);
  274. },
  275. cancel() {
  276. this.formData = {};
  277. this.visible = false;
  278. },
  279. confirm() {
  280. this.$refs.form.validate(async (value) => {});
  281. }
  282. }
  283. };
  284. </script>
  285. <style lang="scss" scoped>
  286. .mt20 {
  287. margin-top: 20px;
  288. }
  289. .el-form-item {
  290. margin-bottom: 0 !important;
  291. }
  292. .toolbar_box {
  293. display: flex;
  294. justify-content: space-between;
  295. margin-right: 10px;
  296. > div {
  297. display: flex;
  298. align-items: center;
  299. justify-content: center;
  300. > span {
  301. width: 150px;
  302. }
  303. > div {
  304. margin-left: 10px;
  305. }
  306. }
  307. }
  308. </style>