|
@@ -22,8 +22,8 @@
|
|
|
<button class="btn btn-primary btn-sm" onclick="importRule()"><i
|
|
|
class="fa fa-fw fa-cloud-upload fa-lg"></i>导入关键词
|
|
|
</button>
|
|
|
- <!-- <a class="btn btn-sm btn-instagram" onclick="produceData()"><i class="fa fa-fw fa-database fa-lg"></i>快速预览</a> -->
|
|
|
- <!-- <button id="previewDatas" class="btn btn-warning btn-sm" onclick="previewData()"><i class="fa fa-fw fa-eye fa-lg"></i>数据导出</button> -->
|
|
|
+ <a class="btn btn-sm btn-instagram previewDatass" onclick="previewData1()"><i class="fa fa-fw fa-database fa-lg"></i>快速预览</a>
|
|
|
+ <button id="previewData" class="btn btn-warning btn-sm previewDatass" onclick="previewData()"><i class="fa fa-fw fa-eye fa-lg"></i>数据导出</button>
|
|
|
<form style="display:none" id='uploadform' method='post'>
|
|
|
<input type='file' name='xlsx' id='file'/>
|
|
|
</form>
|
|
@@ -393,7 +393,7 @@
|
|
|
{{include "com/footer.html"}}
|
|
|
<script>
|
|
|
$('#back').attr("href", "javascript:history.go(-1)")
|
|
|
- $("#previewDatas").hide()
|
|
|
+ $(".previewDatass").hide()
|
|
|
|
|
|
// menuActive("/customer/list");
|
|
|
var state = 1;
|
|
@@ -1532,11 +1532,12 @@
|
|
|
if (r.rep && r.id) {
|
|
|
dataMap["id"] = r.id;
|
|
|
dataMap["s_dataid"] = r.s_dataid;
|
|
|
+ dataMap["s_esquery"] = r.s_esquery;
|
|
|
$('#es_div').show();
|
|
|
$('#estxt').val(r.s_esquery);
|
|
|
state = 2;
|
|
|
showTip("保存成功", 1000);
|
|
|
- $("#previewDatas").show()
|
|
|
+ $(".previewDatass").show()
|
|
|
} else {
|
|
|
showTip("保存失败", 1000);
|
|
|
}
|
|
@@ -1581,35 +1582,328 @@
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
+
|
|
|
+ function produceData() {
|
|
|
+ com.maskShow("正在生成数据...");
|
|
|
+ var isOk = true
|
|
|
+ setTimeout(function(){
|
|
|
+ $.ajax({
|
|
|
+ url: "/customerRule/cuser/produce",
|
|
|
+ type: "post",
|
|
|
+ data: {"id": dataMap.id},
|
|
|
+ async: false,
|
|
|
+ success: function (r) {
|
|
|
+ if (r.msg){
|
|
|
+ com.maskHide();
|
|
|
+ isOk = false
|
|
|
+ showTip(r.msg, 30000);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ error: function (r) {
|
|
|
+ com.maskHide();
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (isOk) {
|
|
|
+ com.maskShow("倒计时3s");
|
|
|
+ setTimeout(function(){
|
|
|
+ com.maskShow("倒计时2s");
|
|
|
+ setTimeout(function(){
|
|
|
+ com.maskShow("倒计时1s");
|
|
|
+ setTimeout(function(){
|
|
|
+ com.maskShow("倒计时0s");
|
|
|
+ var href = previewHref+"?type=private" + "&key=" + dataMap.s_dataid;
|
|
|
+ window.open(href);
|
|
|
+ com.maskHide();
|
|
|
+ },1000)
|
|
|
+ },1000)
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
+ },1000)
|
|
|
+ }
|
|
|
|
|
|
//生成数据
|
|
|
- function produceData() {
|
|
|
- if (dataMap.id == undefined || dataMap.id == "") {
|
|
|
- alert("请先保存规则");
|
|
|
- return
|
|
|
- }
|
|
|
+ function previewData1() {
|
|
|
com.maskShow("正在生成数据...");
|
|
|
$.ajax({
|
|
|
- url: "/customerRule/cuser/produce",
|
|
|
+ url: "/customerRule/rule/preview",
|
|
|
type: "post",
|
|
|
- data: {"id": dataMap.id},
|
|
|
+ data: {"id": dataMap.id,"esquery": dataMap.s_esquery},
|
|
|
+ async: false,
|
|
|
success: function (r) {
|
|
|
- com.maskHide();
|
|
|
- if (r.rep === true) {
|
|
|
- dataMap.i_estotal = r.count;
|
|
|
- showTip("数据生成成功", 1000);
|
|
|
- } else if (r.rep === false) {
|
|
|
- showTip(r.msg, 30000);
|
|
|
- } else {
|
|
|
- showTip("数据生成失败", 12000);
|
|
|
- }
|
|
|
-
|
|
|
+ dataMap.i_estotal = r.count;
|
|
|
+ dataMap.datas = r.data;
|
|
|
},
|
|
|
- error: function (r) {
|
|
|
- com.maskHide();
|
|
|
- }
|
|
|
})
|
|
|
+ myDataTable = $('#previewData').DataTable({
|
|
|
+ "destroy": false,
|
|
|
+ "paging": true,
|
|
|
+ "lengthChange": false,
|
|
|
+ "searching": false,
|
|
|
+ "ordering": false,
|
|
|
+ "info": true,
|
|
|
+ "autoWidth": true,
|
|
|
+ "serverSide": false,
|
|
|
+ "data": dataMap.datas,
|
|
|
+ "language": {
|
|
|
+ "url": "/dist/js/dataTables.chinese.lang"
|
|
|
+ },
|
|
|
+ "fnDrawCallback": function () {
|
|
|
+ $("ul.pagination").prepend(" 转到第 <input type='text' id='changePage' style='width:20px;'> 页 <a type='text' href='javascript:void(0);' id='dataTable-btn' style='text-align:center'>GO</a>");
|
|
|
+ $('#dataTable-btn').click(function (e) {
|
|
|
+ var redirectpage = 0
|
|
|
+ if ($("#changePage").val() && $("#changePage").val() > 0) {
|
|
|
+ var redirectpage = $("#changePage").val() - 1;
|
|
|
+ }
|
|
|
+ myDataTable.page(redirectpage).draw(false);
|
|
|
+ });
|
|
|
+ this.api().column(0).nodes().each(function (cell, i) {
|
|
|
+ cell.innerHTML = i + 1;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ "columns": [
|
|
|
+ {"data": null, width: "2%"},
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.s_matchkey) {
|
|
|
+ return row.s_matchkey
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "8%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.area) {
|
|
|
+ return row.area
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.city) {
|
|
|
+ return row.city
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.s_jyhref) {
|
|
|
+ if (row.title.length > 36) {
|
|
|
+ var str = row.title.substring(0, 36) + "..."
|
|
|
+ } else {
|
|
|
+ var str = row.title
|
|
|
+ }
|
|
|
+ tmp = '<a class="" target="_blank" href=' + row.s_jyhref + '>' + str + '</a>';
|
|
|
+ return tmp
|
|
|
+ } else {
|
|
|
+ return row.title
|
|
|
+ }
|
|
|
+ }, width: "5%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.subtype) {
|
|
|
+ return row.subtype
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.detail !== "" && row.detail !== undefined) {
|
|
|
+ var str = com.trimStr(row.detail);
|
|
|
+ if (str.length > 14) {
|
|
|
+ return str.substring(0, 14) + "..."
|
|
|
+ } else {
|
|
|
+ return str
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ row.detail = ""
|
|
|
+ }
|
|
|
+ }, width: "5%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ var dt = new Date();
|
|
|
+ dt.setTime(parseInt(row.publishtime) * 1000);
|
|
|
+ return dt.format("yyyy-MM-dd")
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.href) {
|
|
|
+ var shref = row.href;
|
|
|
+ tmp = '<a class="" target="_blank" href=' + shref + '>公告地址</a>';
|
|
|
+ return tmp
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "5%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.projectcode) {
|
|
|
+ return row.projectcode
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "5%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": "projectname", width: "5%", render: function (val) {
|
|
|
+ if (val === undefined) {
|
|
|
+ return ""
|
|
|
+ } else {
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.projectscope) {
|
|
|
+ if (row.projectscope.length > 14) {
|
|
|
+ return row.projectscope.substring(0, 14) + "..."
|
|
|
+ } else {
|
|
|
+ return row.projectscope
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ""
|
|
|
+ }, width: "3%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.budget == undefined) {
|
|
|
+ return ""
|
|
|
+ } else {
|
|
|
+ return row.budget
|
|
|
+ }
|
|
|
+ }, width: "3%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.bidamount == undefined) {
|
|
|
+ return ""
|
|
|
+ } else {
|
|
|
+ return row.bidamount
|
|
|
+ }
|
|
|
+ }, width: "3%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": "bidopentime", width: "3%", render: function (val) {
|
|
|
+ if (val) {
|
|
|
+ var dt = new Date();
|
|
|
+ dt.setTime(parseInt(val) * 1000);
|
|
|
+ return dt.format("yyyy-MM-dd")
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": "buyer", width: "3%", render: function (val) {
|
|
|
+ if (val == undefined) {
|
|
|
+ val = ""
|
|
|
+ }
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.buyerperson) {
|
|
|
+ return row.buyerperson
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.buyertel) {
|
|
|
+ return row.buyertel
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": "agency", width: "5%", render: function (val) {
|
|
|
+ if (val == undefined) {
|
|
|
+ val = ""
|
|
|
+ }
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": "s_winner", width: "3%", render: function (val) {
|
|
|
+ if (val == undefined) {
|
|
|
+ val = ""
|
|
|
+ }
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.winnerperson) {
|
|
|
+ return row.winnerperson
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.winnertel) {
|
|
|
+ return row.winnertel
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.legal_person) {
|
|
|
+ return row.legal_person
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.company_phone) {
|
|
|
+ return row.company_phone
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ {
|
|
|
+ "data": function (row) {
|
|
|
+ if (row.company_email) {
|
|
|
+ return row.company_email
|
|
|
+ } else {
|
|
|
+ return ""
|
|
|
+ }
|
|
|
+ }, width: "4%"
|
|
|
+ },
|
|
|
+ ]
|
|
|
+ });
|
|
|
+ setTimeout(function(){
|
|
|
+ com.maskHide();
|
|
|
+ var str = "预览时间范围:近两个月,数据量:" + dataMap.i_estotal;
|
|
|
+ $('#dataCount').html(str);
|
|
|
+ $('#modal-preview').modal("show");
|
|
|
+ },3000)
|
|
|
}
|
|
|
+
|
|
|
+ $.fn.dataTable.ext.errMode = 'none';
|
|
|
+
|
|
|
+
|
|
|
|
|
|
var key_flag = -1; // 0:新增,1:修改
|
|
|
//关键词表格新增
|
|
@@ -1748,8 +2042,18 @@
|
|
|
return {flag: flag, v1: v1, v2: v2}
|
|
|
}
|
|
|
|
|
|
+ // function previewData(){
|
|
|
+ // var href = previewHref+"?type=private" + "&key=" + dataMap["s_dataid"];
|
|
|
+ // window.open(href);
|
|
|
+ // }
|
|
|
+
|
|
|
function previewData(){
|
|
|
- var href = previewHref+"?type=private" + "&key=" + dataMap["s_dataid"];
|
|
|
- window.open(href);
|
|
|
+ showConfirm("建议您在数据导出前先使用快速预览功能完成规则优化,数据导出需要提交预生成数据请求。", function () {
|
|
|
+ showConfirm("预生成数据后方可导出,确认加入生成数据队列?", function () {
|
|
|
+ produceData();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ // var href = previewHref+"?type=private" + "&key=" + dataMap.s_dataid;
|
|
|
+ // window.open(href);
|
|
|
}
|
|
|
</script>
|