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