parent
ffbe8b42cc
commit
8f2e872166
@ -0,0 +1,55 @@
|
||||
import request from "@/utils/request";
|
||||
function customParamsSerializer(params) {
|
||||
let result = '';
|
||||
for (let key in params) {
|
||||
if (params.hasOwnProperty(key)) {
|
||||
if (Array.isArray(params[key])) {
|
||||
params[key].forEach((item,index) => {
|
||||
if(item.key){
|
||||
result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
|
||||
|
||||
}else{
|
||||
result +=`${key}[${index}]=${item}&`
|
||||
}
|
||||
});
|
||||
} else {
|
||||
result += `${key}=${params[key]}&`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.slice(0, -1);
|
||||
}
|
||||
export function index(params,isLoading = false) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/banners/index",
|
||||
params,
|
||||
paramsSerializer: customParamsSerializer,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params, isLoading = true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/banners/show",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function save(data) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/banners/save",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/banners/destroy",
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
import request from "@/utils/request";
|
||||
function customParamsSerializer(params) {
|
||||
let result = '';
|
||||
for (let key in params) {
|
||||
if (params.hasOwnProperty(key)) {
|
||||
if (Array.isArray(params[key])) {
|
||||
params[key].forEach((item,index) => {
|
||||
if(item.key){
|
||||
result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
|
||||
|
||||
}else{
|
||||
result +=`${key}[${index}]=${item}&`
|
||||
}
|
||||
});
|
||||
} else {
|
||||
result += `${key}=${params[key]}&`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.slice(0, -1);
|
||||
}
|
||||
export function index(params,isLoading = false) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/configs/index",
|
||||
params,
|
||||
paramsSerializer: customParamsSerializer,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params, isLoading = true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/configs/show",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function save(data) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/configs/save",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/configs/destroy",
|
||||
params
|
||||
})
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
import request from "@/utils/request";
|
||||
function customParamsSerializer(params) {
|
||||
let result = '';
|
||||
for (let key in params) {
|
||||
if (params.hasOwnProperty(key)) {
|
||||
if (Array.isArray(params[key])) {
|
||||
params[key].forEach((item,index) => {
|
||||
if(item.key){
|
||||
result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
|
||||
|
||||
}else{
|
||||
result +=`${key}[${index}]=${item}&`
|
||||
}
|
||||
});
|
||||
} else {
|
||||
result += `${key}=${params[key]}&`;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.slice(0, -1);
|
||||
}
|
||||
export function index(params,isLoading = false) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/teachers/index",
|
||||
params,
|
||||
paramsSerializer: customParamsSerializer,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function show(params, isLoading = true) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/teachers/show",
|
||||
params,
|
||||
isLoading
|
||||
})
|
||||
}
|
||||
|
||||
export function save(data) {
|
||||
return request({
|
||||
method: "post",
|
||||
url: "/api/admin/teachers/save",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function destroy(params) {
|
||||
return request({
|
||||
method: "get",
|
||||
url: "/api/admin/teachers/destroy",
|
||||
params
|
||||
})
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,153 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content">
|
||||
<div class="searchwrap" style="display: flex;align-items: center;">
|
||||
<div>
|
||||
<el-date-picker v-model="select.daterange" type="daterange" range-separator="至" start-placeholder="预约日期"
|
||||
end-placeholder="结束日期">
|
||||
</el-date-picker>
|
||||
</div>
|
||||
<div>
|
||||
<el-input v-model="select.name" placeholder="请输入预约人"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-select v-model="select.type" placeholder="请选择预约场地" clearable>
|
||||
<el-option v-for="item in type_options" :key="item.id" :label="item.value" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small">查询</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<xy-table :list="list" :total="total" :table-item="table_item">
|
||||
<template v-slot:btns>
|
||||
<el-table-column align='center' label="操作" width="180" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="small" @click="checkBook('check',scope.row.id)">审核</el-button>
|
||||
<el-button type="primary" size="small" @click="checkBook('show',scope.row.id)">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
|
||||
<check-book ref="checkBook"></check-book>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import checkBook from './components/checkBook.vue';
|
||||
export default {
|
||||
components: {
|
||||
checkBook
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
name: '',
|
||||
daterange: '',
|
||||
type: ''
|
||||
},
|
||||
type_options: [{
|
||||
id: 0,
|
||||
value: '会议室1'
|
||||
}, {
|
||||
id: 1,
|
||||
value: '会议室2'
|
||||
}],
|
||||
list: [{
|
||||
name: '2024-07-18',
|
||||
daterange: '08:00-09:00',
|
||||
do: '研修班会议',
|
||||
address: '会议室1',
|
||||
no:'',
|
||||
num:3,
|
||||
user:'王同学',
|
||||
status: '待审核'
|
||||
}],
|
||||
total: 0,
|
||||
table_item: [{
|
||||
prop: 'name',
|
||||
label: '预约日期',
|
||||
align: 'left',
|
||||
width:120,
|
||||
}, {
|
||||
prop: 'daterange',
|
||||
label: '预约时段',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
}, {
|
||||
prop: 'do',
|
||||
label: '预约事项',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
}, {
|
||||
prop: 'address',
|
||||
label: '预约场地',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
}, {
|
||||
prop: 'no',
|
||||
label: '车牌',
|
||||
align: 'center',
|
||||
// width: 180,
|
||||
}, {
|
||||
prop: 'num',
|
||||
label: '同行人数',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
},{
|
||||
prop: 'user',
|
||||
label: '预约人',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
} ,{
|
||||
prop: 'status',
|
||||
label: '状态',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
},]
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
checkBook(type, id) {
|
||||
|
||||
this.$refs.checkBook.type = type
|
||||
this.$refs.checkBook.isShow = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.searchwrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
|
||||
span {
|
||||
min-width: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,209 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content">
|
||||
<div class="searchwrap" style="display: flex;align-items: center;">
|
||||
<div>
|
||||
<el-input v-model="select.name" placeholder="请输入名称"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-select v-model="select.position" placeholder="请选择显示位置" clearable>
|
||||
<el-option v-for="item in position_options" :key="item.id" :label="item.value" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="getList">查询</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="editBanner('add')">新增</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<xy-table :list="list" :total="total" :table-item="table_item">
|
||||
<template v-slot:image_id>
|
||||
<el-table-column align='center' label="图片" width="80" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-image style="width: 60px; height: 60px" :src="scope.row.image.url" :preview-src-list="[scope.row.image.url]">
|
||||
</el-image>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<template v-slot:jump_type>
|
||||
<el-table-column align='center' label="跳转类型" width="120" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<div v-for="item in type_options">
|
||||
<div v-if="scope.row.jump_type===item.id">{{item.value}}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<template v-slot:position>
|
||||
<el-table-column align='center' label="显示位置" width="120" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<div v-for="item in position_options">
|
||||
<div v-if="scope.row.position===item.id">{{item.value}}</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
<template v-slot:btns>
|
||||
<el-table-column align='center' label="操作" width="180" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="small" @click="editBanner('editor',scope.row.id)">编辑</el-button>
|
||||
<el-popconfirm style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="确定删除吗?">
|
||||
<el-button type="danger" size="small" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
|
||||
<add-banner ref="addBanner" @refresh="getList"></add-banner>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addBanner from './components/addBanner.vue';
|
||||
import {
|
||||
index,
|
||||
destroy
|
||||
} from "@/api/info/banners.js"
|
||||
export default {
|
||||
components: {
|
||||
addBanner
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
name: '',
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
position: ''
|
||||
},
|
||||
position_options: [{
|
||||
id: 1,
|
||||
value: '首页'
|
||||
}, {
|
||||
id: 2,
|
||||
value: '课程'
|
||||
}, {
|
||||
id: 3,
|
||||
value: '公告'
|
||||
}],
|
||||
type_options: [{
|
||||
id: 1,
|
||||
value: '小程序'
|
||||
}, {
|
||||
id: 2,
|
||||
value: 'h5'
|
||||
}],
|
||||
list: [],
|
||||
total: 0,
|
||||
table_item: [{
|
||||
prop: 'name',
|
||||
label: '名称',
|
||||
align: 'left'
|
||||
}, {
|
||||
prop: 'image_id',
|
||||
label: '图片',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
slot: 'imageshow'
|
||||
}, {
|
||||
prop: 'position',
|
||||
label: '显示位置',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
}, {
|
||||
prop: 'jump_type',
|
||||
label: '跳转类型',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
}, {
|
||||
prop: 'jump_url',
|
||||
label: '跳转链接',
|
||||
align: 'left',
|
||||
width: 180,
|
||||
}, {
|
||||
prop: 'sort',
|
||||
label: '排序',
|
||||
align: 'center',
|
||||
width: 80,
|
||||
}]
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
async getList() {
|
||||
const res = await index({
|
||||
page: this.select.page,
|
||||
page_size: this.select.page_size,
|
||||
filter: [{
|
||||
key: 'name',
|
||||
op: 'like',
|
||||
value: this.select.name
|
||||
}, {
|
||||
key: 'position',
|
||||
op: 'eq',
|
||||
value: this.select.position
|
||||
}],
|
||||
show_relation: ['image']
|
||||
})
|
||||
this.list = res.data
|
||||
this.total = res.total
|
||||
|
||||
},
|
||||
editBanner(type, id) {
|
||||
if (id) {
|
||||
this.$refs.addBanner.id = id
|
||||
}
|
||||
this.$refs.addBanner.setOptions(this.position_options, this.type_options)
|
||||
this.$refs.addBanner.type = type
|
||||
this.$refs.addBanner.isShow = true
|
||||
},
|
||||
deleteList(id) {
|
||||
var that = this;
|
||||
destroy({
|
||||
id: id,
|
||||
}).then(response => {
|
||||
this.$Message.success('删除成功');
|
||||
this.getList()
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
reject(error)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.searchwrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
|
||||
span {
|
||||
min-width: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,139 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content">
|
||||
<div class="searchwrap" style="display: flex;align-items: center;">
|
||||
<div>
|
||||
<el-input v-model="select.name" placeholder="请输入配置名称"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="getList()">查询</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="editInfo('add')">新增</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<xy-table :list="list" :total="total" :table-item="table_item">
|
||||
<template v-slot:btns>
|
||||
<el-table-column align='center' label="操作" width="180" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="small" @click="editInfo('editor',scope.row.id)">编辑</el-button>
|
||||
<el-popconfirm style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="确定删除吗?">
|
||||
<el-button type="danger" size="small" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
|
||||
<add-info ref="addInfo" @refresh="getList()"></add-info>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addInfo from './components/addInfo.vue';
|
||||
import {
|
||||
index,
|
||||
destroy
|
||||
} from "@/api/info/configs.js"
|
||||
export default {
|
||||
components: {
|
||||
addInfo
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
name: '',
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
},
|
||||
|
||||
list: [],
|
||||
total: 0,
|
||||
table_item: [{
|
||||
prop: 'name',
|
||||
label: '配置名称',
|
||||
align: 'center',
|
||||
width: 180
|
||||
}, {
|
||||
prop: 'key',
|
||||
label: '英文标识',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
}, {
|
||||
prop: 'value',
|
||||
label: '配置值',
|
||||
align: 'left',
|
||||
}]
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
async getList() {
|
||||
const res = await index({
|
||||
page: this.select.page,
|
||||
page_size: this.select.page_size,
|
||||
filter: [{
|
||||
key: 'name',
|
||||
op: 'like',
|
||||
value: this.select.name
|
||||
}]
|
||||
})
|
||||
this.list = res.data
|
||||
this.total = res.total
|
||||
|
||||
},
|
||||
editInfo(type, id) {
|
||||
if (id) {
|
||||
this.$refs.addInfo.id = id
|
||||
}
|
||||
this.$refs.addInfo.type = type
|
||||
this.$refs.addInfo.isShow = true
|
||||
},
|
||||
deleteList(id) {
|
||||
var that = this;
|
||||
destroy({
|
||||
id: id
|
||||
}).then(response => {
|
||||
this.$Message.success('删除成功');
|
||||
this.getList()
|
||||
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
reject(error)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.searchwrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
|
||||
span {
|
||||
min-width: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,182 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content">
|
||||
<div class="searchwrap" style="display: flex;align-items: center;">
|
||||
<div>
|
||||
<el-input v-model="select.name" placeholder="请输入姓名"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="getList()">查询</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="editTeacher('add')">新增</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="importTable()">导入</el-button>
|
||||
<el-button type="primary" size="small" @click="exportExcel()">导出</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<xy-table :list="list" :total="total" :table-item="table_item">
|
||||
<template v-slot:btns>
|
||||
<el-table-column align='center' label="操作" width="180" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="small" @click="editTeacher('editor',scope.row.id)">编辑</el-button>
|
||||
<el-popconfirm style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="确定删除吗?">
|
||||
<el-button type="danger" size="small" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
|
||||
<add-teacher ref="addTeacher" @refresh="getList()"></add-teacher>
|
||||
<imports ref="imports" :table-name="'teachers'" @refresh="getList()"></imports>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addTeacher from './components/addTeacher.vue';
|
||||
import {
|
||||
index,
|
||||
destroy
|
||||
} from "@/api/info/teachers.js"
|
||||
import imports from "@/views/component/imports.vue"
|
||||
import * as XLSX from "xlsx";
|
||||
import {
|
||||
saveAs
|
||||
} from "file-saver";
|
||||
export default {
|
||||
components: {
|
||||
addTeacher,
|
||||
imports
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
name: '',
|
||||
page: 1,
|
||||
page_size: 10,
|
||||
},
|
||||
|
||||
list: [],
|
||||
total: 0,
|
||||
table_item: [{
|
||||
prop: 'name',
|
||||
label: '姓名',
|
||||
align: 'center',
|
||||
width: 180
|
||||
}, {
|
||||
prop: 'sex',
|
||||
label: '性别',
|
||||
align: 'center',
|
||||
width: 180,
|
||||
}, {
|
||||
prop: 'introduce',
|
||||
label: '介绍',
|
||||
align: 'left',
|
||||
}]
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
async getList() {
|
||||
const res = await index({
|
||||
page: this.select.page,
|
||||
page_size: this.select.page_size,
|
||||
filter: [{
|
||||
key: 'name',
|
||||
op: 'like',
|
||||
value: this.select.name
|
||||
}]
|
||||
})
|
||||
this.list = res.data
|
||||
this.total = res.total
|
||||
|
||||
},
|
||||
async exportExcel() {
|
||||
let sheetName = `教师${new Date().getTime().toString()}`
|
||||
const res = await index(Object.assign(this.select, {
|
||||
page: 1,
|
||||
page_size: 9999,
|
||||
// is_export:1
|
||||
}))
|
||||
if (res.data) {
|
||||
let headers = this.table_item.map(i => {
|
||||
return {
|
||||
key: i.prop,
|
||||
title: i.label
|
||||
}
|
||||
})
|
||||
const data = res.data.map(row => headers.map(header => row[header.key]));
|
||||
data.unshift(headers.map(header => header.title));
|
||||
const wb = XLSX.utils.book_new();
|
||||
const ws = XLSX.utils.aoa_to_sheet(data);
|
||||
XLSX.utils.book_append_sheet(wb, ws, sheetName);
|
||||
const wbout = XLSX.write(wb, {
|
||||
bookType: 'xlsx',
|
||||
bookSST: true,
|
||||
type: 'array'
|
||||
});
|
||||
saveAs(new Blob([wbout], {
|
||||
type: 'application/octet-stream'
|
||||
}), `${sheetName}.xlsx`);
|
||||
}
|
||||
},
|
||||
editTeacher(type, id) {
|
||||
if (id) {
|
||||
this.$refs.addTeacher.id = id
|
||||
}
|
||||
this.$refs.addTeacher.type = type
|
||||
this.$refs.addTeacher.isShow = true
|
||||
},
|
||||
deleteList(id) {
|
||||
var that = this;
|
||||
destroy({
|
||||
id: id
|
||||
}).then(response => {
|
||||
this.$Message.success('删除成功');
|
||||
this.getList()
|
||||
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
reject(error)
|
||||
})
|
||||
},
|
||||
importTable() {
|
||||
this.$refs.imports.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.searchwrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
|
||||
span {
|
||||
min-width: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@ -0,0 +1,199 @@
|
||||
<template>
|
||||
<div>
|
||||
|
||||
<div>
|
||||
<div ref="lxHeader">
|
||||
<lx-header icon="md-apps" :text="$route.meta.title" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
|
||||
<div slot="content">
|
||||
<div class="searchwrap" style="display: flex;align-items: center;">
|
||||
<div>
|
||||
<el-input v-model="select.biaoti" placeholder="请输入标题"></el-input>
|
||||
</div>
|
||||
<div>
|
||||
<el-select v-model="select.leibie" placeholder="请选择类别" clearable>
|
||||
<el-option v-for="item in leibie_options" :key="item.id" :label="item.value" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="getList">查询</el-button>
|
||||
</div>
|
||||
<div>
|
||||
<el-button type="primary" size="small" @click="editNotice('add')">新增</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</lx-header>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<xy-table :list="list" :total="total" :table-item="table_item">
|
||||
<template v-slot:btns>
|
||||
<el-table-column align='center' label="操作" width="180" header-align="center">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="small" @click="editNotice('editor',scope.row.id)">编辑</el-button>
|
||||
<el-popconfirm style="margin:0 10px" @confirm="deleteList(scope.row.id)" title="确定删除吗?">
|
||||
<el-button type="danger" size="small" slot="reference">删除</el-button>
|
||||
</el-popconfirm>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</template>
|
||||
</xy-table>
|
||||
</div>
|
||||
|
||||
<add-notice ref="addNotice" @refresh="getList"></add-notice>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import addNotice from './components/addNotice.vue';
|
||||
import {
|
||||
index,
|
||||
destroy
|
||||
} from "@/api/system/baseForm.js"
|
||||
export default {
|
||||
components: {
|
||||
addNotice
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
select: {
|
||||
biaoti: '',
|
||||
leibie: '',
|
||||
table_name: 'notices',
|
||||
page: 1,
|
||||
page_size: 10
|
||||
},
|
||||
leibie_options: [{
|
||||
id: 1,
|
||||
value: '公告'
|
||||
}, {
|
||||
id: 2,
|
||||
value: '通知'
|
||||
}],
|
||||
gzh_options:[{
|
||||
id:0,
|
||||
value:'否'
|
||||
},{
|
||||
id:1,
|
||||
value:'是'
|
||||
}],
|
||||
zt_options:[{
|
||||
id:0,
|
||||
value:'待发布'
|
||||
},{
|
||||
id:1,
|
||||
value:'发布'
|
||||
}],
|
||||
list: [],
|
||||
total: 0,
|
||||
table_item: [{
|
||||
prop: 'biaoti',
|
||||
label: '标题',
|
||||
align: 'left'
|
||||
}, {
|
||||
prop: 'leibie',
|
||||
label: '类别',
|
||||
align: 'center',
|
||||
width: 160,
|
||||
customFn: (row) => {
|
||||
return this.leibie_options.map(item=>{
|
||||
if(item.id===row.leibie){
|
||||
return item.value
|
||||
}
|
||||
})
|
||||
}
|
||||
}, {
|
||||
prop: 'shifoutongbugongzhonghao',
|
||||
label: '是否同步公众号',
|
||||
align: 'center',
|
||||
width: 160,
|
||||
customFn: (row) => {
|
||||
return this.gzh_options.map(item=>{
|
||||
if(item.id===row.shifoutongbugongzhonghao){
|
||||
return item.value
|
||||
}
|
||||
})
|
||||
}
|
||||
}, {
|
||||
prop: 'zhuangtai',
|
||||
label: '发布状态',
|
||||
align: 'center',
|
||||
width: 160,
|
||||
customFn: (row) => {
|
||||
return this.zt_options.map(item=>{
|
||||
if(item.id===row.zhuangtai){
|
||||
return item.value
|
||||
}
|
||||
})
|
||||
}
|
||||
}]
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
editNotice(type, id) {
|
||||
if(type=='editor'){
|
||||
this.$refs.addNotice.id = id
|
||||
}
|
||||
this.$refs.addNotice.type = type
|
||||
this.$refs.addNotice.isShow = true
|
||||
},
|
||||
async getList() {
|
||||
const res = await index({
|
||||
page_size: this.select.page_size,
|
||||
page: this.select.page,
|
||||
table_name: this.select.table_name,
|
||||
filter: [{
|
||||
"key": "biaoti",
|
||||
"op": "like",
|
||||
"value": this.select.biaoti
|
||||
},
|
||||
{
|
||||
"key": "leibie",
|
||||
"op": "eq",
|
||||
"value": this.select.leibie
|
||||
}
|
||||
],
|
||||
})
|
||||
this.list = res.data
|
||||
this.total = res.total
|
||||
},
|
||||
deleteList(id) {
|
||||
var that = this;
|
||||
destroy({
|
||||
id: id,
|
||||
table_name: this.select.table_name
|
||||
}).then(response => {
|
||||
this.$Message.success('操作成功');
|
||||
this.getList()
|
||||
}).catch(error => {
|
||||
console.log(error)
|
||||
reject(error)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.searchwrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
&>div {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-right: 10px;
|
||||
|
||||
span {
|
||||
min-width: 70px;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue