AeService.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778
  1. <template>
  2. <el-row :gutter="10" class="ae-service">
  3. <el-col :span="24">
  4. <!-- <el-card class="header-card">
  5. <el-steps :active="step" finish-status="success">
  6. <el-step title="基本信息" @click.native="onStep(0)"></el-step>
  7. <el-step title="参数/返回值" @click.native="onStep(1)"></el-step>
  8. <el-step title="数据集" @click.native="onStep(2)"></el-step>
  9. </el-steps>
  10. </el-card> -->
  11. </el-col>
  12. <el-col :span="24" class="service-body">
  13. <el-card>
  14. <div class="box" v-show="step === 0">
  15. <el-form
  16. ref="formRef"
  17. :model="form"
  18. :rules="rules"
  19. label-width="120px"
  20. size="small"
  21. >
  22. <el-form-item label="服务分类" prop="cateCode">
  23. <el-cascader
  24. v-model="form.cateCode"
  25. :options="cascader.options"
  26. :props="cascader.props"
  27. :show-all-levels="false"
  28. filterable
  29. clearable
  30. />
  31. </el-form-item>
  32. <el-form-item label="服务名称" prop="name" style="width: 70%;">
  33. <div style="display: flex;width: 100%;">
  34. <el-input v-model="form.name"></el-input>
  35. <el-button @click="saveService" size="small" type="primary" plain style="margin-left: 1%;">文档模式</el-button>
  36. <el-button @click="saveService" size="small" type="warning" plain>调试模式</el-button>
  37. </div>
  38. </el-form-item>
  39. <el-form-item label="接口地址" prop="urlSuffix">
  40. <el-input v-model="form.urlSuffix">
  41. <template #prepend>
  42. <el-select v-model="form.urlPrepend" style="width: 100px">
  43. <el-option label="http://" value="http://"></el-option>
  44. <el-option label="https://" value="https://"></el-option>
  45. </el-select>
  46. </template>
  47. </el-input>
  48. </el-form-item>
  49. <!-- <el-row>
  50. <el-col :span="11">
  51. <el-form-item label="开放等级">
  52. <el-select v-model="form.openCndtn">
  53. <el-option label="申请开放" value="0"></el-option>
  54. <el-option label="登录开放" value="1"></el-option>
  55. <el-option label="完全开放" value="2"></el-option>
  56. </el-select>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="11">
  60. <el-form-item label="数据领域">
  61. <el-select v-model="form.dataField">
  62. <el-option
  63. v-for="dict in optionsDataField"
  64. :key="dict.value"
  65. :label="dict.dictLabel"
  66. :value="dict.dictCode"
  67. ></el-option>
  68. </el-select>
  69. </el-form-item>
  70. </el-col>
  71. </el-row> -->
  72. <el-row>
  73. <el-col :span="11">
  74. <el-form-item label="请求方式">
  75. <el-select v-model="form.rqtype">
  76. <el-option label="GET" value="get"></el-option>
  77. <el-option label="POST" value="post"></el-option>
  78. </el-select>
  79. </el-form-item>
  80. </el-col>
  81. <el-col :span="11">
  82. <el-form-item label="接口格式">
  83. <el-select v-model="form.type">
  84. <el-option label="RESTful" value="RESTful"></el-option>
  85. <el-option
  86. label="WebService"
  87. value="WebService"
  88. ></el-option>
  89. <el-option label="HTTP" value="HTTP"></el-option>
  90. <el-option label="WebSocket" value="WebSocket"></el-option>
  91. </el-select>
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. <el-row>
  96. <el-col :span="11">
  97. <el-form-item label="返回格式">
  98. <el-select v-model="form.rptype">
  99. <el-option label="json" value="json"></el-option>
  100. <el-option label="html" value="html"></el-option>
  101. <el-option label="xml" value="xml"></el-option>
  102. </el-select>
  103. </el-form-item>
  104. </el-col>
  105. </el-row>
  106. <!-- <el-row>
  107. <el-col :span="24">
  108. <el-form-item label="所属业务系统">
  109. <el-input v-model="form.serviceSource"></el-input>
  110. </el-form-item>
  111. </el-col>
  112. </el-row>
  113. <el-row>
  114. <el-col :span="11">
  115. <el-form-item label="所属业务部门">
  116. <el-input v-model="form.serviceDept"></el-input>
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="11">
  120. <el-form-item label="业务部门管理人">
  121. <el-input v-model="form.manageName"></el-input>
  122. </el-form-item>
  123. </el-col>
  124. </el-row>
  125. <el-row>
  126. <el-col :span="11">
  127. <el-form-item label="开发单位">
  128. <el-input v-model="form.developUnit"></el-input>
  129. </el-form-item>
  130. </el-col>
  131. <el-col :span="11">
  132. <el-form-item label="开发单位联系人">
  133. <el-input v-model="form.developContacter"></el-input>
  134. </el-form-item>
  135. </el-col>
  136. </el-row>
  137. <el-row>
  138. <el-col :span="11">
  139. <el-form-item label="运维单位">
  140. <el-input v-model="form.maintainUnit"></el-input>
  141. </el-form-item>
  142. </el-col>
  143. <el-col :span="11">
  144. <el-form-item label="运维单位联系人">
  145. <el-input v-model="form.maintainContacer"></el-input>
  146. </el-form-item>
  147. </el-col>
  148. </el-row> -->
  149. <el-form-item label="服务说明">
  150. <el-input v-model="form.intro" type="textarea"></el-input>
  151. </el-form-item>
  152. <el-form-item label="返回说明">
  153. <el-input
  154. v-model="form.rpcontent"
  155. type="textarea"
  156. :autosize="{ minRows: 4, maxRows: 8 }"
  157. ></el-input>
  158. </el-form-item>
  159. <el-row type="flex" justify="center">
  160. <el-button
  161. icon="ArrowLeft"
  162. size="small"
  163. disabled
  164. @click="forwardStep"
  165. circle
  166. ></el-button>
  167. <el-button type="primary" @click="onSubmit"> 保存</el-button>
  168. <el-button @click="exit">退出</el-button>
  169. <el-button
  170. icon="ArrowRight"
  171. size="small"
  172. @click="nextStep"
  173. circle
  174. ></el-button>
  175. </el-row>
  176. </el-form>
  177. <el-tabs v-model="activeName" type="card">
  178. <el-tab-pane label="请求参数" name="first">
  179. <p><label style="padding: 0 10px">地址</label>{{ url }}</p>
  180. <el-divider></el-divider>
  181. <service-param
  182. :srvId="srvId"
  183. :url="url"
  184. @forwardStep="forwardStep"
  185. @nextStep="nextStep"
  186. ></service-param>
  187. </el-tab-pane>
  188. <el-tab-pane label="返回值" name="second">
  189. <p><label style="padding: 0 10px">地址</label>{{ url }}</p>
  190. <el-divider></el-divider>
  191. <service-return
  192. :srvId="srvId"
  193. :url="url"
  194. @forwardStep="forwardStep"
  195. @nextStep="nextStep"
  196. ></service-return>
  197. </el-tab-pane>
  198. </el-tabs>
  199. <div class="app-container consult-list">
  200. <h3>
  201. 数据集
  202. <el-tooltip
  203. content="数据集是存放服务的数据文件,支持JSON、EXCEL格式文件。用户可下载文件获取数据。"
  204. placement="top-start"
  205. effect="light"
  206. >
  207. <i class="el-icon-question"></i>
  208. </el-tooltip>
  209. </h3>
  210. <el-divider></el-divider>
  211. <el-row type="flex" justify="space-between">
  212. <el-col :span="18">
  213. <el-form :inline="true" :model="table.query.data">
  214. <el-form-item>
  215. <el-input
  216. placeholder="数据集名称"
  217. v-model="table.query.data.title"
  218. ></el-input>
  219. </el-form-item>
  220. <el-form-item>
  221. <el-button
  222. type="primary"
  223. @click="getOpenDataList"
  224. icon="Search"
  225. size="small"
  226. >
  227. 查询
  228. </el-button>
  229. </el-form-item>
  230. </el-form>
  231. </el-col>
  232. <el-col :span="2" style="text-align: right">
  233. <el-upload
  234. ref="upload"
  235. name="file"
  236. :action="uploadUrl"
  237. :headers="headers"
  238. :before-upload="handleBeforeUpload"
  239. :on-success="handleUploadSuccess"
  240. :on-error="handleUploadError"
  241. :data="uploadData"
  242. :show-file-list="false"
  243. >
  244. <el-button size="small" type="primary">添加数据集</el-button>
  245. </el-upload>
  246. </el-col>
  247. </el-row>
  248. <el-row class="table_box">
  249. <el-table
  250. stripe
  251. :data="table.list"
  252. :height="table.height"
  253. style="width: 100%"
  254. size="small"
  255. :header-cell-style="{
  256. background: '#ebf3fb',
  257. color: '#333',
  258. padding: '4px 0',
  259. 'border-right': '1px solid #fff',
  260. }"
  261. >
  262. <el-table-column type="index" align="center" label="序号" :index="1"/>
  263. <el-table-column
  264. show-overflow-tooltip
  265. v-for="(param, index) in table.params"
  266. :key="index"
  267. header-align="center"
  268. :align="param.align ? param.align : 'center'"
  269. :width="param.width ? param.width : 'auto'"
  270. :prop="param.paramCode"
  271. :label="param.paramName"
  272. >
  273. <template #default="scope">
  274. <span v-if="param.paramCode != 'viewNum'">
  275. {{ scope.row[param.paramCode] }}
  276. </span>
  277. <span v-if="param.paramCode == 'viewNum'">
  278. <el-tag disable-transitions>
  279. {{
  280. scope.row[param.paramCode] == null
  281. ? "0"
  282. : scope.row[param.paramCode]
  283. }}
  284. </el-tag>
  285. </span>
  286. </template>
  287. </el-table-column>
  288. <el-table-column fixed="right" align="center" label="操作" width="auto">
  289. <template #default="scope">
  290. <!-- <el-button @click="handlerDoc('view', scope.row)">
  291. 预览
  292. </el-button> -->
  293. <el-button type="primary" @click="downloadFile(scope.row)">
  294. 下载
  295. </el-button>
  296. <el-button
  297. type="danger"
  298. @click="deleteServiceFile(scope.row.fileId)"
  299. >
  300. 删除
  301. </el-button>
  302. </template>
  303. </el-table-column>
  304. </el-table>
  305. <pagination
  306. v-show="table.total > 0"
  307. :total="table.total"
  308. :page.sync="table.query.pageNum"
  309. :limit.sync="table.query.pageSize"
  310. @pagination="getOpenDataList"
  311. />
  312. </el-row>
  313. <el-row type="flex" justify="center">
  314. <!-- <el-button
  315. icon="ArrowLeft"
  316. @click="forwardStep"
  317. circle
  318. ></el-button>
  319. <el-button @click="exit">退出</el-button>
  320. <el-button
  321. icon="ArrowRight"
  322. @click="nextStep"
  323. disabled
  324. circle
  325. ></el-button> -->
  326. </el-row>
  327. <a ref="downloadTools" style="display: none" href="" download=""></a>
  328. </div>
  329. </div>
  330. <div class="box" v-show="step === 1">
  331. <param-and-file
  332. ref="paramAndFile"
  333. :srvId="form.srvId"
  334. :url="form.url"
  335. @forwardStep="forwardStep"
  336. @nextStep="nextStep"
  337. ></param-and-file>
  338. </div>
  339. <div class="box" v-show="step === 2">
  340. <service-file
  341. ref="serviceFile"
  342. :srvId="form.srvId"
  343. @forwardStep="forwardStep"
  344. @nextStep="nextStep"
  345. ></service-file>
  346. </div>
  347. </el-card>
  348. </el-col>
  349. </el-row>
  350. </template>
  351. <script>
  352. import {saveServiceInfo} from "@/api/service/info";
  353. import {getCatalog} from "@/api/service/catalog";
  354. import ParamAndFile from "./paramAndFile.vue";
  355. import ServiceFile from "./serviceFile.vue";
  356. import { getDicts } from "@/api/system/dict/data";
  357. import useDictStore from '@/store/modules/dict'
  358. import ServiceParam from "./serviceParam.vue";
  359. import ServiceReturn from "./serviceReturn.vue";
  360. import {
  361. getServiceFile,
  362. updateServiceFile,
  363. deleteServiceFile,
  364. } from "@/api/service/serviceFile.js";
  365. import {getToken} from "@/utils/auth";
  366. export default {
  367. props: ["service", "serviceVisible"],
  368. components: {ParamAndFile, ServiceFile,ServiceParam, ServiceReturn},
  369. dicts: ["service_data_field"],
  370. data() {
  371. return {
  372. uploadUrl: "/pt/service/file/add",
  373. headers: {Authorization: "Bearer " + getToken()},
  374. fileSize: "100",
  375. uploadData: {},
  376. fileTypes: [
  377. "application/vnd.ms-excel",
  378. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  379. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel",
  380. "application/pdf",
  381. "text/xml, application/xml",
  382. "application/xml",
  383. "text/xml",
  384. "application/json",
  385. "text/csv",
  386. ],
  387. table: {
  388. height: window.innerHeight - 430,
  389. list: [],
  390. params: [
  391. {
  392. paramCode: "fileViewname",
  393. paramName: "数据集名称",
  394. align: "left",
  395. width: "200",
  396. },
  397. {
  398. paramCode: "fileType",
  399. paramName: "数据集类型",
  400. width: "100",
  401. },
  402. {
  403. paramCode: "fileSize",
  404. paramName: "数据集大小",
  405. width: "100",
  406. },
  407. {paramCode: "viewNum", paramName: "访问数量/次", width: "90"},
  408. {paramCode: "fileTime", paramName: "提交时间", width: "120"},
  409. ],
  410. total: 0,
  411. query: {
  412. pageNum: 1,
  413. pageSize: 20,
  414. orderBy: "",
  415. data: {
  416. name: "",
  417. },
  418. },
  419. },
  420. step: 0,
  421. type: "添加",
  422. optionsDataField:[],
  423. form: {
  424. srvId: "",
  425. cateCode: "",
  426. name: "",
  427. url: "",
  428. urlSuffix: "",
  429. urlPrepend: "http://",
  430. rqtype: "GET",
  431. rptype: "JSON",
  432. type: "RESTful",
  433. serviceSource: "",
  434. serviceDept: "",
  435. manageName: "",
  436. developUnit: "",
  437. developContacter: "",
  438. maintainUnit: "",
  439. maintainContacer: "",
  440. intro: "",
  441. dataField: "",
  442. openCndtn: "0",
  443. },
  444. cascader: {
  445. orgListUrl: "/pt/map/countNum",
  446. orgPidName: "catePcode",
  447. orgIdName: "cateCode",
  448. topValue: "0",
  449. props: {
  450. emitPath: false,
  451. checkStrictly: true,
  452. children: "children",
  453. label: "cateName",
  454. value: "cateCode",
  455. },
  456. options: [],
  457. },
  458. activeName: "first",
  459. rules: {
  460. name: [
  461. {
  462. required: true,
  463. message: "请填写信息,该属性为必填项",
  464. trigger: "blur",
  465. },
  466. ],
  467. urlSuffix: [
  468. {
  469. required: true,
  470. message: "请填写信息,该属性为必填项",
  471. trigger: "blur",
  472. },
  473. ],
  474. cateCode: [
  475. {
  476. type: "string",
  477. required: true,
  478. message: "请选择",
  479. trigger: "change",
  480. },
  481. ],
  482. },
  483. };
  484. },
  485. mounted() {
  486. this.fetchData();
  487. this.getDicts()
  488. this.getOpenDataList();
  489. },
  490. methods: {
  491. // 前进一步
  492. forwardStep() {
  493. this.$emit("forwardStep");
  494. },
  495. // 后退一步
  496. nextStep() {
  497. this.$emit("nextStep");
  498. },
  499. // 查询帮助数据集表
  500. getOpenDataList() {
  501. if (!this.srvId) {
  502. return;
  503. }
  504. getServiceFile(this.table.query, this.srvId).then((r) => {
  505. this.table.list = r.rows;
  506. this.table.total = r.total;
  507. });
  508. },
  509. // 下载文件
  510. downloadFile(file) {
  511. if (file) {
  512. this.$refs.downloadTools.href = "/doc/files" + file.path;
  513. this.$refs.downloadTools.download = file.name;
  514. this.$refs.downloadTools.click();
  515. }
  516. },
  517. // 删除文件
  518. deleteServiceFile(id) {
  519. deleteServiceFile(id)
  520. .then(() => {
  521. this.$message.success("文件删除成功");
  522. this.getOpenDataList();
  523. })
  524. .catch(() => {
  525. this.$message.error("文件删除失败");
  526. });
  527. },
  528. // 上传前校检格式和大小
  529. handleBeforeUpload(file) {
  530. if (!this.srvId) {
  531. return;
  532. }
  533. this.headers.srvId = this.srvId;
  534. this.uploadData = {srvId: this.srvId};
  535. const pattern = /\.{1}[A-Za-z]{1,}$/;
  536. let fileExt = pattern.exec(file.name);
  537. const checkType = this.fileTypes.includes(file.type);
  538. debugger;
  539. if (!checkType) {
  540. this.$message.warning(
  541. "只能上传 .xls、.xlsx、.json、.xml、.csv 格式的文件!"
  542. );
  543. return false;
  544. }
  545. if (![".xls", ".xlsx"].includes(fileExt[0].toLowerCase())) {
  546. this.$message.warning(
  547. "只能上传 .xls、.xlsx、.json、.xml、.csv 格式的文件!"
  548. );
  549. return false;
  550. }
  551. // 校检文件大小
  552. if (this.fileSize) {
  553. const isLt = file.size / 1024 / 1024 < this.fileSize;
  554. if (!isLt) {
  555. this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`);
  556. return false;
  557. }
  558. }
  559. return true;
  560. },
  561. // 上传成功后
  562. handleUploadSuccess(res, file) {
  563. this.getOpenDataList();
  564. // // 获取富文本组件实例
  565. // let quill = this.Quill;
  566. // // 如果上传成功
  567. // if (res.code == 200) {
  568. // // 获取光标所在位置
  569. // let length = quill.getSelection().index;
  570. // // 插入图片 res.url为服务器返回的图片地址
  571. // quill.insertEmbed(
  572. // length,
  573. // "image",
  574. // process.env.VUE_APP_BASE_API + res.fileName
  575. // );
  576. // // 调整光标到最后
  577. // quill.setSelection(length + 1);
  578. // } else {
  579. // this.$message.error("文件上传成功");
  580. // }
  581. },
  582. // 文件上传失败
  583. handleUploadError() {
  584. this.$message.error("文件上传失败");
  585. },
  586. // 退出
  587. exit() {
  588. this.$nextTick(() => {
  589. this.$router.replace({
  590. query: {isClose: "true"},
  591. });
  592. });
  593. },
  594. getDicts(){
  595. getDicts('service_data_field').then((r) => {
  596. for(var i =0;i<r.data.length;i++){
  597. r.data[i].dictCode = r.data[i].dictCode.toString()
  598. }
  599. this.optionsDataField = r.data
  600. });
  601. },
  602. exit() {
  603. this.$emit("close");
  604. },
  605. // 前进一步
  606. forwardStep() {
  607. if (this.step === 0) {
  608. return;
  609. }
  610. this.step--;
  611. },
  612. // 切换步数
  613. onStep(step) {
  614. if (step != 0 && !this.form.srvId) {
  615. this.$message({
  616. message: "请先添加服务",
  617. type: "warning",
  618. });
  619. return;
  620. }
  621. this.step = step;
  622. },
  623. nextStep() {
  624. console.log(this.form.srvId)
  625. if (!this.form.srvId) {
  626. this.$message({
  627. message: "请先添加服务",
  628. type: "warning",
  629. });
  630. return;
  631. }
  632. if (this.step === 2) {
  633. return;
  634. }
  635. this.step++;
  636. },
  637. // 服务提交
  638. onSubmit() {
  639. this.$refs.formRef.validate((valid) => {
  640. if (valid) {
  641. this.form.url = this.form.urlPrepend + this.form.urlSuffix;
  642. saveServiceInfo(this.form).then((r) => {
  643. this.form.srvId = r.data.srvId;
  644. this.$message({
  645. message: this.type + "成功",
  646. type: "success",
  647. });
  648. this.nextStep();
  649. this.$emit("refreshTable");
  650. });
  651. return true;
  652. }
  653. return false;
  654. });
  655. },
  656. buildTree(flatData, rootValue = '0') {
  657. // 1. 创建哈希映射和结果集
  658. const nodeMap = new Map();
  659. const tree = [];
  660. // 2. 构建初始映射(浅拷贝节点,避免污染原数据)
  661. flatData.forEach(item => {
  662. nodeMap.set(item.cateCode, { ...item, children: [] });
  663. });
  664. // 3. 构建树结构
  665. for (const [code, node] of nodeMap) {
  666. const parentCode = node.catePcode;
  667. // 根节点直接加入结果集
  668. if (parentCode === rootValue || !parentCode) {
  669. tree.push(node);
  670. continue;
  671. }
  672. // 非根节点:挂载到父节点
  673. const parent = nodeMap.get(parentCode);
  674. if (parent) {
  675. parent.children.push(node);
  676. } else {
  677. // 处理孤儿节点(可选:也可选择忽略)
  678. console.warn(`Orphan node detected: ${code}. Parent ${parentCode} not found`);
  679. }
  680. }
  681. return tree;
  682. },
  683. fetchData() {
  684. getCatalog().then((r) => {
  685. this.cascader.options = this.buildTree(
  686. r.data
  687. );
  688. console.log(this.cascader.options)
  689. });
  690. },
  691. addParam() {
  692. this.$refs.paramAndFile.addParam();
  693. },
  694. submitForm(name) {
  695. this.$refs.paramAndFile.submitForm(name);
  696. },
  697. },
  698. watch: {
  699. "$route.query.isClose": {
  700. handler(val) {
  701. if (val == "true") {
  702. this.exit();
  703. }
  704. },
  705. immediate: true,
  706. },
  707. serviceVisible: {
  708. handler(val) {
  709. if (!val) {
  710. return;
  711. }
  712. this.type = "添加";
  713. this.step = 0;
  714. this.form = {
  715. srvId: "",
  716. cateCode: "",
  717. name: "",
  718. url: "",
  719. urlSuffix: "",
  720. urlPrepend: "http://",
  721. rqtype: "GET",
  722. type: "REST",
  723. serviceSource: "",
  724. serviceDept: "",
  725. manageName: "",
  726. developUnit: "",
  727. developContacter: "",
  728. maintainUnit: "",
  729. maintainContacer: "",
  730. intro: "",
  731. dataField: "",
  732. openCndtn: "0",
  733. };
  734. if (this.service) {
  735. this.type = "修改";
  736. const httpsReg = new RegExp("https://", "i");
  737. const httpReg = new RegExp("http://", "i");
  738. this.form = this.service;
  739. if (this.form.url) {
  740. let isHas = this.form.url.match(httpsReg);
  741. if (isHas) {
  742. this.form.urlPrepend = "https://";
  743. this.form.urlSuffix = this.form.url.replace(httpsReg, "");
  744. } else {
  745. this.form.urlPrepend = "http://";
  746. this.form.urlSuffix = this.form.url.replace(httpReg, "");
  747. }
  748. }
  749. }
  750. },
  751. immediate: true,
  752. deep: true,
  753. },
  754. },
  755. };
  756. </script>
  757. <style scoped>
  758. .header-card ::v-deep.el-card__body {
  759. padding: 15px 20px;
  760. }
  761. .box {
  762. height: calc(100vh - 201px);
  763. display: inline;
  764. }
  765. </style>