7676 @changePage =" getList"
7777 v-loading =" loading"
7878 >
79- <el-table-column prop =" menu" :label =" $t('views.operateLog.table.menu.label')" width =" 160" />
79+ <el-table-column prop =" menu" :label =" $t('views.operateLog.table.menu.label')" width =" 160" >
80+ <template #header >
81+ <div >
82+ <span >{{ $t('views.operateLog.table.menu.label') }}</span >
83+ <el-popover :width =" 200" trigger =" click" :visible =" popoverVisible" >
84+ <template #reference >
85+ <el-button
86+ style =" margin-top : -2px "
87+ :type =" operateTypeArr && operateTypeArr.length > 0 ? 'primary' : ''"
88+ link
89+ @click =" popoverVisible = !popoverVisible"
90+ >
91+ <el-icon >
92+ <Filter />
93+ </el-icon >
94+ </el-button >
95+ </template >
96+ <div class =" filter" >
97+ <div class =" form-item mb-16" >
98+ <div @click.stop >
99+ <el-scrollbar height =" 300" style =" margin : 0 0 0 10px ;" >
100+ <el-checkbox-group v-model =" operateTypeArr" style =" display : flex ; flex-direction : column ;" >
101+ <el-checkbox v-for =" item in operateOptions"
102+ :key =" item.value"
103+ :label =" item.label"
104+ :value =" item.value" />
105+ </el-checkbox-group >
106+ </el-scrollbar >
107+ </div >
108+ </div >
109+ </div >
110+ <div class =" text-right" >
111+ <el-button size =" small" @click =" filterChange('clear')" >{{
112+ $t('common.clear')
113+ }}</el-button >
114+ <el-button type =" primary" @click =" filterChange" size =" small" >{{
115+ $t('common.confirm')
116+ }}</el-button >
117+ </div >
118+ </el-popover >
119+ </div >
120+ </template >
121+ </el-table-column >
80122 <el-table-column prop =" operate" :label =" $t('views.operateLog.table.operate.label')" />
81123 <el-table-column
82124 width =" 120"
119161</template >
120162<script setup lang="ts">
121163import { ref , onMounted , reactive } from ' vue'
122- import getOperateLog from ' @/api/operate-log'
164+ import operateLog from ' @/api/operate-log'
123165import DetailDialog from ' ./component/DetailDialog.vue'
124166import { t } from ' @/locales'
125167import { beforeDay , datetimeFormat , nowDate } from ' @/utils/time'
126168
169+ const popoverVisible = ref (false )
170+ const operateTypeArr = ref <any []>([])
127171const DetailDialogRef = ref ()
128172const loading = ref (false )
129173const paginationConfig = reactive ({
@@ -134,7 +178,7 @@ const paginationConfig = reactive({
134178const searchValue = ref (' ' )
135179const tableData = ref <any []>([])
136180const history_day = ref <number | string >(7 )
137- const filter_type = ref <string >(' menu ' )
181+ const filter_type = ref <string >(' user ' )
138182const filter_status = ref <string >(' ' )
139183const daterange = ref ({
140184 start_time: ' ' ,
@@ -165,14 +209,6 @@ const dayOptions = [
165209 }
166210]
167211const filterOptions = [
168- {
169- value: ' menu' ,
170- label: t (' views.operateLog.table.menu.label' )
171- },
172- {
173- value: ' operate' ,
174- label: t (' views.operateLog.table.operate.label' )
175- },
176212 {
177213 value: ' user' ,
178214 label: t (' views.operateLog.table.user.label' )
@@ -196,6 +232,15 @@ const statusOptions = [
196232 label: t (' views.operateLog.table.status.fail' )
197233 }
198234]
235+ const operateOptions = ref <any []>([])
236+
237+ function filterChange(val : string ) {
238+ if (val === ' clear' ) {
239+ operateTypeArr .value = []
240+ }
241+ getList ()
242+ popoverVisible .value = false
243+ }
199244
200245function changeStatusHandle(val : string ) {
201246 getList ()
@@ -241,15 +286,29 @@ function getList() {
241286 if (filter_type .value === ' status' ) {
242287 obj [' status' ] = filter_status .value
243288 }
244- return getOperateLog .getOperateLog (paginationConfig , obj , loading ).then ((res ) => {
289+ if (operateTypeArr .value .length > 0 ) {
290+ obj [' menu' ] = JSON .stringify (operateTypeArr .value )
291+ }
292+ return operateLog .getOperateLog (paginationConfig , obj , loading ).then ((res ) => {
245293 tableData .value = res .data .records
246294 paginationConfig .total = res .data .total
247295 })
248296}
249297
298+ function getMenuList() {
299+ return operateLog .getMenuList ().then ((res ) => {
300+ let arr: any [] = res .data
301+ arr .filter ((item , index , self ) =>
302+ index === self .findIndex ((i ) => i [' menu' ] === item [' menu' ])
303+ ).forEach (ele => {
304+ operateOptions .value .push ({label:ele .menu_label , value:ele .menu })
305+ })
306+ })
307+ }
308+
250309onMounted (() => {
310+ getMenuList ()
251311 changeDayHandle (history_day .value )
252- getList ()
253312})
254313 </script >
255314<style lang="scss" scoped>
0 commit comments