Merge pull request '预约模块添加预约项目管理' (#57) from sjy-two into master
Some checks failed
continuous-integration/drone/push Build is failing

Reviewed-on: #57
This commit is contained in:
root 2024-10-21 15:52:50 +08:00
commit 9d57571165
25 changed files with 1182 additions and 511 deletions

View File

@ -0,0 +1,51 @@
import request from '@/config/axios'
// 预约项目 VO
export interface ProjectVO {
id: number // ID
brandId: number // 所属门店
name: string // 项目名称
pictrue: string // 项目图片
content: string // 项目简介
status: number // 状态
timeInterval: string // 可预约日期
brandName: string
}
// 预约项目 API
export const ProjectApi = {
// 查询预约项目分页
getProjectPage: async (params: any) => {
return await request.get({ url: `/subscribe/project/page`, params })
},
// 查询预约项目详情
getProject: async (id: number) => {
return await request.get({ url: `/subscribe/project/get?id=` + id })
},
// 新增预约项目
createProject: async (data: ProjectVO) => {
return await request.post({ url: `/subscribe/project/create`, data })
},
// 修改预约项目
updateProject: async (data: ProjectVO) => {
return await request.put({ url: `/subscribe/project/update`, data })
},
// 删除预约项目
deleteProject: async (id: number) => {
return await request.delete({ url: `/subscribe/project/delete?id=` + id })
},
// 导出预约项目 Excel
exportProject: async (params) => {
return await request.download({ url: `/subscribe/project/export-excel`, params })
},
getProjectName: async () => {
return await request.get({ url: `/subscribe/project/getProjectName` })
},
}

View File

@ -3,16 +3,11 @@ import request from '@/config/axios'
// 人员管理 VO
export interface LitemallTechnicianVO {
id: number // id
techSn: string // 人员编号
type: number // 人员类型
technicianName: string // 人员名称
brandId: number // 门店id
brandName: string
sex: number // 性别
projectId: number // 项目id
brandName: string //项目名称
photo: string // 照片
serviceTime: string // 服务时间段
serviceScope: string // 服务范围
phone: string // 手机号
ym: number // 约满标记
status: number // 状态
content: string // 介绍

View File

@ -123,7 +123,9 @@ export enum DICT_TYPE {
TYPES = 'types',
TECHNICIAN_STATUS = 'technician_status',
SEX = 'sex',
//预约:项目
SUBSCRIBE_PROJECT_STATUS = 'subscribe_project_status',
//预约:人员管理
STALL_SEX = 'stall_sex',

View File

@ -96,6 +96,8 @@ const open = async (type: string, id?: number) => {
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {

View File

@ -0,0 +1,161 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="50%">
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-width="100px"
v-loading="formLoading"
>
<el-form-item label="门店" prop="brandId">
<!-- <el-input v-model="formData.brandId" placeholder="请输入门店id" />-->
<el-select v-model="formData.brandId" 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="name">
<el-input v-model="formData.name" placeholder="请输入项目名称" />
</el-form-item>
<el-form-item label="项目图片" prop="pictrue">
<UploadImg v-model="formData.pictrue" />
</el-form-item>
<el-form-item label="项目简介" prop="content">
<Editor v-model="formData.content" height="150px" />
</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.SUBSCRIBE_PROJECT_STATUS)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="可预约日期" prop="timeInterval">
<!-- <el-input v-model="formData.timeInterval" placeholder="请输入可预约日期" /> -->
<el-date-picker
v-model="formData.timeInterval"
type="daterange"
start-placeholder="开始日期"
end-placeholder="结束日期"
/>
</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 { ProjectApi, ProjectVO } from '@/api/subscribe/project'
import { LitemallBrandApi, LitemallBrandVO } from '@/api/subscribe/brand'
/** 预约项目 表单 */
defineOptions({ name: 'ProjectForm' })
const { t } = useI18n() //
const message = useMessage() //
const option = ref<LitemallBrandVO[]>([]);
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
brandId: undefined,
name: undefined,
pictrue: undefined,
content: undefined,
status: undefined,
timeInterval: '',
})
const formRules = reactive({
brandId: [{ required: true, message: '所属门店不能为空', trigger: 'blur' }],
name: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }],
pictrue: [{ required: true, message: '项目图片不能为空', trigger: 'blur' }],
status: [{ required: true, message: '状态不能为空', trigger: 'change' }],
timeInterval: [{ required: true, message: '可预约日期不能为空', trigger: 'blur' }]
})
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 ProjectApi.getProject(id)
formData.value.timeInterval = JSON.parse(formData.value.timeInterval)
console.log('11111111111',formData.value)
} finally {
formLoading.value = false
}
}
}
defineExpose({ open }) // open
/** 提交表单 */
const emit = defineEmits(['success']) // success
const submitForm = async () => {
formData.value.timeInterval = JSON.stringify(formData.value.timeInterval);
//
await formRef.value.validate()
//
formLoading.value = true
try {
const data = formData.value as unknown as ProjectVO
if (formType.value === 'create') {
await ProjectApi.createProject(data)
message.success(t('common.createSuccess'))
} else {
await ProjectApi.updateProject(data)
message.success(t('common.updateSuccess'))
}
dialogVisible.value = false
//
emit('success')
} finally {
formLoading.value = false
}
}
//
const getOrganizations = async () => {
try {
option.value = await LitemallBrandApi.getOrganizations()
} finally {
}
}
/** 重置表单 */
const resetForm = () => {
formData.value = {
id: undefined,
brandId: undefined,
name: undefined,
pictrue: undefined,
content: undefined,
status: undefined,
timeInterval: '',
}
formRef.value?.resetFields()
}
/** 初始化 **/
onMounted(() => {
getOrganizations()
})
</script>

