index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. <template>
  2. <div class="appCenter">
  3. <div class="ac_header">
  4. <div class="ac_h_top">
  5. <span>应用管理</span>
  6. <el-button
  7. type="primary"
  8. size="small"
  9. icon="el-icon-plus"
  10. style="position: absolute;right: 15px;"
  11. @click="addApp"
  12. >添加应用</el-button
  13. >
  14. </div>
  15. <div class="ac_h_bottom">
  16. <div class="ac_h_b_selectList">
  17. <el-input
  18. v-model="searchText"
  19. style="width: 200px;"
  20. placeholder="请输入应用名称"
  21. @keyup.enter.native="getData"
  22. />
  23. <el-select
  24. v-model="selectJuri"
  25. placeholder="请选择"
  26. @change="changeSelectType"
  27. >
  28. <el-option
  29. v-for="item in selectList"
  30. :key="item.index"
  31. :label="item.label"
  32. :value="item.index"
  33. ></el-option>
  34. </el-select>
  35. <el-button
  36. type="primary"
  37. style="margin-left: 10px;"
  38. icon="el-icon-search"
  39. @click="getData"
  40. ></el-button>
  41. <el-button type="primary" @click="resetData">重置</el-button>
  42. </div>
  43. <div class="ac_h_b_typeList">
  44. <span
  45. :class="{ ac_h_b_typeList_active: showType === '' }"
  46. @click="changeType('')"
  47. >全部</span
  48. >
  49. <span
  50. v-for="item in typeList"
  51. :key="item.id"
  52. :class="{ ac_h_b_typeList_active: showType === item.id }"
  53. @click="changeType(item.id)"
  54. >{{ item.name }}</span
  55. >
  56. </div>
  57. </div>
  58. </div>
  59. <div class="ac_content">
  60. <div class="ac_c_item" v-for="(item, index) in dataList" :key="item.id">
  61. <div class="ac_c_i_top">
  62. <div class="ac_c_i_t_left">
  63. <svg
  64. t="1732605901531"
  65. class="icon"
  66. viewBox="0 0 1024 1024"
  67. version="1.1"
  68. xmlns="http://www.w3.org/2000/svg"
  69. p-id="4275"
  70. width="200"
  71. height="200"
  72. >
  73. <path
  74. d="M179.2 153.6a51.2 51.2 0 0 0-51.2 51.2v128a51.2 51.2 0 0 0 51.2 51.2h128a51.2 51.2 0 0 0 51.2-51.2V204.8a51.2 51.2 0 0 0-51.2-51.2H179.2z m0-102.4h128a153.6 153.6 0 0 1 153.6 153.6v128a153.6 153.6 0 0 1-153.6 153.6H179.2a153.6 153.6 0 0 1-153.6-153.6V204.8a153.6 153.6 0 0 1 153.6-153.6z m0 614.4a51.2 51.2 0 0 0-51.2 51.2v128a51.2 51.2 0 0 0 51.2 51.2h128a51.2 51.2 0 0 0 51.2-51.2V716.8a51.2 51.2 0 0 0-51.2-51.2H179.2z m0-102.4h128a153.6 153.6 0 0 1 153.6 153.6v128a153.6 153.6 0 0 1-153.6 153.6H179.2a153.6 153.6 0 0 1-153.6-153.6V716.8a153.6 153.6 0 0 1 153.6-153.6z m611.84-403.4048a51.2 51.2 0 0 0-72.3968 0L646.144 232.2432a51.2 51.2 0 0 0 0 72.3968l72.448 72.3968a51.2 51.2 0 0 0 72.3968 0l72.3968-72.3968a51.2 51.2 0 0 0 0-72.3968L791.04 159.744z m72.3968-72.3968l72.3968 72.3968a153.6 153.6 0 0 1 0 217.2416l-72.3968 72.3968a153.6 153.6 0 0 1-217.2416 0l-72.3968-72.3968a153.6 153.6 0 0 1 0-217.2416l72.3968-72.3968a153.6 153.6 0 0 1 217.2416 0zM699.7504 896a51.2 51.2 0 0 1 0 102.4A162.1504 162.1504 0 0 1 537.6 836.2496v-110.8992A162.1504 162.1504 0 0 1 699.7504 563.2h110.8992a162.1504 162.1504 0 0 1 162.1504 162.1504v8.448a51.2 51.2 0 0 1-102.4 0v-8.448c0-33.024-26.7264-59.7504-59.7504-59.7504h-110.8992c-33.024 0-59.7504 26.7264-59.7504 59.7504v110.8992c0 33.024 26.7264 59.7504 59.7504 59.7504z"
  75. fill="#2C6DD2"
  76. p-id="4276"
  77. ></path>
  78. <path
  79. d="M791.4496 160a51.2 51.2 0 0 0-72.3968 0l-72.448 72.3968a51.2 51.2 0 0 0 0 72.3968l72.448 72.3968a51.2 51.2 0 0 0 72.3968 0l72.3968-72.3968a51.2 51.2 0 0 0 0-72.3968l-72.3968-72.3968z"
  80. fill="#20C997"
  81. p-id="4277"
  82. ></path>
  83. </svg>
  84. </div>
  85. <div class="ac_c_i_t_right">
  86. <div>{{ item.name }}</div>
  87. <span>{{ item.label }}</span>
  88. </div>
  89. </div>
  90. <div class="ac_c_i_bottom">
  91. <div>{{ item.detail }}</div>
  92. <span @click="openApp(item.url)">{{ item.url }}</span>
  93. </div>
  94. </div>
  95. <div class="ac_c_empty" v-if="dataList.length === 0">
  96. <span>暂无数据...</span>
  97. </div>
  98. </div>
  99. <addAppDialog
  100. ref="addAppDialogRef"
  101. :typeList="typeList"
  102. @success="addAppSuccess"
  103. />
  104. </div>
  105. </template>
  106. <script>
  107. import addAppDialog from "./dialog/addAppDialog.vue";
  108. export default {
  109. components: {
  110. addAppDialog
  111. },
  112. data() {
  113. return {
  114. showType: "",
  115. searchText: "",
  116. selectJuri: 1,
  117. typeList: [],
  118. selectList: [
  119. { index: 1, label: "我的" },
  120. { index: 2, label: "组织" },
  121. { index: 3, label: "所有人" }
  122. ],
  123. userId: this.$route.query["userid"],
  124. org: this.$route.query["org"],
  125. oid: this.$route.query["oid"],
  126. getDataLoading: false,
  127. dataList: []
  128. };
  129. },
  130. methods: {
  131. changeType(newIndex) {
  132. let flag = this.showType === newIndex;
  133. this.showType = newIndex;
  134. if (!flag) {
  135. this.getData();
  136. }
  137. },
  138. changeSelectType() {
  139. this.getData();
  140. },
  141. getData() {
  142. this.getDataLoading = true;
  143. let params = {
  144. uid: this.userId,
  145. name: this.searchText,
  146. label: "",
  147. type: this.showType,
  148. juri: this.selectJuri,
  149. stand: "cn"
  150. };
  151. this.ajax
  152. .get(this.$store.state.api + "select_appStore", params)
  153. .then(res => {
  154. this.getDataLoading = false;
  155. let _data = res.data[0];
  156. if (_data.length > 0) {
  157. this.dataList = _data;
  158. } else {
  159. this.dataList = [];
  160. }
  161. })
  162. .catch(err => {
  163. this.getDataLoading = false;
  164. console.log(err);
  165. this.$message.error("获取应用失败");
  166. });
  167. },
  168. addApp() {
  169. this.$refs.addAppDialogRef.open({ type: 1 });
  170. },
  171. addAppSuccess(data, type) {
  172. if (type === 1) {
  173. //添加
  174. let params = [
  175. {
  176. nname: data.nname, //app名称
  177. nuserid: this.userId, //创建的用户ID
  178. nlabel: data.nlabel, //app标签
  179. ndetail: data.ndetail, //app简介
  180. nurl: data.nurl, //app链接
  181. ntype: data.ntype, //app类型
  182. njuri: data.njuri, //app权限 1:我的 2:组织 3:所有人
  183. nstand: "cn", //语言
  184. njson: "" //其他信息
  185. }
  186. ];
  187. this.ajax
  188. .post(this.$store.state.api + "insert_appStore", params)
  189. .then(res => {
  190. if (res.data == 1) {
  191. this.$message.success("添加成功");
  192. this.$refs.addAppDialogRef.close(true);
  193. this.getData();
  194. } else {
  195. this.$message.error("添加失败");
  196. this.$refs.addAppDialogRef.loading = false;
  197. }
  198. })
  199. .catch(err => {
  200. console.log(err);
  201. this.$message.error("添加失败");
  202. });
  203. } else if (type === 2) {
  204. //编辑
  205. console.log("编辑");
  206. console.log(data);
  207. }
  208. },
  209. getTypeList() {
  210. let params = {
  211. suserid: this.userId,
  212. sorg: this.org,
  213. soid: this.oid,
  214. sstand: "cn"
  215. };
  216. this.ajax
  217. .get(this.$store.state.api + "select_appStoreType", params)
  218. .then(res => {
  219. let data = res.data[0];
  220. if (data.length > 0) {
  221. this.typeList = data;
  222. }
  223. })
  224. .catch(err => {
  225. console.log(err);
  226. this.$message.error("获取应用类型失败");
  227. });
  228. },
  229. openApp(url){
  230. window.open(url, '_blank');
  231. },
  232. resetData() {
  233. this.searchText = "";
  234. this.selectJuri = 1;
  235. this.showType = "";
  236. this.getData();
  237. }
  238. },
  239. mounted() {
  240. this.getTypeList();
  241. this.getData();
  242. }
  243. };
  244. </script>
  245. <style scoped>
  246. .appCenter {
  247. width: 100vw;
  248. height: 100vh;
  249. background-color: #f2f4f7;
  250. margin: 0;
  251. overflow: auto;
  252. box-sizing: border-box;
  253. padding: 20px;
  254. display: flex;
  255. flex-direction: column;
  256. }
  257. .ac_header {
  258. width: 100%;
  259. height: auto;
  260. border-radius: 5px;
  261. background-color: #fff;
  262. }
  263. .ac_h_top {
  264. width: 100%;
  265. height: 50px;
  266. display: flex;
  267. align-items: center;
  268. box-sizing: border-box;
  269. padding: 0 15px;
  270. border-bottom: 1px solid #eeeeee;
  271. position: relative;
  272. }
  273. .ac_h_top > span {
  274. font-size: 26px;
  275. }
  276. .ac_h_bottom {
  277. width: 100%;
  278. height: auto;
  279. padding: 10px 0 20px 0;
  280. }
  281. .ac_h_b_typeList {
  282. width: 100%;
  283. height: auto;
  284. display: flex;
  285. flex-wrap: wrap;
  286. box-sizing: border-box;
  287. padding: 0 15px;
  288. }
  289. .ac_h_b_typeList > span {
  290. font-size: 18px;
  291. margin-right: 20px;
  292. margin-top: 10px;
  293. margin-bottom: 5px;
  294. cursor: pointer;
  295. }
  296. .ac_h_b_typeList_active {
  297. color: #007aff;
  298. }
  299. .ac_h_b_selectList {
  300. margin-left: 15px;
  301. margin-bottom: 10px;
  302. }
  303. .ac_content {
  304. width: 100%;
  305. flex: 1;
  306. height: auto;
  307. margin-top: 20px;
  308. overflow: auto;
  309. }
  310. .ac_c_item {
  311. width: calc(100% / 5 - (15px * 4) / 5);
  312. height: 250px;
  313. background-color: #fff;
  314. border-radius: 10px;
  315. box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  316. box-sizing: border-box;
  317. padding: 15px;
  318. margin-right: 15px;
  319. margin-bottom: 15px;
  320. float: left;
  321. }
  322. @media screen and (min-width: 1400px) {
  323. .ac_c_item {
  324. width: calc(100% / 5 - (15px * 4) / 5) !important;
  325. }
  326. .ac_c_item:nth-child(5n) {
  327. margin-right: 0px !important;
  328. /* background-color: red; */
  329. }
  330. }
  331. @media screen and (max-width: 1380px) {
  332. .ac_c_item {
  333. width: calc(100% / 4 - (15px * 3) / 4) !important;
  334. }
  335. .ac_c_item:nth-child(4n) {
  336. margin-right: 0px !important;
  337. }
  338. /* .ac_c_item:nth-child(5n) {
  339. margin-right: 0 !important;
  340. } */
  341. }
  342. @media screen and (max-width: 1080px) {
  343. .ac_c_item {
  344. width: calc(100% / 3 - (15px * 2) / 3) !important;
  345. }
  346. .ac_c_item:nth-child(5n) {
  347. margin-right: 15px !important;
  348. }
  349. .ac_c_item:nth-of-type(4n) {
  350. margin-right: 15px !important;
  351. }
  352. .ac_c_item:nth-child(3n) {
  353. margin-right: 0 !important;
  354. }
  355. }
  356. .ac_c_empty{
  357. width: 100%;
  358. height: 40%;
  359. display: flex;
  360. box-sizing: border-box;
  361. padding-top: 2%;
  362. justify-content: center;
  363. /* align-items: center; */
  364. }
  365. .ac_c_i_top {
  366. width: 100%;
  367. height: 50px;
  368. display: flex;
  369. /* flex-direction: column; */
  370. /* justify-content: space-evenly; */
  371. /* background-color: red */
  372. }
  373. .ac_c_i_t_left {
  374. width: 50px;
  375. height: 50px;
  376. border-radius: 8px;
  377. margin-right: 10px;
  378. box-sizing: border-box;
  379. padding: 5px;
  380. }
  381. .ac_c_i_t_left > svg {
  382. width: 100%;
  383. height: 100%;
  384. }
  385. .ac_c_i_t_right {
  386. width: calc(100% - 60px);
  387. height: 100%;
  388. display: flex;
  389. flex-direction: column;
  390. justify-content: space-evenly;
  391. }
  392. .ac_c_i_t_right > div {
  393. font-size: 22px;
  394. font-weight: bold;
  395. max-width: 100%;
  396. overflow: hidden;
  397. text-overflow: ellipsis;
  398. white-space: nowrap;
  399. }
  400. .ac_c_i_t_right > span {
  401. font-size: 16px;
  402. font-weight: bold;
  403. color: #8991a1;
  404. display: block;
  405. max-width: 100%;
  406. overflow: hidden;
  407. text-overflow: ellipsis;
  408. white-space: nowrap;
  409. }
  410. .ac_c_i_bottom {
  411. width: 100%;
  412. height: calc(100% - 60px);
  413. margin-top: 15px;
  414. }
  415. .ac_c_i_bottom > div {
  416. font-size: 20px;
  417. color: #8991a1;
  418. width: 100%;
  419. height: calc(100% - 30px);
  420. /* 第四行溢出显示... */
  421. display: -webkit-box;
  422. display: block;
  423. overflow: hidden;
  424. text-overflow: ellipsis;
  425. -webkit-line-clamp: 4;
  426. -webkit-box-orient: vertical;
  427. }
  428. .ac_c_i_bottom > span {
  429. margin-top: 5px;
  430. font-size: 16px;
  431. color: #409eff;
  432. overflow: hidden;
  433. display: block;
  434. text-overflow: ellipsis;
  435. white-space: nowrap;
  436. cursor: pointer;
  437. }
  438. </style>