index.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <div class="reportManager">
  3. <customHeader>报表管理中心</customHeader>
  4. <div class="content">
  5. <div class="left-box">
  6. <!-- 左侧树菜单 -->
  7. <fileSystem :selected="selected" :list="listArr" :draggable="true" @on-click="onClick">
  8. <template #icon="{ item }">
  9. <template v-if="item.isFolder">
  10. <SvgIcon v-if="item.expanded" size="18" name="file-open" />
  11. <SvgIcon v-else size="18" name="file-close" />
  12. </template>
  13. <treeIcon class="iconfont" :title="item.title" v-else />
  14. </template>
  15. </fileSystem>
  16. </div>
  17. <div class="right-box">
  18. <NormalTable :key="dataNow" :searchParam="searchParam" :columns="columns" :deleteById="deleteById"
  19. :downLoad="downLoad" :list="reportList" designScope="device-tabel" title="报表管理" :showTab="false"
  20. @saveAdd="saveAdd" />
  21. </div>
  22. </div>
  23. </div>
  24. </template>
  25. <script setup lang="ts">
  26. import { ref, nextTick, reactive, onMounted } from 'vue';
  27. import customHeader from '/@/components/vent/customHeader.vue';
  28. import fileSystem from './comment/common/cameraTree.vue';
  29. import { SvgIcon } from '/@/components/Icon';
  30. import treeIcon from './comment/common/Icon/treeIcon.vue';
  31. import NormalTable from './comment/NormalTable.vue';
  32. import { message } from 'ant-design-vue';
  33. import { columns, } from './reportManager.data';
  34. import { reportList, save, deleteById, downLoad, getQuery } from './reportManager.api';
  35. let dataNow = ref(0)
  36. let searchParam = reactive({
  37. busKind: '',
  38. modelType: '',
  39. reportType: '',
  40. })
  41. //左侧菜单列表
  42. let listArr = reactive<any[]>([
  43. {
  44. pid: 'auto',
  45. isFolder: true,
  46. title: '自动报表',
  47. id: '0',
  48. children: []
  49. },
  50. {
  51. pid: 'hand',
  52. isFolder: true,
  53. title: '手动报表',
  54. id: '1',
  55. children: []
  56. },
  57. {
  58. pid: 'temp',
  59. isFolder: true,
  60. title: '报表模板',
  61. id: '2',
  62. children: []
  63. },
  64. ]);
  65. //lxh 当前选中树节点
  66. let selected = reactive<any>({
  67. id: null,
  68. pid: null,
  69. title: '',
  70. isFolder: false,
  71. });
  72. //获取左侧菜单树
  73. async function getTreeList() {
  74. const res = await getQuery()
  75. if (res.length != 0) {
  76. listArr.forEach(el => {
  77. el.children.length = 0
  78. res.forEach(v => {
  79. // v.id=v.itemValue
  80. let childre: any[] = []
  81. if (v.children.length != 0) {
  82. v.children.forEach(m => {
  83. childre.push({ pid: v.itemValue, ppid: el.id, isFolder: false, title: m.itemText, id: m.itemValue })
  84. })
  85. }
  86. el.children.push({ pid: el.id, isFolder: true, title: v.itemText, id: v.itemValue, children: childre })
  87. })
  88. })
  89. console.log(listArr, 'listArr-----------')
  90. }
  91. }
  92. //点击目录
  93. async function onClick(node) {
  94. console.log(node, 'node--------------')
  95. if (node.pid == 'auto') {
  96. treeClick(node)
  97. } else if (node.pid == 'hand') {
  98. treeClick(node)
  99. } else {
  100. treeClick(node)
  101. }
  102. };
  103. function treeClick(node) {
  104. dataNow.value = new Date().getTime()
  105. selected.id = node.id;
  106. selected.pid = node.pid;
  107. selected.title = node.title;
  108. selected.isFolder = node.isFolder;
  109. selected.ppid=node.ppid
  110. if (node.id == '0' || node.id == '1' || node.id == '2') {
  111. searchParam.busKind = ''
  112. searchParam.modelType = node.id
  113. searchParam.reportType = ''
  114. } else if (node.pid == '0' || node.pid == '1' || node.pid == '2') {
  115. searchParam.busKind = node.id
  116. searchParam.modelType = node.pid
  117. searchParam.reportType = ''
  118. } else {
  119. searchParam.busKind = node.pid
  120. searchParam.modelType = node.ppid
  121. searchParam.reportType = node.id
  122. }
  123. }
  124. async function saveAdd(params) {
  125. let res = await save({ ...params });
  126. if (res.id) {
  127. message.warning('新增成功!');
  128. } else {
  129. message.error('新增失败!')
  130. }
  131. dataNow.value = new Date().getTime()
  132. }
  133. onMounted(() => {
  134. getTreeList()
  135. })
  136. </script>
  137. <style lang="less" scoped>
  138. .reportManager {
  139. width: calc(100% - 20px);
  140. height: calc(100% - 90px);
  141. position: relative;
  142. margin: 80px 10px 10px 10px;
  143. .content {
  144. width: 100%;
  145. height: calc(100% - 30px);
  146. display: flex;
  147. flex-direction: row;
  148. justify-content: space-between;
  149. align-items: flex-start;
  150. position: relative;
  151. // z-index: 999;
  152. .left-box {
  153. width: 15%;
  154. height: 100%;
  155. padding: 20px;
  156. border: 1px solid #99e8ff66;
  157. background: #27546e1a;
  158. box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  159. -moz-box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  160. -webkit-box-shadow: 0px 0px 50px 1px rgb(149 235 255 / 5%) inset;
  161. overflow-y: auto;
  162. // lxh
  163. .iconfont {
  164. color: #fff;
  165. font-size: 12px;
  166. margin-left: 5px;
  167. }
  168. }
  169. .right-box {
  170. width: 85%;
  171. height: 100%;
  172. padding: 0px 0px 0px 15px;
  173. box-sizing: border-box;
  174. }
  175. }
  176. }
  177. </style>