1 Commits

Author SHA1 Message Date
ec2f257a87 asset
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 6m18s
2025-06-25 09:27:33 +08:00
13 changed files with 253 additions and 486 deletions

View File

@@ -7,7 +7,7 @@ VITE_COMPRESS=gzip
VITE_PWA=false
# vue-router 的模式
VITE_ROUTER_HISTORY=history
VITE_ROUTER_HISTORY=hash
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true

View File

@@ -10,7 +10,7 @@ VITE_COMPRESS=gzip
VITE_PWA=false
# vue-router 的模式
VITE_ROUTER_HISTORY=history
VITE_ROUTER_HISTORY=hash
# 是否注入全局loading
VITE_INJECT_APP_LOADING=true

View File

@@ -15,6 +15,10 @@ export function assetTypeList(params?: AssetTypeQuery) {
return requestClient.get<PageResult<AssetTypeVO>>('/property/assetType/list', { params });
}
export function assetTypeselect() {
return requestClient.get<AssetTypeVO[]>('/property/assetType/list');
}
/**
* 导出资产类型列表
* @param params

View File

@@ -5,11 +5,16 @@ import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { type FormSchemaGetter, useVbenForm } from "#/adapter/form";
import { applicationAdd, applicationInfo, applicationUpdate } from '#/api/property/assetManage/application';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
import { assetTypeselect } from "#/api/property/assetType";
import { depotList } from "#/api/property/assetManage/depot";
import { suppliersList } from "#/api/property/assetManage/suppliers";
import { assetList } from "#/api/property/assetManage/asset";
import { userList } from "#/api/system/user";
const emit = defineEmits<{ reload: [] }>();
@@ -41,6 +46,103 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
},
);
formApi.getValues().then(setupPackageSelect);
async function upSelectUser(nickName: string){
const list=await userList({
nickName:nickName,
pageNum: 1,
pageSize: 10,
});
const options=list.map(item=>{
item.label=item.userName;
item.value=item.id;
})
fromApi.updateSchema([
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options,
showSearch: true,
},
fieldName: 'userId',
},
]);
}
async function upSelectAssets(assetsName: string){
const list=await assetList({
assetsName:assetsName,
pageNum: 1,
pageSize: 10,
});
const options=list.map(item=>{
item.label=item.assetsName;
item.value=item.id;
})
fromApi.updateSchema([
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options,
showSearch: true,
},
fieldName: 'assetsId',
},
]);
}
async function setupPackageSelect() {
const users = await userList({
pageNum: 1,
pageSize: 10,
});
const assets = await assetList({
pageNum: 1,
pageSize: 10,
});
const options = users.rows.map((item) => ({
label: item.nickName,
value: item.userId,
}));
const assetOptions = assets.rows.map((item) => ({
label: item.name,
value: item.id,
}));
formApi.updateSchema([
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options,
showSearch: true,
},
async select(userId) {
await upSelectUser(userId);
userId=""
},
fieldName: 'userId',
},
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options: assetOptions,
showSearch: true,
},
async select(assetsId) {
await upSelectAssets(assetsId);
assetsId=""
},
fieldName: 'assetId',
},
]);
}
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
@@ -62,7 +164,7 @@ const [BasicModal, modalApi] = useVbenModal({
await formApi.setValues(record);
}
await markInitialized();
await setupPackageSelect();
modalApi.modalLoading(false);
},
});

View File

@@ -112,46 +112,46 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '资产id',
fieldName: 'assetId',
component: 'Input',
component: 'Select',
},
{
label: '领用人id',
fieldName: 'userId',
component: 'Input',
component: 'Select',
},
{
label: '数量',
fieldName: 'number',
component: 'Input',
},
{
label: '状态',
fieldName: 'state',
component: 'Input',
},
{
label: '审批人id',
fieldName: 'acceptanceUserId',
component: 'Input',
},
{
label: '审批时间',
fieldName: 'acceptanceTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
{
label: '申请时间',
fieldName: 'applicationTime',
component: 'DatePicker',
componentProps: {
showTime: true,
format: 'YYYY-MM-DD HH:mm:ss',
valueFormat: 'YYYY-MM-DD HH:mm:ss',
},
},
// {
// label: '状态',
// fieldName: 'state',
// component: 'Input',
// },
// {
// label: '审批人id',
// fieldName: 'acceptanceUserId',
// component: 'Input',
// },
// {
// label: '审批时间',
// fieldName: 'acceptanceTime',
// component: 'DatePicker',
// componentProps: {
// showTime: true,
// format: 'YYYY-MM-DD HH:mm:ss',
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
// },
// },
// {
// label: '申请时间',
// fieldName: 'applicationTime',
// component: 'DatePicker',
// componentProps: {
// showTime: true,
// format: 'YYYY-MM-DD HH:mm:ss',
// valueFormat: 'YYYY-MM-DD HH:mm:ss',
// },
// },
];

View File

@@ -10,6 +10,10 @@ import { assetAdd, assetInfo, assetUpdate } from '#/api/property/assetManage/ass
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { modalSchema } from './data';
import { packageSelectList } from "#/api/system/tenant-package";
import { assetTypeselect } from "#/api/property/assetType";
import { depotList } from "#/api/property/assetManage/depot";
import { suppliersList } from "#/api/property/assetManage/suppliers";
const emit = defineEmits<{ reload: [] }>();
@@ -41,6 +45,55 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
},
);
async function setupPackageSelect() {
const tenantPackageList = await assetTypeselect();
const depot = await depotList();
const suppliers =await suppliersList();
const options = tenantPackageList.rows.map((item) => ({
label: item.assetTypeName,
value: item.id,
}));
const depotoptions = depot.rows.map((item) => ({
label: item.depotName,
value: item.id,
}));
const supplieroptions = suppliers.rows.map((item) => ({
label: item.suppliersName,
value: item.id,
}));
formApi.updateSchema([
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options,
showSearch: true,
},
fieldName: 'model',
},
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options: depotoptions,
showSearch: true,
},
fieldName: 'depotId',
},
{
componentProps: {
optionFilterProp: 'label',
optionLabelProp: 'label',
options: supplieroptions,
showSearch: true,
},
fieldName: 'suppliersId',
},
]);
}
const [BasicModal, modalApi] = useVbenModal({
// 在这里更改宽度
class: 'w-[550px]',
@@ -52,6 +105,7 @@ const [BasicModal, modalApi] = useVbenModal({
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
@@ -62,7 +116,7 @@ const [BasicModal, modalApi] = useVbenModal({
await formApi.setValues(record);
}
await markInitialized();
await setupPackageSelect();
modalApi.modalLoading(false);
},
});

View File

@@ -1,6 +1,9 @@
import type {FormSchemaGetter} from '#/adapter/form';
import type {VxeGridProps} from '#/adapter/vxe-table';
import {getDictOptions} from "#/utils/dict";
import { renderDict } from "#/utils/render";
import { DictEnum } from '@vben/constants';
export const querySchema: FormSchemaGetter = () => [
@@ -44,7 +47,7 @@ export const columns: VxeGridProps['columns'] = [
},
{
title: '资产类型',
field: 'model',
field: 'modelName',
},
{
title: '规格',
@@ -63,16 +66,16 @@ export const columns: VxeGridProps['columns'] = [
field: 'unit',
},
{
title: '仓库id',
field: 'depotId',
title: '仓库',
field: 'depotName',
},
{
title: '描述信息',
field: 'msg',
},
{
title: '供应商id',
field: 'suppliersId',
title: '供应商',
field: 'suppliersName',
},
{
title: '入库时间',
@@ -81,6 +84,11 @@ export const columns: VxeGridProps['columns'] = [
{
title: '固定资产',
field: 'type',
slots: {
default: ({ row }) => {
return renderDict(row.type, DictEnum.WY_SF);
},
},
},
{
title: '创建时间',
@@ -113,7 +121,7 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '类型',
fieldName: 'model',
component: 'Textarea',
component: 'Select',
},
{
label: '规格',
@@ -136,9 +144,9 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input',
},
{
label: '仓库id',
label: '仓库',
fieldName: 'depotId',
component: 'Input',
component: 'Select',
},
{
label: '描述信息',
@@ -148,7 +156,7 @@ export const modalSchema: FormSchemaGetter = () => [
{
label: '供应商id',
fieldName: 'suppliersId',
component: 'Input',
component: 'Select',
},
{
label: '入库时间',
@@ -164,6 +172,8 @@ export const modalSchema: FormSchemaGetter = () => [
label: '固定资产类型',
fieldName: 'type',
component: 'Select',
componentProps: {},
componentProps: {
options: getDictOptions('wy_sf'),
},
},
];

View File

@@ -1,230 +0,0 @@
<script setup lang="ts">
import { computed, ref } from 'vue';
import { useVbenModal } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { cloneDeep } from '@vben/utils';
import { useVbenForm } from '#/adapter/form';
import { cleanList } from '#/api/property/clean';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
const emit = defineEmits<{ reload: [data: any] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
});
// 缓存清洁服务数据
let cleanListData: any[] = [];
const detailSchema = [
{
label: '劳务名称',
fieldName: 'name',
component: 'ApiSelect',
componentProps: {
api: async () => {
const res = await cleanList({stater:1});
cleanListData = res.rows || [];
return res;
},
resultField: 'rows',
labelField: 'name',
valueField: 'id',
onChange: async (value: string) => {
// 找到选中的服务数据
const selectedService = cleanListData.find(item => item.id === value);
if (selectedService) {
// 自动填充其他字段
await formApi.setValues({
measure: selectedService.measure,
method: selectedService.method,
peices: selectedService.peices,
frequency: selectedService.frequency,
standard: selectedService.standard,
remark: selectedService.remark,
stater: selectedService.stater,
});
}
},
},
rules: 'required',
},
{
label: '计量单位',
fieldName: 'measure',
component: 'Input',
componentProps: {
disabled: true,
},
rules: 'required',
},
{
label: '计算方式',
fieldName: 'method',
component: 'Input',
componentProps: {
disabled: true,
},
rules: 'required',
},
{
label: '申报单价含税(元)',
fieldName: 'peices',
component: 'InputNumber',
componentProps: {
disabled: true,
},
rules: 'required',
},
{
label: '保洁频率',
fieldName: 'frequency',
component: 'Input',
componentProps: {
disabled: true,
},
rules: 'required',
},
{
label: '保洁标准',
fieldName: 'standard',
component: 'Input',
componentProps: {
disabled: true,
},
rules: 'required',
},
{
label: '备注',
fieldName: 'remark',
component: 'Input',
componentProps: {
disabled: true,
},
},
{
label: '状态',
fieldName: 'stater',
component: 'Select',
componentProps: {
disabled: true,
options: [
{ label: '上架', value: 1 },
{ label: '下架', value: 0 },
],
},
rules: 'required',
},
{
label: '保洁面积',
fieldName: 'area',
component: 'InputNumber',
rules: 'required',
componentProps: {
onChange: async (value: number) => {
const formValues = await formApi.getValues();
if (formValues.peices && value) {
await formApi.setValues({
sumPeices: Number((formValues.peices * value).toFixed(2)),
});
}
},
},
},
{
label: '合计费用',
fieldName: 'sumPeices',
component: 'InputNumber',
componentProps: {
disabled: true,
},
},
];
const [BasicForm, formApi] = useVbenForm({
commonConfig: {
labelWidth: 120,
componentProps: {
class: 'w-full',
},
},
schema: detailSchema,
showDefaultActions: false,
});
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
{
initializedGetter: defaultFormValueGetter(formApi),
currentGetter: defaultFormValueGetter(formApi),
},
);
const [BasicModal, modalApi] = useVbenModal({
onBeforeClose,
onClosed: handleClosed,
onConfirm: handleConfirm,
onOpenChange: async (isOpen) => {
if (!isOpen) {
return null;
}
modalApi.modalLoading(true);
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
// TODO: 获取详情数据
}
await markInitialized();
modalApi.modalLoading(false);
},
});
async function handleConfirm() {
console.log('handleConfirm');
try {
modalApi.lock(true);
const { valid } = await formApi.validate();
if (!valid) {
return;
}
const data = cloneDeep(await formApi.getValues());
// 获取选中的服务名称
const selectedService = cleanListData.find(item => item.id === data.name);
if (selectedService) {
data.name = selectedService.name;
}
handleClosed()
await markInitialized();
emit('reload', data);
modalApi.close();
} catch (error) {
console.error(error);
} finally {
modalApi.lock(false);
}
}
async function handleClosed() {
console.log('handleClosed');
await formApi.resetForm();
resetInitialized();
}
</script>
<template>
<BasicModal :title="title">
<BasicForm />
</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) {
/* 设置一个更深的颜色,可以自己调整 */
color: rgba(0, 0, 0, 0.65) !important;
/* 有些浏览器需要这个来覆盖默认颜色 */
-webkit-text-fill-color: rgba(0, 0, 0, 0.65) !important;
}
</style>

