index.vue 36 KB

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