master
xy 2 years ago
parent ded40d28b2
commit ba2011469c

@ -0,0 +1,58 @@
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) => {
result += `${key}[${index}][key]=${item.key}&${key}[${index}][op]=${item.op}&${key}[${index}][value]=${item.value}&`;
});
} else {
result += `${key}=${params[key]}&`;
}
}
}
return result.slice(0, -1);
}
export function index(params,isLoading = false) {
return request({
method: "get",
url: "/api/admin/base-form/index",
params,
paramsSerializer: customParamsSerializer,
isLoading
})
}
export function show(params, isLoading = true) {
return request({
method: "get",
url: "/api/admin/base-form/show",
params,
isLoading
})
}
export function save(data) {
return request({
method: "post",
url: "/api/admin/base-form/save",
data
})
}
export function destroy(params) {
return request({
method: "get",
url: "/api/admin/base-form/destroy",
params
})
}
export function imports(data) {
return request({
method: "post",
url: "/api/admin/base-form/import",
data
})
}

@ -1,4 +1,4 @@
import request from "@/utils/request";
import request from "@/utils/request";
export function index(params) {
return request({
@ -31,4 +31,4 @@ export function destroy(params) {
url: '/api/admin/study-question/destroy',
params
})
}
}

@ -100,6 +100,9 @@ export default {
},
okClick(){
this.$emit('on-ok')
},
clearValidate() {
this.$refs['elForm'].clearValidate();
}
},
watch:{

@ -0,0 +1,344 @@
<template>
<div>
<xy-dialog
ref="dialog"
:is-show.sync="isShow"
type="form"
:title="type === 'add' ? '新增点位场馆' : '编辑点位场馆'"
:form="form"
:rules="rules"
@submit="submit"
>
<template v-slot:name>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>
名称
</div>
<div class="xy-table-item-content">
<el-input
v-model="form.name"
clearable
placeholder="请输入名称"
style="width: 300px"
></el-input>
</div>
</div>
</template>
<template v-slot:image_id>
<div class="xy-table-item">
<div class="xy-table-item-label">封面图 </div>
<div class="xy-table-item-content">
<el-upload
style="width: 300px"
class="upload-demo"
:action="action"
:on-success="
(response, file, fileList) =>
successHandle(response, file, fileList, 'image_id')
"
:before-upload="uploadBefore"
:file-list="image_id"
:on-remove="
(file, fileList) => removeHande(file, fileList, 'image_id')
"
list-type="picture-card"
>
<i slot="default" class="el-icon-plus"></i>
<div slot="tip" class="el-upload__tip">
只能上传jpg/png文件且不超过500kb
</div>
</el-upload>
</div>
</div>
</template>
<template v-slot:lat>
<div class="xy-table-item">
<div class="xy-table-item-label">纬度 </div>
<div class="xy-table-item-content">
<el-input-number
v-model="form.lat"
clearable
placeholder="请输入纬度"
style="width: 300px"
:controls="false"
></el-input-number>
</div>
</div>
</template>
<template v-slot:lng>
<div class="xy-table-item">
<div class="xy-table-item-label">经度 </div>
<div class="xy-table-item-content">
<el-input-number
v-model="form.lng"
clearable
placeholder="请输入经度"
style="width: 300px"
:controls="false"
></el-input-number>
</div>
</div>
</template>
<template v-slot:x>
<div class="xy-table-item">
<div class="xy-table-item-label">x轴位置 </div>
<div class="xy-table-item-content xy-table-item-price-per">
<el-input-number
v-model="form.x"
clearable
:precision="2"
placeholder="请输入x轴位置"
style="width: 300px"
:controls="false"
></el-input-number>
</div>
</div>
</template>
<template v-slot:y>
<div class="xy-table-item">
<div class="xy-table-item-label">y轴位置 </div>
<div class="xy-table-item-content xy-table-item-price-per">
<el-input-number
v-model="form.y"
:precision="2"
clearable
placeholder="请输入y轴位置"
style="width: 300px"
:controls="false"
></el-input-number>
</div>
</div>
</template>
<template v-slot:video_id>
<div class="xy-table-item">
<div class="xy-table-item-label">视频 </div>
<div class="xy-table-item-content">
<el-upload
style="width: 300px"
ref="upload"
multiple
:on-success="
(response, file, fileList) =>
successHandle(response, file, fileList, 'video_id')
"
:before-upload="uploadBefore"
accept=".rar,.zip,.doc,.docx,.pdf,.jpg,.png,.gif,.mp4,.xls,.xlsx"
:action="action"
:file-list="video_id"
:auto-upload="false"
:on-remove="
(file, fileList) => removeHande(file, fileList, 'video_id')
"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件</el-button
>
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="$refs['upload'].submit()"
>开始上传</el-button
>
<div slot="tip" class="el-upload__tip">
支持文件格式.rar .zip .doc .docx .pdf .jpg .png .gif .mp4 .xls
.xlsx
<br />单个文件不能超过20M
</div>
</el-upload>
</div>
</div>
</template>
<template v-slot:content>
<div class="xy-table-item">
<div class="xy-table-item-label">内容 </div>
<div class="xy-table-item-content">
<el-input
type="textarea"
:autosize="{ minRows: 2 }"
v-model="form.content"
clearable
placeholder="请输入内容"
style="width: 300px"
></el-input>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import { show, save } from "@/api/index";
export default {
props: {},
data() {
return {
isShow: false,
id: "",
type: "",
image_id: [],
action: process.env.VUE_APP_UPLOAD_API,
video_id: [],
form: {
activity_list_id: 7,
name: "",
image_id: "",
lat: "",
lng: "",
x: "",
y: "",
video_id: "",
content: "",
},
rules: {
name: [
{
required: true,
message: "请填写名称",
},
],
},
};
},
methods: {
show() {
this.isShow = true;
},
hidden() {
this.isShow = false;
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["dialog"].clearValidate();
},
setId(id) {
if (typeof id == "number") {
this.id = id;
} else {
console.error("error typeof id: " + typeof id);
}
},
getId() {
return this.id;
},
setType(type = "add") {
let types = ["add", "editor"];
if (types.includes(type)) {
this.type = type;
} else {
console.warn("Unknown type: " + type);
}
},
setForm(key = [], value = []) {
if (key instanceof Array) {
key.forEach((key, index) => {
this.form[key] = value[index] ?? "";
});
}
if (typeof key === "string") {
this.form[key] = value;
}
if (!key) {
this.init();
}
},
//
successHandle(response, file, fileList, key) {
this[key] = fileList;
},
removeHande(file, fileList, key) {
this[key] = fileList;
},
uploadBefore(file) {
console.log(file);
if (file.size / 1000 > 20 * 1024) {
this.$message({
type: "warning",
message: "上传图片大小超过20MB",
});
return false;
}
},
async getDetail() {
const res = await show({ id: this.id, table_name: "map_points" });
this.$integrateData(this.form, res);
},
submit() {
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
}
if (this.type === "editor") {
Object.defineProperty(this.form, "id", {
value: this.id,
enumerable: true,
configurable: true,
writable: true,
});
}
this.form.image_id = this.image_id[0]?.response?.id
save(Object.assign(this.form, { table_name: "map_points" })).then(
(res) => {
this.$message({
type: "success",
message:
this.type === "add" ? "新增点位场馆" : "编辑点位场馆" + "成功",
});
this.isShow = false;
this.$emit("refresh");
}
);
},
},
watch: {
isShow(val) {
if (val) {
if (this.type === "editor") {
this.getDetail();
}
} else {
this.id = "";
this.type = "";
this.init();
this.$refs["dialog"].clearValidate();
delete this.form.id;
}
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-input__inner {
text-align: left;
}
.xy-table-item-price-per {
position: relative;
&::after {
position: absolute;
right: 10px;
top: 0;
content: "%";
}
::v-deep .el-input__clear {
position: relative;
right: 46px;
z-index: 2;
}
}
</style>

@ -0,0 +1,216 @@
<template>
<div>
<xy-dialog
ref="dialog"
:is-show.sync="isShow"
type="form"
:title="type === 'add' ? '新增题目' : '编辑题目'"
:form="form"
:rules="rules"
@submit="submit"
>
<template v-slot:title>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red; font-weight: 600; padding-right: 4px"
>*</span
>
题目
</div>
<div class="xy-table-item-content">
<el-input
v-model="form.title"
clearable
placeholder="请输入题目"
style="width: 300px"
></el-input>
</div>
</div>
</template>
<template #option_list>
<div class="xy-table-item">
<div class="xy-table-item-label">
选项
</div>
<div class="xy-table-item-content">
<el-button @click="addOptions"></el-button>
<div style="width: 300px;margin-bottom: 10px;" v-for="item in form.option_list" :key="item.myindex">
<div style="font-weight: 600">选项{{ indexFormat(item.myindex) }}</div>
<el-input style="flex: 2;" v-model="item.title" placeholder="选项"></el-input>
<div style="margin-top: 6px;display: flex;justify-content: space-between;align-items: center;">
<el-switch v-model="item.is_correct" active-text="正确" inactive-text="错误" :active-value="1" :inactive-value="0"></el-switch>
<el-input-number class="myindex-tip" placeholder="排序" style="width: 140px;" :min="0" :max="26" controls-position="right" v-model="item.myindex" :precision="0"></el-input-number>
</div>
</div>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import { show, save } from "@/api/party/studyQuestion";
export default {
props: {},
data() {
return {
isShow: false,
id: "",
type: "",
form: {
activity_list_id: 7,
title: "",
option_list: [],
},
rules: {
title: [
{
required: true,
message: "请填写题目",
},
],
},
};
},
methods: {
show() {
this.isShow = true;
},
hidden() {
this.isShow = false;
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["dialog"].clearValidate();
},
setId(id) {
if (typeof id == "number") {
this.id = id;
} else {
console.error("error typeof id: " + typeof id);
}
},
getId() {
return this.id;
},
setType(type = "add") {
let types = ["add", "editor"];
if (types.includes(type)) {
this.type = type;
} else {
console.warn("Unknown type: " + type);
}
},
setForm(key = [], value = []) {
if (key instanceof Array) {
key.forEach((key, index) => {
this.form[key] = value[index] ?? "";
});
}
if (typeof key === "string") {
this.form[key] = value;
}
if (!key) {
this.init();
}
},
async getDetail() {
const res = await show({ id: this.id });
this.$integrateData(this.form, res);
},
submit() {
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
}
if (this.type === "editor") {
Object.defineProperty(this.form, "id", {
value: this.id,
enumerable: true,
configurable: true,
writable: true,
});
}
save(this.form).then((res) => {
this.$message({
type: "success",
message: this.type === "add" ? "新增题目" : "编辑题目" + "成功",
});
this.isShow = false;
this.$emit("refresh");
});
},
addOptions () {
this.form.option_list.push({
title: '',
is_correct: 0,
myindex: this.form.option_list.length + 1,
});
}
},
computed: {
indexFormat () {
return function (myindex) {
if (myindex < 1 || myindex > 26) {
throw new Error("Invalid number");
}
return String.fromCharCode(myindex + 64);
}
}
},
watch: {
isShow(val) {
if (val) {
if (this.type === "editor") {
this.getDetail();
}
} else {
this.id = "";
this.type = "";
this.init();
this.$refs["dialog"].clearValidate();
delete this.form.id;
}
},
},
};
</script>
<style scoped lang="scss">
::v-deep .el-input__inner {
text-align: left;
}
.myindex-tip {
position: relative;
&::after {
text-align: end;
color: red;
font-size: 12px;
line-height: 20px;
zoom: .9;
content: '选项排序例1为选项A';
transform: translateY(100%);
position: absolute;
right: 0;
bottom: 0;
}
}
</style>

@ -0,0 +1,242 @@
<template>
<div>
<xy-dialog ref="dialog"
:is-show.sync="isShow"
type="form"
:title="type === 'add' ? '新增vr看展' : '编辑vr看展'"
:form="form"
:rules="rules"
@submit="submit">
<template v-slot:name>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>
名称
</div>
<div class="xy-table-item-content">
<el-input v-model="form.name"
clearable
placeholder="请输入名称"
style="width: 300px;"
></el-input>
</div>
</div>
</template>
<template v-slot:image_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
封面图
</div>
<div class="xy-table-item-content">
<el-upload
style="width: 300px;"
class="upload-demo"
:action="action"
:limit="1"
:on-success="(response, file, fileList) => successHandle(response, file, fileList, 'image_id')"
:before-upload="uploadBefore"
:file-list="image_id"
:on-remove="(file, fileList) => removeHande(file, fileList, 'image_id')"
list-type="picture-card">
<i slot="default" class="el-icon-plus"></i>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div>
</el-upload>
</div>
</div>
</template>
<template v-slot:video_id>
<div class="xy-table-item">
<div class="xy-table-item-label">
视频
</div>
<div class="xy-table-item-content">
<el-upload
style="width: 300px"
ref="upload"
multiple
:on-success="(response, file, fileList) => successHandle(response, file, fileList, 'video_id')"
:before-upload="uploadBefore"
accept=".rar,.zip,.doc,.docx,.pdf,.jpg,.png,.gif,.mp4,.xls,.xlsx"
:action="action"
:file-list="video_id"
:auto-upload="false"
:on-remove="(file, fileList) => removeHande(file, fileList, 'video_id')"
>
<el-button slot="trigger" size="small" type="primary"
>选取文件</el-button
>
<el-button
style="margin-left: 10px"
size="small"
type="success"
@click="$refs['upload'].submit()"
>开始上传</el-button
>
<div slot="tip" class="el-upload__tip">
支持文件格式.rar .zip .doc .docx .pdf .jpg .png .gif .mp4 .xls
.xlsx
<br />单个文件不能超过20M
</div>
</el-upload>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import {
show,
save
} from '@/api/index';
export default {
props:{
},
data() {
return {
isShow: false,
id: '',
type: '',
action: process.env.VUE_APP_UPLOAD_API,
image_id: [],
video_id: [],
form: {
activity_list_id: 7,
name: "",
image_id: "",
map_point_id: "",
video_id: "",
},
rules: {
name: [{
required: true,
message: "请填写名称"
}],
}
}
},
methods: {
show(){
this.isShow = true;
},
hidden(){
this.isShow = false;
},
init(){
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["dialog"].clearValidate();
},
setId(id) {
if(typeof id == "number") {
this.id = id;
}else {
console.error("error typeof id: " + typeof id)
}
},
getId() {
return this.id;
},
setType(type = 'add') {
let types = ['add','editor']
if(types.includes(type)) {
this.type = type;
}else{
console.warn("Unknown type: " + type)
}
},
setForm(key = [], value = []) {
if(key instanceof Array) {
key.forEach((key,index) => {
this.form[key] = value[index] ?? "";
})
}
if(typeof key === "string"){
this.form[key] = value
}
if(!key){
this.init()
}
},
//
uploadBefore(file) {
console.log(file);
if (file.size / 1000 > 20 * 1024) {
this.$message({
type: "warning",
message: "上传图片大小超过20MB",
});
return false;
}
},
successHandle(response, file, fileList, key) {
this[key] = fileList;
},
removeHande(file, fileList, key) {
this[key] = fileList;
},
async getDetail() {
const res = await show({ id:this.id, table_name: 'map_point_contents' })
this.$integrateData(this.form, res)
},
submit() {
if(this.type === 'add'){
if(this.form.hasOwnProperty('id')){
delete this.form.id
}
}
if (this.type === 'editor') {
Object.defineProperty(this.form, 'id', {
value: this.id,
enumerable: true,
configurable: true,
writable: true
})
}
this.form.image_id = this.image_id[0]?.response?.id
save(Object.assign(this.form,{table_name: 'map_point_contents'})).then(res => {
this.$message({
type: 'success',
message: this.type === 'add' ? '新增vr看展' : '编辑vr看展' + '成功'
});
this.isShow = false
this.$emit('refresh')
})
}
},
watch: {
isShow(val) {
if (val) {
if (this.type === 'editor') {
this.getDetail()
}
} else {
this.id = ''
this.type = ''
this.init();
this.$refs['dialog'].clearValidate();
delete this.form.id
}
},
}
}
</script>
<style scoped lang="scss">
::v-deep .el-input__inner {
text-align: left;
}
</style>

@ -0,0 +1,125 @@
<template>
<div>
<Drawer width="46" title="vr看展" :closable="false" v-model="drawer">
<Button
@click="
$refs['addVr'].setForm(
['map_point_id', 'activity_list_id'],
[select.filter[0].value, 7]
),
$refs['addVr'].setType('add'),
$refs['addVr'].show()
"
>新增</Button
>
<xy-table
style="margin-top: 20px"
:list="list"
:table-item="talbe"
:is-page="false"
@delete="row => destroy({
table_name: 'map_point_contents',
id: row.id,
activity_list_id: 7
}).then(_ => getList())"
@editor="
(row) => {
$refs['addVr'].setForm(
['map_point_id', 'activity_list_id'],
[select.filter[0].value, 7]
);
$refs['addVr'].setId(row.id);
$refs['addVr'].setType('editor');
$refs['addVr'].show();
}
"
>
</xy-table>
</Drawer>
<add-vr ref="addVr" @refresh="getList"></add-vr>
</div>
</template>
<script>
import { index, destroy } from "@/api/index";
import addVr from "./addVr.vue";
export default {
components: {
addVr,
},
data() {
return {
drawer: false,
select: {
page: 1,
page_size: 999,
activity_list_id: 7,
table_name: "map_point_contents",
filter: [
{
key: "map_point_id",
value: 7,
op: "eq",
},
],
},
list: [],
talbe: [
{
prop: "name",
label: "题目",
minWidth: 220,
align: "left",
},
{
prop: "created_at",
label: "创建信息",
width: 190,
formatter: (v1, v2, value) => {
return this.$moment(value).format("YYYY-MM-DD HH:mm:ss");
},
},
{
prop: "updated_at",
label: "更新时间",
align: "left",
width: 190,
formatter: (v1, v2, value) => {
return this.$moment(value).format("YYYY-MM-DD HH:mm:ss");
},
},
],
};
},
methods: {
destroy,
show() {
this.drawer = true;
},
hidden() {
this.drawer = false;
},
setMapPointId(value) {
this.select.filter[0].value = value;
},
async getList() {
const res = await index(this.select);
this.list = res.data;
},
},
computed: {},
watch: {
drawer(newVal) {
if (newVal) {
this.getList();
}
},
},
};
</script>
<style scoped lang="scss"></style>