View File

@ -0,0 +1,209 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
<el-form-item label="所属门店" prop="brandId">
<el-select v-model="queryParams.brandId" 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="name">
<el-input v-model="queryParams.name" 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.SUBSCRIBE_PROJECT_STATUS)" :key="dict.value"
:label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="可预约日期" prop="timeInterval">
<el-input v-model="queryParams.timeInterval" placeholder="请输入可预约日期" clearable @keyup.enter="handleQuery"
class="!w-240px" />
</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:project:create']">
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button type="success" plain @click="handleExport" :loading="exportLoading"
v-hasPermi="['subscribe:project: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="brandName" />
<el-table-column label="项目名称" align="center" prop="name" />
<!-- <el-table-column label="项目图片" align="center" prop="pictrue" /> -->
<el-table-column label="照片" align="center" prop="pictrue">
<template #default="{ row }">
<div class="flex" style="display: flex; align-items: center;">
<el-image fit="cover" :src="row.pictrue" class="flex-none w-50px h-50px"
@click="imagePreview(row.pictrue)" />
</div>
</template>
</el-table-column>
<!-- <el-table-column label="项目简介" align="center" prop="content" /> -->
<el-table-column label="介绍" align="center" prop="content">
<template #default="scope">
<div v-html="scope.row.content"></div>
</template>
</el-table-column>
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.SUBSCRIBE_PROJECT_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="可预约日期" align="center" prop="timeInterval" />
<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:project:update']">
编辑
</el-button>
<el-button link type="danger" @click="handleDelete(scope.row.id)"
v-hasPermi="['subscribe:project: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>
<!-- 表单弹窗添加/修改 -->
<ProjectForm 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 { ProjectApi, ProjectVO } from '@/api/subscribe/project'
import ProjectForm from './ProjectForm.vue'
import { LitemallBrandApi, LitemallBrandVO } from '@/api/subscribe/brand'
/** 预约项目 列表 */
defineOptions({ name: 'Project' })
const message = useMessage() //
const { t } = useI18n() //
const option = ref<LitemallBrandVO[]>([]);
const loading = ref(true) //
const list = ref<ProjectVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
brandId: undefined,
name: undefined,
pictrue: undefined,
content: undefined,
status: undefined,
timeInterval: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await ProjectApi.getProjectPage(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 getOrganization = async () => {
loading.value = true
try {
option.value = await LitemallBrandApi.getOrganizations()
} finally {
loading.value = false
}
}
const imagePreview = (imgUrl : string) => {
createImageViewer({
urlList: [imgUrl]
})
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
try {
//
await message.delConfirm()
//
await ProjectApi.deleteProject(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await ProjectApi.exportProject(queryParams)
download.excel(data, '预约项目.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
getOrganization()
})
</script>

View File

@ -141,7 +141,7 @@
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="用户" align="center" prop="nickname" />
<el-table-column label="预约类型" align="center" prop="type">
<template #default="scope">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TYPE" :value="scope.row.type" />
</template>
</el-table-column>

View File

@ -1,31 +1,14 @@
<template>
<Dialog :title="dialogTitle" v-model="dialogVisible" width="800px">
<el-form ref="formRef" :model="formData" :rules="formRules" label-width="100px" v-loading="formLoading">
<!-- <el-form-item label="人员编号" prop="techSn">-->
<!-- <el-input v-model="formData.techSn" 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.TYPES)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="人员名称" prop="technicianName">
<el-input v-model="formData.technicianName" placeholder="请输入人员名称" />
</el-form-item>
<el-form-item label="门店" prop="brandId">
<!-- <el-input v-model="formData.brandId" placeholder="请输入门店id" />-->
<el-select v-model="formData.brandId" placeholder="请选择门店" clearable class="!w-240px">
<el-form-item label="项目" prop="projectId">
<el-select v-model="formData.projectId" 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="sex">
<el-select v-model="formData.sex" placeholder="请选择性别">
<el-option v-for="dict in getIntDictOptions(DICT_TYPE.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>
@ -52,12 +35,7 @@
<el-form-item label="服务范围" prop="serviceScope">
<el-input v-model="formData.serviceScope" 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="ym">-->
<!-- <el-input v-model="formData.ym" 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.TECHNICIAN_STATUS)" :key="dict.value"
@ -80,30 +58,24 @@
<script setup lang="ts">
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { LitemallTechnicianApi, LitemallTechnicianVO } from '@/api/subscribe/technician'
import { LitemallBrandApi, LitemallBrandVO } from '@/api/subscribe/brand'
import { ProjectApi, ProjectVO } from '@/api/subscribe/project'
/** 人员管理 表单 */
defineOptions({ name: 'LitemallTechnicianForm' })
const { t } = useI18n() //
const message = useMessage() //
const option = ref<LitemallBrandVO[]>([]);
const option = ref<ProjectVO[]>([]);
const dialogVisible = ref(false) //
const dialogTitle = ref('') //
const formLoading = ref(false) // 12
const formType = ref('') // create - update -
const formData = ref({
id: undefined,
// techSn: undefined,
type: undefined,
technicianName: undefined,
brandId: undefined,
sex: undefined,
projectId: undefined,
photo: undefined,
serviceTime: '',
serviceTimeArray: [{}],
serviceScope: undefined,
phone: undefined,
// ym: undefined,
status: undefined,
content: undefined,
remark: undefined,
@ -130,9 +102,9 @@
};
//
const getOrganizations = async () => {
const getProjectName = async () => {
try {
option.value = await LitemallBrandApi.getOrganizations()
option.value = await ProjectApi.getProjectName()
} finally {
}
@ -195,16 +167,10 @@
const resetForm = () => {
formData.value = {
id: undefined,
// techSn: undefined,
type: undefined,
technicianName: undefined,
brandId: undefined,
sex: undefined,
projectId: undefined,
photo: undefined,
serviceTime: '',
serviceScope: undefined,
phone: undefined,
// ym: undefined,
status: undefined,
content: undefined,
remark: undefined,
@ -215,7 +181,7 @@
/** 初始化 **/
onMounted(() => {
getOrganizations()
getProjectName()
})
</script>
<style>

View File

@ -1,372 +1,240 @@
<template>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class="-mb-15px"
:model="queryParams"
ref="queryFormRef"
:inline="true"
label-width="68px"
>
<el-form-item label="人员编号" prop="techSn">
<el-input
v-model="queryParams.techSn"
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.TYPES)"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="人员名称" prop="technicianName">
<el-input
v-model="queryParams.technicianName"
placeholder="请输入人员名称"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<el-form-item label="所属门店" prop="brandId">
<!-- <el-input-->
<!-- v-model="queryParams.brandId"-->
<!-- placeholder="请输入门店id"-->
<!-- clearable-->
<!-- @keyup.enter="handleQuery"-->
<!-- class="!w-240px"-->
<!-- />-->
<el-select
v-model="queryParams.brandId"
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="sex">-->
<!-- <el-select-->
<!-- v-model="queryParams.sex"-->
<!-- placeholder="请选择性别"-->
<!-- clearable-->
<!-- class="!w-240px"-->
<!-- >-->
<!-- <el-option-->
<!-- v-for="dict in getIntDictOptions(DICT_TYPE.SEX)"-->
<!-- :key="dict.value"-->
<!-- :label="dict.label"-->
<!-- :value="dict.value"-->
<!-- />-->
<!-- </el-select>-->
<!-- </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="phone">
<el-input
v-model="queryParams.phone"
placeholder="请输入手机号"
clearable
@keyup.enter="handleQuery"
class="!w-240px"
/>
</el-form-item>
<!-- <el-form-item label="约满标记" prop="ym">-->
<!-- <el-input-->
<!-- v-model="queryParams.ym"-->
<!-- 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.TECHNICIAN_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>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="68px">
<!-- <el-form-item label="人员编号" prop="techSn">
<el-input v-model="queryParams.techSn" 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.TYPES)" :key="dict.value" :label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="人员名称" prop="technicianName">
<el-input v-model="queryParams.technicianName" placeholder="请输入人员名称" clearable
@keyup.enter="handleQuery" class="!w-240px" />
</el-form-item> -->
<el-form-item label="所属门店" prop="brandId">
<el-select v-model="queryParams.brandId" 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="phone">
<el-input v-model="queryParams.phone" placeholder="请输入手机号" clearable @keyup.enter="handleQuery"
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:litemall-technician:create']"
>
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button
type="success"
plain
@click="handleExport"
:loading="exportLoading"
v-hasPermi="['subscribe:litemall-technician:export']"
>
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<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.TECHNICIAN_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>
<!-- 列表 -->
<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="techSn" />
<el-table-column label="人员类型" align="center" prop="type">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TYPES" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="人员名称" align="center" prop="technicianName" />
<el-table-column label="门店" align="center" prop="brandName" />
<el-table-column label="性别" align="center" prop="sex">
<template #default="scope">
<dict-tag :type="DICT_TYPE.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="serviceTimeArray" width="200" />
<el-table-column label="服务范围" align="center" prop="serviceScope" />
<el-table-column label="手机号" align="center" prop="phone" />
<el-table-column label="约满标记" align="center" prop="ym" />
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TECHNICIAN_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="介绍" align="center" prop="content" >
<template #default="scope">
<div v-html="scope.row.content"></div>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<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:litemall-technician:update']"
>
编辑
</el-button>
<el-button
link
type="danger"
@click="handleDelete(scope.row.id)"
v-hasPermi="['subscribe:litemall-technician: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>
<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:litemall-technician:create']">
<Icon icon="ep:plus" class="mr-5px" /> 新增
</el-button>
<el-button type="success" plain @click="handleExport" :loading="exportLoading"
v-hasPermi="['subscribe:litemall-technician:export']">
<Icon icon="ep:download" class="mr-5px" /> 导出
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 表单弹窗添加/修改 -->
<LitemallTechnicianForm ref="formRef" @success="getList" />
<!-- 列表 -->
<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="techSn" />
<el-table-column label="人员类型" align="center" prop="type">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TYPES" :value="scope.row.type" />
</template>
</el-table-column>
<el-table-column label="人员名称" align="center" prop="technicianName" /> -->
<el-table-column label="归属项目" align="center" prop="brandName" />
<!-- <el-table-column label="性别" align="center" prop="sex">
<template #default="scope">
<dict-tag :type="DICT_TYPE.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="serviceTimeArray" width="200" />
<el-table-column label="服务范围" align="center" prop="serviceScope" />
<el-table-column label="约满标记" align="center" prop="ym" />
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :type="DICT_TYPE.TECHNICIAN_STATUS" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="介绍" align="center" prop="content">
<template #default="scope">
<div v-html="scope.row.content"></div>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<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:litemall-technician:update']">
编辑
</el-button>
<el-button link type="danger" @click="handleDelete(scope.row.id)"
v-hasPermi="['subscribe:litemall-technician: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>
<!-- 表单弹窗添加/修改 -->
<LitemallTechnicianForm 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 { LitemallTechnicianApi, LitemallTechnicianVO } from '@/api/subscribe/technician'
import LitemallTechnicianForm from './LitemallTechnicianForm.vue'
import {createImageViewer} from "@/components/ImageViewer";
import { LitemallBrandApi, LitemallBrandVO } from '@/api/subscribe/brand'
/** 人员管理 列表 */
defineOptions({ name: 'LitemallTechnician' })
import { getIntDictOptions, DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import download from '@/utils/download'
import { LitemallTechnicianApi, LitemallTechnicianVO } from '@/api/subscribe/technician'
import LitemallTechnicianForm from './LitemallTechnicianForm.vue'
import { createImageViewer } from "@/components/ImageViewer";
import { ProjectApi, ProjectVO } from '@/api/subscribe/project'
/** 人员管理 列表 */
defineOptions({ name: 'LitemallTechnician' })
const message = useMessage() //
const { t } = useI18n() //
const option = ref<LitemallBrandVO[]>([]);
const loading = ref(true) //
const list = ref<LitemallTechnicianVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
techSn: undefined,
type: undefined,
technicianName: undefined,
brandId: undefined,
sex: undefined,
photo: undefined,
serviceTime: [],
serviceScope: undefined,
phone: undefined,
ym: undefined,
status: undefined,
content: undefined,
remark: undefined,
createTime: [],
const message = useMessage() //
const { t } = useI18n() //
const option = ref<ProjectVO[]>([]);
const loading = ref(true) //
const list = ref<LitemallTechnicianVO[]>([]) //
const total = ref(0) //
const queryParams = reactive({
pageNo: 1,
pageSize: 10,
techSn: undefined,
type: undefined,
technicianName: undefined,
brandId: undefined,
sex: undefined,
photo: undefined,
serviceTime: [],
serviceScope: undefined,
phone: undefined,
ym: undefined,
status: undefined,
content: undefined,
remark: undefined,
createTime: [],
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
})
const queryFormRef = ref() //
const exportLoading = ref(false) //
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await LitemallTechnicianApi.getLitemallTechnicianPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
/** 查询列表 */
const getList = async () => {
loading.value = true
try {
const data = await LitemallTechnicianApi.getLitemallTechnicianPage(queryParams)
list.value = data.list
total.value = data.total
} finally {
loading.value = false
}
}
//
const getOrganization = async () => {
loading.value = true
try {
option.value = await LitemallBrandApi.getOrganizations()
} finally {
loading.value = false
}
}
//
const getProjectName = async () => {
loading.value = true
try {
option.value = await ProjectApi.getProjectName()
} finally {
loading.value = false
}
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 搜索按钮操作 */
const handleQuery = () => {
queryParams.pageNo = 1
getList()
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
const imagePreview = (imgUrl: string) => {
createImageViewer({
urlList: [imgUrl]
})
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type: string, id?: number) => {
formRef.value.open(type, id)
}
/** 重置按钮操作 */
const resetQuery = () => {
queryFormRef.value.resetFields()
handleQuery()
}
const imagePreview = (imgUrl : string) => {
createImageViewer({
urlList: [imgUrl]
})
}
/** 添加/修改操作 */
const formRef = ref()
const openForm = (type : string, id ?: number) => {
formRef.value.open(type, id)
}
/** 删除按钮操作 */
const handleDelete = async (id: number) => {
try {
//
await message.delConfirm()
//
await LitemallTechnicianApi.deleteLitemallTechnician(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch {}
}
/** 删除按钮操作 */
const handleDelete = async (id : number) => {
try {
//
await message.delConfirm()
//
await LitemallTechnicianApi.deleteLitemallTechnician(id)
message.success(t('common.delSuccess'))
//
await getList()
} catch { }
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await LitemallTechnicianApi.exportLitemallTechnician(queryParams)
download.excel(data, '人员管理.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 导出按钮操作 */
const handleExport = async () => {
try {
//
await message.exportConfirm()
//
exportLoading.value = true
const data = await LitemallTechnicianApi.exportLitemallTechnician(queryParams)
download.excel(data, '人员管理.xls')
} catch {
} finally {
exportLoading.value = false
}
}
/** 初始化 **/
onMounted(() => {
getList()
getOrganization()
})
</script>
/** 初始化 **/
onMounted(() => {
getList()
getProjectName()
})
</script>

View File

@ -5,13 +5,16 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
public interface ErrorCodeConstants {
ErrorCode MANAGE_NOT_EXISTS = new ErrorCode(11111, "预约不存在");
ErrorCode STAFF_NOT_EXISTS = new ErrorCode(22222, "预约人员不存在");
ErrorCode ORGANIZATION_NOT_EXISTS = new ErrorCode(33333, "机构不存在");
ErrorCode STAFF_NOT_EXISTS = new ErrorCode(11112, "预约人员不存在");
ErrorCode ORGANIZATION_NOT_EXISTS = new ErrorCode(11113, "机构不存在");
ErrorCode LITEMALL_TECHNICIAN_NOT_EXISTS = new ErrorCode(111, "人员管理不存在");
ErrorCode LITEMALL_TECHNICIAN_NOT_EXISTS = new ErrorCode(11114, "人员管理不存在");
ErrorCode LITEMALL_BRAND_NOT_EXISTS = new ErrorCode(222, "门店管理不存在");
ErrorCode LITEMALL_BRAND_NOT_EXISTS = new ErrorCode(11115, "门店管理不存在");
ErrorCode LITEMALL_RESERVATION_NOT_EXISTS = new ErrorCode(333, "预约订单不存在");
ErrorCode LITEMALL_RESERVATION_NOT_EXISTS = new ErrorCode(11116, "预约订单不存在");
// ========== 预约项目 TODO 补充编号 ==========
ErrorCode PROJECT_NOT_EXISTS = new ErrorCode(11117, "预约项目不存在");
}

View File

@ -0,0 +1,104 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.project;
import cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo.ProjectPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo.ProjectRespVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo.ProjectSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.project.ProjectDO;
import cn.iocoder.yudao.module.srbscribe.service.project.ProjectService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 预约项目")
@RestController
@RequestMapping("/subscribe/project")
@Validated
public class ProjectController {
@Resource
private ProjectService projectService;
@PostMapping("/create")
@Operation(summary = "创建预约项目")
@PreAuthorize("@ss.hasPermission('subscribe:project:create')")
public CommonResult<Long> createProject(@Valid @RequestBody ProjectSaveReqVO createReqVO) {
return success(projectService.createProject(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新预约项目")
@PreAuthorize("@ss.hasPermission('subscribe:project:update')")
public CommonResult<Boolean> updateProject(@Valid @RequestBody ProjectSaveReqVO updateReqVO) {
projectService.updateProject(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除预约项目")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('subscribe:project:delete')")
public CommonResult<Boolean> deleteProject(@RequestParam("id") Long id) {
projectService.deleteProject(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得预约项目")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('subscribe:project:query')")
public CommonResult<ProjectRespVO> getProject(@RequestParam("id") Long id) {
ProjectDO project = projectService.getProject(id);
return success(BeanUtils.toBean(project, ProjectRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得预约项目分页")
@PreAuthorize("@ss.hasPermission('subscribe:project:query')")
public CommonResult<PageResult<ProjectRespVO>> getProjectPage(@Valid ProjectPageReqVO pageReqVO) {
PageResult<ProjectDO> pageResult = projectService.getProjectPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, ProjectRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出预约项目 Excel")
@PreAuthorize("@ss.hasPermission('subscribe:project:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportProjectExcel(@Valid ProjectPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<ProjectDO> list = projectService.getProjectPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "预约项目.xls", "数据", ProjectRespVO.class,
BeanUtils.toBean(list, ProjectRespVO.class));
}
@GetMapping("/getProjectName")
public CommonResult<List<ProjectDO>> getProjectPage() {
List<ProjectDO> projectName = projectService.getProjectName();
return success(projectName);
}
}

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo;
import cn.hutool.core.date.DateTime;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 预约项目分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ProjectPageReqVO extends PageParam {
@Schema(description = "所属门店", example = "18441")
private Long brandId;
@Schema(description = "项目名称", example = "芋艿")
private String name;
@Schema(description = "项目图片")
private String pictrue;
@Schema(description = "项目简介")
private String content;
@Schema(description = "状态", example = "1")
private Integer status;
@Schema(description = "可预约日期")
private String timeInterval;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo;
import cn.hutool.core.date.DateTime;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import com.alibaba.excel.annotation.*;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@Schema(description = "管理后台 - 预约项目 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ProjectRespVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21557")
@ExcelProperty("ID")
private Long id;
@Schema(description = "所属门店", requiredMode = Schema.RequiredMode.REQUIRED, example = "18441")
@ExcelProperty("所属门店")
private Long brandId;
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@ExcelProperty("项目名称")
private String name;
@Schema(description = "项目图片", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("项目图片")
private String pictrue;
@Schema(description = "项目简介")
@ExcelProperty("项目简介")
private String content;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "状态", converter = DictConvert.class)
@DictFormat("subscribe_project_status") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer status;
@Schema(description = "可预约日期", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("可预约日期")
private String timeInterval;
@Schema(description = "创建时间")
@ExcelProperty("创建时间")
private LocalDateTime createTime;
private String brandName;
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo;
import cn.hutool.core.date.DateTime;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import javax.validation.constraints.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 预约项目新增/修改 Request VO")
@Data
public class ProjectSaveReqVO {
@Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "21557")
private Long id;
@Schema(description = "所属门店", requiredMode = Schema.RequiredMode.REQUIRED, example = "18441")
@NotNull(message = "所属门店不能为空")
private Long brandId;
@Schema(description = "项目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
@NotEmpty(message = "项目名称不能为空")
private String name;
@Schema(description = "项目图片", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "项目图片不能为空")
private String pictrue;
@Schema(description = "项目简介")
private String content;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空")
private Integer status;
@Schema(description = "可预约日期", requiredMode = Schema.RequiredMode.REQUIRED)
@NotEmpty(message = "可预约日期不能为空")
private String timeInterval;
}

View File

@ -15,20 +15,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@ToString(callSuper = true)
public class LitemallTechnicianPageReqVO extends PageParam {
@Schema(description = "人员编号")
private String techSn;
@Schema(description = "人员类型", example = "1")
private Integer type;
@Schema(description = "人员名称", example = "赵六")
private String technicianName;
@Schema(description = "门店id", example = "28184")
private Long brandId;
@Schema(description = "性别")
private Integer sex;
@Schema(description = "项目id", example = "28184")
private Long projectId;
@Schema(description = "照片")
private String photo;
@ -40,9 +29,6 @@ public class LitemallTechnicianPageReqVO extends PageParam {
@Schema(description = "服务范围")
private String serviceScope;
@Schema(description = "手机号")
private String phone;
@Schema(description = "约满标记")
private Integer ym;

View File

@ -19,27 +19,9 @@ public class LitemallTechnicianRespVO {
@ExcelProperty("id")
private Long id;
@Schema(description = "人员编号", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("人员编号")
private String techSn;
@Schema(description = "人员类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@ExcelProperty(value = "人员类型", converter = DictConvert.class)
@DictFormat("types") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer type;
@Schema(description = "人员名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@ExcelProperty("人员名称")
private String technicianName;
@Schema(description = "门店id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28184")
@ExcelProperty("门店id")
private Long brandId;
@Schema(description = "性别")
@ExcelProperty(value = "性别", converter = DictConvert.class)
@DictFormat("sex") // TODO 代码优化建议设置到对应的 DictTypeConstants 枚举类中
private Integer sex;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28184")
@ExcelProperty("项目id")
private Long projectId;
@Schema(description = "照片")
@ExcelProperty("照片")
@ -53,9 +35,6 @@ public class LitemallTechnicianRespVO {
@ExcelProperty("服务范围")
private String serviceScope;
@Schema(description = "手机号")
@ExcelProperty("手机号")
private String phone;
@Schema(description = "约满标记")
@ExcelProperty("约满标记")

View File

@ -12,23 +12,9 @@ public class LitemallTechnicianSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "26372")
private Long id;
@Schema(description = "人员编号", requiredMode = Schema.RequiredMode.REQUIRED)
private String techSn;
@Schema(description = "人员类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "人员类型不能为空")
private Integer type;
@Schema(description = "人员名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotEmpty(message = "人员名称不能为空")
private String technicianName;
@Schema(description = "门店id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28184")
@NotNull(message = "门店不能为空")
private Long brandId;
@Schema(description = "性别")
private Integer sex;
@Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED, example = "28184")
@NotNull(message = "项目不能为空")
private Long projectId;
@Schema(description = "照片")
private String photo;
@ -39,9 +25,6 @@ public class LitemallTechnicianSaveReqVO {
@Schema(description = "服务范围")
private String serviceScope;
@Schema(description = "手机号")
private String phone;
@Schema(description = "约满标记")
private Integer ym;

View File

@ -0,0 +1,64 @@
package cn.iocoder.yudao.module.srbscribe.dal.dataobject.project;
import cn.hutool.core.date.DateTime;
import lombok.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 预约项目 DO
*
* @author 管理员
*/
@TableName("subscribe_project")
@KeySequence("subscribe_project_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ProjectDO extends BaseDO {
/**
* ID
*/
@TableId
private Long id;
/**
* 所属门店
*/
private Long brandId;
/**
* 项目名称
*/
private String name;
/**
* 项目图片
*/
private String pictrue;
/**
* 项目简介
*/
private String content;
/**
* 状态
*
* 枚举 {@link TODO subscribe_project_status 对应的类}
*/
private Integer status;
/**
* 可预约日期
*/
private String timeInterval;
@TableField(exist = false)
private String brandName;
}

View File

@ -29,29 +29,9 @@ public class LitemallTechnicianDO extends BaseDO {
@TableId
private Long id;
/**
* 人员编号
* 项目id
*/
private String techSn;
/**
* 人员类型
*
* 枚举 {@link TODO types 对应的类}
*/
private Integer type;
/**
* 人员名称
*/
private String technicianName;
/**
* 门店id
*/
private Long brandId;
/**
* 性别
*
* 枚举 {@link TODO sex 对应的类}
*/
private Integer sex;
private Long projectId;
/**
* 照片
*/
@ -64,10 +44,6 @@ public class LitemallTechnicianDO extends BaseDO {
* 服务范围
*/
private String serviceScope;
/**
* 手机号
*/
private String phone;
/**
* 约满标记
*/

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.srbscribe.dal.mysql.project;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo.ProjectPageReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.project.ProjectDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 预约项目 Mapper
*
* @author 管理员
*/
@Mapper
public interface ProjectMapper extends BaseMapperX<ProjectDO> {
default PageResult<ProjectDO> selectPage(ProjectPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ProjectDO>()
.eqIfPresent(ProjectDO::getBrandId, reqVO.getBrandId())
.likeIfPresent(ProjectDO::getName, reqVO.getName())
.eqIfPresent(ProjectDO::getPictrue, reqVO.getPictrue())
.eqIfPresent(ProjectDO::getContent, reqVO.getContent())
.eqIfPresent(ProjectDO::getStatus, reqVO.getStatus())
.eqIfPresent(ProjectDO::getTimeInterval, reqVO.getTimeInterval())
.betweenIfPresent(ProjectDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ProjectDO::getId));
}
}

View File

@ -21,15 +21,9 @@ public interface LitemallTechnicianMapper extends BaseMapperX<LitemallTechnician
default PageResult<LitemallTechnicianDO> selectPage(LitemallTechnicianPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<LitemallTechnicianDO>()
.eqIfPresent(LitemallTechnicianDO::getTechSn, reqVO.getTechSn())
.eqIfPresent(LitemallTechnicianDO::getType, reqVO.getType())
.likeIfPresent(LitemallTechnicianDO::getTechnicianName, reqVO.getTechnicianName())
.eqIfPresent(LitemallTechnicianDO::getBrandId, reqVO.getBrandId())
.eqIfPresent(LitemallTechnicianDO::getSex, reqVO.getSex())
.eqIfPresent(LitemallTechnicianDO::getPhoto, reqVO.getPhoto())
.betweenIfPresent(LitemallTechnicianDO::getServiceTime, reqVO.getServiceTime())
.eqIfPresent(LitemallTechnicianDO::getServiceScope, reqVO.getServiceScope())
.eqIfPresent(LitemallTechnicianDO::getPhone, reqVO.getPhone())
.eqIfPresent(LitemallTechnicianDO::getYm, reqVO.getYm())
.eqIfPresent(LitemallTechnicianDO::getStatus, reqVO.getStatus())
.eqIfPresent(LitemallTechnicianDO::getContent, reqVO.getContent())

View File

@ -0,0 +1,59 @@
package cn.iocoder.yudao.module.srbscribe.service.project;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo.ProjectPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo.ProjectSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.project.ProjectDO;
import javax.validation.*;
import java.util.List;
/**
* 预约项目 Service 接口
*
* @author 管理员
*/
public interface ProjectService {
/**
* 创建预约项目
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createProject(@Valid ProjectSaveReqVO createReqVO);
/**
* 更新预约项目
*
* @param updateReqVO 更新信息
*/
void updateProject(@Valid ProjectSaveReqVO updateReqVO);
/**
* 删除预约项目
*
* @param id 编号
*/
void deleteProject(Long id);
/**
* 获得预约项目
*
* @param id 编号
* @return 预约项目
*/
ProjectDO getProject(Long id);
/**
* 获得预约项目分页
*
* @param pageReqVO 分页查询
* @return 预约项目分页
*/
PageResult<ProjectDO> getProjectPage(ProjectPageReqVO pageReqVO);
List<ProjectDO> getProjectName();
}

View File

@ -0,0 +1,89 @@
package cn.iocoder.yudao.module.srbscribe.service.project;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo.ProjectPageReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.project.vo.ProjectSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.brand.LitemallBrandDO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.project.ProjectDO;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.brand.LitemallBrandMapper;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.project.ProjectMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.subscribe.enums.ErrorCodeConstants.*;
/**
* 预约项目 Service 实现类
*
* @author 管理员
*/
@Service
@Validated
public class ProjectServiceImpl implements ProjectService {
@Resource
private ProjectMapper projectMapper;
@Resource
private LitemallBrandMapper litemallBrandMapper;
@Override
public Long createProject(ProjectSaveReqVO createReqVO) {
// 插入
ProjectDO project = BeanUtils.toBean(createReqVO, ProjectDO.class);
projectMapper.insert(project);
// 返回
return project.getId();
}
@Override
public void updateProject(ProjectSaveReqVO updateReqVO) {
// 校验存在
validateProjectExists(updateReqVO.getId());
// 更新
ProjectDO updateObj = BeanUtils.toBean(updateReqVO, ProjectDO.class);
projectMapper.updateById(updateObj);
}
@Override
public void deleteProject(Long id) {
// 校验存在
validateProjectExists(id);
// 删除
projectMapper.deleteById(id);
}
private void validateProjectExists(Long id) {
if (projectMapper.selectById(id) == null) {
throw exception(PROJECT_NOT_EXISTS);
}
}
@Override
public ProjectDO getProject(Long id) {
return projectMapper.selectById(id);
}
@Override
public PageResult<ProjectDO> getProjectPage(ProjectPageReqVO pageReqVO) {
PageResult<ProjectDO> projectDOPageResult = projectMapper.selectPage(pageReqVO);
for (int i = 0; i < projectDOPageResult.getList().size(); i++) {
ProjectDO projectDO = projectDOPageResult.getList().get(i);
LitemallBrandDO litemallBrandDO = litemallBrandMapper.selectOne("id", projectDO.getBrandId());
projectDO.setBrandName(litemallBrandDO.getName());
}
return projectDOPageResult;
}
@Override
public List<ProjectDO> getProjectName() {
return projectMapper.selectList();
}
}

View File

@ -113,8 +113,8 @@ public class LitemallReservationServiceImpl implements LitemallReservationServic
litemallReservationDO.setBrandName(litemallBrandDO.getName());
litemallReservationDO.setBrandaddress(litemallBrandDO.getAddress());
LitemallTechnicianDO litemallTechnicianDO = litemallTechnicianMapper.selectOne("id", litemallReservationDO.getTechnicianId());
litemallReservationDO.setTechnicianName(litemallTechnicianDO.getTechnicianName());
// LitemallTechnicianDO litemallTechnicianDO = litemallTechnicianMapper.selectOne("id", litemallReservationDO.getTechnicianId());
// litemallReservationDO.setTechnicianName(litemallTechnicianDO.getTechnicianName());
MemberUserDO memberUserDO = memberUserMapper.selectOne("id", litemallReservationDO.getUserId());
litemallReservationDO.setNickname(memberUserDO.getNickname());

View File

@ -6,8 +6,10 @@ import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.Litemall
import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.LitemallTechnicianSaveReqVO;
import cn.iocoder.yudao.module.srbscribe.controller.admin.technician.vo.ServiceTimeVO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.brand.LitemallBrandDO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.project.ProjectDO;
import cn.iocoder.yudao.module.srbscribe.dal.dataobject.technician.LitemallTechnicianDO;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.brand.LitemallBrandMapper;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.project.ProjectMapper;
import cn.iocoder.yudao.module.srbscribe.dal.mysql.technician.LitemallTechnicianMapper;
import cn.iocoder.yudao.module.srbscribe.service.brand.LitemallBrandService;
import com.alibaba.fastjson.JSON;
@ -40,6 +42,9 @@ public class LitemallTechnicianServiceImpl implements LitemallTechnicianService
@Resource
private LitemallBrandMapper litemallBrandMapper;
@Resource
private ProjectMapper projectMapper;
/**
* 查询技师管理列表
@ -110,8 +115,8 @@ public class LitemallTechnicianServiceImpl implements LitemallTechnicianService
String serviceTime = "";
for (int i = 0; i < litemallTechnicianDOPageResult.getList().size(); i++) {
LitemallTechnicianDO litemallTechnicianDO = litemallTechnicianDOPageResult.getList().get(i);
LitemallBrandDO litemallBrandDO = litemallBrandMapper.selectOne("id", litemallTechnicianDO.getBrandId());
litemallTechnicianDO.setBrandName(litemallBrandDO.getName());
ProjectDO projectDO = projectMapper.selectOne("id", litemallTechnicianDO.getProjectId());
litemallTechnicianDO.setBrandName(projectDO.getName());
if(litemallTechnicianDO.getServiceTime() != null && litemallTechnicianDO.getServiceTime() != ""){
//把StringJSON格式serviceTime转成对象