1523 lines
82 KiB
HTML
1523 lines
82 KiB
HTML
<!--#
|
|
layout("/layouts/platform.html"){
|
|
#-->
|
|
<style>
|
|
.avatar-uploader .el-upload {
|
|
border: 1px dashed #d9d9d9;
|
|
border-radius: 6px;
|
|
cursor: pointer;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.avatar-uploader .el-upload:hover {
|
|
border-color: #409EFF;
|
|
}
|
|
|
|
.avatar-uploader-icon {
|
|
font-size: 28px;
|
|
color: #8c939d;
|
|
width: 100px;
|
|
height: 100px;
|
|
line-height: 100px;
|
|
text-align: center;
|
|
}
|
|
|
|
.avatar {
|
|
width: 100px;
|
|
height: 100px;
|
|
display: block;
|
|
}
|
|
|
|
.avatar-delete {
|
|
font-size: 20px;
|
|
color: red;
|
|
}
|
|
|
|
#qsmEditor .w-e-text-container {
|
|
height: 200px !important;
|
|
}
|
|
|
|
#qsmEditor div {
|
|
z-index: 0 !important;
|
|
}
|
|
|
|
.btDiv {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.btDiv:hover {
|
|
background-color: rgb(240, 240, 240);
|
|
}
|
|
|
|
.shou {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.issue {
|
|
cursor: pointer;
|
|
padding: 20px 0;
|
|
}
|
|
|
|
.issue:hover {
|
|
background-color: rgb(240, 240, 240);
|
|
}
|
|
|
|
.el-divider {
|
|
background-color: #409EFF;
|
|
}
|
|
|
|
.el-divider__text {
|
|
color: #409EFF;
|
|
}
|
|
|
|
.inputParent input {
|
|
border: none;
|
|
border-bottom: 1px solid rgb(220, 223, 230);
|
|
border-radius: 0;
|
|
}
|
|
|
|
.issueList > .el-table__header-wrapper {
|
|
display: none;
|
|
}
|
|
|
|
.issueList .el-table__expanded-cell {
|
|
background-color: rgb(250, 250, 250) !important;
|
|
}
|
|
|
|
.el-upload--picture-card {
|
|
width: 100px;
|
|
height: 100px;
|
|
line-height: 100px;
|
|
}
|
|
|
|
.avatar-uploader .el-upload-list__item-actions {
|
|
position: absolute;
|
|
width: 100%;
|
|
height: 100%;
|
|
left: 0;
|
|
top: 0;
|
|
cursor: default;
|
|
text-align: center;
|
|
color: #fff;
|
|
opacity: 0;
|
|
font-size: 20px;
|
|
background-color: rgba(0, 0, 0, .5);
|
|
transition: opacity .3s;
|
|
}
|
|
|
|
.avatar-uploader .el-upload-list__item-actions:hover {
|
|
opacity: 1;
|
|
}
|
|
|
|
.avatar-uploader .el-upload-list__item-actions span {
|
|
cursor: pointer;
|
|
}
|
|
|
|
.avatar-uploader .el-upload-list__item-actions .el-upload-list__item-delete {
|
|
position: static;
|
|
font-size: inherit;
|
|
color: inherit;
|
|
display: inline-block;
|
|
}
|
|
|
|
.avatar-uploader .el-upload-list__item-actions .el-upload-list__item-delete i {
|
|
color: inherit;
|
|
}
|
|
</style>
|
|
|
|
<div id="app" v-cloak>
|
|
<guava ref="guava">
|
|
<template>
|
|
<el-card shadow="never">
|
|
<div class="btn-group tool-button">
|
|
<el-date-picker
|
|
:clearable="false"
|
|
placeholder="选择年"
|
|
type="year"
|
|
v-model="pageForm.year"
|
|
value-format="yyyy">
|
|
</el-date-picker>
|
|
</div>
|
|
<div class="btn-group tool-button">
|
|
<el-input placeholder="请输入内容" v-model="pageForm.qtitle">
|
|
<template slot="prepend">标题</template>
|
|
</el-input>
|
|
</div>
|
|
<div class="btn-group tool-button">
|
|
<el-button @click="doSearch" icon="el-icon-search"></el-button>
|
|
</div>
|
|
<div class="pull-right offscreen-right">
|
|
<el-button @click="openAdd" size="medium" type="primary"><i class="ti-plus"></i> 新建问卷调查
|
|
</el-button>
|
|
</div>
|
|
</el-card>
|
|
<el-card class="mt20" shadow="never">
|
|
<el-table :data="tableData" align="center" header-align="center" size="medium" style="width: 100%">
|
|
<el-table-column
|
|
align="center" header-align="center" label="序号" type="index">
|
|
<template scope="scope">
|
|
<span>{{scope.$index+(pageForm.pageNumber - 1) * pageForm.pageSize + 1}} </span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="标题"
|
|
prop="qtitle">
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="说明"
|
|
prop="qsm"
|
|
show-overflow-tooltip="true">
|
|
<template scope="scope">
|
|
<div v-html="scope.row.qsm" v-if="!isNull(scope.row.qsm)">{{scope.row.qsm}}</div>
|
|
<span v-else>暂无</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="创建人"
|
|
prop="username">
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="创建时间"
|
|
prop="qctime">
|
|
</el-table-column>
|
|
<el-table-column align="center" label="类型" prop="qlx">
|
|
<template scope="{row}">
|
|
<span v-if="row.qlx===1">调查</span>
|
|
<span v-if="row.qlx===2">答题</span>
|
|
<span v-if="row.qlx===3">购物调查</span>
|
|
<span v-if="row.qlx===4">意向选择</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="状态"
|
|
prop="qflag">
|
|
<template scope="scope">
|
|
<span style="color: #E6A23C" v-if="scope.row.qflag==1">未开启</span>
|
|
<span style="color: #67C23A" v-if="scope.row.qflag==2">已开启</span>
|
|
<span style="color: #F56C6C" v-if="scope.row.qflag==3">已关闭</span>
|
|
</template>
|
|
</el-table-column>
|
|
<!-- <el-table-column align="center" label="问卷调查二维码">-->
|
|
<!-- <template slot-scope="scope">-->
|
|
<!-- <el-button size="small" plain type="primary" @click="saveCode(scope.row.qid)">保存二维码-->
|
|
<!-- </el-button>-->
|
|
<!-- </template>-->
|
|
<!-- </el-table-column>-->
|
|
<el-table-column align="center" header-align="center" label="操作" width="360px">
|
|
<template scope="scope">
|
|
|
|
<el-button @click="sendMsg(scope.row)" size="small" type="primary">通知</el-button>
|
|
|
|
<el-button @click="openView(scope.row.qid)" size="small" type="primary">查看</el-button>
|
|
<el-button @click="upZt(scope.row.qid,2)" size="small" type="primary"
|
|
type="success" v-if="scope.row.qflag==1||scope.row.qflag==3">开启
|
|
</el-button>
|
|
<el-button @click="upZt(scope.row.qid,3)" size="small" type="primary"
|
|
type="danger" v-if="scope.row.qflag==2">关闭
|
|
</el-button>
|
|
<!-- v-if="scope.row.qflag==1||scope.row.qflag==3"-->
|
|
<el-button @click="openEdit(scope.row.qid)" size="small" type="primary"
|
|
type="primary">编辑
|
|
</el-button>
|
|
<el-button @click="doDelete(scope.row.qid)" size="small"
|
|
type="danger" v-if="scope.row.qflag==1||scope.row.qflag==3">删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<el-row class="el-pagination-container">
|
|
<el-pagination
|
|
:current-page="pageForm.pageNumber"
|
|
:page-size="pageForm.pageSize"
|
|
:page-sizes="[10, 20, 30, 50]"
|
|
:total="pageForm.totalCount"
|
|
@current-change="pageNumberChange"
|
|
@size-change="pageSizeChange"
|
|
layout="total, sizes, prev, pager, next, jumper">
|
|
</el-pagination>
|
|
</el-row>
|
|
</el-card>
|
|
</template>
|
|
<!-- <template #edit_func>-->
|
|
<!-- <el-button @click="operation" plain size="medium" type="primary">确定</el-button>-->
|
|
<!-- </template>-->
|
|
<template #edit>
|
|
<div>
|
|
<el-form :model="formData" :rules="formRules" label-position="right" label-width="120px" ref="addform">
|
|
<vi-title2 title="基础设置"></vi-title2>
|
|
|
|
<el-form-item label="问卷类型" prop="qlx">
|
|
<el-radio-group @change="questionTypeChange" v-model="formData.qlx" size="small">
|
|
<el-radio :label="1" border>投票调查</el-radio>
|
|
<el-radio :label="2" border>答题</el-radio>
|
|
<el-radio :label="3" border>购物调查</el-radio>
|
|
<el-radio :label="4" border>意向选择</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
|
|
<el-form-item class="is-required" label="标题" prop="qtitle">
|
|
<el-input placeholder="请填写标题" v-model="formData.qtitle"></el-input>
|
|
</el-form-item>
|
|
|
|
<el-row v-show="![1,3,4].includes(formData.qlx)" :gutter="20">
|
|
<el-col :span="12">
|
|
<el-form-item class="is-required" label="每日可答次数" label-width="120px" prop="qrkdcs">
|
|
<el-input-number :max="100" :min="0"
|
|
controls-position="right"
|
|
placeholder="设0则不限制次数"
|
|
style="width: 100%" v-model="formData.qrkdcs"></el-input-number>
|
|
<div class="text-primary">设0则不限制次数</div>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="每日答题时间" prop="qdtkssj">
|
|
<el-time-picker
|
|
end-placeholder="结束时间"
|
|
is-range
|
|
placeholder="选择时间范围"
|
|
range-separator="-"
|
|
start-placeholder="开始时间"
|
|
style="width: 100%"
|
|
v-model="formData.qdtsj"
|
|
value-format="HH:mm:ss">
|
|
</el-time-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="12">
|
|
<el-form-item label="开始时间" prop="startTime">
|
|
<el-date-picker
|
|
style="width: 100%"
|
|
type="datetime"
|
|
v-model="formData.startTime"
|
|
value-format="timestamp">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item label="结束时间" prop="endTime">
|
|
<el-date-picker
|
|
:picker-options="endTimeOptions"
|
|
style="width: 100%"
|
|
type="datetime"
|
|
v-model="formData.endTime"
|
|
value-format="timestamp">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8" v-show="formData.qlx===4">
|
|
<el-form-item label="自动选择默认项" label-width="150px" prop="autoSelect">
|
|
<el-switch
|
|
v-model="formData.autoSelect"
|
|
>
|
|
</el-switch>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-form-item label="说明" prop="qsm">
|
|
<div id="qsmEditor"></div>
|
|
</el-form-item>
|
|
|
|
<el-form-item label="参加人员" prop="activityUserScopeId">
|
|
<div style="display: flex; column-gap: 10px">
|
|
<el-select clearable v-model="formData.activityUserScopeId">
|
|
<el-option :key="item.groupId"
|
|
:label="item.groupName"
|
|
:value="item.groupId"
|
|
v-for="item in activityUserScopeList"></el-option>
|
|
</el-select>
|
|
<el-button @click="openUserScope" type="primary">设置</el-button>
|
|
</div>
|
|
</el-form-item>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="6">
|
|
<el-form-item label="出题模式" prop="ctMode">
|
|
<el-radio-group v-model="formData.ctMode" size="small">
|
|
<el-radio :label="1" border>定时定题</el-radio>
|
|
<el-radio :label="2" border>随机题目</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="单次出题数量" prop="ctNum">
|
|
<el-input-number :max="formData.issues.length" :min="1"
|
|
controls-position="right"
|
|
style="width: 100%"
|
|
v-model="formData.ctNum"></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<el-row :gutter="20">
|
|
<el-col :span="6">
|
|
<el-form-item label="是否抽奖" prop="isRaffle">
|
|
<el-radio-group v-model="formData.isRaffle" size="small">
|
|
<el-radio :label="true" border>是</el-radio>
|
|
<el-radio :label="false" border>否</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6" v-if="formData.isRaffle">
|
|
<el-form-item label="抽奖分数" prop="raffleScore">
|
|
<el-input-number :min="1"
|
|
controls-position="right"
|
|
style="width: 100%"
|
|
v-model="formData.raffleScore"></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6" v-if="formData.isRaffle">
|
|
<el-form-item label="获奖人数" prop="raffleWinnerUserNum">
|
|
<el-input-number :max="10000" :min="1"
|
|
controls-position="right"
|
|
style="width: 100%"
|
|
v-model="formData.raffleWinnerUserNum"></el-input-number>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
<div class="btDiv" style="margin-bottom: 10px" title="编辑问卷标题与问卷说明">
|
|
<el-row style="text-align: center">
|
|
<h2>{{formData.qtitle}}</h2>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="21" offset="1">
|
|
<div v-html="formData.qsm" v-if="!isNull(formData.qsm)">{{formData.qsm}}
|
|
</div>
|
|
</el-col>
|
|
</el-row>
|
|
</div>
|
|
|
|
<vi-title2 title="题目列表"></vi-title2>
|
|
|
|
<el-row style="margin-top: 10px">
|
|
<el-table :data="formData.issues" :key="tableKey"
|
|
class="issueList"
|
|
default-expand-all="true"
|
|
highlight-current-row="true"
|
|
style="width: 100%">
|
|
|
|
<el-table-column label="选项" type="expand">
|
|
<template slot-scope="props">
|
|
<el-row style="margin-bottom: 10px">
|
|
<div class="btn-group tool-button mt5">
|
|
题目设置:
|
|
</div>
|
|
<div class="btn-group tool-button mt5">
|
|
<el-button @click="openIssueName(props.$index,'iname')"
|
|
size="small">
|
|
设置标题
|
|
</el-button>
|
|
</div>
|
|
<div class="btn-group tool-button mt5">
|
|
<el-button @click="openIssueName(props.$index,'its')" size="small">
|
|
设置提示
|
|
</el-button>
|
|
</div>
|
|
|
|
<div class="btn-group tool-button mt5">
|
|
<el-select
|
|
@change="if(props.row.itx==2){props.row.iplfs=1;props.row.iisdx=true;props.row.wors=[{}]}else{props.row.wors=[{wtxt:'选项1'},{wtxt:'选项2'}]}"
|
|
placeholder="题型" size="small"
|
|
style="width: 100px"
|
|
v-model="props.row.itx">
|
|
<el-option
|
|
:key="item.x"
|
|
:label="item.y"
|
|
:value="item.x"
|
|
v-for="item in [{x:1,y:'选择题'},{x:2,y:'填空题'}]">
|
|
</el-option>
|
|
</el-select>
|
|
</div>
|
|
<div class="btn-group tool-button mt5">
|
|
<el-select placeholder="是否必答" size="small"
|
|
style="width: 100px"
|
|
v-model="props.row.iisbd">
|
|
<el-option
|
|
:key="item.x"
|
|
:label="item.y"
|
|
:value="item.x"
|
|
v-for="item in [{x:true,y:'必答'},{x:false,y:'选答'}]">
|
|
</el-option>
|
|
</el-select>
|
|
</div>
|
|
<div class="btn-group tool-button mt5" v-if="props.row.itx==1">
|
|
<el-select placeholder="单选/多选" size="small"
|
|
style="width: 100px"
|
|
v-model="props.row.iisdx">
|
|
<el-option
|
|
:key="item.x"
|
|
:label="item.y"
|
|
:value="item.x"
|
|
v-for="item in [{x:true,y:'单选'},{x:false,y:'多选'}]">
|
|
</el-option>
|
|
</el-select>
|
|
</div>
|
|
<div class="btn-group tool-button mt5" v-if="props.row.iisdx==false">
|
|
<el-input-number :max="5"
|
|
:min="1" controls-position="right"
|
|
placeholder="最小选择数"
|
|
size="small" style="width: 130px"
|
|
v-model="props.row.iminselect"></el-input-number>
|
|
</div>
|
|
<div class="btn-group tool-button mt5" v-if="props.row.iisdx==false">
|
|
<el-input-number :max="20"
|
|
:min="1" controls-position="right"
|
|
placeholder="最大选择数"
|
|
size="small" style="width: 130px"
|
|
v-model="props.row.imaxselect"></el-input-number>
|
|
</div>
|
|
<div class="btn-group tool-button mt5" v-if="props.row.itx==1">
|
|
<el-select @change="if(props.row.iplfs==2){props.row.icolnum=2}"
|
|
placeholder="排列方式"
|
|
size="small"
|
|
style="width: 110px"
|
|
v-model="props.row.iplfs">
|
|
<el-option
|
|
:key="item.x"
|
|
:label="item.y"
|
|
:value="item.x"
|
|
v-for="item in [{x:1,y:'竖向排列'},{x:2,y:'横向排列'}]">
|
|
</el-option>
|
|
</el-select>
|
|
</div>
|
|
<div class="btn-group tool-button mt5" v-if="props.row.iplfs==2">
|
|
<el-input-number :max="12"
|
|
:min="1" controls-position="right"
|
|
placeholder="每行多少列"
|
|
size="small" style="width: 130px"
|
|
v-model="props.row.icolnum"></el-input-number>
|
|
</div>
|
|
<div class="btn-group tool-button mt5" v-if="formData.qlx===2">
|
|
<el-input
|
|
placeholder="请输入分值"
|
|
size="small"
|
|
style="width: 120px"
|
|
type="number"
|
|
v-model="formData.issues[props.$index]['fraction']">
|
|
</el-input>
|
|
</div>
|
|
|
|
<div class="btn-group tool-button mt5" v-if="formData.qlx===2">
|
|
<el-date-picker placeholder="请选择显示日期"
|
|
size="small"
|
|
type="date"
|
|
v-model="formData.issues[props.$index]['displayDate']"
|
|
:disabled="formData.ctMode==2"
|
|
value-format="yyyy-MM-dd">
|
|
</el-date-picker>
|
|
</div>
|
|
|
|
</el-row>
|
|
<el-row v-if="props.row.itx==1">
|
|
<el-table :data="props.row.wors" border style="width: 100%">
|
|
<el-table-column header-align="center"
|
|
label="选项文字"
|
|
property="wtxt">
|
|
<template slot-scope="scope">
|
|
<el-row>
|
|
<el-col :span="20">
|
|
<el-input placeholder="选项文字" size="small"
|
|
maxlength="100"
|
|
v-model="scope.row.wtxt"></el-input>
|
|
</el-col>
|
|
<el-col :span="2">
|
|
<el-button
|
|
@click="props.row.wors.splice(scope.$index+1,0,{wtxt:'选项'+(props.row.wors.length+1)})"
|
|
circle
|
|
icon="el-icon-plus"
|
|
size="mini"
|
|
style="margin-left: 5px"
|
|
type="info"></el-button>
|
|
</el-col>
|
|
<el-col :span="2">
|
|
<el-button @click="props.row.wors.splice(scope.$index,1)"
|
|
circle
|
|
icon="el-icon-minus"
|
|
size="mini"
|
|
style="margin-left: 5px"
|
|
type="info"></el-button>
|
|
</el-col>
|
|
</el-row>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" header-align="center" width="200px">
|
|
<template slot="header">
|
|
<div>图片</div>
|
|
<div>尺寸:150*100</div>
|
|
<div>格式:jpg、png、jpeg</div>
|
|
</template>
|
|
<template slot-scope="scope">
|
|
<el-upload
|
|
:action="FILE_UPLOAD_ADDRESS"
|
|
:before-upload="beforeAvatarUpload"
|
|
:on-success="(res,file)=>{handleAvatarSuccess(res,file,scope.row)}"
|
|
:show-file-list="false"
|
|
list-type="picture-card"
|
|
class="avatar-uploader">
|
|
<div style="position: relative" v-if="scope.row.wimg">
|
|
<img :src="FILE_STREAM_PREVIEW_ADDRESS+'?id='+ scope.row.wimg"
|
|
class="avatar">
|
|
<!-- <div @click.stop="(file)=>{handleRemove(file,scope.row)}">-->
|
|
<!-- <i class="el-icon-delete avatar-delete"></i>-->
|
|
<!-- </div>-->
|
|
<span class="el-upload-list__item-actions">
|
|
<span class="el-upload-list__item-delete"
|
|
@click.stop="(file)=>{handleRemove(file,scope.row)}">
|
|
<i class="el-icon-delete"></i>
|
|
</span>
|
|
</span>
|
|
|
|
</div>
|
|
<i class="el-icon-plus avatar-uploader-icon" v-else></i>
|
|
</el-upload>
|
|
<!-- <tab-upload :allowfiles="['png','jpg','jpeg','svg']"
|
|
ref="tabUpload"
|
|
:filex="scope.row.wimg ? FILE_STREAM_PREVIEW_ADDRESS + '?id=' + scope.row.wimg : ''"
|
|
:resfile.sync="scope.row.wimg"
|
|
maxnum="1"></tab-upload>-->
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="说明"
|
|
property="wsm"
|
|
width="250px"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-input
|
|
autosize
|
|
placeholder="请输入说明"
|
|
type="textarea"
|
|
v-if="formData.qlx!==4"
|
|
v-model="scope.row.wsm">
|
|
</el-input>
|
|
<el-button @click="openCakeDesc(props,scope)" type="text"
|
|
v-else>
|
|
编辑说明
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="链接"
|
|
property="wlj"
|
|
width="150px"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-input
|
|
autosize
|
|
placeholder="请输入链接"
|
|
type="textarea"
|
|
v-model="scope.row.wlj">
|
|
</el-input>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="允许填空"
|
|
property="wistk"
|
|
width="80px"
|
|
>
|
|
<template slot-scope="scope">
|
|
<template>
|
|
<el-checkbox v-model="scope.row.wistk">
|
|
<!-- {{scope.row.wistk==true?'允许':'不允许'}}-->
|
|
</el-checkbox>
|
|
<el-checkbox v-if="scope.row.wistk"
|
|
v-model="scope.row.wisbt">必填
|
|
</el-checkbox>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="默认选中"
|
|
property="wismr"
|
|
width="80px"
|
|
>
|
|
<template slot-scope="scope">
|
|
<template>
|
|
<el-checkbox
|
|
@change="upMr(props.$index,scope.$index,scope.row.wismr)"
|
|
v-model="scope.row.wismr"></el-checkbox>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="是否正确答案"
|
|
property="correct"
|
|
v-if="formData.qlx==2"
|
|
width="80px"
|
|
>
|
|
<template slot-scope="scope">
|
|
<template>
|
|
<el-checkbox
|
|
@change="upCorrect(props.$index,scope.$index,scope.row.correct)"
|
|
v-model="scope.row.correct"></el-checkbox>
|
|
</template>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="单价"
|
|
property="correct"
|
|
v-if="formData.qlx==3"
|
|
width="200px"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-input-number :max="100000"
|
|
:precision="2" :step="1"
|
|
controls-position="right"
|
|
v-model="scope.row.price"></el-input-number>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" header-align="center" label="上/下移"
|
|
width="150px">
|
|
<template slot-scope="scope">
|
|
<el-button @click="worPx(props.$index,scope.$index,true)" circle
|
|
icon="el-icon-top"
|
|
size="small"
|
|
type="info"></el-button>
|
|
|
|
<el-button @click="worPx(props.$index,scope.$index,false)" circle
|
|
icon="el-icon-bottom"
|
|
size="small" type="info"></el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-row>
|
|
<el-row v-if="props.row.itx==2">
|
|
</el-row>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column align="left" header-align="left" label="issue">
|
|
<template scope="issue">
|
|
<el-col :span="1">
|
|
<span style="color: red" v-if="issue.row.iisbd">*</span>
|
|
<span style="font-weight: bolder">{{issue.$index+1}}.</span>
|
|
</el-col>
|
|
<el-col :span="23">
|
|
<el-row>
|
|
<el-col :span="1" v-if="issue.row.fraction">
|
|
<span>({{issue.row.fraction}}分)</span>
|
|
</el-col>
|
|
<el-col :span="23">
|
|
<span v-html="issue.row.iname"></span>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<div style="color: rgb(160,160,160)" v-html="issue.row.its"
|
|
v-if="!isNull(issue.row.its)"></div>
|
|
</el-row>
|
|
<el-row v-if="issue.row.itx==1">
|
|
<el-row v-for="wor,idx in issue.row.wors">
|
|
<el-row style="margin-top: 5px" v-if="wor.wimg">
|
|
<el-image
|
|
:src="FILE_STREAM_PREVIEW_ADDRESS + '?id=' +wor.wimg"
|
|
fit="fill"
|
|
style="max-width: 100px;max-height: 100px"></el-image>
|
|
</el-row>
|
|
<el-row style="margin-top: 5px" v-if="!isNull(wor.wimg)">
|
|
<div style="color: rgb(160,160,160);text-align: left">
|
|
<div v-html="wor.wsm"></div>
|
|
</div>
|
|
</el-row>
|
|
<el-radio :label="idx"
|
|
v-if="issue.row.iisdx==true" v-model="issue.row.xz" border
|
|
size="small">
|
|
<div v-html="wor.wtxt"></div>
|
|
<!-- {{wor.wtxt}} -->
|
|
<span class="inputParent"
|
|
v-if="wor.wistk==true"><el-input
|
|
size="mini" style="border-top: none"
|
|
v-model="wor.tktxt"></el-input> <span
|
|
style="color:red;"
|
|
v-if="wor.wisbt==true">*</span></span>
|
|
</el-radio>
|
|
<el-checkbox :key="idx" :label="idx"
|
|
v-if="issue.row.iisdx==false">
|
|
{{wor.wtxt}} <span class="inputParent"
|
|
v-if="wor.wistk==true"><el-input
|
|
size="mini" style="border-top: none"
|
|
v-model="wor.tktxt"></el-input> <span
|
|
style="color:red;"
|
|
v-if="wor.wisbt==true">*</span></span>
|
|
</el-checkbox>
|
|
<el-row style="margin-top: 5px"
|
|
v-if="isNull(wor.wimg)&&!isNull(wor.wsm)">
|
|
<div style="color: rgb(160,160,160)">
|
|
<div v-html="wor.wsm"></div>
|
|
</div>
|
|
</el-row>
|
|
</el-row>
|
|
</el-row>
|
|
<el-row v-if="issue.row.itx==2">
|
|
<el-input size="small" style="width: 50%"
|
|
v-for="wor in issue.row.wors"
|
|
v-model="issue.row.tktxt"></el-input>
|
|
</el-row>
|
|
</el-col>
|
|
</template>
|
|
</el-table-column>
|
|
|
|
<el-table-column
|
|
align="center"
|
|
header-align="center"
|
|
label="操作" width="180px">
|
|
<template scope="scope">
|
|
<el-button @click="issuePx(scope.$index,true)" circle icon="el-icon-top"
|
|
size="small"
|
|
type="primary"></el-button>
|
|
<el-button @click="issuePx(scope.$index,false)" circle icon="el-icon-bottom"
|
|
size="small" type="primary"></el-button>
|
|
<el-button @click="formData.issues.splice(scope.$index,1)" circle
|
|
icon="el-icon-delete"
|
|
size="small" type="danger"></el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-row>
|
|
|
|
<el-row style="text-align: center;margin-top: 10px">
|
|
<el-button
|
|
:disabled="formData.qlx===4 && formData.issues && formData.issues.length===1"
|
|
@click="formData.issues.push({wors:[{wtxt:'选项1'},{wtxt:'选项2'}],itx:1,its:'',iisrandom:false,iisbd:true,iisdx:true,iname:'<p><b>标题</b></p>',iplfs:1})">
|
|
添加题目
|
|
</el-button>
|
|
</el-row>
|
|
|
|
<el-row style="margin: 10px 0;text-align: center">
|
|
<el-button @click="operation" size="medium" type="primary">确定</el-button>
|
|
</el-row>
|
|
|
|
</el-form>
|
|
</div>
|
|
</template>
|
|
<template #view>
|
|
<div style="height:calc(100vh - 180px);overflow-y: scroll">
|
|
<el-card class="box-card v-box" shadow="never">
|
|
<div style="padding-left: 20px;padding-right: 20px">
|
|
<el-row style="text-align: center">
|
|
<h2>{{viewData.qtitle}}</h2>
|
|
</el-row>
|
|
<el-row style="margin-bottom: 20px">
|
|
<div v-html="viewData.qsm"></div>
|
|
</el-row>
|
|
|
|
<el-row style="border-bottom: 1px solid rgb(200,200,200);padding: 20px 0;margin-bottom: 20px"
|
|
v-for="issue,idx in viewData.issues">
|
|
<el-col :span="1">
|
|
<span style="color: red" v-if="issue.iisbd">*</span>
|
|
<span style="font-weight: bolder">{{idx+1}}.</span>
|
|
</el-col>
|
|
<el-col :span="23">
|
|
<el-row>
|
|
<div v-html="issue.iname"></div>
|
|
</el-row>
|
|
<el-row>
|
|
<div style="color: rgb(160,160,160)" v-html="issue.its"
|
|
v-if="!isNull(issue.its)"></div>
|
|
</el-row>
|
|
<el-row v-if="issue.itx==1">
|
|
<template v-if="issue.iplfs==1">
|
|
<!--竖向排列-->
|
|
<el-row :style="isNull(wor.wimg)?'':'text-align: center'"
|
|
v-for="wor,idx in issue.wors">
|
|
<el-row style="margin-top: 5px" v-if="!isNull(wor.wimg)">
|
|
<el-image
|
|
:src="FILE_STREAM_PREVIEW_ADDRESS + '?id=' +wor.wimg"
|
|
fit="cover"
|
|
style="width: 100px;max-width: 100px"></el-image>
|
|
</el-row>
|
|
<el-row style="margin-top: 5px" v-if="!isNull(wor.wimg)">
|
|
<div style="color: rgb(160,160,160);text-align: left" v-html="wor.wsm">
|
|
</div>
|
|
</el-row>
|
|
<el-row style="margin-top: 5px">
|
|
<el-radio :label="idx" v-if="issue.iisdx==true" v-model="issue.xz">
|
|
{{wor.wtxt}} <span class="inputParent" v-if="wor.wistk==true"><el-input
|
|
size="mini" style="border-top: none"
|
|
v-model="wor.tktxt"></el-input> <span
|
|
style="color:red;" v-if="wor.wisbt==true">*</span></span>
|
|
</el-radio>
|
|
<el-checkbox :key="idx" :label="idx" v-if="issue.iisdx==false">
|
|
{{wor.wtxt}} <span class="inputParent" v-if="wor.wistk==true"><el-input
|
|
size="mini" style="border-top: none"
|
|
v-model="wor.tktxt"></el-input> <span
|
|
style="color:red;" v-if="wor.wisbt==true">*</span></span>
|
|
</el-checkbox>
|
|
<el-row style="margin-top: 5px"
|
|
v-if="isNull(wor.wimg)&&!isNull(wor.wsm)">
|
|
<div style="color: rgb(160,160,160)" v-html="wor.wsm">
|
|
|
|
</div>
|
|
</el-row>
|
|
</el-row>
|
|
</el-row>
|
|
</template>
|
|
<template v-if="issue.iplfs==2">
|
|
<!--横向排列-->
|
|
<el-row :gutter="20" v-for="idx1 in issue.wors.length">
|
|
<el-col :span="parseInt(24/issue.icolnum)"
|
|
v-for="idx2 in issue.icolnum">
|
|
<div :style="isNull(issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg)?'':'text-align: center'"
|
|
v-if="(idx1-1)*issue.icolnum+idx2<=issue.wors.length">
|
|
<el-row style="margin-top: 5px"
|
|
v-if="!isNull(issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg)">
|
|
<el-image
|
|
:src="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].islocal?issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg:FILE_STREAM_PREVIEW_ADDRESS + '?id=' +issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg"
|
|
fit="cover"
|
|
style="width: 100%;max-width: 300px"></el-image>
|
|
</el-row>
|
|
<el-row style="margin-top: 5px"
|
|
v-if="!isNull(issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg)">
|
|
<div style="color: rgb(160,160,160);text-align: left">
|
|
{{issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wsm}}
|
|
</div>
|
|
</el-row>
|
|
<el-row style="margin-top: 5px">
|
|
<el-radio :label="idx1+'-'+idx2" v-if="issue.iisdx==true"
|
|
v-model="issue.xz">
|
|
{{issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wtxt}}
|
|
<span
|
|
class="inputParent"
|
|
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wistk==true"><el-input
|
|
size="mini"
|
|
style="border-top: none"
|
|
v-model="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].tktxt"></el-input> <span
|
|
style="color:red;"
|
|
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wisbt==true">*</span></span>
|
|
</el-radio>
|
|
<el-checkbox :key="idx1+'-'+idx2" :label="idx1+'-'+idx2"
|
|
v-if="issue.iisdx==false">
|
|
{{issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wtxt}}
|
|
<span class="inputParent"
|
|
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wistk==true"><el-input
|
|
size="mini"
|
|
style="border-top: none"
|
|
v-model="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].tktxt"></el-input> <span
|
|
style="color:red;"
|
|
v-if="issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wisbt==true">*</span></span>
|
|
</el-checkbox>
|
|
<el-row style="margin-top: 5px"
|
|
v-if="isNull(issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wimg)&&!isNull(issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wsm)">
|
|
<div style="color: rgb(160,160,160)">
|
|
{{issue.wors[((idx1-1)*issue.icolnum+idx2)-1].wsm}}
|
|
</div>
|
|
</el-row>
|
|
</el-row>
|
|
</div>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
</template>
|
|
</el-row>
|
|
<el-row v-if="issue.itx==2">
|
|
<el-input size="small" style="width: 50%" v-for="wor in issue.wors"
|
|
v-model="issue.tktxt"></el-input>
|
|
</el-row>
|
|
</el-col>
|
|
</el-row>
|
|
|
|
</div>
|
|
</el-card>
|
|
</div>
|
|
</template>
|
|
</guava>
|
|
|
|
<el-dialog :close-on-click-modal="false"
|
|
:visible.sync="setTitleDialogVisible" custom-class="ViewDialogClass" width="50%">
|
|
<div id="upTxtEditor"></div>
|
|
<span class="dialog-footer" slot="footer">
|
|
<el-button @click="setTitleDialogVisible = false" v-show="!addDialogVisible">取 消</el-button>
|
|
<el-button @click="upIssueName" type="primary">确 定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
|
|
<a id="download" style="display: none"></a>
|
|
<div id="qrcode" style="display: none;width: 500px;height: 500px"></div>
|
|
|
|
<el-dialog :close-on-click-modal="false" :visible.sync="cakeDialog" id="cakeDialog" title="编辑说明" width="50%">
|
|
<div id="cakeEditor"></div>
|
|
<span class="dialog-footer" slot="footer">
|
|
<el-button @click="cakeDialog = false">取 消</el-button>
|
|
<el-button @click="upCakeDesc" type="primary">确 定</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
|
|
<el-drawer
|
|
title="我是标题" size="78%"
|
|
:visible.sync="userScopeDialog"
|
|
:with-header="false">
|
|
<div style="padding: 0px 16px;" class="clearfix">
|
|
<el-button icon="el-icon-back" style="font-size: 16px" type="text" @click="userScopeDialog = false">返回
|
|
</el-button>
|
|
</div>
|
|
<user-scope
|
|
:is_h04="${@shiro.hasRole('H04')}"
|
|
:is_a06="${@shiro.hasRole('A06')}"
|
|
:is_h02="${@shiro.hasRole('club01')}"
|
|
:is_sysadmin="${@shiro.hasRole('sysadmin')}"
|
|
:unionid="'${@shiro.getPrincipalProperty('unit').getUnionid()}'"
|
|
:group_id.sync="formData.activityUserScopeId"
|
|
></user-scope>
|
|
</el-drawer>
|
|
|
|
<send-msg ref="sendMsg"></send-msg>
|
|
|
|
</div>
|
|
<script src="${base!}/assets/platform/js/jquery.qrcode.min.js"></script>
|
|
<script>
|
|
let qsmEditor
|
|
let upTxtEditor
|
|
let cakeEditor
|
|
let vue = new Vue({
|
|
el: '#app',
|
|
data() {
|
|
return {
|
|
cakeDialog: false,
|
|
addDialogVisible: false,
|
|
tableData: [],
|
|
v: 'index',
|
|
pageForm: {
|
|
searchName: "",
|
|
searchKeyword: "",
|
|
pageNumber: 1,
|
|
pageSize: 10,
|
|
totalCount: 0,
|
|
qlx: 1,
|
|
pageOrderName: "",
|
|
pageOrderBy: "",
|
|
year: new Date().getFullYear() + ''
|
|
},
|
|
viewData: {issue: [{word: []}]},
|
|
formData: {issues: [{wors: [{}]}]},
|
|
setTitleDialogVisible: false,
|
|
formRules: {
|
|
qtitle: [{required: true, message: '请填写标题', trigger: ['blur', 'change']}],
|
|
qlx: [{required: true, message: '请选择类型', trigger: ['blur', 'change']}],
|
|
},
|
|
isNull(val) {
|
|
if (val == '' || val == undefined || val == null) {
|
|
return true
|
|
}
|
|
return false
|
|
},
|
|
issueIdx: null,
|
|
issueName: null,
|
|
delIssueIds: [],
|
|
delWorIds: [],
|
|
tableKey: '',
|
|
appid: 'wx9fd2b07ea126f9f6',
|
|
redirect_uri: location.protocol + "//" + location.host,
|
|
|
|
cake_subject: 0,
|
|
cake_subject_option: 0,
|
|
endTimeOptions: {
|
|
disabledDate(val) {
|
|
return val.getTime() < new Date().getTime()
|
|
}
|
|
},
|
|
activityUserScopeList: [],
|
|
userScopeDialog: false,
|
|
}
|
|
},
|
|
components: {
|
|
'tab-upload': httpVueLoader('/components/plugins/TabUpload.vue'),
|
|
'user-scope': httpVueLoader('/components/plugins/UserScope.vue'),
|
|
'send-msg': httpVueLoader('/components/plugins/SendMsgByGroupId.vue')
|
|
},
|
|
methods: {
|
|
openUserScope() {
|
|
this.userScopeDialog = true
|
|
},
|
|
sendMsg(row) {
|
|
this.$refs.sendMsg.openDialog(row.activityuserscopeid)
|
|
},
|
|
beforeAvatarUpload(file) {
|
|
const isJPG = ['image/png', 'image/jpeg'].includes(file.type);
|
|
const isLt2M = file.size / 1024 / 1024 < 2;
|
|
if (!isJPG) {
|
|
this.$message.error('上传图片只能是 jpg、png、jpeg 格式!');
|
|
}
|
|
if (!isLt2M) {
|
|
this.$message.error('上传图片大小不能超过 2MB!');
|
|
}
|
|
return isJPG && isLt2M;
|
|
},
|
|
handleAvatarSuccess(res, file, row) {
|
|
this.$set(row, 'wimg', res.data.id)
|
|
},
|
|
handleRemove(file, row) {
|
|
this.$set(row, 'wimg', null)
|
|
},
|
|
|
|
openCakeDesc(subject, option) {
|
|
this.cake_subject = subject.$index
|
|
this.cake_subject_option = option.$index
|
|
this.cakeDialog = true
|
|
this.$nextTick(() => {
|
|
$('#cakeEditor').html("")
|
|
cakeEditor = new window.wangEditor('#cakeEditor')
|
|
cakeEditor.config.uploadImgShowBase64 = true // 使用 base64 保存图片
|
|
// cakeEditor.customConfig.uploadImgShowBase64 = true
|
|
cakeEditor.create()
|
|
console.log(cakeEditor)
|
|
const wsm = this.formData.issues[this.cake_subject]['wors'][this.cake_subject_option]['wsm']
|
|
if (wsm) {
|
|
cakeEditor.txt.html(wsm)
|
|
}
|
|
})
|
|
|
|
},
|
|
upCakeDesc() {
|
|
const wsm = cakeEditor.txt.html()
|
|
this.formData.issues[this.cake_subject]['wors'][this.cake_subject_option]['wsm'] = wsm
|
|
this.cakeDialog = false
|
|
},
|
|
questionTypeChange(val) {
|
|
if (val === 4 && this.formData.issues.length > 1) {
|
|
this.formData.issues = this.formData.issues.slice(0, 1);
|
|
}
|
|
},
|
|
|
|
|
|
IEVersion() {
|
|
let userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
|
|
let isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; //判断是否IE<11浏览器
|
|
let isEdge = userAgent.indexOf("Edge") > -1 && !isIE; //判断是否IE的Edge浏览器
|
|
let isIE11 = userAgent.indexOf('Trident') > -1 && userAgent.indexOf("rv:11.0") > -1;
|
|
if (isIE) {
|
|
let reIE = new RegExp("MSIE (\\d+\\.\\d+);");
|
|
reIE.test(userAgent);
|
|
let fIEVersion = parseFloat(RegExp["$1"]);
|
|
if (fIEVersion == 7) {
|
|
return 7;
|
|
} else if (fIEVersion == 8) {
|
|
return 8;
|
|
} else if (fIEVersion == 9) {
|
|
return 9;
|
|
} else if (fIEVersion == 10) {
|
|
return 10;
|
|
} else {
|
|
return 6;//IE版本<=7
|
|
}
|
|
} else if (isEdge) {
|
|
return 'edge';//edge
|
|
} else if (isIE11) {
|
|
return 11; //IE11
|
|
} else {
|
|
return -1;//不是ie浏览器
|
|
}
|
|
},
|
|
dwnCode(name) {
|
|
let type = 'png';
|
|
if (this.IEVersion() != -1) {
|
|
let blob = $("canvas").get(0).msToBlob();
|
|
window.navigator.msSaveBlob(blob, name + '_' + (new Date()).getTime() + '.' + type);
|
|
} else {
|
|
$('#download').attr({
|
|
href: $("canvas").get(0).toDataURL('image/png').replace("image/png", "image/octet-stream"),
|
|
download: name + '_' + (new Date()).getTime() + '.' + type
|
|
}).get(0).click();
|
|
}
|
|
},
|
|
saveCode(qid) {
|
|
let self = this
|
|
$("#qrcode").html("")
|
|
$("#qrcode").qrcode({ //设置css
|
|
render: "canvas", //二维码的生成方式
|
|
width: $("#qrcode").width(), //生成二维码的宽度
|
|
height: $("#qrcode").width(), //生成二维码的高度
|
|
text: self.redirect_uri + '/platform/zgfw/mobile/questionnaire?qid=' + qid,
|
|
correctLevel: 3 //容错级别,默认为2,最高为3,为了让用户扫码最快,容错级别应当设为最低
|
|
});
|
|
this.$nextTick(() => {
|
|
this.dwnCode("问卷调查")
|
|
})
|
|
},
|
|
upZt(qid, flag) {
|
|
$.post("/platform/zgfw/question/upZt", {qid: qid, flag: flag}, (data) => {
|
|
if (data.code == 0) {
|
|
this.$message({
|
|
message: data.msg,
|
|
type: 'success'
|
|
});
|
|
this.pageData()
|
|
} else {
|
|
this.$message({
|
|
message: data.msg,
|
|
type: 'error'
|
|
});
|
|
}
|
|
})
|
|
},
|
|
openView(qid) {
|
|
$.get("/platform/zgfw/question/findOne", {qid: qid}, (data) => {
|
|
if (data.code == 0) {
|
|
data.data.issues.forEach((issue) => {
|
|
issue.xz = []
|
|
issue.wors.forEach((wor) => {
|
|
if (wor.wismr == true && issue.iisdx == true
|
|
) {
|
|
issue.xz = wor.wid
|
|
} else if (wor.wismr == true && issue.iisdx == false) {
|
|
issue.xz.push(wor.wid)
|
|
}
|
|
})
|
|
if (issue.iplfs == 2) {
|
|
issue.wors_ = []
|
|
for (let i = 0; i < issue.wors.length; i += issue.icolnum) {
|
|
let arr = []
|
|
for (let j = 0; j < issue.icolnum; j++) {
|
|
arr.push(issue.wors[i + j])
|
|
}
|
|
issue.wors_.push(arr)
|
|
}
|
|
}
|
|
})
|
|
this.viewData = data.data
|
|
// this.v = 'view'
|
|
this.$refs.guava.view()
|
|
} else {
|
|
this.$message({
|
|
message: data.msg,
|
|
type: 'error'
|
|
});
|
|
}
|
|
})
|
|
},
|
|
worPx(iidx, widx, isTop) {
|
|
if (isTop && widx > 0) {
|
|
let v = JSON.parse(JSON.stringify(this.formData.issues[iidx].wors[widx]))
|
|
this.$set(this.formData.issues[iidx].wors, widx, this.formData.issues[iidx].wors[widx - 1])
|
|
this.$set(this.formData.issues[iidx].wors, widx - 1, v)
|
|
} else if (!isTop && widx < this.formData.issues[iidx].wors.length - 1) {
|
|
let v = JSON.parse(JSON.stringify(this.formData.issues[iidx].wors[widx]))
|
|
this.$set(this.formData.issues[iidx].wors, widx, this.formData.issues[iidx].wors[widx + 1])
|
|
this.$set(this.formData.issues[iidx].wors, widx + 1, v)
|
|
}
|
|
},
|
|
upMr(iidx, widx, val) {
|
|
if (this.formData.issues[iidx].iisdx && val == true) {
|
|
this.formData.issues[iidx].wors.forEach((v) => {
|
|
v.wismr = false
|
|
})
|
|
this.formData.issues[iidx].wors[widx].wismr = true
|
|
}
|
|
},
|
|
upCorrect(iidx, widx, val) {
|
|
if (this.formData.issues[iidx].iisdx && val) {
|
|
this.formData.issues[iidx].wors.forEach((v) => {
|
|
v.correct = false
|
|
})
|
|
this.formData.issues[iidx].wors[widx].correct = true
|
|
}
|
|
},
|
|
issuePx(idx, isTop) {
|
|
if (isTop && idx > 0) {
|
|
let v = JSON.parse(JSON.stringify(this.formData.issues[idx]))
|
|
this.formData.issues[idx] = this.formData.issues[idx - 1]
|
|
this.formData.issues[idx - 1] = v
|
|
} else if (!isTop && idx < this.formData.issues.length - 1) {
|
|
let v = JSON.parse(JSON.stringify(this.formData.issues[idx]))
|
|
this.formData.issues[idx] = this.formData.issues[idx + 1]
|
|
this.formData.issues[idx + 1] = v
|
|
}
|
|
},
|
|
upIssueName() {
|
|
this.formData.issues[this.issueIdx][this.issueName] = upTxtEditor.txt.html()
|
|
this.issueIdx = null
|
|
this.issueName = null
|
|
this.setTitleDialogVisible = false
|
|
},
|
|
delWor(props, scope) {
|
|
if (!this.isNull(scope.row.wid)) {
|
|
this.delWorIds.push(scope.row.wid)
|
|
}
|
|
props.row.wors.splice(scope.$index, 1)
|
|
},
|
|
delIssue(scope) {
|
|
if (!this.isNull(scope.row.iid)) {
|
|
this.delIssueIds.push(scope.row.iid)
|
|
}
|
|
this.formData.issues.splice(scope.$index, 1)
|
|
},
|
|
openIssueName(idx, name) {
|
|
this.issueIdx = idx
|
|
this.issueName = name
|
|
this.setTitleDialogVisible = true
|
|
this.$nextTick(() => {
|
|
$('#upTxtEditor').html("")
|
|
upTxtEditor = new wangEditor('#upTxtEditor')
|
|
upTxtEditor.config.uploadImgShowBase64 = true // 使用 base64 保存图片
|
|
upTxtEditor.create()
|
|
if (!this.isNull(this.formData.issues[idx][name])) {
|
|
upTxtEditor.txt.html(this.formData.issues[idx][name])
|
|
}
|
|
})
|
|
},
|
|
doDelete(id) {
|
|
let that = this
|
|
this.$confirm('确定要删除吗', '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning',
|
|
callback(a, b) {
|
|
if ("confirm" == a) {//确认后再执行
|
|
$.post(base + "/platform/zgfw/question/delete", {qid: id}, (data) => {
|
|
if (data.code == 0) {
|
|
that.$message({
|
|
message: data.msg,
|
|
type: 'success'
|
|
});
|
|
that.pageData();
|
|
} else {
|
|
that.$message({
|
|
message: data.msg,
|
|
type: 'error'
|
|
});
|
|
}
|
|
}, "json");
|
|
}
|
|
}
|
|
});
|
|
},
|
|
openAdd() {
|
|
this.$refs.guava.edit()
|
|
this.$nextTick(() => {
|
|
$('#qsmEditor').html("")
|
|
qsmEditor = new wangEditor('#qsmEditor')
|
|
qsmEditor.config.uploadImgShowBase64 = true
|
|
qsmEditor.config.onchange = (html) => {
|
|
this.$set(this.formData, "qsm", html)
|
|
}
|
|
qsmEditor.create()
|
|
this.formData = {issues: [], qlx: 2, qrkdcs: 0}
|
|
})
|
|
},
|
|
openEdit(qid) {
|
|
$.get("/platform/zgfw/question/findOne", {qid: qid}, (data) => {
|
|
if (data.code == 0) {
|
|
this.$nextTick(() => {
|
|
$('#qsmEditor').html(data.data.qsm)
|
|
qsmEditor = new wangEditor('#qsmEditor')
|
|
qsmEditor.config.onchange = (html) => {
|
|
this.$set(this.formData, "qsm", html)
|
|
}
|
|
qsmEditor.create()
|
|
this.formData = data.data
|
|
if (!this.isNull(this.formData.qdtkssj) && !this.isNull(this.formData.qdtjssj)) {
|
|
this.$set(this.formData, 'qdtsj', [this.formData.qdtkssj, this.formData.qdtjssj])
|
|
}
|
|
})
|
|
console.log(this.formData)
|
|
this.$refs.guava.edit()
|
|
} else {
|
|
this.$message.error(data.msg)
|
|
}
|
|
})
|
|
},
|
|
operation() {
|
|
if (this.formData.qlx === 4) {
|
|
if (this.formData.autoSelect && this.formData.endTime < new Date().getTime()) {
|
|
this.$message.warning('结束时间必须要大于当前时间')
|
|
return
|
|
}
|
|
}
|
|
|
|
//答题 并且是 定时定题
|
|
if (this.formData.qlx === 2 && this.formData.ctMode === 1) {
|
|
if (this.formData.issues.some(v => v.displayDate != null) && this.formData.issues.some(v => v.displayDate == null)) {
|
|
this.$message.warning('显示日期只能全为空或者全不为空')
|
|
return
|
|
}
|
|
}
|
|
|
|
if (this.formData.qid) {
|
|
this.doEdit()
|
|
} else {
|
|
this.doAdd()
|
|
}
|
|
// if (this.v == 'edit') {
|
|
// this.doEdit()
|
|
// } else if (this.v == 'add') {
|
|
// this.doAdd()
|
|
// }
|
|
},
|
|
doEdit() {
|
|
if (this.formData.issues.length < 1) {
|
|
this.$message.warning('请先添加问题!')
|
|
return
|
|
}
|
|
this.formData.issues.forEach((issue) => {
|
|
if (issue.iisdx == true) {
|
|
issue.iminselect = undefined
|
|
issue.imaxselect = undefined
|
|
}
|
|
if (issue.iplfs == 1) {
|
|
issue.icolnum = undefined
|
|
}
|
|
issue.wors.forEach((wor) => {
|
|
if (wor.wistk != true) {
|
|
wor.wisbt = undefined
|
|
}
|
|
})
|
|
})
|
|
if (!this.isNull(this.formData.qdtsj) && this.formData.qdtsj.length > 0) {
|
|
this.formData.qdtkssj = this.formData.qdtsj[0]
|
|
this.formData.qdtjssj = this.formData.qdtsj[1]
|
|
} else {
|
|
this.formData.qdtkssj = undefined
|
|
this.formData.qdtjssj = undefined
|
|
}
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: '数据提交中...',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
});
|
|
$.post(base + "/platform/zgfw/question/doEdit", {question: JSON.stringify(this.formData)}, (data) => {
|
|
if (data.code == 0) {
|
|
// this.v = 'index'
|
|
this.$refs.guava.index()
|
|
this.pageData()
|
|
this.$message.success(data.msg)
|
|
} else {
|
|
this.$message.error(data.msg);
|
|
}
|
|
loading.close()
|
|
})
|
|
},
|
|
doAdd() {
|
|
this.formData.issues.forEach(v => {
|
|
if (v.iisdx == true) {
|
|
v.iminselect = undefined
|
|
v.imaxselect = undefined
|
|
}
|
|
if (v.iplfs == 1) {
|
|
v.icolnum = undefined
|
|
}
|
|
v.wors.forEach(wor => {
|
|
if (wor.wistk != true) {
|
|
wor.wisbt = undefined
|
|
}
|
|
})
|
|
})
|
|
|
|
if (!this.isNull(this.formData.qdtsj) && this.formData.qdtsj.length > 0) {
|
|
this.formData.qdtkssj = this.formData.qdtsj[0]
|
|
this.formData.qdtjssj = this.formData.qdtsj[1]
|
|
}
|
|
|
|
const loading = this.$loading({
|
|
lock: true,
|
|
text: '数据提交中...',
|
|
spinner: 'el-icon-loading',
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
});
|
|
|
|
$.post(base + "/platform/zgfw/question/doAdd", {question: JSON.stringify(this.formData)}, (data) => {
|
|
if (data.code == 0) {
|
|
// this.v = 'index'
|
|
this.$refs.guava.index()
|
|
this.pageData()
|
|
this.$message.success(data.msg)
|
|
} else {
|
|
this.$message({
|
|
message: data.msg,
|
|
type: 'error'
|
|
});
|
|
}
|
|
loading.close()
|
|
})
|
|
},
|
|
doSearch() {
|
|
this.pageForm.pageNumber = 1;
|
|
this.pageData();
|
|
},
|
|
pageOrder(column) {//按字段排序
|
|
switch (column.order) {
|
|
case 'descending':
|
|
column.order = 'desc'
|
|
break
|
|
case "ascending":
|
|
column.order = 'asc'
|
|
break
|
|
}
|
|
this.pageForm.pageOrderName = column.prop;
|
|
this.pageForm.pageOrderBy = column.order;
|
|
this.pageData();
|
|
},
|
|
pageNumberChange(val) {//页码更新操作
|
|
this.pageForm.pageNumber = val;
|
|
this.pageData();
|
|
},
|
|
pageSizeChange(val) {//分页大小更新操作
|
|
this.pageForm.pageSize = val;
|
|
this.pageData();
|
|
},
|
|
pageData() {//加载分页数据
|
|
sublime.showLoadingbar();//显示loading
|
|
$.post(base + "/platform/zgfw/question/data", this.pageForm, (data) => {
|
|
sublime.closeLoadingbar();//关闭loading
|
|
if (data.code == 0) {
|
|
this.tableData = data.data.list;
|
|
this.pageForm.totalCount = data.data.totalCount;
|
|
} else {
|
|
this.$message({
|
|
message: data.msg,
|
|
type: 'error'
|
|
});
|
|
}
|
|
}, "json");
|
|
},
|
|
async getActivityUserScope() {
|
|
const resp = await $.get('/platform/activity/basic/scope/getActivityUserScopeGroup')
|
|
if (resp.code === 0) {
|
|
this.activityUserScopeList = resp.data
|
|
}
|
|
}
|
|
},
|
|
created() {
|
|
this.getActivityUserScope()
|
|
this.pageData();
|
|
},
|
|
watch: {
|
|
'formData.activityUserScopeId': {
|
|
async handler(newVal, oldVal) {
|
|
await this.getActivityUserScope()
|
|
this.userScopeDialog = false
|
|
},
|
|
deep: true
|
|
},
|
|
}
|
|
})
|
|
</script>
|
|
|
|
<!--#
|
|
}
|
|
#--> |