View File

@@ -12,19 +12,11 @@ import type { CleanVO } from '#/api/property/clean/model';
import { clean_orderAdd, clean_orderInfo, clean_orderUpdate } from '#/api/property/clean_order';
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
import { resident_unitList } from '#/api/property/resident/unit';
import { useVbenVxeGrid } from '#/adapter/vxe-table';
import type { VxeGridProps } from '#/adapter/vxe-table';
import cleanDetailModal from './clean-detail-modal.vue';
import { Table, Button } from 'ant-design-vue';
import { modalSchema } from './data';
const totalSumPeices = computed(() => {
return detailTable.value
.reduce((total: number, item: any) => total + (Number(item.sumPeices) || 0), 0)
.toFixed(2);
});
const emit = defineEmits<{ reload: [] }>();
const isUpdate = ref(false);
const title = computed(() => {
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
@@ -107,9 +99,8 @@ const [BasicModal, modalApi] = useVbenModal({
const { id } = modalApi.getData() as { id?: number | string };
isUpdate.value = !!id;
if (isUpdate.value && id) {
const record:any = await clean_orderInfo(id);
const record = await clean_orderInfo(id);
if (record.starTime) record.starTime = dayjs(record.starTime);
if (record.endTime) record.endTime = dayjs(record.endTime);
editUnitId.value = record.unitId || '';
@@ -121,121 +112,6 @@ const [BasicModal, modalApi] = useVbenModal({
},
});
// 添加订单详情表格配置
const detailGridOptions: VxeGridProps = {
height: '300px',
columns: [
{ type: 'checkbox', width: 60 },
{
title: '序号',
field: 'index',
slots: {
default: ({ rowIndex }) => {
return (rowIndex + 1).toString();
},
},
},
{
title: '劳务名称',
field: 'name',
},
{
title: '计量单位',
field: 'measure',
},
{
title: '计算方式',
field: 'method',
},
{
title: '申报单价含税(元)',
field: 'peices',
},
{
title: '保洁频率',
field: 'frequency',
},
{
title: '保洁标准',
field: 'standard',
},
{
title: '备注',
field: 'remark',
},
{
title: '状态',
field: 'stater',
slots: {
default: ({ row }) => row.stater === 1 ? '启用' : '禁用',
},
},
{
title: '保洁面积',
field: 'area',
},
{
title: '合计费用',
field: 'sumPeices',
},
{
field: 'action',
fixed: 'right',
slots: { default: 'action' },
title: '操作',
width: 120,
},
],
data: [],
};
const detailColumns = [
{ title: '序号', key: 'index'},
{ title: '劳务名称', dataIndex: 'name', key: 'name' },
{ title: '计量单位', dataIndex: 'measure', key: 'measure' },
{ title: '计算方式', dataIndex: 'method', key: 'method' },
{ title: '申报单价含税(元)', dataIndex: 'peices', key: 'peices' },
{ title: '保洁频率', dataIndex: 'frequency', key: 'frequency' },
{ title: '保洁标准', dataIndex: 'standard', key: 'standard' },
{ title: '备注', dataIndex: 'remark', key: 'remark' },
{
title: '状态',
dataIndex: 'stater',
key: 'stater',
customRender: ({ value }: { value: number }) => (value === 1 ? '启用' : '禁用')
},
{ title: '保洁面积', dataIndex: 'area', key: 'area' },
{ title: '合计费用', dataIndex: 'sumPeices', key: 'sumPeices' },
{
title: '操作',
key: 'action',
fixed: 'right',
width: 120,
},
]
const [DetailTable, detailTableApi] = useVbenVxeGrid({
gridOptions: detailGridOptions,
});
const detailTable = ref<any>([])
const [CleanDetailModal, detailModalApi] = useVbenModal({
connectedComponent: cleanDetailModal,
});
function handleAddDetail() {
detailModalApi.setData({});
detailModalApi.open();
}
function handleDetailReload(data: any) {
detailTable.value.push(data)
}
function handleDeleteDetail(record: any,index: number) {
console.log(record,index);
detailTable.value.splice(index,1)
}
async function handleConfirm() {
try {
modalApi.lock(true);
@@ -244,13 +120,15 @@ async function handleConfirm() {
return;
}
const data = cloneDeep(await formApi.getValues());
console.log(data);
console.log(data);
// 单位数据缓存
if (unitListData.length === 0) {
const res = await resident_unitList();
unitListData = res.rows || [];
}
// 劳务数据缓存 cleanListData 已有
// 查找label
const unitObj = unitListData.find(item => item.id === data.unit);
const cleanObj = cleanListData.find(item => item.id === data.name);
@@ -282,54 +160,8 @@ async function handleClosed() {
</script>
<template>
<BasicModal :title="title" >
<BasicModal :title="title">
<BasicForm />
<!-- 添加订单详情部分 -->
<div class="mt-4">
<div class="flex items-center justify-between mb-2">
<h3 class="text-lg font-medium">添加保洁订单详情</h3>
<a-button type="primary" @click="handleAddDetail">
{{ $t('pages.common.add') }}
</a-button>
</div>
<Table :dataSource="detailTable" :columns="detailColumns" :pagination="false" >
<template #bodyCell="{ column, index,record }">
<template v-if="column.key === 'index'">
{{ index + 1 }}
</template>
<template v-else-if="column.key === 'action'">
<Button danger @click="handleDeleteDetail(record,index)">删除</Button>
</template>
</template>
</Table>
<div>费用合计{{ totalSumPeices }}</div>
</div>
<CleanDetailModal @reload="handleDetailReload" />
</BasicModal>
</template>
<style scoped>
.mt-4 {
margin-top: 1rem;
}
.mb-2 {
margin-bottom: 0.5rem;
}
.flex {
display: flex;
}
.items-center {
align-items: center;
}
.justify-between {
justify-content: space-between;
}
.text-lg {
font-size: 1.125rem;
line-height: 1.75rem;
}
.font-medium {
font-weight: 500;
}
</style>

View File

@@ -131,28 +131,28 @@ export const modalSchema: FormSchemaGetter = () => [
component: 'Input',
rules: 'required',
},
// {
// label: '劳务名称',
// fieldName: 'name',
// component: 'ApiSelect',
// componentProps: {
// api: cleanList,
// resultField: 'rows',
// labelField: 'name',
// valueField: 'id',
// },
// rules: 'required',
// },
// {
// label: '服务单价',
// fieldName: 'prices',
// component: 'Input',
// rules: 'required',
// componentProps: {
// placeholder: '',
// disabled: true,
// },
// },
{
label: '劳务名称',
fieldName: 'name',
component: 'ApiSelect',
componentProps: {
api: cleanList,
resultField: 'rows',
labelField: 'name',
valueField: 'id',
},
rules: 'required',
},
{
label: '服务单价',
fieldName: 'prices',
component: 'Input',
rules: 'required',
componentProps: {
placeholder: '',
disabled: true,
},
},
// {
// label: '保洁频率',
// fieldName: 'frequency',

View File

@@ -1,18 +1,11 @@
<script setup lang="ts">
import type { Recordable } from '@vben/types';
import { ref } from 'vue';
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
import { getVxePopupContainer } from '@vben/utils';
import { Modal, Popconfirm, Space } from 'ant-design-vue';
import dayjs from 'dayjs';
import {
import {
useVbenVxeGrid,
vxeCheckboxChecked,
type VxeGridProps
type VxeGridProps
} from '#/adapter/vxe-table';
import {
@@ -138,8 +131,8 @@ function handleDownloadExcel() {
<a-button
:disabled="!vxeCheckboxChecked(tableApi)"
danger
type="primary"
v-access:code="['property:floor:remove']"
type="primary"
v-access:code="['property:floor:remove']"
@click="handleMultiDelete">
{{ $t('pages.common.delete') }}
</a-button>

View File

@@ -27,7 +27,8 @@ export default defineConfig(async () => {
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
// mock代理目标地址
target: 'http://47.109.37.87:3010/',
// target: 'http://by.missmoc.top:3010/',
target: 'http://127.0.0.1:8080/',
ws: true,
},
},

View File

@@ -13,6 +13,7 @@ export const DictEnum = {
WF_BUSINESS_STATUS: 'wf_business_status', // 业务状态
WF_FORM_TYPE: 'wf_form_type', // 表单类型
WF_TASK_STATUS: 'wf_task_status', // 任务状态
WY_SF: 'wy_sf',
} as const;
export type DictEnumKey = keyof typeof DictEnum;