You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
91 lines
2.6 KiB
91 lines
2.6 KiB
<script lang="ts" setup>
|
|
import { Switch } from 'ant-design-vue'
|
|
import { onMounted } from 'vue'
|
|
|
|
import { useRoute } from 'vue-router'
|
|
import { columns, searchFormSchema } from './alarm.data'
|
|
// import UpdateModal from './UpdateModal.vue'
|
|
|
|
import { BasicTable, TableAction, useTable } from '@/components/Table'
|
|
import { getWarnPageReal, updateWarn } from '@/api/alert/warn'
|
|
import { useI18n } from '@/hooks/web/useI18n'
|
|
import { useMessage } from '@/hooks/web/useMessage'
|
|
import { IconEnum } from '@/enums/appEnum'
|
|
import { useModal } from '@/components/Modal'
|
|
|
|
defineOptions({ name: 'Warn' })
|
|
|
|
const route = useRoute()
|
|
|
|
const { createMessage } = useMessage()
|
|
const { t } = useI18n()
|
|
const [registerUpdateModal, { openModal: openUpdateModal }] = useModal()
|
|
const [registerTable, { getForm, reload, getDataSource, updateTableDataRecord }] = useTable({
|
|
title: '集中告警列表',
|
|
api: getWarnPageReal,
|
|
rowKey: 'warnId',
|
|
immediate: true,
|
|
columns,
|
|
//这个要写,不然不生效
|
|
useSearchForm: true,
|
|
formConfig: {
|
|
labelWidth: 80,
|
|
schemas: searchFormSchema,
|
|
showResetButton: false,
|
|
actionColOptions: {
|
|
span: 4,
|
|
style: {
|
|
marginLeft: '10px'
|
|
}
|
|
},
|
|
},
|
|
showTableSetting: true,
|
|
showIndexColumn: false,
|
|
actionColumn: {
|
|
width: 200,
|
|
title: t('common.action'),
|
|
dataIndex: 'action',
|
|
fixed: 'right',
|
|
}
|
|
})
|
|
|
|
async function updateStatus(record) {
|
|
await updateWarn(record)
|
|
createMessage.success(t('common.saveSuccessText'))
|
|
console.log(record)
|
|
reload()
|
|
}
|
|
function handleWarnConfig(record: Recordable) {
|
|
openUpdateModal(true, { record, isUpdate: true })
|
|
}
|
|
|
|
onMounted(async () => {
|
|
const { setFieldsValue } = getForm()
|
|
await setFieldsValue({ system: null })
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<div>
|
|
<BasicTable @register="registerTable">
|
|
<template #bodyCell="{ column, record }">
|
|
<template v-if="column.key === 'action'">
|
|
<TableAction
|
|
:actions="[
|
|
|
|
{ icon: IconEnum.EDIT, label: t('action.edit'), auth: 'run:instant:warnConfig', onClick: handleWarnConfig.bind(null, record) },
|
|
{ icon: IconEnum.TREND, label: t('action.trend'), auth: 'run:instant:warnConfig', onClick: handleWarnConfig.bind(null, record) },
|
|
{ icon: IconEnum.DETAIL, label: t('action.detail'), auth: 'run:instant:warnConfig', onClick: handleWarnConfig.bind(null, record) },
|
|
|
|
]"
|
|
/>
|
|
</template>
|
|
</template>
|
|
</BasicTable>
|
|
<!-- <UpdateModal @register="registerUpdateModal" @success="reload" />-->
|
|
</div>
|
|
</template>
|
|
|
|
<style lang="less" scoped>
|
|
|
|
</style>
|
|
|