generated from Leo_Ding/web-template
183 lines
5.6 KiB
Vue
183 lines
5.6 KiB
Vue
<template>
|
|
<a-row :gutter="8" :wrap="false">
|
|
<a-col flex="auto">
|
|
<a-card type="flex">
|
|
<a-table :columns="columns" :data-source="listData" bordered="true" :loading="loading"
|
|
:pagination="paginationState" @change="onTableChange">
|
|
<template #bodyCell="{ column, record }">
|
|
<template v-if="'startAt' === column.dataIndex">
|
|
<span>{{ dayjs(record.startAt).format('YYYY-MM-DD HH:mm:ss') + ' - ' +
|
|
dayjs(record.endAt).format('YYYY-MM-DD HH:mm:ss')}}</span>
|
|
</template>
|
|
<template v-if="'action' === column.key">
|
|
<x-action-button @click="auditHandleEdit(record)" v-if="record.status === 1">
|
|
<a-tooltip>
|
|
<template #title>审核</template>
|
|
<i class='iconfont icon-shenhe' style='font-size:14px;color:#faad14'></i>
|
|
</a-tooltip>
|
|
</x-action-button>
|
|
</template>
|
|
</template>
|
|
</a-table>
|
|
</a-card>
|
|
</a-col>
|
|
</a-row>
|
|
<a-modal :open="open" :title="'审核'" :width="640" title="审核" ok-text="确认" cancel-text="取消" @ok="handleAuditEdit"
|
|
@cancel="open = false">
|
|
<a-card class="mb-8-2">
|
|
<a-form-item :label="'审核'" name="">
|
|
<a-radio-group v-model:value="auditStatus"
|
|
:options="[{ value: 2, label: '通过' }, { value: 99, label: '驳回' }]"></a-radio-group>
|
|
</a-form-item>
|
|
<a-form-item :label="'备注'" name="">
|
|
<a-textarea v-model:value="remark"></a-textarea>
|
|
</a-form-item>
|
|
</a-card>
|
|
</a-modal>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { message, Modal } from 'ant-design-vue'
|
|
import { ref } from 'vue'
|
|
import apis from '@/apis'
|
|
import { config } from '@/config'
|
|
import { usePagination } from '@/hooks'
|
|
import EditDialog from './components/EditDialog.vue'
|
|
import { PlusOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
|
import { useI18n } from 'vue-i18n'
|
|
import { orderStatus } from '@/enums/index.js'
|
|
import { status } from 'nprogress'
|
|
import dayjs from 'dayjs'
|
|
defineOptions({
|
|
name: 'mettingYuYue',
|
|
})
|
|
const { t } = useI18n() // 解构出t方法
|
|
const columns = [
|
|
{ title: '用户', dataIndex: 'concatName' },
|
|
{ title: '手机号', dataIndex: 'concatPhone' },
|
|
{ title: '会议室', dataIndex: 'roomName' },
|
|
{ title: '时间段', dataIndex: 'startAt', width: 300, align: 'center' },
|
|
{ title: '备注', dataIndex: 'remark' },
|
|
{ title: t('button.action'), key: 'action', fixed: 'right', width: 100, align: 'center' },
|
|
]
|
|
const { listData, loading, showLoading, hideLoading, paginationState, resetPagination, searchFormData } = usePagination()
|
|
const remark = ref('')
|
|
const currentInfo = ref({})
|
|
const auditStatus = ref(2)
|
|
const editDialogRef = ref()
|
|
const open = ref(false)
|
|
const imgOpen = ref(false)
|
|
getPageList()
|
|
/**
|
|
* 获取用户列表
|
|
* @returns {Promise<void>}
|
|
*/
|
|
async function getPageList() {
|
|
try {
|
|
showLoading()
|
|
const { pageSize, current } = paginationState
|
|
const { success, data, total } = await apis.mettingYuYue
|
|
.getDataList({
|
|
pageSize,
|
|
current: current,
|
|
})
|
|
.catch(() => {
|
|
throw new Error()
|
|
})
|
|
hideLoading()
|
|
if (config('http.code.success') === success) {
|
|
listData.value = data.map(item => ({
|
|
...item,
|
|
key: item.value
|
|
}))
|
|
paginationState.total = total
|
|
}
|
|
} catch (error) {
|
|
hideLoading()
|
|
}
|
|
}
|
|
const auditHandleEdit = (obj = {}, type) => {
|
|
currentInfo.value = obj
|
|
if (type === 'audit') {
|
|
open.value = true
|
|
} else {
|
|
imgOpen.value = true
|
|
}
|
|
|
|
}
|
|
const handleClick = async () => {
|
|
try {
|
|
const params = {
|
|
...currentInfo.value,
|
|
status: auditStatus.value,
|
|
remark: remark.value
|
|
}
|
|
const result = await apis.mettingYuYue.updateMenu(formData.value.id, params).catch(() => {
|
|
throw new Error(error)
|
|
})
|
|
if (config('http.code.success') === result?.success) {
|
|
message.success('已审核')
|
|
open.value = false
|
|
}
|
|
} catch (error) {
|
|
message.error({ content: error.message })
|
|
hideLoading()
|
|
}
|
|
}
|
|
/**
|
|
* 删除
|
|
*/
|
|
const handleAuditEdit = async () => {
|
|
try {
|
|
const params = {
|
|
...currentForm.value,
|
|
status: auditStatus.value,
|
|
remark: remark.value
|
|
}
|
|
const result = await apis.mettingRoom.updateMenu(currentForm.value.id, params).catch(() => {
|
|
throw new Error()
|
|
})
|
|
if (config('http.code.success') === result?.success) {
|
|
getPageList()
|
|
open.value = false
|
|
message.success('审核成功')
|
|
}
|
|
} catch (error) {
|
|
message.error(error.message)
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 分页
|
|
*/
|
|
function onTableChange({ current, pageSize }) {
|
|
paginationState.current = current
|
|
paginationState.pageSize = pageSize
|
|
getPageList()
|
|
}
|
|
|
|
/**
|
|
* 搜索
|
|
*/
|
|
function handleSearch() {
|
|
resetPagination()
|
|
getPageList()
|
|
}
|
|
/**
|
|
* 重置
|
|
*/
|
|
function handleResetSearch() {
|
|
searchFormData.value = {}
|
|
resetPagination()
|
|
getPageList()
|
|
}
|
|
/**
|
|
* 编辑完成
|
|
*/
|
|
async function onOk() {
|
|
await getPageList()
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped></style>
|