index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. <template>
  2. <el-scrollbar height="92vh">
  3. <div class="query mg-b-8">
  4. <div class="query-items">
  5. <div class="query-item" style="width: 200px">
  6. <div class="lable">场站:</div>
  7. <div class="search-input">
  8. <el-select
  9. v-model="station"
  10. placeholder="请选择"
  11. popper-class="select"
  12. >
  13. <el-option
  14. v-for="item in ChangZhan"
  15. :key="item.id"
  16. :value="item.id"
  17. :label="item.name"
  18. >
  19. </el-option>
  20. </el-select>
  21. </div>
  22. </div>
  23. <div class="query-item" style="width: 200px">
  24. <div class="lable">样本类型:</div>
  25. <div class="search-input">
  26. <el-select
  27. v-model="yblx"
  28. placeholder="请选择样本"
  29. popper-class="select"
  30. >
  31. <el-option
  32. v-for="item in yblxArr"
  33. :key="item.value"
  34. :value="item.value"
  35. :label="item.label"
  36. >
  37. </el-option>
  38. </el-select>
  39. </div>
  40. </div>
  41. <div class="query-item" style="width: 200px">
  42. <div class="lable">模型:</div>
  43. <div class="search-input">
  44. <el-select
  45. v-model="model"
  46. collapse-tags
  47. placeholder="请选择"
  48. popper-class="select"
  49. >
  50. <el-option
  51. v-for="item in models"
  52. :key="item.value"
  53. :value="item.value"
  54. :label="item.label"
  55. >
  56. </el-option>
  57. </el-select>
  58. </div>
  59. </div>
  60. <div class="query-item" style="width: 250px">
  61. <div class="lable">时间间隔:</div>
  62. <div class="search-input">
  63. <el-select
  64. v-model="interval"
  65. collapse-tags
  66. placeholder="请选择"
  67. popper-class="select"
  68. >
  69. <el-option
  70. v-for="item in intervals"
  71. :key="item.value"
  72. :value="item.value"
  73. :label="item.label"
  74. >
  75. </el-option>
  76. </el-select>
  77. </div>
  78. </div>
  79. <div class="query-item">
  80. <div class="lable">时间:</div>
  81. <div class="search-input">
  82. <el-date-picker
  83. v-model="time"
  84. type="datetimerange"
  85. range-separator="至"
  86. start-placeholder="开始日期"
  87. end-placeholder="结束日期"
  88. >
  89. </el-date-picker>
  90. </div>
  91. </div>
  92. <div class="query-actions">
  93. <button class="btn" @click="list">查询</button>
  94. </div>
  95. </div>
  96. </div>
  97. <el-row :type="'flex'" class="content">
  98. <ComTable
  99. :data="tableData"
  100. height="80vh"
  101. v-loading="tableLoading"
  102. element-loading-text="拼命加载中"
  103. element-loading-background="rgba(0, 0, 0, 0.8)"
  104. ></ComTable>
  105. </el-row>
  106. <el-dialog
  107. title="数据对比"
  108. v-model="dialog"
  109. width="70%"
  110. top="10vh"
  111. custom-class="modal"
  112. :close-on-click-modal="false"
  113. :before-close="onClickDialogClose"
  114. class="isvisiable"
  115. >
  116. <!-- <scatter-line-chart
  117. :data="scatterLineData"
  118. :dotName="dotName"
  119. :height="'70vh'"
  120. /> -->
  121. <PerformanceEcharts
  122. :data="scatterLineData"
  123. :dotName="dotName"
  124. :height="'70vh'"
  125. ></PerformanceEcharts>
  126. </el-dialog>
  127. </el-scrollbar>
  128. </template>
  129. <script>
  130. import ComTable from "@/components/coms/table/table.vue";
  131. // import ScatterLineChart from "./scatter-line-chart.vue";
  132. import PerformanceEcharts from "./performanceEcharts.vue";
  133. import BASE from "@tools/basicTool.js";
  134. export default {
  135. components: {
  136. ComTable,
  137. PerformanceEcharts,
  138. // ScatterLineChart,
  139. },
  140. data() {
  141. const that = this;
  142. return {
  143. scatterLineData: [
  144. [1.49, 337.0],
  145. [5.78, 368.0],
  146. [5.08, 247.0],
  147. [4.79, 171.0],
  148. [4.05, 120.0],
  149. ],
  150. dotName: "",
  151. checkLength: 0, //对标分析只能选择5个
  152. yblx: 0,
  153. yblxArr: [
  154. {
  155. label: "正样本",
  156. value: 0,
  157. },
  158. {
  159. label: "负样本",
  160. value: 1,
  161. },
  162. ],
  163. dialog: false, //传感点组件隐藏或显示
  164. ChangZhan: [],
  165. // 模型
  166. model: 0,
  167. models: [
  168. {
  169. label: "欠发矩阵模型",
  170. value: 0,
  171. },
  172. ],
  173. // 时间间隔
  174. interval: "1-2",
  175. intervals: [
  176. //和明华有约定,必须这么写
  177. {
  178. label: "小于30分钟",
  179. value: "0-0.5",
  180. },
  181. {
  182. label: "30分钟-1小时",
  183. value: "0.5-1",
  184. },
  185. {
  186. label: "1小时-2小时",
  187. value: "1-2",
  188. },
  189. {
  190. label: "2小时-5小时",
  191. value: "2-5",
  192. },
  193. {
  194. //42天
  195. label: "大于5小时",
  196. value: "5-1008",
  197. },
  198. ],
  199. time: [],
  200. station: "",
  201. tableData: {
  202. column: [
  203. {
  204. name: "序号",
  205. field: "index",
  206. is_light: false,
  207. width: "100px",
  208. },
  209. {
  210. name: "样本类型",
  211. field: "tag",
  212. is_light: false,
  213. width: "150px",
  214. },
  215. {
  216. name: "风机编号",
  217. field: "windturbineid",
  218. is_light: false,
  219. width: "250px",
  220. },
  221. {
  222. name: "开始时间",
  223. field: "starttime",
  224. is_light: false,
  225. width: "350px",
  226. },
  227. {
  228. name: "结束时间",
  229. field: "endtime",
  230. is_light: false,
  231. width: "350px",
  232. },
  233. {
  234. name: "操作",
  235. field: "cz",
  236. is_light: false,
  237. width: "200px",
  238. template: () => {
  239. return "<el-button type='text' style='cursor: pointer;' value='config'>详情</el-button>&nbsp";
  240. },
  241. click(e, row) {
  242. that.onClickOption(e, row);
  243. },
  244. },
  245. ],
  246. data: [],
  247. },
  248. };
  249. },
  250. methods: {
  251. async startAjax() {
  252. var that = this;
  253. that.time = [
  254. new Date(new Date() - 3600 * 24 * 1000 * 15).formatDate(
  255. "yyyy-MM-dd hh:mm:ss"
  256. ),
  257. new Date().formatDate("yyyy-MM-dd hh:mm:ss"),
  258. ];
  259. await that.API.requestData({
  260. method: "GET",
  261. baseURL: "http://10.155.32.4:9001/",
  262. subUrl: "benchmarking/wplist",
  263. success(res) {
  264. that.ChangZhan = res.data;
  265. that.station = res.data[1].id;
  266. },
  267. });
  268. that.list();
  269. },
  270. onClickOption(e, row) {
  271. // 操作按钮
  272. if ("config" == e.target.getAttribute("value")) {
  273. //查看
  274. this.chart([row.id]);
  275. }
  276. },
  277. chart(ids) {
  278. const that = this;
  279. BASE.showLoading({ text: "加载中..." });
  280. that.API.requestData({
  281. method: "GET",
  282. // baseURL: "http://192.168.10.19:9002/",
  283. baseURL: "http://192.168.10.4:9002/",
  284. subUrl: "case/performance/line",
  285. data: {
  286. id: ids,
  287. interval: 30,
  288. },
  289. success(res) {
  290. if (res.code == 200) {
  291. // let key = Object.keys(res.data)[0];
  292. that.scatterLineData = res.data;
  293. // that.dotName = key;
  294. BASE.closeLoading();
  295. that.dialog = true;
  296. }
  297. },
  298. });
  299. },
  300. list() {
  301. // var that = this;
  302. // if (that.time == undefined) {
  303. // that.BASE.showMsg({
  304. // type: "warning",
  305. // msg: "请选择起始时间",
  306. // });
  307. // return;
  308. // }
  309. var that = this;
  310. let station = "";
  311. if (typeof that.time[0].valueOf() != "string") {
  312. that.time[0] = new Date(that.time[0]).formatDate("yyyy-MM-dd hh:mm:ss")
  313. }
  314. if (typeof that.time[1].valueOf() != "string") {
  315. that.time[1] = new Date(that.time[1]).formatDate("yyyy-MM-dd hh:mm:ss")
  316. }
  317. that.API.requestData({
  318. showLoading: true,
  319. method: "GET",
  320. baseURL: "http://192.168.10.4:9002/",
  321. // baseURL: "http://192.168.10.19:9002/",
  322. subUrl: "case/performance/list",
  323. data: {
  324. tag: that.yblx,
  325. station: that.station,
  326. interval: that.interval,
  327. st: that.time[0].valueOf(),
  328. et: that.time[1].valueOf(),
  329. },
  330. success(res) {
  331. console.log(11111, res);
  332. if (res.code == 200) {
  333. that.tableData.data = [];
  334. if (res.data.length) {
  335. let data = res.data;
  336. for (var i = 0; i < data.length; i++) {
  337. let obj = {
  338. index: i + 1,
  339. tag: data[i].tag == 0 ? "正样本" : "负样本",
  340. windturbineid: data[i].windturbineid,
  341. starttime: data[i].starttime,
  342. endtime: data[i].endtime,
  343. id: data[i].id,
  344. };
  345. that.tableData.data.push(obj);
  346. }
  347. } else {
  348. that.BASE.showMsg({
  349. msg: "所选日期暂无数据",
  350. });
  351. }
  352. }
  353. },
  354. });
  355. },
  356. },
  357. created() {
  358. this.startAjax();
  359. },
  360. };
  361. </script>
  362. <style lang="less" scoped>
  363. .el-select.w {
  364. width: 100%;
  365. }
  366. </style>