123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- <script setup lang="ts">
- import AForm from '@/components/AForm/index.vue'
- import { FormConfigType } from '@/components/AForm/type'
- import { ToolbarConfigType } from '@/components/AToolbar/type'
- import { ColumnConfigType } from '@/components/ATable/type'
- import { StrAnyObj, StrAnyObjArr } from '@/typings'
- import { editApi, getDetailApi, getPageApi } from '@/api/business/log/userOperation'
- import { getListApi } from '@/api/system/user'
- const props = withDefaults(
- defineProps<{
- logData: StrAnyObj
- }>(),
- {
- logData: {}
- }
- )
- const queryRef = ref<InstanceType<typeof AForm>>()
- const formRef = ref<InstanceType<typeof AForm>>()
- const showQuery = ref<boolean>(true)
- const pageTotal = ref<number>(0)
- const queryData = ref<StrAnyObj>({ pageNum: 1, pageSize: 10 })
- const tableData = ref<StrAnyObjArr>([])
- const formData = ref<StrAnyObj>({})
- const dialogVisible = ref<boolean>(false)
- const queryConfig: FormConfigType[] = [
- {
- type: 'input',
- prop: 'moduleName',
- label: '操作模块'
- },
- {
- type: 'select',
- prop: 'operatorId',
- label: '操作人',
- keyName: 'id',
- labelName: 'nickname',
- async option() {
- return await getListApi()
- }
- },
- {
- type: 'select',
- prop: 'operationType',
- label: '操作类型',
- option: [
- {
- key: 2,
- label: '新增'
- },
- {
- key: 3,
- label: '修改'
- },
- {
- key: 4,
- label: '删除'
- }
- ]
- },
- {
- type: 'select',
- prop: 'auditStatus',
- label: '审核状态',
- option: [
- {
- key: 0,
- label: '待审核'
- },
- {
- key: 1,
- label: '通过'
- },
- {
- key: 2,
- label: '拒绝'
- }
- ]
- }
- ]
- const toolbarConfig: ToolbarConfigType[] = [
- {
- common: 'search',
- click() {
- queryData.value.pageNum = 1
- getPage()
- }
- },
- {
- common: 'reset',
- click() {
- queryRef.value?.resetFields()
- getPage()
- }
- }
- ]
- const columnConfig: ColumnConfigType[] = [
- {
- prop: 'moduleName',
- label: '模块标题',
- width: 140
- },
- {
- prop: 'operatorName',
- label: '操作人姓名',
- width: 140
- },
- {
- prop: 'operationType',
- label: '操作类型',
- formatter: (row) => {
- switch (row.operationType) {
- case 2:
- return '新增'
- case 3:
- return '修改'
- case 4:
- return '删除'
- }
- return ''
- },
- width: 120
- },
- {
- prop: 'createTime',
- label: '操作时间',
- width: 160
- },
- {
- prop: 'description',
- label: '操作描述'
- },
- {
- prop: 'auditStatus',
- label: '审核状态',
- formatter: (row) => {
- switch (row.auditStatus) {
- case 0:
- return '待审核'
- case 1:
- return '通过'
- case 2:
- return '拒绝'
- }
- return ''
- },
- width: 120,
- if: () => !(props.logData && props.logData.id)
- },
- {
- prop: 'auditTime',
- label: '审核时间',
- width: 160,
- if: () => !(props.logData && props.logData.id)
- },
- {
- prop: 'remark',
- label: '审核注释',
- width: 160,
- if: () => !(props.logData && props.logData.id)
- },
- {
- width: 120,
- if: () => !(props.logData && props.logData.id),
- handleConfig: [
- {
- if: (row) => row.auditStatus == 0,
- text: '审核',
- click(row) {
- dialogVisible.value = true
- getDetailApi({ id: row.id }).then((resp: StrAnyObj) => {
- formData.value = resp
- })
- }
- }
- ]
- }
- ]
- onMounted(() => {
- getPage()
- })
- function getPage() {
- if (props.logData && props.logData.id) {
- queryData.value.businessId = props.logData.id
- }
- getPageApi(queryData.value).then((resp) => {
- tableData.value = resp.records
- pageTotal.value = resp.total
- })
- }
- function formSubmit(status: boolean) {
- editApi({ ...formData.value, auditStatus: status ? 1 : 2 }).then(() => {
- dialogVisible.value = false
- ElMessage.success('操作成功')
- getPage()
- })
- }
- </script>
- <template>
- <div :style="props.logData && props.logData.id ? 'max-height: calc(100vh - 140px); overflow: hidden auto' : ''">
- <el-card v-if="showQuery">
- <a-form ref="queryRef" v-model="queryData" :config="queryConfig" :span="6"> </a-form>
- </el-card>
- <a-table
- :data="tableData"
- :page-total="pageTotal"
- :toolbar-config="toolbarConfig"
- :column-config="columnConfig"
- v-model:show-query="showQuery"
- v-model:page-num="queryData.pageNum"
- v-model:page-size="queryData.pageSize"
- @page-num-change="getPage"
- @page-size-change="getPage"
- >
- </a-table>
- <a-dialog v-model="dialogVisible" title="审核" :footer="false">
- <el-form-item label="操作描述">
- <el-input type="textarea" v-model="formData.description" disabled placeholder="操作描述" />
- </el-form-item>
- <el-form-item label="审核备注">
- <el-input type="textarea" v-model="formData.remark" placeholder="请输入审核备注" />
- </el-form-item>
- <div style="text-align: center">
- <div>
- <el-button plain type="info" @click="dialogVisible = false">关 闭</el-button>
- <el-button plain type="success" @click="formSubmit(true)">通 过</el-button>
- <el-button plain type="warning" @click="formSubmit(false)">拒 绝</el-button>
- </div>
- </div>
- </a-dialog>
- </div>
- </template>
|