You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

206 lines
6.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <el-dialog
  3. top="5vh"
  4. class="moduleset"
  5. :visible.sync="visible"
  6. width="60%"
  7. append-to-body>
  8. <div slot="title" class="dialog-title">
  9. <p>全部应用</p>
  10. <el-divider style="margin: 0 !important;"></el-divider>
  11. </div>
  12. <div class="toolBox">
  13. <el-input v-model="keyWords" @change="searchMenu" placeholder="模糊搜索, enter回车键搜索">
  14. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  15. </el-input>
  16. <div class="selectItem">
  17. <div class="item" :class="{active: active == 'xmgl' }" @click="active = 'xmgl'">
  18. <span>项目管理系统</span>
  19. </div>
  20. <div class="item" :class="{active: active == 'oa' }" @click="active = 'oa'">
  21. <span>智慧协同办公系统</span>
  22. </div>
  23. <div class="item" :class="{active: active == 'mall' }" @click="active = 'mall'">
  24. <span>电商定制系统</span>
  25. </div>
  26. </div>
  27. </div>
  28. <div class="nav" v-loading="menuLoading">
  29. <div class="nav_item" v-for="(item, index) in (selectMenus.length > 0 ? selectMenus : menus[active])" :key="index" @click="selectItem(item, index)">
  30. <img :src="item.logoUrl" alt="">
  31. <span>{{item.name}}</span>
  32. <el-divider></el-divider>
  33. <div class="desc" v-if="item.billMode!=='0'">
  34. <el-button @click="goBuy(item)" v-if="!item.isBuy" style="width:70px;" type="primary" round>购买</el-button>
  35. <span class="buyAfter" v-else>已购买</span>
  36. </div>
  37. <div class="desc" v-else>
  38. <span class="buyAfter">免费</span>
  39. </div>
  40. </div>
  41. </div>
  42. </el-dialog>
  43. </template>
  44. <script>
  45. import { mapGetters } from 'vuex';
  46. import {getAllMenuModule, getBuyMenuModule} from '@/api/mdp/sys/modules'
  47. import {modulesOfIcon} from "./modulesOfIcon.js";
  48. import {modulesOfRouter} from "./modulesOfRouter.js";
  49. export default {
  50. props: ['value'],
  51. computed: {
  52. ...mapGetters([
  53. 'userInfo'
  54. ]),
  55. visible: {
  56. get() {
  57. return this.value
  58. },
  59. set(val) {
  60. this.$emit('input', val)
  61. }
  62. }
  63. },
  64. watch: {
  65. 'value': {
  66. handler(nval, oval) {
  67. if(nval) {
  68. this.getAllModules();
  69. }
  70. }
  71. },
  72. 'keyWords': 'filterModule'
  73. },
  74. data() {
  75. return {
  76. menuLoading: false,
  77. selectMenus: [],
  78. active: "xmgl",
  79. menus: {},
  80. keyWords: null,
  81. filterVal: '',
  82. }
  83. },
  84. methods: {
  85. searchMenu(val) {
  86. this.keyWords = val;
  87. },
  88. filterModule() {
  89. if(this.keyWords == null || this.keyWords == "" || this.keyWords == undefined) {
  90. this.selectMenus = [];
  91. return;
  92. }
  93. let val = this.keyWords;
  94. let tempArr = [];
  95. this.menus.mall.forEach(element => {
  96. if(element.name.indexOf(val) != -1) {
  97. tempArr.push(element);
  98. }
  99. });
  100. this.menus.oa.forEach(element => {
  101. if(element.name.indexOf(val) != -1) {
  102. tempArr.push(element);
  103. }
  104. });
  105. this.menus.xmgl.forEach(element => {
  106. if(element.name.indexOf(val) != -1) {
  107. tempArr.push(element);
  108. }
  109. });
  110. this.selectMenus = tempArr;
  111. },
  112. selectItem(item) {
  113. if(item.isBuy||item.billMode=='0') {
  114. //路由跳转
  115. let name = "";
  116. modulesOfRouter.forEach(e => {
  117. if(e.id == item.id) {
  118. name = e.path;
  119. item.type = e.type;
  120. }
  121. })
  122. if(name != "") {
  123. if(item.type == "link") {
  124. window.open(name);
  125. }else {
  126. this.$router.push({path: name})
  127. }
  128. }
  129. this.visible = false;
  130. }
  131. },
  132. goBuy(item) {
  133. this.visible = false;
  134. //前往购买页面
  135. this.$router.push({path:'/my/order/index',query:{moduleId:item.id}})
  136. },
  137. //获取所有模块
  138. getAllModules() {
  139. this.menuLoading = true
  140. getAllMenuModule({}).then(res => {
  141. let tempData = res.data.data;
  142. tempData.forEach(i=>{
  143. i.isBuy=false;
  144. })
  145. getBuyMenuModule({}).then(res2 => {
  146. let branchModules = res2.data.data;
  147. tempData.forEach(k => {
  148. branchModules.forEach(element => {
  149. if(k.id == element.moduleId && element.status=='1') {
  150. k.isBuy = true;
  151. }
  152. });
  153. modulesOfIcon.forEach(element => {
  154. if(k.id == element.id) {
  155. k.logoUrl = element.logoUrl;
  156. }
  157. });
  158. })
  159. let xmMenus = tempData.filter(res => {return res.mcate == '2'})
  160. let oaMunus = tempData.filter(res => {return res.mcate == '1'})
  161. let mallMenus = tempData.filter(res => {return res.mcate == '3'})
  162. this.menus = {
  163. "xmgl": xmMenus,
  164. "oa" : oaMunus,
  165. "mall": mallMenus
  166. }
  167. })
  168. }).finally(() => this.menuLoading = false)
  169. },
  170. },
  171. created() {
  172. }
  173. }
  174. </script>
  175. <style lang="scss">
  176. .moduleset .el-dialog__header {
  177. padding: 0;
  178. }
  179. .moduleset .el-divider--horizontal {
  180. margin: 0 !important;
  181. }
  182. </style>
  183. <style lang="scss" scoped>
  184. @import './index.scss';
  185. </style>