index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. size="small"
  7. :inline="true"
  8. v-show="showSearch"
  9. label-width="100px"
  10. >
  11. <el-form-item label="任务名称" prop="name">
  12. <el-input
  13. v-model="queryParams.name"
  14. placeholder="请输入任务名称"
  15. clearable
  16. @keyup.enter.native="handleQuery"
  17. />
  18. </el-form-item>
  19. <el-form-item label="类型" prop="type">
  20. <el-select
  21. v-model="queryParams.type"
  22. placeholder="请选择类型"
  23. clearable
  24. >
  25. <el-option
  26. v-for="dict in dict.type.biz_perf_eval_type"
  27. :key="dict.value"
  28. :label="dict.label"
  29. :value="dict.value"
  30. />
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="故障诊断算法" prop="fdAlgorithmId">
  34. <el-input
  35. v-model="queryParams.fdAlgorithmId"
  36. placeholder="请输入故障诊断算法"
  37. clearable
  38. @keyup.enter.native="handleQuery"
  39. />
  40. </el-form-item>
  41. <el-form-item label="实际标签" prop="truthLabels">
  42. <el-input
  43. v-model="queryParams.truthLabels"
  44. placeholder="请输入实际标签"
  45. clearable
  46. @keyup.enter.native="handleQuery"
  47. />
  48. </el-form-item>
  49. <el-form-item>
  50. <el-button
  51. type="primary"
  52. icon="el-icon-search"
  53. size="mini"
  54. @click="handleQuery"
  55. >搜索</el-button
  56. >
  57. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  58. >重置</el-button
  59. >
  60. </el-form-item>
  61. </el-form>
  62. <el-row :gutter="10" class="mb8">
  63. <el-col :span="1.5">
  64. <el-button
  65. type="primary"
  66. plain
  67. icon="el-icon-plus"
  68. size="mini"
  69. @click="handleAdd"
  70. v-hasPermi="['test:perf:add']"
  71. >新增</el-button
  72. >
  73. </el-col>
  74. <el-col :span="1.5">
  75. <el-button
  76. type="success"
  77. plain
  78. icon="el-icon-edit"
  79. size="mini"
  80. :disabled="single"
  81. @click="handleUpdate"
  82. v-hasPermi="['test:perf:edit']"
  83. >修改</el-button
  84. >
  85. </el-col>
  86. <el-col :span="1.5">
  87. <el-button
  88. type="danger"
  89. plain
  90. icon="el-icon-delete"
  91. size="mini"
  92. :disabled="multiple"
  93. @click="handleDelete"
  94. v-hasPermi="['test:perf:remove']"
  95. >删除</el-button
  96. >
  97. </el-col>
  98. <el-col :span="1.5">
  99. <el-button
  100. type="warning"
  101. plain
  102. icon="el-icon-download"
  103. size="mini"
  104. @click="handleExport"
  105. v-hasPermi="['test:perf:export']"
  106. >导出</el-button
  107. >
  108. </el-col>
  109. <right-toolbar
  110. :showSearch.sync="showSearch"
  111. @queryTable="getList"
  112. ></right-toolbar>
  113. </el-row>
  114. <el-table
  115. v-loading="loading"
  116. :data="perfList"
  117. @selection-change="handleSelectionChange"
  118. >
  119. <el-table-column type="selection" width="55" align="center" />
  120. <el-table-column label="序号" align="center" prop="id" />
  121. <el-table-column label="任务名称" align="center" prop="name" />
  122. <el-table-column label="类型" align="center" prop="type">
  123. <template slot-scope="scope">
  124. <dict-tag
  125. :options="dict.type.biz_perf_eval_type"
  126. :value="scope.row.type"
  127. />
  128. </template>
  129. </el-table-column>
  130. <!-- <el-table-column label="循环次数" align="center" prop="loopCount" /> -->
  131. <el-table-column
  132. label="故障诊断算法"
  133. align="center"
  134. prop="fdAlgorithmId"
  135. />
  136. <el-table-column label="实际标签" align="center" prop="truthLabels" />
  137. <el-table-column label="图片结果" align="center" prop="resultImagePath">
  138. <template slot-scope="scope">
  139. <el-image
  140. style="width: 100px; height: 100px"
  141. :src="baseUrl + scope.row.resultImagePath"
  142. :preview-src-list="baseUrl + scope.row.resultImagePath"
  143. >
  144. </el-image
  145. ></template>
  146. </el-table-column>
  147. <el-table-column label="图片结果" align="center" prop="resultFilePath">
  148. <template slot-scope="scope">
  149. <el-image
  150. style="width: 100px; height: 100px"
  151. src="@src/assets/testImage/output1.png"
  152. :preview-src-list="baseUrl + scope.row.resultFilePath"
  153. >
  154. </el-image
  155. ></template>
  156. </el-table-column>
  157. <el-table-column label="文本结果" align="center" prop="resultText" />
  158. <el-table-column
  159. label="开始时间"
  160. align="center"
  161. prop="startTime"
  162. width="180"
  163. >
  164. <template slot-scope="scope">
  165. <span>{{ parseTime(scope.row.startTime, "{y}-{m}-{d}") }}</span>
  166. </template>
  167. </el-table-column>
  168. <el-table-column
  169. label="结束时间"
  170. align="center"
  171. prop="endTime"
  172. width="180"
  173. >
  174. <template slot-scope="scope">
  175. <span>{{ parseTime(scope.row.endTime, "{y}-{m}-{d}") }}</span>
  176. </template>
  177. </el-table-column>
  178. <el-table-column
  179. label="操作"
  180. align="center"
  181. class-name="small-padding fixed-width"
  182. >
  183. <template slot-scope="scope">
  184. <el-button
  185. size="mini"
  186. type="text"
  187. icon="el-icon-video-play"
  188. @click="handleRun(scope.row)"
  189. v-hasPermi="['test:ddAlgorithm:edit']"
  190. >运行</el-button
  191. >
  192. <el-button
  193. size="mini"
  194. type="text"
  195. icon="el-icon-edit"
  196. @click="handleUpdate(scope.row)"
  197. v-hasPermi="['test:perf:edit']"
  198. >修改</el-button
  199. >
  200. <el-button
  201. size="mini"
  202. type="text"
  203. icon="el-icon-delete"
  204. @click="handleDelete(scope.row)"
  205. v-hasPermi="['test:perf:remove']"
  206. >删除</el-button
  207. >
  208. </template>
  209. </el-table-column>
  210. </el-table>
  211. <pagination
  212. v-show="total > 0"
  213. :total="total"
  214. :page.sync="queryParams.pageNum"
  215. :limit.sync="queryParams.pageSize"
  216. @pagination="getList"
  217. />
  218. <!-- 添加或修改算法性能评估对话框 -->
  219. <el-dialog
  220. v-if="open"
  221. :title="title"
  222. :visible.sync="open"
  223. width="500px"
  224. :close-on-click-modal="false"
  225. append-to-body
  226. >
  227. <perfDetail
  228. :_form="form"
  229. @submitPerfDetail="submitPerfDetail"
  230. @cancelPerfDetail="cancelPerfDetail"
  231. ></perfDetail>
  232. </el-dialog>
  233. </div>
  234. </template>
  235. <script>
  236. import {
  237. listPerf,
  238. getPerf,
  239. delPerf,
  240. addPerf,
  241. updatePerf,
  242. run,
  243. } from "@/api/test/perf";
  244. import perfDetail from "./perfDetail.vue";
  245. export default {
  246. name: "Perf",
  247. components: {
  248. perfDetail,
  249. },
  250. dicts: ["biz_perf_eval_type"],
  251. data() {
  252. return {
  253. baseUrl: process.env.VUE_APP_BASE_API,
  254. // 遮罩层
  255. loading: true,
  256. // 选中数组
  257. ids: [],
  258. // 非单个禁用
  259. single: true,
  260. // 非多个禁用
  261. multiple: true,
  262. // 显示搜索条件
  263. showSearch: true,
  264. // 总条数
  265. total: 0,
  266. // 算法性能评估表格数据
  267. perfList: [],
  268. // 弹出层标题
  269. title: "",
  270. // 是否显示弹出层
  271. open: false,
  272. // 查询参数
  273. queryParams: {
  274. pageNum: 1,
  275. pageSize: 10,
  276. name: null,
  277. type: null,
  278. fdAlgorithmId: null,
  279. truthLabels: null,
  280. },
  281. // 表单参数
  282. form: {},
  283. // 表单校验
  284. rules: {},
  285. };
  286. },
  287. created() {
  288. this.getList();
  289. },
  290. methods: {
  291. /** 查询算法性能评估列表 */
  292. getList() {
  293. this.loading = true;
  294. listPerf(this.queryParams).then((response) => {
  295. this.perfList = response.rows;
  296. this.total = response.total;
  297. this.loading = false;
  298. });
  299. },
  300. // 取消按钮
  301. cancel() {
  302. this.open = false;
  303. this.reset();
  304. },
  305. // 表单重置
  306. reset() {
  307. this.form = {
  308. id: null,
  309. name: null,
  310. type: null,
  311. loopCount: null,
  312. fdAlgorithmId: null,
  313. truthLabels: null,
  314. phyModelId: null,
  315. phyParams: null,
  316. phyDataIds: null,
  317. noseModelId: null,
  318. noseParams: null,
  319. noseDataIds: null,
  320. testModelId: null,
  321. testParams: null,
  322. testDataIds: null,
  323. resultImagePath: null,
  324. resultFilePath: null,
  325. resultText: null,
  326. remark: null,
  327. startTime: null,
  328. endTime: null,
  329. createBy: null,
  330. createTime: null,
  331. updateBy: null,
  332. updateTime: null,
  333. };
  334. this.resetForm("form");
  335. },
  336. /** 搜索按钮操作 */
  337. handleQuery() {
  338. this.queryParams.pageNum = 1;
  339. this.getList();
  340. },
  341. /** 重置按钮操作 */
  342. resetQuery() {
  343. this.resetForm("queryForm");
  344. this.handleQuery();
  345. },
  346. // 多选框选中数据
  347. handleSelectionChange(selection) {
  348. this.ids = selection.map((item) => item.id);
  349. this.single = selection.length !== 1;
  350. this.multiple = !selection.length;
  351. },
  352. /** 新增按钮操作 */
  353. handleAdd() {
  354. this.reset();
  355. this.open = true;
  356. this.title = "添加算法性能评估";
  357. },
  358. /** 修改按钮操作 */
  359. handleUpdate(row) {
  360. this.reset();
  361. const id = row.id || this.ids;
  362. getPerf(id).then((response) => {
  363. this.form = response.data;
  364. this.open = true;
  365. this.title = "修改算法性能评估";
  366. });
  367. },
  368. /** 提交按钮 */
  369. submitForm() {
  370. if (this.form.id != null) {
  371. updatePerf(this.form).then((response) => {
  372. this.$modal.msgSuccess("修改成功");
  373. this.open = false;
  374. this.getList();
  375. });
  376. } else {
  377. addPerf(this.form).then((response) => {
  378. this.$modal.msgSuccess("新增成功");
  379. this.open = false;
  380. this.getList();
  381. });
  382. }
  383. },
  384. /** 删除按钮操作 */
  385. handleDelete(row) {
  386. const ids = row.id || this.ids;
  387. this.$modal
  388. .confirm('是否确认删除算法性能评估编号为"' + ids + '"的数据项?')
  389. .then(function () {
  390. return delPerf(ids);
  391. })
  392. .then(() => {
  393. this.getList();
  394. this.$modal.msgSuccess("删除成功");
  395. })
  396. .catch(() => {});
  397. },
  398. /** 导出按钮操作 */
  399. handleExport() {
  400. this.download(
  401. "test/perf/export",
  402. {
  403. ...this.queryParams,
  404. },
  405. `perf_${new Date().getTime()}.xlsx`
  406. );
  407. },
  408. submitPerfDetail(detailForm) {
  409. console.info(detailForm);
  410. // alert("确认成功");
  411. this.form = detailForm;
  412. this.submitForm();
  413. this.open = false;
  414. },
  415. cancelPerfDetail() {
  416. this.open = false;
  417. },
  418. /** 验证*/
  419. handleRun(row) {
  420. const ids = row.id || this.ids;
  421. this.$modal
  422. .confirm("是否运行")
  423. .then(function () {
  424. return run(ids);
  425. })
  426. .then(() => {
  427. this.getList();
  428. this.$modal.msgSuccess("运行成功");
  429. })
  430. .catch(() => {});
  431. },
  432. },
  433. };
  434. </script>