@ -0,0 +1,205 @@
<template>
<div>
<lx-header
icon="md-apps"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
text="场馆点位管理"
>
<div slot="content"></div>
<slot>
<div class="selects">
<div>
<span style="padding: 0 6px; word-break: keep-all"> 关键字 </span>
<Input
v-model="select.keyword"
placeholder="请输入关键字"
style="width: 180px"
></Input>
</div>
<Button
style="margin-left: 10px"
type="primary"
@click="select = { page: 1, keyword: '' }"
>重置
</Button>
<Button style="margin-left: 10px" type="primary" @click="doSearch"
>查询</Button
>
<Button
style="margin-left: 10px"
type="primary"
@click="
$refs['addPointer'].setForm(['activity_list_id'],[7]),$refs['addPointer'].setType('add'), $refs['addPointer'].show()
"
>新增</Button
>
</div>
</slot>
</lx-header>
<xy-table
:list="list"
:total="total"
:table-item="table"
>
<template v-slot:btns>
<template v-if="type == 0"> </template>
<template v-else>
<el-table-column label="操作" width="200" fixed="right">
<template #default="{ row }">
<Poptip confirm transfer title="确认删除?" @on-ok="deleteitem(row)">
<Button size="small" type="error">删除</Button>
</Poptip>
<Button
size="small"
type="primary"
style="margin-left: 4px"
@click="
$refs['addPointer'].setForm(['activity_list_id'],[7]);
$refs['addPointer'].setId(row.id);
$refs['addPointer'].setType('editor');
$refs['addPointer'].show();
"
>编辑</Button
>
<Button size="small" type="primary" style="margin-left: 4px" @click="
$refs['vr'].setMapPointId(row.id);
$refs['vr'].show();
"
>vr看展</Button
>
</template>
</el-table-column>
</template>
</template>
</xy-table>
<addPointer ref="addPointer" @refresh="load"></addPointer>
<vr ref="vr"></vr>
</div>
</template>
<script>
import { index, destroy, show } from "@/api/index";
import vr from './components/vr.vue';
import addPointer from "@/views/PartyshistoryRecoder/components/addPointer.vue";
export default {
components: {
addPointer,
vr
},
data() {
return {
select: {
page: 1,
page_size: 10,
table_name: "map_points",
activity_list_id: 7,
filter: [],
},
listActivity: [],
total: 0,
list: [],
table: [
{
prop: "name",
label: "名称",
minWidth: 220,
align: "left",
},
{
prop: "lng,lat",
label: "经度,纬度",
width: 160,
customFn: (row) => {
return (
<span>
{row.lng} {row.lat}
</span>
);
},
},
{
prop: "x,y",
label: "x轴y轴",
width: 160,
customFn: (row) => {
return (
<span>
{row.x} {row.y}
</span>
);
},
},
{
prop: "created_at",
label: "创建信息",
width: 190,
formatter: (v1, v2, value) => {
return this.$moment(value).format("YYYY-MM-DD HH:mm:ss");
},
},
{
prop: "updated_at",
label: "更新时间",
align: "left",
width: 190,
formatter: (v1, v2, value) => {
return this.$moment(value).format("YYYY-MM-DD HH:mm:ss");
},
},
],
};
},
methods: {
doSearch() {
this.select.page = 1;
this.load();
},
pageSizeChange(e) {
this.select.page_size = e;
this.select.page = 1;
this.load();
},
async load() {
const res = await index(this.select);
this.total = res.total;
this.list = res.data;
},
deleteitem(row) {
destroy({
id: row.id,
activity_list_id: 7,
table_name: 'map_points'
}).then((res) => {
this.load();
this.$Message.success("操作成功");
});
},
pageChange(e) {
this.select.page = e;
this.load();
},
},
mounted() {
this.load();
},
created() {
let type = parseInt(this.$route.path.split("_")[1] || 0);
this.type = this.select.is_auth = type;
},
};
</script>
<style lang="scss" scoped>
.selects {
display: flex;
flex-wrap: wrap;
& > div {
margin-bottom: 6px;
}
}
</style>

