footBtn.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <template>
  2. <div class="foot_box">
  3. <div v-for="(item, index) in btnList" :key="index" class="btn" :style="{ background: item.bjColor }"
  4. @click="footClick(item.type)">
  5. <img src="../../../assets/Frame.png" class="Frame" />
  6. {{ item.name }}
  7. </div>
  8. </div>
  9. </template>
  10. <script>
  11. export default {
  12. data() {
  13. return {
  14. btnList1: [
  15. {
  16. name: '领料',
  17. type: 'pick',
  18. bjColor: '#FC1B75'
  19. },
  20. {
  21. name: '投料',
  22. type: 'feed',
  23. bjColor: '#FBD114'
  24. },
  25. {
  26. name: '报工',
  27. type: 'job',
  28. bjColor: '#157A2C'
  29. },
  30. {
  31. name: '委外请托',
  32. type: 'Outsourcing',
  33. bjColor: '#39D9AC'
  34. },
  35. {
  36. name: '暂停启动',
  37. type: '',
  38. bjColor: '#858585'
  39. },
  40. // {
  41. // name: '工单交接',
  42. // type: '',
  43. // bjColor: '#2B56C2'
  44. // },
  45. {
  46. name: '工艺文件',
  47. type: 'work',
  48. bjColor: '#2f3033'
  49. }
  50. ],
  51. btnList2: [
  52. // {
  53. // name: '取样质检',
  54. // type: 'inspection',
  55. // bjColor: '#FBD114'
  56. // },
  57. {
  58. name: '报工',
  59. type: 'job',
  60. bjColor: '#157A2C'
  61. },
  62. {
  63. name: '委外请托',
  64. type: 'Outsourcing',
  65. bjColor: '#39D9AC'
  66. },
  67. {
  68. name: '暂停启动',
  69. type: '',
  70. bjColor: '#858585'
  71. },
  72. {
  73. name: '工艺文件',
  74. type: 'work',
  75. bjColor: '#2B56C2'
  76. }
  77. ],
  78. btnList3: [
  79. {
  80. name: '入库',
  81. type: 'job',
  82. bjColor: '#157A2C'
  83. },
  84. {
  85. name: '暂停启动',
  86. type: '',
  87. bjColor: '#858585'
  88. },
  89. {
  90. name: '工艺文件',
  91. type: 'work',
  92. bjColor: '#2B56C2'
  93. }
  94. ],
  95. btnList: [
  96. ]
  97. };
  98. },
  99. props: {
  100. type: {
  101. type: String | Number,
  102. default: ''
  103. },
  104. singleReportInspection:{
  105. }
  106. },
  107. computed: {
  108. taskObj() {
  109. return this.$store.state.user.taskObj;
  110. },
  111. clientEnvironmentId() {
  112. return this.$store.state.user.info.clientEnvironmentId;
  113. }
  114. },
  115. watch: {
  116. taskObj(val) {
  117. // if (this.clientEnvironmentId == 2 && val.type == 3) {
  118. // this.btnList[1].name = '质检';
  119. // this.btnList[1].type = 'inspection';
  120. // } else {
  121. // this.btnList[1].name = '投料';
  122. // this.btnList[1].type = 'feed';
  123. // }
  124. if(this.clientEnvironmentId == 3 && (this.taskObj.type == 3||this.taskObj.type == 6)){
  125. let index=this.btnList2.findIndex(obj => obj.name == '取样质检');
  126. if( index !==-1){
  127. this.btnList2.splice(0, 1);
  128. }
  129. }
  130. },
  131. type: {
  132. handler(v) {
  133. if (v == '2' || v == '3' || v == '6') {
  134. console.log(111);
  135. let btnList2=this.btnList2.filter(item=>{
  136. if(v!=6){
  137. }
  138. })
  139. this.$set(this, 'btnList', this.btnList2)
  140. }else if (v == '5') {
  141. this.$set(this, 'btnList', this.btnList3)
  142. }else {
  143. this.$set(this, 'btnList', this.btnList1)
  144. }
  145. console.log(this.btnList, 'btnList');
  146. },
  147. immediate: true,
  148. deep: true
  149. },
  150. singleReportInspection:{
  151. handler(v) {
  152. if(v==1||v==null){
  153. let index=this.btnList2.findIndex(obj => obj.name == '取样质检');
  154. if( index !==-1){
  155. this.btnList2.splice(0, 1);
  156. }
  157. }else if(v==0){
  158. let arr= {
  159. name: '取样质检',
  160. type: 'inspection',
  161. bjColor: '#FBD114'
  162. }
  163. this.btnList2.unshift(arr)
  164. }
  165. }
  166. }
  167. },
  168. created() {
  169. },
  170. mounted(){
  171. // if(this.clientEnvironmentId == 3 && (this.taskObj.type == 3||this.taskObj.type == 6)){
  172. // this.btnList2.splice(0, 1);
  173. // }
  174. },
  175. methods: {
  176. footClick(type) {
  177. this.$emit('footBtn', type);
  178. }
  179. }
  180. };
  181. </script>
  182. <style lang="scss" scoped>
  183. .foot_box {
  184. min-width: 1280px;
  185. width: 100%;
  186. height: 80px;
  187. padding: 0 20px;
  188. display: flex;
  189. align-items: center;
  190. // justify-content: space-between;
  191. font-size: 20px;
  192. }
  193. .btn {
  194. height: 70px;
  195. width: calc(100% / 10);
  196. margin: 0 10px;
  197. color: #fff;
  198. font-weight: 800;
  199. font-size: 20px;
  200. border-radius: 4px;
  201. display: flex;
  202. flex-direction: column;
  203. align-items: center;
  204. justify-content: center;
  205. cursor: pointer;
  206. .Frame {
  207. width: 26px;
  208. height: 26px;
  209. }
  210. }
  211. </style>