index.vue 18 KB

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