feat:【system】操作日志 100%
This commit is contained in:
@@ -21,21 +21,22 @@
|
|||||||
</view>
|
</view>
|
||||||
<view class="mb-24rpx">
|
<view class="mb-24rpx">
|
||||||
<view class="mb-12rpx text-28rpx text-[#666]">
|
<view class="mb-12rpx text-28rpx text-[#666]">
|
||||||
用户编号
|
操作人
|
||||||
</view>
|
</view>
|
||||||
<wd-input
|
<UserPicker
|
||||||
|
ref="userPickerRef"
|
||||||
v-model="formData.userId"
|
v-model="formData.userId"
|
||||||
placeholder="请输入用户编号"
|
type="radio"
|
||||||
clearable
|
placeholder="请选择操作人员"
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="mb-24rpx">
|
<view class="mb-24rpx">
|
||||||
<view class="mb-12rpx text-28rpx text-[#666]">
|
<view class="mb-12rpx text-28rpx text-[#666]">
|
||||||
操作模块类型
|
操作模块
|
||||||
</view>
|
</view>
|
||||||
<wd-input
|
<wd-input
|
||||||
v-model="formData.type"
|
v-model="formData.type"
|
||||||
placeholder="请输入操作模块类型"
|
placeholder="请输入操作模块"
|
||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
@@ -49,16 +50,6 @@
|
|||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="mb-24rpx">
|
|
||||||
<view class="mb-12rpx text-28rpx text-[#666]">
|
|
||||||
操作数据模块编号
|
|
||||||
</view>
|
|
||||||
<wd-input
|
|
||||||
v-model="formData.bizId"
|
|
||||||
placeholder="请输入操作数据模块编号"
|
|
||||||
clearable
|
|
||||||
/>
|
|
||||||
</view>
|
|
||||||
<view class="mb-24rpx">
|
<view class="mb-24rpx">
|
||||||
<view class="mb-12rpx text-28rpx text-[#666]">
|
<view class="mb-12rpx text-28rpx text-[#666]">
|
||||||
操作内容
|
操作内容
|
||||||
@@ -69,9 +60,9 @@
|
|||||||
clearable
|
clearable
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="mb-32rpx">
|
<view class="mb-24rpx">
|
||||||
<view class="mb-12rpx text-28rpx text-[#666]">
|
<view class="mb-12rpx text-28rpx text-[#666]">
|
||||||
创建时间
|
操作时间
|
||||||
</view>
|
</view>
|
||||||
<view class="flex items-center gap-16rpx">
|
<view class="flex items-center gap-16rpx">
|
||||||
<view class="flex-1" @click="visibleCreateTime[0] = true">
|
<view class="flex-1" @click="visibleCreateTime[0] = true">
|
||||||
@@ -119,6 +110,16 @@
|
|||||||
</wd-button>
|
</wd-button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="mb-32rpx">
|
||||||
|
<view class="mb-12rpx text-28rpx text-[#666]">
|
||||||
|
业务编号
|
||||||
|
</view>
|
||||||
|
<wd-input
|
||||||
|
v-model="formData.bizId"
|
||||||
|
placeholder="请输入业务编号"
|
||||||
|
clearable
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
<view class="w-full flex justify-center gap-24rpx">
|
<view class="w-full flex justify-center gap-24rpx">
|
||||||
<wd-button class="flex-1" plain @click="handleReset">
|
<wd-button class="flex-1" plain @click="handleReset">
|
||||||
重置
|
重置
|
||||||
@@ -133,6 +134,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, reactive, ref } from 'vue'
|
import { computed, reactive, ref } from 'vue'
|
||||||
|
import UserPicker from '@/pages-system/user/form/components/user-picker.vue'
|
||||||
import { formatDate, formatDateRange } from '@/utils/date'
|
import { formatDate, formatDateRange } from '@/utils/date'
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
@@ -141,35 +143,37 @@ const emit = defineEmits<{
|
|||||||
}>()
|
}>()
|
||||||
|
|
||||||
const visible = ref(false)
|
const visible = ref(false)
|
||||||
|
const userPickerRef = ref<InstanceType<typeof UserPicker>>()
|
||||||
const formData = reactive({
|
const formData = reactive({
|
||||||
userId: undefined as number | undefined,
|
userId: undefined as number | undefined,
|
||||||
type: undefined as string | undefined,
|
type: undefined as string | undefined,
|
||||||
subType: undefined as string | undefined,
|
subType: undefined as string | undefined,
|
||||||
bizId: undefined as number | undefined,
|
|
||||||
action: undefined as string | undefined,
|
action: undefined as string | undefined,
|
||||||
createTime: [undefined, undefined] as [number | undefined, number | undefined],
|
createTime: [undefined, undefined] as [number | undefined, number | undefined],
|
||||||
|
bizId: undefined as number | undefined,
|
||||||
})
|
})
|
||||||
|
|
||||||
/** 搜索条件 placeholder 拼接 */
|
/** 搜索条件 placeholder 拼接 */
|
||||||
const placeholder = computed(() => {
|
const placeholder = computed(() => {
|
||||||
const conditions: string[] = []
|
const conditions: string[] = []
|
||||||
if (formData.userId !== undefined) {
|
if (formData.userId !== undefined) {
|
||||||
conditions.push(`用户编号:${formData.userId}`)
|
const nickname = userPickerRef.value?.getUserNickname(formData.userId)
|
||||||
|
conditions.push(`操作人:${nickname || formData.userId}`)
|
||||||
}
|
}
|
||||||
if (formData.type) {
|
if (formData.type) {
|
||||||
conditions.push(`操作模块类型:${formData.type}`)
|
conditions.push(`操作模块:${formData.type}`)
|
||||||
}
|
}
|
||||||
if (formData.subType) {
|
if (formData.subType) {
|
||||||
conditions.push(`操作名:${formData.subType}`)
|
conditions.push(`操作名:${formData.subType}`)
|
||||||
}
|
}
|
||||||
if (formData.bizId !== undefined) {
|
|
||||||
conditions.push(`操作数据模块编号:${formData.bizId}`)
|
|
||||||
}
|
|
||||||
if (formData.action) {
|
if (formData.action) {
|
||||||
conditions.push(`操作内容:${formData.action}`)
|
conditions.push(`操作内容:${formData.action}`)
|
||||||
}
|
}
|
||||||
if (formData.createTime?.[0] && formData.createTime?.[1]) {
|
if (formData.createTime?.[0] && formData.createTime?.[1]) {
|
||||||
conditions.push(`创建时间:${formatDate(formData.createTime[0])}~${formatDate(formData.createTime[1])}`)
|
conditions.push(`操作时间:${formatDate(formData.createTime[0])}~${formatDate(formData.createTime[1])}`)
|
||||||
|
}
|
||||||
|
if (formData.bizId !== undefined) {
|
||||||
|
conditions.push(`业务编号:${formData.bizId}`)
|
||||||
}
|
}
|
||||||
return conditions.length > 0 ? conditions.join(' | ') : '搜索操作日志'
|
return conditions.length > 0 ? conditions.join(' | ') : '搜索操作日志'
|
||||||
})
|
})
|
||||||
@@ -178,24 +182,24 @@ const placeholder = computed(() => {
|
|||||||
const visibleCreateTime = ref<[boolean, boolean]>([false, false])
|
const visibleCreateTime = ref<[boolean, boolean]>([false, false])
|
||||||
const tempCreateTime = ref<[number, number]>([Date.now(), Date.now()])
|
const tempCreateTime = ref<[number, number]>([Date.now(), Date.now()])
|
||||||
|
|
||||||
/** 创建时间[0]确认 */
|
/** 操作时间[0]确认 */
|
||||||
function handleCreateTime0Confirm() {
|
function handleCreateTime0Confirm() {
|
||||||
formData.createTime = [tempCreateTime.value[0], formData.createTime?.[1]]
|
formData.createTime = [tempCreateTime.value[0], formData.createTime?.[1]]
|
||||||
visibleCreateTime.value[0] = false
|
visibleCreateTime.value[0] = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 创建时间[0]取消 */
|
/** 操作时间[0]取消 */
|
||||||
function handleCreateTime0Cancel() {
|
function handleCreateTime0Cancel() {
|
||||||
visibleCreateTime.value[0] = false
|
visibleCreateTime.value[0] = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 创建时间[1]确认 */
|
/** 操作时间[1]确认 */
|
||||||
function handleCreateTime1Confirm() {
|
function handleCreateTime1Confirm() {
|
||||||
formData.createTime = [formData.createTime?.[0], tempCreateTime.value[1]]
|
formData.createTime = [formData.createTime?.[0], tempCreateTime.value[1]]
|
||||||
visibleCreateTime.value[1] = false
|
visibleCreateTime.value[1] = false
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 创建时间[1]取消 */
|
/** 操作时间[1]取消 */
|
||||||
function handleCreateTime1Cancel() {
|
function handleCreateTime1Cancel() {
|
||||||
visibleCreateTime.value[1] = false
|
visibleCreateTime.value[1] = false
|
||||||
}
|
}
|
||||||
@@ -214,10 +218,12 @@ function handleReset() {
|
|||||||
formData.userId = undefined
|
formData.userId = undefined
|
||||||
formData.type = undefined
|
formData.type = undefined
|
||||||
formData.subType = undefined
|
formData.subType = undefined
|
||||||
formData.bizId = undefined
|
|
||||||
formData.action = undefined
|
formData.action = undefined
|
||||||
formData.createTime = [undefined, undefined]
|
formData.createTime = [undefined, undefined]
|
||||||
|
formData.bizId = undefined
|
||||||
visible.value = false
|
visible.value = false
|
||||||
emit('reset')
|
emit('reset')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
<wd-select-picker
|
<wd-select-picker
|
||||||
v-model="selectedId"
|
v-model="selectedId"
|
||||||
:label="label"
|
:label="label"
|
||||||
label-width="180rpx"
|
:label-width="label ? '180rpx' : '0'"
|
||||||
:columns="columns"
|
:columns="columns"
|
||||||
:type="type"
|
:type="type"
|
||||||
filterable
|
filterable
|
||||||
|
:placeholder="placeholder"
|
||||||
@confirm="handleConfirm"
|
@confirm="handleConfirm"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
@@ -19,15 +20,28 @@ const props = withDefaults(defineProps<{
|
|||||||
modelValue?: number | number[]
|
modelValue?: number | number[]
|
||||||
type?: 'radio' | 'checkbox'
|
type?: 'radio' | 'checkbox'
|
||||||
label?: string
|
label?: string
|
||||||
|
placeholder?: string
|
||||||
}>(), {
|
}>(), {
|
||||||
type: 'checkbox',
|
type: 'checkbox',
|
||||||
label: '负责人',
|
label: '',
|
||||||
|
placeholder: '请选择',
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(e: 'update:modelValue', value: number | number[] | undefined): void
|
(e: 'update:modelValue', value: number | number[] | undefined): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
/** 根据用户 ID 获取昵称 */
|
||||||
|
function getUserNickname(userId: number | undefined): string {
|
||||||
|
if (!userId) return ''
|
||||||
|
const user = userList.value.find(u => u.id === userId)
|
||||||
|
return user?.nickname || ''
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
getUserNickname,
|
||||||
|
})
|
||||||
|
|
||||||
const userList = ref<User[]>([])
|
const userList = ref<User[]>([])
|
||||||
const selectedId = ref<number | string | number[]>([])
|
const selectedId = ref<number | string | number[]>([])
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ const menuGroupsData: MenuGroup[] = [
|
|||||||
{
|
{
|
||||||
key: 'operateLog',
|
key: 'operateLog',
|
||||||
name: '操作日志',
|
name: '操作日志',
|
||||||
icon: 'notes',
|
icon: 'rootlist',
|
||||||
url: '/pages-system/operate-log/index',
|
url: '/pages-system/operate-log/index',
|
||||||
iconColor: '#722ed1',
|
iconColor: '#722ed1',
|
||||||
permission: 'system:operate-log:query',
|
permission: 'system:operate-log:query',
|
||||||
|
|||||||
Reference in New Issue
Block a user