index.vue 5.3 KB

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