addQuestionnaire.html 10.2 KB
<div class="inmodal">
    <div class="modal-header">
        <h4 class="modal-title">{{mark == 'edit' ? '编辑问卷' : '新建问卷'}}</h4>
        <button type="button" class="close" data-dismiss="modal" ng-click="$dismiss()">
            <span aria-hidden="true">×</span> <span class="sr-only">Close</span>
        </button>
    </div>
    <div class="modal-body ofy-visible">

        <form class="form-horizontal form-fixed form-fixed-6" role="form" name="questionnaireForm" novalidate>
            <div class="ibox-content">
                <div class="form-group">
                    <label class="col-sm-3 control-label required">请输入问卷名称</label>
                    <div class="col-sm-4">
                        <input type="text" class="form-control" name="name" ng-model="questionnaire.name" onkeydown="if(event.keyCode==13){event.returnValue=false;}"
                               placeholder="最多不超过30个字" maxlength="30" required>
                        <div class="m-t-xs" ng-show="questionnaireForm.name.$invalid && submitted">
                            <small class="text-danger" ng-show="questionnaireForm.name.$error.required">标题不能为空</small>
                        </div>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-3 control-label required">请输入问卷类型</label>
                    <div class="col-sm-4">
                        <label class="checkbox-inline p-l-none">
                            <input icheck name="type" type="radio" ng-required="saveFlag" ng-model="questionnaire.type" ng-value="1">
                            打分型
                        </label>
                        <label class="checkbox-inline p-l-none">
                            <input icheck name="type" type="radio" ng-required="saveFlag" ng-model="questionnaire.type" ng-value="2">
                            多选型
                        </label>
                        <div class="m-t-xs" ng-show="questionnaireForm.type.$invalid && submitted">
                            <small class="text-danger" ng-show="questionnaireForm.type.$error.required">不能为空</small>
                        </div>
                    </div>
                </div>
            </div>
            <div class="ibox-content" ng-show="questionnaire.type == 1">
                <div class="form-group">
                    <div class="col-sm-3 control-label">
                        <button class="btn btn-primary aButton" ng-click="addQuestion();">+添加问题</button>
                        <input type="hidden" name="question" ng-model="gradeQuestions[0]" ng-required="saveFlag && questionnaire.type == 1">
                        <div class="m-t-xs" ng-show="questionnaireForm.question.$invalid && submitted">
                            <small class="text-danger" ng-show="questionnaireForm.question.$error.required">请添加问题</small>
                        </div>
                    </div>
                    <br>
                    <span style="color: #FF6702;padding-left: 4%">(帮助:问卷按照序号从小到大排序)</span>
                </div>
                <div class="form-group" ng-repeat="item in gradeQuestions">
                    <label class="col-sm-3 control-label required">序号:{{item.serialNumber = gradeQuestions.length - $index}}</label>
                    <label class="col-sm-3 control-label" style="width: 70px;">问题:</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" name="{{'questionName' + $index}}" ng-model="item.title"
                               placeholder="最多不超过30个字" maxlength="30" ng-required="questionnaire.type == 1">
                        <div class="m-t-xs" ng-show="questionnaireForm['questionName' + $index].$invalid && submitted">
                            <small class="text-danger" ng-show="questionnaireForm['questionName' + $index].$error.required">问题不能为空
                            </small>
                        </div>
                    </div>
                    <div>
                        <label class="col-sm-3 control-label" style="width: 58px;">满分:</label>
                        <div class="col-sm-1 " style="width: 11%;">
                            <input type="text" class="form-control" name="{{'score' + $index}}" ng-model="item.scoreScale" maxlength="3" ng-required="questionnaire.type == 1" v-async="validNum(value)">
                            <div class="m-t-xs" ng-show="questionnaireForm['score' + $index].$invalid && submitted">
                                <small class="text-danger" ng-show="questionnaireForm['score' + $index].$error.required">请输入分数</small>
                                <small class="text-danger" ng-show="questionnaireForm['score' + $index].$error.vAsync">格式不正确</small>
                            </div>
                        </div>
                    </div>
                    <div class="form-inline">
                        <div class="form-group" ng-show="questionnaire.type == 1"><a class="btn btn-link" ng-click="delete($index)">分</a></div>
                        <div class="form-group"><a style="color: #00a479;width: 90px;" class="btn btn-link" ng-click="delete($index)">删除</a></div>
                    </div>
                </div>
            </div>

            <div class="ibox-content" ng-show="questionnaire.type == 2">
                <div class="form-group">
                    <div class="col-sm-3 control-label">
                        <button class="btn btn-primary aButton" ng-click="addQuestion();">+添加问题</button>
                        <input type="hidden" name="question1" ng-model="selectQuestions[0]" ng-required="saveFlag && questionnaire.type == 2">
                        <div class="m-t-xs" ng-show="questionnaireForm.question1.$invalid && submitted">
                            <small class="text-danger" ng-show="questionnaireForm.question1.$error.required">请添加问题</small>
                        </div>
                    </div>
                    <br>
                    <span style="color: #FF6702;padding-left: 4%">(帮助:问卷按照序号从小到大排序)</span>
                </div>

                <div class="form-group" ng-repeat="item in selectQuestions">
                    <label class="col-sm-3 control-label required">序号:{{item.serialNumber = selectQuestions.length - $index}}</label>
                    <label class="col-sm-3 control-label" style="width: 70px;">问题:</label>
                    <div class="col-sm-6">
                        <input type="text" class="form-control" name="{{'questionName1' + $index}}" ng-model="item.title"
                               placeholder="最多不超过30个字" maxlength="30" ng-required="questionnaire.type == 2">
                        <div class="m-t-xs" ng-show="questionnaireForm['questionName1' + $index].$invalid && submitted">
                            <small class="text-danger" ng-show="questionnaireForm['questionName1' + $index].$error.required">问题不能为空
                            </small>
                        </div>
                    </div>
                    <div class="form-inline">
                        <div class="form-group"><a style="color: #00a479;width: 90px;" class="btn btn-link" ng-click="delete($index)">删除</a></div>
                    </div>
                </div>
            </div>

            <div class="ibox-content">
                <div class="form-group">
                    <div class="col-sm-3 control-label">
                        <button class="btn btn-primary aButton" ng-click="import('importQuestionItem')">+导入被调查商户</button>
                        <input type="hidden" name="importQuestionItemName" ng-model="importQuestionItem.execlName" ng-required="saveFlag">
                        <div class="m-t-xs" ng-show="questionnaireForm.importQuestionItemName.$invalid && submitted">
                            <small class="text-danger" ng-show="questionnaireForm.importQuestionItemName.$error.required">请导入被调查商户</small>
                        </div>
                    </div>
                    <br>
                    <span style="padding-left: 4%">(帮助:“被调查商户”将作为问题的选项。)</span>
                </div>
                <div class="form-group">
                    <a class="col-sm-3 control-label investigate">{{importQuestionItem.execlName}}</a>
                </div>
            </div>

            <div class="ibox-content">
                <div class="form-group">
                    <div class="col-sm-3 control-label">
                        <button class="btn btn-primary aButton" ng-click="import('importRespondents')">+导入调查商户</button>
                        <input type="hidden" name="importRespondentsName" ng-model="importRespondents.execlName" ng-required="saveFlag">
                        <div class="m-t-xs" ng-show="questionnaireForm.importRespondentsName.$invalid && submitted">
                            <small class="text-danger" ng-show="questionnaireForm.importRespondentsName.$error.required">请导入调查商户</small>
                        </div>
                    </div>
                    <br>
                    <span style="padding-left: 4%">(帮助:“调查商户”将作为问卷的回答者。)</span>
                </div>
                <div class="form-group">
                    <a class="col-sm-3 control-label investigate">{{importRespondents.execlName}}</a>
                </div>
            </div>

        </form>
    </div>
    <div class="modal-footer">
        <button class="btn btn-primary" ng-click="draft()" ladda="submiting" data-style="expand-right" ng-disabled="saveBtnDisabled">
            存草稿
        </button>
        <button class="btn btn-primary"  ng-click="save()" ladda="submiting" data-style="expand-right" ng-disabled="saveBtnDisabled">
            保存正式问卷
        </button>
        <button type="button" class="btn btn-default" ng-click="$dismiss()">返回</button>
    </div>
</div>
<style type="text/css">
    .investigate{
        color: #337ab7;
        text-decoration: underline;
        width: 120px !important;
    }
</style>