windturbine.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <el-card>
  3. <el-row type="flex" justify="space-between">
  4. <div class="handle-box" style="margin-bottom: 10px">
  5. <el-button
  6. type="primary"
  7. icon="el-icon-lx-add"
  8. class="handle-edit mr10"
  9. @click="handleInsert"
  10. >
  11. 新增记录
  12. </el-button>
  13. <el-button
  14. type="primary"
  15. icon="el-icon-lx-down"
  16. class="handle-edit mr10"
  17. @click="export2Excel"
  18. >
  19. 批量导出</el-button
  20. >
  21. <el-button
  22. type="primary"
  23. icon="el-icon-lx-down"
  24. class="handle-edit mr10"
  25. @click="outExe"
  26. >
  27. 模板下载</el-button
  28. >
  29. <el-upload
  30. class="handle-edit mr10"
  31. style="display: inline"
  32. action="/sharding/warning2/import"
  33. :headers="token"
  34. :show-file-list="false"
  35. :on-success="handleSuccess"
  36. :on-progress="handleProgress"
  37. :on-error="handleError"
  38. >
  39. <el-button
  40. type="primary"
  41. icon="el-icon-lx-top"
  42. @click="exportShow = true"
  43. >
  44. 批量导入</el-button
  45. >
  46. </el-upload>
  47. </div>
  48. <div style="display: flex; flex-direction: row; margin-bottom: 10px">
  49. <el-select
  50. v-if="!isStation"
  51. v-model="query.alarmType"
  52. class="mr10"
  53. style="width: 150px"
  54. popper-class="select"
  55. @change="categorychanged"
  56. >
  57. <el-option key="2" label="升压站" value="booststation"></el-option>
  58. <el-option key="1" label="风机" value="windturbine"></el-option>
  59. <el-option key="3" label="光伏" value="inverter"></el-option>
  60. </el-select>
  61. <el-select
  62. v-model="query.wpId"
  63. clearable
  64. class="mr10"
  65. style="width: 150px"
  66. :placeholder="
  67. query.alarmType == 'windturbine' ? '全部场站' : '全部升压站'
  68. "
  69. popper-class="select"
  70. @change="changeStation"
  71. >
  72. <el-option
  73. v-for="item in stationList"
  74. :key="item.id"
  75. :value="item.id"
  76. :label="item.aname"
  77. ></el-option>
  78. </el-select>
  79. <el-select
  80. v-if="query.alarmType == 'windturbine'"
  81. v-model="query.modelId"
  82. clearable
  83. class="mr10"
  84. style="width: 150px"
  85. placeholder="全部机型"
  86. popper-class="select"
  87. >
  88. <el-option
  89. v-for="item in modelList"
  90. :key="item.id"
  91. :value="item.id"
  92. :label="item.aname"
  93. ></el-option>
  94. </el-select>
  95. <el-input
  96. placeholder="请输入名称"
  97. v-model="query.name"
  98. style="width: 150px"
  99. class="mr10"
  100. clearable
  101. ></el-input>
  102. <el-button icon="el-icon-search" type="primary" @click="getData"
  103. >搜索</el-button
  104. >
  105. </div>
  106. </el-row>
  107. <el-table :data="state.tableData" :highlight-current-row="true" border>
  108. <el-table-column
  109. v-for="item in query.alarmType == 'windturbine'
  110. ? state.tableHeader
  111. : state.tableHeader1"
  112. :key="item.code"
  113. :label="item.title"
  114. align="center"
  115. :prop="item.code"
  116. show-overflow-tooltip
  117. >
  118. <template #default="scope">
  119. <span v-if="item.code == 'rank'">
  120. {{ rankConvert(scope.row.rank) }}
  121. </span>
  122. <span v-else-if="item.code == 'alarmType'">
  123. {{ alarmTypeConvert(scope.row.alarmType) }}
  124. </span>
  125. <span v-else-if="item.code == 'deviceType'">
  126. {{ alarmTypeConvert(scope.row.deviceType) }}
  127. </span>
  128. <span v-else-if="item.code == 'enable'">
  129. {{ enabledConvert(scope.row.enable) }}
  130. </span>
  131. <span v-else-if="item.code == 'characteristic'">
  132. {{ charactConvert(scope.row.characteristic) }}
  133. </span>
  134. <span v-else>
  135. {{ scope.row[item.code] }}
  136. </span>
  137. </template>
  138. </el-table-column>
  139. <!-- <el-table-column label="序列号" align="center" prop="id" />
  140. <el-table-column label="统一编码" align="center" prop="uniformCode">
  141. <template #default="scope">{{
  142. // ednaValueConvert(scope.row.ednaValue)
  143. scope.row.uniformCode
  144. }}</template>
  145. </el-table-column>
  146. <el-table-column
  147. label="名称"
  148. align="left"
  149. prop="chineseText"
  150. width="180"
  151. />
  152. <el-table-column label="停机类型" align="center" prop="characteristic" />
  153. <el-table-column label="设备型号" align="center" prop="modelId" />
  154. <el-table-column label="报警类型" align="center" prop="warningTypeId" />
  155. <el-table-column label="故障编码" align="center" prop="faultCode" />
  156. <el-table-column label="报警级别" align="center" prop="levelId">
  157. <template #default="scope">{{
  158. levelIdConvert(scope.row.levelId)
  159. }}</template>
  160. </el-table-column>
  161. <el-table-column
  162. label="报警分类"
  163. align="center"
  164. prop="warningClassIfyId"
  165. min-width="50"
  166. >
  167. <template #default="scope">{{
  168. warningClassIfyIdConvert(scope.row.warningClassIfyId)
  169. }}</template>
  170. </el-table-column>
  171. <el-table-column
  172. label="是否可以复位"
  173. align="center"
  174. prop="isreset"
  175. min-width="50"
  176. >
  177. <template #default="scope">{{
  178. isresetConvert(scope.row.isreset)
  179. }}</template>
  180. </el-table-column>
  181. <el-table-column
  182. label="是否启用"
  183. align="center"
  184. prop="display"
  185. min-width="50"
  186. >
  187. <template #default="scope">{{
  188. scope.row.enabled == 1 ? "是" : "否"
  189. }}</template>
  190. </el-table-column>
  191. <el-table-column
  192. label="关联部件"
  193. align="center"
  194. prop="relatedParts"
  195. min-width="50"
  196. >
  197. <template #default="scope">
  198. <span>{{ relatePartConvert(scope.row.relatedParts) }}</span>
  199. </template>
  200. </el-table-column> -->
  201. <el-table-column label="操作" align="center" width="100">
  202. <template #default="scope">
  203. <el-button
  204. type="primary"
  205. plain
  206. round
  207. size="mini"
  208. icon="el-icon-lx-edit"
  209. @click="handleEditClick(scope.row)"
  210. >
  211. 编辑</el-button
  212. >
  213. </template>
  214. </el-table-column>
  215. </el-table>
  216. <div class="pagination">
  217. <el-pagination
  218. background
  219. layout="total, prev, pager, next"
  220. hide-on-single-page
  221. :current-page="query.pagenum"
  222. :page-size="query.pagesize"
  223. :total="total"
  224. @current-change="handlePageChange"
  225. ></el-pagination>
  226. </div>
  227. <windturbinecomponents
  228. @close="dialogclose"
  229. :isVisible="state.visible"
  230. :form="state.form"
  231. />
  232. </el-card>
  233. </template>
  234. <script setup>
  235. import {
  236. windturbinebj_fetchTableData,
  237. getStationinfo,
  238. fetchRelatePartAndAlarmType,
  239. fetchModel,
  240. } from "/@/api/api.js";
  241. import { outExportExcel } from "/@/utils/exportExcel"; //引入文件
  242. import {
  243. ref,
  244. onMounted,
  245. provide,
  246. computed,
  247. reactive,
  248. watch,
  249. nextTick,
  250. } from "vue";
  251. import { useStore } from "vuex";
  252. import { ElMessageBox, ElMessage } from "element-plus";
  253. import windturbinecomponents from "./windturbine_components.vue";
  254. const token = { token: sessionStorage.getItem("token") };
  255. const store = useStore();
  256. onMounted(() => {
  257. getequipmentmodel_list();
  258. });
  259. const query = reactive({
  260. pagenum: 1,
  261. pagesize: 10,
  262. wpId: "",
  263. modelId: "",
  264. name: "",
  265. alarmType: "windturbine",
  266. });
  267. const state = reactive({
  268. tableData: [],
  269. modelList: [],
  270. modelListAll: {}, //型号所有列表
  271. visible: false,
  272. form: {},
  273. tableHeader: [
  274. { title: "编码", code: "id" },
  275. { title: "场站", code: "stationName", width: "100" },
  276. // { title: "设备", code: "deviceId", width: "100" },
  277. { title: "机型", code: "modelId" },
  278. { title: "部件", code: "components" },
  279. { title: "报警描述", code: "description", width: "150" },
  280. { title: "设备部件", code: "componentsName" },
  281. { title: "级别", code: "rankName" },
  282. { title: "特性", code: "characteristic" },
  283. { title: "设备类型", code: "deviceType" },
  284. { title: "报警类型", code: "alarmType" },
  285. { title: "报警类别", code: "triggerType" },
  286. { title: "是否启用", code: "enable" },
  287. { title: "是否可复位", code: "resetTableName" },
  288. ],
  289. tableHeader1: [
  290. { title: "编码", code: "id" },
  291. { title: "升压站", code: "stationName" },
  292. { title: "规则名称", code: "name" },
  293. { title: "表达式", code: "expression" },
  294. { title: "描述", code: "description" },
  295. { title: "级别", code: "rank" },
  296. { title: "类型", code: "alarmType" },
  297. { title: "是否启用", code: "enable" },
  298. ],
  299. });
  300. // 机型
  301. const getequipmentmodel_list = async () => {
  302. const { data } = await fetchModel();
  303. state.modelListAll = data;
  304. };
  305. // 场站列表/升压站列表
  306. const stationList = computed(() => {
  307. if (query.alarmType == "windturbine") {
  308. return store.state.stationListAll;
  309. } else {
  310. return store.state.booststationList;
  311. }
  312. });
  313. watch(
  314. () => stationList,
  315. (val, old) => {
  316. val.value.length &&
  317. nextTick(async () => {
  318. query.wpId = val.value[0]?.id;
  319. await getData();
  320. });
  321. },
  322. {
  323. deep: true,
  324. immediate: true,
  325. }
  326. );
  327. //型号列表
  328. const modelList = computed(() => {
  329. if (query.wpId == "") {
  330. return [];
  331. } else {
  332. return state.modelListAll[query.wpId];
  333. }
  334. });
  335. const isStation = computed(() => store.getters.isStation);
  336. let total = ref(0);
  337. const getData = async () => {
  338. const { data: res } = await windturbinebj_fetchTableData(query);
  339. res.records.forEach((ele) => {
  340. ele.rankName = getRankName(ele.rank);
  341. ele.resetTableName = ele.resetTable ? "是" : "否";
  342. });
  343. state.tableData = res.records;
  344. total.value = res.total;
  345. };
  346. const getRankName = (rank) => {
  347. if (rank === 1) {
  348. return "低级";
  349. } else if (rank === 2) {
  350. return "低中级";
  351. } else if (rank === 3) {
  352. return "中级";
  353. } else if (rank === 4) {
  354. return "中高级";
  355. } else if (rank === 5) {
  356. return "高极";
  357. }
  358. };
  359. //changeStation
  360. const changeStation = async () => {
  361. query.modelId = "";
  362. getData();
  363. };
  364. const dialogclose = () => {
  365. state.visible = false;
  366. getData();
  367. };
  368. const handleInsert = () => {
  369. state.visible = true;
  370. };
  371. const handleEditClick = (row) => {
  372. let obj = Object.assign({}, row);
  373. obj && (obj.manufacturerCode = "");
  374. state.form = obj;
  375. state.visible = true;
  376. };
  377. // 分页导航
  378. const handlePageChange = (val) => {
  379. query.pagenum = val;
  380. getData();
  381. };
  382. const tableHeader = [
  383. "id",
  384. "报警级别(ZC_BJ:运转正常;YJ_BJ:运转状态超出标准范围;GZ_BJ:非正常停止运转;WH_BJ:停机维护;XD_BJ:限电/计划停机)",
  385. "制造商(HFYG_CS:合肥阳光电源有限公司;AMS_CS:艾默生;NRJD_CS:国电南瑞吉电新能源;MGSK_CS:美国赛康;LHDL_CS:联合动力;SYHC_CS:沈阳华创)",
  386. "名称",
  387. "上一级节点",
  388. "是否有子节点",
  389. "序列号",
  390. "类别 :正常停机,正常启动,快速停机,紧急停机",
  391. "设备型号",
  392. "全部默认为1",
  393. "统一编码",
  394. "是否展示(0:是;1:否)",
  395. "报警分类(bj:变桨;bpq:变频器;clx:齿轮箱;fdj:发电机;hh:滑环;jcjr:机舱加热;lq:冷却;ph:偏航;rh:润滑;yy:液压;zz:主轴;other:其它;kz:控制;yl:叶轮;jc:机舱;xb:箱变;dw:电网;td:塔底;fsy:风速仪)",
  396. "消缺规定时间",
  397. "是否可以复位(0:是;1:否)",
  398. "报警类型编号",
  399. "故障编码",
  400. "关联部件",
  401. ];
  402. const tableKey = [
  403. "id",
  404. "levelId",
  405. "manufacturerCode",
  406. "chineseText",
  407. "parentId",
  408. "isleaf",
  409. "sequenceNumber",
  410. "characteristic",
  411. "modelId",
  412. "codeName",
  413. "ednaValue",
  414. "display",
  415. "warningClassIfyId",
  416. "standardTime",
  417. "isreset",
  418. "warningTypeId",
  419. "faultCode",
  420. "relatedParts",
  421. ];
  422. // 批量导出
  423. const export2Excel = async () => {
  424. let { name, wpId, modelId } = query;
  425. const res = await windturbinebj_fetchTableData({
  426. pagenum: 1,
  427. pagesize: 999999,
  428. name,
  429. wpId,
  430. modelId,
  431. });
  432. ElMessage.success(`导出成功!`);
  433. outExportExcel(tableHeader, tableKey, res.records, "设备报警配置导出excel");
  434. };
  435. // 模板下载
  436. const outExe = () => {
  437. const data = [];
  438. ElMessage.success(`导出成功!`);
  439. outExportExcel(tableHeader, tableKey, data, "设备报警模板");
  440. };
  441. // 批量导入
  442. const handleSuccess = (response, file, fileList) => {
  443. ElMessage.success("导入成功!");
  444. getData();
  445. };
  446. const handleProgress = (response, file, fileList) => {};
  447. const handleError = (response, file, fileList) => {
  448. ElMessage.success("导入失败!");
  449. };
  450. //级别
  451. const rankConvert = (val) => {
  452. if (val == 1) {
  453. return "低";
  454. } else if (val == 2) {
  455. return "中低";
  456. } else if (val == 3) {
  457. return "中";
  458. } else if (val == 4) {
  459. return "中高";
  460. } else if (val == 5) {
  461. return "高";
  462. }
  463. };
  464. // 类型
  465. const alarmTypeConvert = (val) => {
  466. if (val === "windturbine") {
  467. return "设备";
  468. } else if (val === "booststation") {
  469. return "升压站";
  470. }
  471. };
  472. // 状态
  473. const enabledConvert = (val) => {
  474. if (val === false) {
  475. return "停用";
  476. } else if (val === true) {
  477. return "启用";
  478. }
  479. };
  480. // 特征
  481. const charactConvert = (val) => {
  482. switch (val) {
  483. case "ZC_BJ":
  484. return "运转正常";
  485. break;
  486. case "YJ_BJ":
  487. return "运转状态超出标准范围";
  488. break;
  489. case "GZ_BJ":
  490. return "非正常停止运转";
  491. break;
  492. case "WH_BJ":
  493. return "停机维护";
  494. break;
  495. case "XD_BJ":
  496. return "限电/计划停机";
  497. break;
  498. default:
  499. return;
  500. }
  501. };
  502. // 报警分类
  503. const warningClassIfyIdConvert = (val) => {
  504. switch (val) {
  505. case "bj":
  506. return "变桨";
  507. break;
  508. case "bpq":
  509. return "变频器";
  510. break;
  511. case "clx":
  512. return "齿轮箱";
  513. break;
  514. case "fdj":
  515. return "发电机";
  516. break;
  517. case "hh":
  518. return "滑环";
  519. break;
  520. case "jcjr":
  521. return "机舱加热";
  522. break;
  523. case "lq":
  524. return "冷却";
  525. break;
  526. case "ph":
  527. return "偏航";
  528. break;
  529. case "rh":
  530. return "润滑";
  531. break;
  532. case "yy":
  533. return "液压";
  534. break;
  535. case "zz":
  536. return "主轴";
  537. break;
  538. case "other":
  539. return "其它";
  540. break;
  541. case "kz":
  542. return "控制";
  543. break;
  544. case "yl":
  545. return "叶轮";
  546. break;
  547. case "jc":
  548. return "机舱";
  549. break;
  550. case "xb":
  551. return "箱变";
  552. break;
  553. case "dw":
  554. return "电网";
  555. break;
  556. case "td":
  557. return "塔底";
  558. break;
  559. case "fsy":
  560. return "风速仪";
  561. break;
  562. }
  563. };
  564. // 是否可以复位
  565. const isresetConvert = (val) => {
  566. switch (val) {
  567. case 0:
  568. return "是";
  569. break;
  570. case 1:
  571. return "否";
  572. break;
  573. }
  574. };
  575. // 统一编码
  576. const ednaValueConvert = (val) => {
  577. if (val === 0) {
  578. return "";
  579. } else if (val < 100 && val > 0) {
  580. return "DI0" + val;
  581. } else if (val >= 100) {
  582. return "DI" + val;
  583. }
  584. };
  585. // 关联部件
  586. const relatePartConvert = (val) => {
  587. switch (val) {
  588. case "YP":
  589. return "叶片";
  590. break;
  591. case "LG":
  592. return "轮毂";
  593. break;
  594. case "TZ":
  595. return "塔架";
  596. break;
  597. case "JC":
  598. return "机舱";
  599. break;
  600. case "KZXT":
  601. return "控制系统";
  602. break;
  603. case "BJXT":
  604. return "变桨系统";
  605. break;
  606. case "PHXT":
  607. return "偏航系统";
  608. break;
  609. case "CLX":
  610. return "齿轮箱";
  611. break;
  612. case "FDJ":
  613. return "发电机";
  614. return;
  615. case "BPQ":
  616. return "变频器";
  617. return;
  618. case "YYXT":
  619. return "液压系统";
  620. break;
  621. case "FZXT":
  622. return "辅助系统";
  623. break;
  624. case "CFXT":
  625. return "测风系统";
  626. break;
  627. case "DWXT":
  628. return "电网系统";
  629. break;
  630. case "TDG":
  631. return "塔底柜";
  632. break;
  633. case "CDL":
  634. return "传动链";
  635. break;
  636. case "QT":
  637. return "其他";
  638. break;
  639. default:
  640. break;
  641. }
  642. };
  643. </script>
  644. <style scoped>
  645. .mr10 {
  646. margin-right: 10px;
  647. }
  648. .el-button + .el-button {
  649. margin-left: 10px;
  650. }
  651. </style>