HaveMis.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <div>
  3. <div class="bigBox">
  4. <!-- 点击开始检测盒子 -->
  5. <div class="startBox">
  6. <p class="nowIn">{{ nowRunList.name ? nowRunList.name : "暂无待检测任务" }}</p>
  7. <p class="createDate">创建日期:{{ nowRunList.ct ? nowRunList.ct : "暂无时间" }}</p>
  8. <img src="../../../assets/image/start_btn.png" alt="" style="cursor: pointer;" @click="startNow(nowRunList)" />
  9. <p class="nowModel">
  10. 当前模型:<em class="nowEm">{{ nowRunList.voltage_name ? nowRunList.voltage_name + '线路保护' : "暂无数据" }}<img
  11. v-if="nowRunList.voltage_name" src="../../../assets/icon/pencil.png" alt="" /></em>
  12. </p>
  13. </div>
  14. <!-- 待检测任务 -->
  15. <div class="noReportBox">
  16. <div>
  17. <p class="norep">待检测任务</p>
  18. </div>
  19. <div style="display: flex;justify-content: flex-start;align-items: center;overflow-x: auto;">
  20. <div :class="setImg(nowRunList)" v-if="nowRunList.name">
  21. <div class="intBoxOne">
  22. <p class="intOne">
  23. <span style="font-size: 18px;color: white;">{{ nowRunList.name }}</span>
  24. <span style="font-size: 12px;" @click="editItem(nowRunList)">编辑</span>
  25. </p>
  26. <p>
  27. <img style="width: 15px;height: 15px;" src="../../../assets/icon/white_flash.png" alt="" />
  28. <span style="font-size: 12px;color:white" class="commonSpan">{{ nowRunList.station_name }}</span>
  29. </p>
  30. <p>
  31. <img style="width: 15px;height: 15px;" src="../../../assets/icon/white_clock.png" alt="" />
  32. <span style="font-size: 12px;color:white" class="commonSpan">{{ nowRunList.ct }}</span>
  33. </p>
  34. </div>
  35. <!-- 点击检测 -->
  36. <div class="setNow">
  37. <span style="font-size: 16px;color:white" class="setnowspan" @click="startNow(nowRunList)">检测中<em
  38. v-loading="emLoading"></em></span>
  39. </div>
  40. </div>
  41. <div class="intBox" v-for="(item, index) in misList" :style="setImg(item, index)">
  42. <div class="intBoxOne">
  43. <p class="intOne">
  44. <span style="font-size: 18px;color: #1A2447;">{{ item.name }}</span>
  45. <span style="font-size: 12px;cursor: pointer;" @click="editItem(item, index)">编辑</span>
  46. </p>
  47. <p>
  48. <img style="width: 15px;height: 15px;" src="../../../assets/icon/flash_darkBlue.png" alt="" />
  49. <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.station_name }}</span>
  50. </p>
  51. <p>
  52. <img style="width: 15px;height: 15px;" src="../../../assets/icon/clock_darkBlue.png" alt="" />
  53. <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.ut }}</span>
  54. </p>
  55. </div>
  56. <!-- 点击检测 -->
  57. <div class="setNow">
  58. <span style="font-size: 16px;color:blue" class="setnowspan" @click="startNow(item, index)">立即检测</span>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <!-- 已完成 -->
  64. <div class="noReportBox">
  65. <div>
  66. <p class="norep">最近检测任务-已完成</p>
  67. </div>
  68. <div style="display: flex;justify-content: flex-start;align-items: center;overflow-x: auto;">
  69. <div class="intBox" v-for="(item, index) in passList">
  70. <div class="intBoxOne">
  71. <p class="intOne">
  72. <span>{{ item.name }}</span>
  73. <span>详情→</span>
  74. </p>
  75. <p>
  76. <img style="width: 15px;height: 15px;" src="../../../assets/icon/flash_darkBlue.png" alt="" />
  77. <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.station_name }}</span>
  78. </p>
  79. <p>
  80. <img style="width: 15px;height: 15px;" src="../../../assets/icon/clock_darkBlue.png" alt="" />
  81. <span style="font-size: 12px;color:#7484AB" class="commonSpan">{{ item.ct }}</span>
  82. </p>
  83. </div>
  84. <!-- 点击检测 -->
  85. <div class="setNow">
  86. <span style="color: #255CE7;" class="setnowspan" @click="goNetStructPicture(item)">scd可视化</span>
  87. <span style="margin: 0 10px;color: #7484AB;" class="setnowspan">|</span>
  88. <span style="color: #255CE7;" class="setnowspan">检测结果</span>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </div>
  95. </template>
  96. <script>
  97. import { ref, onMounted, computed, toRefs } from "vue";
  98. import { useRouter } from "vue-router";
  99. import task from "@/api/task"
  100. import imgs from "../jscom/img";
  101. import { ElLoading, ElMessage } from "element-plus";
  102. export default {
  103. setup(props, { emit }) {
  104. let imgBack = ref("@/assets/image/card_blue.png");
  105. let router = useRouter();
  106. let sizeNum = ref(1);
  107. let misList = ref([])//待检测任务列表
  108. let nowRunList = ref({})//正在检测任务列表
  109. let passList = ref([])//已完成检测任务列表
  110. let emLoading = ref(true)
  111. function scdLink() {
  112. router.push("/home/scdMap");
  113. }
  114. function startNow(row, num) {
  115. if (row.name == null || row.name == '' || row.name == undefined) {
  116. ElMessage({
  117. message: "暂无检测任务",
  118. type: "info"
  119. })
  120. } else {
  121. sizeNum.value = 1;
  122. emit("hmBack", sizeNum.value, row);
  123. }
  124. }
  125. function goNetStructPicture(row) {
  126. console.log(row, 'push');
  127. router.push({
  128. path: "/home/netStructPicture",
  129. query: {
  130. id: row.scd_id,
  131. name: row.name,
  132. station:row.station_id,
  133. },
  134. });
  135. }
  136. function getList() {
  137. const loading = ElLoading.service({
  138. lock: true,
  139. text: '正在查询数据',
  140. background: 'rgba(0, 0, 0, 0.7)',
  141. })
  142. // 0为待检测
  143. task.getTask({ pageno: 1, pagesize: 10, state: 0 }).then(res => {
  144. if (res.data == null) {
  145. loading.close()
  146. misList.value = []
  147. return
  148. } else {
  149. const sortedList = res.data.sort((a, b) => {
  150. // 将 state 为 0 的对象排在前面
  151. if (a.state === 1 && b.state !== 1) {
  152. return -1; // a排在b前面
  153. } else if (a.state !== 1 && b.state === 1) {
  154. return 1; // b排在a前面
  155. } else {
  156. return 0; // 不需要交换位置
  157. }
  158. });
  159. misList.value = sortedList;
  160. emit("haveBack", misList.value);
  161. loading.close()
  162. }
  163. })
  164. // 2为完成检测
  165. task.getTask({ pageno: 1, pagesize: 10, state: 2 }).then(res => {
  166. if (res.data == null) {
  167. passList.value = []
  168. return
  169. } else {
  170. passList.value = res.data
  171. }
  172. })
  173. // 1为正在检测
  174. task.getTask({ pageno: 1, pagesize: 10, state: 1 }).then(res => {
  175. if (res.data == null) {
  176. nowRunList.value = {}
  177. return
  178. } else {
  179. nowRunList.value = res.data[0]
  180. }
  181. })
  182. }
  183. function editItem(row) {
  184. emit("haveInCreate", 1, row, 2)
  185. }
  186. function setImg(row, num) {
  187. if (row.state == "1") {
  188. return "intBoxCopy"
  189. } else {
  190. return "intBox"
  191. }
  192. }
  193. onMounted(() => {
  194. getList()
  195. })
  196. return {
  197. imgBack,
  198. scdLink,
  199. startNow,
  200. sizeNum,
  201. goNetStructPicture,
  202. getList,
  203. misList,//待检测任务列表
  204. editItem,
  205. nowRunList,//正在检测任务列表
  206. setImg,
  207. passList,//已完成列表
  208. emLoading,
  209. };
  210. },
  211. components: {
  212. }
  213. };
  214. </script>
  215. <style scoped>
  216. @import url('https://fonts.font.im/css?family=Montserrat');
  217. p {
  218. margin: 0;
  219. padding: 0;
  220. font-family: 'Montserrat', sans-serif;
  221. }
  222. .bigBox {
  223. width: 99%;
  224. height: 100%;
  225. /* border: 1px solid saddlebrown; */
  226. }
  227. .startBox {
  228. width: 320px;
  229. height: 335px;
  230. margin: 0 auto;
  231. /* border: 1px solid black; */
  232. text-align: center;
  233. line-height: 25px;
  234. }
  235. .nowIn {
  236. /* width: 180px;
  237. height: 28px; */
  238. font-size: 20px;
  239. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  240. font-weight: bold;
  241. color: #1a2447;
  242. /* line-height: 28px; */
  243. }
  244. .createDate {
  245. /* width: 168px;
  246. height: 22px; */
  247. font-size: 16px;
  248. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  249. font-weight: 400;
  250. color: #7484ab;
  251. /* line-height: 22px; */
  252. }
  253. .nowModel {
  254. font-size: 18px;
  255. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  256. font-weight: 400;
  257. color: #1a2447;
  258. }
  259. .nowEm {
  260. font-style: normal;
  261. font-size: 18px;
  262. font-family: Source Han Sans CN-Medium, Source Han Sans CN;
  263. font-weight: 500;
  264. color: #255ce7;
  265. line-height: 24px;
  266. border-bottom: 1px solid #255ce7;
  267. }
  268. .noReportBox {
  269. width: 99%;
  270. height: 100%;
  271. margin-left: 8px;
  272. /* border: 1px solid salmon; */
  273. }
  274. .norep {
  275. font-size: 16px;
  276. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  277. font-weight: 400;
  278. color: #7484ab;
  279. }
  280. .intBox {
  281. width: 269px;
  282. height: 116px;
  283. line-height: 20px;
  284. background-repeat: no-repeat;
  285. background-size: 100% 100%;
  286. margin: 15px 15px;
  287. /* border: 1px solid #255ce7; */
  288. background-color: #F6F9FF;
  289. border-radius: 5px;
  290. box-shadow: inset 0px -3px 3px 0px #C8D4EC;
  291. /* border: 1px solid brown; */
  292. /* background-image: url(../../../assets/image/card_blue.png); */
  293. }
  294. .intBoxCopy {
  295. width: 269px;
  296. height: 116px;
  297. line-height: 20px;
  298. background-repeat: no-repeat;
  299. background-size: 100% 100%;
  300. margin: 15px 15px;
  301. background-color: #F6F9FF;
  302. border-radius: 5px;
  303. box-shadow: inset 0px -3px 3px 0px #C8D4EC;
  304. background-image: url(../../../assets/image/card_blue.png);
  305. }
  306. .intBoxOne {
  307. padding-top: 5px;
  308. }
  309. .intOne {
  310. position: relative;
  311. }
  312. .intOne span:nth-child(2) {
  313. /* margin-left: 70px; */
  314. font-size: 14px;
  315. position: absolute;
  316. top: 0px;
  317. right: 10px;
  318. }
  319. .intOne span:nth-child(1) {
  320. margin-left: 5px;
  321. font-size: 18px;
  322. }
  323. .commonSpan {
  324. font-size: 14px;
  325. }
  326. .setNow {
  327. text-align: center;
  328. margin-top: 10px;
  329. }
  330. .setnowspan {
  331. font-size: 17px;
  332. cursor: pointer;
  333. }
  334. :deep(.el-loading-spinner .circular) {
  335. width: 16px;
  336. }
  337. :deep(.el-loading-spinner .path) {
  338. stroke: #ffffff;
  339. }
  340. </style>