修改PPT模板管理
This commit is contained in:
parent
297077ea2c
commit
91788197cf
|
@ -8,6 +8,7 @@ export function sysRegionTreeList(query) {
|
|||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
// 依据父级id获取行政区划数据
|
||||
export function sysRegionListByPid(query) {
|
||||
return request({
|
||||
|
@ -16,8 +17,7 @@ export function sysRegionListByPid(query) {
|
|||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 新增行政区划
|
||||
export function addSysRegion(data) {
|
||||
return request({
|
||||
|
|
|
@ -9,6 +9,15 @@ export function sysMediaTypeTreeList(query) {
|
|||
})
|
||||
}
|
||||
|
||||
// 依据父级id获取媒体类型数据
|
||||
export function sysMediaTypeListByPid(query) {
|
||||
return request({
|
||||
url: '/admin/sysMediaType/listByPid',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
// 新增媒体类型
|
||||
export function addSysMediaType(data) {
|
||||
return request({
|
||||
|
|
|
@ -3,7 +3,7 @@ import request from '@/utils/request'
|
|||
// 获取PPT模板列表
|
||||
export function pptTemplatePage(query) {
|
||||
return request({
|
||||
url: '/admin/pptTemplate/getPptTemplatePage',
|
||||
url: '/admin/busPptTemplate/getBusPptTemplatePage',
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
|
@ -12,7 +12,7 @@ export function pptTemplatePage(query) {
|
|||
// 新增PPT模板
|
||||
export function addPptTemplate(data) {
|
||||
return request({
|
||||
url: '/admin/pptTemplate/addPptTemplate',
|
||||
url: '/admin/busPptTemplate/addBusPptTemplate',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
|
@ -21,7 +21,7 @@ export function addPptTemplate(data) {
|
|||
// 修改PPT模板
|
||||
export function updatePptTemplate(data) {
|
||||
return request({
|
||||
url: '/admin/pptTemplate/updatePptTemplate',
|
||||
url: '/admin/busPptTemplate/updateBusPptTemplate',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
|
@ -30,7 +30,7 @@ export function updatePptTemplate(data) {
|
|||
// 获取PPT模板详情
|
||||
export function getPptTemplate(pptTemplateId) {
|
||||
return request({
|
||||
url: '/admin/pptTemplate/getPptTemplate/' + pptTemplateId,
|
||||
url: '/admin/busPptTemplate/getBusPptTemplate/' + pptTemplateId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ export function getPptTemplate(pptTemplateId) {
|
|||
// 删除PPT模板
|
||||
export function deletePptTemplate(pptTemplateId) {
|
||||
return request({
|
||||
url: '/admin/pptTemplate/deletePptTemplate/' + pptTemplateId,
|
||||
url: '/admin/busPptTemplate/deleteBusPptTemplate/' + pptTemplateId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
|
@ -11,12 +11,12 @@
|
|||
<el-col :span="24">
|
||||
<el-button type="primary" class="primaryBtn" @click="handleAddRootNode"
|
||||
v-hasPermi="['system:administrativeRegion:add']">新增根节点</el-button>
|
||||
<el-button type="primary" class="primaryBtn" @click="toggleExpandAll">展开/折叠</el-button>
|
||||
<!-- <el-button type="primary" class="primaryBtn" @click="toggleExpandAll">展开/折叠</el-button> -->
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-if="refreshTable" v-loading="loading" height="calc(100vh - 244px)" :data="regionTreeList"
|
||||
row-key="id" lazy :load="loadChildren" :tree-props="{ children: 'childList' }">
|
||||
<el-table v-loading="loading" height="calc(100vh - 244px)" :data="regionTreeList"
|
||||
row-key="id" lazy :load="loadChildren" :tree-props="{ children: 'childList', hasChildren: 'hasChildren' }">
|
||||
<el-table-column prop="name" label="区域名称"></el-table-column>
|
||||
<el-table-column prop="code" label="区域编号"></el-table-column>
|
||||
<el-table-column prop="sortNo" label="排序"></el-table-column>
|
||||
|
@ -82,7 +82,7 @@ const refreshTable = ref(true)
|
|||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
listByPid: '0'
|
||||
parentId: '0'
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, message: "区域名称不能为空", trigger: "blur" }],
|
||||
|
@ -96,7 +96,7 @@ const { queryParams, form, rules } = toRefs(data)
|
|||
/** 查询行政区域树列表 */
|
||||
const getsysRegionTreeList = () => {
|
||||
loading.value = true
|
||||
sysRegionListByPid(queryParams.value).then(res => {
|
||||
sysRegionListByPid(queryParams.value).then(res => {
|
||||
regionTreeList.value = res.data
|
||||
loading.value = false
|
||||
})
|
||||
|
@ -107,7 +107,7 @@ const loadChildren = async (row, treeNode, resolve) => {
|
|||
try {
|
||||
// 调用API获取子节点数据
|
||||
// const children = await fetchChildrenData(row.id)
|
||||
queryParams.value.listByPid = row.id
|
||||
queryParams.value.parentId = row.id
|
||||
const children = await sysRegionListByPid(queryParams.value)
|
||||
// 将子节点数据传递给表格
|
||||
resolve(children.data)
|
||||
|
@ -117,14 +117,14 @@ const loadChildren = async (row, treeNode, resolve) => {
|
|||
}
|
||||
}
|
||||
|
||||
/** 展开/折叠操作 */
|
||||
const toggleExpandAll = () => {
|
||||
refreshTable.value = false
|
||||
isExpandAll.value = !isExpandAll.value
|
||||
nextTick(() => {
|
||||
refreshTable.value = true
|
||||
})
|
||||
}
|
||||
// /** 展开/折叠操作 */
|
||||
// const toggleExpandAll = () => {
|
||||
// refreshTable.value = false
|
||||
// isExpandAll.value = !isExpandAll.value
|
||||
// nextTick(() => {
|
||||
// refreshTable.value = true
|
||||
// })
|
||||
// }
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
|
@ -196,6 +196,8 @@ const handleDelete = (row) => {
|
|||
proxy.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function () {
|
||||
return deleteSysRegion(row.id)
|
||||
}).then(() => {
|
||||
regionTreeList.value = []
|
||||
queryParams.value.parentId = '0'
|
||||
getsysRegionTreeList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
<el-col :span="24">
|
||||
<el-button type="primary" class="primaryBtn" @click="handleAddRootNode"
|
||||
v-hasPermi="['system:mediaType:add']">新增根节点</el-button>
|
||||
<el-button type="primary" class="primaryBtn" @click="toggleExpandAll">展开/折叠</el-button>
|
||||
<!-- <el-button type="primary" class="primaryBtn" @click="toggleExpandAll">展开/折叠</el-button> -->
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-table v-if="refreshTable" v-loading="loading" height="calc(100vh - 244px)" :data="mediaTypeTreeList"
|
||||
row-key="deptId" :default-expand-all="isExpandAll" :tree-props="{ children: 'children' }">
|
||||
<el-table v-loading="loading" height="calc(100vh - 244px)" :data="mediaTypeTreeList" row-key="id" lazy
|
||||
:load="loadChildren" :tree-props="{ children: 'childList', hasChildren: 'hasChildren' }">
|
||||
<el-table-column prop="name" label="类型名称"></el-table-column>
|
||||
<el-table-column prop="value" label="类型标识"></el-table-column>
|
||||
<el-table-column prop="sortNo" label="排序"></el-table-column>
|
||||
|
@ -31,7 +31,7 @@
|
|||
v-hasPermi="['system:mediaType:edit']">修改</el-button>
|
||||
<el-button link type="primary" @click="handleAddChildrenNode(scope.row)"
|
||||
v-hasPermi="['system:mediaType:add']">新增子节点</el-button>
|
||||
<el-button v-if="scope.row.parentId != 0" link type="primary" @click="handleDelete(scope.row)"
|
||||
<el-button link type="primary" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['system:mediaType:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
@ -64,7 +64,7 @@
|
|||
|
||||
<script setup name="Dept">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { sysMediaTypeTreeList, addSysMediaType, updateSysMediaType, getSysMediaType, deleteSysMediaType } from "@/api/system/mediaType"
|
||||
import { sysMediaTypeListByPid, addSysMediaType, updateSysMediaType, getSysMediaType, deleteSysMediaType } from "@/api/system/mediaType"
|
||||
import { useBackgroundStore } from '@/store/modules/background'
|
||||
import otherbg from '@/assets/images/otherbg.png'
|
||||
const bgStore = useBackgroundStore()
|
||||
|
@ -81,6 +81,9 @@ const refreshTable = ref(true)
|
|||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
parentId: 0
|
||||
},
|
||||
rules: {
|
||||
name: [{ required: true, message: "类型名称不能为空", trigger: "blur" }],
|
||||
value: [{ required: true, message: "类型标识不能为空", trigger: "blur" }],
|
||||
|
@ -88,25 +91,41 @@ const data = reactive({
|
|||
},
|
||||
})
|
||||
|
||||
const { form, rules } = toRefs(data)
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
/** 查询媒体类型树列表 */
|
||||
const getsysMediaTypeTreeList = () => {
|
||||
loading.value = true
|
||||
sysMediaTypeTreeList().then(res => {
|
||||
sysMediaTypeListByPid(queryParams.value).then(res => {
|
||||
mediaTypeTreeList.value = res.data
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
/** 展开/折叠操作 */
|
||||
const toggleExpandAll = () => {
|
||||
refreshTable.value = false
|
||||
isExpandAll.value = !isExpandAll.value
|
||||
nextTick(() => {
|
||||
refreshTable.value = true
|
||||
})
|
||||
|
||||
|
||||
// 加载子节点数据的方法
|
||||
const loadChildren = async (row, treeNode, resolve) => {
|
||||
try {
|
||||
// 调用API获取子节点数据
|
||||
queryParams.value.parentId = row.id
|
||||
const children = await sysMediaTypeListByPid(queryParams.value)
|
||||
// 将子节点数据传递给表格
|
||||
resolve(children.data)
|
||||
} catch (error) {
|
||||
console.error('加载子节点失败:', error)
|
||||
resolve([])
|
||||
}
|
||||
}
|
||||
|
||||
// /** 展开/折叠操作 */
|
||||
// const toggleExpandAll = () => {
|
||||
// refreshTable.value = false
|
||||
// isExpandAll.value = !isExpandAll.value
|
||||
// nextTick(() => {
|
||||
// refreshTable.value = true
|
||||
// })
|
||||
// }
|
||||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
form.value = {
|
||||
|
@ -176,6 +195,8 @@ const handleDelete = (row) => {
|
|||
proxy.$modal.confirm('是否确认删除媒体类型名称为"' + row.name + '"的数据项?').then(function () {
|
||||
return deleteSysMediaType(row.id)
|
||||
}).then(() => {
|
||||
mediaTypeTreeList.value = []
|
||||
queryParams.value.parentId = 0
|
||||
getsysMediaTypeTreeList()
|
||||
proxy.$modal.msgSuccess("删除成功")
|
||||
}).catch(() => { })
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<el-row :gutter="10" class="my_row">
|
||||
<el-col :span="12">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" class="searchInputForm">
|
||||
<el-form-item label="" prop="keyword">
|
||||
<el-input v-model="form.keyword" placeholder="请输入" :prefix-icon="Search"
|
||||
<el-form-item label="" prop="templateName">
|
||||
<el-input v-model="queryParams.templateName" placeholder="请输入模板名称" :prefix-icon="Search"
|
||||
style="width: 300px;" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
@ -25,8 +25,15 @@
|
|||
|
||||
<el-table v-loading="loading" :data="templateList" height="calc(100vh - 306px)">
|
||||
<el-table-column label="模板名称" align="center" prop="templateName" />
|
||||
<el-table-column label="模板类型" align="center" prop="type" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="210">
|
||||
<el-table-column label="模板类型" align="center" prop="type">
|
||||
<template #default="scope">
|
||||
<span v-if="scope.row.type == 1">空白模板</span>
|
||||
<span v-if="scope.row.type == 2">滴滴模板</span>
|
||||
<span v-if="scope.row.type == 3">优客模板</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="模板地址" align="center" prop="originalFileName" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||
</template>
|
||||
|
@ -54,10 +61,12 @@
|
|||
<el-input v-model="form.templateName" placeholder="请输入" />
|
||||
</el-form-item>
|
||||
<el-form-item label="模板类型" prop="type">
|
||||
<el-input v-model="form.type" placeholder="请输入" />
|
||||
<el-select v-model="form.type" placeholder="请选择" clearable>
|
||||
<el-option v-for="item in typeList" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="模板文件" prop="fileId">
|
||||
<el-upload class="upload-demo" drag action="#" :http-request="requestDocUpload"
|
||||
<el-form-item label="模板文件" prop="fileUrl">
|
||||
<el-upload class="upload-demo" drag action="#" :limit="1" :http-request="requestDocUpload"
|
||||
:file-list="docUploadList" :before-upload="beforeDocUpload" :on-remove="removeDocUpload">
|
||||
<el-icon class="el-icon--upload"><upload-filled /></el-icon>
|
||||
<div class="el-upload__text">
|
||||
|
@ -91,23 +100,30 @@ const bgStore = useBackgroundStore()
|
|||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const baseUrl = import.meta.env.VITE_APP_BASE_API
|
||||
|
||||
const docUploadList = ref([])
|
||||
// 列表数据
|
||||
const templateList = ref([])
|
||||
const loading = ref(true)
|
||||
const total = ref(0)
|
||||
const open = ref(false)
|
||||
const title = ref("")
|
||||
const typeList = ref([
|
||||
{ label: '空白模板', value: 1 },
|
||||
{ label: '滴滴模板', value: 2 },
|
||||
{ label: '优客模板', value: 3 },
|
||||
])
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageIndex: 1,
|
||||
pageSize: 10,
|
||||
keyword: undefined,
|
||||
templateName: undefined,
|
||||
},
|
||||
rules: {
|
||||
templateName: [{ required: true, message: "模板名称不能为空", trigger: "blur" }],
|
||||
type: [{ required: true, message: "模板类型不能为空", trigger: "blur" }],
|
||||
fileId: [{ required: true, message: "模板文件不能为空", trigger: "change" }],
|
||||
fileUrl: [{ required: true, message: "模板文件不能为空", trigger: "change" }],
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -125,18 +141,19 @@ const getpptTemplatePageList = () => {
|
|||
|
||||
/** 表单重置 */
|
||||
const reset = () => {
|
||||
docUploadList.value = []
|
||||
form.value = {
|
||||
templateName: undefined,
|
||||
type: undefined,
|
||||
fileId: undefined
|
||||
fileUrl: undefined
|
||||
}
|
||||
proxy.resetForm("pptTemplateRef")
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
queryParams.value.pageIndex = 1
|
||||
getpptTemplatePageList()
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
|
@ -157,6 +174,12 @@ const handleUpdate = (row) => {
|
|||
reset()
|
||||
getPptTemplate(row.id).then(response => {
|
||||
form.value = response.data
|
||||
console.log('请求结果', form.value)
|
||||
docUploadList.value.push({
|
||||
name: form.value.originalFileName,
|
||||
url: form.value.fileUrl,
|
||||
suffix: form.value.suffix
|
||||
})
|
||||
open.value = true
|
||||
title.value = "修改模板"
|
||||
})
|
||||
|
@ -172,7 +195,7 @@ const cancel = () => {
|
|||
const submitForm = () => {
|
||||
proxy.$refs["pptTemplateRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.postId != undefined) {
|
||||
if (form.value.id != undefined) {
|
||||
updatePptTemplate(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功")
|
||||
open.value = false
|
||||
|
@ -199,7 +222,6 @@ const handleDelete = (row) => {
|
|||
}).catch(() => { })
|
||||
}
|
||||
|
||||
const docUploadList = ref([])
|
||||
// 自定义上传文件资料
|
||||
const requestDocUpload = (options) => {
|
||||
const { file } = options
|
||||
|
@ -213,7 +235,12 @@ const requestDocUpload = (options) => {
|
|||
url: baseUrl + res.fileName,
|
||||
suffix: res.suffix
|
||||
})
|
||||
form.fileId = ''
|
||||
form.value.fileUrl = baseUrl + res.fileName
|
||||
form.value.fileName = res.fileName
|
||||
form.value.newFileName = res.newFileName
|
||||
form.value.originalFileName = res.originalFilename
|
||||
form.value.size = res.size
|
||||
form.value.suffix = res.suffix
|
||||
} else {
|
||||
proxy.$modal.msgError(res.msg);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user