plm前端
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.

169 lines
4.6 KiB

2 years ago
  1. <template>
  2. <el-dialog
  3. :title="buttons.menuList || '菜单列表'"
  4. @close="close"
  5. :close-on-click-modal="false"
  6. :visible.sync="visible">
  7. <div class="mod-menu">
  8. <el-table
  9. :data="dataList"
  10. v-loading="dataListLoading"
  11. border
  12. :height="tableHeight"
  13. style="width: 100%; ">
  14. <el-table-column
  15. prop="name"
  16. header-align="center"
  17. min-width="150"
  18. :label="buttons.name || '名称'">
  19. </el-table-column>
  20. <el-table-column
  21. prop="parentName"
  22. header-align="center"
  23. align="center"
  24. width="120"
  25. :label="buttons.parentName || '上级菜单'">
  26. </el-table-column>
  27. <el-table-column
  28. header-align="center"
  29. align="center"
  30. :label="buttons.icon || '图标'">
  31. <template slot-scope="scope">
  32. <icon-svg :name="scope.row.icon || ''"></icon-svg>
  33. </template>
  34. </el-table-column>
  35. <el-table-column
  36. prop="type"
  37. header-align="center"
  38. align="center"
  39. :label="buttons.type || '类型'">
  40. <template slot-scope="scope">
  41. <el-link v-if="scope.row.type === 0" type="success">{{ buttons.type1 || '目录' }}</el-link>
  42. <el-link v-else-if="scope.row.type === 1" size="small" type="success">{{ buttons.type2 || '菜单' }}
  43. </el-link>
  44. <el-link v-else-if="scope.row.type === 2" size="small" type="info">{{ buttons.type3 || '按钮' }}</el-link>
  45. </template>
  46. </el-table-column>
  47. <el-table-column
  48. fixed="right"
  49. header-align="center"
  50. align="center"
  51. width="150"
  52. :label="buttons.cz || '操作'">
  53. <template slot-scope="scope">
  54. <a v-if="isAuth('sys:oss:all') && scope.row.type === 1 " type="text" size="small"
  55. @click="helpFileList(scope.row.menuId)">{{ buttons.helpFileList || '帮助文档' }}</a>
  56. </template>
  57. </el-table-column>
  58. </el-table>
  59. <FileList ref="helpFileList" v-if="helpFileVisible"></FileList>
  60. </div>
  61. <span slot="footer" class="dialog-footer">
  62. <el-button type="primary" @click="visible = false">{{ buttons.close || '关闭' }}</el-button>
  63. </span>
  64. </el-dialog>
  65. </template>
  66. <script>
  67. import {
  68. searchFunctionButtonList,
  69. } from "@/api/sysLanguage.js"
  70. import FileList from '../common/file-list'
  71. import {treeDataTranslate} from '@/utils'
  72. export default {
  73. data() {
  74. return {
  75. // height: 450,
  76. dataForm: {},
  77. dataList: [],
  78. tableHeight: 0,
  79. visible: false,
  80. dataListLoading: false,
  81. addOrUpdateVisible: false,
  82. menuLanguageVisible: false,
  83. helpFileVisible: false,
  84. buttons: {
  85. menuList: '菜单列表',
  86. name: '名称',
  87. cz: '操作',
  88. upload: '上传',
  89. delete: '删除',
  90. fileDownload: '下载',
  91. deleteList: '批量删除',
  92. helpFileList: '帮助文档',
  93. parentName: '上级菜单',
  94. icon: '图标',
  95. type: '类型',
  96. type1: '目录',
  97. type2: '菜单',
  98. type3: '按钮',
  99. close: '关闭'
  100. },
  101. }
  102. },
  103. components: {
  104. FileList
  105. },
  106. activated() {
  107. this.getDataList()
  108. },
  109. mounted() {
  110. this.$nextTick(() => {
  111. this.tableHeight = (window.innerHeight * 0.65);
  112. })
  113. },
  114. methods: {
  115. // 获取button的词典
  116. getFunctionButtonList() {
  117. let queryButton = {
  118. functionId: this.$route.meta.menuId,
  119. tableId: '*',
  120. languageCode: this.$i18n.locale,
  121. objectType: 'button'
  122. }
  123. searchFunctionButtonList(queryButton).then(({data}) => {
  124. if (data.code == 0 && data.data) {
  125. this.buttons = data.data
  126. }
  127. })
  128. },
  129. init() {
  130. this.visible = true
  131. this.getDataList()
  132. },
  133. getDataList() {
  134. this.dataListLoading = true
  135. this.$http({
  136. url: this.$http.adornUrl('/sys/menu/list/' + this.$i18n.locale),
  137. method: 'get',
  138. params: this.$http.adornParams()
  139. }).then(({data}) => {
  140. this.dataList = data.filter(item => item.type === 1 && item.menuType === 'pc')
  141. this.dataListLoading = false
  142. })
  143. },
  144. // 帮助文档列表
  145. helpFileList(val) {
  146. let fileMappingDto = {
  147. fileId: '',
  148. fileType: '功能帮助文档',
  149. orderRef1: val,
  150. orderRef2: '*',
  151. orderRef3: '*',
  152. }
  153. this.helpFileVisible = true;
  154. this.$nextTick(() => {
  155. this.$refs.helpFileList.init(fileMappingDto)
  156. })
  157. },
  158. close() {
  159. this.dataList = []
  160. }
  161. },
  162. created() {
  163. this.getFunctionButtonList()
  164. }
  165. }
  166. </script>