修改
This commit is contained in:
parent
afa02c6769
commit
e3d4203981
@ -17,6 +17,28 @@ export function updatePoserHeads(data) {
|
|||||||
data: data
|
data: data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function uploadVideoUrl(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingItem/uploadVideoUrl',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function uploadUrl(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingItem/uploadUrl',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function uploadTrainingCategoryPicture(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingCategory/uploadTrainingCategoryPicture',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export function posts(data) {
|
export function posts(data) {
|
||||||
return request({
|
return request({
|
||||||
|
|||||||
44
src/api/system/trainingCategory.js
Normal file
44
src/api/system/trainingCategory.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询学习培训分类列表
|
||||||
|
export function listTrainingCategory(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingCategory/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询学习培训分类详细
|
||||||
|
export function getTrainingCategory(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingCategory/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增学习培训分类
|
||||||
|
export function addTrainingCategory(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingCategory/add',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改学习培训分类
|
||||||
|
export function updateTrainingCategory(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingCategory/edit',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除学习培训分类
|
||||||
|
export function delTrainingCategory(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingCategory/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
50
src/api/system/trainingItem.js
Normal file
50
src/api/system/trainingItem.js
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询学习培训项目信息列表
|
||||||
|
export function listTrainingItem(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingItem/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function listTrainingCategory(query) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingCategory/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 查询学习培训项目信息详细
|
||||||
|
export function getTrainingItem(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingItem/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增学习培训项目信息
|
||||||
|
export function addTrainingItem(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingItem/add',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改学习培训项目信息
|
||||||
|
export function updateTrainingItem(data) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingItem/edit',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除学习培训项目信息
|
||||||
|
export function delTrainingItem(id) {
|
||||||
|
return request({
|
||||||
|
url: '/system/trainingItem/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
@ -1,13 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div class="user-info-head" :class="video.VideoPath ? 'wihi' : ''" @click="editCropper()">
|
<div
|
||||||
|
class="user-info-head"
|
||||||
|
:class="video.VideoPath ? 'wihi' : ''"
|
||||||
|
@click="editCropper()"
|
||||||
|
>
|
||||||
<video
|
<video
|
||||||
style="width: 208px; height: 208px"
|
style="width: 208px; height: 208px"
|
||||||
v-if="video.VideoPath"
|
v-if="video.VideoPath"
|
||||||
v-bind:src="video.VideoPath"
|
v-bind:src="video.VideoPath"
|
||||||
class="avatar video-avatar"
|
class="avatar video-avatar"
|
||||||
controls="controls"
|
controls="controls"
|
||||||
>您的浏览器不支持视频播放</video>
|
>
|
||||||
|
您的浏览器不支持视频播放
|
||||||
|
</video>
|
||||||
<img
|
<img
|
||||||
v-if="options.img"
|
v-if="options.img"
|
||||||
v-bind:src="options.img"
|
v-bind:src="options.img"
|
||||||
@ -56,14 +62,26 @@
|
|||||||
v-bind:src="videoForm.showVideoPath"
|
v-bind:src="videoForm.showVideoPath"
|
||||||
class="avatar video-avatar"
|
class="avatar video-avatar"
|
||||||
controls="controls"
|
controls="controls"
|
||||||
>您的浏览器不支持视频播放</video>
|
>
|
||||||
<img style="width: 100%; height: 100%" v-if="previews.url" :src="previews.url" />
|
您的浏览器不支持视频播放
|
||||||
|
</video>
|
||||||
|
<img
|
||||||
|
style="width: 100%; height: 100%"
|
||||||
|
v-if="previews.url"
|
||||||
|
:src="previews.url"
|
||||||
|
/>
|
||||||
<div v-else></div>
|
<div v-else></div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="title"
|
class="title"
|
||||||
v-if="types != 'posterVideoUrl'&&types!='posterPictureUrl'"
|
v-if="
|
||||||
>请上传图片为800x800px的正方形</div>
|
types != 'posterVideoUrl' &&
|
||||||
|
types != 'posterPictureUrl' &&
|
||||||
|
types != 'itemDirectoryUrl'
|
||||||
|
"
|
||||||
|
>
|
||||||
|
请上传图片为800x800px的正方形
|
||||||
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<br />
|
<br />
|
||||||
@ -110,7 +128,9 @@
|
|||||||
></el-button>
|
></el-button>
|
||||||
</el-col>-->
|
</el-col>-->
|
||||||
<el-col :lg="{ span: 2, offset: 20 }" :md="2">
|
<el-col :lg="{ span: 2, offset: 20 }" :md="2">
|
||||||
<el-button type="primary" size="small" @click="uploadImg()">提 交</el-button>
|
<el-button type="primary" size="small" @click="uploadImg()"
|
||||||
|
>提 交</el-button
|
||||||
|
>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@ -123,7 +143,10 @@ import baseurl from "@/api/baseurl.js";
|
|||||||
import {
|
import {
|
||||||
updateNurseStationHeads,
|
updateNurseStationHeads,
|
||||||
posts,
|
posts,
|
||||||
updatePoserHeads
|
uploadVideoUrl,
|
||||||
|
uploadTrainingCategoryPicture,
|
||||||
|
updatePoserHeads,
|
||||||
|
uploadUrl,
|
||||||
} from "@/api/system/stationAvatar.js";
|
} from "@/api/system/stationAvatar.js";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -145,17 +168,17 @@ export default {
|
|||||||
autoCrop: true, // 是否默认生成截图框
|
autoCrop: true, // 是否默认生成截图框
|
||||||
autoCropWidth: 300, // 默认生成截图框宽度
|
autoCropWidth: 300, // 默认生成截图框宽度
|
||||||
autoCropHeight: 300, // 默认生成截图框高度
|
autoCropHeight: 300, // 默认生成截图框高度
|
||||||
fixedBox: true // 固定截图框大小 不允许改变
|
fixedBox: true, // 固定截图框大小 不允许改变
|
||||||
},
|
},
|
||||||
previews: {},
|
previews: {},
|
||||||
items: {},
|
items: {},
|
||||||
//显示上传按钮
|
//显示上传按钮
|
||||||
videoForm: {
|
videoForm: {
|
||||||
showVideoPath: null //回显的变量
|
showVideoPath: null, //回显的变量
|
||||||
},
|
},
|
||||||
video: {
|
video: {
|
||||||
VideoPath: null //回显的变量
|
VideoPath: null, //回显的变量
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@ -175,7 +198,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.options.img = baseurl + this.img;
|
this.options.img = baseurl + this.img;
|
||||||
}
|
}
|
||||||
if (this.types == "posterVideoUrl") {
|
if (this.types == "posterVideoUrl" || this.types == "itemDirectoryUrl") {
|
||||||
this.title = "上传视频";
|
this.title = "上传视频";
|
||||||
} else {
|
} else {
|
||||||
this.title = "上传图片";
|
this.title = "上传图片";
|
||||||
@ -183,12 +206,12 @@ export default {
|
|||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
tovideo: {
|
tovideo: {
|
||||||
handler(newimg, oldimg) {}
|
handler(newimg, oldimg) {},
|
||||||
},
|
},
|
||||||
item: {
|
item: {
|
||||||
handler(newimg, oldimg) {
|
handler(newimg, oldimg) {
|
||||||
this.items = this.item;
|
this.items = this.item;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
img: {
|
img: {
|
||||||
handler(newimg, oldimg) {
|
handler(newimg, oldimg) {
|
||||||
@ -199,13 +222,13 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.options.img = baseurl + this.img;
|
this.options.img = baseurl + this.img;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
handler(newimg, oldimg) {
|
handler(newimg, oldimg) {
|
||||||
this.types = this.type;
|
this.types = this.type;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 编辑头像
|
// 编辑头像
|
||||||
@ -233,7 +256,7 @@ export default {
|
|||||||
},
|
},
|
||||||
// 上传预处理
|
// 上传预处理
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
if (this.types == "posterVideoUrl") {
|
if (this.types == "posterVideoUrl" || this.types == "itemDirectoryUrl") {
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
this.previews.data = file;
|
this.previews.data = file;
|
||||||
this.previews.url = URL.createObjectURL(file);
|
this.previews.url = URL.createObjectURL(file);
|
||||||
@ -264,14 +287,39 @@ export default {
|
|||||||
if (this.previews.data) {
|
if (this.previews.data) {
|
||||||
formData.append("file", this.previews.data);
|
formData.append("file", this.previews.data);
|
||||||
formData.append("type", this.types);
|
formData.append("type", this.types);
|
||||||
if (this.types == "posterVideoUrl") {
|
if (this.types == "itemDirectoryUrl") {
|
||||||
updatePoserHeads(formData).then(response => {
|
uploadVideoUrl(formData).then((response) => {
|
||||||
|
this.video.VideoPath = baseurl + response.imgUrl;
|
||||||
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
|
this.items.itemDirectoryUrl = response.imgUrl;
|
||||||
|
this.$emit("item", JSON.stringify(this.items));
|
||||||
|
console.log(this.video,this.options)
|
||||||
|
this.openimg = false;
|
||||||
|
});
|
||||||
|
} else if (
|
||||||
|
this.types == "trainingItemCoverUrl" ||
|
||||||
|
this.types == "trainingItemContentUrl" ||
|
||||||
|
this.types == "trainingItemPosterUrl"
|
||||||
|
) {
|
||||||
|
uploadUrl(formData).then((response) => {
|
||||||
|
this.options.img = baseurl + response.imgUrl;
|
||||||
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
|
this.openimg = false;
|
||||||
|
});
|
||||||
|
} else if (this.types == "trainingCategoryPictureUrl") {
|
||||||
|
uploadTrainingCategoryPicture(formData).then((response) => {
|
||||||
|
this.options.img = baseurl + response.imgUrl;
|
||||||
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
|
this.openimg = false;
|
||||||
|
});
|
||||||
|
} else if (this.types == "posterVideoUrl") {
|
||||||
|
updatePoserHeads(formData).then((response) => {
|
||||||
this.video.VideoPath = baseurl + response.imgUrl;
|
this.video.VideoPath = baseurl + response.imgUrl;
|
||||||
this.$emit("imgUrl", response.imgUrl);
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
this.openimg = false;
|
this.openimg = false;
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
updateNurseStationHeads(formData).then(response => {
|
updateNurseStationHeads(formData).then((response) => {
|
||||||
this.options.img = baseurl + response.imgUrl;
|
this.options.img = baseurl + response.imgUrl;
|
||||||
this.$emit("imgUrl", response.imgUrl);
|
this.$emit("imgUrl", response.imgUrl);
|
||||||
if (this.types == "attributePitureUrl") {
|
if (this.types == "attributePitureUrl") {
|
||||||
@ -313,8 +361,8 @@ export default {
|
|||||||
closeDialog() {
|
closeDialog() {
|
||||||
this.imgs = "";
|
this.imgs = "";
|
||||||
this.visible = false;
|
this.visible = false;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
435
src/views/system/trainingCategory/index.vue
Normal file
435
src/views/system/trainingCategory/index.vue
Normal file
@ -0,0 +1,435 @@
|
|||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form
|
||||||
|
:model="queryParams"
|
||||||
|
ref="queryForm"
|
||||||
|
size="small"
|
||||||
|
:inline="true"
|
||||||
|
v-show="showSearch"
|
||||||
|
label-width="100px"
|
||||||
|
>
|
||||||
|
<!-- <el-form-item label="父级分类id" prop="parentId">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.parentId"
|
||||||
|
placeholder="请输入父级分类id"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="培训分类名称" prop="trainingCategoryName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.trainingCategoryName"
|
||||||
|
placeholder="请输入培训分类名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="培训分类编码" prop="trainingCategoryCode">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.trainingCategoryCode"
|
||||||
|
placeholder="请输入培训分类编码"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="培训分类排序" prop="trainingCategorySort">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.trainingCategorySort"
|
||||||
|
placeholder="请输入培训分类排序"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-search"
|
||||||
|
size="mini"
|
||||||
|
@click="handleQuery"
|
||||||
|
>搜索</el-button
|
||||||
|
>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
||||||
|
>重置</el-button
|
||||||
|
>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:trainingCategory:add']"
|
||||||
|
>新增</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['system:trainingCategory:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:trainingCategory:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</el-col>
|
||||||
|
<!-- <el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['system:trainingCategory:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col> -->
|
||||||
|
<right-toolbar
|
||||||
|
:showSearch.sync="showSearch"
|
||||||
|
@queryTable="getList"
|
||||||
|
></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table
|
||||||
|
v-loading="loading"
|
||||||
|
:data="trainingCategoryList"
|
||||||
|
@selection-change="handleSelectionChange"
|
||||||
|
>
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<!-- <el-table-column label="主键id" align="center" prop="id" />
|
||||||
|
<el-table-column label="父级分类id" align="center" prop="parentId" /> -->
|
||||||
|
<el-table-column
|
||||||
|
label="培训分类名称"
|
||||||
|
align="center"
|
||||||
|
prop="trainingCategoryName"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
label="培训分类编码"
|
||||||
|
align="center"
|
||||||
|
prop="trainingCategoryCode"
|
||||||
|
/>
|
||||||
|
<!-- <el-table-column label="培训分类图片路径" align="center" prop="trainingCategoryPictureUrl" /> -->
|
||||||
|
<el-table-column
|
||||||
|
label="培训分类排序"
|
||||||
|
align="center"
|
||||||
|
prop="trainingCategorySort"
|
||||||
|
/>
|
||||||
|
<!-- <el-table-column label="分类概述" align="center" prop="remark" /> -->
|
||||||
|
<el-table-column
|
||||||
|
label="操作"
|
||||||
|
align="center"
|
||||||
|
class-name="small-padding fixed-width"
|
||||||
|
>
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:trainingCategory:edit']"
|
||||||
|
>修改</el-button
|
||||||
|
>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:trainingCategory:remove']"
|
||||||
|
>删除</el-button
|
||||||
|
>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total > 0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改学习培训分类对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
label-width="110px"
|
||||||
|
:inline="true"
|
||||||
|
>
|
||||||
|
<!-- <el-form-item label="父级分类id" prop="parentId">
|
||||||
|
<el-input v-model="form.parentId" placeholder="请输入父级分类id" />
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="培训分类名称" prop="trainingCategoryName">
|
||||||
|
<el-input
|
||||||
|
v-model="form.trainingCategoryName"
|
||||||
|
maxlength="50"
|
||||||
|
placeholder="请输入培训分类名称"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<!-- <el-form-item label="培训分类编码" prop="trainingCategoryCode">
|
||||||
|
<el-input v-model="form.trainingCategoryCode" placeholder="请输入培训分类编码" />
|
||||||
|
</el-form-item> -->
|
||||||
|
<el-form-item label="培训分类图片" prop="trainingCategoryPictureUrl">
|
||||||
|
<stationAcatar
|
||||||
|
style="width: 208px"
|
||||||
|
@imgUrl="imgUrl"
|
||||||
|
:img="form.trainingCategoryPictureUrl"
|
||||||
|
:type="'trainingCategoryPictureUrl'"
|
||||||
|
/>
|
||||||
|
<!-- <el-input v-model="form.trainingCategoryPictureUrl" type="textarea" placeholder="请输入内容" /> -->
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="培训分类排序" prop="trainingCategorySort">
|
||||||
|
<el-input
|
||||||
|
v-model.number="form.trainingCategorySort"
|
||||||
|
maxlength="5"
|
||||||
|
placeholder="请输入培训分类排序"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="分类概述" prop="remark">
|
||||||
|
<el-input
|
||||||
|
type="textarea"
|
||||||
|
:rows="5"
|
||||||
|
style="width: 340px"
|
||||||
|
placeholder="请输入分类概述"
|
||||||
|
v-model="form.remark"
|
||||||
|
></el-input>
|
||||||
|
<!-- <el-input v-model="form.remark" placeholder="请输入分类概述" /> -->
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
listTrainingCategory,
|
||||||
|
getTrainingCategory,
|
||||||
|
delTrainingCategory,
|
||||||
|
addTrainingCategory,
|
||||||
|
updateTrainingCategory,
|
||||||
|
} from "@/api/system/trainingCategory";
|
||||||
|
import stationAcatar from "../stationAvatar/index.vue";
|
||||||
|
import { updatePicture } from "@/api/system/station";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: { stationAcatar },
|
||||||
|
name: "TrainingCategory",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
imgsurl: { pictureUrlList: [] },
|
||||||
|
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 学习培训分类表格数据
|
||||||
|
trainingCategoryList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
parentId: null,
|
||||||
|
trainingCategoryName: null,
|
||||||
|
trainingCategoryCode: null,
|
||||||
|
trainingCategoryPictureUrl: null,
|
||||||
|
trainingCategorySort: null,
|
||||||
|
},
|
||||||
|
imgone: "",
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
trainingCategoryName: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入培训分类名称",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
remark: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请输入分类概述",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trainingCategoryPictureUrl: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择培训分类图片",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
trainingCategorySort: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: "请选择培训分类排序",
|
||||||
|
trigger: "blur",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
imgUrl(imgUrl) {
|
||||||
|
this.form.trainingCategoryPictureUrl = imgUrl;
|
||||||
|
},
|
||||||
|
/** 查询学习培训分类列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listTrainingCategory(this.queryParams).then((response) => {
|
||||||
|
this.trainingCategoryList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
var obj = { pictureUrlList: [] };
|
||||||
|
if (this.imgone != this.form.trainingCategoryPictureUrl) {
|
||||||
|
if (this.form.trainingCategoryPictureUrl) {
|
||||||
|
obj.pictureUrlList.push(this.form.trainingCategoryPictureUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (obj.pictureUrlList.length > 0) {
|
||||||
|
updatePicture(obj).then((res) => {});
|
||||||
|
}
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
parentId: null,
|
||||||
|
trainingCategoryName: null,
|
||||||
|
trainingCategoryCode: null,
|
||||||
|
trainingCategoryPictureUrl: null,
|
||||||
|
trainingCategorySort: null,
|
||||||
|
remark: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map((item) => item.id);
|
||||||
|
this.single = selection.length !== 1;
|
||||||
|
this.multiple = !selection.length;
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加学习培训分类";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids;
|
||||||
|
getTrainingCategory(id).then((response) => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.imgone = this.form.trainingCategoryPictureUrl;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改学习培训分类";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateTrainingCategory(this.form).then((response) => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addTrainingCategory(this.form).then((response) => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal
|
||||||
|
.confirm('是否确认删除学习培训分类编号为"' + ids + '"的数据项?')
|
||||||
|
.then(function () {
|
||||||
|
return delTrainingCategory(ids);
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download(
|
||||||
|
"system/trainingCategory/export",
|
||||||
|
{
|
||||||
|
...this.queryParams,
|
||||||
|
},
|
||||||
|
`trainingCategory_${new Date().getTime()}.xlsx`
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
1087
src/views/system/trainingItem/index.vue
Normal file
1087
src/views/system/trainingItem/index.vue
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user