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
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run
This commit is contained in:
@@ -109,6 +109,7 @@ async function setupPackageSelect() {
|
||||
const assets = await assetList({
|
||||
pageNum: 1,
|
||||
pageSize: 1000,
|
||||
params: {stock: 1} //库存不为0
|
||||
});
|
||||
assetsData.value = assets.rows
|
||||
const options = users.rows.map((item) => ({
|
||||
@@ -145,7 +146,8 @@ async function setupPackageSelect() {
|
||||
if (assetInfo) {
|
||||
formApi.updateSchema([{
|
||||
componentProps: {
|
||||
max:assetInfo.stock
|
||||
max: assetInfo.stock,
|
||||
min: 1
|
||||
},
|
||||
fieldName: 'number',
|
||||
}])
|
||||
|
@@ -28,7 +28,7 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
options:getDictOptions(DictEnum.WY_ZCSHZT)
|
||||
},
|
||||
fieldName: 'state',
|
||||
label: '领用状态',
|
||||
label: '审核状态',
|
||||
},
|
||||
// {
|
||||
// component: 'Input',
|
||||
@@ -78,7 +78,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
field: 'applicationTime',
|
||||
},
|
||||
{
|
||||
title: '领用状态',
|
||||
title: '审核状态',
|
||||
field: 'state',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
|
@@ -14,7 +14,7 @@ import {
|
||||
import {
|
||||
applicationExport,
|
||||
applicationList,
|
||||
applicationRemove, applicationUpdate,
|
||||
applicationRemove, applicationVerified,
|
||||
} from '#/api/property/assetManage/application';
|
||||
import type {ApplicationForm} from '#/api/property/assetManage/application/model';
|
||||
import {commonDownloadExcel} from '#/utils/file/download';
|
||||
@@ -98,7 +98,7 @@ async function handleAudit(row: Required<ApplicationForm>, status: number) {
|
||||
info.state = status
|
||||
info.acceptanceTime = new Date()
|
||||
info.acceptanceUserId = userStore.userInfo?.userId
|
||||
await applicationUpdate(info)
|
||||
await applicationVerified(info)
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
import {renderDict} from "#/utils/render";
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
@@ -69,19 +70,24 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
title: '仓库id',
|
||||
field: 'depotId',
|
||||
title: '仓库',
|
||||
field: 'depotName',
|
||||
minWidth:150,
|
||||
},
|
||||
{
|
||||
title: '资产id',
|
||||
field: 'assetId',
|
||||
title: '资产',
|
||||
field: 'assetName',
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '流转类型',
|
||||
field: 'type',
|
||||
width:120,
|
||||
slots:{
|
||||
default:({row})=>{
|
||||
return renderDict(row.type,'wy_cklzlx')
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
@@ -95,8 +101,8 @@ export const columns: VxeGridProps['columns'] = [
|
||||
width:150,
|
||||
},
|
||||
{
|
||||
title: '操作人id',
|
||||
field: 'userId',
|
||||
title: '操作人',
|
||||
field: 'userName',
|
||||
width:150,
|
||||
},
|
||||
{
|
||||
|
@@ -152,8 +152,7 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '工单类型',
|
||||
fieldName: 'type',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {},
|
||||
component: 'TreeSelect',
|
||||
rules: 'selectRequired',
|
||||
},
|
||||
{
|
||||
|
@@ -17,7 +17,10 @@ import workOrdersDetail from './work-orders-detail.vue';
|
||||
import ordersModal from './orders-modal.vue';
|
||||
import {columns, querySchema} from './data';
|
||||
import {onMounted, ref} from "vue";
|
||||
import {workOrdersTypeList} from "#/api/property/businessManagement/workOrdersType";
|
||||
import {
|
||||
workOrdersTypeList,
|
||||
workOrdersTypeListAll
|
||||
} from "#/api/property/businessManagement/workOrdersType";
|
||||
|
||||
const ordersTypeList = ref<any[]>([]);
|
||||
const ordersType = ref<string>('0');
|
||||
@@ -130,11 +133,10 @@ function handleMultiDelete() {
|
||||
|
||||
async function queryOrderType() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1
|
||||
filterSubNodes:true
|
||||
}
|
||||
const res = await workOrdersTypeList(params)
|
||||
ordersTypeList.value = res.rows.map((item) => ({
|
||||
const res = await workOrdersTypeListAll(params)
|
||||
ordersTypeList.value = res.map((item) => ({
|
||||
label: item.orderTypeName,
|
||||
value: item.id,
|
||||
}));
|
||||
|
@@ -14,9 +14,7 @@ import {
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
|
||||
import {modalSchema} from './data';
|
||||
import {personList} from "#/api/property/resident/person";
|
||||
import {renderDictValue} from "#/utils/render";
|
||||
import {workOrdersTypeList} from "#/api/property/businessManagement/workOrdersType";
|
||||
import {workOrdersTypeTree} from "#/api/property/businessManagement/workOrdersType";
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -61,7 +59,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
await queryPersonData()
|
||||
await queryWorkOrdersType()
|
||||
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
@@ -106,34 +104,35 @@ async function handleClosed() {
|
||||
resetInitialized();
|
||||
}
|
||||
|
||||
async function queryPersonData() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1,
|
||||
}
|
||||
const res = await personList(params);
|
||||
const options = res.rows.map((user) => ({
|
||||
label: user.userName + '-' + renderDictValue(user.gender, 'sys_user_sex') + '-' + user.phone,
|
||||
value: user.id,
|
||||
}));
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch:true,
|
||||
filterOption: filterOption
|
||||
}),
|
||||
fieldName: 'initiatorName',
|
||||
},
|
||||
async function queryWorkOrdersType() {
|
||||
const options = await workOrdersTypeTree()
|
||||
formApi.updateSchema([
|
||||
{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch:true,
|
||||
filterOption: filterOption
|
||||
class: 'w-full',
|
||||
fieldNames: {
|
||||
key: 'id',
|
||||
label: 'orderTypeName',
|
||||
value: 'id',
|
||||
children: 'children',
|
||||
},
|
||||
placeholder: '请选择工单类型',
|
||||
showSearch: true,
|
||||
treeData: options,
|
||||
treeDefaultExpandAll: true,
|
||||
treeLine: { showLeafIcon: false },
|
||||
treeNodeFilterProp: 'orderTypeName',
|
||||
treeNodeLabelProp: 'orderTypeName',
|
||||
}),
|
||||
fieldName: 'handler',
|
||||
}])
|
||||
fieldName: 'type',
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
const filterOption = (input: string, option: any) => {
|
||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
};
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@@ -4,11 +4,11 @@ import {renderDict} from "#/utils/render";
|
||||
import {getDictOptions} from "#/utils/dict";
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'orderTypeNo',
|
||||
label: '工单类型编号',
|
||||
},
|
||||
// {
|
||||
// component: 'Input',
|
||||
// fieldName: 'orderTypeNo',
|
||||
// label: '工单类型编号',
|
||||
// },
|
||||
{
|
||||
component: 'Input',
|
||||
fieldName: 'orderTypeName',
|
||||
@@ -25,7 +25,7 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
];
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
// { type: 'checkbox', width: 60 },
|
||||
// {
|
||||
// title: '工单类型编号',
|
||||
// field: 'orderTypeNo',
|
||||
@@ -33,6 +33,8 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '类型名称',
|
||||
field: 'orderTypeName',
|
||||
treeNode: true,
|
||||
minWidth:180,
|
||||
},
|
||||
{
|
||||
title: '运作模式',
|
||||
@@ -42,15 +44,17 @@ export const columns: VxeGridProps['columns'] = [
|
||||
return renderDict(row.operationMode, 'pro_operation_pattern');
|
||||
},
|
||||
},
|
||||
minWidth:'120'
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '排序值',
|
||||
field: 'sort',
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '累计工单数量',
|
||||
field: 'number',
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
title: '是否支持转单',
|
||||
@@ -60,7 +64,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
return renderDict(row.isTransfers, 'support_transferring_orders');
|
||||
},
|
||||
},
|
||||
minWidth:'120'
|
||||
width:180,
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
@@ -87,6 +91,11 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '父级类型',
|
||||
fieldName: 'parentId',
|
||||
component: 'Select',
|
||||
},
|
||||
{
|
||||
label: '运作模式',
|
||||
fieldName: 'operationMode',
|
||||
|
@@ -8,13 +8,14 @@ import {
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
import {
|
||||
workOrdersTypeList,
|
||||
workOrdersTypeListAll,
|
||||
workOrdersTypeRemove,
|
||||
} from '#/api/property/businessManagement/workOrdersType';
|
||||
import type { WorkOrdersTypeForm } from '#/api/property/businessManagement/workOrdersType/model';
|
||||
import workOrdersTypeModal from './workOrdersType-modal.vue';
|
||||
import workOrdersTypeDetail from './workOrdersType-detail.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import {ref} from "vue";
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
@@ -39,21 +40,27 @@ const gridOptions: VxeGridProps = {
|
||||
columns,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
pagerConfig: {
|
||||
enabled:false,
|
||||
},
|
||||
proxyConfig: {
|
||||
ajax: {
|
||||
query: async ({ page }, formValues = {}) => {
|
||||
return await workOrdersTypeList({
|
||||
pageNum: page.currentPage,
|
||||
pageSize: page.pageSize,
|
||||
query: async (_, formValues = {}) => {
|
||||
const resp = await workOrdersTypeListAll({
|
||||
...formValues,
|
||||
});
|
||||
return { rows: resp };
|
||||
},
|
||||
},
|
||||
},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
treeConfig: {
|
||||
parentField: 'parentId',
|
||||
rowField: 'id',
|
||||
transform: true,
|
||||
},
|
||||
// 表格全局唯一表示 保存列配置需要用到
|
||||
id: 'property-workOrdersType-index'
|
||||
};
|
||||
@@ -87,6 +94,7 @@ async function handleEdit(row: Required<WorkOrdersTypeForm>) {
|
||||
}
|
||||
|
||||
async function handleDelete(row: Required<WorkOrdersTypeForm>) {
|
||||
console.log(row,'======row')
|
||||
await workOrdersTypeRemove(row.id);
|
||||
await tableApi.query();
|
||||
}
|
||||
@@ -111,14 +119,14 @@ function handleMultiDelete() {
|
||||
<BasicTable table-title="工单类型列表">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||
danger
|
||||
type="primary"
|
||||
v-access:code="['property:workOrdersType:remove']"
|
||||
@click="handleMultiDelete">
|
||||
{{ $t('pages.common.delete') }}
|
||||
</a-button>
|
||||
<!-- <a-button-->
|
||||
<!-- :disabled="!vxeCheckboxChecked(tableApi)"-->
|
||||
<!-- danger-->
|
||||
<!-- type="primary"-->
|
||||
<!-- v-access:code="['property:workOrdersType:remove']"-->
|
||||
<!-- @click="handleMultiDelete">-->
|
||||
<!-- {{ $t('pages.common.delete') }}-->
|
||||
<!-- </a-button>-->
|
||||
<a-button
|
||||
type="primary"
|
||||
v-access:code="['property:workOrdersType:add']"
|
||||
@@ -151,6 +159,7 @@ function handleMultiDelete() {
|
||||
danger
|
||||
v-access:code="['property:workOrdersType:remove']"
|
||||
@click.stop=""
|
||||
:disabled="row.children?.length>0"
|
||||
>
|
||||
{{ $t('pages.common.delete') }}
|
||||
</ghost-button>
|
||||
|
@@ -30,9 +30,9 @@ async function handleOpenChange(open: boolean) {
|
||||
<template>
|
||||
<BasicModal :footer="false" :fullscreen-button="false" title="工单类型信息" class="w-[70%]">
|
||||
<Descriptions v-if="workOrdersTypeInfoDetail" size="small" :column="2" bordered :labelStyle="{width:'120px'}">
|
||||
<DescriptionsItem label="工单类型编号">
|
||||
{{ workOrdersTypeInfoDetail.orderTypeNo }}
|
||||
</DescriptionsItem>
|
||||
<!-- <DescriptionsItem label="工单类型编号">-->
|
||||
<!-- {{ workOrdersTypeInfoDetail.orderTypeNo }}-->
|
||||
<!-- </DescriptionsItem>-->
|
||||
<DescriptionsItem label="类型名称">
|
||||
{{ workOrdersTypeInfoDetail.orderTypeName }}
|
||||
</DescriptionsItem>
|
||||
|
@@ -1,12 +1,16 @@
|
||||
<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 { workOrdersTypeAdd, workOrdersTypeInfo, workOrdersTypeUpdate } from '#/api/property/businessManagement/workOrdersType';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import { modalSchema } from './data';
|
||||
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 {
|
||||
workOrdersTypeAdd,
|
||||
workOrdersTypeInfo, workOrdersTypeListAll,
|
||||
workOrdersTypeUpdate
|
||||
} from '#/api/property/businessManagement/workOrdersType';
|
||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
||||
import {modalSchema} from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
const isUpdate = ref(false);
|
||||
@@ -31,7 +35,7 @@ const [BasicForm, formApi] = useVbenForm({
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
@@ -40,7 +44,7 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[60%]',
|
||||
class: 'w-[70%]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
@@ -50,10 +54,9 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
const {id} = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
await initTypeOptions(id)
|
||||
if (isUpdate.value && id) {
|
||||
const record = await workOrdersTypeInfo(id);
|
||||
record.operationMode = record.operationMode?.toString();
|
||||
@@ -69,7 +72,7 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
const {valid} = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
@@ -90,11 +93,30 @@ async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
|
||||
async function initTypeOptions(id:string) {
|
||||
let params = {
|
||||
excludeId:id,
|
||||
filterSubNodes: true //过滤子级
|
||||
}
|
||||
const typeList = await workOrdersTypeListAll(params)
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: typeList,
|
||||
showSearch: true,
|
||||
optionFilterProp: 'orderTypeName',
|
||||
fieldNames: {label: 'orderTypeName', value: 'id'},
|
||||
allowClear: true,
|
||||
}),
|
||||
fieldName: 'parentId',
|
||||
},
|
||||
]);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<BasicForm/>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -32,49 +32,26 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
// {
|
||||
// title: '任务编号',
|
||||
// field: 'id',
|
||||
// width:'auto'
|
||||
// },
|
||||
// {
|
||||
// title: '巡检计划',
|
||||
// field: 'planName',
|
||||
// minWidth:200
|
||||
// },
|
||||
// {
|
||||
// title: '巡检时间范围',
|
||||
// field: 'planInsTime',
|
||||
// width:'auto'
|
||||
//
|
||||
// },
|
||||
// // {
|
||||
// // title: '实际巡检时间',
|
||||
// // field: 'endDate',
|
||||
// // width:180
|
||||
// //
|
||||
// // },
|
||||
// {
|
||||
// title: '签到状态',
|
||||
// field: 'actInsTime',
|
||||
// width:150,
|
||||
// },
|
||||
// {
|
||||
// title: '巡检人',
|
||||
// field: 'planUserName',
|
||||
// width:'auto'
|
||||
//
|
||||
// },
|
||||
// {
|
||||
// title: '巡检方式',
|
||||
// field: 'taskType',
|
||||
// width:'auto',
|
||||
// slots: {
|
||||
// default: ({ row }) => {
|
||||
// return renderDict(row.taskType, 'wy_xjqdfs');
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
{
|
||||
title: '巡检计划',
|
||||
field: 'planId',
|
||||
minWidth:200
|
||||
},
|
||||
{
|
||||
title: '巡检任务',
|
||||
field: 'taskId',
|
||||
width:150
|
||||
},
|
||||
{
|
||||
title: '巡检路线',
|
||||
field: 'routeId',
|
||||
width:150
|
||||
},
|
||||
{
|
||||
title: '巡检点',
|
||||
field: 'pointId',
|
||||
width:150
|
||||
},
|
||||
{
|
||||
title: '签到类型',
|
||||
field: 'signType',
|
||||
@@ -118,7 +95,7 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '备注',
|
||||
field: 'remark',
|
||||
minWidth:120
|
||||
width:180
|
||||
},
|
||||
// {
|
||||
// field: 'action',
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import {type FormSchemaGetter, z} from '#/adapter/form';
|
||||
import {type FormSchemaGetter} from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'Input',
|
||||
@@ -10,8 +9,6 @@ export const querySchema: FormSchemaGetter = () => [
|
||||
},
|
||||
];
|
||||
|
||||
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||
// export const columns: () => VxeGridProps['columns'] = () => [
|
||||
export const columns: VxeGridProps['columns'] = [
|
||||
{ type: 'checkbox', width: 60 },
|
||||
{
|
||||
@@ -61,19 +58,85 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '巡检点',
|
||||
fieldName: 'pointId',
|
||||
component: 'ApiSelect',
|
||||
componentProps:{
|
||||
mode: 'multiple',
|
||||
},
|
||||
rules: z.array(z.string()).min(1, { message: '请选择' }),
|
||||
formItemClass: 'col-span-2',
|
||||
},
|
||||
{
|
||||
label: '备注',
|
||||
fieldName: 'remark',
|
||||
component: 'Textarea',
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
//!!!!!!
|
||||
export const querySchemaPoint: FormSchemaGetter = () => [
|
||||
{
|
||||
component: 'ApiSelect',
|
||||
fieldName: 'pointId',
|
||||
label: '巡检点名称',
|
||||
componentProps: {},
|
||||
},
|
||||
];
|
||||
|
||||
export const columnsPoint: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '巡检点ID',
|
||||
field: 'pointId',
|
||||
},
|
||||
{
|
||||
title: '巡检点名称',
|
||||
field: 'pointName',
|
||||
},
|
||||
{
|
||||
field: 'action',
|
||||
fixed: 'right',
|
||||
slots: { default: 'action' },
|
||||
title: '操作',
|
||||
width: 180,
|
||||
},
|
||||
];
|
||||
|
||||
export const modalSchemaPoint: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键id',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '巡检点名称',
|
||||
fieldName: 'pointId',
|
||||
rules: 'required',
|
||||
component: 'ApiSelect',
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
label: '开始时间',
|
||||
fieldName: 'startTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
placeholder: '请选择开始时间',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '结束时间',
|
||||
fieldName: 'endTime',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
showTime: true,
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
placeholder: '请选择开始时间',
|
||||
},
|
||||
rules: 'required',
|
||||
},
|
||||
{
|
||||
label: '排序',
|
||||
fieldName: 'sort',
|
||||
component: 'Input',
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
||||
|
@@ -1,14 +1,8 @@
|
||||
<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 { ref } from 'vue';
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
vxeCheckboxChecked,
|
||||
@@ -33,15 +27,6 @@ const formOptions: VbenFormProps = {
|
||||
},
|
||||
schema: querySchema(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
// 处理区间选择器RangePicker时间格式 将一个字段映射为两个字段 搜索/导出会用到
|
||||
// 不需要直接删除
|
||||
// fieldMappingTime: [
|
||||
// [
|
||||
// 'createTime',
|
||||
// ['params[beginTime]', 'params[endTime]'],
|
||||
// ['YYYY-MM-DD 00:00:00', 'YYYY-MM-DD 23:59:59'],
|
||||
// ],
|
||||
// ],
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
@@ -114,6 +99,12 @@ function handleMultiDelete() {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
const parentData = ref({})
|
||||
const handleUpdate = (dataSet) => {
|
||||
parentData.value = dataSet; // 更新父组件的数据源
|
||||
console.log(parentData.value,111123);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -163,6 +154,6 @@ function handleMultiDelete() {
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<InspectionRouteModal @reload="tableApi.query()" />
|
||||
<InspectionRouteModal @reload="tableApi.query()" @update-data="handleUpdate"/>
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -1,15 +1,20 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
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 { inspectionRouteAdd, inspectionRouteInfo, inspectionRouteUpdate } from '#/api/property/inspectionManagement/inspectionRoute';
|
||||
import {
|
||||
inspectionRouteAdd,
|
||||
inspectionRouteInfo,
|
||||
inspectionRouteList,
|
||||
inspectionRouteUpdate
|
||||
} from '#/api/property/inspectionManagement/inspectionRoute';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import {
|
||||
inspectionPointList,
|
||||
} from '#/api/property/inspectionManagement/inspectionPoint';
|
||||
import { modalSchema } from './data';
|
||||
import {modalSchema} from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
@@ -20,11 +25,8 @@ const title = computed(() => {
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
// 默认占满两列
|
||||
formItemClass: 'col-span-1',
|
||||
// 默认label宽度 px
|
||||
labelWidth: 100,
|
||||
// 通用配置项 会影响到所有表单项
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
@@ -41,8 +43,8 @@ const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
},
|
||||
);
|
||||
|
||||
const pointList = ref<any[]>([]);
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
// 在这里更改宽度
|
||||
class: 'w-[60%]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
@@ -59,11 +61,15 @@ const [BasicModal, modalApi] = useVbenModal({
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await inspectionRouteInfo(id);
|
||||
record.pointId = record.pointId?.split(',')
|
||||
pointList.value = (record.inspectionRoutePointVoList || []).map(item => ({
|
||||
pointId: item.pointId ?? '',
|
||||
pointName: item.pointName ?? '',
|
||||
}));
|
||||
await tableApi.reload();
|
||||
console.log(pointList.value,111)
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
@@ -75,9 +81,11 @@ async function handleConfirm() {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
data.pointId = data.pointId?.join(',')
|
||||
let data = {
|
||||
...cloneDeep(await formApi.getValues()),
|
||||
inspectionRoutePointBoList:[pointData.value]
|
||||
}
|
||||
console.log(data,333)
|
||||
await (isUpdate.value ? inspectionRouteUpdate(data) : inspectionRouteAdd(data));
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
@@ -104,12 +112,11 @@ async function queryWorkOrdersType() {
|
||||
label: item.pointName,
|
||||
value: item.id,
|
||||
}));
|
||||
formApi.updateSchema([{
|
||||
tableApi.formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch: true,
|
||||
filterOption: filterOption,
|
||||
mode: 'multiple',
|
||||
}),
|
||||
fieldName: 'pointId',
|
||||
}])
|
||||
@@ -118,11 +125,100 @@ async function queryWorkOrdersType() {
|
||||
const filterOption = (input: string, option: any) => {
|
||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
};
|
||||
|
||||
|
||||
//!!!!!!
|
||||
import { Page, type VbenFormProps } from '@vben/common-ui';
|
||||
import { Space } from 'ant-design-vue';
|
||||
import {
|
||||
useVbenVxeGrid,
|
||||
type VxeGridProps
|
||||
} from '#/adapter/vxe-table';
|
||||
import dayjs from 'dayjs';
|
||||
import type { InspectionRouteForm } from '#/api/property/inspectionManagement/inspectionRoute/model';
|
||||
import pointModal from './point-modal.vue';
|
||||
import { columnsPoint, querySchemaPoint } from './data';
|
||||
|
||||
const formOptions: VbenFormProps = {
|
||||
commonConfig: {
|
||||
labelWidth: 90,
|
||||
componentProps: {
|
||||
allowClear: true,
|
||||
},
|
||||
},
|
||||
schema: querySchemaPoint(),
|
||||
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',
|
||||
};
|
||||
|
||||
const gridOptions: VxeGridProps = {
|
||||
checkboxConfig: {
|
||||
highlight: true,
|
||||
reserve: true,
|
||||
},
|
||||
columns: columnsPoint,
|
||||
height: 'auto',
|
||||
keepSource: true,
|
||||
pagerConfig: {},
|
||||
rowConfig: {
|
||||
keyField: 'id',
|
||||
},
|
||||
id: 'property-inspectionRoutePoint-index'
|
||||
};
|
||||
|
||||
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||
formOptions,
|
||||
gridOptions,
|
||||
});
|
||||
|
||||
const [PointModal, pointModalApi] = useVbenModal({
|
||||
connectedComponent: pointModal,
|
||||
});
|
||||
|
||||
function handleAdd() {
|
||||
pointModalApi.setData({});
|
||||
pointModalApi.open();
|
||||
}
|
||||
|
||||
async function handleEdit(row: Required<InspectionRouteForm>) {
|
||||
pointModalApi.setData({ id: row.id });
|
||||
pointModalApi.open();
|
||||
}
|
||||
|
||||
const pointData = ref({})
|
||||
const handlePoint = (data) => {
|
||||
data.startTime = dayjs(data.startTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
data.endTime = dayjs(data.endTime).format('YYYY-MM-DD HH:mm:ss')
|
||||
pointData.value = data;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal :title="title">
|
||||
<BasicForm />
|
||||
<Page :auto-content-height="true" style="background-color: #F1F3F6">
|
||||
<BasicTable table-title="巡检点" :grid-options="gridOptions">
|
||||
<template #toolbar-tools>
|
||||
<Space>
|
||||
<a-button
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>
|
||||
{{ $t('pages.common.add') }}
|
||||
</a-button>
|
||||
</Space>
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<ghost-button
|
||||
@click.stop="handleEdit(row)"
|
||||
>
|
||||
{{ '巡检点' }}
|
||||
</ghost-button>
|
||||
</Space>
|
||||
</template>
|
||||
</BasicTable>
|
||||
<PointModal @reload="tableApi.query()" @update-data="handlePoint"/>
|
||||
</Page>
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
||||
|
@@ -0,0 +1,116 @@
|
||||
<script setup lang="ts">
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { inspectionRouteInfo } from '#/api/property/inspectionManagement/inspectionRoute';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import {
|
||||
inspectionPointList,
|
||||
} from '#/api/property/inspectionManagement/inspectionPoint';
|
||||
import { modalSchemaPoint } from './data';
|
||||
import {ref} from "vue";
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const isUpdate = ref(false);
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-2',
|
||||
labelWidth: 100,
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
schema: modalSchemaPoint(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
);
|
||||
|
||||
const [BasicModal, modalApi] = useVbenModal({
|
||||
class: 'w-[550px]',
|
||||
fullscreenButton: false,
|
||||
onBeforeClose,
|
||||
onClosed: handleClosed,
|
||||
onConfirm: handleConfirm,
|
||||
onOpenChange: async (isOpen) => {
|
||||
if (!isOpen) {
|
||||
return null;
|
||||
}
|
||||
modalApi.modalLoading(true);
|
||||
await queryWorkOrdersType()
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
isUpdate.value = !!id;
|
||||
|
||||
if (isUpdate.value && id) {
|
||||
const record = await inspectionRouteInfo(id);
|
||||
await formApi.setValues(record);
|
||||
}
|
||||
await markInitialized();
|
||||
|
||||
modalApi.modalLoading(false);
|
||||
},
|
||||
});
|
||||
|
||||
async function handleConfirm() {
|
||||
try {
|
||||
modalApi.lock(true);
|
||||
const { valid } = await formApi.validate();
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
emit('update-data', data);
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
|
||||
async function queryWorkOrdersType() {
|
||||
let params = {
|
||||
pageSize: 1000,
|
||||
pageNum: 1
|
||||
}
|
||||
const res = await inspectionPointList(params)
|
||||
const options = res.rows.map((item) => ({
|
||||
label: item.pointName,
|
||||
value: item.id,
|
||||
}));
|
||||
formApi.updateSchema([{
|
||||
componentProps: () => ({
|
||||
options: options,
|
||||
showSearch: true,
|
||||
filterOption: filterOption,
|
||||
}),
|
||||
fieldName: 'pointId',
|
||||
}])
|
||||
}
|
||||
|
||||
const filterOption = (input: string, option: any) => {
|
||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal title="选择巡检点">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user