footBtn.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <div class="foot_box">
  3. <template v-for="(item, index) in btnListData">
  4. <div
  5. v-if="$hasPermission(item.isShow)"
  6. :key="index"
  7. class="btn"
  8. :style="{ background: item.disable ? '#858585' : item.bjColor }"
  9. @click="footClick(item)"
  10. >
  11. <img src="../../../assets/Frame.png" class="Frame" />
  12. {{ item.name }}
  13. </div>
  14. </template>
  15. </div>
  16. </template>
  17. <script>
  18. export default {
  19. props: {
  20. //
  21. type: {
  22. type: String | Number,
  23. default: ''
  24. },
  25. singleReportInspection: {},
  26. // 是否完成产前准备
  27. isPreProductionResult: {
  28. type: Object,
  29. default: () => {
  30. return null;
  31. }
  32. }
  33. },
  34. data() {
  35. return {
  36. btnList1: [
  37. {
  38. name: '产前准备',
  39. type: 'prenatalExamination',
  40. bjColor: '#770077',
  41. isShow: 'mes:producetaskrulerecord:save1'
  42. },
  43. {
  44. name: '领料',
  45. type: 'pick',
  46. bjColor: '#FC1B75',
  47. isShow: 'mes:workorder:save'
  48. },
  49. {
  50. name: '投料',
  51. type: 'feed',
  52. bjColor: '#FBD114',
  53. isShow: 'mes:feed:save'
  54. },
  55. {
  56. name: '过程监测',
  57. type: 'processDetection',
  58. bjColor: '#008888',
  59. isShow: 'mes:producetaskrulerecord:save2'
  60. },
  61. {
  62. name: '报工',
  63. type: 'job',
  64. bjColor: '#157A2C',
  65. isShow: 'mes:workreport:save'
  66. },
  67. {
  68. name: '委外请托',
  69. type: 'Outsourcing',
  70. bjColor: '#39D9AC',
  71. isShow: 'mes:applyoutsource:save'
  72. },
  73. {
  74. name: '暂停启动',
  75. type: '',
  76. bjColor: '#858585',
  77. isShow: 'mes:workorder:startstop'
  78. },
  79. {
  80. name: '产后检查',
  81. type: 'postpartumExamination',
  82. bjColor: '#9955FF',
  83. isShow: 'mes:producetaskrulerecord:save3'
  84. },
  85. {
  86. name: '工单交接',
  87. type: '',
  88. bjColor: '#2B56C2',
  89. isShow: 'mes:producetaskrulerecord:save4'
  90. },
  91. {
  92. name: '工艺文件',
  93. type: 'work',
  94. bjColor: '#2f3033',
  95. isShow: 'mes:workorder:bomfile'
  96. },
  97. {
  98. name: '工步',
  99. type: 'workStep',
  100. bjColor: '#409EFF',
  101. isShow: 'main:categoryparamstep:save'
  102. },
  103. {
  104. name: '任务',
  105. type: 'task',
  106. bjColor: '#67c23a',
  107. isShow: 'aps:assign:save'
  108. },
  109. {
  110. name: '异常',
  111. type: 'error',
  112. bjColor: '#cc0000',
  113. isShow: 'mes:anomaly:save'
  114. },
  115. {
  116. name: 'BOM',
  117. type: 'bom',
  118. bjColor: '#BB5500',
  119. isShow: 'mes:workorder:bom'
  120. },
  121. {
  122. name: '设备',
  123. type: 'device',
  124. bjColor: '#008866',
  125. isShow: 'mes:workorder:device'
  126. },
  127. {
  128. name: '周转车',
  129. type: 'turnover',
  130. bjColor: '#660066',
  131. isShow: 'mes:workorder:transfer'
  132. }
  133. // {
  134. // type: 'turnover',
  135. // bjColor: '#E6F7E7'
  136. // }
  137. ],
  138. btnList2: [
  139. // {
  140. // name: '取样质检',
  141. // type: 'inspection',
  142. // bjColor: '#FBD114'
  143. // },
  144. {
  145. name: '领料',
  146. type: 'pick',
  147. bjColor: '#FC1B75',
  148. isShow: 'mes:workorder:save'
  149. },
  150. {
  151. name: '投料',
  152. type: 'feed',
  153. bjColor: '#FBD114',
  154. isShow: 'mes:feed:save'
  155. },
  156. {
  157. name: '报工',
  158. type: 'job',
  159. bjColor: '#157A2C',
  160. isShow: 'mes:workreport:save'
  161. },
  162. {
  163. name: '委外请托',
  164. type: 'Outsourcing',
  165. bjColor: '#39D9AC',
  166. isShow: 'mes:applyoutsource:save'
  167. },
  168. {
  169. name: '暂停启动',
  170. type: '',
  171. bjColor: '#858585',
  172. isShow: 'mes:workorder:startstop'
  173. },
  174. {
  175. name: '工艺文件',
  176. type: 'work',
  177. bjColor: '#2B56C2',
  178. isShow: 'mes:workorder:bomfile'
  179. },
  180. {
  181. name: '工步',
  182. type: 'workStep',
  183. bjColor: '#409EFF',
  184. isShow: 'main:categoryparamstep:save'
  185. },
  186. {
  187. name: '任务',
  188. type: 'task',
  189. bjColor: '#67c23a',
  190. isShow: 'aps:assign:save'
  191. },
  192. {
  193. name: '异常',
  194. type: 'error',
  195. bjColor: '#cc0000',
  196. isShow: 'mes:anomaly:save'
  197. }
  198. ],
  199. btnList3: [
  200. {
  201. name: '入库',
  202. type: 'job',
  203. bjColor: '#157A2C'
  204. },
  205. {
  206. name: '暂停启动',
  207. type: '',
  208. bjColor: '#858585'
  209. },
  210. {
  211. name: '工艺文件',
  212. type: 'work',
  213. bjColor: '#2B56C2'
  214. },
  215. {
  216. name: '异常',
  217. type: 'error',
  218. bjColor: '#cc0000'
  219. }
  220. ],
  221. btnList4: [
  222. // {
  223. // name: '取样质检',
  224. // type: 'inspection',
  225. // bjColor: '#FBD114'
  226. // },
  227. {
  228. name: '报工',
  229. type: 'job',
  230. bjColor: '#157A2C',
  231. isShow: 'mes:workreport:save'
  232. },
  233. {
  234. name: '委外请托',
  235. type: 'Outsourcing',
  236. bjColor: '#39D9AC'
  237. },
  238. {
  239. name: '暂停启动',
  240. type: '',
  241. bjColor: '#858585'
  242. },
  243. {
  244. name: '工艺文件',
  245. type: 'work',
  246. bjColor: '#2B56C2'
  247. },
  248. {
  249. name: '工步',
  250. type: 'workStep',
  251. bjColor: '#409EFF'
  252. },
  253. {
  254. name: '任务',
  255. type: 'task',
  256. bjColor: '#67c23a'
  257. },
  258. {
  259. name: '异常',
  260. type: 'error',
  261. bjColor: '#cc0000'
  262. }
  263. ],
  264. btnList: [],
  265. disableObj: {
  266. preResult: {
  267. buts: ['投料', '过程监测', '产后检查', '报工'],
  268. msg: '请先完成产前准备'
  269. },
  270. feedResult: {
  271. buts: ['过程监测', '产后检查', '报工'],
  272. msg: '请先完成投料'
  273. },
  274. processResult: {
  275. buts: ['产后检查', '报工'],
  276. msg: '请先完成过程监测'
  277. },
  278. postResult: {
  279. buts: ['报工'],
  280. msg: '请先完成产后检查'
  281. }
  282. }
  283. };
  284. },
  285. computed: {
  286. taskObj() {
  287. return this.$store.state.user.taskObj;
  288. },
  289. clientEnvironmentId() {
  290. return this.$store.state.user.info.clientEnvironmentId;
  291. },
  292. btnListData() {
  293. // 根据是否完成产前准备等前置条件 来禁用按钮
  294. return this.btnList.map((i) => {
  295. if (this.isPreProductionResult) {
  296. for (let key in this.isPreProductionResult) {
  297. let obj = this.disableObj[key];
  298. if (!this.isPreProductionResult[key] && obj) {
  299. // 未完成
  300. if (obj.buts.includes(i.name) && !i.disable) {
  301. return {
  302. ...i,
  303. disable: true,
  304. msg: obj.msg
  305. };
  306. }
  307. }
  308. }
  309. }
  310. return i;
  311. });
  312. }
  313. },
  314. watch: {
  315. taskObj(val) {
  316. // if (this.clientEnvironmentId == 2 && val.type == 3) {
  317. // this.btnList[1].name = '质检';
  318. // this.btnList[1].type = 'inspection';
  319. // } else {
  320. // this.btnList[1].name = '投料';
  321. // this.btnList[1].type = 'feed';
  322. // }
  323. console.log(val);
  324. if (
  325. this.clientEnvironmentId == 3 &&
  326. (this.taskObj.type == 3 || this.taskObj.type == 6)
  327. ) {
  328. let index = this.btnList2.findIndex((obj) => obj.name == '取样质检');
  329. if (index !== -1) {
  330. this.btnList2.splice(0, 1);
  331. }
  332. }
  333. },
  334. type: {
  335. handler(v) {
  336. if (v == '2' || v == '3' || v == '6') {
  337. let btnList2 = this.btnList2.filter((item) => {
  338. if (v != 6) {
  339. }
  340. });
  341. this.$set(this, 'btnList', this.btnList2);
  342. } else if (v == '5') {
  343. this.$set(this, 'btnList', this.btnList3);
  344. } else {
  345. this.$set(this, 'btnList', this.btnList1);
  346. }
  347. },
  348. immediate: true,
  349. deep: true
  350. },
  351. singleReportInspection: {
  352. handler(v) {
  353. // if (v == 1 || v == null) {
  354. // let index = this.btnList2.findIndex(
  355. // (obj) => obj.name == '取样质检'
  356. // );
  357. // if (index !== -1) {
  358. // this.btnList2.splice(0, 1);
  359. // }
  360. // } else
  361. // if (v == 0 && this.clientEnvironmentId == 2) {
  362. // let arr = {
  363. // name: '取样质检',
  364. // type: 'inspection',
  365. // bjColor: '#FBD114'
  366. // };
  367. // this.btnList2.unshift(arr);
  368. // }
  369. }
  370. }
  371. },
  372. created() {},
  373. mounted() {
  374. // if(this.clientEnvironmentId == 3 && (this.taskObj.type == 3||this.taskObj.type == 6)){
  375. // this.btnList2.splice(0, 1);
  376. // }
  377. },
  378. methods: {
  379. footClick(item) {
  380. if (item.disable) {
  381. this.$message.warning(item.msg);
  382. return;
  383. }
  384. this.$emit('footBtn', item.type);
  385. }
  386. }
  387. };
  388. </script>
  389. <style lang="scss" scoped>
  390. .foot_box {
  391. // min-width: 1280px;
  392. width: 100%;
  393. height: 80px;
  394. padding: 0 10px !important;
  395. display: flex;
  396. flex-direction: row;
  397. align-items: center;
  398. // justify-content: space-between;
  399. box-sizing: border-box;
  400. }
  401. .btn {
  402. height: 70px;
  403. margin: 0 10px;
  404. // flex: 1;
  405. width: calc(100% / 12);
  406. color: #fff;
  407. font-weight: 800;
  408. font-size: 16px;
  409. border-radius: 4px;
  410. display: flex;
  411. flex-direction: column;
  412. align-items: center;
  413. justify-content: center;
  414. cursor: pointer;
  415. .Frame {
  416. width: 26px;
  417. height: 26px;
  418. }
  419. }
  420. </style>