优化问卷

This commit is contained in:
java110 2021-02-05 18:27:28 +08:00
parent a5c514bb63
commit 31dab522be
4 changed files with 290 additions and 246 deletions

View File

@ -1,55 +1,62 @@
<div id = "addQuestionAnswerModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" >
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">添加问卷信息</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">问卷类型</label>
<div class="col-sm-10">
<select class="custom-select" v-model="addQuestionAnswerInfo.qaType">
<option selected disabled value="">必填,请选择问卷类型</option>
<option value="1001">业主问卷</option>
<option value="2002">员工自评</option>
<option value="3003">业主投票</option>
<option value="4004">员工投票</option>
</select> </div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">问卷名称</label>
<div class="col-sm-10">
<input v-model="addQuestionAnswerInfo.qaName" type="text" placeholder="必填,请填写问卷名称" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">开始时间</label>
<div class="col-sm-10">
<input v-model="addQuestionAnswerInfo.startTime" type="text" placeholder="必填,请填写开始时间" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">结束时间</label>
<div class="col-sm-10">
<input v-model="addQuestionAnswerInfo.endTime" type="text" placeholder="必填,请填写结束时间" class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">备注</label>
<div class="col-sm-10">
<input v-model="addQuestionAnswerInfo.remark" type="text" placeholder="选填,请填写备注" class="form-control">
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="saveQuestionAnswerInfo()" ><i class="fa fa-check"></i>&nbsp;保存</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;" data-dismiss="modal">取消</button>
</div>
</div>
</div>
<div id="addQuestionAnswerModel" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<h3 class="m-t-none m-b ">添加</h3>
<div class="ibox-content">
<div>
<div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">问卷类型</label>
<div class="col-sm-10">
<select class="custom-select" v-model="addQuestionAnswerInfo.qaType">
<option selected disabled value="">必填,请选择问卷类型</option>
<option value="1001">业主问卷</option>
<option value="2002">员工自评</option>
<option value="3003">业主投票</option>
<option value="4004">员工投票</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">问卷名称</label>
<div class="col-sm-10">
<input v-model="addQuestionAnswerInfo.qaName" type="text" placeholder="必填,请填写问卷名称"
class="form-control">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">开始时间</label>
<div class="col-sm-10">
<input v-model="addQuestionAnswerInfo.startTime" type="text" placeholder="必填,请填写开始时间"
class="form-control addStartTime">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">结束时间</label>
<div class="col-sm-10">
<input v-model="addQuestionAnswerInfo.endTime" type="text" placeholder="必填,请填写结束时间"
class="form-control addEndTime">
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 col-form-label">备注</label>
<div class="col-sm-10">
<textarea v-model="addQuestionAnswerInfo.remark" placeholder="选填,请填写备注" class="form-control"></textarea>
</div>
</div>
<div class="ibox-content">
<button class="btn btn-primary float-right" type="button" v-on:click="saveQuestionAnswerInfo()"><i
class="fa fa-check"></i>&nbsp;保存</button>
<button type="button" class="btn btn-warning float-right" style="margin-right:20px;"
data-dismiss="modal">取消</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

View File

