ChainListScript.blade.php
8.18 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<script>
layui.use(['table', 'form', 'element', 'upload', 'layer', 'Split', 'soulTable', 'admin', 'xmSelect'], function () {
let $ = layui.jquery;
let Split = layui.Split;
let table = layui.table;
let upload = layui.upload;
let form = layui.form;
let admin = layui.admin;
let xmSelect = layui.xmSelect;
let initCondition = {source_type: 'all'};
let whereCondition = initCondition;
let type = 'all';
var soulTable = layui.soulTable;
//监听复选框事件,被选中的行高亮显示
table.on('checkbox(chainList)', function (obj) {
});
let cols = [
{type: 'checkbox', fixed: true},
{field: 'chain_id', title: '序号', align: 'center', width: 80},
{field: 'com_name', title: '公司名称', align: 'center', width: 250},
{field: 'is_entity_name', title: '实体名单', align: 'center', width: 100},
{field: 'check_status_name', title: '跟进结果', align: 'center', width: 100},
{
field: 'chain_check',
title: '跟进记录',
align: 'center',
width: 100,
childTitle: '跟进记录',
show: 2,
layerOption: {title: '跟进记录', area: '1000px',},
children: [
{
title: '子表',
height: 300,
data: function (row) {
return row.sub;
},
size: 'sm',
page: true,
cols: [[
{field: 'check_status_name', title: '跟进结果', width: 100},
{field: 'check_time', title: '跟进时间', width: 150},
{field: 'check_content', title: '跟进内容'},
{field: 'check_name', title: '跟进人', width: 150},
]],
toolEvent: function (obj, pobj) {
},
}
],
templet: function () {
return '<span style="color: dodgerblue" class="view_check">查看记录</span>';
},
},
{
field: 'has_supplier', title: '是否建档', align: 'center', width: 100, templet: function (data) {
return data.supplier && data.com_name ? '是' : '否';
}
},
{field: 'company_nature', title: '公司性质', align: 'center', width: 100},
{field: 'region', title: '所在区域', align: 'center', width: 100},
{field: 'link_name', title: '联系人', align: 'center', width: 170},
{field: 'position', title: '职位', align: 'center', width: 100},
{
field: 'mobile', title: '联系方式', align: 'center', width: 160,
templet: function (data) {
let text = '查看';
return '<span>' + data.mobile + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewChain" type="mobile" id="' + data.chain_id + '">' + text + '</span>';
}
},
{
field: 'email', title: '邮箱', align: 'center', width: 250,
templet: function (data) {
if (data.email) {
let text = '查看';
return '<span>' + data.email + '</span><span style="color: dodgerblue;margin-left: 10px" class="viewChain" type="email" id="' + data.chain_id + '">' + text + '</span>';
}
return '';
}
},
{
field: 'main_product_type', title: '主营产品', align: 'center', width: 160,
},
{
field: 'main_brand', title: '主营品牌', align: 'center', width: 160
},
{field: 'supplier_type_name', title: '入驻类型', align: 'center', width: 100},
{field: 'data_type_name', title: '来源', align: 'center', width: 100},
{field: 'ip_address', title: 'IP地址', align: 'center', width: 150},
{field: 'create_time', title: '创建时间', align: 'center', width: 150},
];
let currentPage = 0;
let url = '/api/chain/GetChainList';
$('#three_days_button').remove();
table.render({
elem: '#chainList'
, url: url
, method: 'post'
, size: 'sm'
, limit: 20
, height: 600
, cellMinWidth: 50 //全局定义常规单元格的最小宽度
, where: whereCondition
, loading: true
, first: true //不显示首页
, last: false //不显示尾页
, cols: [cols]
, id: 'chainList'
, page: {}
, done: function (res, curr, count) {
soulTable.render(this);
currentPage = curr;
}
});
$(document).on('click', '.view_check', function (e) {
$(this).prev().click();
});
form.on('submit(load)', function (data) {
whereCondition = $.extend(false, initCondition, data.field);
//执行重载
table.reload('chainList', {
page: {
curr: 1
}
, where: whereCondition
});
return false;
});
form.on('submit(reset)', function (data) {
layer.load(1);
location.reload();
});
$(document).on('click', '.viewChain', function (e) {
if ($(this).text() === '隐藏') {
$(this).prev().text($(this).attr('prev_text'));
$(this).text('查看');
} else {
let chainId = $(this).attr('id');
let type = $(this).attr('type');
let resp = ajax('/api/chain/GetChain', {chain_id: chainId, type: type});
if (!resp) {
layer.msg('网络连接失败', {'icon': 5});
return false;
}
let prevText = $(this).prev().text();
$(this).attr('prev_text', prevText);
if (resp.err_code === 0) {
switch (type) {
case 'mobile':
$(this).prev().text(resp.data.mobile);
break;
case 'email':
$(this).prev().text(resp.data.email);
break;
}
$.get(getLogDomain() + "/api/addSensitiveClick", {
uid: getCookie("oa_user_id") || 0,
sys_id: 4,
mask_type: type || 0,
origin_id: chainId || 0,
source_from: window.location.href
});
$(this).text('隐藏');
} else {
layer.msg(resp.err_msg, {'icon': 5});
return false;
}
}
});
//审批供应商弹窗
$("#checkStatus").click(function () {
let checkStatus = table.checkStatus('chainList');
let data = checkStatus.data;
if (!data.length) {
layer.msg('请先选择要操作的供应商', {icon: 5})
} else {
if (data.length > 1) {
layer.msg('该操作不支持多选', {icon: 5})
return;
}
let chainId = data[0].chain_id;
let status = data[0].status;
layer.open({
type: 2,
content: '/chain/CheckChain?view=iframe&chain_id=' + chainId,
area: ['800px', '65%'],
title: '跟进情况',
end: function () {
table.reload('chainList');
}
});
}
})
});
</script>