run-test.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. <script setup lang="ts">
  2. import { ref } from "vue";
  3. import titHeader from "./components/tit-header.vue";
  4. import { useCommonStoreHook } from "@/store";
  5. import { getTestProjectList } from "@/api/project";
  6. import { CheckboxValueType } from "element-plus";
  7. import {
  8. searchExcutingInstrumentConfig,
  9. searchTestMachineConfig,
  10. searhTestType,
  11. } from "@/api/project/excute";
  12. const { currentExecutionId } = toRefs(useCommonStoreHook());
  13. interface VersionItem {
  14. instrumentType: string;
  15. configName: string;
  16. configIp: string;
  17. }
  18. const formLabelAlign = ref<VersionItem>({
  19. instrumentType: "",
  20. configName: "",
  21. configIp: "",
  22. zhongduan: "",
  23. });
  24. const drawer = ref(false);
  25. onMounted(() => {
  26. getTestProjectTopList();
  27. getAllTestTypes();
  28. getExcutingMachines();
  29. });
  30. const topProAllList = ref<any[]>([]);
  31. const topProSelectedList = ref<any[]>([]);
  32. const checkAll = ref(false);
  33. const isIndeterminate = ref(true);
  34. const handleCheckAllChange = (val: CheckboxValueType) => {
  35. topProSelectedList.value = val
  36. ? topProAllList.value.map((item) => item.id)
  37. : [];
  38. isIndeterminate.value = false;
  39. };
  40. const handletopProSelectedListChange = (value: CheckboxValueType[]) => {
  41. const checkedCount = value.length;
  42. checkAll.value = checkedCount === topProAllList.value.length;
  43. isIndeterminate.value =
  44. checkedCount > 0 && checkedCount < topProAllList.value.length;
  45. };
  46. // 获取顶部测试项目
  47. const getTestProjectTopList = () => {
  48. getTestProjectList({ engineeringId: currentExecutionId.value }).then(
  49. (result) => {
  50. topProAllList.value = result.data;
  51. topProSelectedList.value = result.data.map((item) => item.id); // 默认选中全部
  52. }
  53. );
  54. };
  55. // 顶部展示的项目 是弹窗选中的项目
  56. const topOnShowProList = computed(() => {
  57. return topProAllList.value.filter((item) =>
  58. topProSelectedList.value.includes(item.id)
  59. );
  60. });
  61. // 下面左边第一列
  62. const allTestTypes = ref<any[]>([]);
  63. const getAllTestTypes = () => {
  64. searhTestType().then((result) => {
  65. allTestTypes.value = result.data;
  66. });
  67. };
  68. // 下边第二列
  69. const excutingMachinesList = ref<any[]>([]); // 所有执行终端
  70. const getExcutingMachines = () => {
  71. searchTestMachineConfig(currentExecutionId.value).then((result) => {
  72. excutingMachinesList.value = result.data;
  73. });
  74. };
  75. const testingMachines = ref<any[]>([]); // 所有routeData里面的测试仪器
  76. const getExcutingGlobalMachines = async () => {
  77. let res = await searchExcutingInstrumentConfig(
  78. currentExecutionId.value,
  79. topProSelectedList.value
  80. );
  81. testingMachines.value = res.data;
  82. };
  83. </script>
  84. <template>
  85. <div class="runtest">
  86. <el-scrollbar>
  87. <div class="content-A">
  88. <div class="drawerbtn" @click="drawer = true">
  89. <svg-icon icon-class="project-config" />
  90. </div>
  91. <el-scrollbar height="100%">
  92. <div class="test-list">
  93. <div
  94. v-for="item in topOnShowProList"
  95. :key="item.id"
  96. class="test-list-item"
  97. :class="item === 2 ? 'active' : ''"
  98. >
  99. <!-- //后面根据状态动态修改class -->
  100. <!-- //'success',合格
  101. 'error', 失败
  102. 'progress',测试中
  103. 'wait' 未开始-->
  104. <!-- :class="['success', 'error', 'progress', 'wait']"-->
  105. <div class="body" :class="['success']">
  106. <div class="line"></div>
  107. <div class="head">合格</div>
  108. <div class="icon">
  109. <svg-icon icon-class="gougou" class="svg svg-success" />
  110. <svg-icon icon-class="chacha" class="svg svg-error" />
  111. <svg-icon icon-class="Frame" class="svg svg-progress" />
  112. </div>
  113. <div class="name">{{ item.projectName }}</div>
  114. </div>
  115. </div>
  116. </div>
  117. </el-scrollbar>
  118. </div>
  119. <div class="content-B">
  120. <div class="content-B-1">
  121. <titHeader icon-class="csgcxx" tit="测试工程信息" />
  122. <el-form
  123. label-position="top"
  124. label-width="auto"
  125. :model="formLabelAlign"
  126. ref="ruleFormRef"
  127. >
  128. <el-form-item label="产品编号" prop="instrumentType">
  129. <el-input v-model="formLabelAlign.instrumentType" />
  130. </el-form-item>
  131. <el-form-item label="测试类型" prop="configName">
  132. <el-select
  133. v-model="formLabelAlign.configName"
  134. placeholder="选择测试类型"
  135. >
  136. <el-option
  137. v-for="item in allTestTypes"
  138. :key="item.dictValue"
  139. :label="item.dictLabel"
  140. :value="item.dictValue"
  141. />
  142. </el-select>
  143. </el-form-item>
  144. <el-form-item label="测试地点" prop="configIp">
  145. <el-input v-model="formLabelAlign.configIp" />
  146. </el-form-item>
  147. </el-form>
  148. </div>
  149. <div class="content-B-2">
  150. <titHeader icon-class="zxzd-yq" tit="执行终端/仪器" />
  151. <el-form
  152. label-position="top"
  153. label-width="auto"
  154. :model="formLabelAlign"
  155. style="max-width: 600px"
  156. ref="ruleFormRef"
  157. >
  158. <el-form-item label="执行终端" prop="configName">
  159. <div class="select-div">
  160. <el-select
  161. class="select-item"
  162. v-model="formLabelAlign.zhongduan"
  163. placeholder="选择执行终端"
  164. >
  165. <el-option
  166. v-for="item in excutingMachinesList"
  167. :key="item.id"
  168. :label="item.configName"
  169. :value="item.id"
  170. />
  171. </el-select>
  172. <el-button class="test-min-btn" type="primary">
  173. <svg-icon icon-class="refresh1" />
  174. </el-button>
  175. </div>
  176. </el-form-item>
  177. </el-form>
  178. <div>
  179. <svg-icon icon-class="gougou" class="svg-success" />
  180. <span>192.168.0.109</span>
  181. </div>
  182. <div class="csyq-tit">
  183. <span>测试仪器</span>
  184. <el-button class="test-min-btn" type="primary">
  185. <svg-icon icon-class="project-config" />
  186. </el-button>
  187. </div>
  188. <div class="csyq-list">
  189. <div v-for="(item, index) in 15" :key="index" class="csyq-item">
  190. <div>
  191. <span class="item-icon">
  192. <svg-icon icon-class="gougou" class="svg-success" />
  193. </span>
  194. <span>信号源1</span>
  195. </div>
  196. <div>192.168.0.109</div>
  197. </div>
  198. </div>
  199. </div>
  200. <div class="content-B-3">
  201. <titHeader icon-class="zxgcrz" tit="执行过程日志" />
  202. <div class="content-log">
  203. 开始执行,时间14:28:32 打开电源 打开射频开关
  204. 执行增益测试,结果合格 执行杂波测试,结果合格 测试完成 电源关闭
  205. </div>
  206. </div>
  207. <div class="content-B-4">
  208. <el-button class="test-min-btn" type="primary">
  209. <svg-icon icon-class="refresh1" />
  210. </el-button>
  211. <titHeader icon-class="cssj" tit="测试数据" />
  212. <div class="cssj-row-flex">
  213. <span>序号</span>
  214. <span>数据项</span>
  215. <span>数据内容</span>
  216. </div>
  217. <div>
  218. <div class="cssj-tit">测试项目:1dB压缩点</div>
  219. <div v-for="(item, index) in 5" :key="index" class="cssj-row-flex">
  220. <span>{{ index }}</span>
  221. <span>数据项</span>
  222. <span>数据内容</span>
  223. </div>
  224. </div>
  225. </div>
  226. </div>
  227. <div class="content-C">
  228. <div class="left">
  229. <div class="test-btn progress">
  230. <svg-icon icon-class="project-config" />
  231. 全局配置
  232. </div>
  233. <div>
  234. <p><span>产品:</span><span>变频模块</span></p>
  235. <p><span>工程类型:</span><span>变频模块</span></p>
  236. </div>
  237. </div>
  238. <div class="center">
  239. <div class="center-item">
  240. <div class="center-num">10</div>
  241. <div class="center-tit">今日检测产品数量</div>
  242. </div>
  243. <div class="center-item">
  244. <div class="center-num">10</div>
  245. <div class="center-tit">历史检测产品数量</div>
  246. </div>
  247. </div>
  248. <div class="right">
  249. <div>已用时:300s</div>
  250. <div class="test-btn progress">
  251. <svg-icon icon-class="start-test" />
  252. 开始测试
  253. </div>
  254. <div class="test-btn error">
  255. <svg-icon icon-class="stop-test" />
  256. 停止测试
  257. </div>
  258. </div>
  259. </div>
  260. </el-scrollbar>
  261. <el-drawer v-model="drawer" direction="rtl" class="test-drawer">
  262. <template #header>
  263. <div class="test-drawer-header">选择测试项</div>
  264. </template>
  265. <template #default>
  266. <el-checkbox
  267. v-model="checkAll"
  268. :indeterminate="isIndeterminate"
  269. @change="handleCheckAllChange"
  270. >
  271. 全选
  272. </el-checkbox>
  273. <el-scrollbar>
  274. <el-checkbox-group
  275. v-model="topProSelectedList"
  276. @change="handletopProSelectedListChange"
  277. class="drawer-list"
  278. >
  279. <div
  280. v-for="item in topProAllList"
  281. :key="item.id"
  282. class="drawer-list-item"
  283. >
  284. <el-checkbox label="" :value="item.id" />
  285. <span>{{ item.projectName }}</span>
  286. </div>
  287. </el-checkbox-group>
  288. </el-scrollbar>
  289. </template>
  290. <template #footer>
  291. <div style="flex: auto">
  292. <el-button>取消</el-button>
  293. <el-button type="primary">保存</el-button>
  294. </div>
  295. </template>
  296. </el-drawer>
  297. </div>
  298. </template>
  299. <style scoped lang="scss">
  300. $color-success: #8fe200;
  301. $color-error: #f83c64;
  302. $color-progress: #3cbaff;
  303. .test-btn {
  304. width: 130px;
  305. height: 36px;
  306. line-height: 36px;
  307. margin: 0 auto;
  308. color: var(--hj-white-1);
  309. text-align: center;
  310. border-radius: 4px 4px 4px 4px;
  311. cursor: pointer;
  312. }
  313. .progress {
  314. background: var(--hj-bg1);
  315. }
  316. .error {
  317. background: var(--hj-bg2);
  318. }
  319. .test-min-btn {
  320. margin-left: 4px;
  321. flex: 0 0 36px;
  322. width: 36px;
  323. height: 36px;
  324. text-align: center;
  325. line-height: 36px;
  326. background: #e6f1fc;
  327. border-radius: 4px 4px 4px 4px;
  328. border: 1px solid #a3d0fd;
  329. font-size: var(--hj-fs-22);
  330. color: var(--fc-color-7);
  331. }
  332. .svg-success {
  333. color: $color-success;
  334. }
  335. .svg-error {
  336. color: $color-error;
  337. }
  338. .svg-progress {
  339. color: $color-progress;
  340. }
  341. .runtest {
  342. position: absolute;
  343. top: 0;
  344. left: 0;
  345. right: 0;
  346. bottom: 0;
  347. width: 100%;
  348. height: 100%;
  349. overflow: hidden;
  350. font-size: var(--hj-fs-12);
  351. .content-A {
  352. position: relative;
  353. width: 100%;
  354. height: 300px;
  355. background: linear-gradient(180deg, #404040 0%, #505050 100%);
  356. border-radius: 0px 0px 0px 0px;
  357. :deep(.el-scrollbar__view) {
  358. height: 100%;
  359. }
  360. .drawerbtn {
  361. position: absolute;
  362. z-index: 10;
  363. right: 10px;
  364. top: 10px;
  365. width: 36px;
  366. height: 36px;
  367. font-size: var(--hj-fs-22);
  368. color: var(--hj-white-1);
  369. cursor: pointer;
  370. }
  371. .test-list {
  372. display: flex;
  373. justify-content: center;
  374. height: 100%;
  375. }
  376. .test-list-item {
  377. flex-shrink: 0;
  378. display: flex;
  379. align-items: center;
  380. justify-content: center;
  381. width: 142px;
  382. height: 100%;
  383. text-align: center;
  384. &.active {
  385. background: linear-gradient(
  386. 180deg,
  387. rgba(255, 255, 255, 0) 0%,
  388. #ffffff 100%
  389. );
  390. }
  391. .body {
  392. background: linear-gradient(180deg, #707070 0%, #515151 100%);
  393. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.5);
  394. border: 1px solid #7e7e7e;
  395. border-radius: 5px;
  396. margin: auto;
  397. width: 108px;
  398. height: 240px;
  399. color: var(--hj-white-1);
  400. cursor: pointer;
  401. .line {
  402. width: 100%;
  403. height: 6px;
  404. border-radius: 5px 5px 0px 0px;
  405. }
  406. .head {
  407. margin: 0 14px;
  408. color: var(--fc-color-8);
  409. padding: 7px 0;
  410. border-bottom: 1px solid #a8a8a8;
  411. }
  412. .icon {
  413. margin: 0 auto;
  414. width: 36px;
  415. height: 36px;
  416. margin-top: 50px;
  417. margin-bottom: 50px;
  418. font-size: var(--hj-fs-32);
  419. .svg {
  420. display: none;
  421. }
  422. }
  423. .name {
  424. font-weight: bold;
  425. font-size: var(--hj-fs-14);
  426. }
  427. }
  428. .body.success {
  429. .line {
  430. background-color: #8fe200;
  431. }
  432. .svg-success {
  433. display: block;
  434. }
  435. }
  436. .body.error {
  437. .line {
  438. background-color: #f83c64;
  439. }
  440. .svg-error {
  441. display: block;
  442. }
  443. }
  444. .body.progress {
  445. .line {
  446. background-color: #3cbaff;
  447. }
  448. .svg-progress {
  449. display: block;
  450. }
  451. }
  452. .body.wait {
  453. .line {
  454. background-color: #ededed;
  455. }
  456. }
  457. }
  458. }
  459. .content-B {
  460. width: 100%;
  461. min-height: 300px;
  462. background-color: var(--hj-bg);
  463. margin-bottom: 70px;
  464. display: flex;
  465. .content-B {
  466. &-1,
  467. &-2,
  468. &-3,
  469. &-4 {
  470. margin-top: 30px;
  471. padding: 0 18px;
  472. border-left: 1px solid #afb9d0;
  473. }
  474. &-1 {
  475. border-left: none;
  476. }
  477. }
  478. .content-B-1 {
  479. flex: 0 0 19%;
  480. }
  481. .content-B-2 {
  482. flex: 0 0 22%;
  483. .select-div {
  484. display: flex;
  485. width: 100%;
  486. .select-item {
  487. flex: 1;
  488. }
  489. }
  490. .csyq-tit {
  491. display: flex;
  492. justify-content: space-between;
  493. height: 36px;
  494. line-height: 36px;
  495. font-size: var(--hj-fs-14);
  496. font-weight: bold;
  497. color: var(--fc-color-5);
  498. }
  499. .csyq-list {
  500. .csyq-item {
  501. font-size: var(--hj-fs-12);
  502. display: flex;
  503. justify-content: space-between;
  504. height: 30px;
  505. line-height: 30px;
  506. border-bottom: 1px solid var(--fc-color-5);
  507. .item-icon {
  508. font-size: var(--hj-fs-22);
  509. margin-right: 8px;
  510. }
  511. }
  512. }
  513. }
  514. .content-B-3 {
  515. flex: 0 0 19%;
  516. .content-log {
  517. font-weight: 400;
  518. font-size: var(--hj-fs-12);
  519. color: var(--fc-color-5);
  520. line-height: 18px;
  521. }
  522. }
  523. .content-B-4 {
  524. flex: 0 0 40%;
  525. position: relative;
  526. .test-min-btn {
  527. position: absolute;
  528. right: 20px;
  529. }
  530. .cssj-tit {
  531. height: 26px;
  532. line-height: 26px;
  533. text-align: center;
  534. font-weight: bolder;
  535. font-size: var(--hj-fs-12);
  536. color: var(--fc-color-5);
  537. }
  538. .cssj-row-flex {
  539. display: flex;
  540. height: 31px;
  541. line-height: 31px;
  542. border-bottom: 1px solid var(--fc-color-5);
  543. font-size: var(--hj-fs-14);
  544. > span:nth-of-type(1) {
  545. flex: 0 0 13%;
  546. text-align: center;
  547. }
  548. > span:nth-of-type(2) {
  549. flex: 0 0 45%;
  550. }
  551. > span:nth-of-type(3) {
  552. flex: 0 0 42%;
  553. text-align: center;
  554. }
  555. }
  556. }
  557. }
  558. .content-C {
  559. position: absolute;
  560. bottom: 0;
  561. left: 0;
  562. width: 100%;
  563. height: 64px;
  564. background: linear-gradient(180deg, #434343 0%, #4f4f4f 100%);
  565. display: flex;
  566. justify-content: space-between;
  567. .left {
  568. padding: 0 12px;
  569. display: flex;
  570. justify-content: space-between;
  571. align-items: center;
  572. p {
  573. display: block;
  574. line-height: 10px;
  575. color: var(--hj-white-1);
  576. margin-left: 15px;
  577. span {
  578. font-size: var(--hj-fs-14);
  579. &:nth-of-type(1) {
  580. font-weight: 400;
  581. }
  582. &:nth-of-type(2) {
  583. font-weight: bold;
  584. }
  585. }
  586. }
  587. }
  588. .center {
  589. display: flex;
  590. text-align: right;
  591. align-items: center;
  592. .center-item {
  593. min-width: 140px;
  594. .center-tit {
  595. font-size: var(--hj-fs-12);
  596. color: var(--hj-white-1);
  597. line-height: 16px;
  598. }
  599. .center-num {
  600. font-weight: bold;
  601. font-size: var(--hj-fs-18);
  602. color: var(--hj-white-1);
  603. line-height: 21px;
  604. border-bottom: 1px solid var(--hj-white-1);
  605. }
  606. }
  607. }
  608. .right {
  609. display: flex;
  610. align-self: center;
  611. align-content: center;
  612. align-items: center;
  613. font-size: var(--hj-fs-12);
  614. color: var(--hj-white-1);
  615. > div {
  616. margin-left: 12px;
  617. }
  618. }
  619. }
  620. :deep(.test-drawer) {
  621. background: linear-gradient(180deg, #434343 0%, #4f4f4f 100%);
  622. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.5);
  623. }
  624. .test-drawer-header {
  625. font-weight: 400;
  626. font-size: var(--hj-fs-14);
  627. color: var(--hj-white-1);
  628. line-height: 19px;
  629. text-align: left;
  630. font-style: normal;
  631. text-transform: none;
  632. }
  633. .drawer-list {
  634. font-size: var(--hj-fs-12);
  635. .drawer-list-item {
  636. height: 36px;
  637. line-height: 36px;
  638. margin-bottom: 12px;
  639. padding: 0 12px;
  640. background: linear-gradient(180deg, #656565 0%, #555555 100%);
  641. box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.25);
  642. border-radius: 4px 4px 4px 4px;
  643. color: var(--hj-white-1);
  644. }
  645. }
  646. }
  647. </style>