@ -1,87 +1,99 @@
(function(vc){
(function (vc) {
vc.extends({
propTypes: {
callBackListener:vc.propTypes.string, //父组件名称
callBackFunction:vc.propTypes.string //父组件监听方法
callBackListener: vc.propTypes.string, //父组件名称
callBackFunction: vc.propTypes.string //父组件监听方法
},
data:{
addQuestionAnswerInfo:{
qaId:'',
qaType:'',
qaName:'',
startTime:'',
endTime:'',
remark:'',
data: {
addQuestionAnswerInfo: {
qaId: '',
qaType: '',
qaName: '',
startTime: '',
endTime: '',
remark: '',
objType: '',
objId: ''
}
},
_initMethod:function(){
},
_initEvent:function(){
vc.on('addQuestionAnswer','openAddQuestionAnswerModal',function(){
_initMethod: function () {
vc.initDateTime('addStartTime', function (_startTime) {
$that.addQuestionAnswerInfo.startTime = _startTime;
});
vc.initDateTime('addEndTime', function (_endTime) {
$that.addQuestionAnswerInfo.endTime = _endTime;
let start = Date.parse(new Date($that.addQuestionAnswerInfo.startTime))
let end = Date.parse(new Date($that.addQuestionAnswerInfo.endTime))
if (start - end >= 0) {
vc.toast("结束时间必须大于开始时间")
$that.addQuestionAnswerInfo.endTime = '';
}
});
},
_initEvent: function () {
vc.on('addQuestionAnswer', 'openAddQuestionAnswerModal', function () {
$('#addQuestionAnswerModel').modal('show');
});
},
methods:{
addQuestionAnswerValidate(){
methods: {
addQuestionAnswerValidate() {
return vc.validate.validate({
addQuestionAnswerInfo:vc.component.addQuestionAnswerInfo
},{
'addQuestionAnswerInfo.qaType':[
{
limit:"required",
param:"",
errInfo:"问卷类型不能为空"
addQuestionAnswerInfo: vc.component.addQuestionAnswerInfo
}, {
'addQuestionAnswerInfo.qaType': [
{
limit: "required",
param: "",
errInfo: "问卷类型不能为空"
},
{
limit:"num",
param:"",
errInfo:"问卷类型格式错误"
{
limit: "num",
param: "",
errInfo: "问卷类型格式错误"
},
],
'addQuestionAnswerInfo.qaName':[
{
limit:"required",
param:"",
errInfo:"问卷名称不能为空"
'addQuestionAnswerInfo.qaName': [
{
limit: "required",
param: "",
errInfo: "问卷名称不能为空"
},
{
limit:"maxLength",
param:"256",
errInfo:"问卷名称太长"
{
limit: "maxLength",
param: "256",
errInfo: "问卷名称太长"
},
],
'addQuestionAnswerInfo.startTime':[
{
limit:"required",
param:"",
errInfo:"开始时间不能为空"
'addQuestionAnswerInfo.startTime': [
{
limit: "required",
param: "",
errInfo: "开始时间不能为空"
},
{
limit:"datetime",
param:"",
errInfo:"开始时间错误"
{
limit: "datetime",
param: "",
errInfo: "开始时间错误"
},
],
'addQuestionAnswerInfo.endTime':[
{
limit:"required",
param:"",
errInfo:"结束时间不能为空"
'addQuestionAnswerInfo.endTime': [
{
limit: "required",
param: "",
errInfo: "结束时间不能为空"
},
{
limit:"datetime",
param:"",
errInfo:"结束时间错误"
{
limit: "datetime",
param: "",
errInfo: "结束时间错误"
},
],
'addQuestionAnswerInfo.remark':[
{
limit:"maxLength",
param:"512",
errInfo:"备注太长"
'addQuestionAnswerInfo.remark': [
{
limit: "maxLength",
param: "512",
errInfo: "备注太长"
},
],
@ -90,57 +102,68 @@ remark:'',
});
},
saveQuestionAnswerInfo:function(){
if(!vc.component.addQuestionAnswerValidate()){
saveQuestionAnswerInfo: function () {
if (!vc.component.addQuestionAnswerValidate()) {
vc.toast(vc.validate.errInfo);
return ;
return;
}
vc.component.addQuestionAnswerInfo.communityId = vc.getCurrentCommunity().communityId;
if ($that.addQuestionAnswerInfo.qaType == '1001'
|| $that.addQuestionAnswerInfo.qaType == '3003'
) {
$that.addQuestionAnswerInfo.objType = '3306';
$that.addQuestionAnswerInfo.objId = vc.getCurrentCommunity().communityId;
} else {
$that.addQuestionAnswerInfo.objType = '3307';
$that.addQuestionAnswerInfo.objId = '-1';
}
vc.component.addQuestionAnswerInfo.communityId = vc.getCurrentCommunity().communityId;
//不提交数据将数据 回调给侦听处理
if(vc.notNull($props.callBackListener)){
vc.emit($props.callBackListener,$props.callBackFunction,vc.component.addQuestionAnswerInfo);
if (vc.notNull($props.callBackListener)) {
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addQuestionAnswerInfo);
$('#addQuestionAnswerModel').modal('hide');
return ;
return;
}
vc.http.apiPost(
'questionAnswer.saveQuestionAnswer',
'/questionAnswer/saveQuestionAnswer',
JSON.stringify(vc.component.addQuestionAnswerInfo),
{
emulateJSON:true
},
function(json,res){
emulateJSON: true
},
function (json, res) {
//vm.menus = vm.refreshMenuActive(JSON.parse(json),0);
let _json = JSON.parse(json);
if (_json.code == 0) {
//关闭model
$('#addQuestionAnswerModel').modal('hide');
vc.component.clearAddQuestionAnswerInfo();
vc.emit('questionAnswerManage','listQuestionAnswer',{});
vc.emit('questionAnswerManage', 'listQuestionAnswer', {});
return ;
return;
}
vc.message(_json.msg);
},
function(errInfo,error){
},
function (errInfo, error) {
console.log('请求失败处理');
vc.message(errInfo);
});
});
},
clearAddQuestionAnswerInfo:function(){
clearAddQuestionAnswerInfo: function () {
vc.component.addQuestionAnswerInfo = {
qaType:'',
qaName:'',
startTime:'',
endTime:'',
remark:'',
};
qaType: '',
qaName: '',
startTime: '',
endTime: '',
remark: '',
objType: '',
objId: ''
};
}
}
});

View File

@ -1,33 +1,43 @@
<div >
<div>
<div class="row">
<div class="col-lg-12">
<div class="ibox ">
<div class="ibox-title">
<h5>查询条件</h5>
<div class="ibox-tools" style="top:10px;">
</div>
</div>
<div class="ibox-content">
<div class="row">
<div class="col-sm-4" >
<select class="custom-select" v-model="questionAnswerManageInfo.conditions.qaType">
<option selected value="">请选择问卷类型</option>
<option value="1001">业主问卷</option>
<option value="2002">员工自评</option>
<option value="3003">业主投票</option>
<option value="4004">员工投票</option>
</select> </div><div class="col-sm-4" >
<div class="form-group">
<input type="text" placeholder="请输入问卷名称" v-model="questionAnswerManageInfo.conditions.qaName" class=" form-control">
</div> </div><div class="col-sm-3" >
<div class="form-group">
<input type="text" placeholder="请输入问卷ID" v-model="questionAnswerManageInfo.conditions.qaId" class=" form-control">
</div> </div><div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_queryQuestionAnswerMethod()">
<i class="glyphicon glyphicon-search"></i> 查询
<div class="col-sm-4">
<select class="custom-select" v-model="questionAnswerManageInfo.conditions.qaType">
<option selected value="">请选择问卷类型</option>
<option value="1001">业主问卷</option>
<option value="2002">员工自评</option>
<option value="3003">业主投票</option>
<option value="4004">员工投票</option>
</select>
</div>
<div class="col-sm-4">
<div class="form-group">
<input type="text" placeholder="请输入问卷名称"
v-model="questionAnswerManageInfo.conditions.qaName" class=" form-control">
</div>
</div>
<div class="col-sm-3">
<div class="form-group">
<input type="text" placeholder="请输入问卷ID"
v-model="questionAnswerManageInfo.conditions.qaId" class=" form-control">
</div>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm"
v-on:click="_queryQuestionAnswerMethod()">
<i class="glyphicon glyphicon-search"></i> 查询
</button>
</div></div>
</div>
</div>
</div>
@ -38,53 +48,57 @@
<div class="col-lg-12">
<div class="ibox">
<div class="ibox-title">
<h5>问卷信息信息</h5>
<h5>问卷信息</h5>
<div class="ibox-tools" style="top:10px;">
<button type="button" class="btn btn-primary btn-sm" v-on:click="_openAddQuestionAnswerModal()">
<i class="glyphicon glyphicon-plus"></i>
添加问卷信息
添加
</button>
</div>
</div>
<div class="ibox-content">
<table class="footable table table-stripped toggle-arrow-tiny"
data-page-size="15"
>
<table class="footable table table-stripped toggle-arrow-tiny" data-page-size="15">
<thead>
<tr>
<th class="text-center">问卷ID</th>
<th class="text-center">问卷类型</th>
<th class="text-center">问卷名称</th>
<th class="text-center">开始时间</th>
<th class="text-center">结束时间</th>
<th class="text-center">操作</th>
</tr>
<tr>
<th class="text-center">问卷ID</th>
<th class="text-center">问卷类型</th>
<th class="text-center">问卷名称</th>
<th class="text-center">开始时间</th>
<th class="text-center">结束时间</th>
<th class="text-center">操作</th>
</tr>
</thead>
<tbody>
<tr v-for="questionAnswer in questionAnswerManageInfo.questionAnswers">
<td class="text-center">{{questionAnswer.qaId}}</td>
<td class="text-center">{{questionAnswer.qaType}}</td>
<td class="text-center">{{questionAnswer.qaName}}</td>
<td class="text-center">{{questionAnswer.startTime}}</td>
<td class="text-center">{{questionAnswer.endTime}}</td>
<td class="text-center"><div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openEditQuestionAnswerModel(questionAnswer)">修改</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs" v-on:click="_openDeleteQuestionAnswerModel(questionAnswer)">删除</button>
</div></td>
<tr v-for="questionAnswer in questionAnswerManageInfo.questionAnswers">
<td class="text-center">{{questionAnswer.qaId}}</td>
<td class="text-center">{{questionAnswer.qaTypeName}}</td>
<td class="text-center">{{questionAnswer.qaName}}</td>
<td class="text-center">{{questionAnswer.startTime}}</td>
<td class="text-center">{{questionAnswer.endTime}}</td>
<td class="text-center">
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_toQuestionAnswerTitle(questionAnswer)">题目</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openEditQuestionAnswerModel(questionAnswer)">修改</button>
</div>
<div class="btn-group">
<button class="btn-white btn btn-xs"
v-on:click="_openDeleteQuestionAnswerModel(questionAnswer)">删除</button>
</div>
</td>
</tr>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
<tr>
<td colspan="7">
<ul class="pagination float-right"></ul>
</td>
</tr>
</tfoot>
</table>
<!-- 分页 -->
@ -94,13 +108,10 @@
</div>
</div>
<vc:create path="property/addQuestionAnswer"
callBackListener=""
callBackFunction=""
></vc:create>
<vc:create path="property/addQuestionAnswer" callBackListener="" callBackFunction=""></vc:create>
<vc:create path="property/editQuestionAnswer"></vc:create>
<vc:create path="property/deleteQuestionAnswer"></vc:create>
</div>
</div>

View File

@ -1,85 +1,88 @@
/**
入驻小区
**/
(function(vc){
(function (vc) {
var DEFAULT_PAGE = 1;
var DEFAULT_ROWS = 10;
vc.extends({
data:{
questionAnswerManageInfo:{
questionAnswers:[],
total:0,
records:1,
moreCondition:false,
qaId:'',
conditions:{
qaType:'',
qaName:'',
qaId:'',
data: {
questionAnswerManageInfo: {
questionAnswers: [],
total: 0,
records: 1,
moreCondition: false,
qaId: '',
conditions: {
qaType: '',
qaName: '',
qaId: '',
communityId:vc.getCurrentCommunity().communityId
}
}
},
_initMethod:function(){
_initMethod: function () {
vc.component._listQuestionAnswers(DEFAULT_PAGE, DEFAULT_ROWS);
},
_initEvent:function(){
vc.on('questionAnswerManage','listQuestionAnswer',function(_param){
vc.component._listQuestionAnswers(DEFAULT_PAGE, DEFAULT_ROWS);
_initEvent: function () {
vc.on('questionAnswerManage', 'listQuestionAnswer', function (_param) {
vc.component._listQuestionAnswers(DEFAULT_PAGE, DEFAULT_ROWS);
});
vc.on('pagination','page_event',function(_currentPage){
vc.component._listQuestionAnswers(_currentPage,DEFAULT_ROWS);
vc.on('pagination', 'page_event', function (_currentPage) {
vc.component._listQuestionAnswers(_currentPage, DEFAULT_ROWS);
});
},
methods:{
_listQuestionAnswers:function(_page, _rows){
methods: {
_listQuestionAnswers: function (_page, _rows) {
vc.component.questionAnswerManageInfo.conditions.page = _page;
vc.component.questionAnswerManageInfo.conditions.row = _rows;
var param = {
params:vc.component.questionAnswerManageInfo.conditions
};
params: vc.component.questionAnswerManageInfo.conditions
};
//发送get请求
vc.http.apiGet('questionAnswer.listQuestionAnswers',
param,
function(json,res){
var _questionAnswerManageInfo=JSON.parse(json);
vc.component.questionAnswerManageInfo.total = _questionAnswerManageInfo.total;
vc.component.questionAnswerManageInfo.records = _questionAnswerManageInfo.records;
vc.component.questionAnswerManageInfo.questionAnswers = _questionAnswerManageInfo.data;
vc.emit('pagination','init',{
total:vc.component.questionAnswerManageInfo.records,
currentPage:_page
});
},function(errInfo,error){
console.log('请求失败处理');
}
);
//发送get请求
vc.http.apiGet('/questionAnswer/queryQuestionAnswer',
param,
function (json, res) {
var _questionAnswerManageInfo = JSON.parse(json);
vc.component.questionAnswerManageInfo.total = _questionAnswerManageInfo.total;
vc.component.questionAnswerManageInfo.records = _questionAnswerManageInfo.records;
vc.component.questionAnswerManageInfo.questionAnswers = _questionAnswerManageInfo.data;
vc.emit('pagination', 'init', {
total: vc.component.questionAnswerManageInfo.records,
currentPage: _page
});
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_openAddQuestionAnswerModal:function(){
vc.emit('addQuestionAnswer','openAddQuestionAnswerModal',{});
_openAddQuestionAnswerModal: function () {
vc.emit('addQuestionAnswer', 'openAddQuestionAnswerModal', {});
},
_openEditQuestionAnswerModel:function(_questionAnswer){
vc.emit('editQuestionAnswer','openEditQuestionAnswerModal',_questionAnswer);
_openEditQuestionAnswerModel: function (_questionAnswer) {
vc.emit('editQuestionAnswer', 'openEditQuestionAnswerModal', _questionAnswer);
},
_openDeleteQuestionAnswerModel:function(_questionAnswer){
vc.emit('deleteQuestionAnswer','openDeleteQuestionAnswerModal',_questionAnswer);
_openDeleteQuestionAnswerModel: function (_questionAnswer) {
vc.emit('deleteQuestionAnswer', 'openDeleteQuestionAnswerModal', _questionAnswer);
},
_queryQuestionAnswerMethod:function(){
_queryQuestionAnswerMethod: function () {
vc.component._listQuestionAnswers(DEFAULT_PAGE, DEFAULT_ROWS);
},
_moreCondition:function(){
if(vc.component.questionAnswerManageInfo.moreCondition){
_toQuestionAnswerTitle:function(_questionAnswer){
},
_moreCondition: function () {
if (vc.component.questionAnswerManageInfo.moreCondition) {
vc.component.questionAnswerManageInfo.moreCondition = false;
}else{
} else {
vc.component.questionAnswerManageInfo.moreCondition = true;
}
}
}
});
})(window.vc);