Wgn.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <div class="wgn_box">
  3. <el-backtop target=".wgn_box" :right="20" :bottom="70" />
  4. <div class="server_title">
  5. <el-image
  6. style="width: 50%; height: calc(100vh - 120px)"
  7. src="static/images/wgn_title.png"
  8. fit="cover"
  9. />
  10. <div class="server_title_text">
  11. <div class="server_title_text_title">微功能服务</div>
  12. <div class="server_title_text_content">
  13. 微功能子系统专注于提供强大的空间计算与数据处理能力,是支撑青浦区三维数字底板空间分析与数据流转的核心模块,聚焦
  14. “精准计算 + 灵活处理”
  15. 两大核心能力,所有功能均以标准化服务接口形式对外提供(支持第三方委办、上层应用系统调用),同时在系统内部集成可视化操作界面,实现
  16. “计算 - 分析 - 展示” 闭环。
  17. </div>
  18. </div>
  19. </div>
  20. <div class="server_list_box">
  21. <div class="server_list_box_title">微功能列表</div>
  22. <el-affix :offset="80">
  23. <div class="server_list_box_search">
  24. <el-input
  25. v-model="searchStr"
  26. style="width: 525px; margin-left: 37px"
  27. placeholder="输入搜索关键词"
  28. class="input-with-select"
  29. clearable
  30. size="large"
  31. @change="searchServerList()"
  32. >
  33. <template #append>
  34. <el-button icon="Search" @click="searchServerList()" />
  35. </template>
  36. </el-input>
  37. </div>
  38. </el-affix>
  39. <div class="server_list_box_table" v-if="dmsServerList">
  40. <div
  41. v-for="item in dmsServerList"
  42. :key="item.c_scene_name"
  43. class="server_list_box_table_item"
  44. :id="item.c_scene_name + 'list'"
  45. >
  46. <div class="server_list_box_table_item_content">
  47. <div class="server_list_box_table_item_content_title">{{ item.title }}</div>
  48. <div class="server_list_box_table_item_content_text">{{ item.content }}</div>
  49. <div class="server_list_box_table_item_content_button_box">
  50. <div
  51. class="server_list_box_table_item_content_button_box_item"
  52. @click.stop="handleOnlineDemo(item)"
  53. >
  54. 在线演示
  55. </div>
  56. <div
  57. class="server_list_box_table_item_content_button_box_item"
  58. @click.stop="handleApply(item)"
  59. >
  60. 申请使用
  61. </div>
  62. </div>
  63. </div>
  64. <div class="server_list_box_table_item_image">
  65. <el-image
  66. style="width: 690px; height: 410px"
  67. :src="dmsDataProxy + item.c_picture"
  68. fit="cover"
  69. />
  70. </div>
  71. </div>
  72. </div>
  73. <!-- 申请使用微功能服务的表单弹窗 -->
  74. <el-dialog
  75. title="申请使用微功能服务"
  76. v-model="showFrom"
  77. width="60%"
  78. :close-on-click-modal="false"
  79. :close-on-press-escape="false"
  80. :show-close="true"
  81. >
  82. <el-form :model="column.from" :rules="rules" ref="formRef" label-width="120px">
  83. <el-form-item label="应用名称" prop="c_application_name">
  84. <el-input
  85. v-model="column.from.c_application_name"
  86. placeholder="请输入应用名称"
  87. />
  88. </el-form-item>
  89. <el-form-item label="接口路径" prop="c_interface_path">
  90. <el-input
  91. v-model="column.from.c_interface_path"
  92. disabled
  93. placeholder="请输入接口路径"
  94. />
  95. </el-form-item>
  96. <el-form-item label="联系电话" prop="c_phone">
  97. <el-input v-model="column.from.c_phone" placeholder="请输入联系电话" />
  98. </el-form-item>
  99. <el-form-item label="单位名称" prop="c_unit_name">
  100. <el-input v-model="column.from.c_unit_name" placeholder="请输入单位名称" />
  101. </el-form-item>
  102. <el-form-item label="部门名称" prop="c_department">
  103. <el-input v-model="column.from.c_department" placeholder="请输入部门名称" />
  104. </el-form-item>
  105. <!-- 项目负责人 -->
  106. <el-form-item label="项目负责人" prop="c_business_leader">
  107. <el-input
  108. v-model="column.from.c_business_leader"
  109. placeholder="请输入项目负责人"
  110. />
  111. </el-form-item>
  112. <!-- 申请使用微功能服务的详细信息 -->
  113. <el-form-item label="申请使用微功能服务的详细信息" prop="content">
  114. <el-input
  115. type="textarea"
  116. v-model="column.from.content"
  117. placeholder="请输入申请使用微功能服务的详细信息"
  118. />
  119. </el-form-item>
  120. </el-form>
  121. <template #footer>
  122. <div class="dialog-footer">
  123. <el-button @click="showFrom = false">取消</el-button>
  124. <el-button type="primary" @click="handleApplySubmit">确定</el-button>
  125. </div>
  126. </template>
  127. </el-dialog>
  128. </div>
  129. </div>
  130. </template>
  131. <script>
  132. import wgn from "@/api/wgn";
  133. import api from "@/api/content";
  134. export default {
  135. name: "微功能服务",
  136. data() {
  137. return {
  138. // 搜索关键词
  139. searchStr: "",
  140. // 微功能服务列表
  141. dmsServerList: [],
  142. // DMS数据代理地址
  143. dmsDataProxy: "",
  144. // 是否显示申请使用微功能服务的表单弹窗
  145. showFrom: false,
  146. // 申请使用微功能服务的表单验证规则
  147. rules: {
  148. c_application_name: [
  149. { required: true, message: "请输入应用名称", trigger: "blur" },
  150. ],
  151. c_interface_path: [
  152. { required: true, message: "请输入接口路径", trigger: "blur" },
  153. ],
  154. c_business_leader: [
  155. { required: true, message: "请输入项目负责人", trigger: "blur" },
  156. ],
  157. // 添加手机号正则验证
  158. c_phone: [
  159. { required: true, message: "请输入联系电话", trigger: "blur" },
  160. {
  161. validator: (rule, value, callback) => {
  162. // 手机号正则验证
  163. let phoneRegex = /^1[3456789]\d{9}$/;
  164. if (!phoneRegex.test(value)) {
  165. callback(new Error("请输入正确的手机号"));
  166. } else {
  167. callback();
  168. }
  169. },
  170. trigger: "blur",
  171. },
  172. ],
  173. c_unit_name: [{ required: true, message: "请输入单位名称", trigger: "blur" }],
  174. c_department: [{ required: true, message: "请输入部门名称", trigger: "blur" }],
  175. },
  176. // 申请使用微功能服务的表单数据
  177. column: {
  178. columnId: systemConfig.columnIds[4],
  179. modelId: systemConfig.modelIds[2],
  180. from: {
  181. // 备注:申请使用微功能服务的详细信息,非必填
  182. content: "",
  183. // 项目负责人,必填
  184. c_business_leader: "",
  185. // 应用名称,必填
  186. c_application_name: "",
  187. // 接口路径,必填
  188. c_interface_path: "",
  189. // 联系电话,必填
  190. c_phone: "",
  191. // 单位名称,必填
  192. c_unit_name: "",
  193. // 部门名称,必填
  194. c_department: "",
  195. },
  196. },
  197. // 搜索微功能服务的防抖定时器
  198. searchTimeout: null,
  199. };
  200. },
  201. mounted() {
  202. this.dmsDataProxy = systemConfig.dmsDataProxy;
  203. this.searchServerList();
  204. },
  205. methods: {
  206. // 搜索微功能服务
  207. searchServerList() {
  208. // 添加防抖功能,避免频繁搜索导致性能问题
  209. if (this.searchTimeout != null) {
  210. clearTimeout(this.searchTimeout);
  211. }
  212. this.searchTimeout = setTimeout(() => {
  213. let requestParams = {
  214. columnId: systemConfig.columnIds[5],
  215. states: 0,
  216. pageSize: 999,
  217. page: 0,
  218. };
  219. if (this.searchStr) {
  220. requestParams.search = JSON.stringify([
  221. {
  222. field: "title",
  223. searchType: 2,
  224. content: { value: "%" + this.searchStr + "%" },
  225. },
  226. ]);
  227. }
  228. // 获取微功能服务列表
  229. wgn
  230. .getDmsData(requestParams)
  231. .then((res) => {
  232. if (res.code === 200) {
  233. this.dmsServerList = res.content.data;
  234. this.$message({
  235. message: "搜索到" + this.dmsServerList.length + "条微功能服务",
  236. type: "success",
  237. });
  238. } else {
  239. this.$message({
  240. message: "搜索到0条微功能服务",
  241. type: "warning",
  242. });
  243. }
  244. })
  245. .catch((e) => {
  246. this.$message({
  247. message: "搜索微功能服务失败" + e,
  248. type: "error",
  249. });
  250. });
  251. }, 0);
  252. },
  253. // 申请使用微功能服务
  254. handleApply(item) {
  255. // 申请使用微功能服务时,先从localStorage中获取数据,填充到表单中
  256. let applyInfo = localStorage.getItem("wgnApplyInfo");
  257. if (applyInfo) {
  258. this.column.from = JSON.parse(applyInfo);
  259. }
  260. // 先打开弹窗,显示from表单,用户输入表单数据并提交
  261. this.column.from.c_interface_path = item.c_url;
  262. this.showFrom = true;
  263. },
  264. // 提交申请使用微功能服务表单
  265. handleApplySubmit() {
  266. let that = this;
  267. this.$refs.formRef.validate((valid) => {
  268. if (valid) {
  269. // 提交时把信息添加到localStorage中,下次打开弹窗时,从localStorage中获取数据,填充到表单中
  270. localStorage.setItem("wgnApplyInfo", JSON.stringify(that.column.from));
  271. // 标题:电话+时间
  272. that.column.from.title =
  273. that.column.from.c_unit_name +
  274. "_" +
  275. that.column.from.c_business_leader +
  276. "_" +
  277. that.column.from.c_phone;
  278. // 备注:申请使用微功能服务的详细信息
  279. let params = {
  280. content: JSON.stringify(that.column.from),
  281. columnId: that.column.columnId,
  282. modelId: that.column.modelId,
  283. };
  284. api.addContent(params).then((res) => {
  285. if (res.code === 200) {
  286. // 确认申请使用
  287. that.$message({
  288. message: "申请成功,请等待审核通过后工作人员专人联系,请保持电话通畅!",
  289. type: "success",
  290. });
  291. that.showFrom = false;
  292. } else {
  293. that.$message({
  294. message: "申请使用" + item.title + "失败" + res.msg,
  295. type: "error",
  296. });
  297. }
  298. });
  299. } else {
  300. // 表单验证失败,提示用户填写完整信息
  301. that.$message({
  302. message: "请填写完整信息",
  303. type: "warning",
  304. });
  305. }
  306. });
  307. },
  308. // 在线演示微功能服务
  309. handleOnlineDemo(item) {
  310. let routerPath = {};
  311. // 1. 解析目标路由(支持传参、命名路由等)
  312. if (item.c_scene_name == "view") {
  313. routerPath = {
  314. path: item.c_url,
  315. };
  316. this.$router.push(routerPath);
  317. } else {
  318. routerPath = {
  319. path: "/wgnSingle", // 微功能
  320. query: { sceneId: item.c_scene_name },
  321. };
  322. const routeData = this.$router.resolve(routerPath);
  323. // 2. 打开新窗口(_blank 表示新窗口)
  324. window.open(routeData.href, "_blank");
  325. }
  326. },
  327. },
  328. };
  329. </script>
  330. <style lang="less" scoped>
  331. .wgn_box {
  332. width: 100vw;
  333. margin: 0 auto;
  334. background-color: #08224a;
  335. }
  336. .server_title {
  337. display: flex;
  338. justify-content: center;
  339. align-items: center;
  340. }
  341. .server_title_text {
  342. width: calc(77vw - 200px);
  343. height: calc(100vh - 120px);
  344. background-color: #1c2631;
  345. color: #fff;
  346. display: flex;
  347. flex-direction: column;
  348. justify-content: center;
  349. overflow: hidden;
  350. padding: 0 100px;
  351. &_title {
  352. font-size: 64px;
  353. font-weight: bold;
  354. letter-spacing: 0.5rem;
  355. }
  356. &_content {
  357. margin-top: 77px;
  358. font-size: 22px;
  359. }
  360. }
  361. .anchor_box {
  362. background: #ffffff32;
  363. float: left;
  364. }
  365. .server_list_box {
  366. width: 100vw;
  367. background-color: rgba(0, 0, 0, 0.15);
  368. display: flex;
  369. flex-direction: column;
  370. align-items: center;
  371. color: #fff;
  372. position: relative;
  373. &_menu {
  374. position: absolute;
  375. top: 100px;
  376. left: 10px;
  377. z-index: 1;
  378. }
  379. &_title {
  380. margin: 100px 0;
  381. font-size: 35px;
  382. font-weight: bold;
  383. position: relative;
  384. &::after {
  385. content: "";
  386. position: absolute;
  387. bottom: -12px;
  388. left: 50%;
  389. transform: translateX(-50%);
  390. width: 100px;
  391. height: 4px;
  392. background-image: linear-gradient(to right, #1d88f0, #00bfff);
  393. }
  394. }
  395. &_search {
  396. // margin-top: 100px;
  397. font-size: 25px;
  398. display: flex;
  399. flex-wrap: nowrap;
  400. align-items: center;
  401. width: -webkit-fill-available;
  402. justify-content: center;
  403. .input-with-select {
  404. background: #08224a;
  405. }
  406. }
  407. &_table {
  408. margin-top: 50px;
  409. width: 100vw;
  410. &_item {
  411. display: flex;
  412. justify-content: space-evenly;
  413. align-items: center;
  414. padding: 100px 0;
  415. &:nth-child(odd) {
  416. flex-direction: row;
  417. }
  418. &:nth-child(even) {
  419. flex-direction: row-reverse;
  420. }
  421. &_content {
  422. width: 760px;
  423. height: 100px;
  424. display: flex;
  425. flex-direction: column;
  426. justify-content: center;
  427. align-items: center;
  428. &_title {
  429. font-size: 35px;
  430. font-weight: bold;
  431. color: #4095e5;
  432. }
  433. &_text {
  434. margin-top: 35px;
  435. font-size: 18px;
  436. }
  437. &_button_box {
  438. display: flex;
  439. justify-content: space-evenly;
  440. width: 100%;
  441. &_item {
  442. margin-top: 35px;
  443. font-size: 20px;
  444. letter-spacing: 0.2rem;
  445. color: #4095e5;
  446. border: 1px solid #4095e5;
  447. border-radius: 10px;
  448. padding: 10px 36px;
  449. cursor: pointer;
  450. &:hover {
  451. background-color: #4095e5;
  452. color: #fff;
  453. }
  454. }
  455. }
  456. }
  457. &_image {
  458. width: 690px;
  459. display: flex;
  460. justify-content: center;
  461. align-items: center;
  462. border-radius: 30px;
  463. overflow: hidden;
  464. }
  465. }
  466. }
  467. }
  468. </style>