detailsPop.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <template>
  2. <div>
  3. <el-drawer
  4. title=""
  5. :visible.sync="drawer"
  6. :custom-class="isFullscreen ? 'not-fullscreen' : 'is-fullscreen'"
  7. :before-close="handleClose"
  8. :with-header="false"
  9. >
  10. <!-- 自定义头部 -->
  11. <div class="custom-drawer-header">
  12. <div class="radio_box rx-cc">
  13. <el-radio-group
  14. size="small"
  15. v-model="currentNodeData.bomType"
  16. @change="bomChange"
  17. >
  18. <el-radio-button :label="4">EBOM </el-radio-button>
  19. <el-radio-button :label="1">PBOM </el-radio-button>
  20. <el-radio-button :label="2">MBOM </el-radio-button>
  21. <el-radio-button :label="3">ABOM </el-radio-button>
  22. </el-radio-group>
  23. <div style="margin-left: 100px">
  24. <el-button
  25. type="primary"
  26. size="mini"
  27. icon="el-icon-plus"
  28. @click="handleAdd"
  29. >
  30. 新建
  31. </el-button>
  32. <el-button
  33. type="danger"
  34. size="mini"
  35. icon="el-icon-delete"
  36. @click="remove"
  37. >
  38. 删除
  39. </el-button>
  40. <el-button
  41. v-if="currentNodeData.bomType == 1"
  42. type="primary"
  43. size="mini"
  44. icon="el-icon-download"
  45. plain
  46. >导出</el-button
  47. >
  48. <el-button
  49. @click="uploadFile"
  50. v-if="currentNodeData.bomType == 1"
  51. type="primary"
  52. size="mini"
  53. icon="el-icon-upload2"
  54. plain
  55. >导入</el-button
  56. >
  57. <el-button
  58. type="primary"
  59. size="mini"
  60. icon="el-icon-refresh"
  61. plain
  62. @click="transformation('P')"
  63. v-if="currentNodeData.bomType == 4"
  64. >转换PBOM</el-button
  65. >
  66. <el-button
  67. type="primary"
  68. size="mini"
  69. icon="el-icon-refresh"
  70. plain
  71. @click="transformation('E')"
  72. v-if="currentNodeData.bomType == 1"
  73. >转换EBOM</el-button
  74. >
  75. <el-button
  76. type="primary"
  77. size="mini"
  78. icon="el-icon-refresh"
  79. plain
  80. @click="transformation('M')"
  81. v-if="currentNodeData.bomType == 1"
  82. >转换MBOM</el-button
  83. >
  84. <el-button
  85. type="primary"
  86. size="mini"
  87. icon="el-icon-refresh"
  88. plain
  89. @click="transformation('A')"
  90. v-if="currentNodeData.bomType == 1"
  91. >转换ABOM</el-button
  92. >
  93. <el-button
  94. type="primary"
  95. size="mini"
  96. @click="handSubmit"
  97. v-if="
  98. currentNodeData.approvalStatus == 0 ||
  99. currentNodeData.approvalStatus == 3
  100. "
  101. >
  102. 提交发布
  103. </el-button>
  104. <el-button type="primary" size="mini" @click="handleSave">
  105. 保存
  106. </el-button>
  107. </div>
  108. </div>
  109. <div>
  110. <el-button
  111. type="text"
  112. @click="handleDetails()"
  113. v-if="isNotData && currentNodeData.approvalStatus == 1"
  114. :underline="false"
  115. >
  116. {{ approvalStatusOpt[+currentNodeData.approvalStatus] }}
  117. </el-button>
  118. <el-button
  119. type="text"
  120. style="color: #f56c6c"
  121. v-if="isNotData && currentNodeData.approvalStatus == 3"
  122. :underline="false"
  123. >
  124. {{ approvalStatusOpt[+currentNodeData.approvalStatus] }}
  125. </el-button>
  126. <el-button
  127. icon="el-icon-full-screen"
  128. type="text"
  129. @click="handleFull"
  130. >{{ isFullscreen ? '全屏' : '缩小' }}</el-button
  131. >
  132. <el-button
  133. icon="el-icon-circle-close"
  134. type="text"
  135. @click="handleClose"
  136. >关闭</el-button
  137. >
  138. </div>
  139. </div>
  140. <!-- 抽屉内容 -->
  141. <div class="drawer_content">
  142. <ele-split-layout
  143. width="260px"
  144. allow-collapse
  145. :resizable="true"
  146. :min-size="200"
  147. :max-size="-200"
  148. :left-style="{
  149. overflow: 'hidden',
  150. width: '100%'
  151. }"
  152. :right-style="{ overflow: 'hidden' }"
  153. :responsive="false"
  154. >
  155. <div class="ele-border-lighter sys-organization-list">
  156. <div>
  157. 版本号: &nbsp; &nbsp;
  158. <el-select
  159. size="mini"
  160. style="width: 72%; margin: 6px 0"
  161. v-model="searchObj.versions"
  162. placeholder="请选择bom版本"
  163. @change="getTreeData"
  164. >
  165. <el-option
  166. v-for="item in versList"
  167. :label="item.versions"
  168. :value="item.versions"
  169. :key="item.id"
  170. >
  171. </el-option>
  172. </el-select>
  173. </div>
  174. <el-tree
  175. class="treeData"
  176. :data="treeList"
  177. :expand-on-click-node="false"
  178. :props="defaultProps"
  179. ref="treeRef"
  180. :default-expanded-keys="current && current.id ? [current.id] : []"
  181. :highlight-current="true"
  182. node-key="id"
  183. @node-click="handleNodeClick"
  184. >
  185. <span class="custom-tree-node" slot-scope="{ node, data }">
  186. {{ node.label }} / {{ data.code }}
  187. </span>
  188. </el-tree>
  189. </div>
  190. <template v-slot:content v-if="isNotData">
  191. <baseInfo :dataInfo="currentNodeData" />
  192. <el-tabs
  193. v-model="activeName"
  194. class="tab-box"
  195. type="border-card"
  196. @tab-click="handleClick"
  197. >
  198. <el-tab-pane label="属性" name="属性">
  199. <attribute v-if="activeName == '属性'" :attributeData="currentNodeData"></attribute>
  200. </el-tab-pane>
  201. <el-tab-pane
  202. :label="
  203. currentNodeData.bomType == 1
  204. ? 'PBOM明细表'
  205. : currentNodeData.bomType == 2
  206. ? 'MBOM明细表'
  207. : currentNodeData.bomType == 3
  208. ? 'ABOM明细表'
  209. : 'EBOM明细表'
  210. "
  211. name="明细表"
  212. >
  213. <detailedList :attributeData="currentNodeData" :treeId="treeId"></detailedList>
  214. </el-tab-pane>
  215. <el-tab-pane
  216. label="工艺路线"
  217. name="工艺路线"
  218. v-if="
  219. currentNodeData.bomType != 4
  220. "
  221. >
  222. <routing
  223. v-if="activeName == '工艺路线'"
  224. ref="routingRef"
  225. :attributeData="currentNodeData"
  226. :taskParam="currentNodeData"
  227. ></routing>
  228. </el-tab-pane>
  229. <el-tab-pane
  230. label="工序配置"
  231. name="工序配置"
  232. v-if="
  233. currentNodeData.bomType != 1
  234. "
  235. >
  236. <workmanship
  237. v-if="activeName == '工序配置'"
  238. ref="workmanshipRef"
  239. :taskParam="currentNodeData"
  240. ></workmanship>
  241. </el-tab-pane>
  242. </el-tabs>
  243. </template>
  244. <template v-slot:content v-else>
  245. <el-empty
  246. :image-size="200"
  247. :description="
  248. currentNodeData.bomType == 1
  249. ? 'PBOM 暂无数据,请先新建'
  250. : currentNodeData.bomType == 2
  251. ? 'MBOM 暂无数据,请先新建'
  252. : currentNodeData.bomType == 3
  253. ? 'ABOM 暂无数据,请先新建'
  254. : 'EBOM 暂无数据,请先新建'
  255. "
  256. ></el-empty>
  257. </template>
  258. </ele-split-layout>
  259. </div>
  260. </el-drawer>
  261. <baseInfoSave
  262. v-if="baseInfoShow"
  263. @close="baseClose"
  264. :categoryObj="currentNodeData"
  265. ></baseInfoSave>
  266. <importDialog
  267. :defModule="moudleName"
  268. ref="importDialogRef"
  269. @success="getTreeData"
  270. />
  271. <el-dialog
  272. title="发布"
  273. :visible.sync="isSubmit"
  274. v-if="isSubmit"
  275. width="30%"
  276. center
  277. >
  278. <div>
  279. <el-radio v-model="radioSubmit" :label="1">药品</el-radio>
  280. <el-radio v-model="radioSubmit" :label="2">器械</el-radio>
  281. </div>
  282. <span slot="footer" class="dialog-footer">
  283. <el-button @click="isSubmit = false">取 消</el-button>
  284. <el-button type="primary" @click="handJsSubmit()">确 定</el-button>
  285. </span>
  286. </el-dialog>
  287. <LCdetail ref="detailRef"></LCdetail>
  288. </div>
  289. </template>
  290. <script>
  291. import {
  292. getBomTreeList,
  293. versionList,
  294. getBomGetById,
  295. convert,
  296. convertABom,
  297. convertEBOM,
  298. convertEBomToPBOM,
  299. deleteBomTreeList,
  300. bomSubmit,
  301. jsBomSubmit,
  302. deviceBomSubmit
  303. } from '@/api/material/BOM.js';
  304. import baseInfo from './components/baseInfo.vue';
  305. import baseInfoSave from './components/baseInfoSave.vue';
  306. import attribute from './components/attribute.vue';
  307. import detailedList from './components/detailedList.vue';
  308. import importDialog from './qualityTesting/import-dialog.vue';
  309. import LCdetail from './components/LCdetail.vue';
  310. import routing from './components/routing.vue';
  311. import workmanship from './components/workmanship.vue';
  312. export default {
  313. components: {
  314. baseInfo,
  315. baseInfoSave,
  316. attribute,
  317. detailedList,
  318. importDialog,
  319. LCdetail,
  320. routing,
  321. workmanship
  322. },
  323. data() {
  324. return {
  325. drawer: false,
  326. isFullscreen: true,
  327. currentNodeData: {
  328. bomType: 1,
  329. children: []
  330. },
  331. isProduct: false,
  332. current: {},
  333. treeList: [],
  334. versList: [],
  335. treeLoading: false,
  336. defaultProps: {
  337. children: 'children',
  338. label: 'name'
  339. },
  340. searchObj: {
  341. versions: '',
  342. categoryId: '',
  343. isProduct: false,
  344. isTemp: 0
  345. },
  346. activeName: '属性',
  347. baseInfoShow: false,
  348. isNotData: true,
  349. moudleName: 'mainUser',
  350. isSubmit: false,
  351. radioSubmit: 1,
  352. treeId: null,
  353. approvalStatusOpt: {
  354. 0: '未提交',
  355. 1: '审核中',
  356. 2: '审核通过',
  357. 3: '审核不通过'
  358. }
  359. };
  360. },
  361. computed: {
  362. clientEnvironmentId() {
  363. return this.$store.state.user.info.clientEnvironmentId;
  364. }
  365. },
  366. methods: {
  367. open(row) {
  368. this.searchObj = row;
  369. this.drawer = true;
  370. this.getTreeData();
  371. this.getVersion();
  372. },
  373. handleClose() {
  374. this.drawer = false;
  375. },
  376. handleFull() {
  377. this.isFullscreen = !this.isFullscreen;
  378. this.$forceUpdate();
  379. },
  380. bomChange(e) {
  381. this.searchObj.versions = '';
  382. this.currentNodeData.bomType = e;
  383. this.getTreeData();
  384. this.getVersion();
  385. },
  386. async getTreeData() {
  387. try {
  388. this.treeLoading = true;
  389. const res = await getBomTreeList({
  390. categoryId: this.searchObj.categoryId,
  391. versions: this.searchObj.versions,
  392. bomType: this.currentNodeData.bomType,
  393. isTemp: this.searchObj.isTemp
  394. });
  395. this.treeLoading = false;
  396. if (res?.code === '0') {
  397. if (res.data?.length > 0) {
  398. this.treeList = res.data;
  399. this.$nextTick(() => {
  400. this.isNotData = true;
  401. // 默认高亮第一个
  402. this.$refs.treeRef.setCurrentKey(res.data[0].id);
  403. this.handleNodeClick(res.data[0]);
  404. });
  405. } else {
  406. this.isNotData = false;
  407. this.treeList = [];
  408. }
  409. return this.treeList;
  410. }
  411. } catch (error) {
  412. console.log(error);
  413. }
  414. this.treeLoading = false;
  415. },
  416. handleNodeClick(data) {
  417. this.treeId = data.id;
  418. this.handBomDetails(data.id);
  419. },
  420. handBomDetails(id) {
  421. if (id) {
  422. getBomGetById(id).then((res) => {
  423. this.currentNodeData = res.data;
  424. this.$forceUpdate();
  425. });
  426. } else {
  427. this.currentNodeData = {
  428. bomType: 1,
  429. children: []
  430. };
  431. }
  432. },
  433. getVersion(type) {
  434. let param = {
  435. categoryId: this.searchObj.categoryId,
  436. bomType: this.currentNodeData.bomType
  437. };
  438. versionList(param).then((res) => {
  439. this.versList = res || [];
  440. if (type == 'del' || type == 'add') {
  441. if (this.versList.length >= 1) {
  442. this.searchObj.versions =
  443. this.versList[this.versList.length - 1].versions;
  444. } else {
  445. this.searchObj.versions = '';
  446. }
  447. this.getTreeData();
  448. }
  449. });
  450. },
  451. handleClick(tab) {},
  452. remove() {
  453. if (this.currentNodeData.status == 1) {
  454. return this.$message.warning('已发布版本不能删除');
  455. }
  456. this.$confirm('是否确认删除?', '提示', {
  457. confirmButtonText: '确定',
  458. cancelButtonText: '取消',
  459. type: 'warning'
  460. })
  461. .then(() => {
  462. deleteBomTreeList([this.currentNodeData.id]).then((msg) => {
  463. this.$message.success('删除' + msg);
  464. this.getVersion('del');
  465. });
  466. })
  467. .finally(() => {});
  468. },
  469. transformation(tt) {
  470. if (this.currentNodeData.status != 1) {
  471. return this.$message.warning('只有已发布版本才可以转换');
  472. }
  473. this.loadingInstance = this.$loading({
  474. lock: true,
  475. text: '转换中...',
  476. background: 'rgba(0, 0, 0, 0.7)'
  477. });
  478. let ULR = tt == 'M' ? convert : tt == 'A' ? convertABom : tt == 'E' ? convertEBOM : tt == 'P' ? convertEBomToPBOM : '';
  479. ULR({ versions: this.searchObj.versions, categoryId: this.searchObj.categoryId }).then(
  480. (data) => {
  481. if (data.code == '0') {
  482. this.loadingInstance.close();
  483. this.$message.success('转换成功');
  484. }
  485. }
  486. );
  487. },
  488. handleAdd() {
  489. this.baseInfoShow = true;
  490. },
  491. baseClose(val) {
  492. if (val) {
  493. this.getVersion('add');
  494. }
  495. this.baseInfoShow = false;
  496. },
  497. uploadFile() {
  498. this.$refs.importDialogRef.open();
  499. },
  500. handleSave() {
  501. this.$message.success('保存成功');
  502. this.handleClose();
  503. },
  504. handSubmit() {
  505. if (this.clientEnvironmentId == 4) {
  506. this.isSubmit = true;
  507. } else {
  508. this.$alert('确定要发布吗?', '提示', {
  509. confirmButtonText: '确定',
  510. cancelButtonText: '取消',
  511. type: 'warning'
  512. })
  513. .then(() => {
  514. bomSubmit({ businessId: this.currentNodeData.id }).then((res) => {
  515. this.$message.success('发布成功');
  516. this.getTreeData();
  517. });
  518. })
  519. .catch(() => {});
  520. }
  521. },
  522. handJsSubmit() {
  523. let URL = this.radioSubmit == 1 ? jsBomSubmit : deviceBomSubmit;
  524. this.$alert('确定要发布吗?', '提示', {
  525. confirmButtonText: '确定',
  526. cancelButtonText: '取消',
  527. type: 'warning'
  528. })
  529. .then(() => {
  530. URL({ businessId: this.currentNodeData.id }).then((res) => {
  531. this.isSubmit = false;
  532. this.$message.success('发布成功');
  533. this.getTreeData();
  534. });
  535. })
  536. .catch(() => {});
  537. },
  538. handleDetails() {
  539. if (!this.currentNodeData.processInstanceId) {
  540. this.$message.info('未提交没有审核流程');
  541. } else {
  542. this.$refs.detailRef.open(this.currentNodeData.processInstanceId);
  543. }
  544. }
  545. }
  546. };
  547. </script>
  548. <style lang="scss" scoped>
  549. /* 自定义全屏样式 */
  550. ::v-deep .is-fullscreen {
  551. width: 100vw !important;
  552. height: 100vh !important;
  553. overflow: hidden !important; /* 隐藏滚动条 */
  554. }
  555. ::v-deep .not-fullscreen {
  556. width: calc(100vw - 260px) !important;
  557. height: 100vh !important;
  558. overflow: hidden !important; /* 隐藏滚动条 */
  559. }
  560. .custom-drawer-header {
  561. display: flex;
  562. justify-content: space-between;
  563. align-items: center;
  564. padding: 4px 15px;
  565. background-color: #f5f7fa; /* 自定义背景色 */
  566. border-bottom: 1px solid #ebeef5; /* 自定义边框,与抽屉内容分隔 */
  567. }
  568. .drawer_content {
  569. margin: 10px 20px;
  570. box-sizing: border-box;
  571. }
  572. .sys-organization-list {
  573. height: calc(100vh - 65px);
  574. box-sizing: border-box;
  575. border-width: 1px;
  576. border-style: solid;
  577. overflow: auto;
  578. padding: 0 10px;
  579. box-sizing: border-box;
  580. display: flex;
  581. flex-direction: column;
  582. overflow: hidden;
  583. .treeData {
  584. height: 0 1 auto;
  585. overflow-y: auto;
  586. }
  587. }
  588. .tab-box {
  589. margin-top: 12px;
  590. }
  591. </style>