index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <BOMSearch @search="reload" :statusOpt="statusOpt" :categoryCode="where.categoryCode" />
  5. <!-- -->
  6. <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
  7. <el-tab-pane label="EBOM" name="4"> </el-tab-pane>
  8. <el-tab-pane label="PBOM" name="1"> </el-tab-pane>
  9. <el-tab-pane label="MBOM" name="2"> </el-tab-pane>
  10. <el-tab-pane label="ABOM" name="3"> </el-tab-pane>
  11. <ele-pro-table
  12. ref="table"
  13. :columns="columns"
  14. :datasource="datasource"
  15. class="dict-table"
  16. tool-class="ele-toolbar-actions"
  17. @sort-change="onSortChange"
  18. :page-size="pageSize"
  19. @columns-change="handleColumnChange"
  20. :cache-key="cacheKeyUrl"
  21. >
  22. <template v-slot:approvalStatus="{ row }">
  23. <el-link type="primary" :underline="false" @click="handleDetails(row)">
  24. {{ approvalStatusOpt[+row.approvalStatus] }}
  25. </el-link>
  26. </template>
  27. <template v-slot:versions="{ row }">
  28. V{{ row.versions }}.0
  29. </template>
  30. <template v-slot:isTemp="{ row }">
  31. <el-tag size="mini" v-if="row.isTemp == 1">主数据</el-tag>
  32. </template>
  33. <template v-slot:rootCategoryLevelId="{ row }">
  34. {{ rootCategoryLevelIdText(row.rootCategoryLevelId) }}
  35. </template>
  36. <template v-slot:attributeType="{ row }">
  37. {{ attributeTypeText(row.attributeType) }}
  38. </template>
  39. <template v-slot:produceType="{ row }">
  40. <el-select v-model="row.produceType" filterable multiple disabled class="ele-block" size="mini">
  41. <el-option v-for="item in dictList" :key="item.value" :value="item.value" :label="item.label"></el-option>
  42. </el-select>
  43. </template>
  44. <!-- 表头工具栏 -->
  45. <template v-slot:action="{ row }">
  46. <el-link type="primary" @click="handelDetail(row)">详情</el-link>
  47. <el-link v-if="row.status != 1 && (row.approvalStatus == 0 || row.approvalStatus == 3)" type="primary"
  48. @click="handSubmit(row)">发布</el-link>
  49. <el-link type="danger" :underline="false"
  50. v-if="activeName == 1 && row.status != 1 && (row.approvalStatus == 0 || row.approvalStatus == 3)"
  51. @click="handDel(row)">
  52. 删除
  53. </el-link>
  54. </template>
  55. </ele-pro-table>
  56. </el-tabs>
  57. </el-card>
  58. <el-dialog title="发布" :visible.sync="isSubmit" v-if="isSubmit" width="30%" center>
  59. <div>
  60. <el-radio v-model="radioSubmit" :label="1">药品</el-radio>
  61. <el-radio v-model="radioSubmit" :label="2">器械</el-radio>
  62. </div>
  63. <span slot="footer" class="dialog-footer">
  64. <el-button @click="isSubmit = false">取 消</el-button>
  65. <el-button type="primary" @click="handJsSubmit()">确 定</el-button>
  66. </span>
  67. </el-dialog>
  68. <LCdetail ref="detailRef"></LCdetail>
  69. <BomDetailsPop ref="bomDrawer"></BomDetailsPop>
  70. </div>
  71. </template>
  72. <script>
  73. import tabMixins from '@/mixins/tableColumnsMixin';
  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. import { getByCode } from '@/api/system/dictionary-data';
  85. import BomDetailsPop from '../BOMmanage/detailsPop.vue'
  86. export default {
  87. name: 'SystemDictionary',
  88. components: { BOMSearch, LCdetail, BomDetailsPop },
  89. mixins: [tabMixins],
  90. data() {
  91. return {
  92. // 表格列配置
  93. columns: [
  94. {
  95. label: '序号',
  96. columnKey: 'index',
  97. type: 'index',
  98. width: 55,
  99. align: 'center',
  100. showOverflowTooltip: true
  101. },
  102. {
  103. prop: 'code',
  104. label: 'BOM编码',
  105. showOverflowTooltip: true,
  106. slot: 'code',
  107. sortable: true
  108. },
  109. {
  110. prop: 'name',
  111. label: 'BOM名称',
  112. showOverflowTooltip: true,
  113. slot: 'name',
  114. sortable: true
  115. },
  116. {
  117. prop: 'categoryCode',
  118. label: '编码',
  119. showOverflowTooltip: true
  120. },
  121. {
  122. prop: 'categoryName',
  123. label: '名称',
  124. showOverflowTooltip: true
  125. },
  126. {
  127. prop: 'specification',
  128. label: '规格',
  129. showOverflowTooltip: true
  130. },
  131. {
  132. prop: 'modelType',
  133. label: '型号',
  134. showOverflowTooltip: true
  135. },
  136. {
  137. prop: 'rootCategoryLevelId',
  138. slot: 'rootCategoryLevelId',
  139. label: '物品分类',
  140. showOverflowTooltip: true
  141. },
  142. {
  143. slot: 'attributeType',
  144. prop: 'attributeType',
  145. label: '属性类型',
  146. showOverflowTooltip: true
  147. },
  148. {
  149. prop: 'produceType',
  150. slot: 'produceType',
  151. label: '生产类型',
  152. showOverflowTooltip: true
  153. },
  154. {
  155. prop: 'versions',
  156. slot: 'versions',
  157. label: '版本'
  158. },
  159. {
  160. prop: 'status ',
  161. label: '状态',
  162. formatter: (row) => {
  163. return this.statusOpt[+row.status];
  164. }
  165. },
  166. {
  167. prop: 'approvalStatus',
  168. label: '审核状态',
  169. slot: 'approvalStatus'
  170. },
  171. // {
  172. // width: 100,
  173. // prop: 'isTemp',
  174. // slot: 'isTemp',
  175. // label: '主数据'
  176. // },
  177. {
  178. prop: 'createName',
  179. label: '创建人',
  180. showOverflowTooltip: true
  181. },
  182. {
  183. prop: 'createTime',
  184. label: '创建日期',
  185. showOverflowTooltip: true,
  186. slot: 'createTime',
  187. sortable: true
  188. },
  189. {
  190. columnKey: 'action',
  191. slot: 'action',
  192. label: '操作'
  193. }
  194. ],
  195. statusOpt: {
  196. 0: '草稿',
  197. 1: '已发布',
  198. 2: '已停用'
  199. },
  200. approvalStatusOpt: {
  201. 0: '未提交',
  202. 1: '审核中',
  203. 2: '审核通过',
  204. 3: '审核不通过'
  205. },
  206. loading: false,
  207. loadingInstance: null,
  208. dictList:[],
  209. where: {},
  210. attributeList: [
  211. {
  212. label: '总装',
  213. value: 1
  214. },
  215. {
  216. label: '部件',
  217. value: 2
  218. },
  219. {
  220. label: '零件',
  221. value: 3
  222. },
  223. {
  224. label: '原材料',
  225. value: 4
  226. }
  227. ],
  228. sort:{},
  229. rootCategoryLevelIdList: [
  230. {
  231. label: '产品',
  232. value: 9
  233. },
  234. {
  235. label: '物料',
  236. value: 1
  237. },
  238. {
  239. label: '生产设备',
  240. value: 4
  241. },
  242. {
  243. label: '模具',
  244. value: 5
  245. },{
  246. label: '备品备件',
  247. value: 6
  248. }
  249. ],
  250. activeName: '1',
  251. isSubmit: false,
  252. JsRId: null,
  253. radioSubmit: 1,
  254. pageSize: this.$store.state.tablePageSize,
  255. cacheKeyUrl: '68be265a-material-BOMmanage'
  256. };
  257. },
  258. computed: {
  259. clientEnvironmentId() {
  260. return this.$store.state.user.info.clientEnvironmentId;
  261. }
  262. },
  263. created() {
  264. this.getDictList('productionType');
  265. },
  266. methods: {
  267. attributeTypeText(v){
  268. if(v){
  269. let a = this.attributeList.find(item=>item.value==v)
  270. return a.label
  271. }
  272. },
  273. rootCategoryLevelIdText(v){
  274. if(v){
  275. let a = this.rootCategoryLevelIdList.find(item=>item.value==v)
  276. if(a) return a.label
  277. }
  278. },
  279. async getDictList(code) {
  280. let { data: res } = await getByCode(code);
  281. this.dictList = res.map((item) => {
  282. let values = Object.keys(item);
  283. return {
  284. value: Number(values[0]),
  285. label: item[values[0]]
  286. };
  287. });
  288. },
  289. handSubmit(row) {
  290. if (this.clientEnvironmentId == 5) {
  291. this.JsRId = row.id;
  292. this.isSubmit = true;
  293. } else {
  294. this.$alert('确定要发布吗?', '提示', {
  295. confirmButtonText: '确定',
  296. cancelButtonText: '取消',
  297. type: 'warning'
  298. })
  299. .then(() => {
  300. bomSubmit({ businessId: row.id }).then((res) => {
  301. if (res?.code == '0') {
  302. this.$message.success('发布成功');
  303. this.reload();
  304. }
  305. });
  306. })
  307. .catch(() => { });
  308. }
  309. },
  310. handJsSubmit() {
  311. let URL = this.radioSubmit == 1 ? jsBomSubmit : deviceBomSubmit;
  312. this.$alert('确定要发布吗?', '提示', {
  313. confirmButtonText: '确定',
  314. cancelButtonText: '取消',
  315. type: 'warning'
  316. })
  317. .then(() => {
  318. URL({ businessId: this.JsRId }).then((res) => {
  319. this.isSubmit = false;
  320. this.$message.success('发布成功');
  321. this.reload();
  322. });
  323. })
  324. .catch(() => { });
  325. },
  326. /* 表格数据源 */
  327. datasource({ where, page, limit }) {
  328. return getBomPageList({
  329. ...where,
  330. ...this.sort,
  331. bomType: Number(this.activeName),
  332. isTemp: true,
  333. pageNum: page,
  334. size: limit
  335. });
  336. },
  337. handelDetail(row) {
  338. let rowData = {
  339. categoryId: row.categoryId,
  340. categoryName: row.categoryName,
  341. code: row.code,
  342. versions: row.versions,
  343. rootPathIdParent: row.categoryLevelPathIdParent,
  344. isProduct: true,
  345. bomType: Number(this.activeName),
  346. isTemp: row.isTemp
  347. };
  348. this.$refs.bomDrawer.open(rowData);
  349. },
  350. /* 刷新表格 */
  351. reload(where) {
  352. this.$refs.table.reload({ where });
  353. },
  354. handleClick(tab) {
  355. this.activeName = tab.name;
  356. this.reload();
  357. },
  358. onSortChange(e) {
  359. console.log(111111111,e);
  360. let sort = {
  361. orderBy: e.order,
  362. sortName: e.prop,
  363. };
  364. this.sort = sort;
  365. this.reload();
  366. },
  367. handDel(row) {
  368. this.$confirm('是否确认删除?', '提示', {
  369. confirmButtonText: '确定',
  370. cancelButtonText: '取消',
  371. type: 'warning'
  372. })
  373. .then(() => {
  374. deleteBomTreeList([row.id]).then(() => {
  375. this.reload();
  376. });
  377. })
  378. .catch(() => {
  379. this.$message({
  380. type: 'info',
  381. message: '已取消删除'
  382. });
  383. });
  384. },
  385. handleDetails(row) {
  386. if (!row.processInstanceId) {
  387. this.$message.info('未提交没有审核流程');
  388. } else {
  389. this.$refs.detailRef.open(row.processInstanceId);
  390. }
  391. }
  392. }
  393. };
  394. </script>
  395. <style lang="scss" scoped>
  396. .ele-body {
  397. height: 100%;
  398. ::v-deep .el-card {
  399. height: 100%;
  400. .el-card__body {
  401. height: 100%;
  402. display: flex;
  403. flex-direction: column;
  404. .dict-table {
  405. flex: 1;
  406. overflow: hidden;
  407. display: flex;
  408. flex-direction: column;
  409. .el-table {
  410. flex: 1;
  411. overflow-y: auto;
  412. }
  413. }
  414. }
  415. }
  416. }
  417. </style>