index.vue 33 KB

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