index.vue 35 KB

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