detailsPop.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995
  1. <template>
  2. <div>
  3. <el-drawer
  4. title=""
  5. :visible.sync="drawer"
  6. v-if="drawer"
  7. :custom-class="isFullscreen ? 'not-fullscreen' : 'is-fullscreen'"
  8. :before-close="handleClose"
  9. :with-header="false"
  10. :append-to-body="true"
  11. >
  12. <!-- 自定义头部 -->
  13. <div class="custom-drawer-header" v-if="!isWt">
  14. <div class="radio_box rx-cc">
  15. <el-radio-group
  16. size="small"
  17. v-model="currentNodeData.bomType"
  18. @change="bomChange"
  19. >
  20. <el-radio-button
  21. :label="4"
  22. v-permissionccc="['main:bomcategory:ebom']"
  23. >EBOM
  24. </el-radio-button>
  25. <el-radio-button :label="1">PBOM </el-radio-button>
  26. <!-- v-if="
  27. searchObj.isProduct ||
  28. [1, 9].includes(searchObj.rootPathIdParent)
  29. " -->
  30. <el-radio-button
  31. :label="2"
  32. v-permissionccc="['main:bomcategory:mbom']"
  33. >MBOM
  34. </el-radio-button>
  35. <el-radio-button
  36. :label="3"
  37. v-permissionccc="['main:bomcategory:abom']"
  38. >ABOM
  39. </el-radio-button>
  40. </el-radio-group>
  41. <div style="margin-left: 100px">
  42. <el-button
  43. type="primary"
  44. size="mini"
  45. icon="el-icon-plus"
  46. @click="handleAdd"
  47. v-if="
  48. $hasPermission('main:categoryparam:saveBom') &&
  49. currentNodeData.bomType == 1 &&
  50. (currentNodeData.parentId == '0' || !currentNodeData.parentId)
  51. "
  52. >
  53. 新建
  54. </el-button>
  55. <el-button
  56. type="danger"
  57. size="mini"
  58. icon="el-icon-delete"
  59. @click="remove"
  60. v-if="
  61. (currentNodeData.approvalStatus == 0 ||
  62. currentNodeData.approvalStatus == 3) &&
  63. $hasPermission('main:categoryparam:deleteBom') &&
  64. (currentNodeData.parentId == '0' ||
  65. !currentNodeData.parentId) &&
  66. isNotData
  67. "
  68. >
  69. 删除
  70. </el-button>
  71. <el-button
  72. v-if="
  73. currentNodeData.bomType == 1 &&
  74. (currentNodeData.parentId == '0' || !currentNodeData.parentId)
  75. "
  76. type="primary"
  77. size="mini"
  78. icon="el-icon-download"
  79. plain
  80. >导出</el-button
  81. >
  82. <el-button
  83. @click="uploadFile"
  84. v-if="
  85. currentNodeData.bomType == 1 &&
  86. (currentNodeData.parentId == '0' || !currentNodeData.parentId)
  87. "
  88. type="primary"
  89. size="mini"
  90. icon="el-icon-upload2"
  91. plain
  92. >导入</el-button
  93. >
  94. <el-button
  95. type="primary"
  96. size="mini"
  97. icon="el-icon-refresh"
  98. plain
  99. @click="transformation('P')"
  100. :disabled="currentNodeData.approvalStatus != 2"
  101. v-if="
  102. currentNodeData.bomType == 4 &&
  103. (currentNodeData.parentId == '0' ||
  104. !currentNodeData.parentId) &&
  105. isNotData
  106. "
  107. >转换PBOM</el-button
  108. >
  109. <el-button
  110. type="primary"
  111. size="mini"
  112. icon="el-icon-refresh"
  113. plain
  114. :disabled="currentNodeData.approvalStatus != 2"
  115. @click="transformation('E')"
  116. v-if="
  117. currentNodeData.bomType == 1 &&
  118. (currentNodeData.parentId == '0' || !currentNodeData.parentId)
  119. "
  120. >转换EBOM</el-button
  121. >
  122. <el-button
  123. type="primary"
  124. size="mini"
  125. icon="el-icon-refresh"
  126. plain
  127. :disabled="currentNodeData.approvalStatus != 2"
  128. @click="transformation('M')"
  129. v-if="
  130. currentNodeData.bomType == 1 &&
  131. (searchObj.isProduct ||
  132. ['1', '9'].includes(searchObj.rootPathIdParent)) &&
  133. (currentNodeData.parentId == '0' || !currentNodeData.parentId)
  134. "
  135. >转换MBOM</el-button
  136. >
  137. <el-button
  138. type="primary"
  139. size="mini"
  140. icon="el-icon-refresh"
  141. plain
  142. :disabled="currentNodeData.approvalStatus != 2"
  143. @click="transformation('A')"
  144. v-if="
  145. currentNodeData.bomType == 1 &&
  146. (searchObj.isProduct ||
  147. ['1', '9'].includes(searchObj.rootPathIdParent)) &&
  148. (currentNodeData.parentId == '0' || !currentNodeData.parentId)
  149. "
  150. >转换ABOM</el-button
  151. >
  152. <el-button
  153. type="primary"
  154. size="mini"
  155. @click="handSubmit"
  156. v-if="
  157. (currentNodeData.approvalStatus == 0 ||
  158. currentNodeData.approvalStatus == 3) &&
  159. (currentNodeData.parentId == '0' ||
  160. !currentNodeData.parentId) &&
  161. isNotData
  162. "
  163. >
  164. 提交发布
  165. </el-button>
  166. <el-button type="primary" size="mini" @click="handleRefresh">
  167. 刷新
  168. </el-button>
  169. </div>
  170. </div>
  171. <div>
  172. <el-button
  173. type="text"
  174. @click="handleDetails()"
  175. v-if="isNotData && currentNodeData.approvalStatus == 1"
  176. :underline="false"
  177. >
  178. {{ approvalStatusOpt[+currentNodeData.approvalStatus] }}
  179. </el-button>
  180. <el-button
  181. type="text"
  182. style="color: #f56c6c"
  183. v-if="isNotData && currentNodeData.approvalStatus == 3"
  184. :underline="false"
  185. >
  186. {{ approvalStatusOpt[+currentNodeData.approvalStatus] }}
  187. </el-button>
  188. <el-button
  189. icon="el-icon-full-screen"
  190. type="text"
  191. @click="handleFull"
  192. >{{ isFullscreen ? '全屏' : '缩小' }}</el-button
  193. >
  194. <el-button
  195. icon="el-icon-circle-close"
  196. type="text"
  197. @click="handleClose"
  198. >关闭</el-button
  199. >
  200. </div>
  201. </div>
  202. <!-- 抽屉内容 -->
  203. <div class="drawer_content">
  204. <ele-split-layout
  205. width="260px"
  206. allow-collapse
  207. :resizable="true"
  208. :min-size="200"
  209. :max-size="-200"
  210. :left-style="{
  211. overflow: 'hidden',
  212. width: '100%'
  213. }"
  214. :right-style="{ overflow: 'hidden' }"
  215. :responsive="false"
  216. >
  217. <!-- // tree 组件 -->
  218. <div class="ele-border-lighter sys-organization-list">
  219. <div>
  220. 版本号: &nbsp; &nbsp;
  221. <el-select
  222. size="mini"
  223. style="width: 70%; margin: 6px 0"
  224. v-model="searchObj.versions"
  225. placeholder="请选择bom版本"
  226. @change="getTreeDataList"
  227. :disabled="isWt"
  228. >
  229. <el-option
  230. v-for="item in versList"
  231. :label="'V' + item.versions + '.0'"
  232. :value="item.versions"
  233. :key="item.id"
  234. >
  235. </el-option>
  236. </el-select>
  237. <br />
  238. 属性类型:
  239. <el-select
  240. size="mini"
  241. style="width: 70%; margin: 6px 0"
  242. v-model="searchObj.componentAttribute"
  243. filterable
  244. multiple
  245. placeholder="请选择属性类型"
  246. @change="getTreeDataList"
  247. :disabled="isWt"
  248. >
  249. <el-option
  250. v-for="item in sxtList"
  251. :key="item.value"
  252. :value="item.value"
  253. :label="item.label"
  254. ></el-option>
  255. </el-select>
  256. </div>
  257. <el-tree
  258. class="treeData"
  259. :data="treeList"
  260. :expand-on-click-node="false"
  261. :props="defaultProps"
  262. ref="treeRef"
  263. :default-expanded-keys="current && current.id ? [current.id] : []"
  264. :highlight-current="true"
  265. node-key="id"
  266. @node-click="handleNodeClick"
  267. >
  268. <span class="custom-tree-node" slot-scope="{ node, data }">
  269. {{ data.categoryCode }} / {{ node.label }}
  270. </span>
  271. </el-tree>
  272. </div>
  273. <template v-slot:content v-if="isNotData">
  274. <!-- 基本信息 -->
  275. <baseInfo
  276. :dataInfo="currentNodeData"
  277. @getNewBomData="getNewBomData"
  278. />
  279. <!-- table -->
  280. <el-tabs
  281. v-model="activeName"
  282. class="tab-box"
  283. type="border-card"
  284. @tab-click="handleClick"
  285. >
  286. <el-tab-pane label="属性" name="属性">
  287. <attribute
  288. :attributeData="currentNodeData"
  289. :isWt="isWt"
  290. ></attribute>
  291. </el-tab-pane>
  292. <el-tab-pane
  293. :label="
  294. currentNodeData.bomType == 1
  295. ? 'PBOM明细表'
  296. : currentNodeData.bomType == 2
  297. ? 'MBOM明细表'
  298. : currentNodeData.bomType == 3
  299. ? 'ABOM明细表'
  300. : 'EBOM明细表'
  301. "
  302. name="明细表"
  303. >
  304. <detailedList
  305. v-if="activeName == '明细表'"
  306. :isTemp="searchObj.isTemp"
  307. :attributeData="currentNodeData"
  308. :treeId="treeId"
  309. :isWt="isWt"
  310. ></detailedList>
  311. </el-tab-pane>
  312. <el-tab-pane
  313. label="工艺路线"
  314. name="工艺路线"
  315. v-if="currentNodeData.bomType != 4"
  316. >
  317. <routing
  318. v-if="activeName == '工艺路线'"
  319. ref="routingRef"
  320. :isWt="isWt"
  321. :attributeData="currentNodeData"
  322. :taskParam="currentNodeData"
  323. :resourceBomId="resourceBomId"
  324. ></routing>
  325. </el-tab-pane>
  326. <el-tab-pane
  327. label="工序配置"
  328. name="工序配置"
  329. v-if="currentNodeData.bomType != 4"
  330. >
  331. <!-- && (searchObj.isProduct ||
  332. [1, 9].includes(searchObj.rootPathIdParent)) -->
  333. <workmanship
  334. v-if="activeName == '工序配置'"
  335. ref="workmanshipRef"
  336. :attributeData="currentNodeData"
  337. :taskParam="currentNodeData"
  338. :resourceBomId="resourceBomId"
  339. ></workmanship>
  340. </el-tab-pane>
  341. </el-tabs>
  342. </template>
  343. <template v-slot:content v-else>
  344. <el-empty
  345. :image-size="200"
  346. :description="
  347. currentNodeData.bomType == 1
  348. ? 'PBOM 暂无数据,请先新建'
  349. : currentNodeData.bomType == 2
  350. ? 'MBOM 暂无数据,请先新建'
  351. : currentNodeData.bomType == 3
  352. ? 'ABOM 暂无数据,请先新建'
  353. : 'EBOM 暂无数据,请先新建'
  354. "
  355. ></el-empty>
  356. </template>
  357. </ele-split-layout>
  358. </div>
  359. </el-drawer>
  360. <baseInfoSave
  361. v-if="baseInfoShow"
  362. @close="baseClose"
  363. :categoryObj="currentNodeData"
  364. :categoryId="searchObj.categoryId"
  365. :categoryName="searchObj.categoryName"
  366. ></baseInfoSave>
  367. <importDialog
  368. :defModule="moudleName"
  369. ref="importDialogRef"
  370. :categoryId="searchObj.categoryId"
  371. @success="getTreeData"
  372. />
  373. <el-dialog
  374. title="发布"
  375. :visible.sync="isSubmit"
  376. v-if="isSubmit"
  377. width="30%"
  378. center
  379. >
  380. <div>
  381. <el-radio v-model="radioSubmit" :label="1">药品</el-radio>
  382. <el-radio v-model="radioSubmit" :label="2">器械</el-radio>
  383. </div>
  384. <span slot="footer" class="dialog-footer">
  385. <el-button @click="isSubmit = false">取 消</el-button>
  386. <el-button type="primary" @click="handJsSubmit()">确 定</el-button>
  387. </span>
  388. </el-dialog>
  389. <process-submit-dialog
  390. api-fun-name="purchaseinquiryStatusAPI"
  391. :processSubmitDialogFlag.sync="processSubmitDialogFlag"
  392. v-if="processSubmitDialogFlag"
  393. ref="processSubmitDialogRef"
  394. @reload="getTreeData"
  395. ></process-submit-dialog>
  396. <LCdetail ref="detailRef"></LCdetail>
  397. </div>
  398. </template>
  399. <script>
  400. import {
  401. getBomTreeList,
  402. versionList,
  403. getBomGetById,
  404. convert,
  405. convertABom,
  406. convertEBOM,
  407. convertEBomToPBOM,
  408. deleteBomTreeList,
  409. bomSubmit,
  410. jsBomSubmit,
  411. deviceBomSubmit,
  412. hasNewVersion
  413. } from '@/api/material/BOM.js';
  414. import baseInfo from './components/baseInfo.vue';
  415. import baseInfoSave from './components/baseInfoSave.vue';
  416. import attribute from './components/attribute.vue';
  417. import detailedList from './components/detailedList.vue';
  418. import importDialog from './qualityTesting/import-dialog.vue';
  419. import LCdetail from './components/LCdetail.vue';
  420. import routing from './components/routing.vue';
  421. import workmanship from './components/workmanship.vue';
  422. import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
  423. import { mapGetters } from 'vuex';
  424. export default {
  425. name: 'bomDetailsPop',
  426. components: {
  427. baseInfo,
  428. baseInfoSave,
  429. attribute,
  430. detailedList,
  431. importDialog,
  432. LCdetail,
  433. routing,
  434. workmanship,
  435. processSubmitDialog
  436. },
  437. data() {
  438. return {
  439. drawer: false,
  440. isFullscreen: true,
  441. resourceBomId: '',
  442. currentNodeData: {
  443. bomType: 1,
  444. children: [],
  445. parentId: ''
  446. },
  447. processSubmitDialogFlag: false,
  448. current: {},
  449. treeList: [],
  450. versList: [],
  451. treeLoading: false,
  452. defaultProps: {
  453. children: 'children',
  454. label: 'name'
  455. },
  456. searchObj: {
  457. versions: '',
  458. categoryId: '',
  459. isProduct: false,
  460. componentAttribute: [],
  461. isTemp: 0
  462. },
  463. activeName: '属性',
  464. baseInfoShow: false,
  465. isNotData: true,
  466. moudleName: 'mainUser',
  467. isSubmit: false,
  468. radioSubmit: '',
  469. treeId: null,
  470. approvalStatusOpt: {
  471. 0: '未提交',
  472. 1: '审核中',
  473. 2: '审核通过',
  474. 3: '审核不通过'
  475. },
  476. sxtList: [
  477. {
  478. label: '自制件',
  479. value: 1
  480. },
  481. {
  482. label: '采购件',
  483. value: 2
  484. },
  485. {
  486. label: '外协件',
  487. value: 3
  488. },
  489. {
  490. label: '受托件',
  491. value: 4
  492. }
  493. ],
  494. isWt: false
  495. };
  496. },
  497. computed: {
  498. clientEnvironmentId() {
  499. return this.$store.state.user.info.clientEnvironmentId;
  500. },
  501. ...mapGetters(['user'])
  502. },
  503. methods: {
  504. open(row) {
  505. this.searchObj = row;
  506. console.log(row, 'rowrowrowrowrow');
  507. sessionStorage.setItem('isCreateBom', '2');
  508. if (Object.prototype.hasOwnProperty.call(row, 'isWt') && row.isWt) {
  509. this.isWt = row.isWt;
  510. this.isFullscreen = false;
  511. }
  512. if (Object.prototype.hasOwnProperty.call(row, 'bomType')) {
  513. this.currentNodeData.bomType = row.bomType;
  514. }
  515. this.drawer = true;
  516. this.treeList = [];
  517. if (
  518. (this.currentNodeData.bomType == 2 ||
  519. this.currentNodeData.bomType == 3) &&
  520. !this.isWt
  521. ) {
  522. this.searchObj.componentAttribute = [1];
  523. } else {
  524. this.searchObj.componentAttribute = [];
  525. }
  526. // this.getTreeData();
  527. this.getVersion();
  528. },
  529. handleClose() {
  530. this.searchObj = {
  531. versions: '',
  532. categoryId: '',
  533. componentAttribute: [],
  534. isProduct: false,
  535. isTemp: 0
  536. };
  537. this.currentNodeData = {
  538. bomType: 1,
  539. children: [],
  540. parentId: ''
  541. };
  542. this.activeName = '属性';
  543. this.drawer = false;
  544. },
  545. getNewBomData(data) {
  546. let rowData = {
  547. categoryId: data.categoryId,
  548. categoryName: data.name,
  549. code: data.code,
  550. versions: data.resourceBomVersion,
  551. rootPathIdParent: data.categoryLevelPathIdParent,
  552. isProduct: true,
  553. bomType: Number(data.bomType),
  554. isTemp: data.isTemp
  555. };
  556. this.open(rowData);
  557. },
  558. handleFull() {
  559. this.isFullscreen = !this.isFullscreen;
  560. this.$forceUpdate();
  561. },
  562. bomChange(e) {
  563. this.searchObj.versions = '';
  564. this.searchObj.componentAttribute = [];
  565. this.treeList = [];
  566. // this.currentNodeData = {
  567. // children: [],
  568. // parentId: ''
  569. // };
  570. this.currentNodeData.bomType = e;
  571. if (
  572. (this.currentNodeData.bomType == 2 ||
  573. this.currentNodeData.bomType == 3) &&
  574. !this.isWt
  575. ) {
  576. this.searchObj.componentAttribute = [1];
  577. } else {
  578. this.searchObj.componentAttribute = [];
  579. }
  580. // this.getTreeData();
  581. this.getVersion();
  582. },
  583. getTreeDataList() {
  584. if (this.searchObj.versions) {
  585. this.getTreeData();
  586. } else {
  587. this.getVersion();
  588. }
  589. },
  590. async getTreeData() {
  591. try {
  592. this.treeLoading = true;
  593. let componentAttribute = '';
  594. if (
  595. this.searchObj.componentAttribute &&
  596. this.searchObj.componentAttribute.length != 0
  597. ) {
  598. componentAttribute = this.searchObj.componentAttribute.join(',');
  599. }
  600. const res = await getBomTreeList({
  601. categoryId: this.searchObj.categoryId,
  602. versions: this.searchObj.versions,
  603. bomType: this.currentNodeData.bomType,
  604. isTemp: this.searchObj.isTemp || 0,
  605. componentAttribute
  606. });
  607. this.treeLoading = false;
  608. if (res?.code === '0') {
  609. if (res.data?.length > 0) {
  610. this.treeList = res.data;
  611. this.$nextTick(() => {
  612. this.isNotData = true;
  613. // 默认高亮第一个
  614. this.$refs.treeRef.setCurrentKey(res.data[0].id);
  615. this.handleNodeClick(res.data[0]);
  616. });
  617. } else {
  618. this.isNotData = false;
  619. this.treeList = [];
  620. }
  621. return this.treeList;
  622. }
  623. } catch (error) {
  624. console.log(error);
  625. }
  626. this.treeLoading = false;
  627. },
  628. handleNodeClick(data) {
  629. this.treeId = data.id;
  630. this.resourceBomId =
  631. data.parentId != 0 ? data.resourceBomId || data.id : data.id;
  632. this.handBomDetails(this.treeId);
  633. },
  634. handBomDetails(id) {
  635. if (id) {
  636. getBomGetById(id).then((res) => {
  637. res.data.attributeType = res.data.category.attributeType;
  638. this.currentNodeData = res.data;
  639. this.searchObj.versions = this.currentNodeData.versions;
  640. this.$forceUpdate();
  641. console.log(this.currentNodeData, 'this.currentNodeData');
  642. });
  643. } else {
  644. this.currentNodeData = {
  645. bomType: 1,
  646. children: []
  647. };
  648. }
  649. },
  650. getVersion(type) {
  651. let param = {
  652. categoryId: this.searchObj.categoryId,
  653. bomType: this.currentNodeData.bomType,
  654. isTemp: this.searchObj.isTemp || 0
  655. };
  656. versionList(param).then((res) => {
  657. this.versList = res || [];
  658. if (type == 'del' || type == 'add') {
  659. if (this.versList.length >= 1) {
  660. // if (!this.searchObj.versions) {
  661. this.searchObj.versions =
  662. this.versList[this.versList.length - 1].versions;
  663. // }
  664. this.getTreeData();
  665. } else {
  666. this.searchObj.versions = '';
  667. this.isNotData = false;
  668. }
  669. } else {
  670. if (this.versList.length != 0) {
  671. this.searchObj.versions =
  672. this.versList[this.versList.length - 1].versions;
  673. this.getTreeData();
  674. } else {
  675. this.isNotData = false;
  676. }
  677. }
  678. });
  679. },
  680. handleClick(tab) {},
  681. remove() {
  682. if (this.currentNodeData.status == 1) {
  683. return this.$message.warning('已发布版本不能删除');
  684. }
  685. this.$confirm('是否确认删除?', '提示', {
  686. confirmButtonText: '确定',
  687. cancelButtonText: '取消',
  688. type: 'warning'
  689. })
  690. .then(() => {
  691. deleteBomTreeList([this.currentNodeData.id]).then((msg) => {
  692. this.$message.success('删除' + msg);
  693. this.getVersion('del');
  694. });
  695. })
  696. .finally(() => {});
  697. },
  698. async transformation(tt) {
  699. if (this.currentNodeData.status != 1) {
  700. return this.$message.warning('只有已发布版本才可以转换');
  701. }
  702. let _type = tt == 'P' ? 1 : tt == 'M' ? 2 : tt == 'A' ? 3 : 4;
  703. if (!this.isEdit) {
  704. let isHas = await this.hasVersionFn(_type);
  705. if (!isHas) return;
  706. }
  707. this.loadingInstance = this.$loading({
  708. lock: true,
  709. text: '转换中...',
  710. background: 'rgba(0, 0, 0, 0.7)'
  711. });
  712. let ULR =
  713. tt == 'M'
  714. ? convert
  715. : tt == 'A'
  716. ? convertABom
  717. : tt == 'E'
  718. ? convertEBOM
  719. : tt == 'P'
  720. ? convertEBomToPBOM
  721. : '';
  722. ULR({
  723. versions: this.searchObj.versions,
  724. categoryId: this.searchObj.categoryId
  725. })
  726. .then((data) => {
  727. if (data.code == '0') {
  728. this.loadingInstance.close();
  729. this.$message.success('转换成功');
  730. this.currentNodeData.bomType = _type;
  731. this.searchObj.versions = '';
  732. // this.getTreeData();
  733. this.getVersion();
  734. }
  735. })
  736. .catch((err) => {
  737. this.loadingInstance.close();
  738. });
  739. },
  740. handleAdd() {
  741. this.baseInfoShow = true;
  742. },
  743. baseClose(val) {
  744. if (val) {
  745. this.getVersion('add');
  746. }
  747. this.activeName = '属性';
  748. this.baseInfoShow = false;
  749. },
  750. uploadFile() {
  751. this.$refs.importDialogRef.open();
  752. },
  753. handleRefresh() {
  754. this.getVersion();
  755. // this.getTreeData();
  756. },
  757. handSubmit() {
  758. if (Number(this.currentNodeData.baseCount) <= 0) {
  759. this.$message.warning('基本用量需要大于0');
  760. return;
  761. }
  762. if (this.clientEnvironmentId == 5) {
  763. this.isSubmit = true;
  764. } else {
  765. this.submit();
  766. // this.$alert('确定要发布吗?', '提示', {
  767. // confirmButtonText: '确定',
  768. // cancelButtonText: '取消',
  769. // type: 'warning'
  770. // })
  771. // .then(() => {
  772. // bomSubmit({ businessId: this.currentNodeData.id }).then((res) => {
  773. // if (res?.code == 0) {
  774. // this.$message.success('发布成功');
  775. // this.getTreeData();
  776. // }
  777. // });
  778. // })
  779. // .catch(() => {});
  780. }
  781. },
  782. submit(businessKey) {
  783. this.processSubmitDialogFlag = true;
  784. this.$nextTick(() => {
  785. let params = {
  786. businessId: this.currentNodeData.id,
  787. businessKey: businessKey || 'bom_approver',
  788. formCreateUserId: this.user.info.userId,
  789. variables: {
  790. businessCode: this.currentNodeData.code,
  791. businessName: this.currentNodeData.name,
  792. businessType:
  793. this.currentNodeData.bomType == 1
  794. ? 'PBOM'
  795. : this.currentNodeData.bomType == 2
  796. ? 'MBOM'
  797. : this.currentNodeData.bomType == 3
  798. ? 'ABOM'
  799. : 'EBOM'
  800. }
  801. };
  802. this.$refs.processSubmitDialogRef.init(params);
  803. });
  804. },
  805. handJsSubmit() {
  806. if (!this.radioSubmit) {
  807. return this.$message.warning('请选择提交的BOM的类型!');
  808. }
  809. this.submit(
  810. this.radioSubmit == 1 ? 'bom_release' : 'bom_release_device'
  811. );
  812. this.isSubmit = false;
  813. // let URL = this.radioSubmit == 1 ? jsBomSubmit : deviceBomSubmit;
  814. // this.$alert('确定要发布吗?', '提示', {
  815. // confirmButtonText: '确定',
  816. // cancelButtonText: '取消',
  817. // type: 'warning'
  818. // })
  819. // .then(() => {
  820. // URL({ businessId: this.currentNodeData.id }).then((res) => {
  821. // this.isSubmit = false;
  822. // this.$message.success('发布成功');
  823. // this.getTreeData();
  824. // });
  825. // })
  826. // .catch(() => {});
  827. },
  828. handleDetails() {
  829. if (!this.currentNodeData.processInstanceId) {
  830. this.$message.info('未提交没有审核流程');
  831. } else {
  832. this.$refs.detailRef.open(this.currentNodeData.processInstanceId);
  833. }
  834. },
  835. async hasVersionFn(bomType) {
  836. return new Promise((resolve) => {
  837. let param = {
  838. categoryId: this.searchObj.categoryId,
  839. bomType: bomType
  840. };
  841. hasNewVersion(param).then((res) => {
  842. if (res.data == 1) {
  843. this.$confirm('已经草稿版本存在,是否覆盖?', '提示', {
  844. confirmButtonText: '覆盖',
  845. cancelButtonText: '取消',
  846. type: 'warning'
  847. })
  848. .then(() => {
  849. resolve(true);
  850. })
  851. .catch(() => {
  852. resolve(false);
  853. });
  854. } else {
  855. resolve(true);
  856. }
  857. });
  858. });
  859. }
  860. }
  861. };
  862. </script>
  863. <style lang="scss" scoped>
  864. /* 自定义全屏样式 */
  865. ::v-deep .is-fullscreen {
  866. width: 100vw !important;
  867. height: 100vh !important;
  868. overflow: hidden !important;
  869. /* 隐藏滚动条 */
  870. }
  871. ::v-deep .not-fullscreen {
  872. width: calc(100vw - 260px) !important;
  873. height: 100vh !important;
  874. overflow: hidden !important;
  875. /* 隐藏滚动条 */
  876. }
  877. .custom-drawer-header {
  878. display: flex;
  879. justify-content: space-between;
  880. align-items: center;
  881. padding: 4px 15px;
  882. background-color: #f5f7fa;
  883. /* 自定义背景色 */
  884. border-bottom: 1px solid #ebeef5;
  885. /* 自定义边框,与抽屉内容分隔 */
  886. }
  887. .drawer_content {
  888. margin: 10px 20px;
  889. box-sizing: border-box;
  890. }
  891. .sys-organization-list {
  892. height: calc(100vh - 65px);
  893. box-sizing: border-box;
  894. border-width: 1px;
  895. border-style: solid;
  896. overflow: auto;
  897. padding: 0 10px;
  898. box-sizing: border-box;
  899. display: flex;
  900. flex-direction: column;
  901. overflow: hidden;
  902. .treeData {
  903. height: 0 1 auto;
  904. overflow-y: auto;
  905. height: calc(100vh - 125px);
  906. }
  907. }
  908. .tab-box {
  909. margin-top: 12px;
  910. }
  911. </style>