feat: 车辆收费接口对接

This commit is contained in:
fyy 2025-07-22 19:19:08 +08:00
parent 34d50c58af
commit 9796a46ba1
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";
const emit = defineEmits<{ reload: [] }>();
const groupId = ref<string | number>();
const isUpdate = ref(false);
const weekdayData = ref<any[]>([])
const title = computed(() => {

View File

@ -1,9 +1,8 @@
<script setup lang="ts">
import { computed, ref, reactive } from 'vue';
import { computed, ref, reactive,onMounted } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { arrangementAdd, arrangementInfo, arrangementUpdate } from '#/api/property/attendanceManagement/arrangement';
@ -13,15 +12,55 @@ import {
type VxeGridProps
} from '#/adapter/vxe-table';
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 {groupList} from '#/api/property/attendanceManagement/attendanceGroupSettings'
import {getDictOptions} from "#/utils/dict";
import dayjs from 'dayjs';
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
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({
commonConfig: {
//
@ -58,6 +97,8 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) {
return null;
}
await getGroupList();
console.log(getDictOptions('wy_kqlx'));
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
@ -70,44 +111,6 @@ const [BasicModal, modalApi] = useVbenModal({
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
// getValuesreadonly
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
const tableData = ref([
{ dept: 'xx部门', users: ['张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三', '张三'] },
@ -175,42 +178,122 @@ function handleAdd() {
unitPersonmodalApi.setData({});
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>
<template>
<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">
<FormItem label="选择考勤组" required class="mb-0">
<Select v-model:value="formModel.group" placeholder="请选择"/>
<FormItem name="groupId" label="选择考勤组" class="mb-0">
<Select v-model:value="formModel.groupId" :options="groupOptions" placeholder="请选择" @change="chooseGroup"/>
</FormItem>
<FormItem label="考勤类型" required class="mb-0">
<Input v-model:value="formModel.type" placeholder="请输入" />
<FormItem name="attendanceType" label="考勤类型" class="mb-0">
<Select :disabled="true" :options="getDictOptions('wy_kqlx')" v-model:value="formModel.attendanceType" placeholder="请选择考勤组" />
</FormItem>
<FormItem label="排班日期" class="col-span-2 mb-0">
<radio-group v-model:value="formModel.dateType" class="mr-4">
<radio value="single">
<FormItem label="排班日期" name="dateType" class="col-span-2 mb-0">
<RadioGroup v-model:value="formModel.dateType" class="mr-4">
<Radio value=1>
<span>
单个日期
<DatePicker/>
<DatePicker v-model:value="singleDate" @click="handleDateTypeChange(1)"/>
</span>
</radio>
<radio value="long">
</Radio>
<Radio value=2>
<span>
从此日起长期有效
<DatePicker/>
<DatePicker v-model:value="longDate" @click="handleDateTypeChange(2)"/>
</span>
</radio>
<radio value="range">
</Radio>
<Radio value=3>
<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>
<DatePicker v-model:value="formModel.endDate" />
<DatePicker v-model:value="rangeDate[1]" @click="handleDateTypeChange(3)"/>
</span>
</radio>
</radio-group>
</Radio>
</RadioGroup>
</FormItem>
</div>
</Form>
@ -223,15 +306,9 @@ function handleAdd() {
<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="确认除?"
title="确认移除?"
@confirm="handleDelete(row)"
>
<ghost-button
@ -239,7 +316,7 @@ function handleAdd() {
v-access:code="['property:arrangement:remove']"
@click.stop=""
>
{{ $t('pages.common.delete') }}
移除
</ghost-button>
</Popconfirm>
</Space>
@ -250,4 +327,16 @@ function handleAdd() {
<!-- 底部按钮区 -->
</BasicModal>
</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">
import { computed, ref, reactive } from 'vue';
import { computed, ref, reactive, onMounted } from 'vue';
import { SyncOutlined } from '@ant-design/icons-vue';
import { Tree, InputSearch, Skeleton, Empty, Button } from 'ant-design-vue';
@ -15,7 +15,7 @@ import {
} from '#/adapter/vxe-table';
import { modalSchema,unitColumns,unitQuerySchema } from './data';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { resident_unitList } from '#/api/property/resident/unit';
const emit = defineEmits<{ reload: [] }>();
const selectDeptId = ref<string[]>([]);
const isUpdate = ref(false);
@ -26,22 +26,28 @@ const showSearch = ref(true);
const searchValue = ref('');
const selectedDeptIds = ref<string[]>([]);
const showTreeSkeleton = ref(false);
// mock
const deptTree = ref([
//
const deptTree = reactive([
{
id: '1',
label: '公司',
id: '',
label: '全部单位',
children: [
{ id: '1-1', label: '研发部', children: [
{ id: '1-1-1', label: '前端组' },
{ id: '1-1-2', label: '后端组' },
] },
{ id: '1-2', 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() {
showTreeSkeleton.value = true;
@ -181,16 +187,7 @@ const formModel = reactive({
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));
function addRow() {
@ -239,15 +236,18 @@ const [BasicTable, tableApi] = useVbenVxeGrid({
formOptions,
gridOptions,
});
async function handleEdit(row: any){
modalApi.setData({ id: row.id });
modalApi.open();
}
async function handleDelete(row: any) {
console.log(12);
}
async function loadDetail() {
async function getUnitList(){
const res = await resident_unitList();
for(const item of res.rows){
deptTree.
}
console.log(res);
}
onMounted(() => {
getUnitList();
console.log(tableData.value);
});
</script>
<template>
@ -258,7 +258,7 @@ async function loadDetail() {
<div class="bg-background z-100 sticky left-0 top-0 p-[8px] flex items-center">
<InputSearch
v-model:value="searchValue"
placeholder="搜索部门"
placeholder="搜索单位"
size="small"
style="flex:1;"
>
@ -289,36 +289,16 @@ async function loadDetail() {
</template>
</Tree>
<div v-else class="mt-5">
<Empty :image="Empty.PRESENTED_IMAGE_SIMPLE" description="无部门数据" />
<Empty :image="Empty.PRESENTED_IMAGE_SIMPLE" description="无单位数据" />
</div>
</div>
</Skeleton>
</div>
<div class="flex-1">
<div class="flex mb-2 overflow-auto" style="max-height: 80px;font-size: 14px;">
已选人员
</div>
<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>
</div>
</div>

View File

@ -58,7 +58,7 @@ const schema =[
rules: 'required',
componentProps: {
options: getDictOptions('wy_cbfylx'),
onChange: async (value:any) => {
onChange: async (value:any) => {
//
if (!value) {
costItemsOptions.value = [];
@ -205,7 +205,7 @@ const [BasicModal, modalApi] = useVbenModal({
if (isUpdate.value && id) {
const record = await costMeterWaterInfo(id);
console.log(1,record);
const costItemsRes = await costItemSettingList({ pageSize: 1000000000, pageNum: 1, costType: record.costType });
costItemsOptions.value = (costItemsRes?.rows || []).map(item => ({
label: item.chargeItem,
@ -234,7 +234,7 @@ const [BasicModal, modalApi] = useVbenModal({
]);
await formApi.setValues(record);
console.log(2,await formApi.getValues());
}
await markInitialized();
@ -252,7 +252,7 @@ async function handleConfirm() {
// getValuesreadonly
const data = cloneDeep(await formApi.getValues());
console.log(data);
await (isUpdate.value ? costMeterWaterUpdate(data) : costMeterWaterAdd(data));
resetInitialized();
//ref
@ -378,4 +378,3 @@ async function setupCommunitySelect() {
-webkit-text-fill-color: rgba(0, 0, 0, 0.65) !important;
}
</style>