| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770 |
- <template>
- <div class="app-container warning-disposal-page" v-loading="loading">
- <el-card shadow="never" class="page-card header-card">
- <div class="page-header">
- <div>
- <div class="page-title">预警处置</div>
- </div>
- <el-button type="primary" icon="Refresh" @click="loadList">刷新</el-button>
- </div>
- </el-card>
- <el-card shadow="never" class="page-card">
- <el-form :model="queryParams" :inline="true">
- <el-form-item label="预警编号">
- <el-input v-model="queryParams.warningNo" placeholder="请输入预警编号" clearable style="width: 220px" @keyup.enter="handleQuery" />
- </el-form-item>
- <el-form-item label="预警类型">
- <el-select v-model="queryParams.warningType" clearable placeholder="请选择预警类型" style="width: 180px">
- <el-option
- v-for="item in warningTypeOptions"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="预警级别">
- <el-select v-model="queryParams.warningLevel" clearable placeholder="请选择预警级别" style="width: 180px">
- <el-option
- v-for="item in warningLevelOptions"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="状态">
- <el-select v-model="queryParams.status" clearable placeholder="请选择状态" style="width: 180px">
- <el-option v-for="item in warningStatusOptions" :key="item.value" :label="item.label" :value="item.value" />
- </el-select>
- </el-form-item>
- <el-form-item label="处置人">
- <el-input v-model="queryParams.handler" placeholder="请输入处置人" clearable style="width: 180px" />
- </el-form-item>
- <el-form-item label="设备编码">
- <el-input v-model="queryParams.deviceCode" placeholder="请输入设备编码" clearable style="width: 180px" />
- </el-form-item>
- <el-form-item label="发布时间">
- <el-date-picker
- v-model="queryParams.dateRange"
- type="datetimerange"
- value-format="YYYY-MM-DD HH:mm:ss"
- range-separator="至"
- start-placeholder="开始时间"
- end-placeholder="结束时间"
- style="width: 360px"
- />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="Search" @click="handleQuery">查询</el-button>
- <el-button icon="Refresh" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- </el-card>
- <el-card shadow="never" class="page-card">
- <el-table :data="warningList">
- <el-table-column label="序号" width="70" align="center">
- <template #default="scope">
- {{ (queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1 }}
- </template>
- </el-table-column>
- <el-table-column label="预警编号" prop="warningNo" width="170" />
- <el-table-column label="预警类型" prop="warningTypeText" width="120" />
- <el-table-column label="预警级别" width="110" align="center">
- <template #default="scope">
- <el-tag :type="getLevelTagType(scope.row.warningLevel)">
- {{ scope.row.warningLevelText }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="处置人" prop="handler" width="120" />
- <el-table-column label="设备名称" prop="deviceName" min-width="140" show-overflow-tooltip />
- <el-table-column label="设备编码" prop="deviceCode" width="160" show-overflow-tooltip />
- <el-table-column label="发布人" prop="publisher" width="120" />
- <el-table-column label="权属单位" prop="ownershipUnit" width="160" show-overflow-tooltip />
- <el-table-column label="状态" width="120" align="center">
- <template #default="scope">
- <el-tag :type="getStatusTagType(scope.row.status)">
- {{ getStatusText(scope.row.status) }}
- </el-tag>
- </template>
- </el-table-column>
- <el-table-column label="发布时间" width="180">
- <template #default="scope">{{ formatDateTime(scope.row.publishTime) }}</template>
- </el-table-column>
- <el-table-column label="操作" fixed="right" width="330" align="center">
- <template #default="scope">
- <el-button link type="primary" @click="openDetail(scope.row)">详情</el-button>
- <el-button v-if="canReview(scope.row)" v-hasPermi="['warning:warning:handle']" link type="success" @click="openResolve(scope.row)">核查解除</el-button>
- <el-button v-if="canUpgrade(scope.row)" v-hasPermi="['warning:warning:handle']" link type="warning" @click="openUpgrade(scope.row)">升级</el-button>
- <el-button v-if="canManage(scope.row)" v-hasPermi="['warning:warning:supervision']" link type="primary" @click="openSupervision(scope.row)">督办</el-button>
- <el-button v-if="canManage(scope.row)" v-hasPermi="['warning:warning:instruction']" link type="info" @click="openInstruction(scope.row)">批示</el-button>
- <el-button v-if="canReview(scope.row)" v-hasPermi="['warning:warning:handle']" link type="danger" @click="openReturn(scope.row)">退回</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- v-model:page="queryParams.pageNum"
- v-model:limit="queryParams.pageSize"
- @pagination="loadList"
- />
- </el-card>
- <el-drawer v-model="detailVisible" title="预警详情" size="820px" append-to-body direction="rtl" class="detail-drawer">
- <template v-if="detailData.basicInfo">
- <WarningItemSummary :warning="detailData.basicInfo" />
- <el-descriptions :column="2" border>
- <el-descriptions-item label="预警编号">{{ detailBasic.warningNo || "-" }}</el-descriptions-item>
- <el-descriptions-item label="预警专项">{{ detailBasic.warningSpecial || "-" }}</el-descriptions-item>
- <el-descriptions-item label="预警类型">{{ detailBasic.warningTypeText || "-" }}</el-descriptions-item>
- <el-descriptions-item label="预警级别">{{ detailBasic.warningLevelText || "-" }}</el-descriptions-item>
- <el-descriptions-item label="状态">{{ getStatusText(detailBasic.status) }}</el-descriptions-item>
- <el-descriptions-item label="处置人">{{ detailBasic.handler || "-" }}</el-descriptions-item>
- <el-descriptions-item label="设备名称">{{ detailBasic.deviceName || "-" }}</el-descriptions-item>
- <el-descriptions-item label="设备编码">{{ detailBasic.deviceCode || "-" }}</el-descriptions-item>
- <el-descriptions-item label="发布人">{{ detailBasic.publisher || "-" }}</el-descriptions-item>
- <el-descriptions-item label="核查人">{{ detailBasic.reviewer || detailBasic.publisher || "-" }}</el-descriptions-item>
- <el-descriptions-item label="权属单位">{{ detailBasic.ownershipUnit || "-" }}</el-descriptions-item>
- <el-descriptions-item label="发布时间">{{ formatDateTime(detailBasic.publishTime) }}</el-descriptions-item>
- <el-descriptions-item label="预警内容" :span="2"><span class="warning-content">{{ detailBasic.warningContent || "-" }}</span></el-descriptions-item>
- </el-descriptions>
- <el-divider content-position="left">处置记录</el-divider>
- <el-timeline v-if="(detailData.disposalHistory || []).length">
- <el-timeline-item
- v-for="(item, index) in detailData.disposalHistory"
- :key="index"
- :timestamp="formatDateTime(item.createTime || item.create_time || item.disposalTime || item.disposal_time)"
- >
- {{ item.disposalTypeName || item.disposal_type_name || item.disposalType || item.disposal_type || "处置记录" }}
- <span v-if="item.oldLevel || item.old_level">:{{ warningLevelLabelMap[item.oldLevel || item.old_level] || item.oldLevel || item.old_level }} → {{ warningLevelLabelMap[item.newLevel || item.new_level] || item.newLevel || item.new_level }}</span>
- <span v-if="item.disposalContent || item.disposal_content || item.content">:{{ item.disposalContent || item.disposal_content || item.content }}</span>
- <span v-if="item.disposalUser || item.disposal_user">({{ item.disposalUser || item.disposal_user }})</span>
- <WarningDisposalReasons :record="item" />
- <WarningAttachments :attachments="attachmentsForDisposal(item, detailData.attachmentList)" />
- </el-timeline-item>
- </el-timeline>
- <el-empty v-else description="暂无处置记录" />
- <template v-if="unlinkedWarningAttachments(detailData.disposalHistory, detailData.attachmentList).length">
- <el-divider content-position="left">其他预警附件</el-divider>
- <WarningAttachments :attachments="unlinkedWarningAttachments(detailData.disposalHistory, detailData.attachmentList)" />
- </template>
- </template>
- </el-drawer>
- <el-dialog v-model="resolveVisible" title="预警解除" width="520px" append-to-body>
- <el-form label-width="100px">
- <el-form-item label="预警编号">
- <el-input :model-value="currentRow?.warningNo || '-'" disabled />
- </el-form-item>
- <el-form-item label="核查说明">
- <el-input v-model="resolveForm.disposalContent" type="textarea" :rows="4" placeholder="请输入预警解除说明" />
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button @click="resolveVisible = false">取 消</el-button>
- <el-button type="primary" :loading="submitLoading" @click="submitResolve">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog v-model="upgradeVisible" title="预警升级" width="560px" append-to-body>
- <el-form label-width="100px">
- <el-form-item label="预警编号">
- <el-input :model-value="currentRow?.warningNo || '-'" disabled />
- </el-form-item>
- <el-form-item label="新预警级别">
- <el-select v-model="upgradeForm.newLevel" placeholder="请选择新预警级别" style="width: 100%">
- <el-option
- v-for="item in upgradeLevelOptions"
- :key="item.dictValue"
- :label="item.dictLabel"
- :value="item.dictValue"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="升级说明">
- <el-input v-model="upgradeForm.disposalContent" type="textarea" :rows="4" placeholder="请输入预警升级说明" />
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button @click="upgradeVisible = false">取 消</el-button>
- <el-button type="primary" :loading="submitLoading" @click="submitUpgrade">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog v-model="supervisionVisible" title="预警督办" width="620px" append-to-body>
- <el-form label-width="100px">
- <el-form-item label="督办人员">
- <el-select v-model="supervisionForm.supervisionUser" filterable :filter-method="filterSupervisionUser" placeholder="请选择督办人员" style="width: 100%" :loading="usersLoading">
- <el-option v-for="user in filteredEnabledUsers" :key="user.userId" :label="supervisionUserLabel(user)" :value="user.userName">
- <span>{{ supervisionUserLabel(user) }}</span>
- <span v-if="user.dept?.deptName" class="user-dept">{{ user.dept.deptName }}</span>
- </el-option>
- </el-select>
- <div class="notification-hint">短信和系统通知均发送给此处选定的人员,请选择通知接收人。</div>
- </el-form-item>
- <el-form-item label="督办意见">
- <el-input v-model="supervisionForm.supervisionContent" type="textarea" :rows="3" placeholder="请输入督办意见" />
- </el-form-item>
- <el-form-item label="通知方式">
- <el-select v-model="supervisionForm.notificationType" placeholder="请选择通知方式" style="width: 100%">
- <el-option label="短信" value="短信" />
- <el-option label="系统通知" value="系统通知" />
- </el-select>
- </el-form-item>
- <el-form-item label="通知内容">
- <el-input v-model="supervisionForm.notificationContent" type="textarea" :rows="3" maxlength="180" show-word-limit placeholder="不填时使用督办意见" />
- </el-form-item>
- <el-form-item label="附件">
- <el-upload v-model:file-list="supervisionFiles" :auto-upload="false" :limit="1" :on-exceed="() => ElMessage.warning('最多上传一个附件')" accept=".jpg,.jpeg,.png,.gif,.webp,.pdf,.xls,.xlsx,.doc,.docx">
- <el-button :icon="Upload">选取文件</el-button>
- <template #tip><div class="el-upload__tip">图片、PDF、Excel 或 Word,最大 20 MB</div></template>
- </el-upload>
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button @click="supervisionVisible = false">取 消</el-button>
- <el-button type="primary" :loading="submitLoading" @click="submitSupervision">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog v-model="instructionVisible" title="添加领导批示" width="620px" append-to-body>
- <el-form label-width="100px">
- <el-form-item label="领导姓名">
- <el-input v-model="instructionForm.leaderName" placeholder="请输入领导姓名" />
- </el-form-item>
- <el-form-item label="批示内容">
- <el-input v-model="instructionForm.instructionContent" type="textarea" :rows="4" placeholder="请输入领导批示内容" />
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button @click="instructionVisible = false">取 消</el-button>
- <el-button type="primary" :loading="submitLoading" @click="submitInstruction">确 定</el-button>
- </template>
- </el-dialog>
- <el-dialog v-model="returnVisible" title="预警退回" width="520px" append-to-body>
- <el-form label-width="100px">
- <el-form-item label="预警编号">
- <el-input :model-value="currentRow?.warningNo || '-'" disabled />
- </el-form-item>
- <el-form-item label="退回说明">
- <el-input v-model="returnForm.disposalContent" type="textarea" :rows="4" placeholder="请输入退回重办说明" />
- </el-form-item>
- </el-form>
- <template #footer>
- <el-button @click="returnVisible = false">取 消</el-button>
- <el-button type="primary" :loading="submitLoading" @click="submitReturn">确 定</el-button>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import { useWarningStatuses } from '@/views/subSystem/lifeCompany/warningWorkflow'
- const { warningStatusOptions, databaseStatusLabels } = useWarningStatuses()
- import { computed, onMounted, reactive, ref } from "vue";
- import { ElMessage } from "element-plus";
- import { Upload } from "@element-plus/icons-vue";
- import { parseTime } from "@/utils/ruoyi";
- import useUserStore from "@/store/modules/user";
- import { enabledAll } from "@/api/system/user";
- import WarningItemSummary from '../components/WarningItemSummary.vue';
- import WarningDisposalReasons from '../components/WarningDisposalReasons.vue';
- import WarningAttachments from "../components/WarningAttachments.vue";
- import { attachmentsForDisposal, unlinkedWarningAttachments } from "../warningAttachments";
- import {
- getAlertTypeDictionaryData,
- getWarningDetailData,
- getdbyjlistData,
- instructionWarningData,
- resolveWarningData,
- returnWarningData,
- supervisionWarningData,
- upgradeWarningData
- } from "@/api/smxyjldczxt/yjxxfb/yjfb.js";
- const loading = ref(false);
- const userStore = useUserStore();
- const submitLoading = ref(false);
- const usersLoading = ref(false);
- const enabledUsers = ref([]);
- const filteredEnabledUsers = ref([]);
- const supervisionFiles = ref([]);
- const warningList = ref([]);
- const total = ref(0);
- const warningTypeOptions = ref([]);
- const warningLevelOptions = ref([]);
- const currentRow = ref(null);
- const detailVisible = ref(false);
- const detailData = ref({});
- const resolveVisible = ref(false);
- const upgradeVisible = ref(false);
- const supervisionVisible = ref(false);
- const instructionVisible = ref(false);
- const returnVisible = ref(false);
- const queryParams = reactive({
- pageNum: 1,
- pageSize: 10,
- warningNo: "",
- warningType: "",
- warningLevel: "",
- status: "",
- handler: "",
- deviceCode: "",
- dateRange: []
- });
- const resolveForm = reactive({
- disposalContent: ""
- });
- const upgradeForm = reactive({
- newLevel: "",
- disposalContent: ""
- });
- const supervisionForm = reactive({
- supervisionUser: "",
- supervisionContent: "",
- notificationType: "",
- notificationContent: ""
- });
- const instructionForm = reactive({
- leaderName: "",
- instructionContent: ""
- });
- const returnForm = reactive({
- disposalContent: ""
- });
- const warningTypeLabelMap = computed(() => {
- return warningTypeOptions.value.reduce((acc, item) => {
- acc[item.dictValue] = item.dictLabel;
- return acc;
- }, {});
- });
- const warningLevelLabelMap = computed(() => {
- return warningLevelOptions.value.reduce((acc, item) => {
- acc[item.dictValue] = item.dictLabel;
- return acc;
- }, {});
- });
- const upgradeLevelOptions = computed(() => warningLevelOptions.value.filter(
- item => Number(item.dictValue) < Number(currentRow.value?.warningLevel)
- ));
- const canManage = row => ["PENDING", "RECEIVED", "PROCESSING", "HANDLED"].includes(row.status);
- const canUpgrade = row => canManage(row) && Number(row.warningLevel) > 1 && Number(row.warningLevel) <= 4;
- const canReview = row => row.status === "HANDLED" && (row.reviewer || row.publisher) === userStore.name;
- function formatDateTime(value) {
- if (!value) return "-";
- const date = new Date(value);
- return parseTime(Number.isNaN(date.getTime()) ? value : date) || "-";
- }
- const detailBasic = computed(() => {
- const basic = detailData.value.basicInfo || {};
- const warningType = basic.warningType || basic.warning_type || "";
- const warningLevel = basic.warningLevel || basic.warning_level || "";
- return {
- warningNo: basic.warningNo || basic.warning_no || "",
- warningSpecial: basic.warningSpecial || basic.warning_special || "",
- warningTypeText: basic.warning_type_name || basic.warningTypeName || warningTypeLabelMap.value[warningType] || "-",
- warningLevelText: warningLevelLabelMap.value[warningLevel] || "-",
- status: basic.status || "",
- handler: basic.handler || "",
- deviceCode: basic.deviceCode || basic.device_code || "",
- deviceName: basic.deviceName || basic.device_name || "",
- publisher: basic.publisher || "",
- reviewer: basic.reviewer || "",
- ownershipUnit: basic.ownershipUnit || basic.ownership_unit || "",
- publishTime: basic.publishTime || basic.publish_time || "",
- warningContent: basic.warningContent || basic.warning_content || ""
- };
- });
- function getLevelTagType(level) {
- return {
- "1": "danger",
- "2": "warning",
- "3": "success",
- "4": "info"
- }[level] || "info";
- }
- function getStatusText(status) {
- return databaseStatusLabels.value[status] || status || "-"
- }
- function getStatusTagType(status) {
- return {
- DRAFT: "info",
- RECEIVED: "warning",
- PENDING: "warning",
- PROCESSING: "warning",
- HANDLED: "success",
- CLOSED: "info"
- }[status] || "info";
- }
- function normalizeWarningRow(item) {
- const warningType = item.warningType || item.warning_type || "";
- const warningLevel = item.warningLevel || item.warning_level || "";
- return {
- warningId: item.warningId || item.warning_id,
- warningNo: item.warningNo || item.warning_no || "",
- warningType,
- warningTypeText: item.warning_type_name || item.warningTypeName || warningTypeLabelMap.value[warningType] || "-",
- warningLevel,
- warningLevelText: warningLevelLabelMap.value[warningLevel] || "-",
- handler: item.handler || "",
- deviceCode: item.deviceCode || item.device_code || "",
- deviceName: item.deviceName || item.device_name || "",
- publisher: item.publisher || "",
- reviewer: item.reviewer || "",
- ownershipUnit: item.ownershipUnit || item.ownership_unit || "",
- publishTime: item.publishTime || item.publish_time || "",
- status: item.status || ""
- };
- }
- function resetActionForms() {
- resolveForm.disposalContent = "";
- upgradeForm.newLevel = "";
- upgradeForm.disposalContent = "";
- supervisionForm.supervisionUser = "";
- supervisionForm.supervisionContent = "";
- supervisionForm.notificationType = "";
- supervisionForm.notificationContent = "";
- supervisionFiles.value = [];
- instructionForm.leaderName = "";
- instructionForm.instructionContent = "";
- returnForm.disposalContent = "";
- }
- function filterSupervisionUser(keyword) {
- const text = String(keyword || "").trim().toLowerCase();
- filteredEnabledUsers.value = !text
- ? enabledUsers.value
- : enabledUsers.value.filter(user => [user.nickName, user.userName, user.dept?.deptName]
- .filter(Boolean)
- .some(value => String(value).toLowerCase().includes(text)));
- }
- function supervisionUserLabel(user) {
- const name = user.nickName || user.userName || "未命名用户";
- return user.userName && user.userName !== name ? `${name}(${user.userName})` : name;
- }
- async function loadDicts() {
- const [typeRes, levelRes] = await Promise.all([
- getAlertTypeDictionaryData({ dictType: "alert_type" }),
- getAlertTypeDictionaryData({ dictType: "alert_level" })
- ]);
- warningTypeOptions.value = typeRes.rows || [];
- warningLevelOptions.value = levelRes.rows || [];
- }
- async function loadList() {
- loading.value = true;
- try {
- const res = await getdbyjlistData({
- pageNum: queryParams.pageNum,
- pageSize: queryParams.pageSize,
- warningNo: queryParams.warningNo || undefined,
- warningType: queryParams.warningType || undefined,
- warningLevel: queryParams.warningLevel || undefined,
- status: queryParams.status || undefined,
- handler: queryParams.handler || undefined,
- deviceCode: queryParams.deviceCode || undefined,
- startTime: queryParams.dateRange?.[0] || undefined,
- endTime: queryParams.dateRange?.[1] || undefined
- });
- warningList.value = (res.data?.records || []).map(normalizeWarningRow);
- total.value = res.data?.total || 0;
- } finally {
- loading.value = false;
- }
- }
- function handleQuery() {
- queryParams.pageNum = 1;
- loadList();
- }
- function resetQuery() {
- queryParams.pageNum = 1;
- queryParams.pageSize = 10;
- queryParams.warningNo = "";
- queryParams.warningType = "";
- queryParams.warningLevel = "";
- queryParams.status = "";
- queryParams.handler = "";
- queryParams.deviceCode = "";
- queryParams.dateRange = [];
- loadList();
- }
- async function openDetail(row) {
- const res = await getWarningDetailData(row.warningId);
- detailData.value = res.data || {};
- detailVisible.value = true;
- }
- function openResolve(row) {
- currentRow.value = row;
- resetActionForms();
- resolveVisible.value = true;
- }
- function openUpgrade(row) {
- currentRow.value = row;
- resetActionForms();
- upgradeVisible.value = true;
- }
- function openSupervision(row) {
- currentRow.value = row;
- resetActionForms();
- supervisionVisible.value = true;
- usersLoading.value = true;
- enabledUsers.value = [];
- filteredEnabledUsers.value = [];
- enabledAll().then(res => {
- enabledUsers.value = res.data || [];
- filteredEnabledUsers.value = enabledUsers.value;
- }).catch(() => {
- ElMessage.error("督办人员加载失败");
- }).finally(() => {
- usersLoading.value = false;
- });
- }
- function openInstruction(row) {
- currentRow.value = row;
- resetActionForms();
- instructionVisible.value = true;
- }
- function openReturn(row) {
- currentRow.value = row;
- resetActionForms();
- returnVisible.value = true;
- }
- async function submitResolve() {
- if (!resolveForm.disposalContent) {
- ElMessage.warning("请输入解除说明");
- return;
- }
- submitLoading.value = true;
- try {
- const res = await resolveWarningData({
- warningId: currentRow.value.warningId,
- disposalContent: resolveForm.disposalContent
- });
- if (res.code !== 200) {
- ElMessage.error(res.msg || "解除失败");
- return;
- }
- ElMessage.success("解除成功");
- resolveVisible.value = false;
- loadList();
- } finally {
- submitLoading.value = false;
- }
- }
- async function submitUpgrade() {
- if (!upgradeForm.newLevel) {
- ElMessage.warning("请选择新预警级别");
- return;
- }
- if (!upgradeForm.disposalContent) {
- ElMessage.warning("请输入升级说明");
- return;
- }
- if (!canUpgrade(currentRow.value) || Number(upgradeForm.newLevel) >= Number(currentRow.value.warningLevel)) {
- ElMessage.warning("只能升级至更严重的级别");
- return;
- }
- submitLoading.value = true;
- try {
- const res = await upgradeWarningData({
- warningId: currentRow.value.warningId,
- newLevel: upgradeForm.newLevel,
- disposalContent: upgradeForm.disposalContent
- });
- if (res.code !== 200) {
- ElMessage.error(res.msg || "升级失败");
- return;
- }
- ElMessage.success("升级成功");
- upgradeVisible.value = false;
- loadList();
- } finally {
- submitLoading.value = false;
- }
- }
- async function submitSupervision() {
- if (!supervisionForm.supervisionUser || !supervisionForm.supervisionContent || !supervisionForm.notificationType) {
- ElMessage.warning("请完善督办信息");
- return;
- }
- if ((supervisionForm.notificationContent.trim() || supervisionForm.supervisionContent.trim()).length > 180) {
- ElMessage.warning("通知内容不能超过 180 字");
- return;
- }
- const attachment = supervisionFiles.value[0]?.raw;
- if (attachment && attachment.size > 20 * 1024 * 1024) {
- ElMessage.warning("附件不能超过 20 MB");
- return;
- }
- const data = new FormData();
- data.append("warningId", currentRow.value.warningId);
- data.append("supervisionUser", supervisionForm.supervisionUser);
- data.append("supervisionContent", supervisionForm.supervisionContent);
- data.append("notificationType", supervisionForm.notificationType);
- data.append("notificationContent", supervisionForm.notificationContent);
- if (attachment) data.append("attachment", attachment);
- submitLoading.value = true;
- try {
- const res = await supervisionWarningData(data);
- if (res.code !== 200) {
- ElMessage.error(res.msg || "督办失败");
- return;
- }
- if (res.data?.notificationStatus === "FAILED") {
- ElMessage.warning("督办已保存,但短信发送失败,请联系管理员核查,勿重复提交");
- } else {
- ElMessage.success(res.msg || "督办通知已发送");
- }
- supervisionVisible.value = false;
- loadList();
- } finally {
- submitLoading.value = false;
- }
- }
- async function submitInstruction() {
- if (!instructionForm.leaderName || !instructionForm.instructionContent) {
- ElMessage.warning("请完善领导批示信息");
- return;
- }
- submitLoading.value = true;
- try {
- const res = await instructionWarningData({
- warningId: currentRow.value.warningId,
- leaderName: instructionForm.leaderName,
- instructionContent: instructionForm.instructionContent
- });
- if (res.code !== 200) {
- ElMessage.error(res.msg || "批示失败");
- return;
- }
- ElMessage.success("添加批示成功");
- instructionVisible.value = false;
- loadList();
- } finally {
- submitLoading.value = false;
- }
- }
- async function submitReturn() {
- if (!returnForm.disposalContent) {
- ElMessage.warning("请输入退回说明");
- return;
- }
- submitLoading.value = true;
- try {
- const res = await returnWarningData({
- warningId: currentRow.value.warningId,
- disposalContent: returnForm.disposalContent
- });
- if (res.code !== 200) {
- ElMessage.error(res.msg || "退回失败");
- return;
- }
- ElMessage.success("退回成功");
- returnVisible.value = false;
- loadList();
- } finally {
- submitLoading.value = false;
- }
- }
- onMounted(async () => {
- await loadDicts();
- await loadList();
- });
- </script>
- <style scoped>
- .warning-disposal-page {
- background: #f5f7fb;
- }
- .page-card {
- border-radius: 16px;
- margin-bottom: 16px;
- }
- .header-card {
- background: linear-gradient(135deg, #eff6ff, #f8fbff);
- border: 1px solid #dbeafe;
- }
- .page-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- gap: 16px;
- }
- .page-title {
- font-size: 22px;
- font-weight: 700;
- color: #1e3a8a;
- }
- .user-dept {
- float: right;
- margin-left: 16px;
- color: #94a3b8;
- font-size: 12px;
- }
- .notification-hint {
- margin-top: 6px;
- color: #909399;
- font-size: 12px;
- line-height: 20px;
- }
- @media (max-width: 768px) {
- .page-header {
- flex-direction: column;
- align-items: flex-start;
- }
- }
- </style>
|