客户服务
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import type {FormSchemaGetter} from '#/adapter/form';
|
import type {FormSchemaGetter} from '#/adapter/form';
|
||||||
import type {VxeGridProps} from '#/adapter/vxe-table';
|
import type {VxeGridProps} from '#/adapter/vxe-table';
|
||||||
import {renderDict} from "#/utils/render";
|
import {renderDict} from "#/utils/render";
|
||||||
import {getDictOptions} from "#/utils/dict";
|
|
||||||
|
|
||||||
export const querySchema: FormSchemaGetter = () => [
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
{
|
{
|
||||||
@@ -14,14 +13,6 @@ export const querySchema: FormSchemaGetter = () => [
|
|||||||
fieldName: 'orderName',
|
fieldName: 'orderName',
|
||||||
label: '工单名称',
|
label: '工单名称',
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// component: 'Select',
|
|
||||||
// componentProps: {
|
|
||||||
// options: getDictOptions('wy_gdclzt'),
|
|
||||||
// },
|
|
||||||
// fieldName: 'status',
|
|
||||||
// label: '状态',
|
|
||||||
// },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const columns: VxeGridProps['columns'] = [
|
export const columns: VxeGridProps['columns'] = [
|
||||||
@@ -63,37 +54,4 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ordersModalSchema: FormSchemaGetter = () => [
|
|
||||||
{
|
|
||||||
label: 'id',
|
|
||||||
fieldName: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
dependencies: {
|
|
||||||
show: () => false,
|
|
||||||
triggerFields: [''],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '状态',
|
|
||||||
fieldName: 'status',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions('wy_gdclzt'),
|
|
||||||
},
|
|
||||||
rules: 'selectRequired',
|
|
||||||
disabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '处理人',
|
|
||||||
fieldName: 'handler',
|
|
||||||
component: 'ApiSelect',
|
|
||||||
formItemClass: 'col-span-2',
|
|
||||||
rules: 'selectRequired',
|
|
||||||
dependencies: {
|
|
||||||
disabled: (formValue) =>formValue.status === '2' ,
|
|
||||||
triggerFields: ['status'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,138 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import {useVbenModal} from '@vben/common-ui';
|
|
||||||
import {cloneDeep} from '@vben/utils';
|
|
||||||
import {useVbenForm} from '#/adapter/form';
|
|
||||||
import {
|
|
||||||
workOrdersInfo,
|
|
||||||
workOrdersUpdate
|
|
||||||
} from '#/api/property/businessManagement/workOrders';
|
|
||||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
|
||||||
import {ordersModalSchema} from './data';
|
|
||||||
import {personList} from "#/api/property/resident/person";
|
|
||||||
import {renderDictValue} from "#/utils/render";
|
|
||||||
import {ref} from "vue";
|
|
||||||
import { useUserStore } from '@vben/stores';
|
|
||||||
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
|
||||||
|
|
||||||
const [BasicForm, formApi] = useVbenForm({
|
|
||||||
commonConfig: {
|
|
||||||
// 默认占满两列
|
|
||||||
formItemClass: 'col-span-1',
|
|
||||||
// 默认label宽度 px
|
|
||||||
labelWidth: 80,
|
|
||||||
// 通用配置项 会影响到所有表单项
|
|
||||||
componentProps: {
|
|
||||||
class: 'w-full',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
schema: ordersModalSchema(),
|
|
||||||
showDefaultActions: false,
|
|
||||||
wrapperClass: 'grid-cols-2',
|
|
||||||
});
|
|
||||||
|
|
||||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
|
||||||
{
|
|
||||||
initializedGetter: defaultFormValueGetter(formApi),
|
|
||||||
currentGetter: defaultFormValueGetter(formApi),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const record = ref({})
|
|
||||||
const title = ref('派单')
|
|
||||||
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 queryPersonData()
|
|
||||||
const {id} = modalApi.getData() as { id?: number | string };
|
|
||||||
const {mean} = modalApi.getData() as { rob?: number | string };
|
|
||||||
if (id) {
|
|
||||||
record.value = await workOrdersInfo(id);
|
|
||||||
if(mean === 'rob'){
|
|
||||||
title.value = '抢单'
|
|
||||||
record.value.status = '2';
|
|
||||||
record.value.handler = record.value.initiatorPeople;
|
|
||||||
}else{
|
|
||||||
title.value = '派单'
|
|
||||||
record.value.status = '1';
|
|
||||||
record.value.handler = null;
|
|
||||||
}
|
|
||||||
await formApi.setValues(record.value);
|
|
||||||
}
|
|
||||||
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());
|
|
||||||
if(title.value === '派单'){
|
|
||||||
record.value.handler = data.handler
|
|
||||||
}else{
|
|
||||||
record.value.handler = userStore.userInfo.userId
|
|
||||||
}
|
|
||||||
await workOrdersUpdate(record.value)
|
|
||||||
resetInitialized();
|
|
||||||
emit('reload');
|
|
||||||
modalApi.close();
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
} finally {
|
|
||||||
modalApi.lock(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleClosed() {
|
|
||||||
await formApi.resetForm();
|
|
||||||
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: 'handler',
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
|
|
||||||
const filterOption = (input: string, option: any) => {
|
|
||||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<BasicModal :title="title">
|
|
||||||
<BasicForm/>
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
|
|
@@ -1,7 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, ref, shallowRef} from 'vue';
|
import {ref, shallowRef} from 'vue';
|
||||||
import {useVbenModal} from '@vben/common-ui';
|
import {useVbenModal} from '@vben/common-ui';
|
||||||
import {Descriptions, DescriptionsItem, Timeline, TimelineItem, Rate,Divider} from 'ant-design-vue';
|
import {Descriptions, DescriptionsItem, Timeline, TimelineItem, Divider} from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import duration from 'dayjs/plugin/duration';
|
import duration from 'dayjs/plugin/duration';
|
||||||
import relativeTime from 'dayjs/plugin/relativeTime';
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
||||||
|
@@ -1,163 +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 {
|
|
||||||
workOrdersAdd,
|
|
||||||
workOrdersInfo,
|
|
||||||
workOrdersUpdate
|
|
||||||
} from '#/api/property/businessManagement/workOrders';
|
|
||||||
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";
|
|
||||||
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
|
||||||
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const title = computed(() => {
|
|
||||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
|
||||||
});
|
|
||||||
|
|
||||||
const [BasicForm, formApi] = useVbenForm({
|
|
||||||
commonConfig: {
|
|
||||||
// 默认占满两列
|
|
||||||
formItemClass: 'col-span-1',
|
|
||||||
// 默认label宽度 px
|
|
||||||
labelWidth: 80,
|
|
||||||
// 通用配置项 会影响到所有表单项
|
|
||||||
componentProps: {
|
|
||||||
class: 'w-full',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
schema: modalSchema(),
|
|
||||||
showDefaultActions: false,
|
|
||||||
wrapperClass: 'grid-cols-2',
|
|
||||||
});
|
|
||||||
|
|
||||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
|
||||||
{
|
|
||||||
initializedGetter: defaultFormValueGetter(formApi),
|
|
||||||
currentGetter: defaultFormValueGetter(formApi),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const [BasicModal, modalApi] = useVbenModal({
|
|
||||||
// 在这里更改宽度
|
|
||||||
class: 'w-[70%]',
|
|
||||||
fullscreenButton: false,
|
|
||||||
onBeforeClose,
|
|
||||||
onClosed: handleClosed,
|
|
||||||
onConfirm: handleConfirm,
|
|
||||||
onOpenChange: async (isOpen) => {
|
|
||||||
if (!isOpen) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
modalApi.modalLoading(true);
|
|
||||||
await queryPersonData()
|
|
||||||
await queryWorkOrdersType()
|
|
||||||
const {id} = modalApi.getData() as { id?: number | string };
|
|
||||||
isUpdate.value = !!id;
|
|
||||||
|
|
||||||
if (isUpdate.value && id) {
|
|
||||||
const record = await workOrdersInfo(id);
|
|
||||||
record.isTimeOut = record.isTimeOut?.toString()
|
|
||||||
await formApi.setValues(record);
|
|
||||||
}
|
|
||||||
await markInitialized();
|
|
||||||
|
|
||||||
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 ? workOrdersUpdate(data) : workOrdersAdd(data));
|
|
||||||
resetInitialized();
|
|
||||||
emit('reload');
|
|
||||||
modalApi.close();
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
} finally {
|
|
||||||
modalApi.lock(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleClosed() {
|
|
||||||
await formApi.resetForm();
|
|
||||||
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',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
componentProps: () => ({
|
|
||||||
options: options,
|
|
||||||
showSearch:true,
|
|
||||||
filterOption: filterOption
|
|
||||||
}),
|
|
||||||
fieldName: 'handler',
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
|
|
||||||
async function queryWorkOrdersType() {
|
|
||||||
let params = {
|
|
||||||
pageSize: 1000,
|
|
||||||
pageNum: 1
|
|
||||||
}
|
|
||||||
const res = await workOrdersTypeList(params)
|
|
||||||
const options = res.rows.map((item) => ({
|
|
||||||
label: item.orderTypeName,
|
|
||||||
value: item.id,
|
|
||||||
}));
|
|
||||||
formApi.updateSchema([{
|
|
||||||
componentProps: () => ({
|
|
||||||
options: options,
|
|
||||||
filterOption: filterOption,
|
|
||||||
showSearch:true,
|
|
||||||
}),
|
|
||||||
fieldName: 'type',
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
|
|
||||||
const filterOption = (input: string, option: any) => {
|
|
||||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<BasicModal :title="title">
|
|
||||||
<BasicForm/>
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
|
|
@@ -3,7 +3,6 @@ import type {VxeGridProps} from '#/adapter/vxe-table';
|
|||||||
import {renderDict} from "#/utils/render";
|
import {renderDict} from "#/utils/render";
|
||||||
import {h} from "vue";
|
import {h} from "vue";
|
||||||
import {Rate} from "ant-design-vue";
|
import {Rate} from "ant-design-vue";
|
||||||
import {getDictOptions} from "#/utils/dict";
|
|
||||||
|
|
||||||
export const querySchema: FormSchemaGetter = () => [
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
{
|
{
|
||||||
@@ -16,14 +15,6 @@ export const querySchema: FormSchemaGetter = () => [
|
|||||||
fieldName: 'orderName',
|
fieldName: 'orderName',
|
||||||
label: '工单名称',
|
label: '工单名称',
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// component: 'Select',
|
|
||||||
// componentProps: {
|
|
||||||
// options: getDictOptions('wy_gdclzt'),
|
|
||||||
// },
|
|
||||||
// fieldName: 'status',
|
|
||||||
// label: '状态',
|
|
||||||
// },
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const columns: VxeGridProps['columns'] = [
|
export const columns: VxeGridProps['columns'] = [
|
||||||
@@ -104,36 +95,3 @@ export const columns: VxeGridProps['columns'] = [
|
|||||||
width: 120,
|
width: 120,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const ordersModalSchema: FormSchemaGetter = () => [
|
|
||||||
{
|
|
||||||
label: 'id',
|
|
||||||
fieldName: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
dependencies: {
|
|
||||||
show: () => false,
|
|
||||||
triggerFields: [''],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '状态',
|
|
||||||
fieldName: 'status',
|
|
||||||
component: 'Select',
|
|
||||||
componentProps: {
|
|
||||||
options: getDictOptions('wy_gdclzt'),
|
|
||||||
},
|
|
||||||
rules: 'selectRequired',
|
|
||||||
disabled: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '处理人',
|
|
||||||
fieldName: 'handler',
|
|
||||||
component: 'ApiSelect',
|
|
||||||
formItemClass: 'col-span-2',
|
|
||||||
rules: 'selectRequired',
|
|
||||||
dependencies: {
|
|
||||||
disabled: (formValue) =>formValue.status === '2' ,
|
|
||||||
triggerFields: ['status'],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
@@ -1,138 +0,0 @@
|
|||||||
<script setup lang="ts">
|
|
||||||
import {useVbenModal} from '@vben/common-ui';
|
|
||||||
import {cloneDeep} from '@vben/utils';
|
|
||||||
import {useVbenForm} from '#/adapter/form';
|
|
||||||
import {
|
|
||||||
workOrdersInfo,
|
|
||||||
workOrdersUpdate
|
|
||||||
} from '#/api/property/businessManagement/workOrders';
|
|
||||||
import {defaultFormValueGetter, useBeforeCloseDiff} from '#/utils/popup';
|
|
||||||
import {ordersModalSchema} from './data';
|
|
||||||
import {personList} from "#/api/property/resident/person";
|
|
||||||
import {renderDictValue} from "#/utils/render";
|
|
||||||
import {ref} from "vue";
|
|
||||||
import { useUserStore } from '@vben/stores';
|
|
||||||
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
|
||||||
|
|
||||||
const [BasicForm, formApi] = useVbenForm({
|
|
||||||
commonConfig: {
|
|
||||||
// 默认占满两列
|
|
||||||
formItemClass: 'col-span-1',
|
|
||||||
// 默认label宽度 px
|
|
||||||
labelWidth: 80,
|
|
||||||
// 通用配置项 会影响到所有表单项
|
|
||||||
componentProps: {
|
|
||||||
class: 'w-full',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
schema: ordersModalSchema(),
|
|
||||||
showDefaultActions: false,
|
|
||||||
wrapperClass: 'grid-cols-2',
|
|
||||||
});
|
|
||||||
|
|
||||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
|
||||||
{
|
|
||||||
initializedGetter: defaultFormValueGetter(formApi),
|
|
||||||
currentGetter: defaultFormValueGetter(formApi),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const record = ref({})
|
|
||||||
const title = ref('派单')
|
|
||||||
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 queryPersonData()
|
|
||||||
const {id} = modalApi.getData() as { id?: number | string };
|
|
||||||
const {mean} = modalApi.getData() as { rob?: number | string };
|
|
||||||
if (id) {
|
|
||||||
record.value = await workOrdersInfo(id);
|
|
||||||
if(mean === 'rob'){
|
|
||||||
title.value = '抢单'
|
|
||||||
record.value.status = '2';
|
|
||||||
record.value.handler = record.value.initiatorPeople;
|
|
||||||
}else{
|
|
||||||
title.value = '派单'
|
|
||||||
record.value.status = '1';
|
|
||||||
record.value.handler = null;
|
|
||||||
}
|
|
||||||
await formApi.setValues(record.value);
|
|
||||||
}
|
|
||||||
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());
|
|
||||||
if(title.value === '派单'){
|
|
||||||
record.value.handler = data.handler
|
|
||||||
}else{
|
|
||||||
record.value.handler = userStore.userInfo.userId
|
|
||||||
}
|
|
||||||
await workOrdersUpdate(record.value)
|
|
||||||
resetInitialized();
|
|
||||||
emit('reload');
|
|
||||||
modalApi.close();
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
} finally {
|
|
||||||
modalApi.lock(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleClosed() {
|
|
||||||
await formApi.resetForm();
|
|
||||||
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: 'handler',
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
|
|
||||||
const filterOption = (input: string, option: any) => {
|
|
||||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<BasicModal :title="title">
|
|
||||||
<BasicForm/>
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
|
|
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {computed, ref, shallowRef} from 'vue';
|
import {ref, shallowRef} from 'vue';
|
||||||
import {useVbenModal} from '@vben/common-ui';
|
import {useVbenModal} from '@vben/common-ui';
|
||||||
import {Descriptions, DescriptionsItem, Timeline, TimelineItem, Rate,Divider} from 'ant-design-vue';
|
import {Descriptions, DescriptionsItem, Timeline, TimelineItem, Rate,Divider} from 'ant-design-vue';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
@@ -1,163 +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 {
|
|
||||||
workOrdersAdd,
|
|
||||||
workOrdersInfo,
|
|
||||||
workOrdersUpdate
|
|
||||||
} from '#/api/property/businessManagement/workOrders';
|
|
||||||
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";
|
|
||||||
|
|
||||||
const emit = defineEmits<{ reload: [] }>();
|
|
||||||
|
|
||||||
const isUpdate = ref(false);
|
|
||||||
const title = computed(() => {
|
|
||||||
return isUpdate.value ? $t('pages.common.edit') : $t('pages.common.add');
|
|
||||||
});
|
|
||||||
|
|
||||||
const [BasicForm, formApi] = useVbenForm({
|
|
||||||
commonConfig: {
|
|
||||||
// 默认占满两列
|
|
||||||
formItemClass: 'col-span-1',
|
|
||||||
// 默认label宽度 px
|
|
||||||
labelWidth: 80,
|
|
||||||
// 通用配置项 会影响到所有表单项
|
|
||||||
componentProps: {
|
|
||||||
class: 'w-full',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
schema: modalSchema(),
|
|
||||||
showDefaultActions: false,
|
|
||||||
wrapperClass: 'grid-cols-2',
|
|
||||||
});
|
|
||||||
|
|
||||||
const {onBeforeClose, markInitialized, resetInitialized} = useBeforeCloseDiff(
|
|
||||||
{
|
|
||||||
initializedGetter: defaultFormValueGetter(formApi),
|
|
||||||
currentGetter: defaultFormValueGetter(formApi),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const [BasicModal, modalApi] = useVbenModal({
|
|
||||||
// 在这里更改宽度
|
|
||||||
class: 'w-[70%]',
|
|
||||||
fullscreenButton: false,
|
|
||||||
onBeforeClose,
|
|
||||||
onClosed: handleClosed,
|
|
||||||
onConfirm: handleConfirm,
|
|
||||||
onOpenChange: async (isOpen) => {
|
|
||||||
if (!isOpen) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
modalApi.modalLoading(true);
|
|
||||||
await queryPersonData()
|
|
||||||
await queryWorkOrdersType()
|
|
||||||
const {id} = modalApi.getData() as { id?: number | string };
|
|
||||||
isUpdate.value = !!id;
|
|
||||||
|
|
||||||
if (isUpdate.value && id) {
|
|
||||||
const record = await workOrdersInfo(id);
|
|
||||||
record.isTimeOut = record.isTimeOut?.toString()
|
|
||||||
await formApi.setValues(record);
|
|
||||||
}
|
|
||||||
await markInitialized();
|
|
||||||
|
|
||||||
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 ? workOrdersUpdate(data) : workOrdersAdd(data));
|
|
||||||
resetInitialized();
|
|
||||||
emit('reload');
|
|
||||||
modalApi.close();
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error);
|
|
||||||
} finally {
|
|
||||||
modalApi.lock(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleClosed() {
|
|
||||||
await formApi.resetForm();
|
|
||||||
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',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
componentProps: () => ({
|
|
||||||
options: options,
|
|
||||||
showSearch:true,
|
|
||||||
filterOption: filterOption
|
|
||||||
}),
|
|
||||||
fieldName: 'handler',
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
|
|
||||||
async function queryWorkOrdersType() {
|
|
||||||
let params = {
|
|
||||||
pageSize: 1000,
|
|
||||||
pageNum: 1
|
|
||||||
}
|
|
||||||
const res = await workOrdersTypeList(params)
|
|
||||||
const options = res.rows.map((item) => ({
|
|
||||||
label: item.orderTypeName,
|
|
||||||
value: item.id,
|
|
||||||
}));
|
|
||||||
formApi.updateSchema([{
|
|
||||||
componentProps: () => ({
|
|
||||||
options: options,
|
|
||||||
filterOption: filterOption,
|
|
||||||
showSearch:true,
|
|
||||||
}),
|
|
||||||
fieldName: 'type',
|
|
||||||
}])
|
|
||||||
}
|
|
||||||
|
|
||||||
const filterOption = (input: string, option: any) => {
|
|
||||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<BasicModal :title="title">
|
|
||||||
<BasicForm/>
|
|
||||||
</BasicModal>
|
|
||||||
</template>
|
|
||||||
|
|
@@ -4,9 +4,6 @@ import {renderDict} from "#/utils/render";
|
|||||||
import {getDictOptions} from "#/utils/dict";
|
import {getDictOptions} from "#/utils/dict";
|
||||||
import {h} from "vue";
|
import {h} from "vue";
|
||||||
import {Rate} from "ant-design-vue";
|
import {Rate} from "ant-design-vue";
|
||||||
import type {Dayjs} from "dayjs";
|
|
||||||
import dayjs from "dayjs";
|
|
||||||
|
|
||||||
|
|
||||||
export const querySchema: FormSchemaGetter = () => [
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
{
|
{
|
||||||
@@ -216,9 +213,6 @@ export const modalSchema: FormSchemaGetter = () => [
|
|||||||
// rules: 'selectRequired',
|
// rules: 'selectRequired',
|
||||||
// },
|
// },
|
||||||
];
|
];
|
||||||
const disabledDate = (current: Dayjs) => {
|
|
||||||
return current && current < dayjs().endOf('day');
|
|
||||||
};
|
|
||||||
export const ordersModalSchema: FormSchemaGetter = () => [
|
export const ordersModalSchema: FormSchemaGetter = () => [
|
||||||
{
|
{
|
||||||
label: 'id',
|
label: 'id',
|
||||||
|
@@ -16,7 +16,12 @@ const workOrderCount = ref<EchartsUIType>();
|
|||||||
const { renderEcharts: renderWorkOrderCount } = useEcharts(workOrderCount);
|
const { renderEcharts: renderWorkOrderCount } = useEcharts(workOrderCount);
|
||||||
async function fetchWorkOrderCount() {
|
async function fetchWorkOrderCount() {
|
||||||
xAxisData.value = board.value.recentWeekWorkOrders
|
xAxisData.value = board.value.recentWeekWorkOrders
|
||||||
console.log(xAxisData.value)
|
const result = xAxisData.value.map(item => {
|
||||||
|
const [year, month, day] = item.date.split('-');
|
||||||
|
const monthDay = `${month}-${day}`;
|
||||||
|
return `${monthDay}${item.dayOfWeek}`;
|
||||||
|
});
|
||||||
|
console.log(result)
|
||||||
renderWorkOrderCount({
|
renderWorkOrderCount({
|
||||||
tooltip: { trigger: 'axis' },
|
tooltip: { trigger: 'axis' },
|
||||||
xAxis: {
|
xAxis: {
|
||||||
|
Reference in New Issue
Block a user