权限
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { useVbenModal } from '@vben/common-ui';
|
||||
import { cloneDeep } from '@vben/utils';
|
||||
import { useVbenForm } from '#/adapter/form';
|
||||
import { contingenPlanInfo, contingenPlanUpdate } from '#/api/property/customerService/contingenPlan';
|
||||
import { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||
import {schema} from './data';
|
||||
|
||||
const emit = defineEmits<{ reload: [] }>();
|
||||
|
||||
const [BasicForm, formApi] = useVbenForm({
|
||||
commonConfig: {
|
||||
formItemClass: 'col-span-1',
|
||||
labelWidth: 80,
|
||||
componentProps: {
|
||||
class: 'w-full',
|
||||
}
|
||||
},
|
||||
schema: schema(),
|
||||
showDefaultActions: false,
|
||||
wrapperClass: 'grid-cols-2',
|
||||
});
|
||||
|
||||
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||
{
|
||||
initializedGetter: defaultFormValueGetter(formApi),
|
||||
currentGetter: defaultFormValueGetter(formApi),
|
||||
},
|
||||
);
|
||||
|
||||
const record = 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);
|
||||
const { id } = modalApi.getData() as { id?: number | string };
|
||||
|
||||
record.value = await contingenPlanInfo(id);
|
||||
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;
|
||||
}
|
||||
// getValues获取为一个readonly的对象 需要修改必须先深拷贝一次
|
||||
const data = cloneDeep(await formApi.getValues());
|
||||
record.value.status = data.status
|
||||
await contingenPlanUpdate(record.value)
|
||||
resetInitialized();
|
||||
emit('reload');
|
||||
modalApi.close();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
} finally {
|
||||
modalApi.lock(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function handleClosed() {
|
||||
await formApi.resetForm();
|
||||
resetInitialized();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<BasicModal title="审核">
|
||||
<BasicForm />
|
||||
</BasicModal>
|
||||
</template>
|
||||
|
@@ -156,3 +156,27 @@ export const modalSchema: FormSchemaGetter = () => [
|
||||
rules: 'required',
|
||||
},
|
||||
];
|
||||
|
||||
export const schema: FormSchemaGetter = () => [
|
||||
{
|
||||
label: '主键',
|
||||
fieldName: 'id',
|
||||
component: 'Input',
|
||||
dependencies: {
|
||||
show: () => false,
|
||||
triggerFields: [''],
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '演练状态',
|
||||
fieldName: 'status',
|
||||
component: 'RadioGroup',
|
||||
componentProps: {
|
||||
options: [
|
||||
{ label: '已取消', value: 1 },
|
||||
{ label: '待进行', value: 2 },
|
||||
],
|
||||
},
|
||||
rules: 'required',
|
||||
}
|
||||
];
|
||||
|
@@ -18,6 +18,7 @@ import type { ContingenPlanForm } from '#/api/property/customerService/contingen
|
||||
import { commonDownloadExcel } from '#/utils/file/download';
|
||||
|
||||
import contingenPlanModal from './contingenPlan-modal.vue';
|
||||
import contingenPlanExamine from './contingenPlan-examine.vue';
|
||||
import contingenPlanDetail from './contingenPlan-detail.vue';
|
||||
import { columns, querySchema } from './data';
|
||||
import {personList} from "#/api/property/resident/person";
|
||||
@@ -96,10 +97,13 @@ async function handleDelete(row: Required<ContingenPlanForm>) {
|
||||
await tableApi.query();
|
||||
}
|
||||
|
||||
const [ContingenPlanExamine, contingenPlanExamineApi] = useVbenModal({
|
||||
connectedComponent: contingenPlanExamine,
|
||||
});
|
||||
|
||||
async function handleExamine(row: Required<ContingenPlanForm>) {
|
||||
row.status = '1'
|
||||
await contingenPlanUpdate(row);
|
||||
await tableApi.query();
|
||||
contingenPlanExamineApi.setData({ id: row.id });
|
||||
contingenPlanExamineApi.open();
|
||||
}
|
||||
|
||||
function handleMultiDelete() {
|
||||
@@ -183,19 +187,12 @@ onMounted(async () => {
|
||||
</template>
|
||||
<template #action="{ row }">
|
||||
<Space>
|
||||
<Popconfirm
|
||||
<ghost-button
|
||||
v-if="row.status === '0'"
|
||||
:get-popup-container="getVxePopupContainer"
|
||||
placement="left"
|
||||
title="确认审核?"
|
||||
@confirm="handleExamine(row)"
|
||||
@click.stop="handleExamine(row)"
|
||||
>
|
||||
<ghost-button
|
||||
@click.stop=""
|
||||
>
|
||||
{{ '审核' }}
|
||||
</ghost-button>
|
||||
</Popconfirm>
|
||||
{{ '审核' }}
|
||||
</ghost-button>
|
||||
<ghost-button
|
||||
@click.stop="handleInfo(row)"
|
||||
>
|
||||
@@ -227,5 +224,6 @@ onMounted(async () => {
|
||||
</BasicTable>
|
||||
<ContingenPlanModal @reload="tableApi.query()" />
|
||||
<contingenPlanDetailModal/>
|
||||
<ContingenPlanExamine @reload="tableApi.query()" />
|
||||
</Page>
|
||||
</template>
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import type { FormSchemaGetter } from '#/adapter/form';
|
||||
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||
import {renderDict} from "#/utils/render";
|
||||
|
||||
export const querySchema: FormSchemaGetter = () => [
|
||||
{
|
||||
@@ -87,6 +88,11 @@ export const columns: VxeGridProps['columns'] = [
|
||||
{
|
||||
title: '事由',
|
||||
field: 'visitingReason',
|
||||
slots: {
|
||||
default: ({ row }) => {
|
||||
return renderDict(row.visitingReason, 'reason_for_visit');
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '拜访时间',
|
||||
|
Reference in New Issue
Block a user