index.vue 41 KB

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