equipmentBoardTopcard.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. <template>
  2. <div id="top-bar" style="width:100%;height:100%">
  3. <div class="content">
  4. <!-- <div class="title">设备信息情况</div> -->
  5. <div class="bar">
  6. <div v-for="(item, index) in topBarData" :key="index" class="item">
  7. <div v-for="(v, i) in item.children" :key="i" class="box1" >
  8. <div class="label" style="text-align: center; ">{{ v.label }}</div>
  9. <div class="count" style="display: flex;justify-content: center;">
  10. <div v-if=" v.label.includes('计划')||v.label.includes('申请')" :style="{color:'#9966FF'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
  11. <div v-else-if="v.label.includes('报废/停用')" :style="{color:'#FF0066'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
  12. <div v-else-if="v.label.includes('受限')" :style="{color:'#CCFF33'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
  13. <div v-else-if="v.label.includes('已')||v.label.includes('完成')||v.label.includes('正常')||v.label.includes('率')" :style="{color:'#00b56a'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
  14. <div v-else :style="{color:'#66CCCC'}" style="font-weight:bold;font-size: 27px;">{{v.value}}</div>
  15. <div class="unit" style="line-height: 34px;">{{ v.unit }}</div>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <dv-decoration-10 />
  22. </div>
  23. </template>
  24. <script>
  25. import color from '@/store/modules/ibps/modules/color';
  26. export default {
  27. name: "topBar",
  28. props: {
  29. info: {
  30. type: Array,
  31. default: [],
  32. },
  33. },
  34. components: {},
  35. watch: {
  36. info(v) {
  37. this.update();
  38. },
  39. },
  40. data() {
  41. return {
  42. topBarData: [],
  43. fontColor: [
  44. "#d20962",
  45. "#f47721",
  46. "#7ac143",
  47. "#00a78e",
  48. "#00bce4",
  49. "#7d3f98",
  50. "#037ef3",
  51. "#f85a40",
  52. "#00c16e",
  53. "#ffd900",
  54. "#0cb9c1",
  55. "#7552cc",
  56. ],
  57. };
  58. },
  59. created() {
  60. this.update();
  61. },
  62. methods: {
  63. //随机颜色
  64. getRandom(minNum, maxNum) {
  65. if (arguments.length === 1) {
  66. return parseInt(Math.random() * minNum + 1, 10);
  67. } else {
  68. return parseInt(Math.random() * (maxNum - minNum + 1) + minNum, 10);
  69. }
  70. },
  71. // 数据更新
  72. update() {
  73. this.info.forEach((item) => {
  74. item.children.forEach((i) => {
  75. i.data = {
  76. number: [i.value],
  77. content: "{nt}",
  78. toFixed: 1,
  79. textAlign: "center",
  80. style: {
  81. fill: this.fontColor[this.getRandom(0, 11)],
  82. // formatter
  83. },
  84. };
  85. i.unit = i.danwei;
  86. });
  87. });
  88. this.topBarData = JSON.parse(JSON.stringify(this.info));
  89. // console.log(this.topBarData);
  90. },
  91. },
  92. };
  93. </script>
  94. <style lang="scss" scoped>
  95. .content{
  96. height: 100%;
  97. width: 100%;
  98. min-height: 0px
  99. // background-color: rgba(6, 30, 93, 0.5);
  100. // .title{
  101. // // width: 100%;
  102. // margin: 20px 2%;
  103. // }
  104. }
  105. .bar {
  106. position: relative;
  107. margin: 20px 2%;
  108. width: 96%;
  109. height: 100%;
  110. display: flex;
  111. justify-content: space-between;
  112. align-items: center;
  113. background-color: rgba(6, 30, 93, 0.5);
  114. .item {
  115. width: 20%;
  116. // width: calc(100% / 13);
  117. height: 60%;
  118. padding: 6px 6px;
  119. border-left: 5px solid rgb(6, 30, 93);
  120. &:first-child {
  121. width: 30%;
  122. display: flex;
  123. justify-content: space-around;
  124. align-items: center;
  125. box-sizing: border-box;
  126. .box1 {
  127. width: 20%;
  128. }
  129. }
  130. &:nth-child(2) {
  131. width: 15%;
  132. display: flex;
  133. justify-content: space-around;
  134. align-items: center;
  135. box-sizing: border-box;
  136. .box1 {
  137. width: 50%;
  138. }
  139. }
  140. &:nth-child(3) {
  141. width: 16%;
  142. display: flex;
  143. justify-content: space-around;
  144. align-items: center;
  145. box-sizing: border-box;
  146. .box1 {
  147. width: 50%;
  148. }
  149. }
  150. &:nth-child(4) {
  151. width: 15%;
  152. display: flex;
  153. justify-content: space-around;
  154. align-items: center;
  155. box-sizing: border-box;
  156. .box1 {
  157. width: 50%;
  158. }
  159. }
  160. &:last-child {
  161. width: 24%;
  162. display: flex;
  163. justify-content: space-around;
  164. align-items: center;
  165. box-sizing: border-box;
  166. .box1 {
  167. width: 33%;
  168. }
  169. }
  170. .title {
  171. text-align: center;
  172. font-size: 18px;
  173. font-weight: bold;
  174. margin-bottom: 20px;
  175. }
  176. .box {
  177. display: inline-block;
  178. width: 33%;
  179. .label {
  180. text-align: center;
  181. font-size: 14px;
  182. }
  183. .count {
  184. display: flex;
  185. align-items: center;
  186. justify-content: center;
  187. .flop {
  188. width: 60px;
  189. height: 40px;
  190. font-size: 18px;
  191. }
  192. .flops{
  193. width: 180px;
  194. height: 40px;
  195. font-size: 10px;
  196. }
  197. .unit {
  198. margin-left: 10px;
  199. font-size: 18px;
  200. line-height: 27px;
  201. box-sizing: border-box;
  202. }
  203. }
  204. }
  205. }
  206. }
  207. #top-bar {
  208. height: 90%;
  209. width: 100%;
  210. }
  211. .dv-decoration-10 {
  212. width: 96%;
  213. margin: 7px 2% 0;
  214. height: 10%;
  215. }
  216. </style>