freightTemplate.js
1.33 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
define(function( require, exports, module ) {
require( 'fancybox' );
require('validate.extend');
// addFancy();
addForm(function (dataBox) {
var tr = $("<tr></tr>");
// when append condition satisfied, clear the source box data.
$.each(dataBox, function (i) {
tr.append("<td>"+ dataBox[i].value + "</td>");
dataBox[i].value = '';
});
$("#tablist").append(tr);
$.fancybox.close();
});
function addFancy () {
var fancyTag = $("#getfancy");
var ope = $(".openservice");
var chk = ope.find('input');
$("#getfancy").fancybox({
});
ope.on({
click: function () {
console.log(chk[0].checked)
chk[0].checked ? fancyTag.click() : 0;
}
});
}
function addForm (fn) {
var _form = $("#fancyform");
var _ipts = _form.find('.oneline input');
var cache = [];
_form.validate({
submitHandler: function () {
$.each(_ipts, function (i) {
cache[i] = _ipts[i].value;
});
addTableData(cache, _ipts, fn);
}
});
$("#altersure").on({
click: function () {
_form.submit();
}
});
};
function addTableData (dataAry, dataBoxAry, fn) {
if ($("#tablist").length) {
!fn ? 0 : fn(dataBoxAry);
}else {
p = null;
};
};
});