StartMission.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <div>
  3. <div class="bigBox">
  4. <!-- 检测任务信息 -->
  5. <div class="missionBox">
  6. <p class="nowMis">{{ loadingMis.name }}</p>
  7. <p class="dateMis">创建日期:{{ loadingMis.ct }}</p>
  8. <img src="../../../assets/image/start_mission.png" style="width: 200px;height: 200px;" alt="">
  9. <p class="loading1" v-if="end">请耐心等待检测完成</p>
  10. <p style="color: greenyellow;font-size: 16px;display: flex;justify-content: center;align-items: center;"
  11. v-else>
  12. <p style="display: block;">检测已完成</p>
  13. <el-icon style="color: greenyellow;display: block;">
  14. <SuccessFilled />
  15. </el-icon>
  16. </p>
  17. <el-button type="primary" @click="misDown" v-if="end">取消</el-button>
  18. <el-button type="primary" @click="backDown" v-else>返回</el-button>
  19. </div>
  20. <!-- 步骤和结果 -->
  21. <div class="stepAndEnd">
  22. <!-- 步骤条 -->
  23. <div class="stepBox">
  24. <StepMethod :stepList="stepList"></StepMethod>
  25. </div>
  26. <!-- 结果 -->
  27. <div class="endBox">
  28. <div style="display: flex;justify-content: flex-start;align-items: center;">
  29. <img style="display: block;" src="../../../assets/icon/file_blue.png" alt="">
  30. <span style="display: block;font-size: 14px;font-size: 16px;font-weight: 400;">检测结果</span>
  31. </div>
  32. <el-table :data="endList" stripe style="width: 100%;height: calc(100vh - 600px);" v-loading="loading">
  33. <el-table-column prop="ied_name" label="装置名称" width="150" />
  34. <el-table-column prop="ied_desc" label="装置描述" width="150" :show-overflow-tooltip="true" />
  35. <el-table-column label="等级" width="130">
  36. <template #default="scope">
  37. <span :style="{ 'color': scope.row.alert_level == 'error' ? 'red' : 'yellow' }">{{
  38. levelChoose(scope.row.alert_level) }}</span>
  39. </template>
  40. </el-table-column>
  41. <el-table-column prop="line_no" label="行号" width="130">
  42. <template #default="scope">
  43. <span style="color: blue;border-bottom: 1px solid blue;cursor: pointer;"
  44. @click="lineno(scope.row)">{{
  45. scope.row.line_no }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="parse_result" label="描述" width="auto" :show-overflow-tooltip="true" />
  49. <el-table-column width="220" label="标准及条款" :show-overflow-tooltip="true">
  50. <template #default="scope">
  51. <p>{{ scope.row.apply_standard }}</p>
  52. <p>{{ scope.row.apply_standard_no }}</p>
  53. </template>
  54. </el-table-column>
  55. </el-table>
  56. </div>
  57. </div>
  58. </div>
  59. <div>
  60. <LookLine v-if="lineSearch" :lineSearch="lineSearch" :scdIds="scdIds" :lineNum="lineNum" :lineMsg="lineMsg"
  61. @lineClose="lineClose">
  62. </LookLine>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import { ref, onMounted, toRefs, watch } from 'vue';
  68. import StepMethod from './StepMethod.vue';
  69. import task from '@/api/task';
  70. import slc from '@/api/slc/slc';
  71. import { ElMessage } from 'element-plus';
  72. import LookLine from '../modalComp/LookLine.vue';
  73. export default {
  74. props: {
  75. startMis: {
  76. type: Object,
  77. required: true
  78. }
  79. },
  80. setup(props, { emit }) {
  81. let arrow = ref(0)
  82. let loadingMis = ref({})
  83. let stepList = ref([])
  84. let endList = ref([])//结果表格
  85. let scdIds = ref("")//当前组件scdid
  86. let lineNum = ref(0)
  87. let lineSearch = ref(false)
  88. let end = ref(true)
  89. let lineMsg = ref("")
  90. let loading = ref(false)
  91. watch(() => props.startMis, (newVal) => {
  92. loadingMis.value = newVal
  93. scdIds.value = newVal.scd_id
  94. })
  95. function misDown() {
  96. task.stopTask({ id: loadingMis.value.id }).then(res => {
  97. if (res.code == 0) {
  98. ElMessage({
  99. message: "取消成功",
  100. type: "success"
  101. })
  102. }
  103. })
  104. emit("smBack", arrow.value)
  105. }
  106. function picReload() {
  107. loadingMis.value = props.startMis
  108. scdIds.value = loadingMis.value.scd_id
  109. loading.value = true
  110. task.tackStart({ id: loadingMis.value.id }).then(res => {
  111. let countTime = setInterval(() => {
  112. task.lookStep({ id: loadingMis.value.id - 0 }).then(res => {
  113. if (res.data) {
  114. stepList.value = res.data
  115. } else {
  116. ElMessage({
  117. message: res.msg,
  118. type: "error"
  119. })
  120. }
  121. })
  122. }, 1000)
  123. setTimeout(() => {
  124. clearInterval(countTime)
  125. end.value = false
  126. }, 40000)
  127. })
  128. setTimeout(() => {
  129. slc.getScdByIdFromMission({
  130. scd_id: loadingMis.value.scd_id - 0,
  131. pageno: 1,
  132. pagesize: 20,
  133. }).then(res => {
  134. if (res.data) {
  135. endList.value = res.data
  136. loading.value = false
  137. }else{
  138. endList.value = []
  139. loading.value = false
  140. }
  141. })
  142. }, 30000)
  143. }
  144. function backDown() {
  145. emit("smBack", arrow.value)
  146. }
  147. function levelChoose(bit) {
  148. if (bit == "error") {
  149. return '错误'
  150. } else if (bit == 'warning') {
  151. return '告警'
  152. }
  153. }
  154. function lineno(row) {
  155. lineNum.value = row.line_no
  156. lineMsg.value = row.parse_result
  157. lineSearch.value = true
  158. }
  159. function lineClose(data) {
  160. lineSearch.value = data
  161. }
  162. onMounted(() => {
  163. picReload()
  164. })
  165. return {
  166. arrow,
  167. misDown,
  168. loadingMis,//传递过来的任务名称
  169. picReload,//初始化组件
  170. stepList,//步骤表
  171. endList,//结果表格
  172. levelChoose,//等级筛选
  173. end,
  174. backDown,
  175. lineno,
  176. scdIds,
  177. lineNum,
  178. lineSearch,
  179. lineMsg,
  180. lineClose,
  181. loading,
  182. }
  183. },
  184. components: {
  185. StepMethod,
  186. LookLine
  187. }
  188. }
  189. </script>
  190. <style scoped>
  191. p {
  192. margin: 0;
  193. padding: 0;
  194. }
  195. .bigBox {
  196. width: 98%;
  197. height: calc(100vh - 150px);
  198. /* border: 1px solid black; */
  199. display: flex;
  200. justify-content: space-around;
  201. align-items: center;
  202. }
  203. .missionBox {
  204. width: 30%;
  205. height: 100%;
  206. /* border: 1px solid purple; */
  207. text-align: center;
  208. line-height: 30px;
  209. }
  210. .stepAndEnd {
  211. width: 68%;
  212. height: 100%;
  213. /* border: 1px solid brown; */
  214. }
  215. .stepBox {
  216. width: 100%;
  217. height: calc(100vh - 530px);
  218. /* border: 1px solid red; */
  219. overflow-y: auto;
  220. background-color: #F7F8FB;
  221. }
  222. .endBox {
  223. width: 100%;
  224. height: calc(100vh - 600px);
  225. /* border: 1px solid green; */
  226. margin-top: 20px;
  227. background-color: #F7F8FB;
  228. }
  229. .nowMis {
  230. font-size: 20px;
  231. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  232. font-weight: bold;
  233. color: #1A2447;
  234. }
  235. .dateMis {
  236. font-size: 14px;
  237. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  238. font-weight: 400;
  239. color: #7484AB;
  240. }
  241. .loading1 {
  242. font-size: 16px;
  243. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  244. font-weight: 400;
  245. color: #255CE7;
  246. }
  247. </style>