index.vue 38 KB

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