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.

931 lines
27 KiB

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