operations.generateLinks.Index.js
2.02 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
webpackJsonp([91],[
/* 0 */
/***/ function(module, exports, __webpack_require__) {
/**
* Created by ty on 2016/6/17.
* 批量生成链接
*/
var $ = __webpack_require__(1);
common = __webpack_require__(2);
var module = {
channelId: 2,
linkType: "app"
},
singleModule = {
action: "go.brand",
linkType: "app"
};
var edit = new common.edit2("#generate-content");
var role = $("#wrap-content").attr("role"),
url = $("#wrap-content").attr("url");
var Bll = {
__render: function () {
$("#generate-content").html(common.util.__template2($("#content-template").html(), role == "complex" ? module : singleModule));
edit.init();
}
};
Bll.__render();
if(role == "single") {
$("#exportsearch").hide();
}
//生成
$(document).on("click", "#submitsearch", function () {
if(edit.validate()) {
module.linkType = $("#linkType").val();
singleModule.linkType = $("#linkType").val();
common.util.__ajax({
url: url,
data: role == "complex" ? module : singleModule
}, function (res) {
module.data = res.data;
singleModule.data = res.data;
Bll.__render();
});
}
});
//导出
$(document).on("click", "#exportsearch", function () {
if(edit.validate()) {
module.linkType = $("#linkType").val();
var temp = $.extend(true, {}, module);
delete temp.data;
window.open("/ajax/down?queryConf=" + JSON.stringify(temp) + "&type=linkExport");
}
});
$(document).on("change", ".observe", function () {
var name = $(this).data("field");
module[name] = $(this).val();
singleModule[name] = $(this).val();
});
//复制
$(document).on("click", ".copy", function() {
var Url2=document.getElementById($(this).data("link"));
Url2.select(); // 选择对象
document.execCommand("Copy"); // 执行浏览器复制命令
common.util.__tip("链接复制成功", "success");
});
/***/ }
]);