Commit 90b42ed9 by Cat

zd 社团

parent ddf3a95c
// 社团基础信息
import request from '@/utils/request';
// 查询社团信息列表
export function getCommunityInfo(data) {
return request({
url: '/info/list',
method: 'get',
params: data
})
}
// 查询社团详细信息列表
export function listCommunityInfo(id) {
return request({
url: '/info/'+ id,
method: 'get',
})
}
// 修改社团信息
export function editCommunityInfo(data) {
return request({
url: '/info',
method: 'put',
data: data
})
}
// 新增社团信息
export function addCommunityInfo(data) {
return request({
url: '/info',
method: 'post',
data: data
})
}
// 删除社团信息
export function delCommunityInfo(id) {
return request({
url: '/info/'+ id,
method: 'delete'
})
}
// 获取全校教师(不分页)
export function getTeachers(data) {
return request({
url: '/school/teacher/getTeachers',
method: 'get',
params: data
})
}
\ No newline at end of file
// 社团风采信息
import request from '@/utils/request';
// 查询社团风采信息列表
export function getCommunityInfo(data) {
return request({
url: '/fc/list',
method: 'get',
params: data
})
}
// 获取社团风采详细信息列表
export function listCommunityInfo(id) {
return request({
url: '/fc/'+ id,
method: 'get',
})
}
// 修改社团信息
export function editCommunityInfo(data) {
return request({
url: '/fc',
method: 'put',
data: data
})
}
//新增社团信息
export function addCommunityInfo(data) {
return request({
url: '/fc',
method: 'post',
data: data
})
}
// 是否发布
export function isCommunityFb(data) {
return request({
url: '/fc/isfb',
method: 'post',
data: data
})
}
// 删除社团风采信息
export function delCommunityInfo(id) {
return request({
url: '/fc/'+ id,
method: 'delete'
})
}
\ No newline at end of file
......@@ -7,15 +7,15 @@
:inline="true"
label-width="80px"
>
<el-form-item prop="taskName" label="社团名称">
<el-form-item prop="name" label="社团名称">
<el-input
v-model="queryForm.taskName"
v-model="queryForm.name"
placeholder="社团名称"
></el-input>
</el-form-item>
<el-form-item prop="grade" label="指导教师">
<el-form-item prop="teachers" label="指导教师">
<el-input
v-model="queryForm.grade"
v-model="queryForm.teachers"
placeholder="指导教师"
></el-input>
</el-form-item>
......@@ -59,21 +59,24 @@
<div style="width: 50%">
<!-- 任务详细信息 -->
<div class="task-info">
<div class="task-name">市二中田径社团</div>
<div class="task-name">
{{ task.intro }}
</div>
</div>
<div class="task-level">
<span>指导教师:张三</span>
<span> {{ task.teachers }}</span>
</div>
<div class="task-time">
<div>
社团宗旨:整合校内外教育资源,培养学生良好的心理素质,发展学生的个性特长,促进学生身心健康、全面发展
{{ task.aim }}
</div>
</div>
</div>
<div style="width: 50%">
<!-- 成员人数 -->
<div class="task-count">
<div class="count">200</div>
<div class="count">{{ task.num }}</div>
<div class="sun">成员人数</div>
</div>
</div>
......@@ -86,28 +89,28 @@
size="mini"
type="danger"
round
@click="handleUpdate(task)"
@click="handleDelete(task)"
>删除
</el-button>
<el-button
type="success"
size="small"
round
@click="clubRegistrationReview(task.id, task.grade)"
@click="clubRegistrationReview(task.id, task.teachers)"
>社团报名审核</el-button
>
<el-button
type="info"
size="small"
round
@click="clubActivityRecord(task.id, task.grade)"
@click="clubActivityRecord(task.id, task.teachers)"
>社团活动记录</el-button
>
<el-button
type="warning"
size="small"
round
@click="memberManagement(task.id, task.grade)"
@click="memberManagement(task.id, task.teachers)"
>成员管理
</el-button>
<el-button
......@@ -115,14 +118,14 @@
size="small"
round
type="primary"
@click="communityStyle(task.id, task.grade)"
@click="communityStyle(task.id, task.teachers)"
>社团风采
</el-button>
<el-button
type="primary"
size="small"
round
@click="basicInformation(task.id, task.grade)"
@click="basicInformation(task.id, task.teachers)"
>基础信息管理
</el-button>
</div>
......@@ -142,42 +145,42 @@
label-width="110px"
>
<div>
<el-form-item label="社团名称" prop="taskName">
<el-form-item label="社团名称" prop="name">
<el-input
v-model="form.taskName"
v-model="form.name"
placeholder="请输入社团名称"
></el-input>
</el-form-item>
<el-form-item label="指导教师">
<el-form-item label="指导教师" prop="teachers">
<el-select
style="width: 100%"
multiple
v-model="form.value"
v-model="form.teachersId"
filterable
placeholder="请选择指导教师"
>
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
v-for="item in teacherInfo"
:key="item.teacherCode"
:label="item.teacherName"
:value="item.teacherCode"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="社团宗旨" prop="grade">
<el-form-item label="社团宗旨" prop="aim">
<el-input
type="textarea"
:rows="4"
v-model="form.grade"
v-model="form.aim"
placeholder="请输入社团宗旨"
></el-input>
</el-form-item>
<el-form-item label="社团简介" prop="grade">
<el-form-item label="社团简介" prop="intro">
<el-input
type="textarea"
:rows="4"
v-model="form.grade"
v-model="form.intro"
placeholder="请输入社团简介"
></el-input>
</el-form-item>
......@@ -193,12 +196,13 @@
<script>
import {
dataCurricula,
addCurricula,
updateCurricula,
getCurricula,
getDept
} from '@/api/smartSchool/gradeWork/courseSelection/taskPublishing.js'
getCommunityInfo, // 查询社团信息列表
listCommunityInfo, // 查询社团详细信息列表
editCommunityInfo, // 修改社团信息
addCommunityInfo, // 新增社团信息
delCommunityInfo, // 删除社团信息
getTeachers //获取全校教师
} from '@/api/smartSchool/MassOrganization/basicInfo'
export default {
name: 'basicInformationManagement',
......@@ -206,16 +210,24 @@ export default {
return {
tasks: [1, 2, 3],
queryForm: {
taskName: '',
grade: ''
name: '',
teachers: ''
},
form: {
params: {},
id: '',
taskName: '',
grade: '',
startTime: '',
endTime: ''
createBy: '',
createTime: '',
updateBy: '',
updateTime: '',
delFlag: '',
name: '',
teachers: [],
teachersId: '',
aim: '',
intro: '',
num: null
},
//新增弹窗
open: false,
......@@ -229,108 +241,92 @@ export default {
look: false,
// 日期范围
dateRange: [],
options: [
{
value: '选项1',
label: '黄金糕'
},
{
value: '选项2',
label: '双皮奶'
},
{
value: '选项3',
label: '蚵仔煎'
},
{
value: '选项4',
label: '龙须面'
},
{
value: '选项5',
label: '北京烤鸭'
}
]
teacherInfo: [] //教师下拉列表
}
},
created() {
this.getList()
this.getList(), //查询列表
this.getTeachersInfo() //教师下拉列表
},
methods: {
/** 获取列表数据 */
getList() {
const params = {
taskName: this.queryForm.taskName,
grade: this.queryForm.grade
}
// dataCurricula(params).then(response => {
// this.tasks = response.rows;
// this.total = response.total;
// }).catch(err => {
// this.loading = false;
// })
getCommunityInfo(this.form)
.then((response) => {
this.tasks = response.rows
this.total = response.total
})
.catch((err) => {
this.loading = false
})
},
// 教师下拉列表
getTeachersInfo() {
getTeachers({}).then((res) => {
this.teacherInfo = res.rows
})
},
//基础信息管理
basicInformation(row) {
// console.log('bbb', row)
this.reset()
listCommunityInfo(row).then((response) => {
// console.log(response, '基础信息管理')
this.form = response.data
// this.form.teachers = response.data.teachers
this.form.teachers = this.form.teachers.split(',')
// console.log(this.form.teachers, 'this.form.teachers')
// console.log(this.form, 'this.form')
this.open = true
this.title = '社团基础信息管理'
})
},
//新增按钮操作
handleAdd() {
this.reset()
this.open = true
// getDept().then(response => {
// this.form.grade = response.data.grade;
// console.log(this.form.grade);
// })
// .catch(err => {
// this.loading = false;
// });
this.title = '新增社团基础信息'
},
// 社团报名审核
clubRegistrationReview(id, grade) {
clubRegistrationReview(id, teachers) {
this.$router.push({
path: '/massOrganization/clubRegistrationReview',
query: {
id,
grade
teachers
}
})
},
// 社团活动记录
clubActivityRecord(id, grade) {
clubActivityRecord(id, teachers) {
this.$router.push({
path: '/massOrganization/clubActivityRecord',
query: {
id,
grade
teachers
}
})
},
//成员管理
memberManagement(id, grade) {
memberManagement(id, teachers) {
this.$router.push({
path: '/massOrganization/memberManagement',
query: {
id,
grade
teachers
}
})
},
//社团风采
communityStyle(id, grade) {
console.log('grade', grade)
communityStyle(id, teachers) {
this.$router.push({
path: '/massOrganization/communityStyle',
query: {
id,
grade
teachers
}
})
},
//基础信息管理
basicInformation(id, grade) {
this.reset()
this.open = true
this.title = '社团基础信息维护'
},
// 取消按钮
cancel() {
this.open = false
......@@ -352,42 +348,51 @@ export default {
},
// 提交表单
submitForm() {
// console.log('object', this.dateRange);
// const teachersId = this.form.teachersId
const teachersId = this.form.teachersId
this.form.teachers =
teachersId == ''
? ''
: this.teacherInfo.find(
(item) => item.teacherCode == teachersId
).teacherName
this.throttle(() => {
this.$refs['form'].validate((valid) => {
const techs = this.form.teachers.join(',')
if (valid) {
if (this.form.id != null) {
// 编辑
// 修改
const params = {
id: this.form.id,
taskName: this.form.taskName,
startTime: this.dateRange[0],
endTime: this.dateRange[1]
name: this.form.name,
teachers: techs,
teachersId: this.form.teachersId,
aim: this.form.aim,
intro: this.form.intro
}
updateCurricula(params)
console.log(params, 'params')
editCommunityInfo(params)
.then((response) => {
console.log(params, 'params')
console.log('res1111')
this.getList()
this.$message.success('修改成功')
console.log('res', response)
this.open = false
this.getList()
})
.catch((err) => {})
} else {
// 新增
const params = {
taskName: this.form.taskName,
grade: this.form.grade,
startTime: this.dateRange[0],
endTime: this.dateRange[1]
name: this.form.name,
teachers: techs,
teachersId: this.form.teachersId,
aim: this.form.aim,
intro: this.form.intro
}
addCurricula(params)
console.log(params, 'params')
addCommunityInfo(params)
.then((response) => {
this.getList()
this.$message.success('新增成功')
this.open = false
this.getList()
})
.catch((err) => {
// Handle error if necessary
......@@ -397,27 +402,26 @@ export default {
})
})
},
// 编辑按钮
handleUpdate(task) {
this.title = '修改'
this.open = true
getCurricula(task.id)
.then((response) => {
this.form = response.data
this.dateRange = [
response.data.startTime,
response.data.endTime
]
this.$modal.closeLoading()
// 删除按钮
handleDelete(row) {
const ids = row.id || this.idEas
this.$modal
.confirm('是否确认删除?')
.then(function () {
return delCommunityInfo(ids)
})
.then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
})
.catch((err) => {})
.catch(() => {})
},
// 重置表单
reset() {
// 重置对话框表单
this.form = {
taskName: '',
grade: ''
name: '',
teachers: ''
}
this.dateRange = []
this.resetForm('form')
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="标题" prop="picName">
<el-input v-model="queryParams.picName" placeholder="请输入标题" clearable/>
</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>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="标题" prop="theme">
<el-input
v-model="queryParams.theme"
placeholder="请输入标题"
clearable
/>
</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" icon="el-icon-plus" size="mini" @click="handleAdd">新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete">删除
</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:pic:export']">导出-->
<!-- </el-button>-->
<!-- </el-col>-->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>-->
</el-row>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增
</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
>删除
</el-button>
</el-col>
</el-row>
<el-table v-loading="loading" ref="table" :data="picList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="序号" align="center" prop="seqencing" width="80"/>
<el-table-column label="风采主题" align="center" prop="picName"/>
<el-table-column label="附件" align="center" prop="picName">
<template slot-scope="scope">
<!-- <ListImage :image-url="pev+scope.row.picUrl"></ListImage>-->
<!-- previewSrcList 开启预览大图的功能。-->
<el-image
style="width: 100px; height: 100px"
:src="scope.row.url"
:preview-src-list="srcList">
</el-image>
</template>
</el-table-column>
<el-table-column label="是否发布" align="center" prop="isShow">
<template slot-scope="scope">
<el-switch v-model="scope.row.isShow" active-value="1" inactive-value="0"
@change="handleIsShow(scope.row)"></el-switch>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" v-if="columns[6].visible">
<template slot-scope="scope">
<!-- 未发布可以修改删除 -->
<div>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)">删除
</el-button>
</div>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleCheck(scope.row)">查看
</el-button>
</template>
</el-table-column>
</el-table>
<el-table
v-loading="loading"
ref="table"
:data="picList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column
label="序号"
align="center"
prop="seqencing"
width="80"
/>
<el-table-column label="风采主题" align="center" prop="theme" />
<el-table-column label="附件" align="center" prop="theme">
<template slot-scope="scope">
<el-image
style="width: 100px; height: 100px"
:src="scope.row.url"
:preview-src-list="srcList"
>
</el-image>
</template>
</el-table-column>
<el-table-column label="是否发布" align="center" prop="isShow">
<template slot-scope="scope">
<el-switch
v-model="scope.row.isShow"
active-value="1"
inactive-value="0"
@change="handleIsShow(scope.row)"
></el-switch>
</template>
</el-table-column>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
v-if="columns[6].visible"
>
<template slot-scope="scope">
<!-- 未发布可以修改删除 -->
<div>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除
</el-button>
</div>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleCheck(scope.row)"
>查看
</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"/>
<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="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px" style="width: 80%; margin: auto">
<el-form-item prop="gardenEmblem"
style="display: flex; text-align: center; justify-content: center; transform: translateX(-30px)">
<!-- <el-upload v-loading="uploadLoading" class="avatar-uploader" action="#" accept="image/*"-->
<!-- :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :on-remove="handleRemove"-->
<!-- :http-request="uploadImage" :limit="1" >-->
<el-upload :disabled="check == true ? true : false" v-loading="uploadLoading" class="avatar-uploader" action="#" accept="image/*"
:show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :on-remove="handleRemove"
:limit="1" >
<img v-if="imageUrl" :src="imageUrl" class="avatar"/>
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<!-- 添加或修改社团主题对话框 -->
<el-dialog
:title="title"
:visible.sync="open"
width="900px"
append-to-body
>
<el-form
ref="form"
:model="form"
:rules="rules"
label-width="90px"
style="width: 80%; margin: auto"
>
<el-form-item
prop="gardenEmblem"
style="
display: flex;
text-align: center;
justify-content: center;
transform: translateX(-30px);
"
>
<!-- <el-upload v-loading="uploadLoading" class="avatar-uploader" action="#" accept="image/*"-->
<!-- :show-file-list="false" :on-success="handleAvatarSuccess" :before-upload="beforeAvatarUpload" :on-remove="handleRemove"-->
<!-- :http-request="uploadImage" :limit="1" >-->
<el-upload
:disabled="check == true ? true : false"
v-loading="uploadLoading"
class="avatar-uploader"
action="#"
accept="image/*"
:show-file-list="false"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
:on-remove="handleRemove"
:limit="1"
>
<img v-if="imageUrl" :src="imageUrl" class="avatar" />
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
</el-upload>
</el-form-item>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="风采主题:" prop="picName">
<el-input :readonly="check == true ? true : false" v-model="form.picName" placeholder="请输入风采主题" style="width: 100%"/>
</el-form-item>
</el-col>
<!-- <el-col :span="12">-->
<!-- <el-form-item label="排序:" prop="seqencing">-->
<!-- <el-input-number v-model="form.seqencing" controls-position="right" style="width: 100%"-->
<!-- :min="1"></el-input-number>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
</el-row>
</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>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="风采主题:" prop="theme">
<el-input
:readonly="check == true ? true : false"
v-model="form.theme"
placeholder="请输入风采主题"
style="width: 100%"
/>
</el-form-item>
</el-col>
</el-row>
</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 {listPic, getPic, delPic, addPic, updatePic, updateState} from '@/api/smartSchool/schoolManage/introduce/pic'
import {
listPic,
getPic,
delPic,
addPic,
updatePic,
updateState
} from '@/api/smartSchool/schoolManage/introduce/pic'
import picAvatar from '@/views/smartSchool/schoolManage/introduce/schoolInfo/profile/picAvatar'
import {changeUserStatus} from '@/api/system/user'
import {uploadImage as commonUpload} from '@/api/common'
import {ExportType, TEXT_SIZE} from '@/enums/common'
import { changeUserStatus } from '@/api/system/user'
import { uploadImage as commonUpload } from '@/api/common'
import { ExportType, TEXT_SIZE } from '@/enums/common'
import {
getCommunityInfo, // 查询社团信息列表
listCommunityInfo, // 查询社团详细信息列表
editCommunityInfo, // 修改社团信息
isCommunityFb, // 新增社团信息
delCommunityInfo, // 删除社团信息
addCommunityInfo //新增社团信息
} from '@/api/smartSchool/MassOrganization/communityStyle'
export default {
name: 'communityStyle',
components: {picAvatar},
data() {
return {
pev: process.env.VUE_APP_BASE_API,
// 输入框字数限制
TEXT_SIZE,
//是否上传的院徽
isUploadPic: false,
//照片是否删除
options: [
{
value: 0,
label: '否'
},
{
value: 1,
label: '是'
name: 'communityStyle',
components: { picAvatar },
data() {
return {
pev: process.env.VUE_APP_BASE_API,
// 输入框字数限制
TEXT_SIZE,
//是否上传的院徽
isUploadPic: false,
//照片是否删除
options: [
{
value: 0,
label: '否'
},
{
value: 1,
label: '是'
}
],
//获取子组件传来的信息
pic: [],
// 图片路径
imageUrl: undefined,
// 图片上传遮罩层
uploadLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 园区照片表格数据
picList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
theme: null
},
// 表单参数
form: {},
// 表单校验
rules: {
theme: [
{
required: true,
message: '请输入相片名称',
trigger: 'blur'
}
],
seqencing: [
{ required: true, message: '请输入排序', trigger: 'blur' }
],
remark: [
{
max: TEXT_SIZE,
message: '备注信息在0到200字之间',
trigger: 'blur'
}
]
},
//设置table列隐藏与显示
columns: [
{ key: 0, label: `园区照片`, visible: true },
{ key: 1, label: `相片名称`, visible: true },
// {key: 2, label: `相片路径`, visible: true},
{ key: 2, label: `排序`, visible: true },
{ key: 3, label: `备注`, visible: true },
{ key: 4, label: `创建者`, visible: true },
{ key: 5, label: `创建时间`, visible: true },
{ key: 6, label: `操作`, visible: true }
],
// 作为临时图片展示
tempImage: '',
// 导出选项
exportOptions: {
title: '选择导出类别',
open: false
},
//查看状态
check: false
}
],
//获取子组件传来的信息
pic: [],
// 图片路径
imageUrl: undefined,
// 图片上传遮罩层
uploadLoading: false,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 园区照片表格数据
picList: [],
// 弹出层标题
title: '',
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
picName: null
},
// 表单参数
form: {},
// 表单校验
rules: {
picName: [{required: true, message: '请输入相片名称', trigger: 'blur'}],
seqencing: [{required: true, message: '请输入排序', trigger: 'blur'}],
remark: [{max: TEXT_SIZE, message: '备注信息在0到200字之间', trigger: 'blur'}]
},
//设置table列隐藏与显示
columns: [
{key: 0, label: `园区照片`, visible: true},
{key: 1, label: `相片名称`, visible: true},
// {key: 2, label: `相片路径`, visible: true},
{key: 2, label: `排序`, visible: true},
{key: 3, label: `备注`, visible: true},
{key: 4, label: `创建者`, visible: true},
{key: 5, label: `创建时间`, visible: true},
{key: 6, label: `操作`, visible: true}
],
// 作为临时图片展示
tempImage: '',
// 导出选项
exportOptions: {
title: '选择导出类别',
open: false
},
//查看状态
check:false,
}
},
created() {
this.getList()
},
watch: {
pic: {
handler(newValue, oldValue) {
console.log('watch----oldValue', oldValue)
console.log('watch----newValue', newValue)
this.isUploadPic = newValue[3]
}
}
},
methods: {
//是否删除 选中值发生变化时id处理函数
selectChangeHandler(value) {
this.form.isShow = value
},
/** 查询园区照片列表 */
getList() {
this.loading = true
this.picList = []
listPic(this.queryParams).then(response => {
this.picList = response.rows
this.total = response.total
this.loading = false
})
},
//获取图片信息
getSchoolInfoPic(val) {
this.pic = val
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
params: {},
id: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
delFlag: null,
picName: null,
picUrl: null,
seqencing: null,
isShow: 0
}
this.imageUrl = ''
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.throttle(() => {
this.queryParams.pageNum = 1
created() {
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.check = false
this.reset()
this.open = true
this.title = '新增社团风采'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const ids = row.id || this.ids
getPic(ids).then(response => {
this.form = response.data
this.imageUrl = this.pev + this.form.picUrl
this.open = true
this.title = '修改园区照片'
})
},
/** 查看按钮操作 */
handleCheck(row){
this.check = true
this.open = true
this.title = '查看社团风采'
},
// 上传成功回调
handleAvatarSuccess(res, file) {
this.imageUrl = res.data.url
console.log(file)
this.commonUpload(file)
},
// 上传前格式和图片大小限制
beforeAvatarUpload(file) {
const type = file.type === 'image/jpeg' || 'image/jpg' || 'image/webp' || 'image/png'
const isLt2M = file.size / 1024 / 1024 < 2
if (!type) {
this.$message.error('图片格式不正确!(只能包含jpg,png,webp,JPEG)')
}
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 2MB!')
}
return type && isLt2M
},
//删除图片
handleRemove(file, fileList){
this.imageUrl = ''
},
// 上传图片
uploadImage(file) {
const fileData = file.file
const formData = new FormData()
formData.append('file', fileData)
this.uploadLoading = true
commonUpload(formData)
.then(response => {
this.uploadLoading = false
this.$modal.msgSuccess('上传成功')
this.imageUrl = this.pev + response.url
// this.form.picUrl = process.env.VUE_APP_BASE_API + response.url
this.form.picUrl = response.url
})
.catch(error => {
this.uploadLoading = false
})
watch: {
pic: {
handler(newValue, oldValue) {
console.log('watch----oldValue', oldValue)
console.log('watch----newValue', newValue)
this.isUploadPic = newValue[3]
}
}
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate(valid => {
if (valid) {
this.$modal.loading('正在上传数据,请稍等...')
if (this.form.id != null) {
updatePic({
...this.form
methods: {
//是否删除 选中值发生变化时id处理函数
selectChangeHandler(value) {
this.form.isShow = value
},
/** 查询列表 */
getList() {
this.loading = true
this.picList = []
getCommunityInfo(this.queryParams).then((response) => {
this.picList = response.rows
this.total = response.total
this.loading = false
})
.then(response => {
this.$modal.closeLoading()
this.$modal.msgSuccess('修改成功')
this.open = false
},
//获取图片信息
getSchoolInfoPic(val) {
this.pic = val
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
params: {},
id: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
delFlag: null,
theme: null,
picUrl: null,
seqencing: null,
isShow: 0
}
this.imageUrl = ''
this.resetForm('form')
},
/** 搜索按钮操作 */
handleQuery() {
this.throttle(() => {
this.queryParams.pageNum = 1
this.getList()
})
.catch(error => {
this.$modal.closeLoading()
})
} else {
addPic({
...this.form,
isShow: '0'
})
.then(response => {
this.$modal.closeLoading()
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
.catch(error => {
this.$modal.closeLoading()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
if (ids) {
this.$modal
.confirm(`是否确认删除选中的${Object.hasOwnProperty.call(ids, 'length') ? ids.length : 1}条数据?`)
.then(() => {
this.$modal.loading('正在处理数据,请稍等...')
return delPic(ids)
})
.then(() => {
this.$modal.closeLoading()
this.getList()
this.$modal.msgSuccess('删除成功')
})
.catch(() => {
this.$modal.closeLoading()
})
}
},
},
/** 重置按钮操作 */
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.check = false
this.reset()
this.open = true
this.title = '新增社团风采'
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const ids = row.id || this.ids
/** 是否发布 */
handleIsShow(row) {
this.$modal
.confirm(row.isShow === '1' ? '是否确认显示为轮播图?' : '是否取消显示为轮播图?')
.then(() => {
this.$modal.loading('正在修改状态,请稍等...')
updateState(row.id, row.isShow)
.then(response => {
this.$modal.closeLoading()
this.$modal.msgSuccess('修改成功')
})
.catch(error => {
this.$modal.closeLoading()
row.isShow = row.isShow === '0' ? '1' : '0'
// getPic(ids).then((response) => {
// this.form = response.data
// this.imageUrl = this.pev + this.form.picUrl
// this.open = true
// this.title = '修改园区照片'
// })
},
/** 查看按钮操作 */
handleCheck(row) {
this.check = true
this.open = true
this.title = '查看社团风采'
},
// 上传成功回调
handleAvatarSuccess(res, file) {
this.imageUrl = res.data.url
console.log(file)
this.commonUpload(file)
},
// 上传前格式和图片大小限制
beforeAvatarUpload(file) {
const type =
file.type === 'image/jpeg' ||
'image/jpg' ||
'image/webp' ||
'image/png'
const isLt2M = file.size / 1024 / 1024 < 2
if (!type) {
this.$message.error(
'图片格式不正确!(只能包含jpg,png,webp,JPEG)'
)
}
if (!isLt2M) {
this.$message.error('上传图片大小不能超过 2MB!')
}
return type && isLt2M
},
//删除图片
handleRemove(file, fileList) {
this.imageUrl = ''
},
// 上传图片
uploadImage(file) {
const fileData = file.file
const formData = new FormData()
formData.append('file', fileData)
this.uploadLoading = true
commonUpload(formData)
.then((response) => {
this.uploadLoading = false
this.$modal.msgSuccess('上传成功')
this.imageUrl = this.pev + response.url
// this.form.picUrl = process.env.VUE_APP_BASE_API + response.url
this.form.picUrl = response.url
})
.catch((error) => {
this.uploadLoading = false
})
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
this.$modal.loading('正在上传数据,请稍等...')
if (this.form.id != null) {
editCommunityInfo({
...this.form
})
.then((response) => {
this.$modal.closeLoading()
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
.catch((error) => {
this.$modal.closeLoading()
})
} else {
addCommunityInfo({
...this.form,
isShow: '0'
})
.then((response) => {
this.$modal.closeLoading()
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
.catch((error) => {
this.$modal.closeLoading()
})
}
}
})
})
.catch(() => {
row.isShow = row.isShow === '0' ? '1' : '0'
})
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
if (ids) {
this.$modal
.confirm(
`是否确认删除选中的${
Object.hasOwnProperty.call(ids, 'length')
? ids.length
: 1
}条数据?`
)
.then(() => {
this.$modal.loading('正在处理数据,请稍等...')
return delCommunityInfo(ids)
})
.then(() => {
this.$modal.closeLoading()
this.getList()
this.$modal.msgSuccess('删除成功')
})
.catch(() => {
this.$modal.closeLoading()
})
}
},
/** 是否发布 */
handleIsShow(row) {
// this.$modal
// .confirm(
// row.isShow === '1'
// ? '是否确认显示为轮播图?'
// : '是否取消显示为轮播图?'
// )
// .then(() => {
// this.$modal.loading('正在修改状态,请稍等...')
// updateState(row.id, row.isShow)
// .then((response) => {
// this.$modal.closeLoading()
// this.$modal.msgSuccess('修改成功')
// })
// .catch((error) => {
// this.$modal.closeLoading()
// row.isShow = row.isShow === '0' ? '1' : '0'
// })
// })
// .catch(() => {
// row.isShow = row.isShow === '0' ? '1' : '0'
// })
}
}
}
}
</script>
<style scoped>
.avatar,
.avatar-uploader,
.el-icon-plus {
width: 650px;
width: 650px;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment