会议桌子摆放形式,会务人员
This commit is contained in:
1 parent
b35b718fa2
commit
d5a333f32c
9 files changed
+687
-19
No files matched your search
@@ -0,0 +1,41 @@
|
||||
import request from "/@/utils/request"
|
||||
|
||||
export function fetchList(query?: Object) {
|
||||
return request({
|
||||
url: '/integrated/meetingDeskLayout/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function addObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/integrated/meetingDeskLayout',
|
||||
method: 'post',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
export function getObj(id?: string) {
|
||||
return request({
|
||||
url: '/integrated/meetingDeskLayout/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function delObjs(ids?: Object) {
|
||||
return request({
|
||||
url: '/integrated/meetingDeskLayout',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function putObj(obj?: Object) {
|
||||
return request({
|
||||
url: '/integrated/meetingDeskLayout',
|
||||
method: 'put',
|
||||
data: obj
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="姓名" prop="name">
|
||||
@@ -15,11 +15,7 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="部门id" prop="deptId">
|
||||
<el-input v-model="form.deptId" placeholder="请输入部门id"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="照片" prop="picUrl">
|
||||
@@ -39,6 +35,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="CleanUserDialog">
|
||||
import { ref, reactive, nextTick } from 'vue';
|
||||
import { useDict } from '/src/hooks/dict';
|
||||
import { useMessage } from "/src/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/src/api/integrated/cleanUser'
|
||||
@@ -56,8 +53,8 @@ const form = reactive({
|
||||
id:'',
|
||||
name: '',
|
||||
phone: '',
|
||||
deptId: '',
|
||||
picUrl: '',
|
||||
type: '1', // 保洁人员
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="name" label="姓名" show-overflow-tooltip/>
|
||||
<el-table-column prop="phone" label="手机号" show-overflow-tooltip/>
|
||||
<el-table-column prop="deptId" label="部门id" show-overflow-tooltip/>
|
||||
<el-table-column prop="picUrl" label="照片" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
@@ -60,6 +59,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemCleanUser">
|
||||
import { ref, reactive, defineAsyncComponent } from 'vue';
|
||||
import { BasicTableProps, useTable } from "/src/hooks/table";
|
||||
import { fetchList, delObjs } from "/src/api/integrated/cleanUser";
|
||||
import { useMessage, useMessageBox } from "/src/hooks/message";
|
||||
@@ -79,8 +79,8 @@ const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
queryForm: { type: '1' }, // 保洁人员
|
||||
pageList: (params: any) => fetchList({ ...params, type: '1' })
|
||||
})
|
||||
|
||||
// table hook
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" formDialogRef label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="摆放形式名称" prop="layoutName">
|
||||
<el-input v-model="form.layoutName" placeholder="请输入摆放形式名称"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="摆放形式编码" prop="layoutCode">
|
||||
<el-input v-model="form.layoutCode" placeholder="请输入摆放形式编码"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="摆放形式描述" prop="description">
|
||||
<el-input v-model="form.description" placeholder="请输入摆放形式描述"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="最小容纳人数" prop="capacityMin">
|
||||
<el-input v-model="form.capacityMin" placeholder="请输入最小容纳人数"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="最大容纳人数" prop="capacityMax">
|
||||
<el-input v-model="form.capacityMax" placeholder="请输入最大容纳人数"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="摆放形式示意图" prop="layoutImage">
|
||||
<el-input v-model="form.layoutImage" placeholder="请输入摆放形式示意图"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="布置所需时间(分钟)" prop="setupTime">
|
||||
<el-input v-model="form.setupTime" placeholder="请输入布置所需时间(分钟)"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="是否可用" prop="isAvailable">
|
||||
<el-radio-group v-model="form.isAvailable">
|
||||
<el-radio value="0">可用</el-radio>
|
||||
<el-radio value="1">不可用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="排序" prop="sortOrder">
|
||||
<el-input v-model="form.sortOrder" placeholder="请输入排序"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="MeetingDeskLayoutDialog">
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
import { useMessage } from "/@/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/@/api/integrated/meetingDeskLayout'
|
||||
import { rule } from '/@/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
const { is_show } = useDict('is_show')
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id:'',
|
||||
layoutName: '',
|
||||
layoutCode: '',
|
||||
description: '',
|
||||
capacityMin: '',
|
||||
capacityMax: '',
|
||||
layoutImage: '',
|
||||
setupTime: '',
|
||||
isAvailable: '0', // 默认可用
|
||||
sortOrder: '',
|
||||
remark: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
layoutName: [{required: true, message: '摆放形式名称不能为空', trigger: 'blur'}],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取meetingDeskLayout信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getmeetingDeskLayoutData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getmeetingDeskLayoutData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,127 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'integrated_meetingDeskLayout_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'integrated_meetingDeskLayout_del'" @click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'integrated_meetingDeskLayout_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border
|
||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="layoutName" label="摆放形式名称" show-overflow-tooltip/>
|
||||
<el-table-column prop="layoutCode" label="摆放形式编码" show-overflow-tooltip/>
|
||||
<el-table-column prop="description" label="摆放形式描述" show-overflow-tooltip/>
|
||||
<el-table-column prop="capacityMin" label="最小容纳人数" show-overflow-tooltip/>
|
||||
<el-table-column prop="capacityMax" label="最大容纳人数" show-overflow-tooltip/>
|
||||
<el-table-column prop="layoutImage" label="摆放形式示意图" show-overflow-tooltip/>
|
||||
<el-table-column prop="setupTime" label="布置所需时间(分钟)" show-overflow-tooltip/>
|
||||
<el-table-column prop="isAvailable" label="是否可用" show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
<dict-tag :options="is_show" :value="scope.row.isAvailable"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sortOrder" label="排序" show-overflow-tooltip/>
|
||||
<el-table-column prop="remark" label="备注" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'integrated_meetingDeskLayout_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'integrated_meetingDeskLayout_del'" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemMeetingDeskLayout">
|
||||
import { BasicTableProps, useTable } from "/@/hooks/table";
|
||||
import { fetchList, delObjs } from "/@/api/integrated/meetingDeskLayout";
|
||||
import { useMessage, useMessageBox } from "/@/hooks/message";
|
||||
import { useDict } from '/@/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
const { is_show } = useDict('is_show')
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: {},
|
||||
pageList: fetchList
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/integrated/meetingDeskLayout/export', Object.assign(state.queryForm, { ids: selectObjs }), 'meetingDeskLayout.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -34,8 +34,22 @@
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="默认管理员" prop="adminId">
|
||||
<el-select v-model="form.adminId" placeholder="请选择默认管理员">
|
||||
<el-option label="请选择">0</el-option>
|
||||
<el-select
|
||||
v-model="form.adminId"
|
||||
placeholder="请选择默认管理员"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
:remote-method="handleAdminUserSearch"
|
||||
:loading="adminUserLoading"
|
||||
@visible-change="handleAdminUserVisibleChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in adminUserOptions"
|
||||
:key="item.id"
|
||||
:label="item.nameWithMobile"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -59,6 +73,19 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="会务人员" prop="serviceUserId">
|
||||
<el-select v-model="form.serviceUserId" placeholder="请选择会务人员" clearable>
|
||||
<el-option
|
||||
v-for="item in serviceUserOptions"
|
||||
:key="item.id"
|
||||
:label="item.name || item.label || item.serviceUserName"
|
||||
:value="item.id || item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="可用时间段" prop="availableTime">
|
||||
<el-input v-model="form.availableTime" placeholder="请输入可用时间段"/>
|
||||
@@ -159,6 +186,7 @@ import { useMessage } from "/src/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/src/api/integrated/meetingRoom'
|
||||
import { fetchList } from '/src/api/integrated/meetingEquipment'
|
||||
import { dropdown } from '/src/api/integrated/cleanUser'
|
||||
import { getSimpleUserAll } from '/src/api/admin/user'
|
||||
import { rule } from '/src/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
@@ -168,6 +196,10 @@ const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
const activeTab = ref('basic')
|
||||
const cleanUserOptions = ref<any[]>([])
|
||||
const serviceUserOptions = ref<any[]>([])
|
||||
const adminUserOptions = ref<any[]>([])
|
||||
const adminUserLoading = ref(false)
|
||||
const adminUserSearchKeyword = ref('')
|
||||
|
||||
interface Equipment {
|
||||
equipId: string;
|
||||
@@ -213,6 +245,7 @@ const form = reactive({
|
||||
capacity: 0,
|
||||
availableTime: '',
|
||||
cleanUserId: '',
|
||||
serviceUserId: '',
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
@@ -298,14 +331,18 @@ const openDialog = (id: string) => {
|
||||
form.id = ''
|
||||
equipmentList.value = []
|
||||
form.cleanUserId = ''
|
||||
form.serviceUserId = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取保洁用户下拉数据
|
||||
getCleanUserOptions()
|
||||
// 获取用户下拉数据(保洁和会务人员)
|
||||
getUserOptions()
|
||||
|
||||
// 获取管理员用户数据
|
||||
getAdminUserOptions()
|
||||
|
||||
// 获取meetingRoom信息
|
||||
if (id) {
|
||||
@@ -314,13 +351,61 @@ const openDialog = (id: string) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 获取保洁用户下拉选项
|
||||
const getCleanUserOptions = async () => {
|
||||
// 获取用户下拉选项(保洁和会务人员)
|
||||
const getUserOptions = async () => {
|
||||
try {
|
||||
const res = await dropdown()
|
||||
cleanUserOptions.value = Array.isArray(res.data) ? res.data : []
|
||||
const allUsers = Array.isArray(res.data) ? res.data : []
|
||||
|
||||
// 根据type字段分别赋值(type为字符串类型)
|
||||
cleanUserOptions.value = allUsers.filter(user => user.type === '1') // type: '1' 为保洁
|
||||
serviceUserOptions.value = allUsers.filter(user => user.type === '2') // type: '2' 为会务人员
|
||||
} catch (err: any) {
|
||||
console.error('获取保洁用户列表失败:', err)
|
||||
console.error('获取用户列表失败:', err)
|
||||
}
|
||||
}
|
||||
|
||||
// 获取管理员用户选项
|
||||
const getAdminUserOptions = async (searchKeyword?: string) => {
|
||||
try {
|
||||
adminUserLoading.value = true
|
||||
const params: any = {}
|
||||
|
||||
// 如果有搜索关键词,添加到参数中
|
||||
if (searchKeyword) {
|
||||
params.name = searchKeyword
|
||||
params.mobile = searchKeyword
|
||||
}
|
||||
|
||||
const res = await getSimpleUserAll(params)
|
||||
let allUsers = Array.isArray(res.data) ? res.data : []
|
||||
|
||||
// 如果接口不支持搜索参数,在前端进行过滤
|
||||
if (searchKeyword && allUsers.length > 0) {
|
||||
allUsers = allUsers.filter(user =>
|
||||
user.nameWithMobile.toLowerCase().includes(searchKeyword.toLowerCase())
|
||||
)
|
||||
}
|
||||
|
||||
adminUserOptions.value = allUsers
|
||||
} catch (err: any) {
|
||||
console.error('获取管理员用户列表失败:', err)
|
||||
adminUserOptions.value = []
|
||||
} finally {
|
||||
adminUserLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 管理员用户搜索处理
|
||||
const handleAdminUserSearch = (keyword: string) => {
|
||||
adminUserSearchKeyword.value = keyword
|
||||
getAdminUserOptions(keyword)
|
||||
}
|
||||
|
||||
// 管理员用户下拉框显示状态变化
|
||||
const handleAdminUserVisibleChange = (visible: boolean) => {
|
||||
if (visible && adminUserOptions.value.length === 0) {
|
||||
getAdminUserOptions()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -361,10 +446,13 @@ const getmeetingRoomData = (id: string) => {
|
||||
if (res.data.equipmentList) {
|
||||
equipmentList.value = res.data.equipmentList
|
||||
}
|
||||
// 确保保洁信息正确回显
|
||||
// 确保保洁和会务信息正确回显
|
||||
if (res.data.cleanUserId) {
|
||||
form.cleanUserId = res.data.cleanUserId
|
||||
}
|
||||
if (res.data.serviceUserId) {
|
||||
form.serviceUserId = res.data.serviceUserId
|
||||
}
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
<el-table-column prop="location" label="位置" show-overflow-tooltip/>
|
||||
<el-table-column prop="capacity" label="容纳人数" show-overflow-tooltip/>
|
||||
<el-table-column prop="availableTime" label="可用时间段" show-overflow-tooltip/>
|
||||
<el-table-column prop="cleanUserId" label="保洁人员" show-overflow-tooltip/>
|
||||
<el-table-column prop="serviceUserId" label="会务人员" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'integrated_meetingRoom_edit'"
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<el-dialog :title="form.id ? '编辑' : '新增'" v-model="visible"
|
||||
:close-on-click-modal="false" draggable>
|
||||
<el-form ref="dataFormRef" :model="form" :rules="dataRules" label-width="90px" v-loading="loading">
|
||||
<el-row :gutter="24">
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="姓名" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入姓名"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="手机号" prop="phone">
|
||||
<el-input v-model="form.phone" placeholder="请输入手机号"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="12" class="mb20">
|
||||
<el-form-item label="照片" prop="picUrl">
|
||||
<upload-img v-model="form.picUrl"></upload-img>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="onSubmit" :disabled="loading">确认</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="ServiceUserDialog">
|
||||
import { ref, reactive, nextTick } from 'vue';
|
||||
import { useDict } from '/src/hooks/dict';
|
||||
import { useMessage } from "/src/hooks/message";
|
||||
import { getObj, addObj, putObj } from '/src/api/integrated/cleanUser'
|
||||
import { rule } from '/src/utils/validate';
|
||||
const emit = defineEmits(['refresh']);
|
||||
|
||||
// 定义变量内容
|
||||
const dataFormRef = ref();
|
||||
const visible = ref(false)
|
||||
const loading = ref(false)
|
||||
// 定义字典
|
||||
|
||||
// 提交表单数据
|
||||
const form = reactive({
|
||||
id:'',
|
||||
name: '',
|
||||
phone: '',
|
||||
picUrl: '',
|
||||
type: '2', // 会务人员
|
||||
});
|
||||
|
||||
// 定义校验规则
|
||||
const dataRules = ref({
|
||||
name: [{required: true, message: '姓名不能为空', trigger: 'blur'}],
|
||||
phone: [{required: true, message: '手机号不能为空', trigger: 'blur'}],
|
||||
})
|
||||
|
||||
// 打开弹窗
|
||||
const openDialog = (id: string) => {
|
||||
visible.value = true
|
||||
form.id = ''
|
||||
|
||||
// 重置表单数据
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields();
|
||||
});
|
||||
|
||||
// 获取serviceUser信息
|
||||
if (id) {
|
||||
form.id = id
|
||||
getserviceUserData(id)
|
||||
}
|
||||
};
|
||||
|
||||
// 提交
|
||||
const onSubmit = async () => {
|
||||
const valid = await dataFormRef.value.validate().catch(() => {});
|
||||
if (!valid) return false;
|
||||
|
||||
try {
|
||||
loading.value = true;
|
||||
form.id ? await putObj(form) : await addObj(form);
|
||||
useMessage().success(form.id ? '修改成功' : '添加成功');
|
||||
visible.value = false;
|
||||
emit('refresh');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// 初始化表单数据
|
||||
const getserviceUserData = (id: string) => {
|
||||
// 获取数据
|
||||
loading.value = true
|
||||
getObj(id).then((res: any) => {
|
||||
Object.assign(form, res.data)
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
};
|
||||
|
||||
// 暴露变量
|
||||
defineExpose({
|
||||
openDialog
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,132 @@
|
||||
<template>
|
||||
<div class="layout-padding">
|
||||
<div class="layout-padding-auto layout-padding-view">
|
||||
<el-row v-show="showSearch">
|
||||
<el-form :model="state.queryForm" ref="queryRef" :inline="true" @keyup.enter="getDataList">
|
||||
<el-form-item label="姓名" prop="name" >
|
||||
<el-input placeholder="请输入姓名" v-model="state.queryForm.name" />
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号" prop="phone" >
|
||||
<el-input placeholder="请输入手机号" v-model="state.queryForm.phone" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button icon="search" type="primary" @click="getDataList">
|
||||
查询
|
||||
</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<div class="mb8" style="width: 100%">
|
||||
<el-button icon="folder-add" type="primary" class="ml10" @click="formDialogRef.openDialog()"
|
||||
v-auth="'integrated_cleanUser_add'">
|
||||
新 增
|
||||
</el-button>
|
||||
<el-button plain :disabled="multiple" icon="Delete" type="primary"
|
||||
v-auth="'integrated_cleanUser_del'" @click="handleDelete(selectObjs)">
|
||||
删除
|
||||
</el-button>
|
||||
<right-toolbar v-model:showSearch="showSearch" :export="'integrated_cleanUser_export'"
|
||||
@exportExcel="exportExcel" class="ml10 mr20" style="float: right;"
|
||||
@queryTable="getDataList"></right-toolbar>
|
||||
</div>
|
||||
</el-row>
|
||||
<el-table :data="state.dataList" v-loading="state.loading" border
|
||||
:cell-style="tableStyle.cellStyle" :header-cell-style="tableStyle.headerCellStyle"
|
||||
@selection-change="selectionChangHandle"
|
||||
@sort-change="sortChangeHandle">
|
||||
<el-table-column type="selection" width="40" align="center" />
|
||||
<el-table-column type="index" label="#" width="40" />
|
||||
<el-table-column prop="name" label="姓名" show-overflow-tooltip/>
|
||||
<el-table-column prop="phone" label="手机号" show-overflow-tooltip/>
|
||||
<el-table-column prop="picUrl" label="照片" show-overflow-tooltip/>
|
||||
<el-table-column label="操作" width="150">
|
||||
<template #default="scope">
|
||||
<el-button icon="edit-pen" text type="primary" v-auth="'integrated_cleanUser_edit'"
|
||||
@click="formDialogRef.openDialog(scope.row.id)">编辑</el-button>
|
||||
<el-button icon="delete" text type="primary" v-auth="'integrated_cleanUser_del'" @click="handleDelete([scope.row.id])">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination @size-change="sizeChangeHandle" @current-change="currentChangeHandle" v-bind="state.pagination" />
|
||||
</div>
|
||||
|
||||
<!-- 编辑、新增 -->
|
||||
<form-dialog ref="formDialogRef" @refresh="getDataList(false)" />
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts" name="systemServiceUser">
|
||||
import { ref, reactive, defineAsyncComponent } from 'vue';
|
||||
import { BasicTableProps, useTable } from "/src/hooks/table";
|
||||
import { fetchList, delObjs } from "/src/api/integrated/cleanUser";
|
||||
import { useMessage, useMessageBox } from "/src/hooks/message";
|
||||
import { useDict } from '/src/hooks/dict';
|
||||
|
||||
// 引入组件
|
||||
const FormDialog = defineAsyncComponent(() => import('./form.vue'));
|
||||
// 定义查询字典
|
||||
|
||||
// 定义变量内容
|
||||
const formDialogRef = ref()
|
||||
// 搜索变量
|
||||
const queryRef = ref()
|
||||
const showSearch = ref(true)
|
||||
// 多选变量
|
||||
const selectObjs = ref([]) as any
|
||||
const multiple = ref(true)
|
||||
|
||||
const state: BasicTableProps = reactive<BasicTableProps>({
|
||||
queryForm: { type: '2' }, // 会务人员
|
||||
pageList: (params: any) => fetchList({ ...params, type: '2' })
|
||||
})
|
||||
|
||||
// table hook
|
||||
const {
|
||||
getDataList,
|
||||
currentChangeHandle,
|
||||
sizeChangeHandle,
|
||||
sortChangeHandle,
|
||||
downBlobFile,
|
||||
tableStyle
|
||||
} = useTable(state)
|
||||
|
||||
// 清空搜索条件
|
||||
const resetQuery = () => {
|
||||
// 清空搜索条件
|
||||
queryRef.value?.resetFields()
|
||||
// 清空多选
|
||||
selectObjs.value = []
|
||||
getDataList()
|
||||
}
|
||||
|
||||
// 导出excel
|
||||
const exportExcel = () => {
|
||||
downBlobFile('/integrated/cleanUser/export', Object.assign(state.queryForm, { ids: selectObjs }), 'serviceUser.xlsx')
|
||||
}
|
||||
|
||||
// 多选事件
|
||||
const selectionChangHandle = (objs: { id: string }[]) => {
|
||||
selectObjs.value = objs.map(({ id }) => id);
|
||||
multiple.value = !objs.length;
|
||||
};
|
||||
|
||||
// 删除操作
|
||||
const handleDelete = async (ids: string[]) => {
|
||||
try {
|
||||
await useMessageBox().confirm('此操作将永久删除');
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await delObjs(ids);
|
||||
getDataList();
|
||||
useMessage().success('删除成功');
|
||||
} catch (err: any) {
|
||||
useMessage().error(err.msg);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
Reference in new issue
Block a user