ReportDetails.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399
  1. <template>
  2. <div class="bigBoxs">
  3. <div class="topBox">
  4. <div class="cilBox">
  5. <p style="font-size: 18px;font-weight: 400;">{{ stationNames }}-{{ relathing }}</p>
  6. </div>
  7. <div class="createReport">
  8. <img v-if="btnType" src="../../../assets/image/board_file.png" alt="">
  9. <img v-else src="../../../assets/image/allright.png" alt="">
  10. <p style="font-size: 14px;font-weight: 400;">{{ btnType ? '还未生成报告' : "报告已生成" }}</p>
  11. <el-button :type="btnType ? 'primary' : 'info'" plain @click="nowGet" :disabled="!btnType">立即生成</el-button>
  12. <el-button :type="btnType ? 'info' : 'primary'" plain :disabled="btnType" @click="downReport">下载报告</el-button>
  13. </div>
  14. </div>
  15. <div class="bottomBox" v-loading="loading">
  16. <div class="miniBox">
  17. <img style="width: 20px;height: 20px;display: block;margin-top: 10px;margin-left: 10px;"
  18. src="../../../assets/icon/file_blue.png" alt="">
  19. <span style="
  20. font-size: 16px;
  21. font-family: Source Han Sans CN, Source Han Sans CN;
  22. font-weight: 500;
  23. color: #1A2447;
  24. display: flex;
  25. margin-top: 10px;
  26. /* margin-left: 10px; */
  27. ">检测结果</span>
  28. </div>
  29. <div class="messageBox">
  30. <!-- 树形结构盒子 -->
  31. <!-- <div class="treeBox">
  32. </div> -->
  33. <!-- 大表格盒子 -->
  34. <div class="tableBox">
  35. <!-- 头部按钮和统计数据盒子 -->
  36. <div class="btnBox">
  37. <!-- 按钮盒子 -->
  38. <div class="btn">
  39. <el-button style="font-size: 16px;margin-left: 10px;" type="primary" plain @click="excelPort">
  40. <svg t="1705980404021" class="iconSvg" viewBox="0 0 1024 1024" version="1.1"
  41. xmlns="http://www.w3.org/2000/svg" p-id="7825" width="48" height="48">
  42. <path
  43. d="M486.4 367.616l-89.344 86.016a25.6 25.6 0 1 1-35.584-36.864l131.84-128A25.6 25.6 0 0 1 512 281.6h2.816a25.6 25.6 0 0 1 16.128 7.68l123.392 128a25.6 25.6 0 1 1-36.864 35.584L537.6 370.688V614.4a25.6 25.6 0 0 1-51.2 0zM972.8 230.4v691.2a102.4 102.4 0 0 1-102.4 102.4H153.6a102.4 102.4 0 0 1-102.4-102.4V102.4a102.4 102.4 0 0 1 102.4-102.4h593.92z m-230.4-162.56V204.8a25.6 25.6 0 0 0 25.6 25.6h133.12zM921.6 281.6h-153.6a76.8 76.8 0 0 1-76.8-76.8V51.2H153.6a51.2 51.2 0 0 0-51.2 51.2v819.2a51.2 51.2 0 0 0 51.2 51.2h716.8a51.2 51.2 0 0 0 51.2-51.2zM358.4 768a25.6 25.6 0 0 1 0-51.2h307.2a25.6 25.6 0 0 1 0 51.2z"
  44. fill="#255be7" p-id="7826"></path>
  45. </svg>
  46. 导出所有结果
  47. </el-button>
  48. </div>
  49. <!-- 统计数据盒子 -->
  50. <div class="count">
  51. <span style="margin-right: 5px;font-size: 16px;font-weight: 400;">全部:
  52. <em>{{ Number(warnCount) + Number(dangerCount) + Number(infoCount) }}</em></span>
  53. <span style="margin-right: 5px;font-size: 16px;font-weight: 400;">错误:
  54. <em style="color: red;">{{ dangerCount }}</em></span>
  55. <span style="margin-right: 5px;font-size: 16px;font-weight: 400;">告警:
  56. <em style="color: orange;">{{ warnCount }}</em></span>
  57. <span style="font-size: 16px;font-weight: 400;">提示:
  58. <em style="color: blue;">{{ infoCount }}</em></span>
  59. </div>
  60. </div>
  61. <div class="realBox" style="position: relative;">
  62. <el-table :data="tableData" stripe
  63. style="width: 100%;height: calc(100vh - 420px);margin-top: 10px;">
  64. <el-table-column prop="ied_name" label="装置名称" width="120" />
  65. <el-table-column prop="ied_desc" label="装置描述" width="240" />
  66. <el-table-column prop="alert_level" label="等级" width="100">
  67. <template #default="scope">
  68. <el-tag class="ml-2" :type="typeLevel(scope.row.alert_level)">{{
  69. canLevel(scope.row.alert_level) }}</el-tag>
  70. </template>
  71. </el-table-column>
  72. <el-table-column prop="line_no" label="行号" width="100">
  73. <template #default="scope">
  74. <span style="color: blue;border-bottom: 1px solid blue;cursor: pointer;"
  75. @click="lineno(scope.row)">{{
  76. scope.row.line_no }}</span>
  77. </template>
  78. </el-table-column>
  79. <el-table-column prop="parse_result" label="描述" width="auto" />
  80. <el-table-column label="标准及条款" width="400" show-overflow-tooltip>
  81. <template #default="scope">
  82. <p>{{ scope.row.apply_standard }}</p>
  83. <p>{{ scope.row.apply_standard_no }}</p>
  84. </template>
  85. </el-table-column>
  86. </el-table>
  87. <Pagination style="position: absolute;right: 10px;" :totals="totals" @pageBack="pageBack">
  88. </Pagination>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. <div>
  94. <LooKLine v-if="lineSearch" :lineSearch="lineSearch" :scdIds="scdIds" :lineNum="lineNum" :lineMsg="lineMsg" @lineClose="lineClose">
  95. </LooKLine>
  96. </div>
  97. </div>
  98. </template>
  99. <script>
  100. import { ref, watch, onMounted } from "vue"
  101. import { useRoute, useRouter } from "vue-router"
  102. import report from "@/api/report"
  103. import slc from "@/api/slc/slc"
  104. import systemRow from "@/api/systemRow"
  105. import Pagination from "./Pagination.vue"
  106. import { ElMessage } from "element-plus"
  107. import system from "@/api/system"
  108. import LooKLine from "../modal/LookLine.vue"
  109. import { scdExpTableData } from "@/api/scdCheck/scdCheck2";
  110. export default {
  111. setup() {
  112. let route = useRoute()
  113. let router = useRouter()
  114. let reportId = ref('')//报告id
  115. let scdIds = ref("")//scdid
  116. let tableData = ref([])//表格数据
  117. let warnCount = ref(0)//告警总数
  118. let dangerCount = ref(0)//错误总数
  119. let infoCount = ref(0)//提示总数
  120. let stationNames = ref("")//变电站名称
  121. let relathing = ref('')//检测名称
  122. let loading = ref(false)
  123. let reportUrl = ref('')
  124. let btnType = ref(true)//生成报告按钮和下载报告按钮状态
  125. let fileId = ref("")//需要下载的报告id'
  126. let totals = ref(0)
  127. let lineSearch = ref(false)
  128. let lineMsg = ref('')//行描述
  129. let lineNum = ref(0)//行号
  130. // 初始化组件
  131. function reload() {
  132. scdIds.value = route.query.scdId
  133. stationNames.value = route.query.stationName
  134. relathing.value = route.query.names
  135. reportId.value = route.query.reportId
  136. // report.genderReport({ task_id: route.query.reportId - 0 }).then(res => {
  137. // console.log(res, 'ressss');
  138. // })
  139. loading.value = true
  140. slc.getScdByIdFromMission({
  141. scd_id: route.query.scdId - 0,
  142. pageno: 1,
  143. pagesize: 20,
  144. }).then(res => {//获取总数量
  145. if (res.data != null) {
  146. console.log(res.data);
  147. tableData.value = res.data
  148. totals.value = res.count
  149. loading.value = false
  150. } else {
  151. loading.value = false
  152. }
  153. })
  154. slc.getErrorByLevel({
  155. scd_id: route.query.scdId - 0
  156. }).then(res => {//获取各个等级总数
  157. if (res.data != null) {
  158. res.data.map(item => {
  159. if (item.alert_level == 'waring') {
  160. warnCount.value = item.cnt
  161. } else if (item.alert_level == 'error') {
  162. dangerCount.value = item.cnt
  163. } else if (item.alert_level == 'info') {
  164. infoCount.value = item.cnt
  165. }
  166. })
  167. }
  168. })
  169. report.allReport({
  170. pageno: 1,
  171. pagesize: 20,
  172. name: relathing.value
  173. }).then(res => {
  174. console.log(res, 'oisaghuih');
  175. if(res.code==0 && res.data.length>0){
  176. btnType.value = false //报告已生成
  177. reportUrl.value = res.data[0].doc
  178. }
  179. })
  180. }
  181. // 筛选等级
  182. function canLevel(level) {
  183. if (level == 'waring') {
  184. return `告警`
  185. } else if (level == 'error') {
  186. return `错误`
  187. } else if (level == 'info') {
  188. return `提示`
  189. }
  190. }
  191. // 筛选tag标签状态
  192. function typeLevel(level) {
  193. if (level == 'waring') {
  194. return `warning`
  195. } else if (level == 'error') {
  196. return `danger`
  197. } else if (level == 'info') {
  198. return `info`
  199. }
  200. }
  201. // 生成报告
  202. function nowGet() {
  203. report.genderReport({
  204. task_id: reportId.value - 0
  205. }).then(res => {
  206. if (res.data != null) {
  207. fileId.value = res.data.TaskId
  208. btnType.value = false
  209. reportUrl.value = res.data.doc
  210. ElMessage({
  211. message: "生成报告成功",
  212. type: "success"
  213. })
  214. }
  215. })
  216. }
  217. // 下载报告
  218. function downReport() {
  219. location.href = window.ApiServer + "/" + reportUrl.value.toString();
  220. /*
  221. system.downLoad({
  222. path: reportUrl.value,
  223. save_name:''
  224. })
  225. */
  226. }
  227. // 导出结果至excel
  228. function excelPort() {
  229. // const nodeName = clickTreeData.value ? clickTreeData.value.datatype : "";
  230. // const nodeId = clickTreeData.value ? clickTreeData.value.id : "";
  231. systemRow.portExcel({
  232. code: "scl-check-result",
  233. caption: "检测报告",
  234. expcols: "ied_name,ied_desc,alert_level,line_no,parse_result,apply_standard,apply_standard_no",
  235. expcolnames: "装置名称,装置描述,等级,行号,描述,应用标准,标准条款",
  236. scd_id: route.query.scdId - 0,
  237. node_name: "",
  238. node_id: "",
  239. }).then(res => {
  240. if (res.data) {
  241. location.href = window.ApiServer + "/" + res.data;
  242. } else {
  243. ElMessage({
  244. message: res.msg,
  245. type: "info",
  246. });
  247. }
  248. })
  249. }
  250. //查看行位置
  251. function lineno(row) {
  252. lineMsg.value = row.parse_result
  253. lineNum.value = row.line_no
  254. lineSearch.value = true
  255. }
  256. // 分页组件返回
  257. function pageBack(size, index) {
  258. loading.value = true
  259. slc.getScdByIdFromMission({
  260. scd_id: route.query.scdId - 0,
  261. pageno: index,
  262. pagesize: size,
  263. }).then(res => {//获取总数量
  264. if (res.data != null) {
  265. console.log(res.data);
  266. tableData.value = res.data
  267. totals.value = res.count
  268. loading.value = false
  269. } else {
  270. loading.value = false
  271. }
  272. })
  273. }
  274. function lineClose(data) {
  275. lineSearch.value = data
  276. }
  277. onMounted(() => {
  278. reload()
  279. })
  280. return {
  281. reload,//初始化组件
  282. reportId,//报告id
  283. tableData,//表格数据
  284. scdIds,//scdid
  285. canLevel,//筛选等级
  286. typeLevel,//筛选tag标签状态
  287. warnCount,//告警总数
  288. dangerCount,//错误总数
  289. infoCount,//提示总数
  290. loading,//
  291. stationNames,
  292. relathing,
  293. totals,//总条数
  294. pageBack,
  295. nowGet,//生成报告按钮
  296. btnType,//按钮状态
  297. reportUrl,
  298. fileId,//下载的报告id
  299. downReport,//下载报告
  300. excelPort,
  301. lineSearch,//查看行号
  302. lineno,//查看行位置
  303. lineNum,//行号
  304. lineClose,//lookline.vue返回模态框状态
  305. lineMsg,
  306. }
  307. },
  308. components: {
  309. Pagination,
  310. LooKLine,
  311. }
  312. }
  313. </script>
  314. <style scoped>
  315. p {
  316. margin: 0;
  317. padding: 0;
  318. }
  319. em {
  320. list-style: none;
  321. font-style: normal;
  322. }
  323. .bigBoxs {
  324. width: 98%;
  325. height: calc(100vh - 90px);
  326. margin: 0 auto;
  327. }
  328. .createReport {
  329. width: 100%;
  330. height: calc(100vh - 780px);
  331. text-align: center;
  332. line-height: 30px;
  333. padding-top: 10px;
  334. background: #F7F8FB;
  335. }
  336. .bottomBox {
  337. width: 100%;
  338. height: calc(100vh - 320px);
  339. background-color: #F7F8FB;
  340. margin-top: 20px;
  341. }
  342. .miniBox {
  343. width: 100%;
  344. height: auto;
  345. display: flex;
  346. justify-content: flex-start;
  347. align-items: center;
  348. }
  349. .messageBox {
  350. width: 100%;
  351. height: calc(100vh - 380px);
  352. /* border: 1px solid saddlebrown; */
  353. margin-top: 10px;
  354. display: flex;
  355. justify-content: space-around;
  356. align-items: center;
  357. }
  358. .treeBox {
  359. width: 20%;
  360. height: calc(100vh - 380px);
  361. border: 1px solid #A3ADE0;
  362. }
  363. .tableBox {
  364. width: 100%;
  365. height: calc(100vh - 380px);
  366. }
  367. .btnBox {
  368. width: 100%;
  369. display: flex;
  370. justify-content: space-between;
  371. align-items: center;
  372. }
  373. .btn {
  374. width: 30%;
  375. }
  376. .count {
  377. width: 20%;
  378. text-align: center;
  379. }
  380. .iconSvg {
  381. width: 20px;
  382. height: 20px;
  383. }
  384. </style>