DmitrMakeev
commited on
Commit
•
91549a2
1
Parent(s):
22e8554
Update data_gc_tab.html
Browse files- data_gc_tab.html +40 -8
data_gc_tab.html
CHANGED
@@ -140,6 +140,7 @@
|
|
140 |
|
141 |
</style>
|
142 |
</head>
|
|
|
143 |
<body>
|
144 |
<div id="header">
|
145 |
<h1>GetCurse - WhatsCRM</h1>
|
@@ -163,9 +164,9 @@
|
|
163 |
<option value="pr1">pr1</option>
|
164 |
<option value="pr2">pr2</option>
|
165 |
<option value="pr3">pr3</option>
|
166 |
-
<option value="pr4"
|
167 |
-
<option value="pr5"
|
168 |
-
<option value="key_pr">Ключ
|
169 |
<option value="canal">Канал</option>
|
170 |
<option value="data_t">Дата</option>
|
171 |
</select>
|
@@ -190,7 +191,7 @@
|
|
190 |
|
191 |
<script>
|
192 |
document.addEventListener('DOMContentLoaded', function() {
|
193 |
-
fetch('https://dmtuit-gc-api-
|
194 |
.then(response => response.json())
|
195 |
.then(data => {
|
196 |
console.log('Data received:', data); // Логирование данных
|
@@ -255,9 +256,9 @@
|
|
255 |
{title:"pr1", field:"pr1"},
|
256 |
{title:"pr2", field:"pr2"},
|
257 |
{title:"pr3", field:"pr3"},
|
258 |
-
{title:"
|
259 |
-
{title:"
|
260 |
-
{title:"Ключ
|
261 |
{title:"Канал", field:"canal"},
|
262 |
{title:"Дата", field:"data_t"}
|
263 |
],
|
@@ -277,7 +278,38 @@
|
|
277 |
// Update filters on value change
|
278 |
document.getElementById("filter-field").addEventListener("change", updateFilter);
|
279 |
document.getElementById("filter-type").addEventListener("change", updateFilter);
|
280 |
-
document.getElementById("filter-value").addEventListener("keyup", updateFilter
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
281 |
|
282 |
</body>
|
283 |
</html>
|
|
|
140 |
|
141 |
</style>
|
142 |
</head>
|
143 |
+
<body>
|
144 |
<body>
|
145 |
<div id="header">
|
146 |
<h1>GetCurse - WhatsCRM</h1>
|
|
|
164 |
<option value="pr1">pr1</option>
|
165 |
<option value="pr2">pr2</option>
|
166 |
<option value="pr3">pr3</option>
|
167 |
+
<option value="pr4">Канал трафика</option>
|
168 |
+
<option value="pr5">Дата</option>
|
169 |
+
<option value="key_pr">Ключ PR</option>
|
170 |
<option value="canal">Канал</option>
|
171 |
<option value="data_t">Дата</option>
|
172 |
</select>
|
|
|
191 |
|
192 |
<script>
|
193 |
document.addEventListener('DOMContentLoaded', function() {
|
194 |
+
fetch('https://dmtuit-gc-api-rass.hf.space/data_gc_tab_out?api_sys=fasSd345D')
|
195 |
.then(response => response.json())
|
196 |
.then(data => {
|
197 |
console.log('Data received:', data); // Логирование данных
|
|
|
256 |
{title:"pr1", field:"pr1"},
|
257 |
{title:"pr2", field:"pr2"},
|
258 |
{title:"pr3", field:"pr3"},
|
259 |
+
{title:"Канал трафика", field:"pr4"},
|
260 |
+
{title:"Дата", field:"pr5"},
|
261 |
+
{title:"Ключ PR", field:"key_pr"},
|
262 |
{title:"Канал", field:"canal"},
|
263 |
{title:"Дата", field:"data_t"}
|
264 |
],
|
|
|
278 |
// Update filters on value change
|
279 |
document.getElementById("filter-field").addEventListener("change", updateFilter);
|
280 |
document.getElementById("filter-type").addEventListener("change", updateFilter);
|
281 |
+
document.getElementById("filter-value").addEventListener("keyup", updateFilter);
|
282 |
+
// Clear filters on "Clear Filters" button click
|
283 |
+
document.getElementById("filter-clear").addEventListener("click", function() {
|
284 |
+
fieldEl.value = "";
|
285 |
+
typeEl.value = "=";
|
286 |
+
valueEl.value = "";
|
287 |
+
table.clearFilter();
|
288 |
+
});
|
289 |
+
// Переопределяем метод table.download
|
290 |
+
table.download = function(type, filename, options) {
|
291 |
+
// Сохраняем старые данные
|
292 |
+
var oldData = table.getData();
|
293 |
+
// Получаем новые данные таблицы
|
294 |
+
var tableData = table.getData("active");
|
295 |
+
// Преобразуем данные в JSON-строку
|
296 |
+
var jsonData = JSON.stringify(tableData, null, 2);
|
297 |
+
// Выводим JSON-строку в консоль
|
298 |
+
console.log(jsonData);
|
299 |
+
// Очищаем старые данные
|
300 |
+
table.setData([]);
|
301 |
+
// Восстанавливаем старые данные
|
302 |
+
table.setData(oldData);
|
303 |
+
};
|
304 |
+
// Пример использования переопределенного метода
|
305 |
+
document.getElementById("download-json").addEventListener("click", function() {
|
306 |
+
table.download("json", "data.json"); // ЭТУ СТРОКУ НЕ УДАЛЯТЬ!!! ЕЁ НАДО ПЕРЕХВАТИТЬ, А НЕ ТВОЙ КОД!!!
|
307 |
+
});
|
308 |
+
})
|
309 |
+
.catch(error => console.error('Error fetching data:', error));
|
310 |
+
});
|
311 |
+
</script>
|
312 |
+
</body>
|
313 |
|
314 |
</body>
|
315 |
</html>
|