index.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <productionPlan-search
  5. @search="reload"
  6. ref="searchRef"
  7. :statusOpt="statusOpt"
  8. :planType="planType"
  9. :activeName="activeName"
  10. >
  11. </productionPlan-search>
  12. <!-- <div class="statistics">
  13. <el-row :gutter="24">
  14. <el-col :span="cardSpan">
  15. <el-card shadow="hover" class="cardItem">
  16. <div>
  17. <div class="cardText">待排产计划数量</div>
  18. <div class="cardNum">{{ planStatistics.waitPlanNum }}</div>
  19. </div>
  20. </el-card>
  21. </el-col>
  22. <el-col :span="cardSpan">
  23. <el-card shadow="hover" class="cardItem">
  24. <div>
  25. <div class="cardText">计划生产数量</div>
  26. <div class="cardNum">{{ planStatistics.planNum }}</div>
  27. </div>
  28. </el-card>
  29. </el-col>
  30. <el-col :span="cardSpan">
  31. <el-card shadow="hover" class="cardItem">
  32. <div>
  33. <div class="cardText">已下发生产数量</div>
  34. <div class="cardNum">{{ planStatistics.issueNum }}</div>
  35. </div>
  36. </el-card>
  37. </el-col>
  38. <el-col :span="cardSpan">
  39. <el-card shadow="hover" class="cardItem">
  40. <div>
  41. <div class="cardText">待派工数量</div>
  42. <div class="cardNum">0</div>
  43. </div>
  44. </el-card>
  45. </el-col>
  46. <el-col :span="cardSpan">
  47. <el-card shadow="hover" class="cardItem">
  48. <div>
  49. <div class="cardText">待完工生产数量</div>
  50. <div class="cardNum">{{ planStatistics.waitFinishNum }}</div>
  51. </div>
  52. </el-card>
  53. </el-col>
  54. <el-col :span="cardSpan">
  55. <el-card shadow="hover" class="cardItem">
  56. <div>
  57. <div class="cardText">待领料数量</div>
  58. <div class="cardNum">0</div>
  59. </div>
  60. </el-card>
  61. </el-col>
  62. <el-col :span="cardSpan">
  63. <el-card shadow="hover" class="cardItem">
  64. <div>
  65. <div class="cardText">已完工数量</div>
  66. <div class="cardNum">{{ planStatistics.finishNum }}</div>
  67. </div>
  68. </el-card>
  69. </el-col>
  70. <el-col :span="cardSpan">
  71. <el-card shadow="hover" class="cardItem">
  72. <div>
  73. <div class="cardText">已入库数量</div>
  74. <div class="cardNum">{{ planStatistics.stockNum }}</div>
  75. </div>
  76. </el-card>
  77. </el-col>
  78. </el-row>
  79. </div> -->
  80. <div class="btn_box">
  81. <el-button
  82. type="success"
  83. size="mini"
  84. v-if="timeDimensionPlanType == 3"
  85. @click="factAdd(3)"
  86. >新增</el-button
  87. >
  88. <!-- <el-button type="success" size="mini" @click="homogeneityInspect"
  89. >齐套性检查</el-button
  90. > -->
  91. <el-dropdown trigger="click" @command="homogeneityInspect">
  92. <el-button size="mini" type="success">齐套性检查</el-button>
  93. <el-dropdown-menu slot="dropdown">
  94. <el-dropdown-item command="1"> 自制件 </el-dropdown-item>
  95. <el-dropdown-item command="2"> 采购件 </el-dropdown-item>
  96. </el-dropdown-menu>
  97. </el-dropdown>
  98. <el-button
  99. type="primary"
  100. size="mini"
  101. v-if="isshow"
  102. @click="disassemblePlan"
  103. >计划分解</el-button
  104. >
  105. <el-button type="primary" size="mini">补单计划</el-button>
  106. <el-button type="info" size="mini">计划行事历</el-button>
  107. <el-button type="warning" size="mini">预警设置</el-button>
  108. <el-button type="primary" size="mini" v-if="isshow" @click="handleMerge"
  109. >合批</el-button
  110. >
  111. <el-button type="danger" size="mini">延期申请</el-button>
  112. <el-button type="danger" size="mini">变更申请</el-button>
  113. <el-button
  114. type="info"
  115. icon="el-icon-upload2"
  116. size="mini"
  117. @click="$refs.importDialogRef.open()"
  118. v-if="isImport"
  119. >导入</el-button
  120. >
  121. </div>
  122. <el-tabs
  123. v-model="activeName"
  124. type="card"
  125. size="mini"
  126. @tab-click="handleSele"
  127. >
  128. <el-tab-pane label="未发布" name="first"></el-tab-pane>
  129. <el-tab-pane label="已发布" name="second"></el-tab-pane>
  130. <el-tab-pane label="已变更" name="change"></el-tab-pane>
  131. </el-tabs>
  132. <!-- 数据表格 -->
  133. <ele-pro-table
  134. ref="table"
  135. :key="activeName"
  136. :initLoad="false"
  137. :columns="newColumns"
  138. :datasource="datasource"
  139. row-key="code"
  140. :selection.sync="selection"
  141. :cache-key="cacheKeyUrl"
  142. @sort-change="onSortChange"
  143. autoAmendPage
  144. :parse-data="parseData"
  145. @update:selection="handleSelectionChange"
  146. @columns-change="handleColumnChange"
  147. >
  148. <template v-slot:batchNo="{ row }">
  149. <el-link type="primary" :underline="false">
  150. <!-- @click.stop="splitDetails(1, row)" -->
  151. <el-tag type="success" size="mini" v-if="row.joinPlanCode">
  152. 拆</el-tag
  153. >
  154. <el-tag
  155. type="danger"
  156. size="mini"
  157. v-if="row.splitBatch == 2"
  158. @click.stop="splitDetails(2, row)"
  159. >
  160. 合</el-tag
  161. >
  162. {{ row.batchNo }}
  163. </el-link>
  164. </template>
  165. <template v-slot:selection="{ row }">
  166. <div class="check_box" @click="handOneSelection(row)">
  167. <div class="check act_check" v-if="selectionFilter(row)">
  168. <i class="el-icon-check"></i>
  169. </div>
  170. <div class="check" v-else></div>
  171. </div>
  172. </template>
  173. <template v-slot:code="{ row }">
  174. <el-link type="primary" :underline="false" @click="goDetail(row)">
  175. {{ row.code }}
  176. </el-link>
  177. </template>
  178. <template v-slot:salesCode="{ row }">
  179. {{ row.salesCode }}
  180. </template>
  181. <template v-slot:priority="{ row }">
  182. <div style="display: flex">
  183. <el-input
  184. v-model="row.priority"
  185. type="number"
  186. size="mini"
  187. :min="0"
  188. :max="10"
  189. @change="priorityChange(row)"
  190. style="width: 80px"
  191. >
  192. </el-input>
  193. <el-popover
  194. placement="right"
  195. width="200"
  196. trigger="hover"
  197. content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)"
  198. >
  199. <div class="sort-wrap" slot="reference">
  200. <i class="el-icon-caret-top" @click="sortTop(row)"></i>
  201. <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
  202. </div>
  203. </el-popover>
  204. </div>
  205. </template>
  206. <template v-slot:productNum="{ row }">
  207. {{ row.productNum }} {{ row.unit }}
  208. </template>
  209. <template v-slot:productWeight="{ row }">
  210. {{ row.productWeight }} {{ row.weightUnit }}
  211. </template>
  212. <template v-slot:requiredFormingNum="{ row }">
  213. {{ row.requiredFormingNum }} {{ row.unit }}
  214. </template>
  215. <template v-slot:newSumOrderWeight="{ row }">
  216. {{ row.newSumOrderWeight }} {{ row.newWeightUnit }}
  217. </template>
  218. <template v-slot:status="{ row }">
  219. <span :class="{ 'ele-text-danger': row.status == 3 }">
  220. {{ statusFormatter(row.status) }}
  221. </span>
  222. </template>
  223. <!-- 操作列 -->
  224. <template v-slot:action="{ row }">
  225. <el-link
  226. type="primary"
  227. :underline="false"
  228. v-if="row.status == 2 && row.splitBatch != 1"
  229. @click="handleOrderPublish(1, row)"
  230. >
  231. 发布
  232. </el-link>
  233. <el-link
  234. type="primary"
  235. v-if="row.status == 3"
  236. :underline="false"
  237. @click="handleOrderPublish(2, row)"
  238. >
  239. 重新发布
  240. </el-link>
  241. <el-link
  242. v-if="
  243. row.splitBatch != 2 &&
  244. row.splitBatch != 1 &&
  245. !row.joinPlanCode &&
  246. activeName == 'first'
  247. "
  248. type="primary"
  249. :underline="false"
  250. @click="planEdit(row)"
  251. >
  252. 修改
  253. </el-link>
  254. <el-link
  255. v-if="row.joinPlanCode && activeName == 'first' && row.status != 4"
  256. type="danger"
  257. :underline="false"
  258. @click="handleDel(row)"
  259. >
  260. 删除
  261. </el-link>
  262. <el-link
  263. v-if="
  264. !row.joinPlanCode &&
  265. !row.childList.length &&
  266. activeName == 'first' &&
  267. isLineNumbre &&
  268. row.status != 4
  269. "
  270. type="danger"
  271. :underline="false"
  272. @click="handleDel(row)"
  273. >
  274. 删除
  275. </el-link>
  276. <el-link
  277. v-if="
  278. clientEnvironmentId != 4 &&
  279. activeName == 'first' &&
  280. row.splitBatch != 2 &&
  281. !row.joinPlanCode
  282. "
  283. type="primary"
  284. :underline="false"
  285. @click="toUnpack(row)"
  286. >
  287. 拆批
  288. </el-link>
  289. </template>
  290. </ele-pro-table>
  291. </el-card>
  292. <unpackDialog ref="unpackRef" @success="newReload" />
  293. <mergeDialog ref="mergeRef" @success="reload"></mergeDialog>
  294. <unpackDetails ref="DetailsRef"></unpackDetails>
  295. <homogeneityInspectDialog
  296. ref="homogeneityInspectDialog"
  297. @success="reload"
  298. />
  299. <homogeneityInspectInstallDialog
  300. ref="homogeneityInspectInstallDialog"
  301. @success="reload"
  302. />
  303. <disassemblePlanPop
  304. ref="disassemblePlanRef"
  305. @close="reload"
  306. ></disassemblePlanPop>
  307. <!-- v-if="factoryShow" :factoryObj="factoryObj" -->
  308. <factoryAdd
  309. ref="factoryAddRef"
  310. :factoryType="factoryType"
  311. @close="factoryClose"
  312. ></factoryAdd>
  313. <importDialog
  314. ref="importDialogRef"
  315. @success="reload"
  316. :fileUrl="'/aps/productionplan/importTemplate'"
  317. :isWeb="false"
  318. fileName="生产临时计划模板"
  319. apiUrl="/aps/productionplan/importFile"
  320. />
  321. </div>
  322. </template>
  323. <script>
  324. import {
  325. getList,
  326. del,
  327. updatePriority,
  328. getPlanStatistics,
  329. factoryDelete,
  330. planIsReview
  331. } from '@/api/productionPlan/index.js';
  332. import productionPlanSearch from './components/productionPlan-search.vue';
  333. import unpackDialog from './components/unpackDialog.vue';
  334. import mergeDialog from './components/mergeDialog.vue';
  335. import homogeneityInspectDialog from './components/homogeneityInspectDialog.vue';
  336. import homogeneityInspectInstallDialog from './components/homogeneityInspectInstallDialog.vue';
  337. import unpackDetails from './components/unpackDetails.vue';
  338. import disassemblePlanPop from './components/disassemblePlanPop.vue';
  339. import factoryAdd from './components/factoryAdd/index.vue';
  340. import { release } from '@/api/productionPlan/order.js';
  341. import { getCode } from '@/api/codeManagement';
  342. import { fieldModel } from '@/api/saleOrder';
  343. import { debounce } from 'lodash';
  344. import tabMixins from '@/mixins/tableColumnsMixin';
  345. import importDialog from '@/components/upload/import-dialog.vue';
  346. import { parameterGetByCode } from '@/api/mainData/index';
  347. import {
  348. findBomCategoryByCategoryId,
  349. listBomType
  350. } from '@/api/productionPlan/index';
  351. export default {
  352. mixins: [tabMixins],
  353. components: {
  354. productionPlanSearch,
  355. unpackDialog,
  356. mergeDialog,
  357. unpackDetails,
  358. disassemblePlanPop,
  359. factoryAdd,
  360. homogeneityInspectDialog,
  361. homogeneityInspectInstallDialog,
  362. importDialog
  363. },
  364. props: {
  365. timeDimensionPlanType: { type: Number, default: 1 },
  366. isLineNumbre: {
  367. default: false
  368. },
  369. isImport: {
  370. default: false
  371. },
  372. cacheKeyUrl: { type: String, default: '513b2388-aps-productionPlan' }
  373. },
  374. data() {
  375. return {
  376. planStatistics: {
  377. waitPlanNum: 0,
  378. planNum: 0,
  379. issueNum: 0,
  380. waitFinishNum: 0,
  381. finishNum: 0,
  382. stockNum: 0
  383. },
  384. activeName: 'first',
  385. isshow: true,
  386. // 加载状态
  387. loading: false,
  388. pageType: 'add',
  389. dialogTitle: '',
  390. isBindPlan: false,
  391. statusOpt: {
  392. first: [
  393. { label: '所有状态', value: '3,2' },
  394. { label: '待发布', value: '2' },
  395. { label: '发布失败', value: '3' },
  396. { label: '已发布', value: '4' }
  397. ],
  398. second: [
  399. { label: '所有状态', value: '7,4,5,6' },
  400. { label: '待生产', value: '4' },
  401. { label: '生产中', value: '5' },
  402. { label: '已完成', value: '6' },
  403. { label: '已延期', value: '7' }
  404. ],
  405. change: [{ label: '已变更', value: '9' }]
  406. },
  407. planType: [
  408. { label: '所有计划类型', value: null },
  409. { label: '内销计划', value: '1' },
  410. { label: '外销计划', value: '2' },
  411. { label: '预制计划', value: '3' },
  412. { label: '改型计划', value: '4' },
  413. { label: '返工返修计划', value: '5' }
  414. ],
  415. newColumns: [],
  416. selection: [],
  417. clientEnvironmentId: '',
  418. // factoryShow: false,
  419. factoryType: 3,
  420. factoryObj: {},
  421. cardSpan: 3,
  422. columnsVersion: 1,
  423. isReview: false
  424. // homogeneityDialog: false
  425. };
  426. },
  427. computed: {
  428. // clientEnvironmentId() {
  429. // return this.$store.state.user.info.clientEnvironmentId;
  430. // },
  431. // 表格列配置
  432. columns() {
  433. const num = this.columnsVersion;
  434. const opt = {
  435. first: [],
  436. second: [
  437. {
  438. prop: 'releaseTime',
  439. label: '工单发布日期',
  440. align: 'center',
  441. minWidth: 110
  442. },
  443. {
  444. prop: 'planFormingTime',
  445. label: '预测生产日期',
  446. align: 'center',
  447. minWidth: 110
  448. },
  449. {
  450. prop: 'deliveryTime',
  451. label: '预测交货日期',
  452. align: 'center',
  453. minWidth: 110
  454. },
  455. {
  456. prop: 'formingTime',
  457. label: '实际交货日期',
  458. align: 'center',
  459. minWidth: 110
  460. }
  461. ],
  462. change: []
  463. };
  464. return [
  465. {
  466. width: 45,
  467. type: 'selection',
  468. columnKey: 'selection',
  469. align: 'center',
  470. slot: 'selection'
  471. },
  472. {
  473. columnKey: 'index',
  474. label: '序号',
  475. type: 'index',
  476. width: 55,
  477. align: 'center',
  478. showOverflowTooltip: true
  479. },
  480. {
  481. slot: 'batchNo',
  482. prop: 'batchNo',
  483. label: '批次号',
  484. align: 'center',
  485. minWidth: 140,
  486. sortable: true
  487. },
  488. this.isLineNumbre
  489. ? {
  490. prop: 'lineNumber',
  491. label: '行号',
  492. align: 'center',
  493. showOverflowTooltip: true
  494. }
  495. : {
  496. width: 1
  497. },
  498. {
  499. slot: 'code',
  500. prop: 'code',
  501. action: 'code',
  502. label: '计划编号',
  503. align: 'center',
  504. minWidth: 160,
  505. sortable: true
  506. },
  507. {
  508. prop: 'salesCode',
  509. action: 'salesCode',
  510. label: '销售订单号',
  511. align: 'center',
  512. minWidth: 160
  513. },
  514. {
  515. prop: 'taskName',
  516. action: 'taskName',
  517. label: '工序进度',
  518. align: 'center',
  519. minWidth: 160
  520. },
  521. {
  522. prop: 'mesStatusName',
  523. label: '状态',
  524. align: 'center',
  525. minWidth: 160
  526. },
  527. {
  528. prop: 'productCode',
  529. label: '编码',
  530. align: 'center',
  531. minWidth: 140
  532. },
  533. {
  534. prop: 'productName',
  535. label: '名称',
  536. align: 'center',
  537. showOverflowTooltip: true,
  538. minWidth: 140
  539. },
  540. {
  541. prop: 'specification',
  542. label: '规格',
  543. align: 'center',
  544. minWidth: 150,
  545. showOverflowTooltip: true
  546. },
  547. {
  548. prop: 'stockNum',
  549. label: '库存',
  550. align: 'center',
  551. minWidth: 100,
  552. showOverflowTooltip: true
  553. },
  554. {
  555. prop: 'productionCodes',
  556. label: '生产编号',
  557. align: 'center',
  558. minWidth: 150,
  559. showOverflowTooltip: true
  560. },
  561. {
  562. prop: 'model',
  563. label: '型号',
  564. align: 'center',
  565. showOverflowTooltip: true
  566. },
  567. {
  568. prop: 'brandNo',
  569. label: '牌号',
  570. align: 'center',
  571. showOverflowTooltip: true
  572. },
  573. {
  574. prop: 'priority',
  575. label: '优先级',
  576. align: 'center',
  577. minWidth: 120,
  578. slot: 'priority',
  579. sortable: 'custom'
  580. },
  581. {
  582. prop: 'productType',
  583. label: 'BOM类型',
  584. align: 'center',
  585. width: 120,
  586. formatter: (row) => {
  587. if (row.produceType == 1) {
  588. return 'PBOM';
  589. }
  590. if (row.produceType == 2) {
  591. return 'MBOM';
  592. }
  593. if (row.produceType == 3) {
  594. return 'ABOM';
  595. }
  596. return '';
  597. }
  598. },
  599. {
  600. prop: 'bomCategoryName',
  601. label: 'BOM版本',
  602. align: 'center',
  603. width: 130,
  604. showOverflowTooltip: true,
  605. formatter: (row) => {
  606. if (row.bomCategoryName) {
  607. return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
  608. }
  609. return '';
  610. }
  611. },
  612. {
  613. prop: 'produceRoutingName',
  614. label: '工艺路线',
  615. align: 'center',
  616. width: 140,
  617. showOverflowTooltip: true
  618. },
  619. {
  620. prop: 'modelKey',
  621. label: '机型',
  622. align: 'center',
  623. minWidth: 120,
  624. showOverflowTooltip: true,
  625. },
  626. {
  627. prop: 'colorKey',
  628. label: '颜色',
  629. align: 'center',
  630. minWidth: 120,
  631. showOverflowTooltip: true,
  632. },
  633. {
  634. prop: 'productNum',
  635. label: '计划数量',
  636. align: 'center',
  637. slot: 'productNum'
  638. },
  639. {
  640. prop: 'productWeight',
  641. label: '计划重量',
  642. align: 'center',
  643. slot: 'productWeight'
  644. },
  645. {
  646. prop: 'requiredFormingNum',
  647. label: '要求生产数量',
  648. align: 'center',
  649. slot: 'requiredFormingNum'
  650. },
  651. {
  652. prop: 'newSumOrderWeight',
  653. label: '要求生产重量',
  654. align: 'center',
  655. slot: 'newSumOrderWeight',
  656. formatter: (row) => {
  657. if (row.newSumOrderWeight) {
  658. return `${row.newSumOrderWeight}${row.newWeightUnit}`;
  659. }
  660. }
  661. },
  662. {
  663. prop: 'scheduleStatusName',
  664. label: '进度状态',
  665. align: 'center',
  666. minWidth: 100
  667. },
  668. // {
  669. // prop: '',
  670. // label: '已排产数量',
  671. // align: 'center',
  672. // showOverflowTooltip: true
  673. // },
  674. // {
  675. // prop: '',
  676. // label: '未排产数量',
  677. // align: 'center',
  678. // showOverflowTooltip: true
  679. // },
  680. // {
  681. // prop: '',
  682. // label: '已生产数量',
  683. // align: 'center',
  684. // showOverflowTooltip: true
  685. // },
  686. // {
  687. // prop: '',
  688. // label: '未生产数量',
  689. // align: 'center',
  690. // showOverflowTooltip: true
  691. // },
  692. {
  693. prop: 'factoriesName',
  694. label: '所属工厂',
  695. align: 'center'
  696. },
  697. // {
  698. // prop: '',
  699. // label: '合格品数',
  700. // align: 'center'
  701. // },
  702. // {
  703. // prop: '',
  704. // label: '不合格品数',
  705. // align: 'center'
  706. // },
  707. // {
  708. // prop: '',
  709. // label: '合格率',
  710. // align: 'center'
  711. // },
  712. {
  713. prop: 'moCount',
  714. label: '模数',
  715. align: 'center',
  716. show: this.clientEnvironmentId == '4'
  717. },
  718. {
  719. prop: 'blockCount',
  720. label: '块数',
  721. align: 'center',
  722. show: this.clientEnvironmentId == '4'
  723. },
  724. {
  725. prop: 'noWordCount',
  726. label: '未排程块数',
  727. align: 'center',
  728. show: this.clientEnvironmentId == '4',
  729. minWidth: 110
  730. },
  731. {
  732. prop: 'planDeliveryTime',
  733. label: '计划交付日期',
  734. align: 'center',
  735. width: 110,
  736. showOverflowTooltip: true
  737. },
  738. {
  739. prop: 'reqMoldTime',
  740. label: '订单要求计划交付日期',
  741. align: 'center',
  742. width: 110,
  743. showOverflowTooltip: true
  744. },
  745. {
  746. prop: 'startTime',
  747. label: '计划开始日期',
  748. align: 'center',
  749. width: 110,
  750. showOverflowTooltip: true
  751. },
  752. {
  753. prop: 'endTime',
  754. label: '计划结束日期',
  755. align: 'center',
  756. width: 110,
  757. showOverflowTooltip: true
  758. },
  759. {
  760. prop: 'orderType',
  761. label: '计划类型',
  762. align: 'center',
  763. formatter: (row) => {
  764. const obj = this.planType.find((i) => i.value == row.planType);
  765. return obj && obj.label;
  766. }
  767. },
  768. {
  769. prop: 'version',
  770. label: '版本',
  771. align: 'center',
  772. minWidth: 80
  773. },
  774. {
  775. prop: 'createTime',
  776. label: '创建时间',
  777. align: 'center',
  778. width: 110,
  779. showOverflowTooltip: true
  780. },
  781. {
  782. columnKey: 'status',
  783. slot: 'status',
  784. label: '状态',
  785. align: 'center',
  786. formatter: (row) => {
  787. const obj = this.statusOpt[this.activeName].find(
  788. (i) => i.value == row.status
  789. );
  790. return obj && obj.label;
  791. }
  792. },
  793. {
  794. prop: 'customerName',
  795. label: '客户名称',
  796. align: 'center',
  797. showOverflowTooltip: true
  798. },
  799. {
  800. prop: 'serialNo',
  801. label: '客户代号',
  802. align: 'center',
  803. showOverflowTooltip: true
  804. },
  805. {
  806. prop: 'simpleName',
  807. label: '客户简称',
  808. align: 'center',
  809. showOverflowTooltip: true
  810. }
  811. ];
  812. }
  813. },
  814. created() {
  815. this.getFieldModel();
  816. },
  817. mounted() {
  818. this.clientEnvironmentId =
  819. this.$store.state.user.info.clientEnvironmentId;
  820. this.getPlanStatistics();
  821. this.getplannedReleaseRequire('planned_release_require');
  822. },
  823. methods: {
  824. handleSele(e) {
  825. if (e.index === '1') {
  826. this.isshow = false;
  827. } else {
  828. this.isshow = true;
  829. }
  830. },
  831. async getplannedReleaseRequire(code) {
  832. parameterGetByCode({ code }).then((res) => {
  833. if (res) {
  834. this.isReview = res.value == '1' ? true : false;
  835. console.log(this.isReview, 'isReview');
  836. }
  837. });
  838. },
  839. async getPlanStatistics() {
  840. let res = await getPlanStatistics();
  841. console.log(res);
  842. this.planStatistics = res;
  843. },
  844. // handleClick(val) {
  845. // console.log(val, 'val');
  846. // // this.$emit('check');
  847. // },
  848. homogeneityInspect(val) {
  849. if (this.selection.length == 0) {
  850. this.$message.warning('请至少选择一条计划!');
  851. return;
  852. }
  853. for (let i = 0; i < this.selection.length; i++) {
  854. let el = this.selection[i];
  855. if (!el.bomCategoryId) {
  856. return this.$message.warning('请选择有BOM版本的数据');
  857. }
  858. }
  859. console.log(val, 'val');
  860. // this.homogeneityDialog = true;
  861. this.$refs.homogeneityInspectDialog.open(this.selection, val);
  862. // this.$nextTick(() => {
  863. // });
  864. // let flag = false;
  865. // let type = 0;
  866. // for (let item of this.selection) {
  867. // type = item.produceType;
  868. // for (let ele of this.selection) {
  869. // if (item.produceType != ele.produceType) {
  870. // flag = true;
  871. // break;
  872. // }
  873. // }
  874. // }
  875. // if (flag) {
  876. // this.$message.warning('请选择生产类型相同的计划!');
  877. // return;
  878. // }
  879. // console.log(type);
  880. // if (type == 2) {
  881. // this.$refs.homogeneityInspectDialog.open(this.selection);
  882. // } else if (type == 3) {
  883. // this.$refs.homogeneityInspectInstallDialog.open(this.selection);
  884. // } else {
  885. // this.$message.warning('请确认生产类型!');
  886. // }
  887. },
  888. statusFormatter(status) {
  889. const obj = this.statusOpt[this.activeName].find(
  890. (i) => i.value == status
  891. );
  892. return obj && obj.label;
  893. },
  894. /* 表格数据源 */
  895. datasource({ page, limit, where }) {
  896. return getList({
  897. pageNum: page,
  898. timeDimensionPlanType: this.timeDimensionPlanType,
  899. size: limit,
  900. ...where,
  901. ...this.sort
  902. });
  903. },
  904. // 发布工单
  905. handleOrderPublish(type, row) {
  906. if (!row.produceRoutingName) {
  907. return this.$message.error('请先选择工艺路线!');
  908. }
  909. this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认')
  910. .then(async () => {
  911. const loading = this.$loading({
  912. lock: true,
  913. fullscreen: true,
  914. text: '工单发布中...'
  915. });
  916. try {
  917. let code = row.workOrderCode;
  918. if (!code) {
  919. code = await getCode('product_order_code');
  920. }
  921. // 反显对象会报错 status
  922. const data = await release([row.id]);
  923. if (data || data === 0) {
  924. this.$message.success('发布成功!');
  925. } else {
  926. this.$message.error('发布失败,请重新发布!');
  927. }
  928. this.reload();
  929. } catch (error) {
  930. console.error(error);
  931. }
  932. loading.close();
  933. })
  934. .catch((err) => {
  935. console.error(err);
  936. });
  937. // this.$router.push({
  938. // path: '/productionPlan/workOrderPublish',
  939. // query: {
  940. // type,
  941. // id: row.id
  942. // }
  943. // });
  944. },
  945. // 修改计划
  946. async planEdit(row) {
  947. console.log(row, 'row 11');
  948. if (row.timeDimensionPlanType == 3) {
  949. this.factoryObj = row;
  950. // this.factoryType = ;
  951. // this.factoryShow = true;
  952. this.$refs.factoryAddRef.open(row);
  953. } else {
  954. let categoryId = row.categoryId;
  955. let produceType = '';
  956. let params = { categoryId: categoryId };
  957. const res = await listBomType(params);
  958. console.log(res, 'res 000');
  959. let bomMap = {
  960. 1: { code: 1, name: 'PBOM' },
  961. 2: { code: 2, name: 'MBOM' },
  962. 3: { code: 3, name: 'ABOM' }
  963. };
  964. let arr = [];
  965. res.map((item) => {
  966. if (bomMap[item.bomType]) {
  967. arr.push(bomMap[item.bomType]);
  968. delete bomMap[item.bomType];
  969. }
  970. });
  971. // const res = await findBomCategoryByCategoryId(categoryId);
  972. // let arr = [];
  973. // if (res.length > 0) {
  974. // let obj = res.find((item) => item.id === row.bomCategoryId);
  975. // produceType = obj ? obj.bomType : produceType;
  976. // let listMap = {
  977. // 1: { code: 1, name: 'PBOM' },
  978. // 2: { code: 2, name: 'MBOM' },
  979. // 3: { code: 3, name: 'ABOM' }
  980. // };
  981. // res.forEach((el) => {
  982. // if (listMap[el.bomType]) {
  983. // arr.push(listMap[el.bomType]);
  984. // delete listMap[el.bomType];
  985. // }
  986. // });
  987. // }
  988. console.log(arr, 'arr 222');
  989. this.$router
  990. .push({
  991. path: '/saleOrder/salesToProduction',
  992. query: {
  993. type: 'edit',
  994. id: row.id,
  995. produceType,
  996. categoryId,
  997. producedList: JSON.stringify(arr)
  998. }
  999. })
  1000. .catch((error) => {
  1001. // 忽略重复导航错误
  1002. if (error.name !== 'NavigationDuplicated') {
  1003. console.error('路由跳转失败:', error);
  1004. }
  1005. });
  1006. }
  1007. },
  1008. getFieldModel() {
  1009. fieldModel({ fieldModel: 't_main_category' }).then((res) => {
  1010. const privateColumn = [];
  1011. if (this.activeName == 'first') {
  1012. privateColumn.push({
  1013. columnKey: 'action',
  1014. label: '操作',
  1015. width: 200,
  1016. align: 'center',
  1017. resizable: false,
  1018. fixed: 'right',
  1019. slot: 'action'
  1020. });
  1021. } else {
  1022. privateColumn = [];
  1023. }
  1024. let newRes = res.map((m) => {
  1025. return {
  1026. prop: 'extField.' + m.prop,
  1027. label: m.label,
  1028. align: 'center',
  1029. showOverflowTooltip: true
  1030. };
  1031. });
  1032. this.newColumns = [...this.columns, ...newRes, ...privateColumn];
  1033. this.$forceUpdate();
  1034. });
  1035. },
  1036. handleTabChange() {
  1037. this.$refs.searchRef.reset();
  1038. },
  1039. /* 刷新表格 */
  1040. reload(where) {
  1041. this.$nextTick(() => {
  1042. this.$refs.table.reload({ page: 1, where });
  1043. });
  1044. },
  1045. newReload() {
  1046. this.$nextTick(() => {
  1047. this.$refs.table.reload({ page: 1 });
  1048. });
  1049. },
  1050. /* 数据转为树形结构 */
  1051. parseData(data) {
  1052. return {
  1053. ...data,
  1054. list: this.$util.toTreeData({
  1055. data: data.list,
  1056. count: data.total,
  1057. idField: 'code',
  1058. parentIdField: 'joinPlanCode'
  1059. })
  1060. };
  1061. },
  1062. handleDel(row) {
  1063. this.$confirm('确定删除当前数据?', '提示')
  1064. .then(() => {
  1065. if (this.isLineNumbre) {
  1066. factoryDelete(row.id).then((res) => {
  1067. this.reload();
  1068. this.$message.success('删除成功');
  1069. });
  1070. } else {
  1071. del(row.id).then((res) => {
  1072. this.reload();
  1073. this.$message.success('删除成功');
  1074. });
  1075. }
  1076. })
  1077. .catch(() => {});
  1078. },
  1079. handleSelectionChange(list) {
  1080. console.log(list, 'list ___');
  1081. if (list.length > 0) {
  1082. let _list = [];
  1083. list.forEach((e) => {
  1084. if (e.childList.length > 0 && e.splitBatch != 2) {
  1085. _list.push(...e.childList);
  1086. } else {
  1087. _list.push(e);
  1088. }
  1089. });
  1090. this.selection = _list;
  1091. } else {
  1092. this.selection = [];
  1093. }
  1094. },
  1095. handOneSelection(row) {
  1096. const index = this.selection.findIndex((item) => item.id == row.id);
  1097. if (index >= 0) {
  1098. this.selection.splice(index, 1);
  1099. } else {
  1100. this.selection.push(row);
  1101. }
  1102. },
  1103. selectionFilter(row) {
  1104. return this.selection.findIndex((item) => item.id == row.id) >= 0;
  1105. },
  1106. goDetail({ id }) {
  1107. console.log('尽然详情');
  1108. this.$router.push({
  1109. path: '/productionPlan/detail',
  1110. query: { id }
  1111. });
  1112. },
  1113. // 计划分解
  1114. disassemblePlan() {
  1115. if (this.selection.length != 1) {
  1116. return this.$message.warning('计划分解只能选择一个计划!');
  1117. }
  1118. this.$refs.disassemblePlanRef.open(this.selection[0]);
  1119. },
  1120. // 拆批
  1121. toUnpack(row) {
  1122. console.log(1111111111111);
  1123. if (!row.batchNo) {
  1124. return this.$message.error('请先填写批次号!');
  1125. }
  1126. this.$refs.unpackRef.open(row);
  1127. },
  1128. // 合并
  1129. handleMerge() {
  1130. if (this.selection.length <= 1) {
  1131. return this.$message.warning('请先勾选二个或多个计划!');
  1132. }
  1133. const productCode = this.selection[0].productCode;
  1134. const produceRoutingId = this.selection[0].produceRoutingId;
  1135. for (var i = 0; i < this.selection.length; i++) {
  1136. if (productCode != this.selection[i].productCode) {
  1137. return this.$message.warning('产品编码不一致!');
  1138. }
  1139. if (produceRoutingId != this.selection[i].produceRoutingId) {
  1140. return this.$message.warning('工艺路线不一致!');
  1141. }
  1142. }
  1143. this.$refs.mergeRef.open(this.selection);
  1144. console.log(this.selection);
  1145. },
  1146. splitDetails(type, row) {
  1147. this.$refs.DetailsRef.open(type, row);
  1148. },
  1149. factAdd(type) {
  1150. this.factoryType = type;
  1151. this.$refs.factoryAddRef.open();
  1152. // this.factoryShow = true;
  1153. },
  1154. factoryClose(val) {
  1155. // this.factoryShow = false;
  1156. this.factoryType = 3;
  1157. this.factoryObj = {};
  1158. if (val) {
  1159. this.reload();
  1160. }
  1161. },
  1162. onSortChange(e) {
  1163. let sort = {
  1164. orderBy: e.order,
  1165. sortName: e.prop
  1166. };
  1167. this.sort = sort;
  1168. this.reload();
  1169. },
  1170. sortTop(row) {
  1171. row.priority = Number(row.priority) + 1;
  1172. this.priorityChange(row);
  1173. },
  1174. sortBottom(row) {
  1175. if (row.priority <= 1) {
  1176. return;
  1177. }
  1178. row.priority = Number(row.priority) - 1;
  1179. this.priorityChange(row);
  1180. },
  1181. priorityChange(row) {
  1182. if (row.priority > 10) {
  1183. row.priority = 10; // 如果大于 10,则设置为 10
  1184. } else if (row.priority < 0) {
  1185. row.priority = 0; // 如果小于 0,则设置为 0
  1186. }
  1187. this.priorityFn(row);
  1188. },
  1189. priorityFn: debounce(function (row) {
  1190. let params = {
  1191. id: row.id,
  1192. priority: row.priority
  1193. };
  1194. updatePriority(params).then((res) => {});
  1195. }, 800)
  1196. }
  1197. };
  1198. </script>
  1199. <style lang="scss" scoped>
  1200. .btn_box {
  1201. margin-bottom: 6px;
  1202. }
  1203. .check_box {
  1204. width: 100%;
  1205. display: flex;
  1206. align-items: center;
  1207. justify-content: center;
  1208. cursor: pointer;
  1209. }
  1210. .check {
  1211. width: 14px;
  1212. height: 14px;
  1213. border: 1px solid #dddddd;
  1214. display: flex;
  1215. align-items: center;
  1216. justify-content: center;
  1217. }
  1218. .act_check {
  1219. border: 1px solid #409eff;
  1220. background: #409eff;
  1221. .el-icon-check {
  1222. color: #fff;
  1223. font-size: 10px;
  1224. }
  1225. }
  1226. .statistics {
  1227. padding: 10px 10px 20px;
  1228. }
  1229. .cardItem {
  1230. border: 1px solid rgb(225, 225, 225);
  1231. text-align: center;
  1232. color: white;
  1233. background-color: rgba(24, 144, 255, 0.8);
  1234. overflow: hidden;
  1235. padding: 10px;
  1236. }
  1237. .cardText {
  1238. font-size: 16px;
  1239. white-space: nowrap;
  1240. text-overflow: ellipsis;
  1241. overflow: hidden;
  1242. }
  1243. .cardNum {
  1244. font-size: 32px;
  1245. font-style: italic;
  1246. white-space: nowrap;
  1247. text-overflow: ellipsis;
  1248. overflow: hidden;
  1249. }
  1250. @media (max-width: 768px) {
  1251. .cardText {
  1252. font-size: 14px;
  1253. }
  1254. .cardNum {
  1255. font-size: 24px;
  1256. }
  1257. }
  1258. ::v-deep .el-card__body {
  1259. padding: 17px 12px !important;
  1260. }
  1261. </style>