custom_components.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842
  1. <template>
  2. <el-dialog v-model="isShow" width="60%" @close="closeDialog" destroy-on-close>
  3. <el-form
  4. ref="ruleFormRef"
  5. :model="form"
  6. :rules="rules"
  7. label-position="top"
  8. label-width="200px"
  9. class="custom-comp-form"
  10. >
  11. <el-row
  12. type="flex"
  13. justify="space-between"
  14. align="middle"
  15. class="first-row"
  16. :gutter="10"
  17. >
  18. <el-col :span="15" class="first-row-first-col">
  19. <el-form-item prop="name">
  20. <el-tag size="small">规则名称</el-tag>
  21. <el-input v-model="form.name" />
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="9" class="first-row-second-col">
  25. <el-form-item prop="category">
  26. <el-tag size="small">报警类别</el-tag>
  27. <el-select
  28. v-model="form.category"
  29. size="mini"
  30. @change="categorychanged"
  31. >
  32. <el-option
  33. key="1"
  34. label="风机报警"
  35. value="windturbine"
  36. ></el-option>
  37. <el-option
  38. key="2"
  39. label="升压站报警"
  40. value="booststation"
  41. ></el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item prop="rank">
  45. <el-tag size="small">报警级别</el-tag>
  46. <el-select v-model="form.rank" size="mini">
  47. <el-option
  48. v-for="item in rankList"
  49. :key="item.id"
  50. :value="item.id"
  51. :label="item.name"
  52. ></el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item prop="enable">
  56. <el-tag size="small">是否启用</el-tag>
  57. <el-switch
  58. v-model="form.enable"
  59. :active-value="true"
  60. :inactive-value="false"
  61. active-color="#13ce66"
  62. />
  63. </el-form-item>
  64. </el-col>
  65. </el-row>
  66. <el-row :gutter="10" class="second-row">
  67. <el-col :span="6">
  68. <el-form-item prop="station">
  69. <el-tag size="small">{{
  70. form.category == "windturbine" ? "风场" : "电站"
  71. }}</el-tag>
  72. <el-select
  73. v-model="form.stationId"
  74. size="mini"
  75. @change="stationChange"
  76. >
  77. <el-option
  78. v-for="item in stationList"
  79. :key="item.id"
  80. :value="item.id"
  81. :label="item.name"
  82. />
  83. </el-select>
  84. </el-form-item>
  85. <el-form-item prop="modelId" v-if="form.category == 'windturbine'">
  86. <el-tag size="small">风机型号</el-tag>
  87. <el-select
  88. v-model="form.modelId"
  89. size="mini"
  90. @change="modelIdChange"
  91. >
  92. <el-option
  93. v-for="item in state.modelList"
  94. :key="item"
  95. :value="item.id"
  96. :label="item.aname"
  97. ></el-option>
  98. </el-select>
  99. </el-form-item>
  100. <el-form-item
  101. prop="relatedParts"
  102. v-if="form.category == 'windturbine'"
  103. >
  104. <el-tag size="small">所属部件</el-tag>
  105. <el-select v-model="form.relatedParts" style="width: 100%">
  106. <el-option
  107. v-for="item in state.relatedPartsList"
  108. :key="item.nemCode"
  109. :label="item.name"
  110. :value="item.nemCode"
  111. />
  112. </el-select>
  113. </el-form-item>
  114. <el-form-item prop="fault">
  115. <el-tag size="small">预警类型</el-tag>
  116. <el-select v-model="form.range" style="width: 100%">
  117. <el-option
  118. v-for="i in faultList"
  119. :key="i.nemCode"
  120. :value="i.nemCode"
  121. :label="i.name"
  122. />
  123. </el-select>
  124. </el-form-item>
  125. </el-col>
  126. <el-col :span="9">
  127. <el-form-item prop="expression">
  128. <el-tag size="small">表达式</el-tag>
  129. <el-input
  130. type="textarea"
  131. rows="14"
  132. v-model="form.expression"
  133. id="expressionInput"
  134. @keyup.z.stop="handle"
  135. />
  136. </el-form-item>
  137. </el-col>
  138. <el-col :span="9">
  139. <el-tabs type="border-card">
  140. <el-tab-pane label="AI测点">
  141. <el-input v-model="state.AIPointSearch"> </el-input>
  142. <el-table
  143. size="mini"
  144. fit
  145. :show-header="false"
  146. stripe
  147. height="204"
  148. :data="filterAIList"
  149. @row-dblclick="rowDbclick"
  150. >
  151. <el-table-column prop="uniformCode" width="120" />
  152. <el-table-column prop="name" />
  153. </el-table>
  154. </el-tab-pane>
  155. <el-tab-pane label="DI测点">
  156. <el-input v-model="state.DIPointSearch"> </el-input>
  157. <el-table
  158. size="mini"
  159. fit
  160. :show-header="false"
  161. stripe
  162. height="204"
  163. :data="filterDIList"
  164. @row-dblclick="rowDbclick"
  165. >
  166. <el-table-column prop="uniformCode" width="120" />
  167. <el-table-column prop="name" />
  168. </el-table>
  169. </el-tab-pane>
  170. <el-tab-pane label="函数">
  171. <el-table
  172. size="mini"
  173. fit
  174. :show-header="false"
  175. stripe
  176. height="204"
  177. :data="func"
  178. @row-dblclick="tabFuncRowClickHandle"
  179. >
  180. <el-table-column min-width="60%">
  181. <template #default="scope">
  182. <el-popover trigger="hover" placement="bottom">
  183. <p>描述:{{ scope.row.describe }}</p>
  184. <p>参数:{{ scope.row.param }}</p>
  185. <template #reference>
  186. <span size="medium" transition="fade-in-linear">{{
  187. scope.row.lab
  188. }}</span>
  189. </template>
  190. </el-popover>
  191. </template>
  192. </el-table-column>
  193. <el-table-column min-width="40%">
  194. <template #default="scope">
  195. <el-popover trigger="hover" placement="bottom">
  196. <p>描述:{{ scope.row.describe }}</p>
  197. <p>参数:{{ scope.row.param }}</p>
  198. <template #reference>
  199. <span size="medium" transition="fade-in-linear">{{
  200. scope.row.name
  201. }}</span>
  202. </template>
  203. </el-popover>
  204. </template>
  205. </el-table-column>
  206. </el-table>
  207. </el-tab-pane>
  208. <el-tab-pane label="运算符">
  209. <div class="operator">
  210. <el-button
  211. v-for="item in operator"
  212. :key="item"
  213. size="mini"
  214. class="buttons"
  215. @click="elInputSplit(item)"
  216. >
  217. {{ item }}
  218. </el-button>
  219. </div>
  220. </el-tab-pane>
  221. </el-tabs>
  222. </el-col>
  223. </el-row>
  224. <el-row :gutter="24">
  225. <el-col :span="24">
  226. <el-form-item prop="description">
  227. <el-tag size="small">规则描述</el-tag>
  228. <el-input
  229. type="textarea"
  230. rows="4"
  231. v-model="form.description"
  232. id="descriptionInput"
  233. />
  234. </el-form-item>
  235. </el-col>
  236. </el-row>
  237. </el-form>
  238. <template #footer>
  239. <span class="footerButton">
  240. <el-button round size="mini" @click="closeDialog">取 消</el-button>
  241. <el-button round size="mini" @click="submitForm(ruleFormRef)"
  242. >确 定</el-button
  243. >
  244. </span>
  245. </template>
  246. </el-dialog>
  247. </template>
  248. <script setup>
  249. import {
  250. ref,
  251. onMounted,
  252. reactive,
  253. computed,
  254. watch,
  255. nextTick,
  256. defineEmits,
  257. defineProps,
  258. } from "vue";
  259. import { ElMessageBox, ElMessage } from "element-plus";
  260. import {
  261. custombj_postSave,
  262. fetch_electrical_point_ai,
  263. fetch_electrical_point_di,
  264. getStationinfo,
  265. fetchPointList,
  266. fetchPointListByBootst,
  267. } from "@/api/zhbj/index.js";
  268. import { useStore } from "vuex";
  269. const store = useStore();
  270. const emits = defineEmits(["close"]);
  271. const props = defineProps({
  272. //是否显示
  273. isVisible: {
  274. type: Boolean,
  275. defaule: false,
  276. },
  277. //表单
  278. dialogOptions: {
  279. type: Object,
  280. },
  281. //型号接口数据
  282. modelListAll: {
  283. type: Object,
  284. },
  285. //所属部件及预警类型
  286. fetchListAll: {
  287. type: Array,
  288. },
  289. //报警级别
  290. rankList: {
  291. type: Array,
  292. },
  293. });
  294. watch(
  295. () => props.isVisible,
  296. (val, old) => {
  297. nextTick(() => {
  298. isShow.value = val;
  299. });
  300. },
  301. {
  302. deep: true,
  303. }
  304. );
  305. watch(
  306. () => props.dialogOptions,
  307. (val, old) => {
  308. nextTick(() => {
  309. form.value = val;
  310. if (val.id && val.id != "") {
  311. if (val?.stationId.includes("FDC") || val?.stationId.includes("GDC")) {
  312. getfetchPointList();
  313. } else {
  314. getfetchPointListByBootst();
  315. }
  316. }
  317. });
  318. },
  319. {
  320. deep: true,
  321. }
  322. );
  323. watch(
  324. () => props.dialogOptions?.stationId,
  325. (val, old) => {
  326. if (val && val != "") {
  327. nextTick(async () => {
  328. state.modelList = props.modelListAll[val];
  329. if (val.includes("FDC")) {
  330. state.relatedPartsList = props.fetchListAll?.fjbj;
  331. } else if (val.includes("GDC")) {
  332. state.relatedPartsList = props.fetchListAll?.gfbj;
  333. } else {
  334. state.relatedPartsList = [];
  335. }
  336. });
  337. } else {
  338. state.relatedPartsList = [];
  339. state.modelList = [];
  340. }
  341. }
  342. );
  343. const isShow = ref(false);
  344. const form = ref({
  345. id: "",
  346. category: "windturbine", //报警类别
  347. description: "", //描述
  348. name: "", //规则名称
  349. enable: true, //是否启用
  350. expression: "", //表达式
  351. range: "", //预警类型
  352. rank: "", //报警级别
  353. relatedParts: "", //所属部件
  354. stationId: "", //场站id
  355. deviceId: "",
  356. electricalId: "",
  357. lineId: "",
  358. modelId: "",
  359. projectId: "",
  360. tag: "",
  361. uniformCode: "",
  362. });
  363. const getExtraCharacters = (str1, str2) => {
  364. let result = "";
  365. if (str1 && str2) {
  366. if (str1.length < str2.length) {
  367. result = str2.slice(str1.length);
  368. } else if (str1.length > str2.length) {
  369. result = str1.slice(str2.length);
  370. }
  371. }
  372. return result;
  373. };
  374. const newVal = ref("");
  375. watch(
  376. () => form.value.expression,
  377. (val, old) => {
  378. console.log(val, old);
  379. let a = getExtraCharacters(val, old);
  380. newVal.value = a;
  381. },
  382. {
  383. immediate: true,
  384. }
  385. );
  386. // 场站列表/升压站列表
  387. const stationList = computed(() => {
  388. if (form.value.category == "windturbine") {
  389. return store.state.stationListAll;
  390. } else {
  391. return store.state.booststationList;
  392. }
  393. });
  394. const toEmits = () => {
  395. emits("close"); // 向父组件传递数据
  396. };
  397. const state = reactive({
  398. modelList: [], //型号列表
  399. relatedPartsList: [], //部件列表
  400. AIPointList: [],
  401. DIPointList: [],
  402. AIPointSearch: "",
  403. DIPointSearch: "",
  404. });
  405. const operator = [
  406. "+",
  407. "-",
  408. "*",
  409. "/",
  410. "(",
  411. ")",
  412. ">",
  413. ">=",
  414. "<",
  415. "<=",
  416. "==",
  417. "!=",
  418. "&&",
  419. "||",
  420. "!",
  421. "%",
  422. "true",
  423. "false",
  424. ".",
  425. ];
  426. const func = [
  427. {
  428. lab: "MR",
  429. name: "移动极差",
  430. param: "测点名,时间(秒)",
  431. describe: "是指两个或多个连续样本值中最大值与最小值之差",
  432. scene: "测点的移动极差超限报警",
  433. },
  434. {
  435. lab: "MAR",
  436. name: "均值极差",
  437. param: "测点名,时间(秒)",
  438. describe: "",
  439. scene: "测点的均值极差计算",
  440. },
  441. {
  442. lab: "RiseExceed",
  443. name: "上升趋势",
  444. param: "测点名,时间(秒),阈值",
  445. describe: "取测点在给定的时间范围内数据上升的量是否超过阈值",
  446. scene: "测点值的上升速度过快等",
  447. },
  448. {
  449. lab: "Sustain",
  450. name: "持续时间",
  451. param: "表达式,时间(秒)",
  452. describe:
  453. "判定状态(表达式成立)持续的时间是否超过给定的时间判断状态持续的时间",
  454. scene: "",
  455. },
  456. {
  457. lab: "LastUpdateTime",
  458. name: "最近数据时间",
  459. param: "测点名",
  460. describe: "",
  461. scene: "判定离线,状态持续时间等",
  462. },
  463. {
  464. lab: "abs",
  465. name: "取绝对值",
  466. param: "double a",
  467. describe: "",
  468. scene: "",
  469. },
  470. {
  471. lab: "acos",
  472. name: "反余弦",
  473. param: "double a",
  474. describe: "",
  475. scene: "",
  476. },
  477. {
  478. lab: "asin",
  479. name: "反正弦",
  480. param: "double a",
  481. describe: "",
  482. scene: "",
  483. },
  484. {
  485. lab: "atan",
  486. name: "反正切",
  487. param: "double a",
  488. describe: "",
  489. scene: "",
  490. },
  491. {
  492. lab: "atan2",
  493. name: "xy坐标转为极坐标",
  494. param: "x,y",
  495. describe: "",
  496. scene: "",
  497. },
  498. {
  499. lab: "ceiling",
  500. name: "向上取整",
  501. param: "double a",
  502. describe: "",
  503. scene: "",
  504. },
  505. {
  506. lab: "cos",
  507. name: "余弦",
  508. param: "double a",
  509. describe: "",
  510. scene: "",
  511. },
  512. {
  513. lab: "cosh",
  514. name: "双曲线余弦",
  515. param: "double a",
  516. describe: "",
  517. scene: "",
  518. },
  519. {
  520. lab: "exp",
  521. name: "欧拉数 e 的 double 次幂的值",
  522. param: "double a",
  523. describe: "",
  524. scene: "",
  525. },
  526. {
  527. lab: "floor",
  528. name: "向下取整",
  529. param: "double a",
  530. describe: "",
  531. scene: "",
  532. },
  533. {
  534. lab: "log",
  535. name: "自然对数",
  536. param: "double a",
  537. describe: "",
  538. scene: "",
  539. },
  540. {
  541. lab: "log10",
  542. name: "底数为 10 的对数",
  543. param: "double a",
  544. describe: "",
  545. scene: "",
  546. },
  547. {
  548. lab: "max",
  549. name: "比较最大值",
  550. param: "double a, double b",
  551. describe: "",
  552. scene: "",
  553. },
  554. {
  555. lab: "min",
  556. name: "比较最小值",
  557. param: "double a, double b",
  558. describe: "",
  559. scene: "",
  560. },
  561. {
  562. lab: "pow",
  563. name: "返回第一个参数的第二个参数次幂的值",
  564. param: "double a, double b",
  565. describe: "",
  566. scene: "",
  567. },
  568. {
  569. lab: "round",
  570. name: "返回最接近参数的 long,或int",
  571. param: "double a",
  572. describe: "",
  573. scene: "",
  574. },
  575. {
  576. lab: "sign",
  577. name: "负数返回-1.0,整数返回1.0,0返回0.0",
  578. param: "float f/double a",
  579. describe: "",
  580. scene: "",
  581. },
  582. {
  583. lab: "sin",
  584. name: "三角正弦值",
  585. param: "double a",
  586. describe: "",
  587. scene: "",
  588. },
  589. {
  590. lab: "sinh",
  591. name: "双曲线正弦",
  592. param: "double x",
  593. describe: "",
  594. scene: "",
  595. },
  596. {
  597. lab: "sqrt",
  598. name: "正平方根",
  599. param: "double a",
  600. describe: "",
  601. scene: "",
  602. },
  603. {
  604. lab: "tan",
  605. name: "正切",
  606. param: "double a",
  607. describe: "",
  608. scene: "",
  609. },
  610. {
  611. lab: "tanh",
  612. name: "双曲线正切",
  613. param: "double x",
  614. describe: "",
  615. scene: "",
  616. },
  617. { lab: "PI", name: "圆周率", param: "", describe: "", scene: "" },
  618. { lab: "E", name: "自然对数", param: "", describe: "", scene: "" },
  619. ];
  620. const faultList = computed(() => props.fetchListAll.yj); //预警类型列表
  621. const ruleFormRef = ref(null);
  622. const rules = reactive({
  623. name: [{ required: true, message: "请输入规则名称", trigger: "blur" }],
  624. category: [{ required: true, message: "请选择报警类别", trigger: "change" }],
  625. rank: [{ required: true, message: "请选择报警级别", trigger: "change" }],
  626. stationId: [{ required: true, message: "请选择风场", trigger: "change" }],
  627. expression: [
  628. { required: true, message: "表达式不能为空", trigger: ["change"] },
  629. ],
  630. });
  631. //categorychanged
  632. const categorychanged = async (val) => {
  633. form.value.stationId = "";
  634. form.value.modelId = "";
  635. form.value.expression = "";
  636. form.value.relatedParts = "";
  637. state.AIPointList = [];
  638. state.DIPointList = [];
  639. };
  640. //stationChange
  641. const stationChange = async (val) => {
  642. if (form.value.category == "windturbine") {
  643. form.value.modelId = "";
  644. state.modelList = props.modelListAll[val];
  645. } else {
  646. getfetchPointListByBootst();
  647. }
  648. };
  649. //modelIdChange
  650. const modelIdChange = async () => {
  651. getfetchPointList();
  652. };
  653. // 根据场站和型号查询测点数据
  654. const getfetchPointList = async () => {
  655. const { data } = await fetchPointList(
  656. form.value.stationId,
  657. form.value.modelId
  658. );
  659. if (Object.keys(data).length) {
  660. state.AIPointList = data.ai.sort(function (a, b) {
  661. return a.uniformCode - b.uniformCode;
  662. });
  663. state.DIPointList = data.di.sort(function (a, b) {
  664. return a.uniformCode - b.uniformCode;
  665. });
  666. }
  667. };
  668. // 根据升压站查询测点数据
  669. const getfetchPointListByBootst = async () => {
  670. const { data } = await fetchPointListByBootst(form.value.stationId);
  671. if (Object.keys(data).length) {
  672. state.AIPointList = data.ai.sort(function (a, b) {
  673. return a.uniformCode - b.uniformCode;
  674. });
  675. state.DIPointList = data.di.sort(function (a, b) {
  676. return a.uniformCode - b.uniformCode;
  677. });
  678. }
  679. };
  680. //筛选AI测点
  681. const filterAIList = computed(() =>
  682. state.AIPointList?.filter(
  683. (data) =>
  684. !state.AIPointSearch ||
  685. data.uniformCode.includes(state.AIPointSearch) ||
  686. data.name.includes(state.AIPointSearch)
  687. )
  688. );
  689. //筛选DI测点
  690. const filterDIList = computed(() =>
  691. state.DIPointList?.filter(
  692. (data) =>
  693. !state.DIPointSearch ||
  694. data.uniformCode.includes(state.DIPointSearch) ||
  695. data.name.includes(state.DIPointSearch)
  696. )
  697. );
  698. // 函数点击事件
  699. const tabFuncRowClickHandle = (row) => {
  700. let elInput = document.getElementById("expressionInput");
  701. let startPos = elInput.selectionStart; //第0个字符到选中的字符
  702. let endPos = elInput.selectionEnd; //选中字符到末尾字符
  703. if (startPos === undefined || endPos === undefined) return;
  704. let txt = elInput.value;
  705. let func;
  706. if (
  707. row.lab === "MR" ||
  708. row.lab === "MAR" ||
  709. row.lab === "RiseExceed" ||
  710. row.lab === "Sustain" ||
  711. row.lab === "LastUpdateTime"
  712. ) {
  713. func = row.lab + "()";
  714. } else if (row.lab === "PI" || row.lab === "E") {
  715. func = "Math." + row.lab;
  716. } else {
  717. func = "Math." + row.lab + "()";
  718. }
  719. // 将插值添加到选中光标位置
  720. let result = txt.substring(0, startPos) + func + txt.substring(endPos);
  721. elInput.value = result;
  722. // 重新定义光标位置
  723. elInput.focus();
  724. if (row.lab === "PI" || row.lab === "E") {
  725. elInput.selectionStart = startPos + func.length;
  726. elInput.selectionEnd = startPos + func.length;
  727. } else {
  728. elInput.selectionStart = startPos + func.length - 1;
  729. elInput.selectionEnd = startPos + func.length - 1;
  730. }
  731. form.value.expression = result; // 赋值给表单中的的字段
  732. };
  733. //rowDbclick
  734. const rowDbclick = (row) => {
  735. elInputSplit(row);
  736. };
  737. // 表达式字符串拼接
  738. const elInputSplit = async (val) => {
  739. let elInput = document.getElementById("expressionInput");
  740. let startPos = elInput.selectionStart;
  741. let endPos = elInput.selectionEnd;
  742. if (startPos === undefined || endPos === undefined) return;
  743. let txt = elInput.value;
  744. let txtSplit = val.uniformCode || val;
  745. let result = txt.substring(0, startPos) + txtSplit + txt.substring(endPos);
  746. elInput.value = result;
  747. elInput.focus();
  748. elInput.selectionStart = startPos + txtSplit.length;
  749. elInput.selectionEnd = startPos + txtSplit.length;
  750. form.value.expression = result;
  751. };
  752. const handle = (e) => {
  753. if (e.ctrlKey && e.key == "z") {
  754. form.value.expression = form.value.expression.replace(newVal.value, "");
  755. }
  756. };
  757. //提交
  758. const submitForm = async (formEl) => {
  759. if (!formEl) return;
  760. await formEl.validate((valid, fields) => {
  761. if (valid) {
  762. save();
  763. } else {
  764. console.log("error submit!", fields);
  765. }
  766. });
  767. };
  768. //保存
  769. const save = async () => {
  770. const res = await custombj_postSave(form.value);
  771. console.warn(res);
  772. if (res.code != 200) {
  773. ElMessage.error(res.msg);
  774. } else {
  775. ElMessage.success(`保存成功!`);
  776. closeDialog();
  777. }
  778. };
  779. //reset
  780. const resetForm = (formEl) => {
  781. formEl.resetFields();
  782. };
  783. //confirm关闭
  784. const handleClose = () => {
  785. ElMessageBox.confirm("确认关闭?")
  786. .then(() => {
  787. closeDialog();
  788. })
  789. .catch(() => {
  790. // catch error
  791. });
  792. };
  793. //关闭触发事件
  794. const closeDialog = () => {
  795. resetForm(ruleFormRef.value);
  796. form.value = {};
  797. state.AIPointList = [];
  798. state.DIPointList = [];
  799. toEmits();
  800. };
  801. </script>
  802. <style lang="less" scoped>
  803. .col-box {
  804. display: flex;
  805. flex-direction: column;
  806. }
  807. .select-mini {
  808. width: 120px;
  809. }
  810. .el-tabs__content {
  811. padding: 0 !important;
  812. }
  813. .el-tabs--border-card {
  814. -webkit-box-shadow: none;
  815. box-shadow: none;
  816. }
  817. .border {
  818. border: solid red 1px;
  819. }
  820. .el-table--mini td {
  821. padding: 3px 0;
  822. }
  823. .el-button-group .el-button--primary {
  824. border: none;
  825. }
  826. .el-form--label-top .el-form-item__label {
  827. padding: 0;
  828. }
  829. </style>