This commit is contained in:
parent
93be4f1891
commit
7d15ff713c
@ -6,7 +6,11 @@ import { $t } from '@vben/locales';
|
|||||||
import { cloneDeep } from '@vben/utils';
|
import { cloneDeep } from '@vben/utils';
|
||||||
|
|
||||||
import { useVbenForm } from '#/adapter/form';
|
import { useVbenForm } from '#/adapter/form';
|
||||||
import { attendanceAreaAdd, attendanceAreaInfo, attendanceAreaUpdate } from '#/api/property/attendanceManagement/attendanceArea';
|
import {
|
||||||
|
attendanceAreaAdd,
|
||||||
|
attendanceAreaInfo,
|
||||||
|
attendanceAreaUpdate,
|
||||||
|
} from '#/api/property/attendanceManagement/attendanceArea';
|
||||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
import { modalSchema } from './data';
|
import { modalSchema } from './data';
|
||||||
@ -27,7 +31,7 @@ const [BasicForm, formApi] = useVbenForm({
|
|||||||
// 通用配置项 会影响到所有表单项
|
// 通用配置项 会影响到所有表单项
|
||||||
componentProps: {
|
componentProps: {
|
||||||
class: 'w-full',
|
class: 'w-full',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
schema: modalSchema(),
|
schema: modalSchema(),
|
||||||
showDefaultActions: false,
|
showDefaultActions: false,
|
||||||
@ -76,7 +80,9 @@ async function handleConfirm() {
|
|||||||
}
|
}
|
||||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||||
const data = cloneDeep(await formApi.getValues());
|
const data = cloneDeep(await formApi.getValues());
|
||||||
await (isUpdate.value ? attendanceAreaUpdate(data) : attendanceAreaAdd(data));
|
await (isUpdate.value
|
||||||
|
? attendanceAreaUpdate(data)
|
||||||
|
: attendanceAreaAdd(data));
|
||||||
resetInitialized();
|
resetInitialized();
|
||||||
emit('reload');
|
emit('reload');
|
||||||
modalApi.close();
|
modalApi.close();
|
||||||
@ -98,4 +104,3 @@ async function handleClosed() {
|
|||||||
<BasicForm />
|
<BasicForm />
|
||||||
</BasicModal>
|
</BasicModal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@ import { getVxePopupContainer } from '@vben/utils';
|
|||||||
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useVbenVxeGrid,
|
useVbenVxeGrid,
|
||||||
vxeCheckboxChecked,
|
vxeCheckboxChecked,
|
||||||
type VxeGridProps
|
type VxeGridProps,
|
||||||
} from '#/adapter/vxe-table';
|
} from '#/adapter/vxe-table';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -76,7 +76,7 @@ const gridOptions: VxeGridProps = {
|
|||||||
keyField: 'id',
|
keyField: 'id',
|
||||||
},
|
},
|
||||||
// 表格全局唯一表示 保存列配置需要用到
|
// 表格全局唯一表示 保存列配置需要用到
|
||||||
id: 'property-attendanceArea-index'
|
id: 'property-attendanceArea-index',
|
||||||
};
|
};
|
||||||
|
|
||||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
@ -118,9 +118,14 @@ function handleMultiDelete() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleDownloadExcel() {
|
function handleDownloadExcel() {
|
||||||
commonDownloadExcel(attendanceAreaExport, '区域区域管理数据', tableApi.formApi.form.values, {
|
commonDownloadExcel(
|
||||||
fieldMappingTime: formOptions.fieldMappingTime,
|
attendanceAreaExport,
|
||||||
});
|
'区域区域管理数据',
|
||||||
|
tableApi.formApi.form.values,
|
||||||
|
{
|
||||||
|
fieldMappingTime: formOptions.fieldMappingTime,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -138,9 +143,10 @@ function handleDownloadExcel() {
|
|||||||
<a-button
|
<a-button
|
||||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
danger
|
danger
|
||||||
type="primary"
|
type="primary"
|
||||||
v-access:code="['property:attendanceArea:remove']"
|
v-access:code="['property:attendanceArea:remove']"
|
||||||
@click="handleMultiDelete">
|
@click="handleMultiDelete"
|
||||||
|
>
|
||||||
{{ $t('pages.common.delete') }}
|
{{ $t('pages.common.delete') }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<a-button
|
<a-button
|
||||||
|
@ -20,9 +20,7 @@ import dayjs from 'dayjs';
|
|||||||
import type { PersonVO } from './type';
|
import type { PersonVO } from './type';
|
||||||
import { ref, h } from 'vue';
|
import { ref, h } from 'vue';
|
||||||
import { Tag, Table } from 'ant-design-vue';
|
import { Tag, Table } from 'ant-design-vue';
|
||||||
import {
|
import { attendanceAreaList } from '#/api/property/attendanceManagement/attendanceArea';
|
||||||
attendanceAreaList,
|
|
||||||
} from '#/api/property/attendanceManagement/attendanceArea';
|
|
||||||
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
//表单项
|
//表单项
|
||||||
@ -33,7 +31,7 @@ let formModal = reactive<{
|
|||||||
dateType: number | undefined;
|
dateType: number | undefined;
|
||||||
startDate: string;
|
startDate: string;
|
||||||
endDate: string;
|
endDate: string;
|
||||||
areaId:string;
|
areaId: string;
|
||||||
userGroupList: any[];
|
userGroupList: any[];
|
||||||
}>({
|
}>({
|
||||||
id: '',
|
id: '',
|
||||||
@ -45,7 +43,7 @@ let formModal = reactive<{
|
|||||||
// dateRange: [null, null],
|
// dateRange: [null, null],
|
||||||
startDate: '', //开始日期
|
startDate: '', //开始日期
|
||||||
endDate: '', //结束日期
|
endDate: '', //结束日期
|
||||||
areaId:'',//区域
|
areaId: '', //区域
|
||||||
userGroupList: [
|
userGroupList: [
|
||||||
// scheduleId:undefined,//排班ID
|
// scheduleId:undefined,//排班ID
|
||||||
// employeeId:undefined,//员工ID
|
// employeeId:undefined,//员工ID
|
||||||
@ -63,8 +61,8 @@ const rules = {
|
|||||||
attendanceType: [{ required: true }],
|
attendanceType: [{ required: true }],
|
||||||
dateType: [{ required: true, message: '请选择排班日期' }],
|
dateType: [{ required: true, message: '请选择排班日期' }],
|
||||||
};
|
};
|
||||||
const groupOptions = ref<any[]>([]);//考勤组
|
const groupOptions = ref<any[]>([]); //考勤组
|
||||||
const areaOptions = ref<any[]>([]);//区域
|
const areaOptions = ref<any[]>([]); //区域
|
||||||
const groupMap = ref<Record<string, any>>({}); // 用于快速查找
|
const groupMap = ref<Record<string, any>>({}); // 用于快速查找
|
||||||
let tableData = reactive<
|
let tableData = reactive<
|
||||||
{ dept: { deptId: string | number; deptName: string }; users: PersonVO[] }[]
|
{ dept: { deptId: string | number; deptName: string }; users: PersonVO[] }[]
|
||||||
@ -246,13 +244,12 @@ async function getGroupList() {
|
|||||||
groupMap.value[item.id] = item;
|
groupMap.value[item.id] = item;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function getAreaList(){
|
async function getAreaList() {
|
||||||
const res = await attendanceAreaList({ pageSize: 1000000000,
|
const res = await attendanceAreaList({ pageSize: 1000000000, pageNum: 1 });
|
||||||
pageNum: 1,})
|
areaOptions.value = (res.rows || []).map((item) => ({
|
||||||
areaOptions.value = (res.rows || []).map((item)=>({
|
label: item.area,
|
||||||
label:item.area,
|
value: item.id,
|
||||||
value:item.id
|
}));
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
function chooseGroup(value: any) {
|
function chooseGroup(value: any) {
|
||||||
const group = groupMap.value[value];
|
const group = groupMap.value[value];
|
||||||
@ -316,7 +313,7 @@ async function handleConfirm() {
|
|||||||
dateType: undefined,
|
dateType: undefined,
|
||||||
startDate: '',
|
startDate: '',
|
||||||
endDate: '',
|
endDate: '',
|
||||||
areaId:'',
|
areaId: '',
|
||||||
userGroupList: [],
|
userGroupList: [],
|
||||||
});
|
});
|
||||||
// 重置其他数据
|
// 重置其他数据
|
||||||
@ -341,7 +338,7 @@ async function handleClosed() {
|
|||||||
dateType: undefined,
|
dateType: undefined,
|
||||||
startDate: '',
|
startDate: '',
|
||||||
endDate: '',
|
endDate: '',
|
||||||
areaId:'',
|
areaId: '',
|
||||||
userGroupList: [],
|
userGroupList: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import type { FormSchemaGetter } from '#/adapter/form';
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
import { renderDict } from '#/utils/render';
|
import { renderDict } from '#/utils/render';
|
||||||
import {
|
import { attendanceAreaList } from '#/api/property/attendanceManagement/attendanceArea';
|
||||||
attendanceAreaList
|
|
||||||
} from '#/api/property/attendanceManagement/attendanceArea';
|
|
||||||
|
|
||||||
export const querySchema: FormSchemaGetter = () => [
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
{
|
{
|
||||||
@ -265,18 +263,18 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label:'选择区域',
|
label: '选择区域',
|
||||||
fieldName:'areaId',
|
fieldName: 'areaId',
|
||||||
component:'ApiSelect',
|
component: 'ApiSelect',
|
||||||
componentProps:{
|
componentProps: {
|
||||||
api: async ()=>{
|
api: async () => {
|
||||||
const res = await attendanceAreaList({pageNum:1,pageSize:10000});
|
const res = await attendanceAreaList({ pageNum: 1, pageSize: 10000 });
|
||||||
return res;
|
return res;
|
||||||
},
|
},
|
||||||
resultField:'rows',
|
resultField: 'rows',
|
||||||
labelField:'',
|
labelField: '',
|
||||||
valueField:''
|
valueField: '',
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '状态:0-未生效,1-已生效',
|
label: '状态:0-未生效,1-已生效',
|
||||||
|
@ -14,9 +14,7 @@ import dayjs from 'dayjs';
|
|||||||
import type { PersonVO } from './type';
|
import type { PersonVO } from './type';
|
||||||
import { ref, h } from 'vue';
|
import { ref, h } from 'vue';
|
||||||
import { Tag, Table } from 'ant-design-vue';
|
import { Tag, Table } from 'ant-design-vue';
|
||||||
import {
|
import { attendanceAreaList } from '#/api/property/attendanceManagement/attendanceArea';
|
||||||
attendanceAreaList,
|
|
||||||
} from '#/api/property/attendanceManagement/attendanceArea';
|
|
||||||
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
//表单项
|
//表单项
|
||||||
@ -24,14 +22,14 @@ let formModal = reactive<{
|
|||||||
id: string | number;
|
id: string | number;
|
||||||
groupId?: string | number;
|
groupId?: string | number;
|
||||||
attendanceType: string;
|
attendanceType: string;
|
||||||
areaId:string;
|
areaId: string;
|
||||||
userGroupList: any[];
|
userGroupList: any[];
|
||||||
dateType: number | undefined;
|
dateType: number | undefined;
|
||||||
}>({
|
}>({
|
||||||
id: '',
|
id: '',
|
||||||
groupId: '',
|
groupId: '',
|
||||||
attendanceType: '', //考勤组类型
|
attendanceType: '', //考勤组类型
|
||||||
areaId:'',//区域
|
areaId: '', //区域
|
||||||
userGroupList: [
|
userGroupList: [
|
||||||
// scheduleId:undefined,//排班ID
|
// scheduleId:undefined,//排班ID
|
||||||
// employeeId:undefined,//员工ID
|
// employeeId:undefined,//员工ID
|
||||||
@ -42,8 +40,8 @@ let formModal = reactive<{
|
|||||||
dateType: undefined, //排班日期类型
|
dateType: undefined, //排班日期类型
|
||||||
});
|
});
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const groupOptions = ref<any[]>([]);//考勤组
|
const groupOptions = ref<any[]>([]); //考勤组
|
||||||
const areaOptions = ref<any[]>([]);//区域
|
const areaOptions = ref<any[]>([]); //区域
|
||||||
const groupMap = ref<Record<string, any>>({}); // 用于快速查找
|
const groupMap = ref<Record<string, any>>({}); // 用于快速查找
|
||||||
let tableData = reactive<
|
let tableData = reactive<
|
||||||
{ dept: { unitId: string | number; unitName: string }; users: PersonVO[] }[]
|
{ dept: { unitId: string | number; unitName: string }; users: PersonVO[] }[]
|
||||||
@ -182,7 +180,6 @@ const [BasicModal, modalApi] = useVbenModal({
|
|||||||
formModal.groupId = record.attendanceGroup.id;
|
formModal.groupId = record.attendanceGroup.id;
|
||||||
formModal.dateType = record.dateType;
|
formModal.dateType = record.dateType;
|
||||||
|
|
||||||
|
|
||||||
if (record.userGroupList) {
|
if (record.userGroupList) {
|
||||||
// 按部门分组处理 userGroupList
|
// 按部门分组处理 userGroupList
|
||||||
const deptMap = new Map();
|
const deptMap = new Map();
|
||||||
@ -231,13 +228,12 @@ async function getGroupList() {
|
|||||||
groupMap.value[item.id] = item;
|
groupMap.value[item.id] = item;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async function getAreaList(){
|
async function getAreaList() {
|
||||||
const res = await attendanceAreaList({ pageSize: 1000000000,
|
const res = await attendanceAreaList({ pageSize: 1000000000, pageNum: 1 });
|
||||||
pageNum: 1,})
|
areaOptions.value = (res.rows || []).map((item) => ({
|
||||||
areaOptions.value = (res.rows || []).map((item)=>({
|
label: item.area,
|
||||||
label:item.area,
|
value: item.id,
|
||||||
value:item.id
|
}));
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
function chooseGroup(value: any) {
|
function chooseGroup(value: any) {
|
||||||
const group = groupMap.value[value];
|
const group = groupMap.value[value];
|
||||||
@ -274,7 +270,7 @@ async function handleConfirm() {
|
|||||||
dateType: undefined,
|
dateType: undefined,
|
||||||
startDate: '',
|
startDate: '',
|
||||||
endDate: '',
|
endDate: '',
|
||||||
areaId:'',
|
areaId: '',
|
||||||
userGroupList: [],
|
userGroupList: [],
|
||||||
});
|
});
|
||||||
// 重置其他数据
|
// 重置其他数据
|
||||||
@ -296,7 +292,7 @@ async function handleClosed() {
|
|||||||
dateType: undefined,
|
dateType: undefined,
|
||||||
startDate: '',
|
startDate: '',
|
||||||
endDate: '',
|
endDate: '',
|
||||||
areaId:'',
|
areaId: '',
|
||||||
userGroupList: [],
|
userGroupList: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user