plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

854 lines
26 KiB

1 year ago
1 year ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
  1. <template>
  2. <div class="mod-config">
  3. <!-- 查询条件 -->
  4. <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()">
  5. <el-form-item :label="'物料编码'">
  6. <el-input v-model="searchData.partNo" clearable style="width: 120px"></el-input>
  7. </el-form-item>
  8. <el-form-item :label="'物料名称'">
  9. <el-input v-model="searchData.partDesc" clearable style="width: 200px"></el-input>
  10. </el-form-item>
  11. <el-form-item :label="'制造类型'">
  12. <el-select v-model="searchData.bomType" clearable style="width: 120px">
  13. <el-option label="Manufacturing" value="Manufacturing"></el-option>
  14. <el-option label="Repair" value="Repair"></el-option>
  15. <el-option label="Purchase" value="Purchase"></el-option>
  16. <el-option label="Prototype" value="Prototype"></el-option>
  17. </el-select>
  18. </el-form-item>
  19. <el-form-item :label="'BOM版本号'">
  20. <el-input v-model="searchData.engChgLevel" type="number" style="width: 100px"></el-input>
  21. </el-form-item>
  22. <el-form-item :label="' '">
  23. <el-button :loading="queryLoading" @click="getDataList()">查询</el-button>
  24. <download-excel
  25. :fields="fields()"
  26. :data="exportData"
  27. type="xls"
  28. :name="exportName"
  29. :header="exportHeader"
  30. :footer="exportFooter"
  31. :fetch="createExportData"
  32. :before-generate="startDownload"
  33. :before-finish="finishDownload"
  34. worksheet="导出信息"
  35. class="el-button el-button--primary el-button--medium">
  36. {{ "导出" }}
  37. </download-excel>
  38. </el-form-item>
  39. </el-form>
  40. <!-- bom列表 -->
  41. <el-table
  42. :height="height"
  43. :data="dataList"
  44. border
  45. ref="bomHeaderTable"
  46. @row-click="headerClickRow"
  47. @current-change="changeCurrentRow"
  48. style="width: 100%">
  49. <el-table-column
  50. v-for="(item,index) in columnList" :key="index"
  51. :sortable="item.columnSortable"
  52. :prop="item.columnProp"
  53. :header-align="item.headerAlign"
  54. :show-overflow-tooltip="item.showOverflowTooltip"
  55. :align="item.align"
  56. :fixed="item.fixed === ''?false:item.fixed"
  57. :min-width="item.columnWidth"
  58. :label="item.columnLabel">
  59. <template slot-scope="scope">
  60. <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span>
  61. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  62. </template>
  63. </el-table-column>
  64. </el-table>
  65. <!-- 分页插件 -->
  66. <el-pagination style="margin-top: 0px"
  67. @size-change="sizeChangeHandle"
  68. @current-change="currentChangeHandle"
  69. :current-page="pageIndex"
  70. :page-sizes="[20, 50, 100, 200, 500]"
  71. :page-size="pageSize"
  72. :total="totalPage"
  73. layout="total, sizes, prev, pager, next, jumper">
  74. </el-pagination>
  75. <!-- 页签 -->
  76. <el-tabs v-model="activeTable" style="width: 100%" :style="{height: secondHeight + 'px'}" type="border-card" @tab-click="tabClick" class="customer-tab">
  77. <!-- Graphical Structure页签 -->
  78. <el-tab-pane label="Graphical Structure" name="GraphicalStructure">
  79. <el-row>
  80. <el-col :style="{width: leftWidth + 'px',height: secondHeight - 48 + 'px'}" class="down-tree">
  81. <el-tree
  82. :data="treeData"
  83. node-key="nodeKey"
  84. :default-expand-all=false
  85. @node-click="handleNodeClick"
  86. :props="defaultProps">
  87. </el-tree>
  88. </el-col>
  89. <el-col :style="{width: rightWidth + 'px',height: secondHeight - 50 + 'px'}" style="margin-left: 10px">
  90. <el-form :inline="true" label-position="top">
  91. <el-form-item :label="'物料编码'">
  92. <el-input v-model="alternativeData.partNo" readonly style="width: 120px"></el-input>
  93. </el-form-item>
  94. <el-form-item :label="'物料名称'">
  95. <el-input v-model="alternativeData.partDesc" readonly style="width: 200px"></el-input>
  96. </el-form-item>
  97. <el-form-item :label="'BOM版本号'">
  98. <el-input v-model="alternativeData.engChgLevel" readonly style="width: 80px"></el-input>
  99. </el-form-item>
  100. <el-form-item :label="'制造类型'">
  101. <el-input v-model="alternativeData.bomType" readonly style="width: 120px"></el-input>
  102. </el-form-item>
  103. </el-form>
  104. <el-form :inline="true" label-position="top">
  105. <el-form-item :label="'替代编码'">
  106. <el-input v-model="alternativeData.alternativeNo" readonly style="width: 120px"></el-input>
  107. </el-form-item>
  108. <el-form-item :label="'替代名称'">
  109. <el-input v-model="alternativeData.alternativeDescription" readonly style="width: 200px"></el-input>
  110. </el-form-item>
  111. <el-form-item :label="'最小订单数'">
  112. <el-input v-model="alternativeData.minLotQty" readonly style="width: 80px"></el-input>
  113. </el-form-item>
  114. <el-form-item :label="'状态'">
  115. <el-input v-model="alternativeData.status" readonly style="width: 120px"></el-input>
  116. </el-form-item>
  117. </el-form>
  118. <el-table
  119. :height="secondHeight-130"
  120. :data="componentPartList"
  121. border
  122. style="width: 100%">
  123. <el-table-column
  124. v-for="(item,index) in componentPartColumnList" :key="index"
  125. :sortable="item.columnSortable"
  126. :prop="item.columnProp"
  127. :header-align="item.headerAlign"
  128. :show-overflow-tooltip="item.showOverflowTooltip"
  129. :align="item.align"
  130. :fixed="item.fixed==''?false:item.fixed"
  131. :min-width="item.columnWidth"
  132. :label="item.columnLabel">
  133. <template slot-scope="scope">
  134. <span v-if="!item.columnHidden"> {{ scope.row[item.columnProp] }}</span>
  135. <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </el-col>
  140. </el-row>
  141. </el-tab-pane>
  142. </el-tabs>
  143. <!-- chooseList模态框 -->
  144. <ChooseList ref="baseList" @getBaseData="getBaseData"></ChooseList>
  145. </div>
  146. </template>
  147. <script>
  148. import {
  149. bomSearchHeader, // bom列表查询
  150. getAlternativeTree, // 查询bom替代树形
  151. getComponentPartList, // 查询子物料
  152. } from '@/api/part/bomSearch3.js'
  153. import ChooseList from '@/views/modules/common/Chooselist'
  154. import dayjs from "dayjs";
  155. export default {
  156. // 组件
  157. components: {
  158. ChooseList
  159. },
  160. // 监听
  161. watch: {
  162. searchData: {
  163. deep: true,
  164. handler: function (newV, oldV) {
  165. this.searchData.partNo = this.searchData.partNo.toUpperCase()
  166. }
  167. }
  168. },
  169. // 对象
  170. data () {
  171. return {
  172. // 导出
  173. exportData: [],
  174. exportName: 'BOM多级查询' + this.dayjs().format('YYYYMMDDHHmmss'),
  175. exportHeader: ['BOM多级查询'],
  176. exportFooter: [],
  177. resultList: [],
  178. // ======== 行高 ========
  179. height: 200,
  180. secondHeight: 200,
  181. leftWidth: 300,
  182. rightWidth: '',
  183. // ======== 分页 ========
  184. pageIndex: 1,
  185. pageSize: 50,
  186. totalPage: 0,
  187. // 条件查询
  188. searchData: {
  189. site: this.$store.state.user.site,
  190. partNo: '',
  191. partDesc: '',
  192. bomType: '',
  193. engChgLevel: '',
  194. page: 1,
  195. limit: 10
  196. },
  197. // loading
  198. queryLoading: false,
  199. // 初始页签
  200. activeTable: 'GraphicalStructure',
  201. // ======== 数据对象 ========
  202. alternativeData: {
  203. site: '',
  204. partNo: '',
  205. partDesc: '',
  206. bomType: '',
  207. engChgLevel: '',
  208. alternativeNo: '',
  209. alternativeDescription: '',
  210. minLotQty: '',
  211. noteText: '',
  212. status: '',
  213. },
  214. // ======== 选中的当前行数据 ========
  215. headerCurrentRow: {},
  216. defaultProps: {
  217. children: "informationList",
  218. label: "nodeKey",
  219. },
  220. // ======== 数据列表 ========
  221. dataList: [],
  222. treeData: [],
  223. componentPartList: [],
  224. // ======== 列表表头 ========
  225. columnList: [
  226. {
  227. userId: this.$store.state.user.name,
  228. functionId: 104009,
  229. serialNumber: '104009Table1PartNo',
  230. tableId: '104009Table1',
  231. tableName: 'BOMHeader表',
  232. columnProp: 'partNo',
  233. headerAlign: 'center',
  234. align: 'center',
  235. columnLabel: '物料编码',
  236. columnHidden: false,
  237. columnImage: false,
  238. columnSortable: false,
  239. sortLv: 0,
  240. status: true,
  241. fixed: '',
  242. columnWidth: 120
  243. },
  244. {
  245. userId: this.$store.state.user.name,
  246. functionId: 104009,
  247. serialNumber: '104009Table1PartDesc',
  248. tableId: '104009Table1',
  249. tableName: 'BOMHeader表',
  250. columnProp: 'partDesc',
  251. headerAlign: 'center',
  252. align: 'left',
  253. columnLabel: '物料名称',
  254. columnHidden: false,
  255. columnImage: false,
  256. columnSortable: false,
  257. sortLv: 0,
  258. status: true,
  259. fixed: '',
  260. columnWidth: 300
  261. },
  262. {
  263. userId: this.$store.state.user.name,
  264. functionId: 104009,
  265. serialNumber: '104009Table1BomType',
  266. tableId: '104009Table1',
  267. tableName: 'BOMHeader表',
  268. columnProp: 'bomType',
  269. headerAlign: 'center',
  270. align: 'left',
  271. columnLabel: '制造类型',
  272. columnHidden: false,
  273. columnImage: false,
  274. columnSortable: false,
  275. sortLv: 0,
  276. status: true,
  277. fixed: '',
  278. columnWidth: 120
  279. },
  280. {
  281. userId: this.$store.state.user.name,
  282. functionId: 104009,
  283. serialNumber: '104009Table1EngChgLevel',
  284. tableId: '104009Table1',
  285. tableName: 'BOMHeader表',
  286. columnProp: 'engChgLevel',
  287. headerAlign: 'center',
  288. align: 'right',
  289. columnLabel: 'BOM版本号',
  290. columnHidden: false,
  291. columnImage: false,
  292. columnSortable: false,
  293. sortLv: 0,
  294. status: true,
  295. fixed: '',
  296. columnWidth: 100
  297. },
  298. {
  299. userId: this.$store.state.user.name,
  300. functionId: 104009,
  301. serialNumber: '104009Table1engRevision',
  302. tableId: '104009Table1',
  303. tableName: 'BOMHeader表',
  304. columnProp: 'engRevision',
  305. headerAlign: 'center',
  306. align: 'center',
  307. columnLabel: '工程版本号',
  308. columnHidden: false,
  309. columnImage: false,
  310. columnSortable: false,
  311. sortLv: 0,
  312. status: true,
  313. fixed: '',
  314. columnWidth: 100
  315. },
  316. {
  317. userId: this.$store.state.user.name,
  318. functionId: 104009,
  319. serialNumber: '104009Table1NetWeight',
  320. tableId: '104009Table1',
  321. tableName: 'BOMHeader表',
  322. columnProp: 'netWeight',
  323. headerAlign: 'center',
  324. align: 'right',
  325. columnLabel: '净重',
  326. columnHidden: false,
  327. columnImage: false,
  328. columnSortable: false,
  329. sortLv: 0,
  330. status: true,
  331. fixed: '',
  332. columnWidth: 100
  333. },
  334. {
  335. userId: this.$store.state.user.name,
  336. functionId: 104009,
  337. serialNumber: '104009Table1EffPhaseInDate',
  338. tableId: '104009Table1',
  339. tableName: 'BOMHeader表',
  340. columnProp: 'effPhaseInDate',
  341. headerAlign: 'center',
  342. align: 'center',
  343. columnLabel: '生效日期',
  344. columnHidden: false,
  345. columnImage: false,
  346. columnSortable: false,
  347. sortLv: 0,
  348. status: true,
  349. fixed: '',
  350. columnWidth: 130
  351. },
  352. {
  353. userId: this.$store.state.user.name,
  354. functionId: 104009,
  355. serialNumber: '104009Table1EffPhaseOutDate',
  356. tableId: '104009Table1',
  357. tableName: 'BOMHeader表',
  358. columnProp: 'effPhaseOutDate',
  359. headerAlign: 'center',
  360. align: 'center',
  361. columnLabel: '失效日期',
  362. columnHidden: false,
  363. columnImage: false,
  364. columnSortable: false,
  365. sortLv: 0,
  366. status: true,
  367. fixed: '',
  368. columnWidth: 130
  369. },
  370. {
  371. userId: this.$store.state.user.name,
  372. functionId: 104009,
  373. serialNumber: '104009Table1CreateDate',
  374. tableId: '104009Table1',
  375. tableName: 'BOMHeader表',
  376. columnProp: 'createDate',
  377. headerAlign: 'center',
  378. align: 'center',
  379. columnLabel: '创建时间',
  380. columnHidden: false,
  381. columnImage: false,
  382. columnSortable: false,
  383. sortLv: 0,
  384. status: true,
  385. fixed: '',
  386. columnWidth: 170
  387. },
  388. {
  389. userId: this.$store.state.user.name,
  390. functionId: 104009,
  391. serialNumber: '104009Table1CreateBy',
  392. tableId: '104009Table1',
  393. tableName: 'BOMHeader表',
  394. columnProp: 'createBy',
  395. headerAlign: 'center',
  396. align: 'center',
  397. columnLabel: '创建人',
  398. columnHidden: false,
  399. columnImage: false,
  400. columnSortable: false,
  401. sortLv: 0,
  402. status: true,
  403. fixed: '',
  404. columnWidth: 100
  405. },
  406. {
  407. userId: this.$store.state.user.name,
  408. functionId: 104009,
  409. serialNumber: '104009Table1UpdateDate',
  410. tableId: '104009Table1',
  411. tableName: 'BOMHeader表',
  412. columnProp: 'updateDate',
  413. headerAlign: 'center',
  414. align: 'center',
  415. columnLabel: '更新时间',
  416. columnHidden: false,
  417. columnImage: false,
  418. columnSortable: false,
  419. sortLv: 0,
  420. status: true,
  421. fixed: '',
  422. columnWidth: 170
  423. },
  424. {
  425. userId: this.$store.state.user.name,
  426. functionId: 104009,
  427. serialNumber: '104009Table1UpdateBy',
  428. tableId: '104009Table1',
  429. tableName: 'BOMHeader表',
  430. columnProp: 'updateBy',
  431. headerAlign: 'center',
  432. align: 'center',
  433. columnLabel: '更新人',
  434. columnHidden: false,
  435. columnImage: false,
  436. columnSortable: false,
  437. sortLv: 0,
  438. status: true,
  439. fixed: '',
  440. columnWidth: 100
  441. }
  442. ],
  443. componentPartColumnList: [
  444. {
  445. userId: this.$store.state.user.name,
  446. functionId: 104009,
  447. serialNumber: '104009Table2LineSequence',
  448. tableId: '104009Table2',
  449. tableName: 'BOMComponent表',
  450. columnProp: 'lineSequence',
  451. headerAlign: 'center',
  452. align: 'center',
  453. columnLabel: '序号',
  454. columnHidden: false,
  455. columnImage: false,
  456. columnSortable: false,
  457. sortLv: 0,
  458. status: true,
  459. fixed: '',
  460. columnWidth: 60
  461. },
  462. {
  463. userId: this.$store.state.user.name,
  464. functionId: 104009,
  465. serialNumber: '104009Table2ComponentPart',
  466. tableId: '104009Table2',
  467. tableName: 'BOMComponent表',
  468. columnProp: 'componentPart',
  469. headerAlign: 'center',
  470. align: 'center',
  471. columnLabel: '物料编码',
  472. columnHidden: false,
  473. columnImage: false,
  474. columnSortable: false,
  475. sortLv: 0,
  476. status: true,
  477. fixed: '',
  478. columnWidth: 120
  479. },
  480. {
  481. userId: this.$store.state.user.name,
  482. functionId: 104009,
  483. serialNumber: '104009Table2ComponentPartDesc',
  484. tableId: '104009Table2',
  485. tableName: 'BOMComponent表',
  486. columnProp: 'componentPartDesc',
  487. headerAlign: 'center',
  488. align: 'left',
  489. columnLabel: '物料名称',
  490. columnHidden: false,
  491. columnImage: false,
  492. columnSortable: false,
  493. sortLv: 0,
  494. status: true,
  495. fixed: '',
  496. columnWidth: 120
  497. },
  498. {
  499. userId: this.$store.state.user.name,
  500. functionId: 104009,
  501. serialNumber: '104009Table2QtyPerAssembly',
  502. tableId: '104009Table2',
  503. tableName: 'BOMComponent表',
  504. columnProp: 'qtyPerAssembly',
  505. headerAlign: 'center',
  506. align: 'right',
  507. columnLabel: '单位用量',
  508. columnHidden: false,
  509. columnImage: false,
  510. columnSortable: false,
  511. sortLv: 0,
  512. status: true,
  513. fixed: '',
  514. columnWidth: 80
  515. },
  516. {
  517. userId: this.$store.state.user.name,
  518. functionId: 104009,
  519. serialNumber: '104009Table2ComponentScrap',
  520. tableId: '104009Table2',
  521. tableName: 'BOMComponent表',
  522. columnProp: 'componentScrap',
  523. headerAlign: 'center',
  524. align: 'right',
  525. columnLabel: '调机量',
  526. columnHidden: false,
  527. columnImage: false,
  528. columnSortable: false,
  529. sortLv: 0,
  530. status: true,
  531. fixed: '',
  532. columnWidth: 80
  533. },
  534. {
  535. userId: this.$store.state.user.name,
  536. functionId: 104009,
  537. serialNumber: '104009Table2ShrinkageFactor',
  538. tableId: '104009Table2',
  539. tableName: 'BOMComponent表',
  540. columnProp: 'shrinkageFactor',
  541. headerAlign: 'center',
  542. align: 'right',
  543. columnLabel: '损耗率',
  544. columnHidden: false,
  545. columnImage: false,
  546. columnSortable: false,
  547. sortLv: 0,
  548. status: true,
  549. fixed: '',
  550. columnWidth: 80
  551. },
  552. {
  553. userId: this.$store.state.user.name,
  554. functionId: 104009,
  555. serialNumber: '104009Table2PrintUnitName',
  556. tableId: '104009Table2',
  557. tableName: 'BOMComponent表',
  558. columnProp: 'printUnit',
  559. headerAlign: 'center',
  560. align: 'center',
  561. columnLabel: '单位',
  562. columnHidden: false,
  563. columnImage: false,
  564. columnSortable: false,
  565. sortLv: 0,
  566. status: true,
  567. fixed: '',
  568. columnWidth: 60
  569. },
  570. {
  571. userId: this.$store.state.user.name,
  572. functionId: 104009,
  573. serialNumber: '104009Table2IssueType',
  574. tableId: '104009Table2',
  575. tableName: 'BOMComponent表',
  576. columnProp: 'issueTypeName',
  577. headerAlign: 'center',
  578. align: 'center',
  579. columnLabel: '生产属性',
  580. columnHidden: false,
  581. columnImage: false,
  582. columnSortable: false,
  583. sortLv: 0,
  584. status: true,
  585. fixed: '',
  586. columnWidth: 80
  587. },
  588. {
  589. userId: this.$store.state.user.name,
  590. functionId: 104009,
  591. serialNumber: '104009Table2OperationNo',
  592. tableId: '104009Table2',
  593. tableName: 'BOMComponent表',
  594. columnProp: 'operationNo',
  595. headerAlign: 'center',
  596. align: 'center',
  597. columnLabel: '工序',
  598. columnHidden: false,
  599. columnImage: false,
  600. columnSortable: false,
  601. sortLv: 0,
  602. status: true,
  603. fixed: '',
  604. columnWidth: 80
  605. },
  606. {
  607. userId: this.$store.state.user.name,
  608. functionId: 104009,
  609. serialNumber: '104009Table2IssueToLoc',
  610. tableId: '104009Table2',
  611. tableName: 'BOMComponent表',
  612. columnProp: 'issueToLocName',
  613. headerAlign: 'center',
  614. align: 'center',
  615. columnLabel: '发料库位',
  616. columnHidden: false,
  617. columnImage: false,
  618. columnSortable: false,
  619. sortLv: 0,
  620. status: true,
  621. fixed: '',
  622. columnWidth: 80
  623. },
  624. {
  625. userId: this.$store.state.user.name,
  626. functionId: 104009,
  627. serialNumber: '104009Table2NoteText',
  628. tableId: '104009Table2',
  629. tableName: 'BOMComponent表',
  630. columnProp: 'noteText',
  631. headerAlign: 'center',
  632. align: 'left',
  633. columnLabel: '备注',
  634. columnHidden: false,
  635. columnImage: false,
  636. columnSortable: false,
  637. sortLv: 0,
  638. status: true,
  639. fixed: '',
  640. columnWidth: 150
  641. },
  642. ],
  643. }
  644. },
  645. mounted () {
  646. this.$nextTick(() => {
  647. this.height = window.innerHeight / 2 - 240
  648. /*第二个表格高度的动态调整*/
  649. this.secondHeight = window.innerHeight - this.height - 175
  650. this.rightWidth = window.innerWidth - this.leftWidth - 275
  651. })
  652. },
  653. created () {
  654. this.getDataList()
  655. },
  656. // js
  657. methods: {
  658. // ======== 分页相关方法 ========
  659. // 每页数
  660. sizeChangeHandle (val) {
  661. this.pageSize = val
  662. this.pageIndex = 1
  663. this.getDataList()
  664. },
  665. // 当前页
  666. currentChangeHandle (val) {
  667. this.pageIndex = val
  668. this.getDataList()
  669. },
  670. // ======== 列表数据操作方法 ========
  671. // 获取数据列表
  672. getDataList () {
  673. this.searchData.limit = this.pageSize
  674. this.searchData.page = this.pageIndex
  675. this.queryLoading = true
  676. bomSearchHeader(this.searchData).then(({data}) => {
  677. if (data.code === 0) {
  678. this.dataList = data.page.list
  679. this.pageIndex = data.page.currPage
  680. this.pageSize = data.page.pageSize
  681. this.totalPage = data.page.totalCount
  682. // 判断是否全部存在数据
  683. if (this.dataList.length > 0) {
  684. // 设置选中行
  685. this.$refs.bomHeaderTable.setCurrentRow(this.dataList[0])
  686. this.headerClickRow(this.dataList[0])
  687. } else {
  688. this.headerCurrentRow = {}
  689. this.refreshCurrentTabTable()
  690. }
  691. }
  692. this.queryLoading = false
  693. })
  694. },
  695. // 单机选中信息
  696. headerClickRow (row) {
  697. this.$refs.bomHeaderTable.toggleRowSelection(row)
  698. this.headerCurrentRow = JSON.parse(JSON.stringify(row))
  699. },
  700. // 树节点单机事件
  701. handleNodeClick (e, node) {
  702. this.alternativeData = {
  703. site: e.site,
  704. partNo: e.partNo,
  705. partDesc: e.partDesc,
  706. bomType: e.bo,
  707. engChgLevel: e.engChgLevel,
  708. alternativeNo: e.alternativeNo,
  709. alternativeDescription: e.alternativeDescription,
  710. minLotQty: e.minLotQty,
  711. noteText: e.noteText,
  712. status: e.status,
  713. }
  714. // 查询替代子物料
  715. getComponentPartList(e).then(({data}) => {
  716. if (data && data.code === 0) {
  717. this.componentPartList = data.rows
  718. } else {
  719. this.componentPartList = []
  720. }
  721. })
  722. },
  723. // ======== 页签切换相关方法 ========
  724. // 列表表格选择替换
  725. tabClick (tab, event) {
  726. // 刷新列表数据
  727. this.refreshCurrentTabTable()
  728. },
  729. // 当前值发生变化的时候修改
  730. changeCurrentRow (row, oldRow) {
  731. // 判断是否是获取焦点的事件
  732. if (row) {
  733. this.headerCurrentRow = JSON.parse(JSON.stringify(row))
  734. //刷新当前页表
  735. this.refreshCurrentTabTable()
  736. // 重置
  737. this.alternativeData = {
  738. site: '',
  739. partNo: '',
  740. partDesc: '',
  741. bomType: '',
  742. engChgLevel: '',
  743. alternativeNo: '',
  744. alternativeDescription: '',
  745. minLotQty: '',
  746. noteText: '',
  747. status: '',
  748. }
  749. this.componentPartList = []
  750. }
  751. },
  752. // 刷新页签的table数据
  753. refreshCurrentTabTable () {
  754. if (this.activeTable === 'GraphicalStructure') {
  755. // 获取bom替代树形
  756. this.getAlternativeTree()
  757. }
  758. },
  759. // 获取bom替代树形
  760. getAlternativeTree () {
  761. getAlternativeTree(this.headerCurrentRow).then(({data}) => {
  762. if (data && data.code === 0) {
  763. this.treeData = data.rows
  764. } else {
  765. this.treeData = []
  766. }
  767. })
  768. },
  769. // ======== chooseList相关方法 ========
  770. // 获取基础数据列表S
  771. getBaseList (val, type) {
  772. this.tagNo = val
  773. this.$nextTick(() => {
  774. let strVal = ''
  775. if (val === 117) {
  776. strVal = this.componentData.issueToLoc
  777. }
  778. this.$refs.baseList.init(val, strVal)
  779. })
  780. },
  781. // 列表方法的回调
  782. getBaseData (val) {
  783. if (this.tagNo === 117) {
  784. this.componentData.issueToLoc = val.location_id
  785. this.componentData.issueToLocName = val.location_name
  786. }
  787. },
  788. // ======== 导出相关方法 ========
  789. // 导出excel
  790. async createExportData () {
  791. this.searchData.limit = -1
  792. this.searchData.page = 1
  793. await bomSearchHeader(this.searchData).then(({data}) => {
  794. this.resultList = data.page.list
  795. })
  796. return this.resultList
  797. },
  798. startDownload () {},
  799. finishDownload () {},
  800. fields () {
  801. let json = '{'
  802. this.columnList.forEach((item, index) => {
  803. if (index == this.columnList.length - 1) {
  804. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"'
  805. } else {
  806. json += '"' + item.columnLabel + '"' + ':' + '"' + item.columnProp + '"' + ','
  807. }
  808. })
  809. json += '}'
  810. let s = eval('(' + json + ')')
  811. return s
  812. },
  813. }
  814. }
  815. </script>
  816. <style scoped lang="scss">
  817. .down-tree{
  818. height: 470px;
  819. display: block;
  820. overflow-y: scroll;
  821. }
  822. /deep/ .el-tabs--border-card>.el-tabs__content{
  823. padding: 5px;
  824. }
  825. </style>