index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="机号" prop="aircraftNumber">
  5. <el-input v-model="queryParams.aircraftNumber" placeholder="请输入机号" clearable
  6. @keyup.enter.native="handleQuery" />
  7. </el-form-item>
  8. <el-form-item label="架次号" prop="sortieNumber">
  9. <el-input v-model="queryParams.sortieNumber" placeholder="请输入架次号" clearable @keyup.enter.native="handleQuery" />
  10. </el-form-item>
  11. <el-form-item>
  12. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  13. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  14. </el-form-item>
  15. </el-form>
  16. <el-table v-loading="loading" border :data="sortieList" @selection-change="handleSelectionChange">
  17. <el-table-column type="selection" width="55" align="center" />
  18. <el-table-column label="机号" align="center" prop="aircraftNumber" />
  19. <el-table-column label="架次号" align="center" prop="sortieNumber" />
  20. <el-table-column label="开始时间" align="center" width="180">
  21. <template slot-scope="scope">
  22. <span>{{
  23. parseTime(scope.row.startTime, "{y}-{m}-{d} {h}:{i}:{s}")
  24. }}</span>
  25. </template>
  26. </el-table-column>
  27. <el-table-column label="结束时间" align="center" width="180">
  28. <template slot-scope="scope">
  29. <span>{{
  30. parseTime(scope.row.endTime, "{y}-{m}-{d} {h}:{i}:{s}")
  31. }}</span>
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="飞行时长" align="center" prop="duration" />
  35. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  36. <template slot-scope="scope">
  37. <el-button type="text" size="mini" @click="handle(scope.row)"
  38. v-hasPermi="['manage:preHandleResult:edit']">数据处理</el-button>
  39. </template>
  40. </el-table-column>
  41. </el-table>
  42. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  43. @pagination="getList" />
  44. <el-dialog :title="title" :visible.sync="open" :close-on-click-modal="false" width="800px" append-to-body>
  45. <div style="max-height: 380px; overflow-y: auto; overflow-x: hidden;">
  46. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  47. <el-form-item label="诊断类型">
  48. <el-checkbox-group v-model="checkList" :min="1">
  49. <el-checkbox label="1">异常值剔除</el-checkbox>
  50. <el-checkbox label="2">缺失值处理</el-checkbox>
  51. </el-checkbox-group>
  52. </el-form-item>
  53. <el-row :gutter="20">
  54. <el-col :span="10">
  55. <el-form-item label="机号" prop="aircraftNumber">
  56. <el-input v-model="form.aircraftNumber" placeholder="请输入机号" disabled />
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="10">
  60. <el-form-item label="架次号" prop="sortieNumber">
  61. <el-input v-model="form.sortieNumber" placeholder="请输入架次号" disabled />
  62. </el-form-item>
  63. </el-col>
  64. </el-row>
  65. <el-form-item label="架次数据:" class="clearMargin" />
  66. <el-form-item>
  67. <el-table :data="sortieParameterAllList" style="margin-left:-30px" highlight-current-row
  68. @current-change="handleSortieData" max-height="250">
  69. <el-table-column prop="sortieNo" label="架次号" align="center" />
  70. <el-table-column prop="batchNo" label="批次号" align="center" />
  71. <el-table-column prop="type" label="数据类型" align="center">
  72. <template slot-scope="scope">
  73. <dict-tag :options="dict.type.data_type" :value="scope.row.type" />
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. </el-form-item>
  78. <el-form-item label="模型选择">
  79. <!-- <el-input v-model="form.sortieNumber" placeholder="请输入架次号" disabled/> -->
  80. <el-select v-model="selectModelVal" placeholder="请选择模型" @change="modelSelectHandel">
  81. <el-option v-for="item in modelOptions" :key="item.id" :label="item.name" :value="item">
  82. </el-option>
  83. </el-select>
  84. </el-form-item>
  85. <el-form-item label="参数选择" v-if="!(selectModelVal==='')">
  86. <el-transfer v-model="selectSortieParams" :props="{ key: 'value', label: 'desc' }" :data="parameterList"
  87. filterable filter-placeholder="请输入参数名称" :titles="['所有参数', '展示参数']">
  88. </el-transfer>
  89. </el-form-item>
  90. </el-form>
  91. </div>
  92. <div slot="footer" class="dialog-footer">
  93. <el-button type="primary" @click="submitForm" :disabled="selectModelVal===''">确 定</el-button>
  94. <el-button @click="cancel">取 消</el-button>
  95. </div>
  96. </el-dialog>
  97. <!-- 进度条 -->
  98. <el-dialog :title="title" :visible.sync="dialogProgress" class="progress" width="800" :close-on-click-modal="false"
  99. append-to-body>
  100. <el-progress :text-inside="true" :stroke-width="24" :percentage="percentageVal" status="success"></el-progress>
  101. </el-dialog>
  102. <el-dialog :title="title" :visible.sync="dialogResult" width="800" :close-on-click-modal="false" append-to-body>
  103. 结果
  104. <div slot="footer" class="dialog-footer">
  105. <el-button type="primary" @click="cancel">完成</el-button>
  106. <el-button @click="cancel">取 消</el-button>
  107. </div>
  108. </el-dialog>
  109. </div>
  110. </template>
  111. <script>
  112. import {
  113. listPreHandleResult,
  114. getPreHandleResult,
  115. delPreHandleResult,
  116. addPreHandleResult,
  117. updatePreHandleResult,
  118. } from '@/api/manage/preHandleResult'
  119. import { listAnalyzeResult } from '@/api/manage/analyzeResult'
  120. import { listSortie, getSortie, getSortieParams } from '@/api/manage/sortie'
  121. import {
  122. beginModel,
  123. listSortieParameterAll,
  124. modelList,
  125. modelListAll,
  126. } from '@/api/manage/data'
  127. export default {
  128. name: 'PreHandleResult',
  129. dicts: ['data_type'],
  130. data() {
  131. return {
  132. // 按钮加载
  133. butLoading: false,
  134. // 需要预处理的源数据列表
  135. sourceDataList: [],
  136. // 当前选择的数据
  137. currentSelection: [],
  138. textarea: '0101010101010111010',
  139. handleList: [
  140. { name: '异常值剔除', value: 1 },
  141. { name: '缺失值补全', value: 2 },
  142. ],
  143. handleList2: [
  144. { name: '手动处理', value: 1 },
  145. { name: '调用异常模型', value: 2 },
  146. ],
  147. // 遮罩层
  148. loading: true,
  149. // 选中数组
  150. ids: [],
  151. // 非单个禁用
  152. single: true,
  153. // 非多个禁用
  154. multiple: true,
  155. // 显示搜索条件
  156. showSearch: true,
  157. // 总条数
  158. total: 0,
  159. // 弹出层标题
  160. title: '',
  161. // 是否显示弹出层
  162. open: false,
  163. // 查询参数
  164. queryParams: {
  165. pageNum: 1,
  166. pageSize: 10,
  167. aircraftNumber: null,
  168. sortieNumber: null,
  169. },
  170. sortieList: [],
  171. // 表单参数
  172. form: {},
  173. rules: {},
  174. checkList: ['1', '2'],
  175. // 进度条是否显示弹出框
  176. dialogProgress: false,
  177. percentageVal: 50,
  178. timer: null,
  179. // 结果弹出框
  180. dialogResult: false,
  181. modelOptions: [],
  182. selectModelVal: '',
  183. sortieParameterAllList: [],
  184. selectedSortieDataType: '',
  185. modelListAll: [],
  186. parameterList: [],
  187. selectSortieParams: [],
  188. modelId: null,
  189. batchNo: '',
  190. showFlag: '',
  191. faultPredictionResult: [],
  192. }
  193. },
  194. created() {
  195. this.getList()
  196. },
  197. watch: {
  198. checkList: {
  199. handler(newValue, oldValue) {
  200. if (newValue.length === 0) {
  201. this.FABtnText = '完成'
  202. }
  203. },
  204. deep: true,
  205. },
  206. },
  207. methods: {
  208. /** 查询架次信息列表 */
  209. getList() {
  210. this.loading = true
  211. listSortie(this.queryParams).then(response => {
  212. this.sortieList = response.rows
  213. this.total = response.total
  214. this.loading = false
  215. })
  216. },
  217. // 取消按钮
  218. cancel() {
  219. this.open = false
  220. this.reset()
  221. ;(this.checkList = ['1', '2']), (this.selectedSortieDataType = '')
  222. this.batchNo = ''
  223. },
  224. cancelSelectModel() {
  225. this.dialogSelectModel = false
  226. this.cancel()
  227. this.selectModelVal = ''
  228. this.parameterList = []
  229. this.selectSortieParams = []
  230. },
  231. // 表单重置
  232. reset() {
  233. this.form = {
  234. id: null,
  235. aircraftNumber: null,
  236. sortieNumber: null,
  237. }
  238. this.resetForm('form')
  239. },
  240. /** 搜索按钮操作 */
  241. handleQuery() {
  242. this.queryParams.pageNum = 1
  243. this.getList()
  244. },
  245. /** 重置按钮操作 */
  246. resetQuery() {
  247. this.resetForm('queryForm')
  248. this.handleQuery()
  249. },
  250. // 多选框选中数据
  251. handleSelectionChange(selection) {
  252. this.ids = selection.map(item => item.id)
  253. this.single = selection.length !== 1
  254. this.multiple = !selection.length
  255. this.currentSelection = selection
  256. },
  257. handle(row) {
  258. console.log('故障诊断', row)
  259. this.reset()
  260. const id = row.id
  261. getSortie(id).then(response => {
  262. this.form = response.data
  263. this.open = true
  264. this.title = '故障诊断信息'
  265. })
  266. listSortieParameterAll({ sortieNo: row.sortieNumber }).then(response => {
  267. this.sortieParameterAllList = response.data
  268. this.loading = false
  269. })
  270. },
  271. handleSortieData(value) {
  272. console.log('value', value)
  273. this.selectSortieId = value.id
  274. this.selectedSortieDataType = value.type
  275. this.batchNo = value.batchNo
  276. },
  277. submitForm() {
  278. if (this.selectedSortieDataType === '') {
  279. this.$message.error(`请选择架次数据`)
  280. } else {
  281. this.checkList = this.checkList.map(str => parseInt(str, 10))
  282. this.open = false
  283. this.dialogSelectModel = true
  284. if (this.checkList[0] === 1) {
  285. this.title = '请选择异常值剔除模型'
  286. // this.FABtnText = '完成'
  287. } else {
  288. this.title = '请选择缺失值补全模型'
  289. }
  290. const data = {
  291. pageNum: 1,
  292. pageSize: 10,
  293. type: this.checkList[0],
  294. }
  295. modelListAll(data).then(response => {
  296. this.modelOptions = response.data
  297. this.loading = false
  298. })
  299. }
  300. },
  301. modelSelectHandel(val) {
  302. this.parameterList = []
  303. this.selectSortieParams = []
  304. this.selectModelVal = val.name
  305. this.selectSortieParams = JSON.parse(val.dataParams)
  306. this.modelId = val.id
  307. getSortieParams(this.selectSortieId).then(response => {
  308. response.data.forEach(item => {
  309. this.parameterList.push({
  310. value: item,
  311. desc: item,
  312. })
  313. })
  314. })
  315. },
  316. back() {
  317. this.dialogSelectModel = false
  318. this.open = true
  319. this.title = '故障诊断信息'
  320. this.selectModelVal = ''
  321. this.parameterList = []
  322. this.selectSortieParams = []
  323. },
  324. begin() {
  325. this.dialogResult = false
  326. this.checkList = this.checkList.map(str => parseInt(str, 10))
  327. if (this.checkList[0] === 3) {
  328. this.falseAlarmBegin()
  329. } else if (this.checkList[0] === 4) {
  330. this.groundDiagnosisBegin()
  331. } else {
  332. this.deepIsolationBegin()
  333. }
  334. },
  335. delAbnormalBegin() {
  336. this.dialogSelectModel = false
  337. this.title = '异常值剔除模型执行中'
  338. this.dialogProgress = true
  339. const data = {
  340. modelId: this.modelId,
  341. sortieNo: this.form.sortieNumber,
  342. batchNo: this.batchNo,
  343. dataType: this.checkList[0],
  344. dataId: this.selectSortieId,
  345. dataParams: this.selectSortieParams,
  346. }
  347. console.log('data', data)
  348. if (!this.timer) {
  349. this.timer = setInterval(() => {
  350. this.percentageVal += 1
  351. if (this.percentageVal == 98) {
  352. clearInterval(this.timer)
  353. this.timer = null
  354. beginModel(data).then(response => {
  355. if (response.code === 200) {
  356. this.$message.success('执行成功')
  357. this.groundDiagnosisResultText = response.data
  358. this.percentageVal = 50
  359. this.dialogProgress = false
  360. this.dialogResult = true
  361. this.title = '异常值剔除结果'
  362. this.showFlag = this.checkList[0]
  363. this.selectModelVal = ''
  364. this.checkList.shift()
  365. } else {
  366. this.$message.error(response.msg)
  367. }
  368. })
  369. }
  370. }, 50)
  371. }
  372. },
  373. missValCompletion() {
  374. this.dialogSelectModel = false
  375. this.title = '缺失值补全模型执行中'
  376. this.dialogProgress = true
  377. const data = {
  378. modelId: this.modelId,
  379. sortieNo: this.form.sortieNumber,
  380. batchNo: this.batchNo,
  381. dataType: this.checkList[0],
  382. dataId: this.selectSortieId,
  383. dataParams: this.selectSortieParams,
  384. }
  385. console.log('data', data)
  386. if (!this.timer) {
  387. this.timer = setInterval(() => {
  388. this.percentageVal += 1
  389. if (this.percentageVal == 98) {
  390. clearInterval(this.timer)
  391. this.timer = null
  392. beginModel(data).then(response => {
  393. if (response.code === 200) {
  394. this.$message.success('执行成功')
  395. this.groundDiagnosisResultText = response.data
  396. this.percentageVal = 50
  397. this.dialogProgress = false
  398. this.dialogResult = true
  399. this.title = '缺失值补全结果'
  400. this.showFlag = this.checkList[0]
  401. this.selectModelVal = ''
  402. this.checkList.shift()
  403. } else {
  404. this.$message.error(response.msg)
  405. }
  406. })
  407. }
  408. }, 50)
  409. }
  410. },
  411. next() {
  412. if (this.FABtnText === '完成') {
  413. this.dialogResult = false
  414. this.cancelSelectModel()
  415. this.FABtnText = '下一步'
  416. } else {
  417. this.submitForm()
  418. }
  419. },
  420. },
  421. }
  422. </script>
  423. <style scoped>
  424. .progress {
  425. top: 35%;
  426. }
  427. ::v-deep .clearMargin {
  428. margin-bottom: 0;
  429. }
  430. .back {
  431. margin-left: -100px;
  432. margin-top: -25px;
  433. }
  434. </style>