TitleBar.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. /* 标题栏 */
  2. <template>
  3. <div class="title-bar">
  4. <el-row>
  5. <el-col :span="2">
  6. <img
  7. class="logo"
  8. src="../assets/img/main_window/logo.png"
  9. sytle="align-items"
  10. />
  11. </el-col>
  12. <el-col :span="1">
  13. <div>
  14. <el-dialog
  15. title="用户登录"
  16. v-model="dialogVisible"
  17. width="21%"
  18. :before-close="handleClose"
  19. :show-close="false"
  20. >
  21. <el-form :model="form">
  22. <el-form-item label="" :label-width="formLabelWidth">
  23. </el-form-item>
  24. <el-form-item label="用户名:" :label-width="formLabelWidth">
  25. <el-input
  26. v-model="form.name"
  27. autocomplete="off"
  28. type="text"
  29. placeholder="用户名"
  30. style="width: 80%"
  31. ></el-input>
  32. </el-form-item>
  33. <el-form-item label="密&emsp;码:" :label-width="formLabelWidth">
  34. <el-input
  35. v-model="form.name"
  36. autocomplete="off"
  37. type="text"
  38. placeholder="密&emsp;码"
  39. style="width: 80%"
  40. show-password
  41. ></el-input>
  42. </el-form-item>
  43. <el-form-item
  44. label="验证码:"
  45. :label-width="formLabelWidth"
  46. style="display: none"
  47. >
  48. <el-input
  49. v-model="form.name"
  50. autocomplete="off"
  51. type="text"
  52. placeholder="验证码"
  53. style="width: 80%"
  54. ><template #append
  55. ><img
  56. src="../../src\assets\logo.png"
  57. style="width: 50px; height: 20px" /></template
  58. ></el-input>
  59. </el-form-item>
  60. </el-form>
  61. <template #footer>
  62. <span class="dialog-footer">
  63. <el-button
  64. @click="dialogVisible = false"
  65. style="
  66. background-color: rgb(100, 100, 100);
  67. color: rgb(220, 220, 220);
  68. "
  69. >取 消</el-button
  70. >
  71. <el-button type="primary" @click="dialogVisible = false"
  72. >登 录</el-button
  73. >
  74. </span>
  75. </template>
  76. </el-dialog>
  77. </div>
  78. </el-col>
  79. <el-col :span="2.3">
  80. <div class="titleinfo">
  81. <ul>
  82. <li>
  83. <TitleBarCard
  84. title="装机容量"
  85. unit="MW"
  86. :value="installedCapacity"
  87. ></TitleBarCard>
  88. </li>
  89. </ul>
  90. </div>
  91. </el-col>
  92. <el-col :span="2.3">
  93. <div class="titleinfo">
  94. <ul>
  95. <li>
  96. <TitleBarCard
  97. title="实时功率"
  98. unit="MW"
  99. :value="totalPower"
  100. ></TitleBarCard>
  101. </li>
  102. </ul>
  103. </div>
  104. </el-col>
  105. <el-col :span="2.3">
  106. <div class="titleinfo">
  107. <ul>
  108. <li>
  109. <TitleBarCard
  110. title="日发电量"
  111. unit="kWh"
  112. :value="dailyPowerGeneration"
  113. ></TitleBarCard>
  114. </li>
  115. </ul>
  116. </div>
  117. </el-col>
  118. <el-col :span="2.3">
  119. <div class="titleinfo">
  120. <ul>
  121. <li>
  122. <TitleBarCard
  123. title="上网电量"
  124. unit="kWh"
  125. :value="gridPower"
  126. ></TitleBarCard>
  127. </li>
  128. </ul>
  129. </div>
  130. </el-col>
  131. <el-col :span="2.3">
  132. <div class="titleinfo">
  133. <ul>
  134. <li>
  135. <TitleBarCard
  136. title="月发电量"
  137. unit="kWh"
  138. :value="monthlyPowerGeneration"
  139. ></TitleBarCard>
  140. </li>
  141. </ul>
  142. </div>
  143. </el-col>
  144. <el-col :span="2.3">
  145. <div class="titleinfo">
  146. <ul>
  147. <li>
  148. <TitleBarCard
  149. title="年发电量"
  150. unit="kWh"
  151. :value="annualPowerGeneration"
  152. ></TitleBarCard>
  153. </li>
  154. </ul>
  155. </div>
  156. </el-col>
  157. <el-col :span="2.3">
  158. <div class="titleinfo">
  159. <ul>
  160. <li>
  161. <TitleBarCard
  162. title="月利用小时"
  163. unit="小时"
  164. :value="monthlyUtilizationHours"
  165. ></TitleBarCard>
  166. </li>
  167. </ul>
  168. </div>
  169. </el-col>
  170. <el-col :span="2.3">
  171. <div class="titleinfo">
  172. <ul>
  173. <li>
  174. <TitleBarCard
  175. title="年利用小时"
  176. unit="小时"
  177. :value="annualUtilizationHours"
  178. ></TitleBarCard>
  179. </li>
  180. </ul>
  181. </div>
  182. </el-col>
  183. <el-col :span="1.6">
  184. <!-- <div class="admin" style="position: absolute;right: 70px;">
  185. <p>管理员</p>
  186. </div> -->
  187. <el-button
  188. type="text"
  189. @click="dialogVisible = true"
  190. class="admin"
  191. style="position: absolute; right: 66px"
  192. >管理员</el-button
  193. >
  194. </el-col>
  195. <el-col :span="1">
  196. <div style="margin-top: 7px; position: absolute; right: 10px">
  197. <button
  198. class="closeButton"
  199. style="
  200. font-size: 30px;
  201. color: white;
  202. background: rgb(41, 41, 41);
  203. width: 44px;
  204. height: 44px;
  205. border-radius: 8px;
  206. border: none;
  207. "
  208. v-on:click="mainClose"
  209. >
  210. ×
  211. </button>
  212. </div>
  213. </el-col>
  214. </el-row>
  215. </div>
  216. </template>
  217. <script>
  218. import TitleBarCard from "./area/mainwindow/TitleBarCard.vue";
  219. import BackgroundData from "../assets/script/BackgroundData";
  220. export default {
  221. name: "TitleBar",
  222. components: {
  223. TitleBarCard,
  224. },
  225. data() {
  226. return {
  227. dialogVisible: false,
  228. dialogFormVisible: false,
  229. form: {
  230. name: "",
  231. date1: "",
  232. date2: "",
  233. delivery: false,
  234. type: [],
  235. resource: "",
  236. desc: "",
  237. },
  238. formLabelWidth: "120px",
  239. totalPower: 0, // 实时功率
  240. dailyPowerGeneration: 0, // 日发电量
  241. gridPower: 0, // 上网电量
  242. monthlyPowerGeneration: 0, // 月发电量
  243. annualPowerGeneration: 0, // 年发电量
  244. installedCapacity: 734, // 装机容量
  245. };
  246. },
  247. computed: {
  248. monthlyUtilizationHours: function () {
  249. // 月利用小时数
  250. return (
  251. (this.monthlyPowerGeneration * 10) /
  252. this.installedCapacity
  253. ).toFixed(2);
  254. },
  255. annualUtilizationHours: function () {
  256. // 年利用小时数
  257. return (
  258. (this.annualPowerGeneration * 10) /
  259. this.installedCapacity
  260. ).toFixed(2);
  261. },
  262. },
  263. created() {
  264. this.refreshTimer = setInterval(this.refreshData, 2000);
  265. },
  266. methods: {
  267. handleClose(done) {
  268. done();
  269. },
  270. mainClose() {
  271. const { remote } = require("electron");
  272. remote.getCurrentWindow().destroy();
  273. },
  274. refreshData() {
  275. // todo 计算发电量的时候没有考虑光伏的,后续完善
  276. var bd = BackgroundData.getInstance();
  277. var val = bd.TopPoint;
  278. for (var v in val) {
  279. var pt = val[v];
  280. if (pt.pointName == "TotalPower") {
  281. this.totalPower = pt.value.toFixed(2);
  282. } else if (pt.pointName == "DailyPowerGeneration") {
  283. this.dailyPowerGeneration = pt.value.toFixed(2);
  284. } else if (pt.pointName == "GridPower") {
  285. this.gridPower = pt.value.toFixed(2);
  286. } else if (pt.pointName == "MonthlyPowerGeneration") {
  287. this.monthlyPowerGeneration = pt.value.toFixed(2);
  288. } else if (pt.pointName == "AnnualPowerGeneration") {
  289. this.annualPowerGeneration = pt.value.toFixed(2);
  290. }
  291. }
  292. },
  293. },
  294. };
  295. </script>
  296. <style scoped>
  297. .title-bar {
  298. height: 6vh;
  299. background-color: #000000;
  300. margin-top: 0;
  301. margin-right: 0;
  302. margin-left: 0;
  303. }
  304. .logo {
  305. position: relative;
  306. top: 33%;
  307. }
  308. .admin {
  309. color: #ffffff;
  310. position: relative;
  311. /* margin-left: 10px;
  312. padding: 0; */
  313. padding: 22px;
  314. }
  315. .titleinfo {
  316. background-color: rgb(20, 20, 20);
  317. height: auto;
  318. padding: 13px;
  319. border-radius: 6px;
  320. margin-top: 5px;
  321. margin-bottom: 5px;
  322. margin-left: -9px;
  323. }
  324. </style>