detailsPop.vue 26 KB

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