index.vue 38 KB

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