basicinfo.js
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
define(['jquery', 'bootstrap', 'backend', 'form', 'table'], function ($, undefined, Backend, Form, Table) {
var Controller = {
edit: function(callback) {
var form = $("form[role=form]")
// 被删除的项目类型的id
var delProjectTypeId = []
// 监听单选按钮切换(限制报名人数)
$('.radio').on('change', 'input[type="radio"]', function () {
console.log($(this).attr('limitCount'));
// 限制人数
if ($(this).attr('limitCount')) {
$(this).parent().siblings('.js-countWrap').show()
} else {
$(this).parent().siblings('.js-countWrap').children('input').val('');
$(this).parent().siblings('.js-countWrap').hide();
}
})
// 移除项目类型
$(".fieldlist", form).on("click", ".btn-remove", function () {
var delId = $(this).parents('dd').find('input[type=hidden]').val()
if (!delId) {return}
delProjectTypeId.push(delId)
$('input[name="row[del_project_type_id]"]').val(delProjectTypeId.join(','))
});
if (callback) {
callback()
return
}
Form.api.bindevent($("form[role=form]"), function () {
top.location.reload()
});
},
add: function () {
Controller.edit(function () {
Form.api.bindevent($("form[role=form]"), function () {
top.window.$("ul.nav-addtabs li.active .close-tab").trigger("click");
});
})
},
api: {
bindevent: function () {
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});