sjy-one #3
52
yudao-admin-vue3/src/api/subscribe/organization/index.ts
Normal file
52
yudao-admin-vue3/src/api/subscribe/organization/index.ts
Normal file
@ -0,0 +1,52 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 机构 VO
|
||||
export interface OrganizationVO {
|
||||
id: number // 机构id
|
||||
name: string // 机构名称
|
||||
phone: string // 机构电话
|
||||
email: string // 机构邮箱
|
||||
picture: string // 机构图片
|
||||
address: string // 机构地址
|
||||
depict: string // 机构简介
|
||||
status: number // 状态
|
||||
}
|
||||
|
||||
// 机构 API
|
||||
export const OrganizationApi = {
|
||||
// 查询机构分页
|
||||
getOrganizationPage: async (params: any) => {
|
||||
return await request.get({ url: `/subscribe/organization/page`, params })
|
||||
},
|
||||
|
||||
// 查询机构详情
|
||||
getOrganization: async (id: number) => {
|
||||
return await request.get({ url: `/subscribe/organization/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增机构
|
||||
createOrganization: async (data: OrganizationVO) => {
|
||||
return await request.post({ url: `/subscribe/organization/create`, data })
|
||||
},
|
||||
|
||||
// 修改机构
|
||||
updateOrganization: async (data: OrganizationVO) => {
|
||||
return await request.put({ url: `/subscribe/organization/update`, data })
|
||||
},
|
||||
|
||||
// 删除机构
|
||||
deleteOrganization: async (id: number) => {
|
||||
return await request.delete({ url: `/subscribe/organization/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出机构 Excel
|
||||
exportOrganization: async (params) => {
|
||||
return await request.download({ url: `/subscribe/organization/export-excel`, params })
|
||||
},
|
||||
|
||||
// 查询机构名称数据
|
||||
getOrganizations: async () => {
|
||||
return await request.get({ url: `/subscribe/organization/getOrganization`})
|
||||
},
|
||||
|
||||
}
|
57
yudao-admin-vue3/src/api/subscribe/staff/index.ts
Normal file
57
yudao-admin-vue3/src/api/subscribe/staff/index.ts
Normal file
@ -0,0 +1,57 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 预约人员 VO
|
||||
export interface StaffVO {
|
||||
id: number // id
|
||||
organizationId: number // 机构id
|
||||
organizationName: string
|
||||
serialNumber: string // 编号
|
||||
type: number // 类型
|
||||
name: string // 名称
|
||||
sex: number // 性别
|
||||
photo: string // 照片
|
||||
phone: string // 手机号
|
||||
serviceTime: string // 服务时间段
|
||||
serviceStartTime: string
|
||||
serviceEndTime: string
|
||||
serviceScope: string // 服务范围
|
||||
sign: number // 约满标记
|
||||
status: number // 状态
|
||||
content: string // 介绍
|
||||
}
|
||||
|
||||
// 预约人员 API
|
||||
export const StaffApi = {
|
||||
// 查询预约人员分页
|
||||
getStaffPage: async (params: any) => {
|
||||
return await request.get({ url: `/subscribe/staff/page`, params })
|
||||
},
|
||||
|
||||
// 查询预约人员详情
|
||||
getStaff: async (id: number) => {
|
||||
return await request.get({ url: `/subscribe/staff/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增预约人员
|
||||
createStaff: async (data: StaffVO) => {
|
||||
return await request.post({ url: `/subscribe/staff/create`, data })
|
||||
},
|
||||
|
||||
// 修改预约人员
|
||||
updateStaff: async (data: StaffVO) => {
|
||||
return await request.put({ url: `/subscribe/staff/update`, data })
|
||||
},
|
||||
|
||||
// 删除预约人员
|
||||
deleteStaff: async (id: number) => {
|
||||
return await request.delete({ url: `/subscribe/staff/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出预约人员 Excel
|
||||
exportStaff: async (params) => {
|
||||
return await request.download({ url: `/subscribe/staff/export-excel`, params })
|
||||
},
|
||||
|
||||
|
||||
|
||||
}
|
45
yudao-admin-vue3/src/api/subscribe/subscribemanage/index.ts
Normal file
45
yudao-admin-vue3/src/api/subscribe/subscribemanage/index.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import request from '@/config/axios'
|
||||
|
||||
// 预约 VO
|
||||
export interface ManageVO {
|
||||
id: number // 表id
|
||||
userId: number // 用户id
|
||||
type: number // 预约类型
|
||||
staffId: number // 预约人员id
|
||||
subscribeTime: Date // 预约时间
|
||||
subscribeStatus: string // 预约状态
|
||||
checkStatus: number // 审核状态
|
||||
}
|
||||
|
||||
// 预约 API
|
||||
export const ManageApi = {
|
||||
// 查询预约分页
|
||||
getManagePage: async (params: any) => {
|
||||
return await request.get({ url: `/subscribe/manage/page`, params })
|
||||
},
|
||||
|
||||
// 查询预约详情
|
||||
getManage: async (id: number) => {
|
||||
return await request.get({ url: `/subscribe/manage/get?id=` + id })
|
||||
},
|
||||
|
||||
// 新增预约
|
||||
createManage: async (data: ManageVO) => {
|
||||
return await request.post({ url: `/subscribe/manage/create`, data })
|
||||
},
|
||||
|
||||
// 修改预约
|
||||
updateManage: async (data: ManageVO) => {
|
||||
return await request.put({ url: `/subscribe/manage/update`, data })
|
||||
},
|
||||
|
||||
// 删除预约
|
||||
deleteManage: async (id: number) => {
|
||||
return await request.delete({ url: `/subscribe/manage/delete?id=` + id })
|
||||
},
|
||||
|
||||
// 导出预约 Excel
|
||||
exportManage: async (params) => {
|
||||
return await request.download({ url: `/subscribe/manage/export-excel`, params })
|
||||
},
|
||||
}
|
@ -36,6 +36,7 @@ const levelOptions = ref<LevelApi.LevelVO[]>([])
|
||||
|
||||
const getList = async () => {
|
||||
levelOptions.value = await LevelApi.getSimpleLevelList()
|
||||
console.log('2222222',levelOptions.value)
|
||||
}
|
||||
|
||||
/** 初始化 */
|
||||
|
@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="机构名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入机构名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="机构电话" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="请输入机构电话" />
|
||||
</el-form-item>
|
||||
<el-form-item label="机构邮箱" prop="email">
|
||||
<el-input v-model="formData.email" placeholder="请输入机构邮箱" />
|
||||
</el-form-item>
|
||||
<el-form-item label="机构图片" prop="picture">
|
||||
<UploadImg v-model="formData.picture" />
|
||||
</el-form-item>
|
||||
<el-form-item label="机构地址" prop="address">
|
||||
<el-input v-model="formData.address" placeholder="请输入机构地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status" >
|
||||
<el-select v-model="formData.status" placeholder="请选择状态" >
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.ORGANIZATION_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="机构简介" prop="depict">
|
||||
<Editor v-model="formData.depict" height="300px" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { OrganizationApi, OrganizationVO } from '@/api/subscribe/organization'
|
||||
|
||||
/** 机构 表单 */
|
||||
defineOptions({ name: 'OrganizationForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
phone: undefined,
|
||||
email: undefined,
|
||||
picture: undefined,
|
||||
address: undefined,
|
||||
depict: undefined,
|
||||
status: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await OrganizationApi.getOrganization(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as OrganizationVO
|
||||
if (formType.value === 'create') {
|
||||
await OrganizationApi.createOrganization(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await OrganizationApi.updateOrganization(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
name: undefined,
|
||||
phone: undefined,
|
||||
email: undefined,
|
||||
picture: undefined,
|
||||
address: undefined,
|
||||
depict: undefined,
|
||||
status: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
264
yudao-admin-vue3/src/views/subscribe/organization/index.vue
Normal file
264
yudao-admin-vue3/src/views/subscribe/organization/index.vue
Normal file
@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="68px"
|
||||
>
|
||||
<el-form-item label="机构名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入机构名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="机构电话" prop="phone">
|
||||
<el-input
|
||||
v-model="queryParams.phone"
|
||||
placeholder="请输入机构电话"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="机构邮箱" prop="email">
|
||||
<el-input
|
||||
v-model="queryParams.email"
|
||||
placeholder="请输入机构邮箱"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="机构地址" prop="address">
|
||||
<el-input
|
||||
v-model="queryParams.address"
|
||||
placeholder="请输入机构地址"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.ORGANIZATION_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['subscribe:organization:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['subscribe:organization:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="机构名称" align="center" prop="name" />
|
||||
<el-table-column label="机构电话" align="center" prop="phone"/>
|
||||
<el-table-column label="机构邮箱" align="center" prop="email" />
|
||||
<el-table-column label="机构图片" align="center" prop="picture">
|
||||
<template #default="{ row }">
|
||||
<div class="flex">
|
||||
<el-image
|
||||
fit="cover"
|
||||
:src="row.picture"
|
||||
class="flex-none w-50px h-50px"
|
||||
@click="imagePreview(row.picture)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="机构地址" align="center" prop="address" />
|
||||
<el-table-column label="机构简介" align="center" prop="depict" />
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.ORGANIZATION_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['subscribe:organization:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['subscribe:organization:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<OrganizationForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { OrganizationApi, OrganizationVO } from '@/api/subscribe/organization'
|
||||
import OrganizationForm from './OrganizationForm.vue'
|
||||
import {createImageViewer} from "@/components/ImageViewer";
|
||||
|
||||
/** 机构 列表 */
|
||||
defineOptions({ name: 'Organization' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<OrganizationVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
name: undefined,
|
||||
phone: undefined,
|
||||
email: undefined,
|
||||
picture: undefined,
|
||||
address: undefined,
|
||||
depict: undefined,
|
||||
status: undefined,
|
||||
createTime: [],
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await OrganizationApi.getOrganizationPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const imagePreview = (imgUrl: string) => {
|
||||
createImageViewer({
|
||||
urlList: [imgUrl]
|
||||
})
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await OrganizationApi.deleteOrganization(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await OrganizationApi.exportOrganization(queryParams)
|
||||
download.excel(data, '机构.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
242
yudao-admin-vue3/src/views/subscribe/staff/StaffForm.vue
Normal file
242
yudao-admin-vue3/src/views/subscribe/staff/StaffForm.vue
Normal file
@ -0,0 +1,242 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="90px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<!-- <el-form-item label="所属机构" prop="organizationId">
|
||||
<el-input v-model="formData.organizationId" placeholder="请输入机构id" />
|
||||
</el-form-item> -->
|
||||
<el-form-item label="所属机构" prop="organizationId">
|
||||
<el-select
|
||||
v-model="formData.organizationId"
|
||||
placeholder="请选择机构"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="organizationNameOptions in option"
|
||||
:key="organizationNameOptions.id"
|
||||
:label="organizationNameOptions.name"
|
||||
:value="organizationNameOptions.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="编号" prop="serialNumber">
|
||||
<el-input v-model="formData.serialNumber" placeholder="请输入编号" />
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="请选择类型">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.STAFF_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="sex">
|
||||
<el-select v-model="formData.sex" placeholder="请选择性别">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.STALL_SEX)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="照片" prop="photo">
|
||||
<UploadImg v-model="formData.photo" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="formData.phone" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="服务时间段" prop="serviceTime">
|
||||
<!-- <el-date-picker
|
||||
v-model="formData.serviceTime"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择服务时间段"
|
||||
/> -->
|
||||
<el-col :span="11">
|
||||
<el-time-select
|
||||
placeholder="起始时间"
|
||||
v-model="formData.serviceStartTime"
|
||||
:picker-options="{
|
||||
start: '08:30',
|
||||
step: '00:15',
|
||||
end: '18:30'
|
||||
}"/>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div style="text-align: center;">-</div>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<el-time-select
|
||||
placeholder="结束时间"
|
||||
v-model="formData.serviceEndTime"
|
||||
:picker-options="{
|
||||
start: '08:30',
|
||||
step: '00:15',
|
||||
end: '18:30',
|
||||
minTime: formData.serviceStartTime
|
||||
}"/>
|
||||
</el-col>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="服务范围" prop="serviceScope">
|
||||
<el-input v-model="formData.serviceScope" placeholder="请输入服务范围" />
|
||||
</el-form-item>
|
||||
<el-form-item label="约满标记" prop="sign">
|
||||
<el-select v-model="formData.sign" placeholder="请选择约满标记">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.STAFF_FULL)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="formData.status" placeholder="请选择状态">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.STAFF_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="介绍" prop="content">
|
||||
<Editor v-model="formData.content" height="300px" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { StaffApi, StaffVO } from '@/api/subscribe/staff'
|
||||
import { OrganizationApi, OrganizationVO } from '@/api/subscribe/organization'
|
||||
|
||||
/** 预约人员 表单 */
|
||||
defineOptions({ name: 'StaffForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
const option = ref<OrganizationVO[]>([]);
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
organizationId: undefined,
|
||||
serialNumber: undefined,
|
||||
type: undefined,
|
||||
name: undefined,
|
||||
sex: undefined,
|
||||
photo: undefined,
|
||||
phone: undefined,
|
||||
serviceTime: undefined,
|
||||
serviceStartTime: undefined,
|
||||
serviceEndTime: undefined,
|
||||
serviceScope: undefined,
|
||||
sign: undefined,
|
||||
status: undefined,
|
||||
content: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
//初始化机构名称下拉框
|
||||
const getOrganizations = async () => {
|
||||
|
||||
try {
|
||||
option.value = await OrganizationApi.getOrganizations()
|
||||
} finally {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await StaffApi.getStaff(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as StaffVO
|
||||
if (formType.value === 'create') {
|
||||
await StaffApi.createStaff(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await StaffApi.updateStaff(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
organizationId: undefined,
|
||||
serialNumber: undefined,
|
||||
type: undefined,
|
||||
name: undefined,
|
||||
sex: undefined,
|
||||
photo: undefined,
|
||||
phone: undefined,
|
||||
serviceTime: undefined,
|
||||
serviceStartTime: undefined,
|
||||
serviceEndTime: undefined,
|
||||
serviceScope: undefined,
|
||||
sign: undefined,
|
||||
status: undefined,
|
||||
content: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getOrganizations()
|
||||
})
|
||||
|
||||
</script>
|
372
yudao-admin-vue3/src/views/subscribe/staff/index.vue
Normal file
372
yudao-admin-vue3/src/views/subscribe/staff/index.vue
Normal file
@ -0,0 +1,372 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="所属机构" prop="organizationId">
|
||||
<el-select
|
||||
v-model="queryParams.organizationId"
|
||||
placeholder="请选择机构"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="organizationNameOptions in option"
|
||||
:key="organizationNameOptions.id"
|
||||
:label="organizationNameOptions.name"
|
||||
:value="organizationNameOptions.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="编号" prop="serialNumber">
|
||||
<el-input
|
||||
v-model="queryParams.serialNumber"
|
||||
placeholder="请输入编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型" prop="type">
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
placeholder="请选择类型"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.STAFF_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input
|
||||
v-model="queryParams.name"
|
||||
placeholder="请输入名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="性别" prop="sex">
|
||||
<el-select
|
||||
v-model="queryParams.sex"
|
||||
placeholder="请选择性别"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.STALL_SEX)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input
|
||||
v-model="queryParams.phone"
|
||||
placeholder="请输入手机号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="服务时间段" prop="serviceTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.serviceTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="服务范围" prop="serviceScope">
|
||||
<el-input
|
||||
v-model="queryParams.serviceScope"
|
||||
placeholder="请输入服务范围"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="约满标记" prop="sign">
|
||||
<el-select
|
||||
v-model="queryParams.sign"
|
||||
placeholder="请选择约满标记"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.STAFF_FULL)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select
|
||||
v-model="queryParams.status"
|
||||
placeholder="请选择状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.STAFF_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['subscribe:staff:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['subscribe:staff:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="所属机构" align="center" prop="organizationName" />
|
||||
<el-table-column label="编号" align="center" prop="serialNumber" />
|
||||
<el-table-column label="类型" align="center" prop="type" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.STAFF_TYPE" :value="scope.row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="名称" align="center" prop="name" />
|
||||
<el-table-column label="性别" align="center" prop="sex">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.STALL_SEX" :value="scope.row.sex" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="照片" align="center" prop="photo">
|
||||
<template #default="{ row }">
|
||||
<div class="flex">
|
||||
<el-image
|
||||
fit="cover"
|
||||
:src="row.photo"
|
||||
class="flex-none w-50px h-50px"
|
||||
@click="imagePreview(row.photo)"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="手机号" align="center" prop="phone" />
|
||||
<el-table-column label="服务时间段" align="center" prop="serviceTime" width="100" />
|
||||
<el-table-column label="服务范围" align="center" prop="serviceScope" :formatter="dateFormatter"/>
|
||||
<el-table-column label="约满标记" align="center" prop="sign" width="100">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.STAFF_FULL" :value="scope.row.sign" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.STAFF_STATUS" :value="scope.row.status" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="介绍" align="center" prop="content" />
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center" fixed="right" width="110">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['subscribe:staff:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['subscribe:staff:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<StaffForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { StaffApi, StaffVO } from '@/api/subscribe/staff'
|
||||
import StaffForm from './StaffForm.vue'
|
||||
import {createImageViewer} from "@/components/ImageViewer";
|
||||
import { OrganizationApi, OrganizationVO } from '@/api/subscribe/organization'
|
||||
|
||||
/** 预约人员 列表 */
|
||||
defineOptions({ name: 'Staff' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<StaffVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const option = ref<OrganizationVO[]>([]);
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
organizationId: undefined,
|
||||
serialNumber: undefined,
|
||||
type: undefined,
|
||||
name: undefined,
|
||||
sex: undefined,
|
||||
photo: undefined,
|
||||
phone: undefined,
|
||||
serviceTime: [],
|
||||
serviceScope: undefined,
|
||||
sign: undefined,
|
||||
status: undefined,
|
||||
content: undefined,
|
||||
createTime: [],
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await StaffApi.getStaffPage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
//初始化机构名称下拉框
|
||||
const getOrganization = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
option.value = await OrganizationApi.getOrganizations()
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
const imagePreview = (imgUrl: string) => {
|
||||
createImageViewer({
|
||||
urlList: [imgUrl]
|
||||
})
|
||||
}
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await StaffApi.deleteStaff(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await StaffApi.exportStaff(queryParams)
|
||||
download.excel(data, '预约人员.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
getOrganization()
|
||||
})
|
||||
</script>
|
@ -0,0 +1,138 @@
|
||||
<template>
|
||||
<Dialog :title="dialogTitle" v-model="dialogVisible">
|
||||
<el-form
|
||||
ref="formRef"
|
||||
:model="formData"
|
||||
:rules="formRules"
|
||||
label-width="100px"
|
||||
v-loading="formLoading"
|
||||
>
|
||||
<el-form-item label="用户id" prop="userId">
|
||||
<el-input v-model="formData.userId" placeholder="请输入用户id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预约类型" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="请选择预约类型">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.SUBSCRIBE_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="预约人员id" prop="staffId">
|
||||
<el-input v-model="formData.staffId" placeholder="请输入预约人员id" />
|
||||
</el-form-item>
|
||||
<el-form-item label="预约时间" prop="subscribeTime">
|
||||
<el-date-picker
|
||||
v-model="formData.subscribeTime"
|
||||
type="date"
|
||||
value-format="x"
|
||||
placeholder="选择预约时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="预约状态" prop="subscribeStatus">
|
||||
<el-radio-group v-model="formData.subscribeStatus">
|
||||
<el-radio label="1">请选择字典生成</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态" prop="checkStatus">
|
||||
<el-select v-model="formData.checkStatus" placeholder="请选择审核状态">
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.SUBSCRIBE_CHECK_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
|
||||
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||
</template>
|
||||
</Dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { ManageApi, ManageVO } from '@/api/subscribe/subscribemanage'
|
||||
|
||||
/** 预约 表单 */
|
||||
defineOptions({ name: 'ManageForm' })
|
||||
|
||||
const { t } = useI18n() // 国际化
|
||||
const message = useMessage() // 消息弹窗
|
||||
|
||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||
const dialogTitle = ref('') // 弹窗的标题
|
||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
|
||||
const formData = ref({
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
type: undefined,
|
||||
staffId: undefined,
|
||||
subscribeTime: undefined,
|
||||
subscribeStatus: undefined,
|
||||
checkStatus: undefined,
|
||||
})
|
||||
const formRules = reactive({
|
||||
})
|
||||
const formRef = ref() // 表单 Ref
|
||||
|
||||
/** 打开弹窗 */
|
||||
const open = async (type: string, id?: number) => {
|
||||
dialogVisible.value = true
|
||||
dialogTitle.value = t('action.' + type)
|
||||
formType.value = type
|
||||
resetForm()
|
||||
// 修改时,设置数据
|
||||
if (id) {
|
||||
formLoading.value = true
|
||||
try {
|
||||
formData.value = await ManageApi.getManage(id)
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
}
|
||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||
|
||||
/** 提交表单 */
|
||||
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
||||
const submitForm = async () => {
|
||||
// 校验表单
|
||||
await formRef.value.validate()
|
||||
// 提交请求
|
||||
formLoading.value = true
|
||||
try {
|
||||
const data = formData.value as unknown as ManageVO
|
||||
if (formType.value === 'create') {
|
||||
await ManageApi.createManage(data)
|
||||
message.success(t('common.createSuccess'))
|
||||
} else {
|
||||
await ManageApi.updateManage(data)
|
||||
message.success(t('common.updateSuccess'))
|
||||
}
|
||||
dialogVisible.value = false
|
||||
// 发送操作成功的事件
|
||||
emit('success')
|
||||
} finally {
|
||||
formLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 重置表单 */
|
||||
const resetForm = () => {
|
||||
formData.value = {
|
||||
id: undefined,
|
||||
userId: undefined,
|
||||
type: undefined,
|
||||
staffId: undefined,
|
||||
subscribeTime: undefined,
|
||||
subscribeStatus: undefined,
|
||||
checkStatus: undefined,
|
||||
}
|
||||
formRef.value?.resetFields()
|
||||
}
|
||||
</script>
|
273
yudao-admin-vue3/src/views/subscribe/subscribemanage/index.vue
Normal file
273
yudao-admin-vue3/src/views/subscribe/subscribemanage/index.vue
Normal file
@ -0,0 +1,273 @@
|
||||
<template>
|
||||
<ContentWrap>
|
||||
<!-- 搜索工作栏 -->
|
||||
<el-form
|
||||
class="-mb-15px"
|
||||
:model="queryParams"
|
||||
ref="queryFormRef"
|
||||
:inline="true"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-form-item label="用户" prop="userId">
|
||||
<el-input
|
||||
v-model="queryParams.userId"
|
||||
placeholder="请输入用户"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="预约类型" prop="type">
|
||||
<el-select
|
||||
v-model="queryParams.type"
|
||||
placeholder="请选择预约类型"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.SUBSCRIBE_TYPE)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="预约人员" prop="staffName">
|
||||
<el-input
|
||||
v-model="queryParams.staffName"
|
||||
placeholder="请输入预约人员"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="预约时间" prop="subscribeTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.subscribeTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="预约状态" prop="subscribeStatus">
|
||||
<el-select
|
||||
v-model="queryParams.subscribeStatus"
|
||||
placeholder="请选择预约状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option label="请选择字典生成" value="" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="审核状态" prop="checkStatus">
|
||||
<el-select
|
||||
v-model="queryParams.checkStatus"
|
||||
placeholder="请选择审核状态"
|
||||
clearable
|
||||
class="!w-240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="dict in getIntDictOptions(DICT_TYPE.SUBSCRIBE_CHECK_STATUS)"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<el-date-picker
|
||||
v-model="queryParams.createTime"
|
||||
value-format="YYYY-MM-DD HH:mm:ss"
|
||||
type="daterange"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
:default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
|
||||
class="!w-240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
|
||||
<el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
@click="openForm('create')"
|
||||
v-hasPermi="['subscribe:manage:create']"
|
||||
>
|
||||
<Icon icon="ep:plus" class="mr-5px" /> 新增
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
@click="handleExport"
|
||||
:loading="exportLoading"
|
||||
v-hasPermi="['subscribe:manage:export']"
|
||||
>
|
||||
<Icon icon="ep:download" class="mr-5px" /> 导出
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 列表 -->
|
||||
<ContentWrap>
|
||||
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table-column label="ID" align="center" prop="id" />
|
||||
<el-table-column label="用户" align="center" prop="userId" />
|
||||
<el-table-column label="预约类型" align="center" prop="type">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SUBSCRIBE_TYPE" :value="scope.row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="预约人员" align="center" prop="staffId" />
|
||||
<el-table-column
|
||||
label="预约时间"
|
||||
align="center"
|
||||
prop="subscribeTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="预约状态" align="center" prop="subscribeStatus" />
|
||||
<el-table-column label="审核状态" align="center" prop="checkStatus">
|
||||
<template #default="scope">
|
||||
<dict-tag :type="DICT_TYPE.SUBSCRIBE_CHECK_STATUS" :value="scope.row.checkStatus" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
label="创建时间"
|
||||
align="center"
|
||||
prop="createTime"
|
||||
:formatter="dateFormatter"
|
||||
width="180px"
|
||||
/>
|
||||
<el-table-column label="操作" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
@click="openForm('update', scope.row.id)"
|
||||
v-hasPermi="['subscribe:manage:update']"
|
||||
>
|
||||
编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="danger"
|
||||
@click="handleDelete(scope.row.id)"
|
||||
v-hasPermi="['subscribe:manage:delete']"
|
||||
>
|
||||
删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!-- 分页 -->
|
||||
<Pagination
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNo"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</ContentWrap>
|
||||
|
||||
<!-- 表单弹窗:添加/修改 -->
|
||||
<ManageForm ref="formRef" @success="getList" />
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
|
||||
import { dateFormatter } from '@/utils/formatTime'
|
||||
import download from '@/utils/download'
|
||||
import { ManageApi, ManageVO } from '@/api/subscribe/subscribemanage'
|
||||
import ManageForm from './ManageForm.vue'
|
||||
|
||||
/** 预约 列表 */
|
||||
defineOptions({ name: 'SubscribeManage' })
|
||||
|
||||
const message = useMessage() // 消息弹窗
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
const loading = ref(true) // 列表的加载中
|
||||
const list = ref<ManageVO[]>([]) // 列表的数据
|
||||
const total = ref(0) // 列表的总页数
|
||||
const queryParams = reactive({
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
userId: undefined,
|
||||
type: undefined,
|
||||
staffId: undefined,
|
||||
staffName: undefined,
|
||||
subscribeTime: [],
|
||||
subscribeStatus: undefined,
|
||||
checkStatus: undefined,
|
||||
createTime: [],
|
||||
})
|
||||
const queryFormRef = ref() // 搜索的表单
|
||||
const exportLoading = ref(false) // 导出的加载中
|
||||
|
||||
/** 查询列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true
|
||||
try {
|
||||
const data = await ManageApi.getManagePage(queryParams)
|
||||
list.value = data.list
|
||||
total.value = data.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.pageNo = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value.resetFields()
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
/** 添加/修改操作 */
|
||||
const formRef = ref()
|
||||
const openForm = (type: string, id?: number) => {
|
||||
formRef.value.open(type, id)
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (id: number) => {
|
||||
try {
|
||||
// 删除的二次确认
|
||||
await message.delConfirm()
|
||||
// 发起删除
|
||||
await ManageApi.deleteManage(id)
|
||||
message.success(t('common.delSuccess'))
|
||||
// 刷新列表
|
||||
await getList()
|
||||
} catch {}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = async () => {
|
||||
try {
|
||||
// 导出的二次确认
|
||||
await message.exportConfirm()
|
||||
// 发起导出
|
||||
exportLoading.value = true
|
||||
const data = await ManageApi.exportManage(queryParams)
|
||||
download.excel(data, '预约.xls')
|
||||
} catch {
|
||||
} finally {
|
||||
exportLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
/** 初始化 **/
|
||||
onMounted(() => {
|
||||
getList()
|
||||
})
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user