|
@@ -1,18 +1,31 @@
|
|
|
<!-- 应急预案编辑 -->
|
|
<!-- 应急预案编辑 -->
|
|
|
<template>
|
|
<template>
|
|
|
<div class="app-container">
|
|
<div class="app-container">
|
|
|
|
|
+ <el-tabs v-model="activeTab" @tab-change="handleTabChange">
|
|
|
|
|
+ <el-tab-pane label="预案列表" name="plans">
|
|
|
<!-- 顶部操作区 -->
|
|
<!-- 顶部操作区 -->
|
|
|
<el-form :model="queryParams" :inline="true" class="search-form">
|
|
<el-form :model="queryParams" :inline="true" class="search-form">
|
|
|
<el-form-item label="预案名称">
|
|
<el-form-item label="预案名称">
|
|
|
- <el-input v-model="queryParams.planName" placeholder="请输入预案名称" clearable style="width: 200px" />
|
|
|
|
|
|
|
+ <el-input v-model="queryParams.planName" placeholder="请输入预案名称" clearable style="width: 200px" @keyup.enter="handleSearch" />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+ <el-form-item label="创建时间">
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="queryParams.dateRange"
|
|
|
|
|
+ type="daterange"
|
|
|
|
|
+ range-separator="至"
|
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
|
+ style="width: 240px"
|
|
|
|
|
+ value-format="YYYY-MM-DD"
|
|
|
|
|
+ />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
<el-form-item>
|
|
|
- <el-button type="primary" @click="handleSearch">搜索</el-button>
|
|
|
|
|
- <el-button @click="handleReset">重置</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" :icon="Search" @click="handleSearch">搜索</el-button>
|
|
|
|
|
+ <el-button :icon="Refresh" @click="handleReset">重置</el-button>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item style="float: right">
|
|
<el-form-item style="float: right">
|
|
|
<el-button type="success" @click="handleAdd">新增</el-button>
|
|
<el-button type="success" @click="handleAdd">新增</el-button>
|
|
|
- <el-button @click="openTemplateDrawer">模板库</el-button>
|
|
|
|
|
|
|
+ <el-button @click="openTemplateLibrary">模板库</el-button>
|
|
|
<el-button type="danger" @click="handleBatchDelete">批量删除</el-button>
|
|
<el-button type="danger" @click="handleBatchDelete">批量删除</el-button>
|
|
|
<el-button type="primary" @click="handleExport">导出</el-button>
|
|
<el-button type="primary" @click="handleExport">导出</el-button>
|
|
|
<el-button type="primary" @click="handleDownloadTemplate">下载模版</el-button>
|
|
<el-button type="primary" @click="handleDownloadTemplate">下载模版</el-button>
|
|
@@ -21,7 +34,7 @@
|
|
|
|
|
|
|
|
<!-- 主体:左侧树 + 右侧表格 -->
|
|
<!-- 主体:左侧树 + 右侧表格 -->
|
|
|
<div class="main-layout">
|
|
<div class="main-layout">
|
|
|
- <!-- 左侧预案分类树 -->
|
|
|
|
|
|
|
+ <!-- 左侧预案分类树(紧凑窄栏,不再挤压表格) -->
|
|
|
<div class="left-tree">
|
|
<div class="left-tree">
|
|
|
<div class="tree-title">预案分类</div>
|
|
<div class="tree-title">预案分类</div>
|
|
|
<el-tree
|
|
<el-tree
|
|
@@ -52,12 +65,19 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column prop="version" label="版本" width="90" />
|
|
<el-table-column prop="version" label="版本" width="90" />
|
|
|
- <el-table-column prop="attachName" label="附件名称" min-width="200" show-overflow-tooltip />
|
|
|
|
|
- <el-table-column label="附件下载" width="90" align="center">
|
|
|
|
|
|
|
+ <el-table-column prop="attachName" label="附件名称" min-width="200" show-overflow-tooltip>
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- <el-button link type="primary" @click="handleDownload(row)" :disabled="!row.attachPath">
|
|
|
|
|
- <el-icon><Download /></el-icon>
|
|
|
|
|
- </el-button>
|
|
|
|
|
|
|
+ <!-- 附件名称即下载入口:有附件时可点击下载,无附件显示 - -->
|
|
|
|
|
+ <el-link
|
|
|
|
|
+ v-if="row.attachName"
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ :underline="false"
|
|
|
|
|
+ :disabled="!row.attachPath"
|
|
|
|
|
+ @click="handleDownload(row)"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-icon style="margin-right:2px"><Download /></el-icon>{{ row.attachName }}
|
|
|
|
|
+ </el-link>
|
|
|
|
|
+ <span v-else>-</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column prop="publishDate" label="发布时间" width="120" align="center" />
|
|
<el-table-column prop="publishDate" label="发布时间" width="120" align="center" />
|
|
@@ -67,12 +87,12 @@
|
|
|
<el-tag :type="statusTagType(row.status)">{{ row.statusName }}</el-tag>
|
|
<el-tag :type="statusTagType(row.status)">{{ row.statusName }}</el-tag>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="200" align="center">
|
|
|
|
|
|
|
+ <el-table-column label="操作" width="270" align="center">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- <el-button link type="primary" @click="handleEdit(row)">{{ isReviseRow(row) ? '修订' : '编辑' }}</el-button>
|
|
|
|
|
- <el-button link type="danger" @click="handleDelete(row)">删除</el-button>
|
|
|
|
|
- <el-button v-if="row.submittable" link type="success" @click="handleSubmitApproval(row)">提交审核</el-button>
|
|
|
|
|
- <el-button link type="primary" @click="handleVersions(row)">版本</el-button>
|
|
|
|
|
|
|
+ <el-button type="primary" plain size="small" @click="handleEdit(row)">{{ isReviseRow(row) ? '修订' : '编辑' }}</el-button>
|
|
|
|
|
+ <el-button type="danger" plain size="small" @click="handleDelete(row)">删除</el-button>
|
|
|
|
|
+ <el-button v-if="row.submittable" type="success" plain size="small" @click="handleSubmitApproval(row)">提交审核</el-button>
|
|
|
|
|
+ <el-button type="warning" plain size="small" @click="handleVersions(row)">版本</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
@@ -90,6 +110,44 @@
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ </el-tab-pane>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 模板库:页签内嵌管理(替代原抽屉式页面) -->
|
|
|
|
|
+ <el-tab-pane label="预案模板库" name="templates">
|
|
|
|
|
+ <div style="margin-bottom:12px;display:flex;justify-content:space-between;align-items:center">
|
|
|
|
|
+ <span style="color:#909399;font-size:13px">模板用于「新建预案」时预填名称与章节正文</span>
|
|
|
|
|
+ <el-button type="primary" size="small" @click="handleTemplateAdd">新增模板</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <el-table :data="templatePageList" border stripe style="width:100%" v-loading="templateLoading">
|
|
|
|
|
+ <el-table-column type="index" :index="templateIndex" label="序号" width="60" align="center" />
|
|
|
|
|
+ <el-table-column prop="planName" label="模板名称" min-width="200" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column prop="eventType" label="类型" width="100" align="center" />
|
|
|
|
|
+ <el-table-column prop="eventLevel" label="等级" width="90" align="center" />
|
|
|
|
|
+ <el-table-column prop="responsibleUnit" label="责任单位" width="120">
|
|
|
|
|
+ <template #default="{ row }">{{ row.responsibleUnit || '-' }}</template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column prop="planSummary" label="概要" min-width="260" show-overflow-tooltip>
|
|
|
|
|
+ <template #default="{ row }">{{ row.planSummary || '-' }}</template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ <el-table-column label="操作" width="140" align="center">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ <el-button type="primary" plain size="small" @click="handleTemplateEdit(row)">编辑</el-button>
|
|
|
|
|
+ <el-button type="danger" plain size="small" @click="handleTemplateDelete(row)">删除</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 模板库分页(列表为全量加载,前端切片分页) -->
|
|
|
|
|
+ <el-pagination
|
|
|
|
|
+ style="margin-top: 16px; justify-content: flex-end"
|
|
|
|
|
+ v-model:current-page="templatePagination.page"
|
|
|
|
|
+ v-model:page-size="templatePagination.pageSize"
|
|
|
|
|
+ :page-sizes="[10, 20, 50]"
|
|
|
|
|
+ :total="templateList.length"
|
|
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-tab-pane>
|
|
|
|
|
+ </el-tabs>
|
|
|
|
|
|
|
|
<!-- 新建预案:空白 or 选择模板 -->
|
|
<!-- 新建预案:空白 or 选择模板 -->
|
|
|
<el-dialog v-model="createPickVisible" title="新建预案" width="560px">
|
|
<el-dialog v-model="createPickVisible" title="新建预案" width="560px">
|
|
@@ -140,7 +198,23 @@
|
|
|
<el-input v-model="form.version" disabled placeholder="由系统在审批通过后生成" />
|
|
<el-input v-model="form.version" disabled placeholder="由系统在审批通过后生成" />
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item label="编制单位" prop="compileUnit">
|
|
<el-form-item label="编制单位" prop="compileUnit">
|
|
|
- <el-input v-model="form.compileUnit" placeholder="请输入编制单位" />
|
|
|
|
|
|
|
+ <!-- 可从系统部门选择,也可手动输入(allow-create 允许创建新条目) -->
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="form.compileUnit"
|
|
|
|
|
+ filterable
|
|
|
|
|
+ allow-create
|
|
|
|
|
+ default-first-option
|
|
|
|
|
+ clearable
|
|
|
|
|
+ placeholder="选择系统部门或手动输入"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="d in deptOptions"
|
|
|
|
|
+ :key="d.deptId"
|
|
|
|
|
+ :label="d.deptName"
|
|
|
|
|
+ :value="d.deptName"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
<el-form-item v-if="isRevising" label="修订说明" prop="changeNote">
|
|
<el-form-item v-if="isRevising" label="修订说明" prop="changeNote">
|
|
|
<el-input v-model="form.changeNote" type="textarea" :rows="3" placeholder="请填写本次修订说明(修订已通过预案必填)" />
|
|
<el-input v-model="form.changeNote" type="textarea" :rows="3" placeholder="请填写本次修订说明(修订已通过预案必填)" />
|
|
@@ -184,32 +258,8 @@
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
- <!-- 模板库管理抽屉 -->
|
|
|
|
|
- <el-drawer v-model="templateDrawerVisible" title="预案模板库" size="760px" destroy-on-close>
|
|
|
|
|
- <div style="margin-bottom:12px;display:flex;justify-content:space-between;align-items:center">
|
|
|
|
|
- <span style="color:#909399;font-size:13px">模板用于「新建预案」时预填名称与章节正文</span>
|
|
|
|
|
- <el-button type="primary" size="small" @click="handleTemplateAdd">新增模板</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- <el-table :data="templateList" border stripe style="width:100%" v-loading="templateLoading">
|
|
|
|
|
- <el-table-column prop="planName" label="模板名称" min-width="180" show-overflow-tooltip />
|
|
|
|
|
- <el-table-column prop="eventType" label="类型" width="80" align="center" />
|
|
|
|
|
- <el-table-column prop="eventLevel" label="等级" width="70" align="center" />
|
|
|
|
|
- <el-table-column prop="responsibleUnit" label="责任单位" width="100">
|
|
|
|
|
- <template #default="{ row }">{{ row.responsibleUnit || '-' }}</template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column prop="planSummary" label="概要" min-width="200" show-overflow-tooltip>
|
|
|
|
|
- <template #default="{ row }">{{ row.planSummary || '-' }}</template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- <el-table-column label="操作" width="130" align="center" fixed="right">
|
|
|
|
|
- <template #default="{ row }">
|
|
|
|
|
- <el-button link type="primary" @click="handleTemplateEdit(row)">编辑</el-button>
|
|
|
|
|
- <el-button link type="danger" @click="handleTemplateDelete(row)">删除</el-button>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
- </el-table>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 模板新增/编辑弹窗 -->
|
|
|
|
|
- <el-dialog v-model="templateFormVisible" :title="templateForm.id ? '编辑模板' : '新增模板'" width="620px" append-to-body destroy-on-close>
|
|
|
|
|
|
|
+ <!-- 模板新增/编辑弹窗 -->
|
|
|
|
|
+ <el-dialog v-model="templateFormVisible" :title="templateForm.id ? '编辑模板' : '新增模板'" width="620px" destroy-on-close>
|
|
|
<el-form ref="templateFormRef" :model="templateForm" :rules="templateRules" label-width="90px">
|
|
<el-form ref="templateFormRef" :model="templateForm" :rules="templateRules" label-width="90px">
|
|
|
<el-form-item label="模板名称" prop="planName">
|
|
<el-form-item label="模板名称" prop="planName">
|
|
|
<el-input v-model="templateForm.planName" maxlength="60" placeholder="请输入模板名称" />
|
|
<el-input v-model="templateForm.planName" maxlength="60" placeholder="请输入模板名称" />
|
|
@@ -245,7 +295,6 @@
|
|
|
<el-button type="primary" :loading="templateSaving" @click="handleTemplateSubmit">保存</el-button>
|
|
<el-button type="primary" :loading="templateSaving" @click="handleTemplateSubmit">保存</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
- </el-drawer>
|
|
|
|
|
|
|
|
|
|
<!-- 版本管理弹窗 -->
|
|
<!-- 版本管理弹窗 -->
|
|
|
<el-dialog v-model="versionVisible" title="版本管理" width="760px" destroy-on-close>
|
|
<el-dialog v-model="versionVisible" title="版本管理" width="760px" destroy-on-close>
|
|
@@ -270,7 +319,7 @@
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" width="100" align="center">
|
|
<el-table-column label="操作" width="100" align="center">
|
|
|
<template #default="{ row }">
|
|
<template #default="{ row }">
|
|
|
- <el-button link type="primary" @click="handlePreviewVersion(row)">查看正文</el-button>
|
|
|
|
|
|
|
+ <el-button type="info" plain size="small" @click="handlePreviewVersion(row)">查看正文</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
@@ -295,14 +344,14 @@
|
|
|
<script setup>
|
|
<script setup>
|
|
|
import { ref, computed, onMounted } from 'vue'
|
|
import { ref, computed, onMounted } from 'vue'
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
-import { Download } from '@element-plus/icons-vue'
|
|
|
|
|
|
|
+import { Download, Search, Refresh } from '@element-plus/icons-vue'
|
|
|
import * as XLSX from 'xlsx'
|
|
import * as XLSX from 'xlsx'
|
|
|
import { getToken } from '@/utils/auth'
|
|
import { getToken } from '@/utils/auth'
|
|
|
import { useDict } from '@/utils/dict'
|
|
import { useDict } from '@/utils/dict'
|
|
|
import {
|
|
import {
|
|
|
getEventPlanPage, getEventPlanById, saveEventPlan, deleteEventPlan,
|
|
getEventPlanPage, getEventPlanById, saveEventPlan, deleteEventPlan,
|
|
|
submitEventPlan, getPlanVersions, getPlanVersion, getPlanLibraryList,
|
|
submitEventPlan, getPlanVersions, getPlanVersion, getPlanLibraryList,
|
|
|
- savePlanLibrary, deletePlanLibrary
|
|
|
|
|
|
|
+ savePlanLibrary, deletePlanLibrary, getDeptOptions
|
|
|
} from '@/api/dispatch'
|
|
} from '@/api/dispatch'
|
|
|
|
|
|
|
|
// ---------- 字典 ----------
|
|
// ---------- 字典 ----------
|
|
@@ -339,17 +388,22 @@ const handleNodeClick = (node) => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ---------- 查询 ----------
|
|
// ---------- 查询 ----------
|
|
|
-const queryParams = ref({ planName: '' })
|
|
|
|
|
|
|
+const queryParams = ref({ planName: '', dateRange: null })
|
|
|
|
|
|
|
|
// ---------- 数据 ----------
|
|
// ---------- 数据 ----------
|
|
|
const tableData = ref([])
|
|
const tableData = ref([])
|
|
|
|
|
|
|
|
async function loadData() {
|
|
async function loadData() {
|
|
|
try {
|
|
try {
|
|
|
- const params = { ...queryParams.value }
|
|
|
|
|
|
|
+ // 手工拼参数:dateRange 是数组不能直接展开进查询参数
|
|
|
|
|
+ const params = { planName: queryParams.value.planName }
|
|
|
if (selectedTreeNode.value) {
|
|
if (selectedTreeNode.value) {
|
|
|
params.planType = selectedTreeNode.value.id
|
|
params.planType = selectedTreeNode.value.id
|
|
|
}
|
|
}
|
|
|
|
|
+ if (queryParams.value.dateRange && queryParams.value.dateRange.length === 2) {
|
|
|
|
|
+ params.startDate = queryParams.value.dateRange[0]
|
|
|
|
|
+ params.endDate = queryParams.value.dateRange[1]
|
|
|
|
|
+ }
|
|
|
const res = await getEventPlanPage(1, 999, params)
|
|
const res = await getEventPlanPage(1, 999, params)
|
|
|
tableData.value = res?.data?.records ?? res?.data ?? res ?? []
|
|
tableData.value = res?.data?.records ?? res?.data ?? res ?? []
|
|
|
} catch {
|
|
} catch {
|
|
@@ -357,7 +411,18 @@ async function loadData() {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-onMounted(() => { loadData() })
|
|
|
|
|
|
|
+onMounted(() => { loadData(); loadDeptOptions() })
|
|
|
|
|
+
|
|
|
|
|
+// ---------- 编制单位候选(系统部门,可手输) ----------
|
|
|
|
|
+const deptOptions = ref([])
|
|
|
|
|
+async function loadDeptOptions() {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const res = await getDeptOptions()
|
|
|
|
|
+ deptOptions.value = res.data || []
|
|
|
|
|
+ } catch {
|
|
|
|
|
+ deptOptions.value = []
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
// ---------- 分页 ----------
|
|
// ---------- 分页 ----------
|
|
|
const pagination = ref({ page: 1, size: 10 })
|
|
const pagination = ref({ page: 1, size: 10 })
|
|
@@ -372,6 +437,7 @@ const onPageChange = () => {}
|
|
|
const handleSearch = () => { pagination.value.page = 1; loadData() }
|
|
const handleSearch = () => { pagination.value.page = 1; loadData() }
|
|
|
const handleReset = () => {
|
|
const handleReset = () => {
|
|
|
queryParams.value.planName = ''
|
|
queryParams.value.planName = ''
|
|
|
|
|
+ queryParams.value.dateRange = null
|
|
|
selectedTreeNode.value = null
|
|
selectedTreeNode.value = null
|
|
|
treeRef.value?.setCurrentKey(null)
|
|
treeRef.value?.setCurrentKey(null)
|
|
|
pagination.value.page = 1
|
|
pagination.value.page = 1
|
|
@@ -423,8 +489,17 @@ function pickCreate(tpl) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ---------- 模板库管理 ----------
|
|
// ---------- 模板库管理 ----------
|
|
|
-const templateDrawerVisible = ref(false)
|
|
|
|
|
|
|
+// 模板库已改为页签内嵌页面(不再是抽屉):activeTab 切到 templates 并加载数据
|
|
|
|
|
+const activeTab = ref('plans')
|
|
|
const templateList = ref([])
|
|
const templateList = ref([])
|
|
|
|
|
+// 模板库前端分页:列表一次全量加载,本地切片展示
|
|
|
|
|
+const templatePagination = ref({ page: 1, pageSize: 10 })
|
|
|
|
|
+const templatePageList = computed(() => {
|
|
|
|
|
+ const start = (templatePagination.value.page - 1) * templatePagination.value.pageSize
|
|
|
|
|
+ return templateList.value.slice(start, start + templatePagination.value.pageSize)
|
|
|
|
|
+})
|
|
|
|
|
+// 序号跨页连续(第2页从11开始)
|
|
|
|
|
+const templateIndex = (index) => (templatePagination.value.page - 1) * templatePagination.value.pageSize + index + 1
|
|
|
const templateLoading = ref(false)
|
|
const templateLoading = ref(false)
|
|
|
const templateFormVisible = ref(false)
|
|
const templateFormVisible = ref(false)
|
|
|
const templateFormRef = ref(null)
|
|
const templateFormRef = ref(null)
|
|
@@ -434,17 +509,29 @@ const templateRules = {
|
|
|
planName: [{ required: true, message: '请输入模板名称', trigger: 'blur' }]
|
|
planName: [{ required: true, message: '请输入模板名称', trigger: 'blur' }]
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 打开抽屉时加载模板列表(此前按钮只开了抽屉没加载数据,导致首次打开“暂无数据”)
|
|
|
|
|
-function openTemplateDrawer() {
|
|
|
|
|
- templateDrawerVisible.value = true
|
|
|
|
|
- loadTemplatesForDrawer()
|
|
|
|
|
|
|
+// 切到模板库页签时加载模板列表(此前按钮只开了抽屉没加载数据,导致首次打开“暂无数据”)
|
|
|
|
|
+function openTemplateLibrary() {
|
|
|
|
|
+ activeTab.value = 'templates'
|
|
|
|
|
+ loadTemplateList()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+// 直接点页签切换也要加载数据(不经「模板库」按钮时 openTemplateLibrary 不会触发)
|
|
|
|
|
+function handleTabChange(name) {
|
|
|
|
|
+ if (name === 'templates') {
|
|
|
|
|
+ loadTemplateList()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-async function loadTemplatesForDrawer() {
|
|
|
|
|
|
|
+async function loadTemplateList() {
|
|
|
templateLoading.value = true
|
|
templateLoading.value = true
|
|
|
try {
|
|
try {
|
|
|
const res = await getPlanLibraryList()
|
|
const res = await getPlanLibraryList()
|
|
|
templateList.value = res?.data ?? []
|
|
templateList.value = res?.data ?? []
|
|
|
|
|
+ // 数据刷新后若当前页超出范围,回到第 1 页(如删除后只剩 1 页)
|
|
|
|
|
+ const maxPage = Math.max(1, Math.ceil(templateList.value.length / templatePagination.value.pageSize))
|
|
|
|
|
+ if (templatePagination.value.page > maxPage) {
|
|
|
|
|
+ templatePagination.value.page = 1
|
|
|
|
|
+ }
|
|
|
} catch {
|
|
} catch {
|
|
|
ElMessage.error('模板列表加载失败')
|
|
ElMessage.error('模板列表加载失败')
|
|
|
} finally {
|
|
} finally {
|
|
@@ -469,7 +556,7 @@ function handleTemplateDelete(row) {
|
|
|
try {
|
|
try {
|
|
|
await deletePlanLibrary(row.id)
|
|
await deletePlanLibrary(row.id)
|
|
|
ElMessage.success('删除成功')
|
|
ElMessage.success('删除成功')
|
|
|
- loadTemplatesForDrawer()
|
|
|
|
|
|
|
+ loadTemplateList()
|
|
|
} catch {
|
|
} catch {
|
|
|
ElMessage.error('删除失败')
|
|
ElMessage.error('删除失败')
|
|
|
}
|
|
}
|
|
@@ -484,7 +571,7 @@ function handleTemplateSubmit() {
|
|
|
await savePlanLibrary(templateForm.value)
|
|
await savePlanLibrary(templateForm.value)
|
|
|
ElMessage.success('保存成功')
|
|
ElMessage.success('保存成功')
|
|
|
templateFormVisible.value = false
|
|
templateFormVisible.value = false
|
|
|
- loadTemplatesForDrawer()
|
|
|
|
|
|
|
+ loadTemplateList()
|
|
|
} catch {
|
|
} catch {
|
|
|
ElMessage.error('保存失败')
|
|
ElMessage.error('保存失败')
|
|
|
} finally {
|
|
} finally {
|
|
@@ -753,20 +840,33 @@ async function handlePreviewVersion(row) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.left-tree {
|
|
.left-tree {
|
|
|
- width: 25%;
|
|
|
|
|
- min-width: 200px;
|
|
|
|
|
|
|
+ /* 固定窄栏:分类只有少数几项,25% 宽度过大会挤压右侧表格 */
|
|
|
|
|
+ width: 160px;
|
|
|
border: 1px solid #ebeef5;
|
|
border: 1px solid #ebeef5;
|
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
|
- padding: 12px;
|
|
|
|
|
|
|
+ padding: 10px 8px;
|
|
|
|
|
+ align-self: flex-start;
|
|
|
flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
|
|
|
|
|
|
.tree-title {
|
|
.tree-title {
|
|
|
- font-weight: bold;
|
|
|
|
|
- font-size: 15px;
|
|
|
|
|
- margin-bottom: 10px;
|
|
|
|
|
- padding-bottom: 8px;
|
|
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ color: #303133;
|
|
|
|
|
+ margin-bottom: 6px;
|
|
|
|
|
+ padding-bottom: 6px;
|
|
|
border-bottom: 1px solid #ebeef5;
|
|
border-bottom: 1px solid #ebeef5;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /* 紧凑树节点:小字号 + 收紧内边距 */
|
|
|
|
|
+ :deep(.el-tree-node__content) {
|
|
|
|
|
+ height: 28px;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ border-radius: 4px;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ :deep(.el-tree-node__content:hover) {
|
|
|
|
|
+ background: #f5f7fa;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
.right-table {
|
|
.right-table {
|