report.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. <template>
  2. <div class="page">
  3. <div class="top adfacjb">
  4. <div class="t_l">
  5. <p>报告管理</p>
  6. <p class="tip">访问和分析PERILL评估报告</p>
  7. </div>
  8. <div class="t_r">
  9. <!-- <el-button type="primary" icon="el-icon-upload2">导出报告</el-button> -->
  10. </div>
  11. </div>
  12. <div class="tabs adfac">
  13. <div class="t_pre" :class="{'active':tidx===1}" @click="handleChangeTab(1)">团队报告</div>
  14. <div class="t_pre" :class="{'active':tidx===2}" @click="handleChangeTab(2)">个人报告</div>
  15. </div>
  16. <div class="query adfacjb">
  17. <el-input placeholder="请输入内容" prefix-icon="el-icon-search" v-model="queryParams.name" style="width: calc(100% - 448px);"></el-input>
  18. <el-select v-model="queryParams.team" placeholder="所有团队" style="width: 200px;"></el-select>
  19. <el-select v-model="queryParams.sort" placeholder="排序方式" style="width: 200px;"></el-select>
  20. </div>
  21. <template v-if="tidx===1">
  22. <div class="list">
  23. <reportList :item="item" :reportList="item.reportList" :showMore="item.showMore"
  24. v-for="(item, index) in teamList" :key="index"
  25. @toggleReport="e=>toggleReportTeam(e,index)" @deleteReport="e=>deleteTeamReport(e,index,item)">
  26. </reportList>
  27. </div>
  28. </template>
  29. <template v-else-if="tidx===2">
  30. <div class="list">
  31. <reportList :item="item" :reportList="item.reportList" :showMore="item.showMore" :isTeam="false"
  32. v-for="(item, index) in personList" :key="index"
  33. @toggleReport="e=>toggleReportPerson(e,index)">
  34. </reportList>
  35. </div>
  36. </template>
  37. </div>
  38. </template>
  39. <script setup name="">
  40. import reportList from '@/components/reportList/index.vue'
  41. import { ref, getCurrentInstance, onMounted } from 'vue'
  42. const { proxy } = getCurrentInstance();
  43. import {
  44. getTeamQuestionnaireList,
  45. getTeamReportWjList,
  46. getUserReportWjList,
  47. deleteTeamReportWj
  48. } from "@/api/agent/index.js";
  49. const tidx = ref(1)
  50. const queryParams = ref({
  51. name: '',
  52. team: '',
  53. sort: ''
  54. })
  55. const teamList = ref([])
  56. const personList = ref([])
  57. const handleChangeTab = (idx) => {
  58. tidx.value = idx
  59. }
  60. const toggleReportTeam = (e,idx) => {
  61. teamList.value[idx].showMore = !teamList.value[idx].showMore;
  62. if(teamList.value[idx].showMore){
  63. getTeamReportWjList(e.id).then(res=>{
  64. if(res.code!==0) return proxy.$message.error(res.msg)
  65. teamList.value[idx].reportList = res.data;
  66. })
  67. }else teamList.value[idx].reportList = [];
  68. }
  69. const toggleReportPerson = (e,idx) => {
  70. personList.value[idx].showMore = !personList.value[idx].showMore;
  71. if(personList.value[idx].showMore){
  72. personList.value[idx].reportList = [
  73. {reportName:'报告名称报告名称报告名称报告名称',reprtTime:'2025-06-18 12:00:30',status:1},
  74. {reportName:'报告名称报告名称报告名称报告名称',reprtTime:'2025-06-18 12:00:30',status:3},
  75. {reportName:'报告名称报告名称报告名称报告名称',reprtTime:'2025-06-18 12:00:30',status:0},
  76. {reportName:'报告名称报告名称报告名称报告名称',reprtTime:'2025-06-18 12:00:30',status:2}
  77. ];
  78. }else personList.value[idx].reportList = [];
  79. }
  80. const getTeamList = () => {
  81. getTeamQuestionnaireList(queryParams.value).then(res=>{
  82. if(res.code!==0) return proxy.$message.error(res.msg)
  83. teamList.value = res.data.list;
  84. teamList.value = teamList.value.map(item=>{
  85. return {
  86. ...item,
  87. showMore:false,
  88. reportList:[]
  89. };
  90. })
  91. })
  92. }
  93. const getPersonList = () => {
  94. getUserReportWjList().then(res=>{
  95. if(res.code!==0) return proxy.$message.error(res.msg)
  96. personList.value = res.data;
  97. })
  98. }
  99. const deleteTeamReport = (e,idx,item) => {
  100. proxy.$modal.confirm('确认删除该报告吗?如确认会立即执行!').then(async function () {
  101. let res = await deleteTeamReportWj([e]);
  102. if(res.code===0){
  103. proxy.$message.success('删除成功!');
  104. getTeamReportWjList(item.id).then(res=>{
  105. if(res.code!==0) return proxy.$message.error(res.msg)
  106. teamList.value[idx].reportList = res.data;
  107. })
  108. } else proxy.$message.error(res.msg)
  109. }).then(() => {}).finally(() => {});
  110. }
  111. onMounted(()=>{
  112. getTeamList()
  113. })
  114. </script>
  115. <style scoped lang="scss">
  116. .page{
  117. padding: 28px 20px;
  118. background: #FAFAFA;
  119. .top{
  120. .t_l{
  121. p{
  122. font-family: PingFang-SC, PingFang-SC;
  123. font-weight: bold;
  124. font-size: 16px;
  125. color: #252525;
  126. line-height: 16px;
  127. &.tip{
  128. font-family: PingFangSC, PingFang SC;
  129. font-weight: 400;
  130. font-size: 14px;
  131. color: #6B7280;
  132. line-height: 14px;
  133. margin-top: 16px;
  134. }
  135. }
  136. }
  137. }
  138. .tabs{
  139. width: 100%;
  140. margin-top: 28px;
  141. border-bottom: 1px solid #E5E7EB;
  142. .t_pre{
  143. width: 116px;
  144. padding-bottom: 18px;
  145. position: relative;
  146. font-family: PingFangSC, PingFang SC;
  147. font-weight: 400;
  148. font-size: 14px;
  149. color: #252525;
  150. line-height: 16px;
  151. text-align: center;
  152. cursor: pointer;
  153. &.active{
  154. font-weight: bold;
  155. color: #761E6A;
  156. &::after{
  157. content: '';
  158. width: 116px;
  159. height: 2px;
  160. background: #761E6A;
  161. position: absolute;
  162. left: 0;
  163. bottom: 0;
  164. }
  165. }
  166. }
  167. }
  168. .query{
  169. width: 100%;
  170. padding: 16px 20px;
  171. box-sizing: border-box;
  172. background: #FFFFFF;
  173. border-radius: 6px;
  174. border: 1px solid #F3F4F6;
  175. margin-top: 31px;
  176. }
  177. .list{
  178. .l_item{
  179. margin-top: 10px;
  180. width: 100%;
  181. padding: 24px;
  182. box-sizing: border-box;
  183. background: #FFFFFF;
  184. border-radius: 6px;
  185. border: 1px solid #F3F4F6;
  186. .li_l{
  187. .li_pre{
  188. width: 335px;
  189. .lit_text{
  190. font-family: PingFang-SC, PingFang-SC;
  191. font-weight: bold;
  192. font-size: 14px;
  193. color: #252525;
  194. line-height: 14px;
  195. text-align: left;
  196. overflow: hidden;
  197. text-overflow: ellipsis;
  198. white-space: nowrap;
  199. }
  200. .lit_tip{
  201. font-family: PingFangSC, PingFang SC;
  202. font-weight: 400;
  203. font-size: 14px;
  204. color: #6B7280;
  205. line-height: 14px;
  206. text-align: left;
  207. margin-top: 16px;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. }
  214. </style>