248 lines
5.4 KiB
Vue
248 lines
5.4 KiB
Vue
<!-- d:\wordpack\WholeProcessPlatform\frontend\src\views\system\map\components\TiltPhotoManagement\index.vue -->
|
|
<template>
|
|
<div class="content">
|
|
<ConfigManagementSearch
|
|
ref="tiltPhotoManagementSearch"
|
|
:river-options="riverOptions"
|
|
:river-options-load="riverOptionsLoad"
|
|
:handle-add="handleAdd"
|
|
@reset="handleReset"
|
|
@search-finish="onSearchFinish"
|
|
/>
|
|
<BasicTable
|
|
ref="basicTable"
|
|
:columns="columns"
|
|
:list-url="bindGetKendoList"
|
|
:search-params="searchParams"
|
|
>
|
|
<template #action="{ column, record }">
|
|
<div class="flex gap-[6px]">
|
|
<a-button
|
|
class="!p-0"
|
|
type="link"
|
|
size="small"
|
|
@click="handleEdit(record)"
|
|
>编辑</a-button
|
|
>
|
|
<a-button
|
|
class="!p-0"
|
|
type="link"
|
|
size="small"
|
|
danger
|
|
@click="handleDelete(record)"
|
|
>删除</a-button
|
|
>
|
|
</div>
|
|
</template>
|
|
</BasicTable>
|
|
<ConfigManagementForm
|
|
ref="tiltPhotoManagementForm"
|
|
v-model:visible="editModalVisible"
|
|
:river-options="riverOptions"
|
|
:river-options-load="riverOptionsLoad"
|
|
:initial-values="currentRecord"
|
|
@cancel="editModalCancel"
|
|
@ok="handleEditSubmit"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { ref, nextTick, onMounted } from 'vue';
|
|
import BasicTable from '@/components/BasicTable/index.vue';
|
|
import ConfigManagementSearch from './ConfigManagementSearch.vue';
|
|
import ConfigManagementForm from './ConfigManagementForm.vue';
|
|
import { message, Modal } from 'ant-design-vue';
|
|
import {
|
|
bindGetKendoList,
|
|
warnruleAddOrUpdate,
|
|
warnruleBindDelete
|
|
} from '@/api/system/alertRules';
|
|
|
|
// 表格列配置
|
|
const columns = [
|
|
{
|
|
title: '序号',
|
|
dataIndex: 'index',
|
|
key: 'index',
|
|
width: 60,
|
|
align: 'center',
|
|
customRender: ({ text, record, index }) => index + 1
|
|
},
|
|
{
|
|
title: '预警名称',
|
|
dataIndex: 'ruleName',
|
|
key: 'ruleName'
|
|
},
|
|
{
|
|
title: '预警类型',
|
|
dataIndex: 'ruleTypeName',
|
|
key: 'ruleTypeName'
|
|
},
|
|
{
|
|
title: '规则类型',
|
|
dataIndex: 'ruleTypeName',
|
|
key: 'ruleTypeName'
|
|
},
|
|
{
|
|
title: '创建人',
|
|
key: 'recordUserName',
|
|
dataIndex: 'recordUserName',
|
|
width: 150
|
|
},
|
|
{
|
|
title: '更新时间',
|
|
key: 'modifyTime',
|
|
dataIndex: 'modifyTime',
|
|
width: 150
|
|
},
|
|
{
|
|
title: '备注',
|
|
key: 'description',
|
|
dataIndex: 'description'
|
|
},
|
|
{
|
|
title: '操作',
|
|
key: 'action',
|
|
width: 120,
|
|
fixed: 'right',
|
|
slots: { customRender: 'action' }
|
|
}
|
|
];
|
|
|
|
// 表格实例
|
|
const basicTable = ref<any>(null);
|
|
// 搜索参数
|
|
const searchParams = ref({});
|
|
// 编辑弹窗数据
|
|
const currentRecord = ref<any | null>(null);
|
|
const editModalVisible = ref(false);
|
|
|
|
// 添加处理
|
|
const handleAdd = () => {
|
|
currentRecord.value = null;
|
|
editModalVisible.value = true;
|
|
};
|
|
|
|
// 编辑处理
|
|
const handleEdit = (record: any) => {
|
|
currentRecord.value = { ...record };
|
|
editModalVisible.value = true;
|
|
};
|
|
|
|
// 删除处理
|
|
const handleDelete = (record: any) => {
|
|
Modal.confirm({
|
|
title: '确认删除',
|
|
content: '确定要删除选中的记录吗?',
|
|
zIndex: 2002,
|
|
onOk: async () => {
|
|
try {
|
|
let res: any = await warnruleBindDelete({ id: record.bindId });
|
|
if (res.code == 0) message.success('删除成功');
|
|
basicTable.value.refresh();
|
|
} catch (error) {
|
|
|
|
return;
|
|
}
|
|
}
|
|
});
|
|
};
|
|
|
|
// 搜索完成处理
|
|
const onSearchFinish = (values: any) => {
|
|
const params = {
|
|
logic: 'and',
|
|
filters: [
|
|
{
|
|
field: 'ruleCode',
|
|
operator: 'in',
|
|
dataType: 'string',
|
|
value: ['common', 'custom']
|
|
},
|
|
values.ruleName
|
|
? {
|
|
field: 'ruleName',
|
|
operator: 'contains',
|
|
dataType: 'string',
|
|
value: values.ruleName
|
|
}
|
|
: null,
|
|
values.ruleType
|
|
? {
|
|
field: 'ruleType',
|
|
operator: 'contains',
|
|
dataType: 'string',
|
|
value: values.ruleType
|
|
}
|
|
: null
|
|
].filter(Boolean)
|
|
};
|
|
basicTable.value.getList(params);
|
|
};
|
|
|
|
// 重置
|
|
const handleReset = () => {
|
|
nextTick(() => {
|
|
basicTable.value.getList({
|
|
logic: 'and',
|
|
filters: []
|
|
});
|
|
});
|
|
};
|
|
|
|
// 表单取消
|
|
const editModalCancel = () => {
|
|
currentRecord.value = null;
|
|
editModalVisible.value = false;
|
|
};
|
|
|
|
// 表单提交
|
|
const handleEditSubmit = async (values: any) => {
|
|
try {
|
|
let res:any = await warnruleAddOrUpdate(values);
|
|
if(res.code == 0) message.success(`保存成功`);
|
|
|
|
editModalVisible.value = false;
|
|
basicTable.value.refresh();
|
|
} catch (error) {
|
|
|
|
|
|
editModalVisible.value = false;
|
|
return;
|
|
}
|
|
};
|
|
const riverOptions = ref<any>([
|
|
{ value: 'RZ_RULE', label: '水位' },
|
|
{ value: 'QGC_RULE', label: '生态流量' },
|
|
{ value: 'WT_RULE', label: '水温' },
|
|
{ value: 'WQ_RULE', label: '水质' }
|
|
]);
|
|
const riverOptionsLoad = ref(false);
|
|
const initOption = () => {};
|
|
onMounted(() => {
|
|
initOption();
|
|
});
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.tilt-photo-management {
|
|
height: 100%;
|
|
padding: 16px;
|
|
}
|
|
.content {
|
|
position: relative;
|
|
z-index: 900;
|
|
pointer-events: all;
|
|
width: 100%;
|
|
height: 100%;
|
|
background-color: #ffffff;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 10px;
|
|
box-sizing: border-box;
|
|
overflow: hidden;
|
|
padding: 16px;
|
|
}
|
|
</style>
|