scripts.html
3.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<script src="__STATIC__/js/admin.js"></script>
<script>
Wind.use('colorpicker', function () {
$('.js-color').each(function () {
var $this = $(this);
$this.ColorPicker({
livePreview: true,
onChange: function (hsb, hex, rgb) {
$this.val('#' + hex);
},
onBeforeShow: function () {
$(this).ColorPickerSetColor(this.value);
}
});
});
});
function doSelectData(obj) {
var $obj = $(obj);
var $realInput = $obj.next();
var selectedObjectsId = $realInput.val();
var dataSource = $obj.data('source');
var title = $obj.data('title');
parent.openIframeLayer("{:url('theme/dataSource')}?ids=" + selectedObjectsId + '&data_source=' + dataSource, title, {
area: ['95%', '90%'],
btn: ['确定', '取消'],
yes: function (index, layero) {
var iframeWin = parent.window[layero.find('iframe')[0]['name']];
var selectedObjects = iframeWin.confirm();
if (selectedObjects.selectedObjectsId.length == 0) {
layer.msg('您没有选择任何数据!');
return;
}
$realInput.val(selectedObjects.selectedObjectsId.join(','));
$obj.val(selectedObjects.selectedObjectsName.join(','));
parent.layer.close(index); //如果设定了yes回调,需进行手工关闭
}
});
}
function doEditArrayData(obj) {
var $obj = $(obj);
var mVar = $obj.data('var');
var title = $obj.data('title');
var widget = $obj.data('widget');
widget = widget ? '&widget=' + widget : '';
var fileId = $obj.data('file_id');
if (!fileId) {
fileId = '{$file_id}';
}
parent.openIframeLayer(
"{:url('theme/fileArrayData')}?tab={$tab}&file_id="+fileId+"&" + 'var=' + mVar + widget,
title,
{
area: ['95%', '90%'],
btn: ['确定', '取消'],
yes: function (index, layero) {
var iframeWin = parent.window[layero.find('iframe')[0]['name']];
var result = iframeWin.confirm();
if (result) {
parent.layer.close(index); //如果设定了yes回调,需进行手工关闭
}
}
}
);
}
function doSelectLocation(obj) {
var $obj = $(obj);
var title = $obj.data('title');
var $realInput = $obj.next();
var location = $realInput.val();
parent.openIframeLayer(
"{:url('dialog/map')}?location=" + location,
title,
{
area: ['95%', '90%'],
btn: ['确定', '取消'],
yes: function (index, layero) {
var iframeWin = parent.window[layero.find('iframe')[0]['name']];
var location = iframeWin.confirm();
$realInput.val(location.lng + ',' + location.lat);
$obj.val(location.address);
parent.layer.close(index); //如果设定了yes回调,需进行手工关闭
}
}
);
}
function confirm() {
$('#submit-btn').click();
}
function removeImage(wigetVarName) {
//需要定位input和image
//清空Input
$('#js-' + wigetVarName + '-input').val('');
//修改Image为原图。
var defaultImage = $('#js-' + wigetVarName + '-button-remove').attr('defaultImage');
$('#js-' + wigetVarName + '-input-preview').attr('src', defaultImage);
//移除自身
$('#js-' + wigetVarName + '-button-remove').remove();
}
</script>