StartMission.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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);">
  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;" @click="lineno(scope.row)">{{
  44. scope.row.line_no }}</span>
  45. </template>
  46. </el-table-column>
  47. <el-table-column prop="parse_result" label="描述" width="auto" :show-overflow-tooltip="true" />
  48. <el-table-column width="220" label="标准及条款" :show-overflow-tooltip="true">
  49. <template #default="scope">
  50. <p>{{ scope.row.apply_standard }}</p>
  51. <p>{{ scope.row.apply_standard_no }}</p>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. </div>
  56. </div>
  57. </div>
  58. <div>
  59. <LookLine v-if="lineSearch" :lineSearch="lineSearch" :scdIds="scdIds" :lineNum="lineNum" @lineClose="lineClose">
  60. </LookLine>
  61. </div>
  62. </div>
  63. </template>
  64. <script>
  65. import { ref, onMounted, toRefs, watch } from 'vue';
  66. import StepMethod from './StepMethod.vue';
  67. import task from '@/api/task';
  68. import slc from '@/api/slc/slc';
  69. import { ElMessage } from 'element-plus';
  70. import LookLine from '../modalComp/LookLine.vue';
  71. export default {
  72. props: {
  73. startMis: {
  74. type: Object,
  75. required: true
  76. }
  77. },
  78. setup(props, { emit }) {
  79. let arrow = ref(0)
  80. let loadingMis = ref({})
  81. let stepList = ref([])
  82. let endList = ref([])//结果表格
  83. let scdIds = ref("")//当前组件scdid
  84. let lineNum = ref(0)
  85. let lineSearch = ref(false)
  86. let end = ref(true)
  87. watch(() => props.startMis, (newVal) => {
  88. loadingMis.value = newVal
  89. scdIds.value = newVal.scd_id
  90. })
  91. function misDown() {
  92. task.stopTask({ id: loadingMis.value.id }).then(res => {
  93. if (res.code == 0) {
  94. ElMessage({
  95. message: "取消成功",
  96. type: "success"
  97. })
  98. }
  99. })
  100. emit("smBack", arrow.value)
  101. }
  102. function picReload() {
  103. loadingMis.value = props.startMis
  104. scdIds.value = loadingMis.value.scd_id
  105. task.tackStart({ id: loadingMis.value.id }).then(res => {
  106. let countTime = setInterval(() => {
  107. task.lookStep({ id: loadingMis.value.id - 0 }).then(res => {
  108. if (res.data) {
  109. stepList.value = res.data
  110. } else {
  111. ElMessage({
  112. message: res.msg,
  113. type: "error"
  114. })
  115. }
  116. })
  117. }, 1000)
  118. setTimeout(() => {
  119. clearInterval(countTime)
  120. end.value = false
  121. }, 30000)
  122. })
  123. setTimeout(() => {
  124. slc.getScdByIdFromMission({
  125. scd_id: loadingMis.value.scd_id - 0,
  126. pageno: 1,
  127. pagesize: 20,
  128. }).then(res => {
  129. endList.value = res.data
  130. })
  131. }, 20000)
  132. }
  133. function backDown() {
  134. emit("smBack", arrow.value)
  135. }
  136. function levelChoose(bit) {
  137. if (bit == "error") {
  138. return '错误'
  139. } else if (bit == 'warning') {
  140. return '告警'
  141. }
  142. }
  143. function lineno(row) {
  144. lineNum.value = row.line_no
  145. lineSearch.value = true
  146. }
  147. onMounted(() => {
  148. picReload()
  149. })
  150. return {
  151. arrow,
  152. misDown,
  153. loadingMis,//传递过来的任务名称
  154. picReload,//初始化组件
  155. stepList,//步骤表
  156. endList,//结果表格
  157. levelChoose,//等级筛选
  158. end,
  159. backDown,
  160. lineno,
  161. scdIds,
  162. lineNum,
  163. lineSearch,
  164. }
  165. },
  166. components: {
  167. StepMethod,
  168. LookLine
  169. }
  170. }
  171. </script>
  172. <style scoped>
  173. p {
  174. margin: 0;
  175. padding: 0;
  176. }
  177. .bigBox {
  178. width: 98%;
  179. height: calc(100vh - 150px);
  180. /* border: 1px solid black; */
  181. display: flex;
  182. justify-content: space-around;
  183. align-items: center;
  184. }
  185. .missionBox {
  186. width: 30%;
  187. height: 100%;
  188. /* border: 1px solid purple; */
  189. text-align: center;
  190. line-height: 30px;
  191. }
  192. .stepAndEnd {
  193. width: 68%;
  194. height: 100%;
  195. /* border: 1px solid brown; */
  196. }
  197. .stepBox {
  198. width: 100%;
  199. height: calc(100vh - 530px);
  200. /* border: 1px solid red; */
  201. overflow-y: auto;
  202. background-color: #F7F8FB;
  203. }
  204. .endBox {
  205. width: 100%;
  206. height: calc(100vh - 600px);
  207. /* border: 1px solid green; */
  208. margin-top: 20px;
  209. background-color: #F7F8FB;
  210. }
  211. .nowMis {
  212. font-size: 20px;
  213. font-family: Source Han Sans CN-Bold, Source Han Sans CN;
  214. font-weight: bold;
  215. color: #1A2447;
  216. }
  217. .dateMis {
  218. font-size: 14px;
  219. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  220. font-weight: 400;
  221. color: #7484AB;
  222. }
  223. .loading1 {
  224. font-size: 16px;
  225. font-family: Source Han Sans CN-Regular, Source Han Sans CN;
  226. font-weight: 400;
  227. color: #255CE7;
  228. }</style>