index.vue 42 KB

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