index.vue 30 KB

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