1
0

index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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" :moduleList="moduleList" :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. let moduleList=reactive<any[]>([])
  74. //获取左侧菜单树
  75. async function getTreeList() {
  76. const res = await getQuery()
  77. if (res.length != 0) {
  78. listArr.forEach(el => {
  79. el.children.length = 0
  80. res.forEach(v => {
  81. // v.id=v.itemValue
  82. let childre: any[] = []
  83. if (v.children.length != 0) {
  84. v.children.forEach(m => {
  85. childre.push({ pid: v.itemValue, ppid: el.id, isFolder: false, title: m.itemText, id: m.itemValue })
  86. })
  87. }
  88. el.children.push({ pid: el.id, isFolder: true, title: v.itemText, id: v.itemValue, children: childre })
  89. })
  90. })
  91. console.log(listArr, 'listArr-----------')
  92. }
  93. }
  94. //点击目录
  95. async function onClick(node) {
  96. console.log(node, 'node--------------')
  97. if (node.pid == 'auto') {
  98. treeClick(node)
  99. } else if (node.pid == 'hand') {
  100. treeClick(node)
  101. } else {
  102. treeClick(node)
  103. }
  104. };
  105. function treeClick(node) {
  106. dataNow.value = new Date().getTime()
  107. selected.id = node.id;
  108. selected.pid = node.pid;
  109. selected.title = node.title;
  110. selected.isFolder = node.isFolder;
  111. selected.ppid=node.ppid
  112. if (node.id == '0' || node.id == '1' || node.id == '2') {
  113. searchParam.busKind = ''
  114. searchParam.modelType = node.id
  115. searchParam.reportType = ''
  116. } else if (node.pid == '0' || node.pid == '1' || node.pid == '2') {
  117. searchParam.busKind = node.id
  118. searchParam.modelType = node.pid
  119. searchParam.reportType = ''
  120. } else {
  121. searchParam.busKind = node.pid
  122. searchParam.modelType = node.ppid
  123. searchParam.reportType = node.id
  124. }
  125. getModuleList()
  126. }
  127. //获取报表模板数据
  128. async function getModuleList(){
  129. let res=await reportList({column: 'createTime', ...searchParam})
  130. console.log(res,'报表模板---------')
  131. if(res.records.length!=0){
  132. moduleList.length=0
  133. res.records.forEach(el=>{
  134. moduleList.push({label:el.fileName,value:el.id})
  135. })
  136. }
  137. }
  138. async function saveAdd(params) {
  139. let res = await save({ ...params });
  140. if (res.id) {
  141. message.warning('新增成功!');
  142. } else {
  143. message.error('新增失败!')
  144. }
  145. dataNow.value = new Date().getTime()
  146. }
  147. onMounted(() => {
  148. getTreeList()
  149. })
  150. </script>
  151. <style lang="less" scoped>
  152. .reportManager {
  153. width: calc(100% - 20px);
  154. height: calc(100% - 90px);
  155. position: relative;
  156. margin: 80px 10px 10px 10px;
  157. .content {
  158. width: 100%;
  159. height: calc(100% - 30px);
  160. display: flex;
  161. flex-direction: row;
  162. justify-content: space-between;
  163. align-items: flex-start;
  164. position: relative;
  165. // z-index: 999;
  166. .left-box {
  167. width: 15%;
  168. height: 100%;
  169. padding: 20px;
  170. border: 1px solid #99e8ff66;
  171. background: #27546e1a;
  172. box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  173. -moz-box-shadow: 0px 0px 20px 7px rgba(145, 233, 254, 0.7) inset;
  174. -webkit-box-shadow: 0px 0px 50px 1px rgb(149 235 255 / 5%) inset;
  175. overflow-y: auto;
  176. // lxh
  177. .iconfont {
  178. color: #fff;
  179. font-size: 12px;
  180. margin-left: 5px;
  181. }
  182. }
  183. .right-box {
  184. width: 85%;
  185. height: 100%;
  186. padding: 0px 0px 0px 15px;
  187. box-sizing: border-box;
  188. }
  189. }
  190. }
  191. </style>