index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <BOMSearch
  5. @search="reload"
  6. :statusOpt="statusOpt"
  7. :categoryCode="where.categoryCode"
  8. />
  9. <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
  10. <el-tab-pane label="PBOM" name="1"> </el-tab-pane>
  11. <el-tab-pane label="MBOM" name="2"> </el-tab-pane>
  12. <el-tab-pane label="ABOM" name="3"> </el-tab-pane>
  13. <ele-pro-table
  14. ref="table"
  15. :columns="columns"
  16. :datasource="datasource"
  17. :initLoad="false"
  18. class="dict-table"
  19. tool-class="ele-toolbar-actions"
  20. >
  21. <template v-slot:approvalStatus="{ row }">
  22. <el-link
  23. type="primary"
  24. :underline="false"
  25. @click="handleDetails(row)"
  26. >
  27. {{ approvalStatusOpt[+row.approvalStatus] }}
  28. </el-link>
  29. </template>
  30. <template v-slot:isTemp="{ row }">
  31. <el-tag size="mini" v-if="row.isTemp == 1">主数据</el-tag>
  32. </template>
  33. <!-- 表头工具栏 -->
  34. <template v-slot:action="{ row }">
  35. <el-link type="primary" @click="handelDetail(row)">详情</el-link>
  36. <el-link
  37. v-if="row.status != 1 && (row.approvalStatus == 0 || row.approvalStatus == 3)"
  38. type="primary"
  39. @click="handSubmit(row)"
  40. >发布</el-link
  41. >
  42. <el-link
  43. type="danger"
  44. :underline="false"
  45. v-if="activeName == 1 && row.status != 1 && (row.approvalStatus == 0 || row.approvalStatus == 3)"
  46. @click="handDel(row)"
  47. >
  48. 删除
  49. </el-link>
  50. </template>
  51. </ele-pro-table>
  52. </el-tabs>
  53. </el-card>
  54. <el-dialog
  55. title="发布"
  56. :visible.sync="isSubmit"
  57. v-if="isSubmit"
  58. width="30%"
  59. center
  60. >
  61. <div>
  62. <el-radio v-model="radioSubmit" :label="1">药品</el-radio>
  63. <el-radio v-model="radioSubmit" :label="2">器械</el-radio>
  64. </div>
  65. <span slot="footer" class="dialog-footer">
  66. <el-button @click="isSubmit = false">取 消</el-button>
  67. <el-button type="primary" @click="handJsSubmit()">确 定</el-button>
  68. </span>
  69. </el-dialog>
  70. <LCdetail ref="detailRef"></LCdetail>
  71. </div>
  72. </template>
  73. <script>
  74. import BOMSearch from './components/BOM-search.vue';
  75. import {
  76. getBomPageList,
  77. startAndStop,
  78. bomSubmit,
  79. jsBomSubmit,
  80. deviceBomSubmit,
  81. deleteBomTreeList
  82. } from '@/api/material/BOM';
  83. import LCdetail from './components/LCdetail.vue';
  84. export default {
  85. name: 'SystemDictionary',
  86. components: { BOMSearch, LCdetail },
  87. data() {
  88. return {
  89. // 表格列配置
  90. columns: [
  91. {
  92. label: '序号',
  93. columnKey: 'index',
  94. type: 'index',
  95. width: 55,
  96. align: 'center',
  97. showOverflowTooltip: true
  98. },
  99. {
  100. prop: 'code',
  101. label: 'BOM编码',
  102. showOverflowTooltip: true
  103. },
  104. {
  105. prop: 'name',
  106. label: 'BOM名称',
  107. showOverflowTooltip: true
  108. },
  109. {
  110. prop: 'categoryCode',
  111. label: '编码',
  112. showOverflowTooltip: true
  113. },
  114. {
  115. prop: 'categoryName',
  116. label: '名称',
  117. showOverflowTooltip: true
  118. },
  119. {
  120. prop: 'versions',
  121. label: '版本'
  122. },
  123. {
  124. prop: 'status ',
  125. label: '状态',
  126. formatter: (row) => {
  127. return this.statusOpt[+row.status];
  128. }
  129. },
  130. {
  131. prop: 'approvalStatus',
  132. label: '审核状态',
  133. slot: 'approvalStatus'
  134. },
  135. {
  136. width: 100,
  137. prop: 'isTemp',
  138. slot: 'isTemp',
  139. label: '主数据'
  140. },
  141. {
  142. prop: 'createName',
  143. label: '创建人',
  144. showOverflowTooltip: true
  145. },
  146. {
  147. prop: 'createTime',
  148. label: '创建日期',
  149. showOverflowTooltip: true
  150. },
  151. {
  152. action: 'action',
  153. slot: 'action',
  154. label: '操作'
  155. }
  156. ],
  157. statusOpt: {
  158. 0: '草稿',
  159. 1: '已发布',
  160. 2: '已停用'
  161. },
  162. approvalStatusOpt: {
  163. 0: '未提交',
  164. 1: '审核中',
  165. 2: '审核通过',
  166. 3: '审核不通过'
  167. },
  168. loading: false,
  169. loadingInstance: null,
  170. where: {},
  171. activeName: '1',
  172. isSubmit: false,
  173. JsRId: null,
  174. radioSubmit: 1
  175. };
  176. },
  177. computed: {
  178. clientEnvironmentId() {
  179. return this.$store.state.user.info.clientEnvironmentId;
  180. }
  181. },
  182. mounted() {
  183. this.initData();
  184. },
  185. activated() {
  186. this.initData();
  187. },
  188. methods: {
  189. initData() {
  190. let { categoryId, code } = this.$route.query;
  191. if (categoryId && code) {
  192. this.where.categoryCode = code;
  193. this.where.categoryId = categoryId;
  194. getBomPageList({
  195. status: 1,
  196. categoryCode: this.where.categoryCode,
  197. pageNum: 1,
  198. size: 10
  199. }).then((data) => {
  200. if (data.count > 1) {
  201. this.$refs.table.setData(data.list || []);
  202. } else {
  203. this.handelDetail(
  204. data.list[0]
  205. ? data.list[0]
  206. : { categoryId: this.where.categoryId },
  207. true
  208. );
  209. }
  210. });
  211. } else {
  212. this.reload();
  213. }
  214. },
  215. /* 启用关闭BOM */
  216. openBom(row, boolean) {
  217. this.loadingInstance = this.$loading({
  218. lock: true,
  219. text: boolean ? '启用中...' : '关闭中...',
  220. background: 'rgba(0, 0, 0, 0.7)'
  221. });
  222. startAndStop({ id: row.id, status: row.status }).then(() => {
  223. this.$message.success('操作成功');
  224. this.loadingInstance.close();
  225. });
  226. setTimeout(() => {}, 2000);
  227. },
  228. handSubmit(row) {
  229. if (this.clientEnvironmentId == 3) {
  230. this.JsRId = row.id;
  231. this.isSubmit = true;
  232. } else {
  233. this.$alert('确定要发布吗?', '提示', {
  234. confirmButtonText: '确定',
  235. cancelButtonText: '取消',
  236. type: 'warning'
  237. })
  238. .then(() => {
  239. bomSubmit({ businessId: row.id }).then((res) => {
  240. this.$message.success('发布成功');
  241. this.reload();
  242. });
  243. })
  244. .catch(() => {});
  245. }
  246. },
  247. handJsSubmit() {
  248. let URL = this.radioSubmit == 1 ? jsBomSubmit : deviceBomSubmit;
  249. this.$alert('确定要发布吗?', '提示', {
  250. confirmButtonText: '确定',
  251. cancelButtonText: '取消',
  252. type: 'warning'
  253. })
  254. .then(() => {
  255. URL({ businessId: this.JsRId }).then((res) => {
  256. this.isSubmit = false;
  257. this.$message.success('发布成功');
  258. this.reload();
  259. });
  260. })
  261. .catch(() => {});
  262. },
  263. /* 表格数据源 */
  264. datasource({ where, page, limit }) {
  265. return getBomPageList({
  266. ...where,
  267. bomType: Number(this.activeName),
  268. isTemp: true,
  269. pageNum: page,
  270. size: limit
  271. });
  272. },
  273. handelDetail(row, noBack) {
  274. this.$router.push({
  275. path: '/material/BOMmanage/details',
  276. query: {
  277. versions: row.versions,
  278. categoryId: row.categoryId,
  279. noBack,
  280. bType: this.activeName,
  281. categoryLevelPathIdParent: row.rootCategoryLevelId,
  282. isProduct: true,
  283. isTemp: row.isTemp
  284. }
  285. });
  286. },
  287. /* 刷新表格 */
  288. reload(where) {
  289. this.$refs.table.reload({ where });
  290. },
  291. handleClick(tab) {
  292. this.activeName = tab.name;
  293. this.reload();
  294. },
  295. handDel(row) {
  296. this.$confirm('是否确认删除?', '提示', {
  297. confirmButtonText: '确定',
  298. cancelButtonText: '取消',
  299. type: 'warning'
  300. })
  301. .then(() => {
  302. deleteBomTreeList([row.id]).then(() => {
  303. this.reload();
  304. });
  305. })
  306. .catch(() => {
  307. this.$message({
  308. type: 'info',
  309. message: '已取消删除'
  310. });
  311. });
  312. },
  313. handleDetails(row) {
  314. if (!row.processInstanceId) {
  315. this.$message.info('未提交没有审核流程');
  316. } else {
  317. this.$refs.detailRef.open(row.processInstanceId);
  318. }
  319. }
  320. }
  321. };
  322. </script>
  323. <style lang="scss" scoped>
  324. .ele-body {
  325. height: 100%;
  326. ::v-deep .el-card {
  327. height: 100%;
  328. .el-card__body {
  329. height: 100%;
  330. display: flex;
  331. flex-direction: column;
  332. .dict-table {
  333. flex: 1;
  334. overflow: hidden;
  335. display: flex;
  336. flex-direction: column;
  337. .el-table {
  338. flex: 1;
  339. overflow-y: auto;
  340. }
  341. }
  342. }
  343. }
  344. }
  345. </style>