2026-07-07 13:48:20 +08:00
|
|
|
<!-- d:\wordpack\WholeProcessPlatform\frontend\src\views\system\map\components\ConfigManagement\index.vue -->
|
|
|
|
|
<template>
|
|
|
|
|
<div class="content">
|
|
|
|
|
推送配置
|
|
|
|
|
<!-- <ConfigManagementSearch
|
|
|
|
|
ref="configManagementSearch"
|
|
|
|
|
:handle-add="handleAdd"
|
|
|
|
|
@reset="handleReset"
|
|
|
|
|
@search-finish="onSearchFinish"
|
2026-07-10 17:11:58 +08:00
|
|
|
/> -->
|
|
|
|
|
<div><a-button type="primary" @click="handleAdd">新增</a-button></div>
|
2026-07-07 13:48:20 +08:00
|
|
|
<BasicTable
|
|
|
|
|
ref="basicTable"
|
|
|
|
|
:columns="columns"
|
2026-07-10 17:11:58 +08:00
|
|
|
:list-url="getPushConfigList"
|
2026-07-07 13:48:20 +08:00
|
|
|
:search-params="searchParams"
|
|
|
|
|
>
|
2026-07-10 17:11:58 +08:00
|
|
|
<template #isSms="{ column, record }">
|
|
|
|
|
<a-switch
|
|
|
|
|
v-model:checked="record.isSms"
|
2026-07-13 11:11:51 +08:00
|
|
|
:unCheckedValue="0"
|
|
|
|
|
:checkedValue="1"
|
2026-07-10 17:11:58 +08:00
|
|
|
@change="switchChange(record.isSms, record)"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
2026-07-07 13:48:20 +08:00
|
|
|
<template #action="{ column, record }">
|
|
|
|
|
<div class="flex gap-[6px]">
|
2026-07-10 17:11:58 +08:00
|
|
|
<a-button
|
|
|
|
|
class="!p-0"
|
|
|
|
|
type="link"
|
|
|
|
|
size="small"
|
|
|
|
|
@click="handlePushTarget(record)"
|
|
|
|
|
>推送目标</a-button
|
|
|
|
|
>
|
2026-07-07 13:48:20 +08:00
|
|
|
<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="configManagementForm"
|
|
|
|
|
v-model:visible="editModalVisible"
|
|
|
|
|
:initial-values="currentRecord"
|
|
|
|
|
@cancel="editModalCancel"
|
|
|
|
|
@ok="handleEditSubmit"
|
2026-07-10 17:11:58 +08:00
|
|
|
/>
|
|
|
|
|
<PushTargetModal
|
|
|
|
|
ref="pushTargetModal"
|
|
|
|
|
v-model:visible="pushTargetModalVisible"
|
|
|
|
|
:initial-values="pushTargetInitialValues"
|
|
|
|
|
@cancel="pushTargetModalCancel"
|
|
|
|
|
@ok="handlePushTargetSubmit"
|
|
|
|
|
/>
|
2026-07-07 13:48:20 +08:00
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2026-07-13 11:11:51 +08:00
|
|
|
import { ref, nextTick, computed,onMounted } from 'vue';
|
2026-07-07 13:48:20 +08:00
|
|
|
import BasicTable from '@/components/BasicTable/index.vue';
|
|
|
|
|
import ConfigManagementForm from './ConfigManagementForm.vue';
|
2026-07-10 17:11:58 +08:00
|
|
|
import PushTargetModal from './PushTargetModal.vue';
|
2026-07-07 13:48:20 +08:00
|
|
|
import { message, Modal } from 'ant-design-vue';
|
|
|
|
|
import {
|
2026-07-10 17:11:58 +08:00
|
|
|
getPushConfigList,
|
|
|
|
|
addPushConfig,
|
|
|
|
|
updatePushConfig,
|
|
|
|
|
deletePushConfig,
|
|
|
|
|
savePushTargets,
|
|
|
|
|
setPushConfigSmsSwitch
|
|
|
|
|
} from '@/api/system/map/pushManagement';
|
2026-07-07 13:48:20 +08:00
|
|
|
|
|
|
|
|
// 表格实例
|
|
|
|
|
const basicTable = ref<any>(null);
|
|
|
|
|
// 表格列配置
|
|
|
|
|
const columns = [
|
|
|
|
|
{
|
2026-07-10 17:11:58 +08:00
|
|
|
title: '消息类型',
|
|
|
|
|
dataIndex: 'messageType',
|
|
|
|
|
key: 'messageType'
|
2026-07-07 13:48:20 +08:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-10 17:11:58 +08:00
|
|
|
title: '当日推送次数',
|
|
|
|
|
key: 'dailyPushCount',
|
|
|
|
|
dataIndex: 'dailyPushCount'
|
2026-07-07 13:48:20 +08:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-10 17:11:58 +08:00
|
|
|
title: '累计推送次数',
|
|
|
|
|
dataIndex: 'pushCount',
|
|
|
|
|
key: 'pushCount'
|
2026-07-07 13:48:20 +08:00
|
|
|
},
|
|
|
|
|
{
|
2026-07-10 17:11:58 +08:00
|
|
|
title: '短信提醒',
|
|
|
|
|
key: 'isSms',
|
|
|
|
|
dataIndex: 'isSms',
|
|
|
|
|
slots: { customRender: 'isSms' }
|
2026-07-07 13:48:20 +08:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '操作',
|
|
|
|
|
key: 'action',
|
2026-07-10 17:11:58 +08:00
|
|
|
width: 160,
|
2026-07-07 13:48:20 +08:00
|
|
|
fixed: 'right',
|
|
|
|
|
slots: { customRender: 'action' }
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// 搜索参数
|
|
|
|
|
const searchParams = ref({});
|
|
|
|
|
// 编辑弹窗数据
|
|
|
|
|
const currentRecord = ref<any | null>(null);
|
|
|
|
|
const editModalVisible = ref(false);
|
|
|
|
|
|
2026-07-10 17:11:58 +08:00
|
|
|
// 推送目标弹窗
|
|
|
|
|
const pushTargetModal = ref<any>(null);
|
|
|
|
|
const pushTargetModalVisible = ref(false);
|
|
|
|
|
const pushTargetInitialValues = ref<any | null>(null);
|
|
|
|
|
|
2026-07-07 13:48:20 +08:00
|
|
|
// 新增处理
|
|
|
|
|
const handleAdd = () => {
|
|
|
|
|
currentRecord.value = null;
|
|
|
|
|
editModalVisible.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 编辑处理
|
|
|
|
|
const handleEdit = (record: any) => {
|
|
|
|
|
currentRecord.value = { ...record };
|
|
|
|
|
editModalVisible.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
2026-07-10 17:11:58 +08:00
|
|
|
// 推送目标处理
|
|
|
|
|
const handlePushTarget = (record: any) => {
|
|
|
|
|
pushTargetInitialValues.value = { ...record };
|
|
|
|
|
pushTargetModalVisible.value = true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 推送目标弹窗取消
|
|
|
|
|
const pushTargetModalCancel = () => {
|
|
|
|
|
pushTargetInitialValues.value = null;
|
|
|
|
|
pushTargetModalVisible.value = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 推送目标提交
|
|
|
|
|
const handlePushTargetSubmit = async (values: any) => {
|
|
|
|
|
try {
|
|
|
|
|
let res: any = await savePushTargets(values);
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
message.success('保存成功');
|
|
|
|
|
}
|
|
|
|
|
pushTargetModalVisible.value = false;
|
|
|
|
|
basicTable.value.refresh();
|
|
|
|
|
} catch (error) {
|
|
|
|
|
// message.error('保存失败');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-07-07 13:48:20 +08:00
|
|
|
// 删除处理
|
|
|
|
|
const handleDelete = (record: any) => {
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
title: '确认删除',
|
|
|
|
|
content: '确定要删除选中的记录吗?',
|
|
|
|
|
zIndex: 2002,
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
try {
|
2026-07-13 11:11:51 +08:00
|
|
|
let res:any = await deletePushConfig([record.id]);
|
2026-07-10 17:11:58 +08:00
|
|
|
if ((res.code = 0)) {
|
|
|
|
|
message.success('删除成功');
|
|
|
|
|
}
|
2026-07-07 13:48:20 +08:00
|
|
|
basicTable.value.refresh();
|
|
|
|
|
} catch (error) {
|
2026-07-10 17:11:58 +08:00
|
|
|
// message.error('删除失败');
|
2026-07-07 13:48:20 +08:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 搜索完成处理
|
2026-07-10 17:11:58 +08:00
|
|
|
const onSearchFinish = () => {
|
2026-07-07 13:48:20 +08:00
|
|
|
const params = {
|
|
|
|
|
logic: 'and',
|
2026-07-10 17:11:58 +08:00
|
|
|
filters: [].filter(Boolean)
|
2026-07-07 13:48:20 +08:00
|
|
|
};
|
|
|
|
|
basicTable.value.getList(params);
|
|
|
|
|
};
|
|
|
|
|
// 表单取消
|
|
|
|
|
const editModalCancel = () => {
|
|
|
|
|
currentRecord.value = null;
|
|
|
|
|
editModalVisible.value = false;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 表单提交
|
|
|
|
|
const handleEditSubmit = async (values: any) => {
|
|
|
|
|
try {
|
2026-07-10 17:11:58 +08:00
|
|
|
//updatePushConfig
|
|
|
|
|
if (values.id) {
|
|
|
|
|
let res: any = await updatePushConfig({ ...values });
|
|
|
|
|
if ((res.code = 0)) {
|
|
|
|
|
message.success(`修改成功`);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
let res: any = await addPushConfig({ ...values });
|
|
|
|
|
if ((res.code = 0)) {
|
|
|
|
|
message.success(`保存成功`);
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-07-07 13:48:20 +08:00
|
|
|
|
|
|
|
|
editModalVisible.value = false;
|
|
|
|
|
basicTable.value.refresh();
|
|
|
|
|
} catch (error) {
|
2026-07-10 17:11:58 +08:00
|
|
|
// message.error(`保存失败`);
|
2026-07-07 13:48:20 +08:00
|
|
|
|
|
|
|
|
editModalVisible.value = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
};
|
2026-07-10 17:11:58 +08:00
|
|
|
//
|
|
|
|
|
const switchChange = async (checked: any, record: any) => {
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
title: '确认修改',
|
|
|
|
|
content: '确定要修改短信提醒的开关状态吗?',
|
|
|
|
|
zIndex: 2002,
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
try {
|
|
|
|
|
let res: any = await setPushConfigSmsSwitch({
|
|
|
|
|
id: record.id,
|
|
|
|
|
isSms: checked ? '1' : '0'
|
|
|
|
|
});
|
|
|
|
|
if (res.code == 0) {
|
|
|
|
|
message.success(`修改成功`);
|
|
|
|
|
basicTable.value.refresh();
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
2026-07-07 13:48:20 +08:00
|
|
|
|
2026-07-10 17:11:58 +08:00
|
|
|
const initOption = async () => {};
|
2026-07-07 13:48:20 +08:00
|
|
|
onMounted(() => {
|
|
|
|
|
initOption();
|
2026-07-10 17:11:58 +08:00
|
|
|
onSearchFinish();
|
2026-07-07 13:48:20 +08:00
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.config-management {
|
|
|
|
|
height: 100%;
|
|
|
|
|
padding: 16px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|