index.vue 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358
  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. formatter: (row) => {
  622. if (row.modelKey) {
  623. return row.modelKey.toString();
  624. }
  625. return '';
  626. }
  627. },
  628. {
  629. prop: 'colorKey',
  630. label: '颜色',
  631. align: 'center',
  632. minWidth: 120,
  633. showOverflowTooltip: true,
  634. formatter: (row) => {
  635. if (row.colorKey) {
  636. return row.colorKey.toString();
  637. }
  638. return '';
  639. }
  640. },
  641. {
  642. prop: 'productNum',
  643. label: '计划数量',
  644. align: 'center',
  645. slot: 'productNum'
  646. },
  647. {
  648. prop: 'productWeight',
  649. label: '计划重量',
  650. align: 'center',
  651. slot: 'productWeight'
  652. },
  653. {
  654. prop: 'requiredFormingNum',
  655. label: '要求生产数量',
  656. align: 'center',
  657. slot: 'requiredFormingNum'
  658. },
  659. {
  660. prop: 'newSumOrderWeight',
  661. label: '要求生产重量',
  662. align: 'center',
  663. slot: 'newSumOrderWeight',
  664. formatter: (row) => {
  665. if (row.newSumOrderWeight) {
  666. return `${row.newSumOrderWeight}${row.newWeightUnit}`;
  667. }
  668. }
  669. },
  670. {
  671. prop: 'scheduleStatusName',
  672. label: '进度状态',
  673. align: 'center',
  674. minWidth: 100
  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: '',
  690. // label: '已生产数量',
  691. // align: 'center',
  692. // showOverflowTooltip: true
  693. // },
  694. // {
  695. // prop: '',
  696. // label: '未生产数量',
  697. // align: 'center',
  698. // showOverflowTooltip: true
  699. // },
  700. {
  701. prop: 'factoriesName',
  702. label: '所属工厂',
  703. align: 'center'
  704. },
  705. // {
  706. // prop: '',
  707. // label: '合格品数',
  708. // align: 'center'
  709. // },
  710. // {
  711. // prop: '',
  712. // label: '不合格品数',
  713. // align: 'center'
  714. // },
  715. // {
  716. // prop: '',
  717. // label: '合格率',
  718. // align: 'center'
  719. // },
  720. {
  721. prop: 'moCount',
  722. label: '模数',
  723. align: 'center',
  724. show: this.clientEnvironmentId == '4'
  725. },
  726. {
  727. prop: 'blockCount',
  728. label: '块数',
  729. align: 'center',
  730. show: this.clientEnvironmentId == '4'
  731. },
  732. {
  733. prop: 'noWordCount',
  734. label: '未排程块数',
  735. align: 'center',
  736. show: this.clientEnvironmentId == '4',
  737. minWidth: 110
  738. },
  739. {
  740. prop: 'planDeliveryTime',
  741. label: '计划交付日期',
  742. align: 'center',
  743. width: 110,
  744. showOverflowTooltip: true
  745. },
  746. {
  747. prop: 'reqMoldTime',
  748. label: '订单要求计划交付日期',
  749. align: 'center',
  750. width: 110,
  751. showOverflowTooltip: true
  752. },
  753. {
  754. prop: 'startTime',
  755. label: '计划开始日期',
  756. align: 'center',
  757. width: 110,
  758. showOverflowTooltip: true
  759. },
  760. {
  761. prop: 'endTime',
  762. label: '计划结束日期',
  763. align: 'center',
  764. width: 110,
  765. showOverflowTooltip: true
  766. },
  767. {
  768. prop: 'orderType',
  769. label: '计划类型',
  770. align: 'center',
  771. formatter: (row) => {
  772. const obj = this.planType.find((i) => i.value == row.planType);
  773. return obj && obj.label;
  774. }
  775. },
  776. {
  777. prop: 'version',
  778. label: '版本',
  779. align: 'center',
  780. minWidth: 80
  781. },
  782. {
  783. prop: 'createTime',
  784. label: '创建时间',
  785. align: 'center',
  786. width: 110,
  787. showOverflowTooltip: true
  788. },
  789. {
  790. columnKey: 'status',
  791. slot: 'status',
  792. label: '状态',
  793. align: 'center',
  794. formatter: (row) => {
  795. const obj = this.statusOpt[this.activeName].find(
  796. (i) => i.value == row.status
  797. );
  798. return obj && obj.label;
  799. }
  800. },
  801. {
  802. prop: 'customerName',
  803. label: '客户名称',
  804. align: 'center',
  805. showOverflowTooltip: true
  806. },
  807. {
  808. prop: 'serialNo',
  809. label: '客户代号',
  810. align: 'center',
  811. showOverflowTooltip: true
  812. },
  813. {
  814. prop: 'simpleName',
  815. label: '客户简称',
  816. align: 'center',
  817. showOverflowTooltip: true
  818. }
  819. ];
  820. }
  821. },
  822. created() {
  823. this.getFieldModel();
  824. },
  825. mounted() {
  826. this.clientEnvironmentId =
  827. this.$store.state.user.info.clientEnvironmentId;
  828. this.getPlanStatistics();
  829. },
  830. methods: {
  831. handleSele(e) {
  832. if (e.index === '1') {
  833. this.isshow = false;
  834. } else {
  835. this.isshow = true;
  836. }
  837. },
  838. async getPlanStatistics() {
  839. let res = await getPlanStatistics();
  840. console.log(res);
  841. this.planStatistics = res;
  842. },
  843. // handleClick(val) {
  844. // console.log(val, 'val');
  845. // // this.$emit('check');
  846. // },
  847. homogeneityInspect(val) {
  848. if (this.selection.length == 0) {
  849. this.$message.warning('请至少选择一条计划!');
  850. return;
  851. }
  852. for (let i = 0; i < this.selection.length; i++) {
  853. let el = this.selection[i];
  854. if (!el.bomCategoryId) {
  855. return this.$message.warning('请选择有BOM版本的数据');
  856. }
  857. }
  858. console.log(val, 'val');
  859. // this.homogeneityDialog = true;
  860. this.$refs.homogeneityInspectDialog.open(this.selection, val);
  861. // this.$nextTick(() => {
  862. // });
  863. // let flag = false;
  864. // let type = 0;
  865. // for (let item of this.selection) {
  866. // type = item.produceType;
  867. // for (let ele of this.selection) {
  868. // if (item.produceType != ele.produceType) {
  869. // flag = true;
  870. // break;
  871. // }
  872. // }
  873. // }
  874. // if (flag) {
  875. // this.$message.warning('请选择生产类型相同的计划!');
  876. // return;
  877. // }
  878. // console.log(type);
  879. // if (type == 2) {
  880. // this.$refs.homogeneityInspectDialog.open(this.selection);
  881. // } else if (type == 3) {
  882. // this.$refs.homogeneityInspectInstallDialog.open(this.selection);
  883. // } else {
  884. // this.$message.warning('请确认生产类型!');
  885. // }
  886. },
  887. statusFormatter(status) {
  888. const obj = this.statusOpt[this.activeName].find(
  889. (i) => i.value == status
  890. );
  891. return obj && obj.label;
  892. },
  893. /* 表格数据源 */
  894. datasource({ page, limit, where }) {
  895. return getList({
  896. pageNum: page,
  897. timeDimensionPlanType: this.timeDimensionPlanType,
  898. size: limit,
  899. ...where,
  900. ...this.sort
  901. });
  902. },
  903. // 发布工单
  904. handleOrderPublish(type, row) {
  905. if (!row.produceRoutingName) {
  906. return this.$message.error('请先选择工艺路线!');
  907. }
  908. this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认')
  909. .then(async () => {
  910. const loading = this.$loading({
  911. lock: true,
  912. fullscreen: true,
  913. text: '工单发布中...'
  914. });
  915. try {
  916. let code = row.workOrderCode;
  917. if (!code) {
  918. code = await getCode('product_order_code');
  919. }
  920. // 反显对象会报错 status
  921. const data = await release([row.id]);
  922. if (data || data === 0) {
  923. this.$message.success('发布成功!');
  924. } else {
  925. this.$message.error('发布失败,请重新发布!');
  926. }
  927. this.reload();
  928. } catch (error) {
  929. console.error(error);
  930. }
  931. loading.close();
  932. })
  933. .catch((err) => {
  934. console.error(err);
  935. });
  936. // this.$router.push({
  937. // path: '/productionPlan/workOrderPublish',
  938. // query: {
  939. // type,
  940. // id: row.id
  941. // }
  942. // });
  943. },
  944. // 修改计划
  945. async planEdit(row) {
  946. console.log(row, 'row 11');
  947. if (row.timeDimensionPlanType == 3) {
  948. this.factoryObj = row;
  949. // this.factoryType = ;
  950. // this.factoryShow = true;
  951. this.$refs.factoryAddRef.open(row);
  952. } else {
  953. let categoryId = row.categoryId;
  954. let produceType = '';
  955. let params = { categoryId: categoryId };
  956. const res = await listBomType(params);
  957. console.log(res, 'res 000');
  958. let bomMap = {
  959. 1: { code: 1, name: 'PBOM' },
  960. 2: { code: 2, name: 'MBOM' },
  961. 3: { code: 3, name: 'ABOM' }
  962. };
  963. let arr = [];
  964. res.map((item) => {
  965. if (bomMap[item.bomType]) {
  966. arr.push(bomMap[item.bomType]);
  967. delete bomMap[item.bomType];
  968. }
  969. });
  970. // const res = await findBomCategoryByCategoryId(categoryId);
  971. // let arr = [];
  972. // if (res.length > 0) {
  973. // let obj = res.find((item) => item.id === row.bomCategoryId);
  974. // produceType = obj ? obj.bomType : produceType;
  975. // let listMap = {
  976. // 1: { code: 1, name: 'PBOM' },
  977. // 2: { code: 2, name: 'MBOM' },
  978. // 3: { code: 3, name: 'ABOM' }
  979. // };
  980. // res.forEach((el) => {
  981. // if (listMap[el.bomType]) {
  982. // arr.push(listMap[el.bomType]);
  983. // delete listMap[el.bomType];
  984. // }
  985. // });
  986. // }
  987. console.log(arr, 'arr 222');
  988. this.$router
  989. .push({
  990. path: '/saleOrder/salesToProduction',
  991. query: {
  992. type: 'edit',
  993. id: row.id,
  994. produceType,
  995. categoryId,
  996. producedList: JSON.stringify(arr)
  997. }
  998. })
  999. .catch((error) => {
  1000. // 忽略重复导航错误
  1001. if (error.name !== 'NavigationDuplicated') {
  1002. console.error('路由跳转失败:', error);
  1003. }
  1004. });
  1005. }
  1006. },
  1007. getFieldModel() {
  1008. fieldModel({ fieldModel: 't_main_category' }).then((res) => {
  1009. const privateColumn = [];
  1010. if (this.activeName == 'first') {
  1011. privateColumn.push({
  1012. columnKey: 'action',
  1013. label: '操作',
  1014. width: 200,
  1015. align: 'center',
  1016. resizable: false,
  1017. fixed: 'right',
  1018. slot: 'action'
  1019. });
  1020. } else {
  1021. privateColumn = [];
  1022. }
  1023. let newRes = res.map((m) => {
  1024. return {
  1025. prop: 'extField.' + m.prop,
  1026. label: m.label,
  1027. align: 'center',
  1028. showOverflowTooltip: true
  1029. };
  1030. });
  1031. this.newColumns = [...this.columns, ...newRes, ...privateColumn];
  1032. this.$forceUpdate();
  1033. });
  1034. },
  1035. handleTabChange() {
  1036. this.$refs.searchRef.reset();
  1037. },
  1038. /* 刷新表格 */
  1039. reload(where) {
  1040. this.$nextTick(() => {
  1041. this.$refs.table.reload({ page: 1, where });
  1042. });
  1043. },
  1044. newReload() {
  1045. this.$nextTick(() => {
  1046. this.$refs.table.reload({ page: 1 });
  1047. });
  1048. },
  1049. /* 数据转为树形结构 */
  1050. parseData(data) {
  1051. return {
  1052. ...data,
  1053. list: this.$util.toTreeData({
  1054. data: data.list,
  1055. count: data.total,
  1056. idField: 'code',
  1057. parentIdField: 'joinPlanCode'
  1058. })
  1059. };
  1060. },
  1061. handleDel(row) {
  1062. this.$confirm('确定删除当前数据?', '提示')
  1063. .then(() => {
  1064. if (this.isLineNumbre) {
  1065. factoryDelete(row.id).then((res) => {
  1066. this.reload();
  1067. this.$message.success('删除成功');
  1068. });
  1069. } else {
  1070. del(row.id).then((res) => {
  1071. this.reload();
  1072. this.$message.success('删除成功');
  1073. });
  1074. }
  1075. })
  1076. .catch(() => {});
  1077. },
  1078. handleSelectionChange(list) {
  1079. console.log(list, 'list ___');
  1080. if (list.length > 0) {
  1081. let _list = [];
  1082. list.forEach((e) => {
  1083. if (e.childList.length > 0 && e.splitBatch != 2) {
  1084. _list.push(...e.childList);
  1085. } else {
  1086. _list.push(e);
  1087. }
  1088. });
  1089. this.selection = _list;
  1090. } else {
  1091. this.selection = [];
  1092. }
  1093. },
  1094. handOneSelection(row) {
  1095. const index = this.selection.findIndex((item) => item.id == row.id);
  1096. if (index >= 0) {
  1097. this.selection.splice(index, 1);
  1098. } else {
  1099. this.selection.push(row);
  1100. }
  1101. },
  1102. selectionFilter(row) {
  1103. return this.selection.findIndex((item) => item.id == row.id) >= 0;
  1104. },
  1105. goDetail({ id }) {
  1106. console.log('尽然详情');
  1107. this.$router.push({
  1108. path: '/productionPlan/detail',
  1109. query: { id }
  1110. });
  1111. },
  1112. // 计划分解
  1113. disassemblePlan() {
  1114. if (this.selection.length != 1) {
  1115. return this.$message.warning('计划分解只能选择一个计划!');
  1116. }
  1117. this.$refs.disassemblePlanRef.open(this.selection[0]);
  1118. },
  1119. // 拆批
  1120. toUnpack(row) {
  1121. console.log(1111111111111);
  1122. if (!row.batchNo) {
  1123. return this.$message.error('请先填写批次号!');
  1124. }
  1125. this.$refs.unpackRef.open(row);
  1126. },
  1127. // 合并
  1128. handleMerge() {
  1129. if (this.selection.length <= 1) {
  1130. return this.$message.warning('请先勾选二个或多个计划!');
  1131. }
  1132. const productCode = this.selection[0].productCode;
  1133. const produceRoutingId = this.selection[0].produceRoutingId;
  1134. for (var i = 0; i < this.selection.length; i++) {
  1135. if (productCode != this.selection[i].productCode) {
  1136. return this.$message.warning('产品编码不一致!');
  1137. }
  1138. if (produceRoutingId != this.selection[i].produceRoutingId) {
  1139. return this.$message.warning('工艺路线不一致!');
  1140. }
  1141. }
  1142. this.$refs.mergeRef.open(this.selection);
  1143. console.log(this.selection);
  1144. },
  1145. splitDetails(type, row) {
  1146. this.$refs.DetailsRef.open(type, row);
  1147. },
  1148. factAdd(type) {
  1149. this.factoryType = type;
  1150. this.$refs.factoryAddRef.open();
  1151. // this.factoryShow = true;
  1152. },
  1153. factoryClose(val) {
  1154. // this.factoryShow = false;
  1155. this.factoryType = 3;
  1156. this.factoryObj = {};
  1157. if (val) {
  1158. this.reload();
  1159. }
  1160. },
  1161. onSortChange(e) {
  1162. let sort = {
  1163. orderBy: e.order,
  1164. sortName: e.prop
  1165. };
  1166. this.sort = sort;
  1167. this.reload();
  1168. },
  1169. sortTop(row) {
  1170. row.priority = Number(row.priority) + 1;
  1171. this.priorityChange(row);
  1172. },
  1173. sortBottom(row) {
  1174. if (row.priority <= 1) {
  1175. return;
  1176. }
  1177. row.priority = Number(row.priority) - 1;
  1178. this.priorityChange(row);
  1179. },
  1180. priorityChange(row) {
  1181. if (row.priority > 10) {
  1182. row.priority = 10; // 如果大于 10,则设置为 10
  1183. } else if (row.priority < 0) {
  1184. row.priority = 0; // 如果小于 0,则设置为 0
  1185. }
  1186. this.priorityFn(row);
  1187. },
  1188. priorityFn: debounce(function (row) {
  1189. let params = {
  1190. id: row.id,
  1191. priority: row.priority
  1192. };
  1193. updatePriority(params).then((res) => {});
  1194. }, 800)
  1195. }
  1196. };
  1197. </script>
  1198. <style lang="scss" scoped>
  1199. .btn_box {
  1200. margin-bottom: 6px;
  1201. }
  1202. .check_box {
  1203. width: 100%;
  1204. display: flex;
  1205. align-items: center;
  1206. justify-content: center;
  1207. cursor: pointer;
  1208. }
  1209. .check {
  1210. width: 14px;
  1211. height: 14px;
  1212. border: 1px solid #dddddd;
  1213. display: flex;
  1214. align-items: center;
  1215. justify-content: center;
  1216. }
  1217. .act_check {
  1218. border: 1px solid #409eff;
  1219. background: #409eff;
  1220. .el-icon-check {
  1221. color: #fff;
  1222. font-size: 10px;
  1223. }
  1224. }
  1225. .statistics {
  1226. padding: 10px 10px 20px;
  1227. }
  1228. .cardItem {
  1229. border: 1px solid rgb(225, 225, 225);
  1230. text-align: center;
  1231. color: white;
  1232. background-color: rgba(24, 144, 255, 0.8);
  1233. overflow: hidden;
  1234. padding: 10px;
  1235. }
  1236. .cardText {
  1237. font-size: 16px;
  1238. white-space: nowrap;
  1239. text-overflow: ellipsis;
  1240. overflow: hidden;
  1241. }
  1242. .cardNum {
  1243. font-size: 32px;
  1244. font-style: italic;
  1245. white-space: nowrap;
  1246. text-overflow: ellipsis;
  1247. overflow: hidden;
  1248. }
  1249. @media (max-width: 768px) {
  1250. .cardText {
  1251. font-size: 14px;
  1252. }
  1253. .cardNum {
  1254. font-size: 24px;
  1255. }
  1256. }
  1257. ::v-deep .el-card__body {
  1258. padding: 17px 12px !important;
  1259. }
  1260. </style>