index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. <template>
  2. <div class="application-management">
  3. <!-- 右侧主内容区 -->
  4. <div class="main-content">
  5. <!-- 过滤条件区域 -->
  6. <div class="filter-section">
  7. <!-- 应用范围过滤 -->
  8. <div class="filter-group">
  9. <span class="filter-title">应用范围:</span>
  10. <el-radio-group
  11. v-model="scopeFilter"
  12. size="small"
  13. @change="handleScopeFilterChange"
  14. v-for="item in buffOptions"
  15. :key="item.value"
  16. >
  17. <el-radio-button :label="item.label">{{ item.value }}</el-radio-button>
  18. <!-- <el-radio-button label="district">区级</el-radio-button>
  19. <el-radio-button label="street">街道</el-radio-button>
  20. <el-radio-button label="community">社区</el-radio-button> -->
  21. </el-radio-group>
  22. </div>
  23. <!-- 应用状态过滤 -->
  24. <div class="filter-group">
  25. <span class="filter-title">应用状态:</span>
  26. <el-radio-group
  27. v-model="statusFilter"
  28. size="small"
  29. @change="handleStatusFilterChange"
  30. v-for="item in statusOptions"
  31. :key="item.value"
  32. >
  33. <el-radio-button :label="item.label">{{ item.value }}</el-radio-button>
  34. <!-- <el-radio-button label="online">在等</el-radio-button>
  35. <el-radio-button label="offline">在建</el-radio-button>
  36. <el-radio-button label="suspended">在维</el-radio-button>
  37. <el-radio-button label="expired">停用</el-radio-button> -->
  38. </el-radio-group>
  39. </div>
  40. <!-- 应用标签过滤 -->
  41. <div class="filter-group">
  42. <span class="filter-title">应用标签:</span>
  43. <el-radio-group
  44. v-model="tagFilter"
  45. size="small"
  46. @change="handleTagFilterChange"
  47. v-for="item in tagOptions"
  48. :key="item.value"
  49. >
  50. <el-radio-button :label="item.label">{{ item.value }}</el-radio-button>
  51. <!-- <el-radio-button label="special">特色应用</el-radio-button>
  52. <el-radio-button label="code">代码平台</el-radio-button>
  53. <el-radio-button label="government">仅供演示</el-radio-button>
  54. <el-radio-button label="demo">示范应用</el-radio-button>
  55. <el-radio-button label="water">水务</el-radio-button>
  56. <el-radio-button label="test">测试</el-radio-button> -->
  57. </el-radio-group>
  58. </div>
  59. </div>
  60. <!-- 搜索栏区域 -->
  61. <div class="search-section">
  62. <el-input
  63. placeholder="请输入应用名称关键字"
  64. v-model="searchKeyword"
  65. class="search-input"
  66. clearable
  67. >
  68. <template #prepend
  69. ><el-icon><search /></el-icon
  70. ></template>
  71. </el-input>
  72. <el-button type="primary" class="search-btn" @click="handleSearchClick">搜索</el-button>
  73. <el-button class="reset-btn" @click="handleResetClick">重置</el-button>
  74. <el-button type="success" class="add-btn" @click="handleAddClick">+ 新增应用</el-button>
  75. </div>
  76. <!-- 应用列表区域 -->
  77. <div class="applications-section">
  78. <div class="section-header">
  79. <span class="total-count">共检索{{ total }}个应用</span>
  80. <div class="sort-control">
  81. <span>排序:</span>
  82. <el-select
  83. v-model="sortByValue"
  84. size="small"
  85. style="width: 120px"
  86. @change="handleSortChange"
  87. >
  88. <el-option label="上架时间(升序)" value="1"></el-option>
  89. <el-option label="上架时间(降序)" value="2"></el-option>
  90. </el-select>
  91. </div>
  92. </div>
  93. <!-- 应用列表 -->
  94. <div class="applications-list">
  95. <div class="application-item" v-for="(app, index) in applications" :key="index">
  96. <div class="app-info">
  97. <div class="app-logo">
  98. <img :src="curUrl + app.c_picture" :alt="app.title" />
  99. </div>
  100. <div class="app-details">
  101. <div class="app-header">
  102. <h3 class="app-name">{{ app.title }}</h3>
  103. <span class="app-version">{{ app.version }}</span>
  104. </div>
  105. <div class="app-tags">
  106. <!-- <el-tag size="small" type="primary" v-if="app.isPublic">区属应用</el-tag> -->
  107. <!-- <el-tag size="small" v-if="app.tag">{{ app.tag }}</el-tag> -->
  108. <el-tag size="small" v-for="tag in app.tags" :key="tag">{{ tag }}</el-tag>
  109. </div>
  110. </div>
  111. </div>
  112. <div class="app-metrics">
  113. <div class="metric-item">
  114. <span class="metric-label">应用范围</span>
  115. <span class="metric-value">{{ app.buffName }}</span>
  116. </div>
  117. <div class="metric-item">
  118. <span class="metric-label">应用状态</span>
  119. <span class="metric-value" :class="`status-${app.appstauts}`">{{
  120. app.appstautName
  121. }}</span>
  122. </div>
  123. <div class="metric-item">
  124. <span class="metric-label">使用单位</span>
  125. <span class="metric-value">{{ app.sydw }}</span>
  126. </div>
  127. <div class="metric-item">
  128. <span class="metric-label">所属部门</span>
  129. <span class="metric-value">{{ app.ssbm }}</span>
  130. </div>
  131. <div class="metric-item">
  132. <span class="metric-label">负责人</span>
  133. <span class="metric-value">{{ app.ywfzr }}</span>
  134. </div>
  135. <div class="metric-item">
  136. <span class="metric-label">联系方式</span>
  137. <span class="metric-value">{{ app.phone }}</span>
  138. </div>
  139. <div class="metric-item">
  140. <span class="metric-label">创建时间</span>
  141. <span class="metric-value">{{ app.createTime }}</span>
  142. </div>
  143. <div class="metric-item">
  144. <span class="metric-label">上架时间</span>
  145. <span class="metric-value">{{ app.frameTime }}</span>
  146. </div>
  147. </div>
  148. <div class="app-actions">
  149. <!-- <span class="app-date">{{ app.createDate }}</span> -->
  150. <el-button type="primary" size="small" class="detail-btn" @click="getContentById(app)"
  151. >查看详情</el-button
  152. >
  153. </div>
  154. </div>
  155. </div>
  156. <!-- 分页控件 -->
  157. <div class="pagination-section">
  158. <span class="total-text">共{{ total }}个应用</span>
  159. <el-pagination
  160. layout="prev, pager, next, jumper, total"
  161. :total="total"
  162. :current-page="currentPage"
  163. :page-size="pageSize"
  164. @current-change="handleCurrentChange"
  165. >
  166. </el-pagination>
  167. </div>
  168. </div>
  169. <editManage
  170. v-if="isContentShow"
  171. :isShow="isContentShow"
  172. :column-model="columnModel"
  173. :column="columnData"
  174. :item="contentItem"
  175. :is-view="isContentView"
  176. :close="handleEditClose"
  177. ></editManage>
  178. </div>
  179. </div>
  180. </template>
  181. <script>
  182. import { defineAsyncComponent } from "vue";
  183. import appCenter from "@/api/appCenter";
  184. import moment from "moment";
  185. export default {
  186. name: "ApplicationManagement",
  187. components: {
  188. editManage: defineAsyncComponent(() => import("@/components/yygl/editManage.vue")),
  189. },
  190. data() {
  191. return {
  192. // 过滤条件
  193. scopeFilter: "all",
  194. statusFilter: "all",
  195. tagFilter: "all",
  196. searchKeyword: "",
  197. curUrl: systemConfig.dmsDataProxy,
  198. buffOptions: [],
  199. tagOptions: [],
  200. statusOptions: [],
  201. // 排序条件 1 升序 2 降序
  202. sortByValue: "1",
  203. modelId: systemConfig.modelIds[0], // 应用中心模型id
  204. columnId: systemConfig.columnIds[1], // 应用中心栏目id
  205. isContentShow: false,
  206. isContentView: false,
  207. columnModel: {},
  208. columnData: {
  209. title: "",
  210. },
  211. contentItem: {},
  212. // 分页信息
  213. currentPage: 1,
  214. pageSize: 10,
  215. total: 10,
  216. itemApplications: [],
  217. // 应用列表数据
  218. applications: [],
  219. };
  220. },
  221. mounted() {
  222. this.initData();
  223. },
  224. methods: {
  225. //关闭编辑弹窗
  226. handleEditClose(flag) {
  227. this.isContentShow = false;
  228. this.isContentView = false;
  229. // this.columnModel = [];
  230. this.contentItem = {};
  231. if (flag) {
  232. this.getDmsDataList();
  233. }
  234. },
  235. // 新增应用
  236. handleAddClick() {
  237. // console.log(this.columnModel);
  238. this.isContentShow = true;
  239. },
  240. // 处理分页变化
  241. handleCurrentChange(page) {
  242. this.currentPage = page;
  243. // 这里可以添加分页数据加载逻辑
  244. this.getDmsDataList();
  245. },
  246. initData() {
  247. this.getDmsCNameAType("applevel");
  248. this.getDmsCNameAType("appstatus");
  249. this.getDmsTagSName();
  250. this.getModelById();
  251. this.getDmsDataList();
  252. },
  253. //根据模型id查询模型详情
  254. getModelById() {
  255. let that = this;
  256. let requestParams = {
  257. modelId: that.modelId, // 应用中心模型id
  258. };
  259. appCenter.getModelById(requestParams).then((res) => {
  260. if (res.code === 200) {
  261. that.columnModel = res.content;
  262. that.columnModel.modelId = that.modelId;
  263. that.columnModel.columnId = that.columnId;
  264. that.columnData = that.columnModel;
  265. }
  266. });
  267. },
  268. //根据内容id查询内容详情
  269. getContentById(item) {
  270. let that = this;
  271. let requestParams = {
  272. columnId: item.column_id,
  273. contentId: item.id,
  274. };
  275. // console.log(item);
  276. appCenter.getContentById(requestParams).then((data) => {
  277. if (data.code === 200) {
  278. that.contentItem = data.content;
  279. that.contentItem.phone = that.formatPhoneNumber(that.contentItem.phone);
  280. that.isContentShow = true;
  281. that.isContentView = false;
  282. }
  283. });
  284. },
  285. // 处理应用范围过滤变化
  286. handleScopeFilterChange() {
  287. this.getDmsDataList();
  288. },
  289. // 处理应用状态过滤变化
  290. handleStatusFilterChange() {
  291. this.getDmsDataList();
  292. },
  293. // 处理应用标签过滤变化
  294. handleTagFilterChange() {
  295. this.getDmsDataList();
  296. },
  297. // 处理搜索点击事件
  298. handleSearchClick() {
  299. this.getDmsDataList();
  300. },
  301. //重置过滤条件
  302. handleResetClick() {
  303. this.scopeFilter = "all";
  304. this.statusFilter = "all";
  305. this.tagFilter = "all";
  306. this.searchKeyword = "";
  307. this.getDmsDataList();
  308. },
  309. // 处理排序条件变化
  310. handleSortChange() {
  311. this.getDmsDataList();
  312. },
  313. getDmsTagSName() {
  314. let requestParams = {
  315. sName: "tag",
  316. };
  317. appCenter.getDmsSName(requestParams).then((res) => {
  318. if (res.code === 200) {
  319. this.tagOptions = res.content.map((item) => ({
  320. label: item.index,
  321. value: item.name,
  322. }));
  323. let allOption = {
  324. label: "all",
  325. value: "全部",
  326. };
  327. this.tagOptions.unshift(allOption);
  328. }
  329. });
  330. },
  331. getDmsCNameAType(param) {
  332. let allOption = {
  333. label: "all",
  334. value: "全部",
  335. };
  336. if (param === "applevel") {
  337. this.buffOptions = [];
  338. this.buffOptions.push(allOption);
  339. let obj = this.$getDmsTypes("applevel");
  340. for (let key in obj) {
  341. this.buffOptions.push({
  342. label: key,
  343. value: obj[key],
  344. });
  345. }
  346. } else if (param === "appstatus") {
  347. this.statusOptions = [];
  348. this.statusOptions.push(allOption);
  349. let obj = this.$getDmsTypes("appstatus");
  350. for (let key in obj) {
  351. this.statusOptions.push({
  352. label: key,
  353. value: obj[key],
  354. });
  355. }
  356. }
  357. // let requestParams = {
  358. // cName: param,
  359. // type: 0
  360. // };
  361. // appCenter.getDmsCNameAType(requestParams).then(res => {
  362. // if (res.code === 200) {
  363. // let option = res.content.map(item => ({
  364. // label: item.index,
  365. // value: item.name
  366. // }));
  367. // let allOption = {
  368. // label: 'all',
  369. // value: '全部'
  370. // }
  371. // if(param === 'applevel'){
  372. // this.buffOptions = option;
  373. // this.buffOptions.unshift(allOption);
  374. // }else{
  375. // this.statusOptions = option;
  376. // this.statusOptions.unshift(allOption);
  377. // }
  378. // }
  379. // })
  380. },
  381. getDmsDataList() {
  382. let requestParams = {
  383. columnId: this.columnId,
  384. states: 0,
  385. orderBy: JSON.stringify([{ field: "frame_time", orderByType: this.sortByValue }]),
  386. pageSize: this.pageSize,
  387. page: this.currentPage - 1,
  388. };
  389. if (this.searchKeyword) {
  390. requestParams.search = JSON.stringify([
  391. ...(requestParams.search ? JSON.parse(requestParams.search) : []),
  392. {
  393. field: "title",
  394. searchType: 2,
  395. content: { value: "%" + this.searchKeyword + "%" },
  396. },
  397. ]);
  398. }
  399. if (this.scopeFilter !== "all") {
  400. requestParams.search = JSON.stringify([
  401. ...(requestParams.search ? JSON.parse(requestParams.search) : []),
  402. {
  403. field: "appbuff",
  404. searchType: 2,
  405. content: { value: this.scopeFilter },
  406. },
  407. ]);
  408. }
  409. if (this.statusFilter !== "all") {
  410. requestParams.search = JSON.stringify([
  411. ...(requestParams.search ? JSON.parse(requestParams.search) : []),
  412. {
  413. field: "appstauts",
  414. searchType: 2,
  415. content: { value: this.statusFilter },
  416. },
  417. ]);
  418. }
  419. if (this.tagFilter !== "all") {
  420. requestParams.search = JSON.stringify([
  421. ...(requestParams.search ? JSON.parse(requestParams.search) : []),
  422. {
  423. field: "apptags",
  424. searchType: 2,
  425. content: { value: this.tagFilter },
  426. },
  427. ]);
  428. }
  429. appCenter.getDmsDataList(requestParams).then((res) => {
  430. if (res.code === 200) {
  431. this.total = res.content.count;
  432. this.itemApplications = res.content.data.map((item) => ({
  433. ...item,
  434. buffName:
  435. this.buffOptions.find((info) => info.label == item.appbuff.trim())?.value || "",
  436. appstautName:
  437. this.statusOptions.find((info) => info.label == item.appstauts.trim())?.value || "",
  438. tags: item.apptags
  439. .split(",")
  440. .map((tag) => this.tagOptions.find((info) => info.label == tag.trim())?.value || ""),
  441. createTime: moment(item.create_time).format("YYYY-MM-DD HH:mm:ss"),
  442. frameTime: moment(item.frame_time).format("YYYY-MM-DD HH:mm:ss"),
  443. phone: this.formatPhoneNumber(item.phone),
  444. }));
  445. this.applications = this.itemApplications;
  446. // console.log("========"+this.itemApplications);
  447. } else {
  448. this.total = 0;
  449. this.applications = [];
  450. }
  451. });
  452. },
  453. formatPhoneNumber(phone) {
  454. if (!phone) return "";
  455. return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2");
  456. },
  457. },
  458. };
  459. </script>
  460. <style lang="less" scoped>
  461. .application-management {
  462. width: 100%;
  463. background-color: #00002a;
  464. color: #ffffff;
  465. }
  466. /* 右侧主内容区 */
  467. .main-content {
  468. padding: 20px 30px;
  469. overflow-y: auto;
  470. }
  471. /* 过滤条件区域 */
  472. .filter-section {
  473. display: flex;
  474. flex-wrap: wrap;
  475. gap: 20px;
  476. // margin-bottom: 20px;
  477. padding-bottom: 15px;
  478. // border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  479. }
  480. .filter-group {
  481. display: flex;
  482. align-items: center;
  483. gap: 10px;
  484. }
  485. .filter-title {
  486. font-size: 14px;
  487. color: rgba(255, 255, 255, 0.8);
  488. }
  489. /* 搜索栏区域 */
  490. .search-section {
  491. display: flex;
  492. align-items: center;
  493. gap: 10px;
  494. margin-bottom: 25px;
  495. }
  496. .search-input {
  497. // width: 400px;
  498. margin-right: 10px;
  499. }
  500. .search-btn,
  501. .reset-btn,
  502. .add-btn {
  503. padding: 8px 16px;
  504. font-size: 14px;
  505. }
  506. /* 应用列表区域 */
  507. .applications-section {
  508. background-color: rgba(255, 255, 255, 0.05);
  509. border-radius: 8px;
  510. padding: 20px;
  511. }
  512. .section-header {
  513. display: flex;
  514. justify-content: space-between;
  515. align-items: center;
  516. margin: 0px 10px 5px 10px;
  517. }
  518. .total-count {
  519. font-size: 14px;
  520. color: rgba(255, 255, 255, 0.8);
  521. }
  522. .sort-control {
  523. display: flex;
  524. align-items: center;
  525. gap: 0px;
  526. margin-right: 8px;
  527. font-size: 14px;
  528. color: rgba(255, 255, 255, 0.8);
  529. }
  530. /* 应用列表 */
  531. .applications-list {
  532. margin-bottom: 20px;
  533. // height: 500px
  534. height: calc(100vh - 420px);
  535. overflow: auto;
  536. padding: 0px 10px 0px 10px;
  537. }
  538. .application-item {
  539. display: flex;
  540. justify-content: space-between;
  541. align-items: center;
  542. padding: 15px;
  543. margin-bottom: 10px;
  544. background-color: rgba(255, 255, 255, 0.05);
  545. border: 1px solid rgba(255, 255, 255, 0.1);
  546. border-radius: 6px;
  547. transition: all 0.3s ease;
  548. &:hover {
  549. border-color: rgba(24, 144, 255, 0.4);
  550. background-color: rgba(24, 144, 255, 0.05);
  551. }
  552. }
  553. .app-info {
  554. display: flex;
  555. align-items: center;
  556. // flex: 1;
  557. width: 410px;
  558. gap: 15px;
  559. }
  560. .app-logo {
  561. width: 60px;
  562. height: 60px;
  563. border-radius: 6px;
  564. overflow: hidden;
  565. img {
  566. width: 100%;
  567. height: 100%;
  568. object-fit: cover;
  569. }
  570. }
  571. .app-details {
  572. display: flex;
  573. flex-direction: column;
  574. gap: 5px;
  575. }
  576. .app-header {
  577. display: flex;
  578. align-items: center;
  579. gap: 10px;
  580. }
  581. .app-name {
  582. font-size: 16px;
  583. font-weight: bold;
  584. margin: 0;
  585. color: #ffffff;
  586. }
  587. .app-version {
  588. font-size: 12px;
  589. color: rgba(255, 255, 255, 0.6);
  590. background-color: rgba(255, 255, 255, 0.1);
  591. padding: 2px 6px;
  592. border-radius: 4px;
  593. }
  594. .app-tags {
  595. display: flex;
  596. gap: 5px;
  597. }
  598. /* 应用指标 */
  599. .app-metrics {
  600. display: flex;
  601. gap: 40px;
  602. flex: 1;
  603. justify-content: space-around;
  604. padding-right: 20px;
  605. }
  606. .metric-item {
  607. display: flex;
  608. flex-direction: column;
  609. align-items: center;
  610. gap: 3px;
  611. }
  612. .metric-label {
  613. font-size: 12px;
  614. color: rgba(255, 255, 255, 0.6);
  615. }
  616. .metric-value {
  617. font-size: 14px;
  618. font-weight: bold;
  619. color: #ffffff;
  620. }
  621. .status-online {
  622. color: #67c23a;
  623. }
  624. .status-offline {
  625. color: #e6a23c;
  626. }
  627. .status-suspended {
  628. color: #909399;
  629. }
  630. .status-expired {
  631. color: #f56c6c;
  632. }
  633. /* 应用操作 */
  634. .app-actions {
  635. display: flex;
  636. align-items: center;
  637. gap: 20px;
  638. }
  639. .app-date {
  640. font-size: 12px;
  641. color: rgba(255, 255, 255, 0.6);
  642. }
  643. .detail-btn {
  644. padding: 4px 12px;
  645. font-size: 12px;
  646. }
  647. /* 分页控件 */
  648. .pagination-section {
  649. display: flex;
  650. justify-content: space-between;
  651. align-items: center;
  652. margin: 0px 15px 0px 10px;
  653. // padding-top: 15px;
  654. // border-top: 1px solid rgba(255, 255, 255, 0.1);
  655. }
  656. .total-text {
  657. font-size: 14px;
  658. color: rgba(255, 255, 255, 0.8);
  659. }
  660. /* 响应式设计 */
  661. @media (max-width: 1200px) {
  662. .app-metrics {
  663. gap: 20px;
  664. }
  665. }
  666. @media (max-width: 992px) {
  667. .main-content {
  668. padding: 15px 20px;
  669. }
  670. .filter-section {
  671. flex-direction: column;
  672. align-items: flex-start;
  673. }
  674. .search-input {
  675. width: 300px;
  676. }
  677. .application-item {
  678. flex-direction: column;
  679. align-items: flex-start;
  680. gap: 15px;
  681. }
  682. .app-metrics {
  683. width: 100%;
  684. justify-content: space-around;
  685. }
  686. .app-actions {
  687. width: 100%;
  688. justify-content: space-between;
  689. }
  690. }
  691. </style>