@ -0,0 +1,162 @@
<template>
<div>
<lx-header
icon="md-apps"
style="margin-bottom: 10px; border: 0px; margin-top: 15px"
text="题库管理"
>
<div slot="content"></div>
<slot>
<div class="selects">
<div>
<span style="padding: 0 6px; word-break: keep-all"> 关键字 </span>
<Input
v-model="select.keyword"
placeholder="请输入关键字"
style="width: 180px"
></Input>
</div>
<Button
style="margin-left: 10px"
type="primary"
@click="select = { page: 1, keyword: '' }"
>重置
</Button>
<Button style="margin-left: 10px" type="primary" @click="doSearch"
>查询</Button
>
<Button
style="margin-left: 10px"
type="primary"
@click="$refs['addQuestions'].show()"
>新增</Button
>
</div>
</slot>
</lx-header>
<xy-table
:list="list"
:total="total"
:table-item="table"
@delete="deleteitem"
@editor="
(row) => {
$refs['addQuestions'].setId(row.id);
$refs['addQuestions'].setType('editor')
$refs['addQuestions'].show();
}
"
>
<template v-slot:btns v-if="type == 0"> </template>
</xy-table>
<addQuestions ref="addQuestions" @refresh="load"></addQuestions>
</div>
</template>
<script>
import { index, destroy, show } from "@/api/party/studyQuestion";
import { index as activityIndex } from "@/api/activity/index";
import addQuestions from "@/views/PartyshistoryRecoder/components/addQuestions.vue";
export default {
components: {
addQuestions,
},
data() {
return {
select: {
page: 1,
page_size: 20,
keyword: "",
activity_list_id: 7,
},
listActivity: [],
total: 0,
list: [],
table: [
{
prop: "title",
label: "题目",
minWidth: 220,
align: "left",
},
{
prop: "created_at",
label: "创建信息",
width: 190,
formatter: (v1, v2, value) => {
return this.$moment(value).format("YYYY-MM-DD HH:mm:ss");
},
},
{
prop: "updated_at",
label: "更新时间",
align: "left",
width: 190,
formatter: (v1, v2, value) => {
return this.$moment(value).format("YYYY-MM-DD HH:mm:ss");
},
},
],
};
},
methods: {
async loadActivity() {
const res = await activityIndex({
page: 1,
page_size: 999,
});
this.listActivity = res.data;
},
doSearch() {
this.select.page = 1;
this.load();
},
pageSizeChange(e) {
this.select.page_size = e;
this.select.page = 1;
this.load();
},
async load() {
const res = await index(this.select);
this.total = res.total;
this.list = res.data;
},
deleteitem(row) {
destroy({
id: row.id,
}).then((res) => {
this.load();
this.$Message.success("操作成功");
});
},
pageChange(e) {
this.select.page = e;
this.load();
},
},
mounted() {
this.load();
this.loadActivity();
},
created() {
let type = parseInt(this.$route.path.split("_")[1] || 0);
this.type = this.select.is_auth = type;
},
};
</script>
<style lang="scss" scoped>
.selects {
display: flex;
flex-wrap: wrap;
& > div {
margin-bottom: 6px;
}
}
</style>
Loading…
Cancel
Save