增加视频预警未指派页面
This commit is contained in:
@@ -0,0 +1,246 @@
|
|||||||
|
import type { FormSchemaGetter } from '#/adapter/form';
|
||||||
|
import type { VxeGridProps } from '#/adapter/vxe-table';
|
||||||
|
import { h } from 'vue';
|
||||||
|
import { getPopupContainer } from '@vben/utils';
|
||||||
|
import { getDictOptions } from '#/utils/dict';
|
||||||
|
import { DictEnum } from '@vben/constants';
|
||||||
|
|
||||||
|
export const querySchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'deviceName',
|
||||||
|
label: '设备名称',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'DatePicker',
|
||||||
|
fieldName: 'reportTime',
|
||||||
|
label: '预警时间',
|
||||||
|
componentProps: {
|
||||||
|
format: 'YYYY-MM-DD',
|
||||||
|
valueFormat: 'YYYY-MM-DD HH:mm:ss',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Input',
|
||||||
|
fieldName: 'alarmType',
|
||||||
|
label: '预警类型',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
component: 'Select',
|
||||||
|
componentProps: {
|
||||||
|
getPopupContainer,
|
||||||
|
options: getDictOptions(DictEnum.alarm_level, true),
|
||||||
|
},
|
||||||
|
fieldName: 'level',
|
||||||
|
label: '预警级别',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const columns: VxeGridProps['columns'] = [
|
||||||
|
{ type: 'checkbox', width: 60 },
|
||||||
|
{
|
||||||
|
title: '预警编号',
|
||||||
|
field: 'id',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预警时间',
|
||||||
|
field: 'reportTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备IP',
|
||||||
|
field: 'deviceIp',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '设备名称',
|
||||||
|
field: 'deviceName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预警级别',
|
||||||
|
field: 'level',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }: any) => {
|
||||||
|
const levelColors: Record<string, string> = {
|
||||||
|
1: 'blue',
|
||||||
|
2: 'orange',
|
||||||
|
3: 'red',
|
||||||
|
};
|
||||||
|
return h(
|
||||||
|
'span',
|
||||||
|
{
|
||||||
|
style: {
|
||||||
|
color: levelColors[row.level] || '#666',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
row.levelName,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '预警类型',
|
||||||
|
field: 'alarmTypeName',
|
||||||
|
slots: {
|
||||||
|
default: ({ row }: any) => {
|
||||||
|
return h('span', row.bigTypeName + '-' + row.smallTypeName);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '处理状态',
|
||||||
|
field: 'stateName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '创建时间',
|
||||||
|
field: 'createTime',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
field: 'action',
|
||||||
|
fixed: 'right',
|
||||||
|
slots: { default: 'action' },
|
||||||
|
title: '操作',
|
||||||
|
width: 380,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const modalSchema: FormSchemaGetter = () => [
|
||||||
|
{
|
||||||
|
label: '主键',
|
||||||
|
fieldName: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
dependencies: {
|
||||||
|
show: () => false,
|
||||||
|
triggerFields: [''],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '预警编号',
|
||||||
|
fieldName: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '预警时间',
|
||||||
|
fieldName: 'reportTime',
|
||||||
|
component: 'DatePicker',
|
||||||
|
componentProps: {
|
||||||
|
format: 'YYYY.MM.DD HH:mm',
|
||||||
|
valueFormat: 'YYYY.MM.DD HH:mm',
|
||||||
|
showTime: true,
|
||||||
|
},
|
||||||
|
disabled: true,
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '预警类型',
|
||||||
|
fieldName: 'alarmType',
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '设备IP',
|
||||||
|
fieldName: 'deviceIp',
|
||||||
|
component: 'Input',
|
||||||
|
disabled: true,
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '设备名称',
|
||||||
|
fieldName: 'deviceName',
|
||||||
|
disabled: true,
|
||||||
|
component: 'Input',
|
||||||
|
rules: 'required',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '预警级别',
|
||||||
|
fieldName: 'level',
|
||||||
|
component: 'Select',
|
||||||
|
disabled: true,
|
||||||
|
componentProps: {
|
||||||
|
getPopupContainer,
|
||||||
|
options: getDictOptions(DictEnum.alarm_level, true),
|
||||||
|
},
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '创建时间',
|
||||||
|
fieldName: 'createTime',
|
||||||
|
component: 'DatePicker',
|
||||||
|
disabled: true,
|
||||||
|
componentProps: {
|
||||||
|
format: 'YYYY.MM.DD HH:mm',
|
||||||
|
valueFormat: 'YYYY.MM.DD HH:mm',
|
||||||
|
showTime: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '处理状态',
|
||||||
|
component: 'Select',
|
||||||
|
disabled: true,
|
||||||
|
componentProps: {
|
||||||
|
getPopupContainer,
|
||||||
|
options: getDictOptions(DictEnum.alarm_state, true),
|
||||||
|
},
|
||||||
|
fieldName: 'state',
|
||||||
|
rules: 'selectRequired',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '预警描述',
|
||||||
|
disabled: true,
|
||||||
|
fieldName: 'description',
|
||||||
|
component: 'Textarea',
|
||||||
|
formItemClass: 'col-span-2',
|
||||||
|
componentProps: {
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
// 插入分割线
|
||||||
|
{
|
||||||
|
component: 'Divider',
|
||||||
|
fieldName: '_divider',
|
||||||
|
formItemClass: 'col-span-2',
|
||||||
|
hideLabel: true,
|
||||||
|
renderComponentContent: () => {
|
||||||
|
return {
|
||||||
|
default: () => h('div', '处理'),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: '处理人',
|
||||||
|
fieldName: 'solveId',
|
||||||
|
component: 'Select',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: '联系电话',
|
||||||
|
fieldName: 'phonenumber',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: '邮箱',
|
||||||
|
fieldName: 'email',
|
||||||
|
component: 'Input',
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: '所在部门',
|
||||||
|
fieldName: 'deptName',
|
||||||
|
component: 'Input',
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
label: '备注',
|
||||||
|
fieldName: 'remark',
|
||||||
|
component: 'Textarea',
|
||||||
|
formItemClass: 'col-span-2',
|
||||||
|
componentProps: {
|
||||||
|
rows: 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
@@ -0,0 +1,186 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { Page, useVbenModal, type VbenFormProps } from '@vben/common-ui';
|
||||||
|
import { getVxePopupContainer } from '@vben/utils';
|
||||||
|
|
||||||
|
import { Modal, Popconfirm, Space } from 'ant-design-vue';
|
||||||
|
import {
|
||||||
|
useVbenVxeGrid,
|
||||||
|
vxeCheckboxChecked,
|
||||||
|
type VxeGridProps,
|
||||||
|
} from '#/adapter/vxe-table';
|
||||||
|
|
||||||
|
import { columns, querySchema } from './data';
|
||||||
|
import warningModal from './warning-modal.vue';
|
||||||
|
import warningDetail from './warning-detail.vue';
|
||||||
|
import { alarmEventsList, alarmEventsRemove } from '#/api/sis/alarmEvents';
|
||||||
|
import type { AlarmEventsForm } from '#/api/sis/alarmEvents/model';
|
||||||
|
|
||||||
|
/* 搜索栏配置 */
|
||||||
|
const formOptions: VbenFormProps = {
|
||||||
|
commonConfig: {
|
||||||
|
labelWidth: 100,
|
||||||
|
componentProps: {
|
||||||
|
allowClear: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
schema: querySchema(),
|
||||||
|
wrapperClass: 'grid-cols-1 md:grid-cols-2 lg:grid-cols-3',
|
||||||
|
};
|
||||||
|
|
||||||
|
/* table栏配置 */
|
||||||
|
const gridOptions: VxeGridProps = {
|
||||||
|
checkboxConfig: {
|
||||||
|
// 高亮
|
||||||
|
highlight: true,
|
||||||
|
// 翻页时保留选中状态
|
||||||
|
reserve: true,
|
||||||
|
// 点击行选中
|
||||||
|
// trigger: 'row',
|
||||||
|
},
|
||||||
|
// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
|
||||||
|
// columns: columns(),
|
||||||
|
columns,
|
||||||
|
height: 'auto',
|
||||||
|
pagerConfig: {},
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }, formValues = {}) => {
|
||||||
|
return await alarmEventsList({
|
||||||
|
pageNum: page.currentPage,
|
||||||
|
pageSize: page.pageSize,
|
||||||
|
state: 10,
|
||||||
|
...formValues,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rowConfig: {
|
||||||
|
keyField: 'id',
|
||||||
|
},
|
||||||
|
id: 'video-warning-processing-index',
|
||||||
|
};
|
||||||
|
|
||||||
|
const [BasicTable, tableApi] = useVbenVxeGrid({
|
||||||
|
formOptions,
|
||||||
|
gridOptions,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 监听数据变化,强制重新渲染表格
|
||||||
|
|
||||||
|
const [WarningModal, modalApi] = useVbenModal({
|
||||||
|
connectedComponent: warningModal,
|
||||||
|
});
|
||||||
|
|
||||||
|
const [WarningDetail, detailApi] = useVbenModal({
|
||||||
|
connectedComponent: warningDetail,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 查看详情
|
||||||
|
async function handleView(row: any) {
|
||||||
|
detailApi.setData({ id: row.id, data: row });
|
||||||
|
detailApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 编辑
|
||||||
|
async function handleEdit(row: any) {
|
||||||
|
modalApi.setData({ id: row.id, data: row });
|
||||||
|
modalApi.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除
|
||||||
|
async function handleDelete(row: any) {
|
||||||
|
const index = row.id;
|
||||||
|
if (index !== -1) {
|
||||||
|
await tableApi.query();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量删除
|
||||||
|
function handleMultiDelete() {
|
||||||
|
const rows = tableApi.grid.getCheckboxRecords();
|
||||||
|
const ids = rows.map((row: Required<AlarmEventsForm>) => row.id);
|
||||||
|
Modal.confirm({
|
||||||
|
title: '提示',
|
||||||
|
okType: 'danger',
|
||||||
|
content: `确认删除选中的${ids.length}条记录吗?`,
|
||||||
|
onOk: async () => {
|
||||||
|
await alarmEventsRemove(ids);
|
||||||
|
await tableApi.query();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<Page :auto-content-height="true">
|
||||||
|
<BasicTable class="flex-1 overflow-hidden">
|
||||||
|
<template #toolbar-tools>
|
||||||
|
<Space>
|
||||||
|
<a-button
|
||||||
|
:disabled="!vxeCheckboxChecked(tableApi)"
|
||||||
|
danger
|
||||||
|
type="primary"
|
||||||
|
v-access:code="['video:warning:remove']"
|
||||||
|
@click="handleMultiDelete"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</a-button>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
<template #action="{ row }">
|
||||||
|
<Space>
|
||||||
|
<!-- <ghost-button
|
||||||
|
v-access:code="['video:warning:level']"
|
||||||
|
@click.stop="handleLevelSetting(row)"
|
||||||
|
>
|
||||||
|
级别设置
|
||||||
|
</ghost-button> -->
|
||||||
|
<ghost-button
|
||||||
|
v-access:code="['video:warning:view']"
|
||||||
|
@click.stop="handleView(row)"
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.info') }}
|
||||||
|
</ghost-button>
|
||||||
|
|
||||||
|
<ghost-button
|
||||||
|
v-access:code="['video:warning:edit']"
|
||||||
|
@click.stop="handleEdit(row)"
|
||||||
|
>
|
||||||
|
处理
|
||||||
|
</ghost-button>
|
||||||
|
|
||||||
|
<Popconfirm
|
||||||
|
:get-popup-container="getVxePopupContainer"
|
||||||
|
placement="left"
|
||||||
|
title="确认删除?"
|
||||||
|
@confirm="handleDelete(row)"
|
||||||
|
>
|
||||||
|
<ghost-button
|
||||||
|
danger
|
||||||
|
v-access:code="['video:warning:remove']"
|
||||||
|
@click.stop=""
|
||||||
|
>
|
||||||
|
{{ $t('pages.common.delete') }}
|
||||||
|
</ghost-button>
|
||||||
|
</Popconfirm>
|
||||||
|
</Space>
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<WarningModal @reload="tableApi.query()" />
|
||||||
|
<WarningDetail />
|
||||||
|
</Page>
|
||||||
|
</template>
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.ant-table-wrapper {
|
||||||
|
.ant-table-thead > tr > th {
|
||||||
|
background-color: #fafafa;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-pagination {
|
||||||
|
.ant-pagination-item-active {
|
||||||
|
background-color: #1890ff;
|
||||||
|
border-color: #1890ff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@@ -0,0 +1,148 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, shallowRef } from 'vue';
|
||||||
|
import { useVbenModal } from '@vben/common-ui';
|
||||||
|
import { Descriptions, DescriptionsItem, Image, Tag } from 'ant-design-vue';
|
||||||
|
import { queryAlarmEventAttachmentsList } from '#/api/sis/alarmEventAttachments';
|
||||||
|
import type { AlarmEventAttachmentsVO } from '#/api/sis/alarmEventAttachments/model';
|
||||||
|
import { fallImg } from '../../common';
|
||||||
|
import { alarmEventProcessList } from '#/api/sis/alarmEventProcess';
|
||||||
|
import type { AlarmEventProcessVO } from '#/api/sis/alarmEventProcess/model';
|
||||||
|
|
||||||
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
|
onOpenChange: handleOpenChange,
|
||||||
|
onClosed() {
|
||||||
|
modalApi.close();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const warningDetail = shallowRef<any>(null);
|
||||||
|
const currFiles = ref<AlarmEventAttachmentsVO[]>([]);
|
||||||
|
|
||||||
|
async function handleOpenChange(open: boolean) {
|
||||||
|
if (!open) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
modalApi.modalLoading(true);
|
||||||
|
const { id, data } = modalApi.getData() as {
|
||||||
|
id: number | string;
|
||||||
|
data: any[];
|
||||||
|
};
|
||||||
|
// 从传递的数据中查找对应的记录
|
||||||
|
if (data) {
|
||||||
|
warningDetail.value = data;
|
||||||
|
}
|
||||||
|
// 加载事件附件信息
|
||||||
|
currFiles.value = await queryAlarmEventAttachmentsList(id);
|
||||||
|
// 加载处理流程
|
||||||
|
loadProcessList();
|
||||||
|
modalApi.modalLoading(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
const process = ref<AlarmEventProcessVO[]>([]);
|
||||||
|
|
||||||
|
function loadProcessList() {
|
||||||
|
const data = modalApi.getData();
|
||||||
|
const params = {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 50,
|
||||||
|
alarmId: data.id,
|
||||||
|
};
|
||||||
|
alarmEventProcessList(params).then((res) => {
|
||||||
|
const { rows = [] } = res;
|
||||||
|
process.value = rows;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<BasicModal
|
||||||
|
:footer="false"
|
||||||
|
:fullscreen-button="false"
|
||||||
|
title="预警详情"
|
||||||
|
class="w-[60%]"
|
||||||
|
>
|
||||||
|
<Descriptions
|
||||||
|
v-if="warningDetail"
|
||||||
|
size="small"
|
||||||
|
:column="2"
|
||||||
|
bordered
|
||||||
|
:labelStyle="{ width: '120px' }"
|
||||||
|
style="margin-bottom: 30px"
|
||||||
|
>
|
||||||
|
<DescriptionsItem label="预警编码">
|
||||||
|
{{ warningDetail.id }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="预警类型">
|
||||||
|
{{ warningDetail.bigTypeName + ' - ' + warningDetail.smallTypeName }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="设备IP"
|
||||||
|
>{{ warningDetail.deviceIp }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
|
||||||
|
<DescriptionsItem label="设备名称"
|
||||||
|
>{{ warningDetail.deviceName }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="预警位置" :span="2">
|
||||||
|
{{ warningDetail.deviceName }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="预警级别">
|
||||||
|
<Tag
|
||||||
|
:color="
|
||||||
|
warningDetail.level === '特大'
|
||||||
|
? 'red'
|
||||||
|
: warningDetail.level === '重要'
|
||||||
|
? 'orange'
|
||||||
|
: 'blue'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ warningDetail.levelName }}
|
||||||
|
</Tag>
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="预警时间">
|
||||||
|
{{ warningDetail.reportTime }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
<DescriptionsItem label="预警描述" :span="2">
|
||||||
|
{{ warningDetail.description }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<DescriptionsItem label="处理状态" :span="2">
|
||||||
|
<Tag color="processing">
|
||||||
|
{{ warningDetail.stateName }}
|
||||||
|
</Tag>
|
||||||
|
</DescriptionsItem>
|
||||||
|
|
||||||
|
<!-- <DescriptionsItem label="处理情况" :span="2">
|
||||||
|
{{ warningDetail.processingDetails || '-' }}
|
||||||
|
</DescriptionsItem>
|
||||||
|
|
||||||
|
<DescriptionsItem label="处理时间" :span="2">
|
||||||
|
{{ warningDetail.processingTime || '-' }}
|
||||||
|
</DescriptionsItem>-->
|
||||||
|
|
||||||
|
<DescriptionsItem :span="2" label="相关图片">
|
||||||
|
<div class="file-box">
|
||||||
|
<div class="img-box" v-for="item in currFiles">
|
||||||
|
<Image
|
||||||
|
style="width: 120px; height: 120px"
|
||||||
|
:src="item.imagePath"
|
||||||
|
:fallback="fallImg"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</DescriptionsItem>
|
||||||
|
|
||||||
|
<DescriptionsItem :span="2" label="报警视频"></DescriptionsItem>
|
||||||
|
</Descriptions>
|
||||||
|
</BasicModal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped lang="scss">
|
||||||
|
.file-box {
|
||||||
|
.img-box {
|
||||||
|
float: left;
|
||||||
|
margin-left: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
@@ -0,0 +1,159 @@
|
|||||||
|
<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 { defaultFormValueGetter, useBeforeCloseDiff } from '#/utils/popup';
|
||||||
|
|
||||||
|
import { modalSchema } from './data';
|
||||||
|
import { queryCurrentSchedu } from '#/api/property/attendanceManagement/arrangement';
|
||||||
|
import type { AttendanceUserGroup } from '#/api/property/attendanceManagement/arrangement/model';
|
||||||
|
import { taskAssignment } from '#/api/sis/alarmEvents';
|
||||||
|
|
||||||
|
const emit = defineEmits<{ reload: [] }>();
|
||||||
|
|
||||||
|
const isUpdate = ref(false);
|
||||||
|
|
||||||
|
const [BasicForm, formApi] = useVbenForm({
|
||||||
|
commonConfig: {
|
||||||
|
formItemClass: 'col-span-1',
|
||||||
|
labelWidth: 110,
|
||||||
|
componentProps: {
|
||||||
|
class: 'w-full',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
schema: modalSchema(),
|
||||||
|
showDefaultActions: false,
|
||||||
|
wrapperClass: 'grid-cols-2',
|
||||||
|
});
|
||||||
|
|
||||||
|
const { onBeforeClose, markInitialized, resetInitialized } = useBeforeCloseDiff(
|
||||||
|
{
|
||||||
|
initializedGetter: defaultFormValueGetter(formApi),
|
||||||
|
currentGetter: defaultFormValueGetter(formApi),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
let currentSelectData: any = null;
|
||||||
|
const [BasicModal, modalApi] = useVbenModal({
|
||||||
|
class: 'w-[70%]',
|
||||||
|
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 };
|
||||||
|
isUpdate.value = !!id;
|
||||||
|
|
||||||
|
if (isUpdate.value && id) {
|
||||||
|
// 更新表单属性
|
||||||
|
const userList: AttendanceUserGroup[] = await queryCurrentSchedu();
|
||||||
|
const arr = userList.map((item) => {
|
||||||
|
const { remoteUserVo, deptName } = item;
|
||||||
|
return {
|
||||||
|
label: remoteUserVo.nickName,
|
||||||
|
value: remoteUserVo.userId,
|
||||||
|
deptName: deptName,
|
||||||
|
phonenumber: remoteUserVo.phonenumber,
|
||||||
|
email: remoteUserVo.email,
|
||||||
|
userName: remoteUserVo.userName,
|
||||||
|
nickName: remoteUserVo.nickName,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
formApi.updateSchema([
|
||||||
|
{
|
||||||
|
componentProps: {
|
||||||
|
options: arr,
|
||||||
|
onChange: async (_value: any, data: any) => {
|
||||||
|
const {
|
||||||
|
deptName = '',
|
||||||
|
email = '',
|
||||||
|
phonenumber = '',
|
||||||
|
nickName = '',
|
||||||
|
} = data;
|
||||||
|
const formData = cloneDeep(await formApi.getValues());
|
||||||
|
formData.phonenumber = phonenumber;
|
||||||
|
formData.email = email;
|
||||||
|
formData.deptName = deptName;
|
||||||
|
currentSelectData = data;
|
||||||
|
formApi.setValues(formData);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
fieldName: 'solveId',
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
|
// 从传递的数据中查找对应的记录
|
||||||
|
const { data } = modalApi.getData() as {
|
||||||
|
id: number | string;
|
||||||
|
data: any;
|
||||||
|
};
|
||||||
|
if (data) {
|
||||||
|
// 处理预警上报类型
|
||||||
|
data.alarmType = `${data.bigTypeName} - ${data.smallTypeName}`;
|
||||||
|
await formApi.setValues(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await markInitialized();
|
||||||
|
modalApi.modalLoading(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
async function handleConfirm() {
|
||||||
|
try {
|
||||||
|
modalApi.lock(true);
|
||||||
|
const { valid } = await formApi.validate();
|
||||||
|
if (!valid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 表单数据
|
||||||
|
const formData = cloneDeep(await formApi.getValues());
|
||||||
|
// 更新数据
|
||||||
|
const params = {
|
||||||
|
alarmId: formData.id,
|
||||||
|
solveId: currentSelectData.value,
|
||||||
|
solveName: `${currentSelectData.userName}(${currentSelectData.nickName})`,
|
||||||
|
solvePhone: currentSelectData.phonenumber,
|
||||||
|
solveEmail: currentSelectData.email,
|
||||||
|
remark: formData.remark,
|
||||||
|
};
|
||||||
|
await taskAssignment(params);
|
||||||
|
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></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),
|
||||||
|
:deep(.ant-picker-disabled .ant-picker-input > input) {
|
||||||
|
/* 设置一个更深的颜色 */
|
||||||
|
color: rgb(0 0 0 / 65%) !important;
|
||||||
|
|
||||||
|
/* 有些浏览器需要这个来覆盖默认颜色 */
|
||||||
|
-webkit-text-fill-color: rgb(0 0 0 / 65%) !important;
|
||||||
|
}
|
||||||
|
</style>
|
Reference in New Issue
Block a user