2 Commits

Author SHA1 Message Date
fyy
5627819db9 Merge branch 'master' of http://47.109.37.87:3000/by2025/admin-vben5
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
2025-07-22 19:19:58 +08:00
fyy
9796a46ba1 feat: 车辆收费接口对接 2025-07-22 19:19:08 +08:00
4 changed files with 198 additions and 130 deletions

View File

@@ -30,7 +30,7 @@ import {PlusOutlined, MinusOutlined} from '@ant-design/icons-vue';
import type {ShiftVO} from "#/api/property/attendanceManagement/shiftSetting/model"; import type {ShiftVO} from "#/api/property/attendanceManagement/shiftSetting/model";
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
const groupId = ref<string | number>();
const isUpdate = ref(false); const isUpdate = ref(false);
const weekdayData = ref<any[]>([]) const weekdayData = ref<any[]>([])
const title = computed(() => { const title = computed(() => {

View File

@@ -1,9 +1,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref, reactive } from 'vue'; import { computed, ref, reactive,onMounted } from 'vue';
import { useVbenModal } from '@vben/common-ui'; import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales'; import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form'; import { useVbenForm } from '#/adapter/form';
import { arrangementAdd, arrangementInfo, arrangementUpdate } from '#/api/property/attendanceManagement/arrangement'; import { arrangementAdd, arrangementInfo, arrangementUpdate } from '#/api/property/attendanceManagement/arrangement';
@@ -13,15 +12,55 @@ import {
type VxeGridProps type VxeGridProps
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { modalSchema,attendanceColumns } from './data'; import { modalSchema,attendanceColumns } from './data';
import { Radio, Button,Calendar,DatePicker,Form,Input,Select,FormItem } from 'ant-design-vue'; import { Radio,DatePicker,Form,Select,FormItem,RadioGroup, message } from 'ant-design-vue';
import unitPersonModal from './unit-person-modal.vue'; import unitPersonModal from './unit-person-modal.vue';
import {groupList} from '#/api/property/attendanceManagement/attendanceGroupSettings'
import {getDictOptions} from "#/utils/dict";
import dayjs from 'dayjs';
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false); const isUpdate = ref(false);
const title = computed(() => { const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add'); return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
}); });
const groupOptions = ref<any[]>([]);
const groupMap = ref<Record<string, any>>({}); // 用于快速查找
//表单项
const formModel = reactive<{
id: string;
groupId: string;
attendanceType: string;
dateType: number | undefined;
startDate: string;
endDate: string;
userGroupList: any[];
}>({
id: '',
groupId: '',
attendanceType:'',//考勤组类型
dateType: undefined,//日期类型1-单个日期2-长期有效3-期间有效
// dateSingle: null,
// dateLong: null,
// dateRange: [null, null],
startDate:'',//开始日期
endDate:'',//结束日期
userGroupList:[
// scheduleId:undefined,//排班ID
// employeeId:undefined,//员工ID
// employeeName:undefined,//员工姓名
// deptId:undefined,//部门ID
// deptName:undefined,//部门名称
]//考勤组人员列表
});
const singleDate = ref('');
const longDate = ref('');
const rangeDate = ref(['', '']);
const formRef = ref();
const rules = {
groupId: [{ required: true, message: '请选择考勤组' }],
attendanceType: [{ required: true }],
dateType: [{ required: true, message: '请选择排班日期' }],
};
const [BasicForm, formApi] = useVbenForm({ const [BasicForm, formApi] = useVbenForm({
commonConfig: { commonConfig: {
// 默认占满两列 // 默认占满两列
@@ -58,6 +97,8 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) { if (!isOpen) {
return null; return null;
} }
await getGroupList();
console.log(getDictOptions('wy_kqlx'));
modalApi.modalLoading(true); modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string }; const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id; isUpdate.value = !!id;
@@ -70,44 +111,6 @@ const [BasicModal, modalApi] = useVbenModal({
modalApi.modalLoading(false); modalApi.modalLoading(false);
}, },
}); });
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues());
await (isUpdate.value ? arrangementUpdate(data) : arrangementAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
const formModel = reactive({
group: '',
type: '',
dateType: 'long',
dateSingle: null,
dateLong: null,
dateRange: [null, null],
startDate:'',
endDate:''
});
// mock 表格数据 // mock 表格数据
const tableData = ref([ const tableData = ref([
{ dept: 'xx部门', users: ['张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三'] }, { dept: 'xx部门', users: ['张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三'] },
@@ -175,42 +178,122 @@ function handleAdd() {
unitPersonmodalApi.setData({}); unitPersonmodalApi.setData({});
unitPersonmodalApi.open(); unitPersonmodalApi.open();
} }
async function getGroupList(){
const res = await groupList({
pageSize:1000000000,
pageNum:1,
status:1//0:停用 1:启用
});
groupOptions.value = (res.rows || []).map(item=>({
label:item.groupName,
value:item.id
}));
// 构建 id 到 group 对象的映射
groupMap.value = {};
(res.rows || []).forEach(item => {
groupMap.value[item.id] = item;
});
}
function chooseGroup(value:any){
console.log(value);
const group = groupMap.value[value];
if(group){
formModel.attendanceType = String(group.attendanceType);
}
}
async function handleDateTypeChange(value:any){
formModel.dateType = value;
}
async function handleConfirm() {
try {
modalApi.lock(true);
// await formRef.value.validate(); // 先校验
const data = formModel;
const { id } = modalApi.getData() as { id?:string };
data.id = id? id:'';
console.log(data);
if(data.dateType == 1){
if(singleDate.value){
data.startDate = dayjs(singleDate.value).format('YYYY-MM-DD');
}else{
message.error('请选择单个日期')
return;
}
}else if(data.dateType == 2){
if(longDate.value){
data.startDate = dayjs(longDate.value).format('YYYY-MM-DD');
}else{
message.error('请选择起始日期')
return;
}
}else if(data.dateType == 3){
if(!rangeDate.value[0]){
message.error('请选择开始日期')
return;
}else if(!rangeDate.value[1]){
message.error('请选择结束日期')
return;
}else{
data.startDate = dayjs(rangeDate.value[0]).format('YYYY-MM-DD');
data.endDate = dayjs(rangeDate.value[1]).format('YYYY-MM-DD');
}
}
// await (isUpdate.value ? arrangementUpdate(data) : arrangementAdd(data));
resetInitialized();
emit('reload');
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
await formApi.resetForm();
resetInitialized();
}
onMounted(() => {
})
</script> </script>
<template> <template>
<BasicModal :title="title"> <BasicModal :title="title">
<!-- 顶部表单区 --> <!-- 顶部表单区 -->
<Form :model="formModel" layout="horizontal" class="mb-4"> <Form :model="formModel" :rules="rules" ref="formRef" layout="horizontal" class="mb-4" >
<div class="grid grid-cols-2 gap-x-8 gap-y-2"> <div class="grid grid-cols-2 gap-x-8 gap-y-2">
<FormItem label="选择考勤组" required class="mb-0"> <FormItem name="groupId" label="选择考勤组" class="mb-0">
<Select v-model:value="formModel.group" placeholder="请选择"/> <Select v-model:value="formModel.groupId" :options="groupOptions" placeholder="请选择" @change="chooseGroup"/>
</FormItem> </FormItem>
<FormItem label="考勤类型" required class="mb-0"> <FormItem name="attendanceType" label="考勤类型" class="mb-0">
<Input v-model:value="formModel.type" placeholder="请输入" /> <Select :disabled="true" :options="getDictOptions('wy_kqlx')" v-model:value="formModel.attendanceType" placeholder="请选择考勤组" />
</FormItem> </FormItem>
<FormItem label="排班日期" class="col-span-2 mb-0"> <FormItem label="排班日期" name="dateType" class="col-span-2 mb-0">
<radio-group v-model:value="formModel.dateType" class="mr-4"> <RadioGroup v-model:value="formModel.dateType" class="mr-4">
<radio value="single"> <Radio value=1>
<span> <span>
单个日期 单个日期
<DatePicker/> <DatePicker v-model:value="singleDate" @click="handleDateTypeChange(1)"/>
</span> </span>
</radio> </Radio>
<radio value="long"> <Radio value=2>
<span> <span>
从此日起长期有效 从此日起长期有效
<DatePicker/> <DatePicker v-model:value="longDate" @click="handleDateTypeChange(2)"/>
</span> </span>
</radio> </Radio>
<radio value="range"> <Radio value=3>
<span> <span>
在此期间有效 在此期间有效
<DatePicker v-model:value="formModel.startDate" class="ml-2" /> <DatePicker v-model:value="rangeDate[0]" class="ml-2" @click="handleDateTypeChange(3)"/>
<span class="mx-2">~</span> <span class="mx-2">~</span>
<DatePicker v-model:value="formModel.endDate" /> <DatePicker v-model:value="rangeDate[1]" @click="handleDateTypeChange(3)"/>
</span> </span>
</radio> </Radio>
</radio-group> </RadioGroup>
</FormItem> </FormItem>
</div> </div>
</Form> </Form>
@@ -223,15 +306,9 @@ function handleAdd() {
<BasicTable> <BasicTable>
<template #action="{ row }"> <template #action="{ row }">
<Space> <Space>
<ghost-button
v-access:code="['property:arrangement:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm <Popconfirm
placement="left" placement="left"
title="确认除?" title="确认除?"
@confirm="handleDelete(row)" @confirm="handleDelete(row)"
> >
<ghost-button <ghost-button
@@ -239,7 +316,7 @@ function handleAdd() {
v-access:code="['property:arrangement:remove']" v-access:code="['property:arrangement:remove']"
@click.stop="" @click.stop=""
> >
{{ $t('pages.common.delete') }} 移除
</ghost-button> </ghost-button>
</Popconfirm> </Popconfirm>
</Space> </Space>
@@ -250,4 +327,16 @@ function handleAdd() {
<!-- 底部按钮区 --> <!-- 底部按钮区 -->
</BasicModal> </BasicModal>
</template> </template>
<style scoped>
/* 使用 :deep() 穿透 scoped 样式,影响子组件 */
:deep(.ant-input[disabled]),
:deep(.ant-input-number-disabled .ant-input-number-input),
:deep(.ant-select-disabled .ant-select-selection-item),
:deep(.ant-picker-input input[disabled]),
:deep(.ant-picker-disabled .ant-picker-input input) {
/* 设置一个更深的颜色,可以自己调整 */
color: rgba(0, 0, 0, 0.65) !important;
/* 有些浏览器需要这个来覆盖默认颜色 */
-webkit-text-fill-color: rgba(0, 0, 0, 0.65) !important;
}
</style>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref, reactive } from 'vue'; import { computed, ref, reactive, onMounted } from 'vue';
import { SyncOutlined } from '@ant-design/icons-vue'; import { SyncOutlined } from '@ant-design/icons-vue';
import { Tree, InputSearch, Skeleton, Empty, Button } from 'ant-design-vue'; import { Tree, InputSearch, Skeleton, Empty, Button } from 'ant-design-vue';
@@ -15,7 +15,7 @@ import {
} from '#/adapter/vxe-table'; } from '#/adapter/vxe-table';
import { modalSchema,unitColumns,unitQuerySchema } from './data'; import { modalSchema,unitColumns,unitQuerySchema } from './data';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui'; import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { resident_unitList } from '#/api/property/resident/unit';
const emit = defineEmits<{ reload: [] }>(); const emit = defineEmits<{ reload: [] }>();
const selectDeptId = ref<string[]>([]); const selectDeptId = ref<string[]>([]);
const isUpdate = ref(false); const isUpdate = ref(false);
@@ -26,22 +26,28 @@ const showSearch = ref(true);
const searchValue = ref(''); const searchValue = ref('');
const selectedDeptIds = ref<string[]>([]); const selectedDeptIds = ref<string[]>([]);
const showTreeSkeleton = ref(false); const showTreeSkeleton = ref(false);
//单位树
// mock 部门树数据 const deptTree = reactive([
const deptTree = ref([
{ {
id: '1', id: '',
label: '公司', label: '全部单位',
children: [ children: [
{ id: '1-1', label: '研发部', children: [
{ id: '1-1-1', label: '前端组' },
{ id: '1-1-2', label: '后端组' },
] },
{ id: '1-2', label: '市场部' },
{ id: '1-3', label: '人事部' }, { id: '1-3', label: '人事部' },
], ],
}, },
]); ]);
//已选内容,需要展示到父组件
const tableData = ref([
{ dept: 'xx部门', users: ['张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三'] },
{ dept: 'xx部门', users: ['张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三'] },
{ dept: '', users: [] },
]);
//已选人
const staticData = [
{ id: 1, dept: 'xx部门', name: '张三' },
{ id: 2, dept: 'yy部门', name: '李四' },
];
function handleReload() { function handleReload() {
showTreeSkeleton.value = true; showTreeSkeleton.value = true;
@@ -181,16 +187,7 @@ const formModel = reactive({
endDate:'' endDate:''
}); });
// mock 表格数据
const tableData = ref([
{ dept: 'xx部门', users: ['张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三'] },
{ dept: 'xx部门', users: ['张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三'] },
{ dept: '', users: [] },
]);
const staticData = [
{ id: 1, dept: 'xx部门', name: '张三' },
{ id: 2, dept: 'yy部门', name: '李四' },
];
const totalSelected = computed(() => tableData.value.reduce((sum, row) => sum + row.users.length, 0)); const totalSelected = computed(() => tableData.value.reduce((sum, row) => sum + row.users.length, 0));
function addRow() { function addRow() {
@@ -239,15 +236,18 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions, formOptions,
gridOptions, gridOptions,
}); });
async function handleEdit(row: any){
modalApi.setData({ id: row.id }); async function getUnitList(){
modalApi.open(); const res = await resident_unitList();
} for(const item of res.rows){
async function handleDelete(row: any) { deptTree.
console.log(12); }
} console.log(res);
async function loadDetail() {
} }
onMounted(() => {
getUnitList();
console.log(tableData.value);
});
</script> </script>
<template> <template>
@@ -258,7 +258,7 @@ async function loadDetail() {
<div class="bg-background z-100 sticky left-0 top-0 p-[8px] flex items-center"> <div class="bg-background z-100 sticky left-0 top-0 p-[8px] flex items-center">
<InputSearch <InputSearch
v-model:value="searchValue" v-model:value="searchValue"
placeholder="搜索部门" placeholder="搜索单位"
size="small" size="small"
style="flex:1;" style="flex:1;"
> >
@@ -289,36 +289,16 @@ async function loadDetail() {
</template> </template>
</Tree> </Tree>
<div v-else class="mt-5"> <div v-else class="mt-5">
<Empty :image="Empty.PRESENTED_IMAGE_SIMPLE" description="无部门数据" /> <Empty :image="Empty.PRESENTED_IMAGE_SIMPLE" description="无单位数据" />
</div> </div>
</div> </div>
</Skeleton> </Skeleton>
</div> </div>
<div class="flex-1"> <div class="flex-1">
<div class="flex mb-2 overflow-auto" style="max-height: 80px;font-size: 14px;">
已选人员
</div>
<BasicTable> <BasicTable>
<template #action="{ row }">
<Space>
<ghost-button
v-access:code="['property:arrangement:edit']"
@click.stop="handleEdit(row)"
>
{{ $t('pages.common.edit') }}
</ghost-button>
<Popconfirm
placement="left"
title="确认删除?"
@confirm="handleDelete(row)"
>
<ghost-button
danger
v-access:code="['property:arrangement:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
</ghost-button>
</Popconfirm>
</Space>
</template>
</BasicTable> </BasicTable>
</div> </div>
</div> </div>

View File

@@ -58,7 +58,7 @@ const schema =[
rules: 'required', rules: 'required',
componentProps: { componentProps: {
options: getDictOptions('wy_cbfylx'), options: getDictOptions('wy_cbfylx'),
onChange: async (value:any) => { onChange: async (value:any) => {
// 请求并更新下拉 // 请求并更新下拉
if (!value) { if (!value) {
costItemsOptions.value = []; costItemsOptions.value = [];
@@ -205,7 +205,7 @@ const [BasicModal, modalApi] = useVbenModal({
if (isUpdate.value && id) { if (isUpdate.value && id) {
const record = await costMeterWaterInfo(id); const record = await costMeterWaterInfo(id);
console.log(1,record); console.log(1,record);
const costItemsRes = await costItemSettingList({ pageSize: 1000000000, pageNum: 1, costType: record.costType }); const costItemsRes = await costItemSettingList({ pageSize: 1000000000, pageNum: 1, costType: record.costType });
costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({ costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({
label: item.chargeItem, label: item.chargeItem,
@@ -234,7 +234,7 @@ const [BasicModal, modalApi] = useVbenModal({
]); ]);
await formApi.setValues(record); await formApi.setValues(record);
console.log(2,await formApi.getValues()); console.log(2,await formApi.getValues());
} }
await markInitialized(); await markInitialized();
@@ -252,7 +252,7 @@ async function handleConfirm() {
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次 // getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
const data = cloneDeep(await formApi.getValues()); const data = cloneDeep(await formApi.getValues());
console.log(data); console.log(data);
await (isUpdate.value ? costMeterWaterUpdate(data) : costMeterWaterAdd(data)); await (isUpdate.value ? costMeterWaterUpdate(data) : costMeterWaterAdd(data));
resetInitialized(); resetInitialized();
//必须要手动清空不然ref会保留值 //必须要手动清空不然ref会保留值
@@ -378,4 +378,3 @@ async function setupCommunitySelect() {
-webkit-text-fill-color: rgba(0, 0, 0, 0.65) !important; -webkit-text-fill-color: rgba(0, 0, 0, 0.65) !important;
} }
</style> </style>