HaveMis.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. <template>
  2. <div>
  3. <div class="bigBox">
  4. <!-- 点击开始检测盒子 -->
  5. <div class="startBox">
  6. <p class="nowIn">{{ lookingTask.name ? lookingTask.name : "请选择一个待检测任务" }}</p>
  7. <p v-if="lookingTask.name" class="createDate">创建日期:{{ lookingTask.ct ? lookingTask.ct : "暂无时间" }}</p>
  8. <img src="../../../assets/image/start_btn.png" alt="" style="cursor: pointer;" @click="startNow(lookingTask)" />
  9. <p class="nowModel" v-if="lookingTask.name">
  10. <span style="margin-right: 15px;">检测模型:</span>
  11. <el-select v-model="currEditTaskModels" @change="relison">
  12. <el-option v-for="(item, index) in taskModels" :title="item.model_name" :key="index"
  13. :label="item.model_name" :value="item.model_id" />
  14. </el-select>
  15. <span style="margin: 10px;cursor: pointer;"><img src="../../../assets/icon/pencil.png" alt="编辑所选模型"
  16. @click="editTaskModel" /></span>
  17. </p>
  18. </div>
  19. <!-- 待检测任务 -->
  20. <div class="noReportBox">
  21. <div style="display: flex;justify-content: flex-start;align-items: center;">
  22. <p class="norep">待检测任务</p>
  23. <p style="display: flex;justify-content: flex-start;align-items: center;margin-left: 10px;cursor: pointer;">
  24. <span style="display: block;color: #5090F1;" @click="moreMis">更多</span>
  25. <svg style="width: 14px;height: 14px;display: block;" t="1706067807079" class="icon" viewBox="0 0 1024 1024"
  26. version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4220" width="48" height="48">
  27. <path
  28. d="M160.117 212.026v-82.233a8 8 0 0 1 13.33-5.966l407.697 364.298c0.9 0.804 1.753 1.658 2.556 2.558 11.764 13.186 10.62 33.419-2.556 45.192L173.448 900.173a8 8 0 0 1-13.33-5.966v-82.233a16 16 0 0 1 5.338-11.93L487.814 512 165.456 223.957a16 16 0 0 1-5.339-11.931z m272.057 0v-82.233a8 8 0 0 1 13.33-5.966l407.697 364.298c0.9 0.804 1.753 1.658 2.556 2.558 11.764 13.186 10.62 33.419-2.556 45.192L445.505 900.173a8 8 0 0 1-13.33-5.966v-82.233a16 16 0 0 1 5.339-11.93L759.87 512 437.514 223.957a16 16 0 0 1-5.34-11.931z"
  29. fill="#5090F1" p-id="4221"></path>
  30. </svg>
  31. </p>
  32. </div>
  33. <div style="display: flex;justify-content: flex-start;align-items: center;overflow-x: auto;"
  34. v-if="nowRunList.length > 0 || misList.length > 0">
  35. <div :class="setImg(item)" v-if="nowRunList.length > 0" v-for="(item, index) in nowRunList">
  36. <div class="intBoxOne">
  37. <p class="intOne">
  38. <span style="font-size: 18px;color: white;">{{ item.name }}</span>
  39. </p>
  40. <p style="margin-left: 8px;">
  41. <img style="width: 15px;height: 15px;float: left;padding-top:2px"
  42. src="../../../assets/icon/white_flash.png" alt="" />
  43. <span style="font-size: 12px;color:white" class="commonSpan">{{ item.station_name }}</span>
  44. </p>
  45. <p style="margin-left: 8px;">
  46. <img style="width: 15px;height: 15px;float: left;padding-top:2px"
  47. src="../../../assets/icon/white_clock.png" alt="" />
  48. <span style="font-size: 12px;color:white" class="commonSpan">{{ item.ct }}</span>
  49. </p>
  50. </div>
  51. <!-- 点击检测 -->
  52. <div class="setNow">
  53. <span style="font-size: 16px;color:white" class="setnowspan" @click="startBefore(item, index)">检测中<em
  54. v-loading="emLoading"></em></span>
  55. </div>
  56. </div>
  57. <div class="intBox" v-for="(item, index) in misList" :style="setImg(item, index)" @mouseover="intOver(index)"
  58. @mouseout="intOut(index)">
  59. <div class="intBoxOne">
  60. <p class="intOne">
  61. <span style="font-size: 18px;">{{ item.name }}</span>
  62. <span style="font-size: 12px;cursor: pointer;" @click="editItem(item, index)">编辑</span>
  63. </p>
  64. <p style="margin-left: 8px;">
  65. <img style="width: 15px;height: 15px;float: left;padding-top:2px"
  66. :src="isImg && isIndex == index ? require('../../../assets/icon/white_flash.png') : require('../../../assets/icon/flash_darkBlue.png')"
  67. alt="" />
  68. <span style="font-size: 12px;" class="commonSpan">{{ item.station_name }}</span>
  69. </p>
  70. <p style="margin-left: 8px;">
  71. <img style="width: 15px;height: 15px;float: left;padding-top:2px"
  72. :src="isImg && isIndex == index ? require('../../../assets/icon/white_clock.png') : require('../../../assets/icon/clock_darkBlue.png')"
  73. alt="" />
  74. <span style="font-size: 12px;" class="commonSpan">{{ item.ut }}</span>
  75. </p>
  76. </div>
  77. <!-- 点击检测 -->
  78. <div class="setNow">
  79. <span style="font-size: 16px;" class="setnowspan" @click="startBefore(item, index)">立即检测</span>
  80. </div>
  81. </div>
  82. </div>
  83. <div
  84. style="width: 100%;height: calc(100vh - 800px);margin: 0 auto;text-align: center;line-height: calc(100vh - 800px);"
  85. v-else>
  86. <p style="display: flex;justify-content: center;align-items: center;">
  87. <el-icon style="font-size: 16px;display: block;color: #7484AB;">
  88. <Warning />
  89. </el-icon>
  90. <span style="display: block;color: #7484AB;">暂无待检测任务,请新建</span>
  91. </p>
  92. </div>
  93. </div>
  94. <!-- 已完成 -->
  95. <div class="noReportBox">
  96. <div style="display: flex;justify-content: flex-start;align-items: center;">
  97. <p class="norep">最近检测任务-已完成</p>
  98. <p style="display: flex;justify-content: flex-start;align-items: center;margin-left: 10px;cursor: pointer;">
  99. <span style="display: block;color: #5090F1;" @click="moreMis">更多</span>
  100. <svg style="width: 14px;height: 14px;display: block;" t="1706067807079" class="icon" viewBox="0 0 1024 1024"
  101. version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4220" width="48" height="48">
  102. <path
  103. d="M160.117 212.026v-82.233a8 8 0 0 1 13.33-5.966l407.697 364.298c0.9 0.804 1.753 1.658 2.556 2.558 11.764 13.186 10.62 33.419-2.556 45.192L173.448 900.173a8 8 0 0 1-13.33-5.966v-82.233a16 16 0 0 1 5.338-11.93L487.814 512 165.456 223.957a16 16 0 0 1-5.339-11.931z m272.057 0v-82.233a8 8 0 0 1 13.33-5.966l407.697 364.298c0.9 0.804 1.753 1.658 2.556 2.558 11.764 13.186 10.62 33.419-2.556 45.192L445.505 900.173a8 8 0 0 1-13.33-5.966v-82.233a16 16 0 0 1 5.339-11.93L759.87 512 437.514 223.957a16 16 0 0 1-5.34-11.931z"
  104. fill="#5090F1" p-id="4221"></path>
  105. </svg>
  106. </p>
  107. </div>
  108. <div style="display: flex;justify-content: flex-start;align-items: center;">
  109. <div class="intBox" v-for="(item, index) in passList" @mouseover="intOvers(index)" @mouseout="intOuts(index)">
  110. <div class="intBoxOne">
  111. <p class="intOne" @click="editItem(item, index)">
  112. <span>{{ item.name }}</span>
  113. <span style="cursor: pointer;" @click="editItem(item, index)">详情<el-icon>
  114. <Right />
  115. </el-icon></span>
  116. </p>
  117. <p style="margin-left: 8px;">
  118. <img style="width: 15px;height: 15px;float: left;padding-top:2px"
  119. :src="isImgs && isIndexs == index ? require('../../../assets/icon/white_flash.png') : require('../../../assets/icon/flash_darkBlue.png')"
  120. alt="" />
  121. <span style="font-size: 12px;" class="commonSpan">{{ item.station_name }}</span>
  122. </p>
  123. <p style="margin-left: 8px;">
  124. <img style="width: 15px;height: 15px;float: left;padding-top:2px"
  125. :src="isImgs && isIndexs == index ? require('../../../assets/icon/white_clock.png') : require('../../../assets/icon/clock_darkBlue.png')"
  126. alt="" />
  127. <span style="font-size: 12px;" class="commonSpan">{{ item.start_time }}</span>
  128. </p>
  129. </div>
  130. <!-- 点击检测 -->
  131. <div class="setNow">
  132. <span class="setnowspan" @click="goNetStructPicture(item)">scd可视化</span>
  133. <span style="margin: 0 10px;" class="setnowspan">|</span>
  134. <span class="setnowspan" @click="outcome(item, index)">检测结果</span>
  135. <span style="margin: 0 10px;" class="setnowspan">|</span>
  136. <!-- <span class="setnowspan" @click="startBefore(item, index)">重新检测</span> -->
  137. <span class="setnowspan" @click="restart(item, index)">重新检测</span>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </template>
  145. <script>
  146. import { ref, onMounted, computed, toRefs, watch } from "vue";
  147. import { useRouter } from "vue-router";
  148. import task from "@/api/task"
  149. import imgs from "../jscom/img";
  150. import { ElLoading, ElMessage } from "element-plus";
  151. export default {
  152. props: {
  153. numType: {
  154. type: Boolean,
  155. required: true,
  156. },//startmission组件返回刷新状态
  157. },
  158. setup(props, { emit }) {
  159. let imgBack = ref("@/assets/image/card_blue.png");
  160. let router = useRouter();
  161. let sizeNum = ref(1);
  162. let lookingTask = ref({}) //当前点击查看的任务对象
  163. let taskModels = ref([]) //任务模型列表
  164. let misList = ref([])//待检测任务列表
  165. let nowRunList = ref([])//正在检测任务列表
  166. let passList = ref([])//已完成检测任务列表
  167. let currEditTaskModels = ref('')
  168. let emLoading = ref(true)
  169. let isImg = ref(false)
  170. let isImgs = ref(false)
  171. let isIndex = ref(999999)
  172. let isIndexs = ref(999999)
  173. let isType = ref(false)//本组件刷新状态
  174. function scdLink() {
  175. router.push("/home/scdMap");
  176. }
  177. function startBefore(row, num) {
  178. lookingTask.value = row
  179. taskModels.value = []
  180. task.getTaskById({ id: row.id }).then(res => {
  181. if (res == null) return
  182. if (res.code != 0) {
  183. ElMessage({
  184. message: res.msg,
  185. type: "error"
  186. })
  187. return
  188. }
  189. let models = res.data.models
  190. if (models === null || models.length === 0) return
  191. taskModels.value = models
  192. })
  193. }
  194. function startNow(row, num) {
  195. if (row.name == null || row.name == '' || row.name == undefined || currEditTaskModels.value == '') {
  196. ElMessage({
  197. message: "暂无检测任务或未选择模型",
  198. type: "info"
  199. })
  200. } else {
  201. sizeNum.value = 1;
  202. emit("hmBack", sizeNum.value, row);
  203. }
  204. }
  205. function editTaskModel() {
  206. // 跳转到内置模型编辑组件
  207. let m1 = taskModels.value.filter(item => item.model_id == currEditTaskModels.value)
  208. if (m1.length === 0) return
  209. router.push({
  210. path: "/home/setting",
  211. query: {
  212. modelid: currEditTaskModels.value,
  213. modelname: m1[0].model_name,
  214. isNow: 1,
  215. },
  216. });
  217. }
  218. function goNetStructPicture(row) {
  219. router.push({
  220. path: "/home/netStructPicture",
  221. query: {
  222. id: row.scd_id,
  223. name: row.name,
  224. parentData: JSON.stringify(row),
  225. stationId: row.station_id,
  226. stationName: row.scd_name,
  227. },
  228. });
  229. }
  230. // 生成报告和跳转页面
  231. function outcome(row, num) {
  232. console.log(row, 'rou');
  233. router.push({
  234. path: "/home/report/details",
  235. query: {
  236. reportId: row.id,
  237. scdId: row.scd_id,
  238. stationName: row.station_name,
  239. names: row.name
  240. }
  241. })
  242. }
  243. function getList() {
  244. const loading = ElLoading.service({
  245. lock: true,
  246. text: '正在查询数据',
  247. background: 'rgba(0, 0, 0, 0.7)',
  248. })
  249. // 0为待检测
  250. task.getTask({ pageno: 1, pagesize: 6, state: 0 }).then(res => {
  251. if (res == null || res.data == null) {
  252. loading.close()
  253. misList.value = []
  254. return
  255. } else {
  256. const sortedList = res.data.sort((a, b) => {
  257. // 将 state 为 0 的对象排在前面
  258. if (a.state === 1 && b.state !== 1) {
  259. return -1; // a排在b前面
  260. } else if (a.state !== 1 && b.state === 1) {
  261. return 1; // b排在a前面
  262. } else {
  263. return 0; // 不需要交换位置
  264. }
  265. });
  266. misList.value = res.data;
  267. emit("haveBack", misList.value);
  268. loading.close()
  269. }
  270. })
  271. // 2为完成检测
  272. task.getTask({ pageno: 1, pagesize: 6, state: 2 }).then(res => {
  273. if (res == null || res.data == null) {
  274. passList.value = []
  275. return
  276. } else {
  277. console.log(res.data, 'asdkjk');
  278. passList.value = res.data.sort((a, b) => {
  279. // 将日期字符串转换为 Date 对象进行比较
  280. const dateA = new Date(a.start_time);
  281. const dateB = new Date(b.start_time);
  282. // 返回结果以实现降序排列
  283. return dateB - dateA;
  284. });
  285. }
  286. })
  287. // 1为正在检测
  288. task.getTask({ pageno: 1, pagesize: 10, state: 1 }).then(res => {
  289. if (res == null || res.data == null) {
  290. nowRunList.value = []
  291. lookingTask.value = []
  292. return
  293. } else {
  294. nowRunList.value = res.data
  295. lookingTask.value = res.data //默认查看该任务信息
  296. }
  297. })
  298. }
  299. function restart(row, num) {
  300. task.reladyTask({
  301. id: row.id
  302. }).then(res => {
  303. if (res != null && res.code == 0) {
  304. ElMessage({
  305. message: "任务已重置",
  306. type: "success"
  307. })
  308. getList()
  309. } else {
  310. ElMessage({
  311. message: res.msg,
  312. type: "error"
  313. })
  314. }
  315. })
  316. }
  317. function editItem(row) {
  318. emit("haveInCreate", 1, row, 2)
  319. }
  320. function setImg(row, num) {
  321. if (row.state == "1") {
  322. return "intBoxCopy"
  323. } else {
  324. return "intBox"
  325. }
  326. }
  327. function moreMis() {
  328. emit("moreBack", 2)
  329. }
  330. function relison(e) {
  331. currEditTaskModels.value = e
  332. }
  333. function intOver(num) {
  334. isIndex.value = num
  335. isImg.value = true
  336. }
  337. function intOut(num) {
  338. isIndex.value = num
  339. isImg.value = false
  340. }
  341. function intOvers(num) {
  342. isIndexs.value = num
  343. isImgs.value = true
  344. }
  345. function intOuts(num) {
  346. isIndexs.value = num
  347. isImgs.value = false
  348. }
  349. onMounted(() => {
  350. getList()
  351. })
  352. return {
  353. imgBack,
  354. scdLink,
  355. startNow,
  356. startBefore,
  357. editTaskModel,
  358. currEditTaskModels,
  359. sizeNum,
  360. goNetStructPicture,
  361. getList,
  362. misList,//待检测任务列表
  363. editItem,
  364. nowRunList,//正在检测任务列表
  365. lookingTask,
  366. taskModels,
  367. setImg,
  368. passList,//已完成列表
  369. emLoading,
  370. isImg,
  371. isImgs,
  372. intOver,
  373. intOut,
  374. intOvers,
  375. intOuts,
  376. isIndex,
  377. isIndexs,
  378. relison,//开始检测后选择模型change事件
  379. outcome,//生成报告和跳转yemian
  380. moreMis,
  381. isType,//本组件刷新状态
  382. restart,
  383. };
  384. },
  385. components: {
  386. }
  387. };
  388. </script>
  389. <style scoped>
  390. @import url('https://fonts.font.im/css?family=Montserrat');
  391. p {
  392. margin: 0;
  393. padding: 0;
  394. font-family: 'Montserrat', sans-serif;
  395. }
  396. .bigBox {
  397. width: 99%;
  398. height: 100%;
  399. /* border: 1px solid saddlebrown; */
  400. }
  401. .startBox {
  402. width: 100%;
  403. height: 335px;
  404. margin: 0 auto;
  405. /* border: 1px solid black; */
  406. text-align: center;
  407. line-height: 25px;
  408. }
  409. .nowIn {
  410. /* width: 180px;
  411. height: 28px; */
  412. font-size: 20px;
  413. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  414. font-weight: bold;
  415. color: #1a2447;
  416. /* line-height: 28px; */
  417. }
  418. .createDate {
  419. /* width: 168px;
  420. height: 22px; */
  421. font-size: 16px;
  422. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  423. font-weight: 400;
  424. color: #7484ab;
  425. margin: 10px 0;
  426. /* line-height: 22px; */
  427. }
  428. .nowModel {
  429. font-size: 18px;
  430. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  431. font-weight: 400;
  432. color: #1a2447;
  433. margin: 10px 0;
  434. }
  435. .nowEm {
  436. font-style: normal;
  437. font-size: 16px;
  438. font-family: Source Han Sans CN-Medium, Source Han Sans CN;
  439. font-weight: 500;
  440. color: #255ce7;
  441. line-height: 24px;
  442. margin: 0 10px;
  443. width: 100px;
  444. border-bottom: 1px solid #255ce7;
  445. float: left;
  446. }
  447. .noReportBox {
  448. width: 99%;
  449. height: 100%;
  450. margin-left: 15px;
  451. float: left;
  452. min-height: 50px;
  453. overflow-y: auto;
  454. /* border: 1px solid salmon; */
  455. }
  456. .norep {
  457. font-size: 16px;
  458. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  459. font-weight: 400;
  460. color: #7484ab;
  461. }
  462. .intBox {
  463. width: 269px;
  464. height: 116px;
  465. line-height: 20px;
  466. background-repeat: no-repeat;
  467. background-size: 100% 100%;
  468. margin: 15px 15px;
  469. background-color: #F6F9FF;
  470. border-radius: 5px;
  471. box-shadow: inset 0px -3px 3px 0px #C8D4EC;
  472. }
  473. .intBox:hover {
  474. background-color: #8BA6F0;
  475. color: white;
  476. }
  477. .intBox>div>p>span:hover {
  478. color: white;
  479. }
  480. .intBoxCopy {
  481. width: 269px;
  482. height: 116px;
  483. line-height: 20px;
  484. background-repeat: no-repeat;
  485. background-size: 100% 100%;
  486. margin: 15px 15px;
  487. background-color: #F6F9FF;
  488. border-radius: 5px;
  489. box-shadow: inset 0px -3px 3px 0px #C8D4EC;
  490. background-image: url(../../../assets/image/card_blue.png);
  491. }
  492. .intBoxOne {
  493. padding-top: 5px;
  494. }
  495. .intOne {
  496. position: relative;
  497. }
  498. .intOne span:nth-child(2) {
  499. /* margin-left: 70px; */
  500. font-size: 14px;
  501. position: absolute;
  502. top: 0px;
  503. right: 10px;
  504. }
  505. .intOne span:nth-child(1) {
  506. margin-left: 5px;
  507. font-size: 18px;
  508. }
  509. .commonSpan {
  510. font-size: 14px;
  511. color: #7484AB;
  512. }
  513. .intBox:hover .commonSpan .setnowspan,
  514. .intBox:hover span {
  515. color: white;
  516. }
  517. .setNow {
  518. text-align: center;
  519. margin-top: 10px;
  520. }
  521. .setnowspan {
  522. font-size: 14px;
  523. cursor: pointer;
  524. color: blue;
  525. }
  526. .needColor {
  527. color: #7484AB;
  528. }
  529. :deep(.el-loading-spinner .circular) {
  530. width: 16px;
  531. }
  532. :deep(.el-loading-spinner .path) {
  533. stroke: #ffffff;
  534. }
  535. </style>