Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
synergy-components
Commits
218b8eb5
Commit
218b8eb5
authored
May 19, 2023
by
Samir Sadyhov
🤔
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
канбан-доска - добавлена выгрузка в ексель
parent
5b15a845
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
0 deletions
+82
-0
constructor/components/Канбан-доска/Канбан-доска.js
constructor/components/Канбан-доска/Канбан-доска.js
+82
-0
No files found.
constructor/components/Канбан-доска/Канбан-доска.js
View file @
218b8eb5
$
.
getScript
(
"
https://cdnjs.cloudflare.com/ajax/libs/alasql/0.6.1/alasql.min.js
"
);
const
compContainer
=
$
(
`#
${
comp
.
code
}
`
);
const
compContainer
=
$
(
`#
${
comp
.
code
}
`
);
const
boardContent
=
compContainer
.
find
(
'
.kanban-board-content
'
);
const
boardContent
=
compContainer
.
find
(
'
.kanban-board-content
'
);
...
@@ -13,6 +15,25 @@ const getRegistryList = async () => {
...
@@ -13,6 +15,25 @@ const getRegistryList = async () => {
});
});
}
}
const
formatDate
=
()
=>
{
let
d
=
new
Date
();
return
[
'
0
'
+
d
.
getDate
(),
'
0
'
+
(
d
.
getMonth
()
+
1
),
''
+
d
.
getFullYear
()].
map
(
x
=>
x
.
slice
(
-
2
)).
join
(
'
.
'
);
}
const
getSystemReport
=
()
=>
{
Cons
.
showLoader
();
AS
.
FORMS
.
ApiUtils
.
simpleAsyncGet
(
`rest/api/registry/filters?registryCode=
${
KanbanBoard
.
registryCode
}
&type=service`
)
.
then
(
filters
=>
{
let
filterID
=
filters
.
find
(
x
=>
x
.
code
===
KanbanBoard
.
filterCode
);
if
(
filterID
)
filterID
=
filterID
.
id
;
Cons
.
hideLoader
();
let
url
=
`
${
window
.
location
.
origin
}
/Synergy/rest/reg/load/xls?r=
${
KanbanBoard
.
registryID
}
`
;
url
+=
`&l=ru&f=
${
filterID
||
''
}
&s=&u=
${
AS
.
OPTIONS
.
currentUser
.
userid
}
&fn=
${
KanbanBoard
.
registryName
}
_
${
formatDate
()}
`
;
window
.
open
(
url
);
});
}
const
KanbanBoard
=
{
const
KanbanBoard
=
{
registryCode
:
null
,
registryCode
:
null
,
registryID
:
null
,
registryID
:
null
,
...
@@ -27,6 +48,8 @@ const KanbanBoard = {
...
@@ -27,6 +48,8 @@ const KanbanBoard = {
fieldDict
:
null
,
fieldDict
:
null
,
countInPart
:
5
,
countInPart
:
5
,
heads
:
[],
columns
:
[],
columns
:
[],
searchString
:
null
,
searchString
:
null
,
filterSearchUrl
:
null
,
filterSearchUrl
:
null
,
...
@@ -50,6 +73,15 @@ const KanbanBoard = {
...
@@ -50,6 +73,15 @@ const KanbanBoard = {
return
''
;
return
''
;
},
},
getFullDataUrl
:
function
(){
let
url
=
`api/registry/data_ext?registryCode=
${
this
.
registryCode
}
`
;
if
(
this
.
filterCode
)
url
+=
`&filterCode=
${
this
.
filterCode
}
`
;
if
(
this
.
heads
&&
this
.
heads
.
length
>
0
)
this
.
heads
.
forEach
(
item
=>
url
+=
`&fields=
${
item
.
columnID
}
`
);
if
(
this
.
searchString
)
url
+=
`&searchString=
${
this
.
searchString
}
`
;
if
(
this
.
filterSearchUrl
)
url
+=
this
.
filterSearchUrl
;
return
url
;
},
getUrlParam
:
function
(
column
)
{
getUrlParam
:
function
(
column
)
{
const
{
key
,
currentPage
,
countInPart
}
=
column
;
const
{
key
,
currentPage
,
countInPart
}
=
column
;
let
param
=
`?registryCode=
${
this
.
registryCode
}
`
;
let
param
=
`?registryCode=
${
this
.
registryCode
}
`
;
...
@@ -642,6 +674,16 @@ const KanbanBoard = {
...
@@ -642,6 +674,16 @@ const KanbanBoard = {
if(!registry.rights.includes("rr_list")) throw new Error(`
Нет
прав
на
просмотр
данного
реестра
`);
if(!registry.rights.includes("rr_list")) throw new Error(`
Нет
прав
на
просмотр
данного
реестра
`);
const info = await appAPI.getRegistryInfo(registryCode);
const info = await appAPI.getRegistryInfo(registryCode);
this.heads = info.columns.filter(item => item.visible != '0')
.sort((a, b) => {
if (a.order == 0) return 0;
return a.order - b.order;
})
.map(item => {
return {label: item.label, columnID: item.columnID}
});
this.registryCode = registryCode;
this.registryCode = registryCode;
this.filterCode = filterCode;
this.filterCode = filterCode;
this.registryID = info.registryID;
this.registryID = info.registryID;
...
@@ -707,6 +749,46 @@ compContainer.off()
...
@@ -707,6 +749,46 @@ compContainer.off()
KanbanBoard.filterSearchUrl = filterSearchUrl;
KanbanBoard.filterSearchUrl = filterSearchUrl;
KanbanBoard.reset();
KanbanBoard.reset();
KanbanBoard.render();
KanbanBoard.render();
}).on('getXLS', e => {
Cons.showLoader();
let url = KanbanBoard.getFullDataUrl();
url += `
&
pageNumber
=
1
&
countInPart
=
1
&
loadData
=
false
`;
rest.synergyGet(url, part => {
Cons.hideLoader();
UIkit.modal.confirm(`
Вы
собираетесь
выгрузить
$
{
part
.
count
}
записей
.
Продолжить
?
`,
{labels: {ok: i18n.tr('Да'), cancel: i18n.tr('Отмена')}})
.then(() => {
if(KanbanBoard.searchString || KanbanBoard.filterSearchUrl) {
Cons.showLoader();
rest.synergyGet(KanbanBoard.getFullDataUrl(), data => {
let excelData = [];
data.result.forEach(res => {
let tmpValues = {};
KanbanBoard.heads.forEach(col => tmpValues[col.label] = res.fieldValue[col.columnID] || "");
excelData.push(tmpValues);
});
try {
let opts = {headers: true, column: {style:{Font:{Bold:"1"}}}};
let result = alasql(`
SELECT
*
INTO
XLS
(
"
${KanbanBoard.registryName}_${formatDate()}.xls
"
,?)
FROM
?
`, [opts, excelData]);
Cons.hideLoader();
} catch (e) {
console.log(e.message);
Cons.hideLoader();
showMessage(i18n.tr('Произошла ошибка при выгрузке записей реестра'), 'error');
}
});
} else {
getSystemReport();
}
}, () => null);
});
});
});
$(document).off()
$(document).off()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment