index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <div class="bg-white py-[10px] px-[10px] relative">
  3. <div class="mb-[20px]">
  4. <el-form class="" :inline="true">
  5. <el-form-item label="场站" class="!mb-0">
  6. <el-select v-model="station" clearable class="w-[150px]">
  7. <el-option
  8. v-for="item in stationList"
  9. :key="item.id"
  10. :label="item.name"
  11. :value="item.id"
  12. ></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item label="开始" class="!mb-0 ml-2">
  16. <el-date-picker
  17. v-model="val1"
  18. @change="BeginChange(val1)"
  19. type="month"
  20. value-format="YYYY-MM"
  21. placeholder="选择日期"
  22. >
  23. </el-date-picker>
  24. </el-form-item>
  25. <el-form-item label="结束" class="!mb-0">
  26. <el-date-picker
  27. v-model="value2"
  28. @change="EndChange(value2)"
  29. type="month"
  30. value-format="YYYY-MM"
  31. placeholder="选择日期"
  32. >
  33. </el-date-picker>
  34. </el-form-item>
  35. <el-form-item class="!mb-0">
  36. <el-button type="primary" @click="addform">查询</el-button>
  37. </el-form-item>
  38. </el-form>
  39. </div>
  40. </div>
  41. <div class="mb-[20px] mt-[20px]">
  42. <el-table
  43. :data="tableData"
  44. stripe
  45. size="large"
  46. :border="true"
  47. :style="{ width: '100%' }"
  48. >
  49. <el-table-column
  50. resizable
  51. align="center"
  52. type="index"
  53. label="序号"
  54. />
  55. <el-table-column
  56. resizable
  57. align="center"
  58. prop="station"
  59. label="场站名称"
  60. />
  61. <el-table-column
  62. resizable
  63. align="center"
  64. prop="time"
  65. label="时间"
  66. />
  67. <el-table-column
  68. resizable
  69. align="center"
  70. prop="wtidcount"
  71. label="风机数量"
  72. />
  73. <el-table-column resizable align="center" label="操作">
  74. <template #default="scope">
  75. <!-- <el-button size="small" @click="handleEdit(scope.$index, scope.row)"
  76. >下载</el-button
  77. > -->
  78. <el-button
  79. size="small"
  80. type="danger"
  81. @click="handleDelete(scope.$index, scope.row)"
  82. >查看报告</el-button
  83. >
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. </div>
  88. <div >
  89. <el-dialog
  90. v-model="centerDialogVisible"
  91. title="风电场性能分析报告"
  92. width="50%"
  93. center
  94. >
  95. <div id="pdfDom">
  96. <!-- <h3 style="font-weight: bolder; font-size: 18px; color: black;text-aling:center">风电场性能分析报告</h3> -->
  97. <p>
  98. <span class="ml-10">场站: {{ nbdata.name }}</span>
  99. <span class="ml-77">风机型号: {{ nbdata.model }}</span>
  100. </p>
  101. <p>
  102. <span class="ml-10">风机数量: {{ nbdata.quantity }}</span>
  103. <span class="ml-85">装机容量(MW): {{ nbdata.capacity }}</span>
  104. </p>
  105. <p>
  106. <span class="ml-10">报告生成日期: {{ time }}</span>
  107. <span class="ml-72">数据分析周期: {{ eltime }}</span>
  108. </p>
  109. <h3 style="font-weight: bolder; font-size: 18px; color: black">概述:</h3>
  110. <p class="ml-7">
  111. 报告基于曲线偏差率、静态偏差对风、容量系数、停机时长、分别对场站{{ nbdata.quantity }}台风机进行了性能分析,其中有{{wtcount}}台风机指标严重异常,信息如下:
  112. </p>
  113. <h3 style="font-weight: bolder; font-size: 18px; color: black">
  114. 1、曲线偏差率
  115. </h3>
  116. <p class="ml-7">
  117. 曲线偏差率对不同风速区间的实际功率和保证功率做偏差率分析,高偏差率表明存在需要进一步调查潜在问题,偏差率负值表明实际功率低于保证功率
  118. </p>
  119. <el-table
  120. :data="curve"
  121. :span-method="objectSpanMethod"
  122. border
  123. style="width: 100%; margin-top: 20px"
  124. >
  125. <el-table-column
  126. prop="section"
  127. align="center"
  128. label="风速区间"
  129. width="180"
  130. />
  131. <el-table-column prop="module" align="center" label="偏差率" />
  132. <el-table-column prop="wtidcount" align="center" label="风机数量" />
  133. <el-table-column prop="windturbine" align="center" label="风机编号" />
  134. </el-table>
  135. <h3 style="font-weight: bolder; font-size: 18px; color: black">
  136. 2、静态偏航对风
  137. </h3>
  138. <p class="ml-7">
  139. 静态偏航对风指风机的叶片与风向之间的偏差,偏差角度过大表明对风存在问题,以下为5-10m风速区间的对风误差
  140. </p>
  141. <el-table
  142. :data="staticwind"
  143. :span-method="objectSpanMethod"
  144. border
  145. style="width: 100%; margin-top: 20px"
  146. >
  147. <el-table-column
  148. prop="section"
  149. align="center"
  150. label="严重程度"
  151. width="180"
  152. />
  153. <el-table-column prop="wtidcount" align="center" label="风机数量" />
  154. <!-- <el-table-column prop="amount1" label="风机数量" /> -->
  155. <el-table-column prop="windturbine" align="center" label="风机编号" />
  156. </el-table>
  157. <h3 style="font-weight: bolder; font-size: 18px; color: black">
  158. 3、容量系数
  159. </h3>
  160. <p class="ml-7">
  161. 容量系数是风机发电量能力的指标,数值越低,说明发电效率越低
  162. </p>
  163. <el-table
  164. :data="mrlxs"
  165. :span-method="objectSpanMethod"
  166. border
  167. style="width: 100%; margin-top: 20px"
  168. >
  169. <el-table-column
  170. prop="section"
  171. align="center"
  172. label="容量系数"
  173. width="180"
  174. />
  175. <!-- <el-table-column prop="name" label="偏差率" /> -->
  176. <el-table-column prop="wtidcount" align="center" label="风机数量" />
  177. <el-table-column prop="windturbine" align="center" label="风机编号" />
  178. </el-table>
  179. <h3 style="font-weight: bolder; font-size: 18px; color: black">
  180. 4、停机时间
  181. </h3>
  182. <p class="ml-7">
  183. 小风速下停机时间越长反应出低风速风机切入不及时,暴风天气不停机反应出风机切出不及时
  184. </p>
  185. <el-table
  186. :data="stoptime"
  187. :span-method="objectSpanMethod"
  188. border
  189. style="width: 100%; margin-top: 20px"
  190. >
  191. <el-table-column
  192. prop="section"
  193. align="center"
  194. label="风速区间"
  195. width="180"
  196. />
  197. <el-table-column prop="wtidcount" align="center" label="风机数量" />
  198. <el-table-column prop="remark" align="center" label="累计时间(h)" />
  199. <el-table-column prop="windturbine" align="center" label="风机编号" />
  200. </el-table>
  201. <!-- <h3 style="font-weight: bolder; font-size: 18px; color: black">
  202. 5、损失电量
  203. </h3>
  204. <p class="ml-7">
  205. 损失电量指因故障或维护等原因导致风机未能正常发电,损失电量占比越高,存在的问题越明显
  206. </p>
  207. <el-table
  208. :data="tableData1"
  209. :span-method="objectSpanMethod"
  210. border
  211. style="width: 100%; margin-top: 20px"
  212. >
  213. <el-table-column prop="id" align="center" label="损失占比" width="180" />
  214. <el-table-column prop="amount1" align="center" label="风机数量" />
  215. <el-table-column prop="amount2" align="center" label="风机编号" />
  216. </el-table> -->
  217. <h3 style="font-weight: bolder; font-size: 18px; color: black">
  218. 结论及建议
  219. </h3>
  220. <p class="ml-7">
  221. 综上统计周期内数据分析,{{ nbdata.name }}的{{hjwtid}}台风机出现频率最高为{{hjcount}}次。
  222. </p>
  223. </div>
  224. <template #footer>
  225. <span class="dialog-footer">
  226. <el-button @click="centerDialogVisible = false">取消</el-button>
  227. <!-- <el-button type="primary" @click="centerDialogVisible = false">
  228. 确定
  229. </el-button> -->
  230. <el-button @click="exportPDF" type="primary" :loading="loading">导出 PDF</el-button>
  231. </span>
  232. </template>
  233. </el-dialog>
  234. </div>
  235. </template>
  236. <script setup name="report">
  237. import request from "@/api/axios.js";
  238. import jsPDF from 'jspdf';
  239. import html2canvas from 'html2canvas';
  240. import htmlToPdf from "./fixGetPDF";
  241. import { ref, onMounted, reactive } from "vue";
  242. const curve = ref([]);
  243. const mrlxs = ref([]);
  244. const staticwind = ref([]);
  245. const stoptime = ref([]);
  246. const nbdata = ref({});
  247. const loading=ref(false)
  248. const exportPDF = () => {
  249. loading.value = true;
  250. // 调用htmlToPdf工具函数
  251. htmlToPdf.getPdf(
  252. document.querySelector("#pdfDom"),
  253. "风电场性能分析报告"
  254. );
  255. // 定时器模拟按钮loading动画的时间
  256. setTimeout(() => {
  257. loading.value = false;
  258. ElMessage.success('打印成功!');
  259. }, 1000);
  260. centerDialogVisible.value=false
  261. }
  262. const centerDialogVisible = ref(false);
  263. /**场站 */
  264. const stationList = ref([]);
  265. const funGetStation = async () => {
  266. const res = await request.get("/base/station");
  267. stationList.value = res.data;
  268. };
  269. /**查询表格数据 */
  270. const tableData = ref();
  271. const station = ref("");
  272. const addform = async () => {
  273. const res = await request.get(
  274. `/report/list?station=${station.value}&st=${val1.value}&et=${value2.value}`
  275. );
  276. // res.data.forEach((ele)=>{
  277. // ele.time=ele.time.slice(0, 7);
  278. // })
  279. tableData.value = res.data;
  280. };
  281. let val1 = ref();
  282. let value2 = ref();
  283. const BeginChange = (val) => {
  284. console.log(val);
  285. val1.value = val;
  286. // console.log(val);
  287. };
  288. const EndChange = (val) => {
  289. // console.log(val);
  290. value2.value = val;
  291. };
  292. let time = ref();
  293. let eltime = ref();
  294. let wtcount=ref()
  295. let hjwtid=ref()
  296. let hjcount=ref()
  297. const handleDelete = async (index, row) => {
  298. time.value = row.time;
  299. // console.log(index, row)
  300. centerDialogVisible.value = true;
  301. const res = await request.get(
  302. `/report/info?station=${row.station}&date=${row.time}`
  303. );
  304. nbdata.value = res.data.station;
  305. // console.log('nb',nbdata.value);
  306. res.data.info.curve.forEach((ele) => {
  307. ele.module = "偏差率负值";
  308. });
  309. // res.data.info.stoptime.forEach((ele)=>{
  310. // ele.remark=ele.remark/60
  311. // })
  312. curve.value = res.data.info.curve;
  313. mrlxs.value = res.data.info.mrlxs;
  314. staticwind.value = res.data.info.staticwind;
  315. stoptime.value = res.data.info.stoptime;
  316. eltime.value = res.data.time;
  317. wtcount.value = res.data.wtcount;
  318. hjwtid.value = res.data.hjwtid;
  319. hjcount.value = res.data.hjcount;
  320. };
  321. const getTime1 = (val) => {
  322. //时间戳处理,val=1是默认开始时间(当前月第一天),val=2是默认结束时间(今天)
  323. var date = new Date();
  324. var year = date.getFullYear(),
  325. month = date.getMonth() + 1,
  326. day = date.getDate();
  327. month >= 1 && month <= 9 ? (month = "0" + month) : "";
  328. day >= 0 && day <= 9 ? (day = "0" + day) : "";
  329. var begin = year + "-" + '05';
  330. var end = year + "-" + month;
  331. if (val == 1) {
  332. return begin;
  333. } else if (val == 2) {
  334. return end;
  335. }
  336. };
  337. onMounted(() => {
  338. funGetStation();
  339. val1.value = getTime1(1);
  340. value2.value = getTime1(2);
  341. addform()
  342. });
  343. /**created */
  344. funGetStation();
  345. // onActivated(() => {
  346. // funQuery();
  347. // })
  348. </script>