You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
80 lines
2.8 KiB
JavaScript
80 lines
2.8 KiB
JavaScript
layui.define(['laydate', 'form', 'laydate', 'table','generalQuestionSettingApi'], function(exports) {
|
|
var form = layui.form;
|
|
var generalQuestionSettingApi = layui.generalQuestionSettingApi;
|
|
var index = layui.index;
|
|
var laydate= layui.laydate;
|
|
var classSelectData = [];
|
|
var x=$("#xx").data('value')
|
|
console.log(x)
|
|
var classData = Common.getAjax('/jlw/schoolClass/getValues.json').data;//上课班级多选框data
|
|
//班级值获取并处理成{name:xx,value:xx,selected:false}格式
|
|
classData.forEach(function (item, index) {
|
|
classSelectData[index] = {name: item.className, value: item.classId, selected: false}
|
|
});
|
|
var xmSeValue = $("#generalQuestionSettingSchoolClassIds").data('value');
|
|
|
|
var xmSeInitValue = [];
|
|
if(!$.isEmpty(xmSeValue)){
|
|
if(xmSeValue.toString().indexOf(",")>=0){
|
|
xmSeValue.split(',').forEach(function (value) {
|
|
xmSeInitValue.push(parseInt(value))
|
|
});
|
|
}else {
|
|
xmSeInitValue.push(xmSeValue)
|
|
}
|
|
}
|
|
|
|
/*班级下拉多选*/
|
|
var xmClassIds = xmSelect.render({
|
|
el: '#generalQuestionSettingSchoolClassIds',
|
|
name: 'generalQuestionSettingSchoolClassIds',
|
|
data: classSelectData,
|
|
initValue: xmSeInitValue,//xxxx为你当前的value值
|
|
/*theme: {
|
|
color: '#1e9fff',
|
|
},*/
|
|
});
|
|
//日期时间范围
|
|
laydate.render({
|
|
elem: '#generalQuestionStartTime'
|
|
,type: 'date'
|
|
,range: true
|
|
, trigger: 'click'
|
|
});
|
|
|
|
|
|
var view = {
|
|
init:function(){
|
|
Lib.initGenrealForm($("#addForm"),form);
|
|
this.initSubmit();
|
|
},
|
|
initSubmit:function(){
|
|
$("#addButton").click(function(){
|
|
form.on('submit(form)', function(){
|
|
var generalQuestionSettingId = $("#addForm input[name='generalQuestionSettingId']").val();
|
|
if(!$.isEmpty(generalQuestionSettingId)){
|
|
generalQuestionSettingApi.updateGeneralQuestionSetting($('#addForm'),function(){
|
|
parent.window.dataReload();
|
|
Common.info("更新成功");
|
|
Lib.closeFrame();
|
|
});
|
|
}else{
|
|
generalQuestionSettingApi.addGeneralQuestionSetting($('#addForm'),function(){
|
|
parent.window.dataReload();
|
|
Common.info("添加成功");
|
|
Lib.closeFrame();
|
|
});
|
|
}
|
|
|
|
});
|
|
});
|
|
|
|
$("#addButton-cancel").click(function(){
|
|
Lib.closeFrame();
|
|
});
|
|
}
|
|
|
|
}
|
|
exports('add',view);
|
|
});
|