odant-work 1.0.90 → 1.0.92
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/#system/package-manifest.json +275 -246
- package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/$virtual/class.js +4 -0
- package/$server/$folder/$class/$data/$catalog/$folder/$class/$data/$catalog/class.js +4 -0
- package/$server/$folder/$class/$data/$catalog/$virtual/$folder/$class/$data/$catalog/$virtual/class.js +4 -0
- package/$server/$folder/$class/$data/$catalog/$virtual/class.js +8 -0
- package/{MODULES/Register/CATALOGS/$catalog/$folder/$class → $server/$folder/$class/$data}/$catalog/class.js +1 -0
- package/$server/$folder/$class/$data/$operation/$folder/$class/$data/$operation/class.js +4 -0
- package/{MODULES/Register/OPERATIONS/$operation/$folder/$class → $server/$folder/$class/$data}/$operation/class.js +1 -0
- package/$server/$folder/$class/$data/$register/$account/$folder/$class/$data/$register/$account/class.js +4 -0
- package/$server/$folder/$class/$data/$register/$account/class.js +8 -0
- package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/$account/class.js +4 -0
- package/$server/$folder/$class/$data/$register/$folder/$class/$data/$register/class.js +4 -0
- package/$server/$folder/$class/$data/$register/class.js +8 -0
- package/$server/$folder/$class/$data/$struct/$folder/$class/$data/$struct/class.js +4 -0
- package/$server/$folder/$class/$data/$struct/class.js +5 -0
- package/$server/$folder/$class/$data/class.js +5 -0
- package/$server/$folder/$class/$data/handlers/pages/form/objects/$handler/class.js +2158 -0
- package/$server/$folder/$class/$data/handlers/pages/form/objects/object/$handler/class.js +1377 -0
- package/$server/$folder/$class/$domain/$folder/$class/$domain/class.js +4 -0
- package/$server/$folder/$class/$domain/handlers/methods/restore/$handler/class.js +5 -5
- package/$server/$folder/$class/$domain/readme.md +1 -1
- package/$server/$folder/$class/$handler/$method/class.js +4 -0
- package/$server/$folder/$class/$handler/$timer/class.js +4 -0
- package/$server/$folder/$class/$module/$folder/$class/$data/$catalog/class.js +4 -0
- package/$server/$folder/$class/$module/$folder/$class/$data/$operation/class.js +4 -0
- package/$server/$folder/$class/$module/$folder/$class/$data/$register/class.js +4 -0
- package/$server/$folder/$class/$module/$folder/$class/$data/$struct/class.js +4 -0
- package/$server/$folder/$class/$module/$folder/$class/$domain/class.js +4 -0
- package/$server/$folder/$class/$module/$folder/$class/$module/class.js +4 -0
- package/$server/$folder/$class/$module/class.js +418 -6
- package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/mcp.js → $module/handlers/pages/form/system/mcp/$handler/class.js} +261 -220
- package/$server/$folder/$class/$module/handlers/pages/form/system/modules/$handler/class.js +7 -0
- package/$server/$folder/$class/$structure/$folder/$class/$structure/class.js +4 -0
- package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$catalog/class.js +4 -0
- package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$operation/class.js +4 -0
- package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$register/class.js +4 -0
- package/$server/$folder/$class/$structure/$organization/$folder/$class/$data/$struct/class.js +4 -0
- package/$server/$folder/$class/$structure/$organization/$folder/$class/$domain/class.js +4 -0
- package/$server/$folder/$class/$structure/$organization/$folder/$class/$module/class.js +4 -0
- package/{ORGANIZATIONS/$domain/$folder/$class/$base → $server/$folder/$class/$structure/$organization/$folder/$class/$structure/$organization}/class.js +4 -5
- package/$server/$folder/$class/$structure/$organization/$folder/$class/$structure/class.js +4 -0
- package/{ORGANIZATIONS/$domain/$folder/$class/$base/$folder/$class/$structure/$base → $server/$folder/$class/$structure/$organization}/class.js +19 -17
- package/$server/$folder/$class/$structure/$organization/handlers/pages/form/system/requisites/$handler/class.js +3 -0
- package/$server/$folder/$class/$structure/{$base/handlers/pages/site/$handler/site.js → $organization/handlers/pages/site/$handler/class.js} +352 -365
- package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$catalog/class.js +4 -0
- package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$operation/class.js +4 -0
- package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$register/class.js +4 -0
- package/$server/$folder/$class/$structure/$project/$folder/$class/$data/$struct/class.js +4 -0
- package/$server/$folder/$class/$structure/$project/$folder/$class/$domain/class.js +4 -0
- package/$server/$folder/$class/$structure/$project/$folder/$class/$module/class.js +4 -0
- package/$server/$folder/$class/$structure/$project/class.js +1 -0
- package/$server/$folder/$class/$structure/$project/readme.md +1 -1
- package/$server/$folder/$class/$structure/$server/$folder/$class/$domain/class.js +4 -0
- package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/database/$handler/class.js +3 -0
- package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/license.js → $structure/$server/handlers/pages/form/system/license/$handler/class.js} +104 -103
- package/$server/$folder/$class/$structure/$server/handlers/pages/site/$handler/{site.js → class.js} +45 -30
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/agent/$handler/class.js +3 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/messengers/$handler/class.js +3 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/modules/$handler/class.js +3 -0
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/profile/$handler/class.js +18 -0
- package/$server/$folder/$class/$structure/ai/system.md +1 -1
- package/$server/$folder/$class/$structure/class.js +1 -1
- package/$server/$folder/$class/$structure/handlers/methods/archive/$handler/class.js +3 -3
- package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +309 -8
- package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/class.js +15 -4
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/class.js +1281 -7
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/class.js +2216 -6
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +1304 -6
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/methods/refresh/$method/class.js +1 -1
- package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/class.js +305 -9
- package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/agent.js → $structure/handlers/pages/form/system/agent/$handler/class.js} +329 -320
- package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/database.js → $structure/handlers/pages/form/system/database/$handler/class.js} +510 -577
- package/$server/$folder/$class/{handlers/pages/form/system/$handler/tabs/messengers.js → $structure/handlers/pages/form/system/messengers/$handler/class.js} +143 -144
- package/$server/$folder/$class/$structure/handlers/pages/form/system/modules/$handler/class.js +270 -0
- package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +2114 -0
- package/$server/$folder/$class/$structure/handlers/pages/site/$handler/class.js +229 -4
- package/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md +1 -1
- package/$server/$folder/$class/$structure/readme.md +3 -3
- package/$server/$folder/$class/$users/$folder/$class/$structure/$user/class.js +4 -0
- package/$server/$folder/$class/$users/class.js +4 -0
- package/$server/$folder/$class/ai/agents/integrator-1c.md +1 -1
- package/$server/$folder/$class/ai/agents/it-admin.md +1 -1
- package/$server/$folder/$class/ai/agents/org-architect.md +4 -4
- package/$server/$folder/$class/ai/agents/readme.md +1 -1
- package/$server/$folder/$class/ai/agents/schema-validator.md +2 -2
- package/$server/$folder/$class/ai/skills/lan-inventory.md +2 -2
- package/$server/$folder/$class/ai/skills/org-structure.md +1 -1
- package/$server/$folder/$class/ai/skills/printer-setup.md +1 -1
- package/$server/$folder/$class/ai/skills/telegram-notify.md +2 -2
- package/$server/$folder/$class/ai/skills/work-scenarios.md +3 -3
- package/$server/$folder/$class/ai/system.md +14 -8
- package/$server/$folder/$class/class.js +2 -6
- package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +3 -0
- package/$server/$folder/$class/handlers/pages/form/system/$handler/class.js +2 -4
- package/$server/$folder/$class/handlers/pages/form/system/files/$handler/class.js +7 -0
- package/$server/$folder/$class/handlers/pages/form/system/requisites/$handler/class.js +100 -0
- package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +25 -6
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/class.js +32 -5
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/class.js +31 -3
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/class.js +11 -3
- package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/class.js +83 -3
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/class.js +61 -3
- package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/class.js +1699 -2
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/class.js +827 -2
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/readme.md +1 -1
- package/$server/$folder/$file/handlers/pages/form/file/$handler/class.js +33 -3
- package/$server/$folder/$file/handlers/pages/form/folder/$handler/class.js +3 -0
- package/$server/$folder/handlers/methods/create/$handler/class.js +5 -5
- package/$server/$folder/handlers/pages/form/$handler/class.js +2467 -3
- package/$server/$folder/handlers/pages/form/folder/$handler/class.js +22 -0
- package/$server/$folder/handlers/readme.md +1 -1
- package/$server/$folder/lib/chat-item/chat-item.js +5 -10
- package/$server/$folder/lib/consultant/consultant.js +7 -10
- package/$server/$folder/lib/explorer/explorer.js +1 -1
- package/$server/$folder/lib/icon/icon.js +1 -1
- package/$server/$folder/lib/menu/menu.js +3 -2
- package/$server/$folder/lib/messenger-settings/messenger-settings.js +4 -4
- package/$server/$folder/lib/node/node.js +3 -3
- package/$server/$folder/lib/prompt-bar/prompt-bar.js +2 -2
- package/$server/$folder/lib/role/role.js +1 -2
- package/$server/$folder/lib/security/admin/admin.js +3 -3
- package/$server/$folder/lib/security/security.js +4 -4
- package/$server/$folder/lib/security/users/users.js +2 -5
- package/$server/$folder/lib/site-loc/site-loc.js +3 -3
- package/$server/$folder/lib/tree/tree.js +14 -22
- package/$server/class.js +1 -0
- package/AGENTS.md +21 -13
- package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-model.js → MODELS/$ai/$folder/$class/$ai/handlers/pages/form/system/ai/$handler/class.js} +385 -425
- package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-provider.js → MODELS/$ai/$folder/$class/$provider/handlers/pages/form/system/ai/$handler/class.js} +157 -161
- package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-root.js → MODELS/$ai/handlers/pages/form/system/ai/$handler/class.js} +34 -33
- package/{$server/$folder/$class/handlers/pages/form/system/$handler/tabs/ai-local.js → MODELS/Local/$provider/handlers/pages/form/system/ai/$handler/class.js} +572 -622
- package/MODULES/$domain/class.js +85 -4
- package/MODULES/$domain/handlers/pages/form/system/mcp/$handler/class.js +7 -0
- package/MODULES/$domain/readme.md +7 -6
- package/{SERVICES/1C/$service → MODULES/1C/$module}/class.js +7 -1
- package/MODULES/2GIS/$module/class.js +32 -0
- package/MODULES/2GIS/$module/readme.md +57 -0
- package/{SERVICES/Bitrix24/$service → MODULES/Bitrix24/$module}/class.js +7 -2
- package/{SERVICES/CBR/$service → MODULES/CBR/$module}/class.js +5 -0
- package/{SERVICES/DaData/$service → MODULES/DaData/$module}/class.js +9 -3
- package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/class.js +648 -21
- package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/class.js +140 -6
- package/{SERVICES/Marketplaces/$service → MODULES/Marketplaces/$domain}/class.js +1 -1
- package/{SERVICES/Marketplaces/Ozon/$service → MODULES/Marketplaces/Ozon/$module}/class.js +1 -1
- package/{SERVICES/Marketplaces/Wildberries/$service → MODULES/Marketplaces/Wildberries/$module}/class.js +1 -1
- package/{SERVICES/Marketplaces/YandexMarket/$service → MODULES/Marketplaces/YandexMarket/$module}/class.js +1 -1
- package/MODULES/Process/$module/readme.md +1 -1
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/class.js" +305 -6
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/class.js" +241 -6
- package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/class.js" +515 -16
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual → $data/$catalog/$virtual}/class.js +3 -0
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/$virtual/handlers/pages/form/objects/$handler/class.js +3 -0
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual/handlers/pages/form/virtual/$handler/virtual.js → $data/$catalog/$virtual/handlers/pages/form/virtual/$handler/class.js} +413 -390
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$data/$catalog/class.js +14 -0
- package/MODULES/Register/CATALOGS/$catalog/class.js +7 -14
- package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/$folder/$class/$data/$catalog/$virtual/class.js +9 -0
- package/MODULES/Register/CATALOGS//320/241/320/276/321/202/321/200/321/203/320/264/320/275/320/270/320/272/320/270/$virtual/class.js +0 -7
- package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/$folder/$class/$data/$catalog/class.js +11 -0
- package/MODULES/Register/CATALOGS//320/241/321/203/320/261/321/212/320/265/320/272/321/202/321/213/$catalog/class.js +0 -9
- package/MODULES/Register/OPERATIONS/$operation/$folder/$class/$data/$operation/class.js +16 -0
- package/MODULES/Register/OPERATIONS/$operation/class.js +0 -9
- package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/$folder/$class/$data/$operation/class.js +8 -0
- package/MODULES/Register/OPERATIONS//320/232/320/260/320/264/321/200/321/213/$operation/class.js +4 -10
- package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/$folder/$class/$data/$operation/class.js +8 -0
- package/MODULES/Register/OPERATIONS//320/232/320/260/321/201/321/201/320/260/$operation/class.js +0 -6
- package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/$folder/$class/$data/$operation/class.js +8 -0
- package/MODULES/Register/OPERATIONS//320/232/320/276/320/274/320/274/321/203/320/275/320/270/320/272/320/260/321/206/320/270/320/270/$operation/class.js +4 -10
- package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/$folder/$class/$data/$operation/class.js" +10 -0
- package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/class.js" +4 -12
- package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/$folder/$class/$data/$operation/class.js" +10 -0
- package/MODULES/Register/OPERATIONS//320/237/320/276/321/201/321/202/321/203/320/277/320/273/320/265/320/275/320/270/321/217 /320/275/320/260 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/321/213/320/271 /321/201/321/207/321/221/321/202/$operation/class.js" +4 -12
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/$folder/$class/$data/$operation/class.js +24 -0
- package/MODULES/Register/OPERATIONS//320/240/320/265/320/260/320/273/320/270/320/267/320/260/321/206/320/270/321/217/$operation/class.js +0 -22
- package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/analysis/$handler/analysis.js → $data/$register/$account/handlers/pages/form/analysis/$handler/class.js} +9 -4
- package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/postings/$handler/postings.js → $data/$register/$account/handlers/pages/form/postings/$handler/class.js} +845 -753
- package/MODULES/Register/REGISTER/$register/$folder/$class/{$account/handlers/pages/form/turnovers/$handler/turnovers.js → $data/$register/$account/handlers/pages/form/turnovers/$handler/class.js} +9 -4
- package/MODULES/Register/REGISTER/$register/{$folder/$class/$register/handlers/pages/form/journal/$handler/journal.js → handlers/pages/form/journal/$handler/class.js} +382 -329
- package/MODULES/Register/REGISTER/$register/handlers/pages/form/sheet/$handler/class.js +807 -0
- package/MODULES/Register/REGISTER/10/$account/$folder/$class/$data/$register/$account/class.js +21 -0
- package/MODULES/Register/REGISTER/10/$account/class.js +0 -19
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/$folder/$class/$data/$register/$account/class.js +14 -0
- package/MODULES/Register/REGISTER//320/232/320/260/320/264/321/200/321/213/$account/class.js +4 -16
- package/{SERVICES/SearXNG/$service → MODULES/SearXNG/$module}/class.js +5 -0
- package/{SERVICES/Yandex/$service → MODULES/Yandex/$module}/class.js +7 -0
- package/{SERVICES/YandexDisk/$service → MODULES/YandexDisk/$module}/class.js +8 -2
- package/NODES/$node/handlers/pages/form/network/$handler/class.js +122 -5
- package/ORGANIZATIONS/$domain/$folder/$class/$structure/$organization/class.js +5 -0
- package/ORGANIZATIONS/$domain/class.js +5 -5
- package/oda/components/inputs/link/link.js +1 -1
- package/package.json +1 -1
- package/readme.md +6 -7
- package/scripts/check-architecture.mjs +541 -0
- package/scripts/cleanup-storage.mjs +1 -1
- package/scripts/demo-seed.mjs +3 -3
- package/scripts/import-bis.mjs +33 -15
- package/scripts/import-delovaya.mjs +26 -14
- package/sources/client/class.js +19 -10
- package/sources/client/folder.js +10 -22
- package/sources/client/handler.js +75 -33
- package/sources/data/api.js +9 -10
- package/sources/data/classes.js +85 -9
- package/sources/data/db.js +10 -6
- package/sources/data/print.js +15 -41
- package/sources/data/readme.md +5 -5
- package/sources/data/schema.js +206 -118
- package/sources/data/sql-inspector.js +7 -7
- package/sources/host/auth-methods.js +2 -5
- package/sources/host/auto-updater.js +1 -2
- package/sources/host/babel-merge.js +174 -129
- package/sources/host/prewarm.js +1 -1
- package/sources/host/watch.js +1 -1
- package/sources/index.html +1 -1
- package/sources/modules/agent/extensions.js +48 -38
- package/sources/modules/agent/index.js +1 -1
- package/sources/modules/agent/node-rules.js +69 -41
- package/sources/modules/agent/permissions.js +1 -1
- package/sources/modules/agent/plugins.js +11 -11
- package/sources/modules/agent/resources.js +96 -52
- package/sources/modules/agent/tools/net.js +1 -1
- package/sources/modules/agent/tools/services.js +7 -7
- package/sources/modules/agent/tools/work/access.js +10 -8
- package/sources/modules/agent/tools/work/classes.js +26 -47
- package/sources/modules/agent/tools/work/common.js +8 -10
- package/sources/modules/agent/tools/work/data.js +4 -4
- package/sources/modules/agent/triggers.js +1 -1
- package/sources/modules/agent/twin-bus.js +4 -4
- package/sources/modules/agent/voice.js +1 -1
- package/sources/modules/call/call.js +4 -4
- package/sources/modules/kladr/index.js +3 -3
- package/sources/modules/lan/register.js +7 -7
- package/sources/modules/mcp-marketplaces/ozon.js +1 -1
- package/sources/modules/mcp-marketplaces/wildberries.js +1 -1
- package/sources/modules/mcp-marketplaces/yandex-market.js +1 -1
- package/sources/modules/nodes/mount.js +2 -4
- package/sources/modules/notify/index.js +18 -18
- package/sources/modules/rag/extract.js +9 -2
- package/sources/modules/rag/indexer.js +1 -1
- package/sources/modules/rag/scope.js +7 -33
- package/sources/modules/trainer/dataset.js +2 -2
- package/sources/modules/trainer/local-engine.js +1 -1
- package/sources/page.html +2 -2
- package/sources/readme.md +1 -1
- package/sources/server/access/gateway.js +19 -19
- package/sources/server/access/invites.js +4 -5
- package/sources/server/access/links.js +10 -8
- package/sources/server/access/policy.js +65 -39
- package/sources/server/access/workplaces.js +20 -14
- package/sources/server/chat-threads.js +4 -4
- package/sources/server/class/archive.js +15 -15
- package/sources/server/class/base-template.js +13 -9
- package/sources/server/class/distro.js +3 -4
- package/sources/server/class/feed.js +3 -3
- package/sources/server/class/mail-calendar.js +9 -8
- package/sources/server/class/scaffold.js +110 -60
- package/sources/server/class/search.js +2 -2
- package/sources/server/class/security.js +76 -94
- package/sources/server/class.js +181 -64
- package/sources/server/file.js +2 -2
- package/sources/server/folder.js +376 -191
- package/sources/server/handler.js +52 -13
- package/sources/server/logs.js +7 -7
- package/sources/server/node.js +12 -43
- package/sources/server/server.js +16 -17
- package/$server/$folder/$class/$device/class.js +0 -3
- package/$server/$folder/$class/$handler/$task/class.js +0 -3
- package/$server/$folder/$class/$service/$class/$service/class.js +0 -4
- package/$server/$folder/$class/$structure/$base/class.js +0 -10
- package/$server/$folder/$class/$structure/$base/roots_1/roots.test +0 -0
- package/$server/$folder/$class/$structure/handlers/pages/data/$handler/data.js +0 -313
- package/$server/$folder/$class/$structure/handlers/pages/explorer/$handler/explorer.js +0 -16
- package/$server/$folder/$class/$structure/handlers/pages/form/calendar/$handler/calendar.js +0 -1226
- package/$server/$folder/$class/$structure/handlers/pages/form/chat/$handler/chat.js +0 -2217
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/email.js +0 -1188
- package/$server/$folder/$class/$structure/handlers/pages/form/search/$handler/search.js +0 -289
- package/$server/$folder/$class/$structure/handlers/pages/site/$handler/site.js +0 -240
- package/$server/$folder/$class/handlers/pages/form/object/$handler/class.js +0 -33
- package/$server/$folder/$class/handlers/pages/form/object/$handler/object.js +0 -1371
- package/$server/$folder/$class/handlers/pages/form/objects/$handler/class.js +0 -33
- package/$server/$folder/$class/handlers/pages/form/objects/$handler/objects.js +0 -2130
- package/$server/$folder/$class/handlers/pages/form/system/$handler/system.js +0 -384
- package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/modules.js +0 -244
- package/$server/$folder/$class/handlers/pages/form/system/$handler/tabs/staff.js +0 -2126
- package/$server/$folder/$class/handlers/pages/storage/$handler/storage.js +0 -21
- package/$server/$folder/$file/$data/handlers/pages/form/editor/$handler/editor.js +0 -27
- package/$server/$folder/$file/$devs/handlers/pages/form/file/$handler/file.js +0 -31
- package/$server/$folder/$file/$ics/handlers/pages/form/file/$handler/file.js +0 -10
- package/$server/$folder/$file/$ipynb/handlers/pages/form/file/$handler/file.js +0 -72
- package/$server/$folder/$file/$md/handlers/pages/form/file/$handler/file.js +0 -63
- package/$server/$folder/$file/$office/handlers/pages/form/file/$handler/file.js +0 -1845
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/file.js +0 -785
- package/$server/$folder/$file/handlers/pages/form/file/$handler/file.js +0 -29
- package/$server/$folder/handlers/pages/form/$handler/form.js +0 -2122
- package/MODULES/Geo//320/232/320/260/321/200/321/202/320/260/$catalog/handlers/pages/form/map/$handler/map.js +0 -623
- package/MODULES/KLADR/$module/handlers/pages/form/kladr/$handler/kladr.js +0 -134
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/gantt/$handler/gantt.js" +0 -293
- package/MODULES/Process//320/227/320/260/320/264/320/260/321/207/320/270 /320/270 /321/215/321/202/320/260/320/277/321/213/$catalog/handlers/pages/form/scheduler/$handler/scheduler.js" +0 -234
- package/MODULES/Process//320/241/321/205/320/265/320/274/321/213 /320/277/321/200/320/276/321/206/320/265/321/201/321/201/320/276/320/262/$catalog/handlers/pages/form/bpmn/$handler/bpmn.js" +0 -406
- package/MODULES/Register/CATALOGS/$catalog/$folder/$class/$virtual/handlers/pages/form/virtual/$handler/class.js +0 -6
- package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/analysis/$handler/class.js +0 -9
- package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/postings/$handler/class.js +0 -9
- package/MODULES/Register/REGISTER/$register/$folder/$class/$account/handlers/pages/form/turnovers/$handler/class.js +0 -9
- package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/journal/$handler/class.js +0 -6
- package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/sheet/$handler/class.js +0 -6
- package/MODULES/Register/REGISTER/$register/$folder/$class/$register/handlers/pages/form/sheet/$handler/sheet.js +0 -808
- package/NODES/$node/handlers/pages/form/network/$handler/network.js +0 -110
- package/SERVICES/$service/$folder/$storage/$service/class.js +0 -8
- package/SERVICES/$service/class.js +0 -442
- package/SERVICES/readme.md +0 -36
- /package/$server/$folder/$class/$structure/{$base → $organization}/icon.png +0 -0
- /package/{SERVICES/DuckDuckGo/$service → MODULES/DuckDuckGo/$module}/class.js +0 -0
- /package/MODULES/KLADR/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
- /package/MODULES/Process/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
- /package/MODULES/Register/$module/$folder/$class/{$catalog → $data/$catalog}/class.js +0 -0
- /package/MODULES/Register/$module/$folder/$class/{$operation → $data/$operation}/class.js +0 -0
- /package/MODULES/Register/$module/$folder/$class/{$register → $data/$register}/class.js +0 -0
- /package/MODULES/Register/$module/$folder/$class/{$struct → $data/$struct}/class.js +0 -0
- /package/MODULES/Register/CATALOGS/$catalog/$folder/$class/{$virtual/$folder/$class → $data/$catalog/$virtual/$folder/$class/$data/$catalog}/$virtual/class.js +0 -0
- /package/MODULES/Register/OPERATIONS//320/237/320/273/320/260/321/202/320/265/320/266/320/270 /321/201 /321/200/320/260/321/201/321/207/321/221/321/202/320/275/320/276/320/263/320/276 /321/201/321/207/321/221/321/202/320/260/$operation/{print → $folder/$class/$data/$operation/print}//320/237/320/273/320/260/321/202/321/221/320/266/320/275/320/276/320/265 /320/277/320/276/321/200/321/203/321/207/320/265/320/275/320/270/320/265.html" +0 -0
- /package/MODULES/Register/REGISTER/$register/$folder/$class/{$account → $data/$register/$account}/class.js +0 -0
- /package/MODULES/Register/REGISTER/$register/$folder/$class/{$account → $data/$register/$account}/readme.md +0 -0
- /package/MODULES/Register/REGISTER/$register/$folder/$class/{$register → $data/$register}/class.js +0 -0
- /package/MODULES/Register/STRUCTS/$struct/$folder/$class/{$struct → $data/$struct}/class.js +0 -0
- /package/{SERVICES/RuCalendar/$service → MODULES/RuCalendar/$module}/class.js +0 -0
- /package/{SERVICES/Telegram/$service → MODULES/Telegram/$module}/class.js +0 -0
- /package/{SERVICES/Weather/$service → MODULES/Weather/$module}/class.js +0 -0
- /package/PROJECTS/$domain/$folder/$class/{$project → $structure/$project}/class.js +0 -0
|
@@ -12,152 +12,208 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
const PERIOD_STORAGE_KEY = 'work.accounting.period';
|
|
15
|
-
|
|
16
15
|
function _day(d) {
|
|
17
|
-
|
|
16
|
+
return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}`;
|
|
18
17
|
}
|
|
19
18
|
const _today = () => _day(new Date());
|
|
20
19
|
const _yearStart = () => `${new Date().getFullYear()}-01-01`;
|
|
21
20
|
const _yearEnd = () => _today();
|
|
22
|
-
|
|
23
21
|
function _readSavedPeriod() {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
22
|
+
try {
|
|
23
|
+
const raw = typeof sessionStorage !== 'undefined' ? sessionStorage.getItem(PERIOD_STORAGE_KEY) : null;
|
|
24
|
+
if (!raw) return null;
|
|
25
|
+
const parsed = JSON.parse(raw);
|
|
26
|
+
return parsed && typeof parsed === 'object' ? parsed : null;
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
34
30
|
}
|
|
35
|
-
|
|
36
31
|
function _writeSavedPeriod(packetsKey, from, to) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
32
|
+
try {
|
|
33
|
+
if (typeof sessionStorage !== 'undefined') sessionStorage.setItem(PERIOD_STORAGE_KEY, JSON.stringify({
|
|
34
|
+
packetsKey: packetsKey || '*',
|
|
35
|
+
from: from || '',
|
|
36
|
+
to: to || ''
|
|
37
|
+
}));
|
|
38
|
+
} catch {/* ignore */}
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
function _derivePacketsKey(from, to, fallback = '*') {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return `period:${from}:${to}`;
|
|
55
|
-
}
|
|
56
|
-
return fallback || '*';
|
|
41
|
+
if (!from && !to) return '*';
|
|
42
|
+
if (fallback && fallback !== '*') return fallback;
|
|
43
|
+
if (from && to) {
|
|
44
|
+
const ym1 = /^(\d{4})-01-01$/.exec(from);
|
|
45
|
+
const ym2 = /^(\d{4})-12-31$/.exec(to);
|
|
46
|
+
if (ym1 && ym2 && ym1[1] === ym2[1]) return `${ym1[1]}*`;
|
|
47
|
+
return `period:${from}:${to}`;
|
|
48
|
+
}
|
|
49
|
+
return fallback || '*';
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
function _daysInMonth(y, m) {
|
|
60
|
-
|
|
52
|
+
return new Date(y, m, 0).getDate();
|
|
61
53
|
}
|
|
62
|
-
|
|
63
54
|
function _weekBounds(dt) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
55
|
+
const dow = dt.getDay();
|
|
56
|
+
const diffToMon = dow === 0 ? -6 : 1 - dow;
|
|
57
|
+
const mon = new Date(dt.getFullYear(), dt.getMonth(), dt.getDate() + diffToMon);
|
|
58
|
+
const sun = new Date(mon.getFullYear(), mon.getMonth(), mon.getDate() + 6);
|
|
59
|
+
return {
|
|
60
|
+
from: _day(mon),
|
|
61
|
+
to: _day(sun)
|
|
62
|
+
};
|
|
69
63
|
}
|
|
70
|
-
|
|
71
64
|
function _boundsFromPacketsKey(key, defaultMode = 'month') {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (gran === 'year')
|
|
96
|
-
return { from: `${y}-01-01`, to: `${y}-12-31` };
|
|
97
|
-
const ms = String(m).padStart(2, '0');
|
|
98
|
-
return { from: `${y}-${ms}-01`, to: `${y}-${ms}-${String(_daysInMonth(y, m)).padStart(2, '0')}` };
|
|
99
|
-
}
|
|
100
|
-
const clean = k.replace(/\*+$/, '');
|
|
101
|
-
if (/^\d{4}$/.test(clean))
|
|
102
|
-
return { from: `${clean}-01-01`, to: `${clean}-12-31` };
|
|
103
|
-
const qm = /^(\d{4})-q([1-4])$/i.exec(clean);
|
|
104
|
-
if (qm) {
|
|
105
|
-
const y = +qm[1], q = +qm[2];
|
|
106
|
-
const m1 = String((q - 1) * 3 + 1).padStart(2, '0');
|
|
107
|
-
const m2 = (q - 1) * 3 + 3;
|
|
108
|
-
return { from: `${y}-${m1}-01`, to: `${y}-${String(m2).padStart(2, '0')}-${String(_daysInMonth(y, m2)).padStart(2, '0')}` };
|
|
65
|
+
const k = String(key || '').trim();
|
|
66
|
+
if (!k || k === '*') return {
|
|
67
|
+
from: '',
|
|
68
|
+
to: ''
|
|
69
|
+
};
|
|
70
|
+
if (k.startsWith('period:')) {
|
|
71
|
+
const [, s = '', e = ''] = k.split(':');
|
|
72
|
+
return {
|
|
73
|
+
from: s,
|
|
74
|
+
to: e
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (k === 'now' || k.startsWith('now:')) {
|
|
78
|
+
const gran = k.startsWith('now:') ? k.slice(4) : defaultMode;
|
|
79
|
+
const now = new Date();
|
|
80
|
+
const y = now.getFullYear(),
|
|
81
|
+
m = now.getMonth() + 1;
|
|
82
|
+
if (gran === 'day') {
|
|
83
|
+
const d = _day(now);
|
|
84
|
+
return {
|
|
85
|
+
from: d,
|
|
86
|
+
to: d
|
|
87
|
+
};
|
|
109
88
|
}
|
|
110
|
-
|
|
111
|
-
if (
|
|
112
|
-
|
|
113
|
-
|
|
89
|
+
if (gran === 'week') return _weekBounds(now);
|
|
90
|
+
if (gran === 'quarter') {
|
|
91
|
+
const q = Math.floor((m - 1) / 3) + 1;
|
|
92
|
+
const m1 = String((q - 1) * 3 + 1).padStart(2, '0');
|
|
93
|
+
const m2 = (q - 1) * 3 + 3;
|
|
94
|
+
return {
|
|
95
|
+
from: `${y}-${m1}-01`,
|
|
96
|
+
to: `${y}-${String(m2).padStart(2, '0')}-${String(_daysInMonth(y, m2)).padStart(2, '0')}`
|
|
97
|
+
};
|
|
114
98
|
}
|
|
115
|
-
if (
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
99
|
+
if (gran === 'year') return {
|
|
100
|
+
from: `${y}-01-01`,
|
|
101
|
+
to: `${y}-12-31`
|
|
102
|
+
};
|
|
103
|
+
const ms = String(m).padStart(2, '0');
|
|
104
|
+
return {
|
|
105
|
+
from: `${y}-${ms}-01`,
|
|
106
|
+
to: `${y}-${ms}-${String(_daysInMonth(y, m)).padStart(2, '0')}`
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
const clean = k.replace(/\*+$/, '');
|
|
110
|
+
if (/^\d{4}$/.test(clean)) return {
|
|
111
|
+
from: `${clean}-01-01`,
|
|
112
|
+
to: `${clean}-12-31`
|
|
113
|
+
};
|
|
114
|
+
const qm = /^(\d{4})-q([1-4])$/i.exec(clean);
|
|
115
|
+
if (qm) {
|
|
116
|
+
const y = +qm[1],
|
|
117
|
+
q = +qm[2];
|
|
118
|
+
const m1 = String((q - 1) * 3 + 1).padStart(2, '0');
|
|
119
|
+
const m2 = (q - 1) * 3 + 3;
|
|
120
|
+
return {
|
|
121
|
+
from: `${y}-${m1}-01`,
|
|
122
|
+
to: `${y}-${String(m2).padStart(2, '0')}-${String(_daysInMonth(y, m2)).padStart(2, '0')}`
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
const mm = /^(\d{4})-(0[1-9]|1[0-2])$/.exec(clean);
|
|
126
|
+
if (mm) {
|
|
127
|
+
const y = +mm[1],
|
|
128
|
+
m = +mm[2];
|
|
129
|
+
return {
|
|
130
|
+
from: `${clean}-01`,
|
|
131
|
+
to: `${clean}-${String(_daysInMonth(y, m)).padStart(2, '0')}`
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
if (clean.startsWith('week:')) {
|
|
135
|
+
const monIso = clean.slice(5);
|
|
136
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(monIso)) {
|
|
137
|
+
const [y, m, d] = monIso.split('-').map(Number);
|
|
138
|
+
return _weekBounds(new Date(y, m - 1, d));
|
|
121
139
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
140
|
+
}
|
|
141
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(clean)) return {
|
|
142
|
+
from: clean,
|
|
143
|
+
to: clean
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
from: '',
|
|
147
|
+
to: ''
|
|
148
|
+
};
|
|
125
149
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
150
|
+
const money = v => Number(v) ? Number(v).toLocaleString('ru-RU', {
|
|
151
|
+
minimumFractionDigits: 2,
|
|
152
|
+
maximumFractionDigits: 2
|
|
153
|
+
}) : '';
|
|
154
|
+
const qtyFmt = v => Number(v) ? Number(v).toLocaleString('ru-RU', {
|
|
155
|
+
maximumFractionDigits: 4
|
|
156
|
+
}) : '';
|
|
129
157
|
/** Сальдо со знаком (Дт − Кт) текстом: «1 200,00 Дт», «300,00 Кт». */
|
|
130
|
-
const saldo = v =>
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
158
|
+
const saldo = v => Number(v) > 0 ? money(v) + ' Дт' : Number(v) < 0 ? money(-v) + ' Кт' : '0';
|
|
159
|
+
export const TURNOVER_GROUPS = [{
|
|
160
|
+
id: 'none',
|
|
161
|
+
label: 'Нет'
|
|
162
|
+
}, {
|
|
163
|
+
id: 'day',
|
|
164
|
+
label: 'Дни'
|
|
165
|
+
}, {
|
|
166
|
+
id: 'week',
|
|
167
|
+
label: 'Недели'
|
|
168
|
+
}, {
|
|
169
|
+
id: 'month',
|
|
170
|
+
label: 'Месяцы'
|
|
171
|
+
}, {
|
|
172
|
+
id: 'quarter',
|
|
173
|
+
label: 'Кварталы'
|
|
174
|
+
}, {
|
|
175
|
+
id: 'year',
|
|
176
|
+
label: 'Годы'
|
|
177
|
+
}, {
|
|
178
|
+
id: 'operation',
|
|
179
|
+
label: 'Операции'
|
|
180
|
+
}, {
|
|
181
|
+
id: 'account',
|
|
182
|
+
label: 'Счета'
|
|
183
|
+
}, {
|
|
184
|
+
id: 'all',
|
|
185
|
+
label: 'Все'
|
|
186
|
+
}];
|
|
143
187
|
|
|
144
188
|
/** Парсинг строки фильтра субаналитики: «поле:значение» или просто текст поиска по name. */
|
|
145
189
|
function parseSubFilterInput(raw) {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
190
|
+
const s = String(raw || '').trim();
|
|
191
|
+
if (!s) return null;
|
|
192
|
+
const colon = s.indexOf(':');
|
|
193
|
+
const eq = s.indexOf('=');
|
|
194
|
+
const sep = colon > 0 && (eq < 0 || colon < eq) ? colon : eq;
|
|
195
|
+
if (sep > 0) {
|
|
196
|
+
const field = s.slice(0, sep).trim();
|
|
197
|
+
const val = s.slice(sep + 1).trim();
|
|
198
|
+
return field && val ? {
|
|
199
|
+
[field]: {
|
|
200
|
+
contains: val
|
|
201
|
+
}
|
|
202
|
+
} : null;
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
name: {
|
|
206
|
+
contains: s
|
|
156
207
|
}
|
|
157
|
-
|
|
208
|
+
};
|
|
158
209
|
}
|
|
159
|
-
|
|
160
210
|
export default {
|
|
211
|
+
icon: 'icons:list',
|
|
212
|
+
label: 'Проводки',
|
|
213
|
+
service: true,
|
|
214
|
+
order: 3,
|
|
215
|
+
default: true,
|
|
216
|
+
component: {
|
|
161
217
|
imports: 'oda//button, oda//packets, ~/lib//editor-form',
|
|
162
218
|
template: /*html*/`
|
|
163
219
|
<style>
|
|
@@ -884,7 +940,11 @@ export default {
|
|
|
884
940
|
</div>
|
|
885
941
|
</div>
|
|
886
942
|
`,
|
|
887
|
-
packetsKey: {
|
|
943
|
+
packetsKey: {
|
|
944
|
+
$def: '*',
|
|
945
|
+
$type: String,
|
|
946
|
+
$save: true
|
|
947
|
+
},
|
|
888
948
|
packetsStart: '',
|
|
889
949
|
packetsEnd: '',
|
|
890
950
|
packetDays: null,
|
|
@@ -929,772 +989,804 @@ export default {
|
|
|
929
989
|
unit: '',
|
|
930
990
|
items: [],
|
|
931
991
|
count: 0,
|
|
932
|
-
opening: {
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
992
|
+
opening: {
|
|
993
|
+
debit: 0,
|
|
994
|
+
credit: 0
|
|
995
|
+
},
|
|
996
|
+
turnover: {
|
|
997
|
+
debit: 0,
|
|
998
|
+
credit: 0
|
|
999
|
+
},
|
|
1000
|
+
closing: {
|
|
1001
|
+
debit: 0,
|
|
1002
|
+
credit: 0
|
|
1003
|
+
},
|
|
1004
|
+
names: {
|
|
1005
|
+
objects: {},
|
|
1006
|
+
classes: {},
|
|
1007
|
+
paths: {}
|
|
1008
|
+
},
|
|
936
1009
|
error: '',
|
|
937
1010
|
money,
|
|
938
1011
|
get analysisSlots() {
|
|
939
|
-
|
|
1012
|
+
return this.slots?.length ? this.slots : [{
|
|
1013
|
+
id: '_default',
|
|
1014
|
+
label: 'Объект / Субсчёт'
|
|
1015
|
+
}];
|
|
940
1016
|
},
|
|
941
1017
|
get analysisGridCols() {
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
1018
|
+
const n = this.analysisSlots.length;
|
|
1019
|
+
const firstCols = Array(n).fill(n === 1 ? 'minmax(210px, 2.5fr)' : 'minmax(150px, 1.45fr)').join(' ');
|
|
1020
|
+
return `${firstCols} repeat(6, minmax(90px, 1fr))`;
|
|
945
1021
|
},
|
|
946
1022
|
slotQueryOf(slotId) {
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
return this.analysisQuery || '';
|
|
951
|
-
return '';
|
|
1023
|
+
if (this.slotQueries && slotId in this.slotQueries) return this.slotQueries[slotId] || '';
|
|
1024
|
+
if (this.analysisSlots.length === 1) return this.analysisQuery || '';
|
|
1025
|
+
return '';
|
|
952
1026
|
},
|
|
953
1027
|
setSlotQuery(slotId, val) {
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
1028
|
+
const v = String(val || '');
|
|
1029
|
+
this.slotQueries = {
|
|
1030
|
+
...(this.slotQueries || {}),
|
|
1031
|
+
[slotId]: v
|
|
1032
|
+
};
|
|
1033
|
+
if (this.analysisSlots.length === 1) this.analysisQuery = v;
|
|
958
1034
|
},
|
|
959
1035
|
get cardGridCols() {
|
|
960
|
-
|
|
961
|
-
|
|
1036
|
+
const slotCols = (this.slots || []).map(() => 'minmax(105px, 1.15fr)').join(' ');
|
|
1037
|
+
return `84px minmax(125px, 1.4fr) minmax(94px, 1fr) minmax(94px, 1fr) minmax(64px, 0.65fr) ${slotCols ? slotCols + ' ' : ''}minmax(125px, 1.3fr) minmax(105px, 1.1fr)`;
|
|
962
1038
|
},
|
|
963
1039
|
get openingText() {
|
|
964
|
-
|
|
1040
|
+
return saldo((Number(this.opening?.debit) || 0) - (Number(this.opening?.credit) || 0));
|
|
965
1041
|
},
|
|
966
1042
|
get closingText() {
|
|
967
|
-
|
|
1043
|
+
return saldo((Number(this.closing?.debit) || 0) - (Number(this.closing?.credit) || 0));
|
|
968
1044
|
},
|
|
969
1045
|
get netTurnoverText() {
|
|
970
|
-
|
|
1046
|
+
return saldo((Number(this.turnover?.debit) || 0) - (Number(this.turnover?.credit) || 0));
|
|
971
1047
|
},
|
|
972
1048
|
get countText() {
|
|
973
|
-
|
|
974
|
-
|
|
1049
|
+
const n = (this.items || []).length;
|
|
1050
|
+
return n < this.count ? `${n} из ${this.count}` : '';
|
|
975
1051
|
},
|
|
976
1052
|
get entryCardDate() {
|
|
977
|
-
|
|
1053
|
+
return this.entryCard?.time ? new Date(this.entryCard.time).toLocaleDateString('ru-RU') : '';
|
|
978
1054
|
},
|
|
979
1055
|
get entryCardOpTitle() {
|
|
980
|
-
|
|
1056
|
+
return this.entryCard?.operation?.title || this.entryCard?.operation?.classLabel || '';
|
|
981
1057
|
},
|
|
982
1058
|
get entryCardDebitLabel() {
|
|
983
|
-
|
|
1059
|
+
return this.entryCard?.debit?.label || this.entryCard?.debit?.account || '';
|
|
984
1060
|
},
|
|
985
1061
|
get entryCardCreditLabel() {
|
|
986
|
-
|
|
1062
|
+
return this.entryCard?.credit?.label || this.entryCard?.credit?.account || '';
|
|
987
1063
|
},
|
|
988
1064
|
accountText(cid) {
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
return label;
|
|
995
|
-
return `${code} ${label}`;
|
|
1065
|
+
const code = String(cid || '').split('/').pop().replace(/^acc\./, '');
|
|
1066
|
+
const label = String(this.names?.classes?.[cid] || '').trim();
|
|
1067
|
+
if (!label || label === code) return code;
|
|
1068
|
+
if (label.startsWith(code + ' ') || label.startsWith(code + '.') || /^\d+(?:\.\d+)?\s/.test(label)) return label;
|
|
1069
|
+
return `${code} ${label}`;
|
|
996
1070
|
},
|
|
997
1071
|
/** Операция: её название, без названия (ядро отдаёт id) — класс операции. */
|
|
998
1072
|
opText(i) {
|
|
999
|
-
|
|
1000
|
-
|
|
1073
|
+
const title = this.names?.objects?.[i.op_id];
|
|
1074
|
+
return (title && title !== i.op_id ? title : '') || this.names?.classes?.[i.op_cid] || i.op_id || '';
|
|
1001
1075
|
},
|
|
1002
1076
|
get displayRows() {
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1077
|
+
return (this.items || []).map(i => ({
|
|
1078
|
+
entry: i.entry || i.id || null,
|
|
1079
|
+
date: i.time ? new Date(i.time).toLocaleDateString() : '',
|
|
1080
|
+
op: this.opText(i),
|
|
1081
|
+
op_id: i.op_id || '',
|
|
1082
|
+
op_cid: i.op_cid || '',
|
|
1083
|
+
debit: money(i.debit),
|
|
1084
|
+
credit: money(i.credit),
|
|
1085
|
+
qty: i.qty ? String(i.qty) : '',
|
|
1086
|
+
slots: (this.slots || []).map(s => {
|
|
1087
|
+
const id = i.analytics?.[s.id];
|
|
1088
|
+
return id ? this.names?.objects?.[id] || id : '';
|
|
1089
|
+
}),
|
|
1090
|
+
corr: this.accountText(i.corr),
|
|
1091
|
+
corr_cid: i.corr || '',
|
|
1092
|
+
bal: saldo(i.balance),
|
|
1093
|
+
storno: !!i.storno
|
|
1094
|
+
}));
|
|
1021
1095
|
},
|
|
1022
1096
|
/** Сводные строки групп для левой таблицы Экрана 3 (Обороты счёта). */
|
|
1023
1097
|
get turnoverGroups() {
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1098
|
+
return (this.groups || []).map(g => ({
|
|
1099
|
+
key: g.key,
|
|
1100
|
+
label: g.label,
|
|
1101
|
+
debit: money(g.debit),
|
|
1102
|
+
credit: money(g.credit),
|
|
1103
|
+
balance: saldo(g.balance),
|
|
1104
|
+
turnover: saldo(g.turnover),
|
|
1105
|
+
count: g.count || 0
|
|
1106
|
+
}));
|
|
1033
1107
|
},
|
|
1034
1108
|
/** Первичные документы выбранного периода для правой таблицы Экрана 3 (Обороты счёта). */
|
|
1035
1109
|
get turnoverDocs() {
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1110
|
+
const sel = this.selectedGroupKey;
|
|
1111
|
+
const list = (this.items || []).filter(i => !sel || !i.groupKey || i.groupKey === sel);
|
|
1112
|
+
return list.map(i => {
|
|
1113
|
+
const corrName = this.accountText(i.corr);
|
|
1114
|
+
const prefix = Number(i.debit) > 0 ? 'со сч. ' : 'на сч. ';
|
|
1115
|
+
return {
|
|
1116
|
+
entry: i.entry || i.id || null,
|
|
1117
|
+
date: i.time ? new Date(i.time).toLocaleDateString() : '',
|
|
1118
|
+
op: this.opText(i),
|
|
1119
|
+
op_id: i.op_id || '',
|
|
1120
|
+
op_cid: i.op_cid || '',
|
|
1121
|
+
corr: corrName,
|
|
1122
|
+
corrDir: corrName ? prefix + corrName : '',
|
|
1123
|
+
corr_cid: i.corr || '',
|
|
1124
|
+
debit: money(i.debit),
|
|
1125
|
+
credit: money(i.credit),
|
|
1126
|
+
rawDebit: Number(i.debit) || 0,
|
|
1127
|
+
rawCredit: Number(i.credit) || 0,
|
|
1128
|
+
storno: !!i.storno
|
|
1129
|
+
};
|
|
1130
|
+
});
|
|
1057
1131
|
},
|
|
1058
1132
|
get turnoverDocsTotals() {
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1133
|
+
let d = 0,
|
|
1134
|
+
c = 0;
|
|
1135
|
+
for (const doc of this.turnoverDocs || []) {
|
|
1136
|
+
d += doc.rawDebit || 0;
|
|
1137
|
+
c += doc.rawCredit || 0;
|
|
1138
|
+
}
|
|
1139
|
+
return {
|
|
1140
|
+
debit: money(d),
|
|
1141
|
+
credit: money(c)
|
|
1142
|
+
};
|
|
1065
1143
|
},
|
|
1066
1144
|
/** Форматирование ячеек Анализа счёта (Сумма или Количество). */
|
|
1067
1145
|
analysisCells(r) {
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
return {
|
|
1073
|
-
open_debit: openNet > 0 ? qtyFmt(openNet) : '',
|
|
1074
|
-
open_credit: openNet < 0 ? qtyFmt(-openNet) : '',
|
|
1075
|
-
debit: qtyFmt(q.debit),
|
|
1076
|
-
credit: qtyFmt(q.credit),
|
|
1077
|
-
close_debit: closeNet > 0 ? qtyFmt(closeNet) : '',
|
|
1078
|
-
close_credit: closeNet < 0 ? qtyFmt(-closeNet) : '',
|
|
1079
|
-
};
|
|
1080
|
-
}
|
|
1146
|
+
if (this.valueMode === 'qty') {
|
|
1147
|
+
const q = r?.qty || {};
|
|
1148
|
+
const openNet = Number(q.opening) || 0;
|
|
1149
|
+
const closeNet = Number(q.closing) || 0;
|
|
1081
1150
|
return {
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1151
|
+
open_debit: openNet > 0 ? qtyFmt(openNet) : '',
|
|
1152
|
+
open_credit: openNet < 0 ? qtyFmt(-openNet) : '',
|
|
1153
|
+
debit: qtyFmt(q.debit),
|
|
1154
|
+
credit: qtyFmt(q.credit),
|
|
1155
|
+
close_debit: closeNet > 0 ? qtyFmt(closeNet) : '',
|
|
1156
|
+
close_credit: closeNet < 0 ? qtyFmt(-closeNet) : ''
|
|
1085
1157
|
};
|
|
1158
|
+
}
|
|
1159
|
+
return {
|
|
1160
|
+
open_debit: money(r?.opening?.debit),
|
|
1161
|
+
open_credit: money(r?.opening?.credit),
|
|
1162
|
+
debit: money(r?.turnover?.debit),
|
|
1163
|
+
credit: money(r?.turnover?.credit),
|
|
1164
|
+
close_debit: money(r?.closing?.debit),
|
|
1165
|
+
close_credit: money(r?.closing?.credit)
|
|
1166
|
+
};
|
|
1086
1167
|
},
|
|
1087
1168
|
/** Строки таблицы Экрана 2 (Анализ счёта) с колонками по каждому аналитическому справочнику. */
|
|
1088
1169
|
get analysisRows() {
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
});
|
|
1103
|
-
const label = r.key
|
|
1104
|
-
? slotCells.join(' / ')
|
|
1105
|
-
: this.accountText(r.account);
|
|
1106
|
-
return {
|
|
1107
|
-
account: r.account,
|
|
1108
|
-
key: r.key || null,
|
|
1109
|
-
detail: !!r.key,
|
|
1110
|
-
slotCells,
|
|
1111
|
-
label,
|
|
1112
|
-
indent: (Number(r.level) || 0) * 16,
|
|
1113
|
-
...this.analysisCells(r),
|
|
1114
|
-
};
|
|
1115
|
-
});
|
|
1116
|
-
return rows.filter(r => {
|
|
1117
|
-
if (q && !r.label.toLowerCase().includes(q))
|
|
1118
|
-
return false;
|
|
1119
|
-
for (let i = 0; i < aSlots.length; i++) {
|
|
1120
|
-
const slotQ = String(sq[aSlots[i].id] || '').trim().toLowerCase();
|
|
1121
|
-
if (slotQ && !String(r.slotCells[i] || '').toLowerCase().includes(slotQ))
|
|
1122
|
-
return false;
|
|
1123
|
-
}
|
|
1124
|
-
return true;
|
|
1170
|
+
const q = String(this.analysisQuery || '').trim().toLowerCase();
|
|
1171
|
+
const sq = this.slotQueries || {};
|
|
1172
|
+
const aSlots = this.analysisSlots;
|
|
1173
|
+
const rawList = this.sheetRows || [];
|
|
1174
|
+
const hasDetailRows = rawList.some(r => r?.key);
|
|
1175
|
+
const filteredRaw = hasDetailRows ? rawList.filter(r => r?.key) : rawList;
|
|
1176
|
+
const rows = filteredRaw.map(r => {
|
|
1177
|
+
const slotCells = aSlots.map(s => {
|
|
1178
|
+
if (r.key && typeof r.key === 'object') {
|
|
1179
|
+
const id = s.id in r.key ? r.key[s.id] : Object.values(r.key)[0];
|
|
1180
|
+
return id === null || id === undefined ? '—' : this.names?.objects?.[id] || String(id);
|
|
1181
|
+
}
|
|
1182
|
+
return this.accountText(r.account);
|
|
1125
1183
|
});
|
|
1184
|
+
const label = r.key ? slotCells.join(' / ') : this.accountText(r.account);
|
|
1185
|
+
return {
|
|
1186
|
+
account: r.account,
|
|
1187
|
+
key: r.key || null,
|
|
1188
|
+
detail: !!r.key,
|
|
1189
|
+
slotCells,
|
|
1190
|
+
label,
|
|
1191
|
+
indent: (Number(r.level) || 0) * 16,
|
|
1192
|
+
...this.analysisCells(r)
|
|
1193
|
+
};
|
|
1194
|
+
});
|
|
1195
|
+
return rows.filter(r => {
|
|
1196
|
+
if (q && !r.label.toLowerCase().includes(q)) return false;
|
|
1197
|
+
for (let i = 0; i < aSlots.length; i++) {
|
|
1198
|
+
const slotQ = String(sq[aSlots[i].id] || '').trim().toLowerCase();
|
|
1199
|
+
if (slotQ && !String(r.slotCells[i] || '').toLowerCase().includes(slotQ)) return false;
|
|
1200
|
+
}
|
|
1201
|
+
return true;
|
|
1202
|
+
});
|
|
1126
1203
|
},
|
|
1127
1204
|
get analysisTotals() {
|
|
1128
|
-
|
|
1205
|
+
return this.analysisCells(this.sheetTotal);
|
|
1129
1206
|
},
|
|
1130
1207
|
featureLabel(feat) {
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
return `${feat.slotLabel}: ${feat.label || feat.id}`;
|
|
1135
|
-
return feat.label || feat.id;
|
|
1208
|
+
if (!feat) return '';
|
|
1209
|
+
if ((this.slots || []).length > 1 && feat.slotLabel) return `${feat.slotLabel}: ${feat.label || feat.id}`;
|
|
1210
|
+
return feat.label || feat.id;
|
|
1136
1211
|
},
|
|
1137
1212
|
featureValueOf(feat) {
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
return String(this.filters?.[feat.slotId] || '');
|
|
1142
|
-
return String(this.featureValues?.[feat.id] || '');
|
|
1213
|
+
if (!feat) return '';
|
|
1214
|
+
if (feat.isObject) return String(this.filters?.[feat.slotId] || '');
|
|
1215
|
+
return String(this.featureValues?.[feat.id] || '');
|
|
1143
1216
|
},
|
|
1144
1217
|
featureValueLabel(feat) {
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
return opt?.label || val;
|
|
1218
|
+
const val = this.featureValueOf(feat);
|
|
1219
|
+
if (!val) return 'Все';
|
|
1220
|
+
const opt = (feat?.options || []).find(o => o.value === val);
|
|
1221
|
+
return opt?.label || val;
|
|
1150
1222
|
},
|
|
1151
1223
|
async setFeatureValue(feat, value) {
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1164
|
-
|
|
1224
|
+
if (!feat) return;
|
|
1225
|
+
const val = String(value || '');
|
|
1226
|
+
if (feat.isObject) {
|
|
1227
|
+
this.filters = {
|
|
1228
|
+
...(this.filters || {}),
|
|
1229
|
+
[feat.slotId]: val
|
|
1230
|
+
};
|
|
1231
|
+
await this.onFilterChanged();
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
this.featureValues = {
|
|
1235
|
+
...(this.featureValues || {}),
|
|
1236
|
+
[feat.id]: val
|
|
1237
|
+
};
|
|
1238
|
+
if (val && !(this.activeSlots || []).includes(feat.spec) && !(this.activeSlots || []).includes(feat.slotId)) {
|
|
1239
|
+
this.activeSlots = [...(this.activeSlots || []), feat.spec];
|
|
1240
|
+
}
|
|
1241
|
+
await this.reload();
|
|
1165
1242
|
},
|
|
1166
1243
|
async moveFeature(delta) {
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
if (this.mode === 'analysis')
|
|
1183
|
-
await this.reload();
|
|
1244
|
+
const list = [...(this.analyticFeatures || [])];
|
|
1245
|
+
const idx = list.findIndex(f => f.id === this.selectedFeatureId);
|
|
1246
|
+
if (idx < 0) return;
|
|
1247
|
+
const target = idx + delta;
|
|
1248
|
+
if (target < 0 || target >= list.length) return;
|
|
1249
|
+
const [moved] = list.splice(idx, 1);
|
|
1250
|
+
list.splice(target, 0, moved);
|
|
1251
|
+
this.analyticFeatures = list;
|
|
1252
|
+
const order = list.map(f => f.spec);
|
|
1253
|
+
this.activeSlots = (this.activeSlots || []).slice().sort((a, b) => {
|
|
1254
|
+
const ia = order.indexOf(a),
|
|
1255
|
+
ib = order.indexOf(b);
|
|
1256
|
+
return (ia < 0 ? 999 : ia) - (ib < 0 ? 999 : ib);
|
|
1257
|
+
});
|
|
1258
|
+
if (this.mode === 'analysis') await this.reload();
|
|
1184
1259
|
},
|
|
1185
1260
|
isSlotActive(slotId) {
|
|
1186
|
-
|
|
1261
|
+
return (this.activeSlots || []).includes(slotId);
|
|
1187
1262
|
},
|
|
1188
1263
|
async toggleSlot(slotId, checked) {
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
return (ia < 0 ? 999 : ia) - (ib < 0 ? 999 : ib);
|
|
1200
|
-
});
|
|
1201
|
-
if (this.mode === 'analysis')
|
|
1202
|
-
await this.reload();
|
|
1264
|
+
const cur = new Set(this.activeSlots || []);
|
|
1265
|
+
if (checked) cur.add(slotId);else cur.delete(slotId);
|
|
1266
|
+
const order = (this.analyticFeatures || []).map(f => f.spec);
|
|
1267
|
+
this.activeSlots = [...cur].sort((a, b) => {
|
|
1268
|
+
const ia = order.indexOf(a),
|
|
1269
|
+
ib = order.indexOf(b);
|
|
1270
|
+
if (ia < 0 && ib < 0) return 0;
|
|
1271
|
+
return (ia < 0 ? 999 : ia) - (ib < 0 ? 999 : ib);
|
|
1272
|
+
});
|
|
1273
|
+
if (this.mode === 'analysis') await this.reload();
|
|
1203
1274
|
},
|
|
1204
1275
|
async moveSlot(index, delta) {
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
if (this.mode === 'analysis')
|
|
1218
|
-
await this.reload();
|
|
1276
|
+
const list = [...(this.slots || [])];
|
|
1277
|
+
const target = index + delta;
|
|
1278
|
+
if (index < 0 || index >= list.length || target < 0 || target >= list.length) return;
|
|
1279
|
+
const [moved] = list.splice(index, 1);
|
|
1280
|
+
list.splice(target, 0, moved);
|
|
1281
|
+
this.slots = list;
|
|
1282
|
+
const order = list.map(s => s.id);
|
|
1283
|
+
this.activeSlots = (this.activeSlots || []).slice().sort((a, b) => order.indexOf(a) - order.indexOf(b));
|
|
1284
|
+
if (this.analyticFeatures?.length) {
|
|
1285
|
+
this.analyticFeatures = [...this.analyticFeatures].sort((a, b) => order.indexOf(a.slotId) - order.indexOf(b.slotId));
|
|
1286
|
+
}
|
|
1287
|
+
if (this.mode === 'analysis') await this.reload();
|
|
1219
1288
|
},
|
|
1220
1289
|
async setUnit(val) {
|
|
1221
|
-
|
|
1222
|
-
|
|
1290
|
+
this.unit = String(val || '');
|
|
1291
|
+
await this.reload();
|
|
1223
1292
|
},
|
|
1224
1293
|
async onFilterChanged() {
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
await this.reload();
|
|
1294
|
+
const sig = JSON.stringify(this.analytics());
|
|
1295
|
+
if (this._lastFilterSig === sig) return;
|
|
1296
|
+
this._lastFilterSig = sig;
|
|
1297
|
+
await this.reload();
|
|
1230
1298
|
},
|
|
1231
1299
|
async setSubFilter(slotId, value) {
|
|
1232
|
-
|
|
1233
|
-
|
|
1300
|
+
this.subFilters = {
|
|
1301
|
+
...(this.subFilters || {}),
|
|
1302
|
+
[slotId]: String(value || '')
|
|
1303
|
+
};
|
|
1304
|
+
await this.reload();
|
|
1234
1305
|
},
|
|
1235
1306
|
setValueMode(vm) {
|
|
1236
|
-
|
|
1307
|
+
this.valueMode = vm === 'qty' ? 'qty' : 'amount';
|
|
1237
1308
|
},
|
|
1238
1309
|
async setMode(m) {
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
this.async?.(() => this.render?.());
|
|
1310
|
+
const next = ['card', 'analysis', 'turnovers'].includes(m) ? m : 'card';
|
|
1311
|
+
if (this.mode === next) return;
|
|
1312
|
+
this.mode = next;
|
|
1313
|
+
await this.reload();
|
|
1314
|
+
this.async?.(() => this.render?.());
|
|
1245
1315
|
},
|
|
1246
1316
|
async setGroupBy(g) {
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1317
|
+
this.groupBy = g || 'quarter';
|
|
1318
|
+
this.selectedGroupKey = '';
|
|
1319
|
+
await this.reload();
|
|
1250
1320
|
},
|
|
1251
1321
|
_notifyConsultantContext() {
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
}
|
|
1264
|
-
catch { /* ignore */ }
|
|
1322
|
+
try {
|
|
1323
|
+
const wf = this._findFormHost?.() || this.domHost;
|
|
1324
|
+
if (!wf || typeof wf.buildConsultantContext !== 'function') return;
|
|
1325
|
+
const exp = window.top?.explorer || window.parent?.explorer;
|
|
1326
|
+
const cons = exp?.$?.('#consultant') || exp?.$?.('item-consultant');
|
|
1327
|
+
if (cons) {
|
|
1328
|
+
const ctx = wf.buildConsultantContext();
|
|
1329
|
+
cons.activeFormContext = ctx;
|
|
1330
|
+
cons.activeFormSummary = ctx;
|
|
1331
|
+
}
|
|
1332
|
+
} catch {/* ignore */}
|
|
1265
1333
|
},
|
|
1266
1334
|
selectGroup(key) {
|
|
1267
|
-
|
|
1268
|
-
|
|
1335
|
+
this.selectedGroupKey = this.selectedGroupKey === key ? '' : key;
|
|
1336
|
+
this._notifyConsultantContext();
|
|
1269
1337
|
},
|
|
1270
1338
|
async openTurnoversFromAnalysis(row) {
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1339
|
+
const r = row || this.selectedAnalysisRow;
|
|
1340
|
+
if (r?.key && typeof r.key === 'object') {
|
|
1341
|
+
const next = {
|
|
1342
|
+
...(this.filters || {})
|
|
1343
|
+
};
|
|
1344
|
+
for (const [k, v] of Object.entries(r.key)) {
|
|
1345
|
+
if (v) next[k] = v;
|
|
1346
|
+
}
|
|
1347
|
+
this.filters = next;
|
|
1348
|
+
}
|
|
1349
|
+
const host = this.domHost || this.parentElement;
|
|
1350
|
+
if (host && typeof host.applyNav === 'function' && host.view?.id && host.view.id !== 'turnovers') {
|
|
1351
|
+
await host.applyNav({
|
|
1352
|
+
view: 'turnovers',
|
|
1353
|
+
mode: 'turnovers',
|
|
1354
|
+
from: this.from,
|
|
1355
|
+
to: this.to,
|
|
1356
|
+
packetsKey: this.packetsKey,
|
|
1357
|
+
unit: this.unit,
|
|
1358
|
+
filters: this.filters
|
|
1359
|
+
});
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
this.mode = 'turnovers';
|
|
1363
|
+
await this.reload();
|
|
1295
1364
|
},
|
|
1296
1365
|
/** Открыть сборную карточку проводки (Экран 4 ODANT) по номеру entry. */
|
|
1297
1366
|
async openEntry(entryId) {
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1367
|
+
if (!entryId || !this.$item) return null;
|
|
1368
|
+
this.error = '';
|
|
1369
|
+
try {
|
|
1370
|
+
const card = await this.$item.fetch('db_entry', {
|
|
1371
|
+
entry: entryId
|
|
1372
|
+
});
|
|
1373
|
+
if (card && typeof card === 'object') {
|
|
1374
|
+
const t = card.operation?.title;
|
|
1375
|
+
card.opTitle = (t && t !== card.operation?.id ? t : '') || card.operation?.label || card.operation?.classLabel || t || '';
|
|
1376
|
+
card.debitLabel = card.debit?.label || card.debit?.account || '';
|
|
1377
|
+
card.debitAmount = card.debit?.amount ?? card.amount ?? 0;
|
|
1378
|
+
card.debitQty = card.debit?.qty ?? card.qty ?? 0;
|
|
1379
|
+
card.debitAnalytics = card.debit?.analytics || [];
|
|
1380
|
+
card.creditLabel = card.credit?.label || card.credit?.account || '';
|
|
1381
|
+
card.creditAmount = card.credit?.amount ?? card.amount ?? 0;
|
|
1382
|
+
card.creditQty = card.credit?.qty ?? card.qty ?? 0;
|
|
1383
|
+
card.creditAnalytics = card.credit?.analytics || [];
|
|
1384
|
+
}
|
|
1385
|
+
this.entryCard = card;
|
|
1386
|
+
return this.entryCard;
|
|
1387
|
+
} catch (e) {
|
|
1388
|
+
this.error = String(e?.message || e);
|
|
1389
|
+
return null;
|
|
1390
|
+
}
|
|
1322
1391
|
},
|
|
1323
1392
|
closeEntry() {
|
|
1324
|
-
|
|
1393
|
+
this.entryCard = null;
|
|
1325
1394
|
},
|
|
1326
1395
|
openEntryOperation() {
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
});
|
|
1396
|
+
if (!this.entryCard?.operation) return;
|
|
1397
|
+
return this.openOperation({
|
|
1398
|
+
op_cid: this.entryCard.operation.path || this.entryCard.operation.cid,
|
|
1399
|
+
op_id: this.entryCard.operation.id
|
|
1400
|
+
});
|
|
1333
1401
|
},
|
|
1334
1402
|
openEntrySideAccount(side) {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1403
|
+
const s = side === 'credit' ? this.entryCard?.credit : this.entryCard?.debit;
|
|
1404
|
+
if (!s?.path && !s?.account) return;
|
|
1405
|
+
return this.openCorr({
|
|
1406
|
+
corr_cid: s.path || s.account
|
|
1407
|
+
});
|
|
1339
1408
|
},
|
|
1340
1409
|
_findFormHost() {
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1347
|
-
return null;
|
|
1410
|
+
if (this.$form && ('focusedItem' in this.$form || typeof this.$form.syncFromView === 'function' || typeof this.$form.setFormPeriod === 'function')) return this.$form;
|
|
1411
|
+
for (let p = this.parentElement || this.domHost; p; p = p.parentElement || p.domHost) {
|
|
1412
|
+
if (p.localName === 'work-form' || typeof p.syncFromView === 'function' || typeof p.setFormPeriod === 'function' || 'focusedItem' in p) return p;
|
|
1413
|
+
}
|
|
1414
|
+
return null;
|
|
1348
1415
|
},
|
|
1349
1416
|
async onPackets(e) {
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1417
|
+
const d = e?.detail?.value ?? e?.detail ?? {};
|
|
1418
|
+
if (Array.isArray(d)) return;
|
|
1419
|
+
if (this._initializingPackets) return;
|
|
1420
|
+
const nextKey = d.value || (d.selected?.name === '*' ? '*' : d.selected?.mask || this.packetsKey || '*');
|
|
1421
|
+
if (d.selected?.name === '*') {
|
|
1422
|
+
this.packetsKey = '*';
|
|
1423
|
+
_writeSavedPeriod('*', '', '');
|
|
1424
|
+
this._findFormHost()?.setFormPeriod?.({
|
|
1425
|
+
packetsKey: '*',
|
|
1426
|
+
from: '',
|
|
1427
|
+
to: ''
|
|
1428
|
+
});
|
|
1429
|
+
if (this._packetFiltered || this.from || this.to) {
|
|
1430
|
+
this._packetFiltered = false;
|
|
1431
|
+
this.from = '';
|
|
1432
|
+
this.to = '';
|
|
1433
|
+
await this.reload();
|
|
1434
|
+
}
|
|
1435
|
+
return;
|
|
1436
|
+
}
|
|
1437
|
+
if (d.period?.start && d.period?.end) {
|
|
1438
|
+
const changed = this.from !== d.period.start || this.to !== d.period.end || !this._packetFiltered;
|
|
1439
|
+
this._packetFiltered = true;
|
|
1440
|
+
this.from = d.period.start;
|
|
1441
|
+
this.to = d.period.end;
|
|
1442
|
+
this.packetsKey = _derivePacketsKey(this.from, this.to, nextKey);
|
|
1443
|
+
_writeSavedPeriod(this.packetsKey, this.from, this.to);
|
|
1444
|
+
this._findFormHost()?.setFormPeriod?.({
|
|
1445
|
+
packetsKey: this.packetsKey,
|
|
1446
|
+
from: this.from,
|
|
1447
|
+
to: this.to
|
|
1448
|
+
});
|
|
1449
|
+
if (changed) await this.reload();
|
|
1450
|
+
}
|
|
1379
1451
|
},
|
|
1380
1452
|
_restorePeriodState(nav = null) {
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1453
|
+
const hasNavPeriod = nav && (nav.from !== undefined || nav.to !== undefined || nav.packetsKey);
|
|
1454
|
+
if (!hasNavPeriod && (this.from || this.to)) return;
|
|
1455
|
+
const formPeriod = this._findFormHost()?.formPeriod || null;
|
|
1456
|
+
const saved = _readSavedPeriod();
|
|
1457
|
+
const localSavedKey = typeof this.loadFromLocalStorage === 'function' ? this.loadFromLocalStorage('packetsKey') : undefined;
|
|
1458
|
+
if (!hasNavPeriod && !formPeriod && !saved && typeof localSavedKey === 'string' && localSavedKey && (typeof this.packetsKey !== 'string' || this.packetsKey === '*')) this.packetsKey = localSavedKey;
|
|
1459
|
+
const pk = typeof this.packetsKey === 'string' ? this.packetsKey : '';
|
|
1460
|
+
const src = hasNavPeriod ? nav : formPeriod || saved || (pk && pk !== '*' ? {
|
|
1461
|
+
packetsKey: pk
|
|
1462
|
+
} : null);
|
|
1463
|
+
if (!src) return;
|
|
1464
|
+
this._initializingPackets = true;
|
|
1465
|
+
try {
|
|
1466
|
+
const rawKey = typeof src.packetsKey === 'string' && src.packetsKey ? src.packetsKey : pk || '*';
|
|
1467
|
+
let from = String(src.from || '');
|
|
1468
|
+
let to = String(src.to || '');
|
|
1469
|
+
if (!from && !to && rawKey !== '*') {
|
|
1470
|
+
const derived = _boundsFromPacketsKey(rawKey, 'month');
|
|
1471
|
+
if (derived.from && derived.to) {
|
|
1472
|
+
from = derived.from;
|
|
1473
|
+
to = derived.to;
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
const key = _derivePacketsKey(from, to, rawKey);
|
|
1477
|
+
this.from = from;
|
|
1478
|
+
this.to = to;
|
|
1479
|
+
this._packetFiltered = !!(from || to);
|
|
1480
|
+
this.packetsKey = key;
|
|
1481
|
+
this._findFormHost()?.setFormPeriod?.({
|
|
1482
|
+
packetsKey: this.packetsKey,
|
|
1483
|
+
from: this.from,
|
|
1484
|
+
to: this.to
|
|
1485
|
+
});
|
|
1486
|
+
} finally {
|
|
1487
|
+
this._initializingPackets = false;
|
|
1488
|
+
}
|
|
1415
1489
|
},
|
|
1416
1490
|
async syncFormPeriod(fp) {
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
this._restorePeriodState(fp);
|
|
1425
|
-
await this.reload();
|
|
1491
|
+
if (!fp || typeof fp !== 'object') return;
|
|
1492
|
+
const nextFrom = String(fp.from || '');
|
|
1493
|
+
const nextTo = String(fp.to || '');
|
|
1494
|
+
const nextKey = String(fp.packetsKey || '*');
|
|
1495
|
+
if (this.from === nextFrom && this.to === nextTo && this.packetsKey === nextKey) return;
|
|
1496
|
+
this._restorePeriodState(fp);
|
|
1497
|
+
await this.reload();
|
|
1426
1498
|
},
|
|
1427
1499
|
_applyNavFields(nav) {
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
this.
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
this.filters = { ...nav.filters };
|
|
1443
|
-
_writeSavedPeriod(this.packetsKey, this.from, this.to);
|
|
1444
|
-
this._findFormHost()?.setFormPeriod?.({ packetsKey: this.packetsKey, from: this.from, to: this.to });
|
|
1500
|
+
if (!nav || typeof nav !== 'object') return;
|
|
1501
|
+
if (nav.mode && ['card', 'analysis', 'turnovers'].includes(nav.mode)) this.mode = nav.mode;else if (nav.view === 'turnovers' || nav.view === 'analysis') this.mode = nav.view;else if (nav.view === 'postings') this.mode = 'card';
|
|
1502
|
+
if (nav.groupBy) this.groupBy = String(nav.groupBy);
|
|
1503
|
+
this._restorePeriodState(nav);
|
|
1504
|
+
if (nav.unit !== undefined) this.unit = String(nav.unit || '');
|
|
1505
|
+
if (nav.filters && typeof nav.filters === 'object') this.filters = {
|
|
1506
|
+
...nav.filters
|
|
1507
|
+
};
|
|
1508
|
+
_writeSavedPeriod(this.packetsKey, this.from, this.to);
|
|
1509
|
+
this._findFormHost()?.setFormPeriod?.({
|
|
1510
|
+
packetsKey: this.packetsKey,
|
|
1511
|
+
from: this.from,
|
|
1512
|
+
to: this.to
|
|
1513
|
+
});
|
|
1445
1514
|
},
|
|
1446
1515
|
async attached() {
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
await Promise.all([this.loadSlots(), this.loadScope()]);
|
|
1456
|
-
await this.reload();
|
|
1457
|
-
if (initNav?.entry)
|
|
1458
|
-
await this.openEntry(initNav.entry);
|
|
1459
|
-
this._attachedDone = true;
|
|
1516
|
+
if (this._attachedDone && !this._initialNav) return;
|
|
1517
|
+
const initNav = this._initialNav;
|
|
1518
|
+
this._initialNav = null;
|
|
1519
|
+
if (initNav) this._applyNavFields(initNav);else this._restorePeriodState();
|
|
1520
|
+
await Promise.all([this.loadSlots(), this.loadScope()]);
|
|
1521
|
+
await this.reload();
|
|
1522
|
+
if (initNav?.entry) await this.openEntry(initNav.entry);
|
|
1523
|
+
this._attachedDone = true;
|
|
1460
1524
|
},
|
|
1461
1525
|
async applyNav(nav) {
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
if (nav.entry)
|
|
1467
|
-
await this.openEntry(nav.entry);
|
|
1526
|
+
if (!nav || typeof nav !== 'object') return;
|
|
1527
|
+
this._applyNavFields(nav);
|
|
1528
|
+
await this.reload();
|
|
1529
|
+
if (nav.entry) await this.openEntry(nav.entry);
|
|
1468
1530
|
},
|
|
1469
1531
|
async openOperation(row) {
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
}
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1532
|
+
const path = this.names?.paths?.[row?.op_cid] || row?.op_cid;
|
|
1533
|
+
if (!path) return;
|
|
1534
|
+
try {
|
|
1535
|
+
const t = await WORK.get_item(path);
|
|
1536
|
+
if (t && window.execute) window.execute(t, {
|
|
1537
|
+
view: 'objects',
|
|
1538
|
+
id: row.op_id
|
|
1539
|
+
});
|
|
1540
|
+
} catch (e) {
|
|
1541
|
+
this.error = String(e?.message || e);
|
|
1542
|
+
}
|
|
1481
1543
|
},
|
|
1482
1544
|
async openCorr(row) {
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1545
|
+
const path = this.names?.paths?.[row?.corr_cid] || row?.corr_cid;
|
|
1546
|
+
if (!path) return;
|
|
1547
|
+
try {
|
|
1548
|
+
const t = await WORK.get_item(path);
|
|
1549
|
+
if (t && window.execute) window.execute(t, {
|
|
1550
|
+
view: 'postings',
|
|
1551
|
+
from: this.from,
|
|
1552
|
+
to: this.to,
|
|
1553
|
+
unit: this.unit
|
|
1554
|
+
});
|
|
1555
|
+
} catch (e) {
|
|
1556
|
+
this.error = String(e?.message || e);
|
|
1557
|
+
}
|
|
1494
1558
|
},
|
|
1495
1559
|
/** Видимые подразделения для фильтра; без ответа — без фильтра. */
|
|
1496
1560
|
async loadScope() {
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
}
|
|
1561
|
+
try {
|
|
1562
|
+
const s = await this.$item?.fetch('db_scope');
|
|
1563
|
+
this.units = Array.isArray(s?.units) && !s.all ? s.units : [];
|
|
1564
|
+
} catch {
|
|
1565
|
+
this.units = [];
|
|
1566
|
+
}
|
|
1504
1567
|
},
|
|
1505
1568
|
/** Слоты аналитик счёта из схемы ядра (с учётом наследования) и поля прилинкованных справочников. */
|
|
1506
1569
|
loadSlots() {
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
}
|
|
1540
|
-
catch (e) {
|
|
1541
|
-
this.slots = [];
|
|
1542
|
-
this.activeSlots = [];
|
|
1543
|
-
this.analyticFeatures = [];
|
|
1544
|
-
this.selectedFeatureId = '';
|
|
1545
|
-
this.error = String(e?.message || e);
|
|
1546
|
-
}
|
|
1547
|
-
finally {
|
|
1548
|
-
if (this._slotsPromise === p)
|
|
1549
|
-
this._slotsPromise = null;
|
|
1570
|
+
const p = (async () => {
|
|
1571
|
+
try {
|
|
1572
|
+
const res = await this.$item?.fetch('db_schema');
|
|
1573
|
+
const s = res?.schema;
|
|
1574
|
+
const fields = Array.isArray(s?.fields) ? s.fields : [];
|
|
1575
|
+
this.slots = fields.filter(f => f?.analytic && f.type === 'link').map(f => ({
|
|
1576
|
+
id: f.id,
|
|
1577
|
+
label: f.label || f.id,
|
|
1578
|
+
type: 'Link',
|
|
1579
|
+
catalog: f.targetPath || f.target,
|
|
1580
|
+
placeholder: f.label || f.id
|
|
1581
|
+
}));
|
|
1582
|
+
this.activeSlots = this.slots.map(f => f.id);
|
|
1583
|
+
const serverSlots = Array.isArray(res?.slots) ? res.slots : [];
|
|
1584
|
+
const features = [];
|
|
1585
|
+
for (const slot of this.slots) {
|
|
1586
|
+
const srv = serverSlots.find(x => x.id === slot.id);
|
|
1587
|
+
if (Array.isArray(srv?.fields) && srv.fields.length) {
|
|
1588
|
+
features.push(...srv.fields);
|
|
1589
|
+
} else {
|
|
1590
|
+
features.push({
|
|
1591
|
+
id: slot.id,
|
|
1592
|
+
spec: slot.id,
|
|
1593
|
+
slotId: slot.id,
|
|
1594
|
+
fieldId: 'name',
|
|
1595
|
+
label: 'Наименование',
|
|
1596
|
+
slotLabel: slot.label,
|
|
1597
|
+
isObject: true,
|
|
1598
|
+
type: 'link',
|
|
1599
|
+
catalog: slot.catalog,
|
|
1600
|
+
options: []
|
|
1601
|
+
});
|
|
1550
1602
|
}
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1603
|
+
}
|
|
1604
|
+
this.analyticFeatures = features;
|
|
1605
|
+
this.selectedFeatureId = features[0]?.id || '';
|
|
1606
|
+
} catch (e) {
|
|
1607
|
+
this.slots = [];
|
|
1608
|
+
this.activeSlots = [];
|
|
1609
|
+
this.analyticFeatures = [];
|
|
1610
|
+
this.selectedFeatureId = '';
|
|
1611
|
+
this.error = String(e?.message || e);
|
|
1612
|
+
} finally {
|
|
1613
|
+
if (this._slotsPromise === p) this._slotsPromise = null;
|
|
1614
|
+
}
|
|
1615
|
+
})();
|
|
1616
|
+
this._slotsPromise = p;
|
|
1617
|
+
return p;
|
|
1554
1618
|
},
|
|
1555
1619
|
/** Заданные фильтры аналитик. */
|
|
1556
1620
|
analytics() {
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
return out;
|
|
1621
|
+
const out = {};
|
|
1622
|
+
for (const [k, v] of Object.entries(this.filters || {})) {
|
|
1623
|
+
if (v) out[k] = v;
|
|
1624
|
+
}
|
|
1625
|
+
return out;
|
|
1563
1626
|
},
|
|
1564
1627
|
/** Заданные фильтры субаналитик. */
|
|
1565
1628
|
subanalytics() {
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1629
|
+
const out = {};
|
|
1630
|
+
for (const [slotId, raw] of Object.entries(this.subFilters || {})) {
|
|
1631
|
+
const parsed = parseSubFilterInput(raw);
|
|
1632
|
+
if (parsed) out[slotId] = {
|
|
1633
|
+
...(out[slotId] || {}),
|
|
1634
|
+
...parsed
|
|
1635
|
+
};
|
|
1636
|
+
}
|
|
1637
|
+
for (const feat of this.analyticFeatures || []) {
|
|
1638
|
+
if (feat.isObject) continue;
|
|
1639
|
+
const val = this.featureValues?.[feat.id];
|
|
1640
|
+
if (val !== undefined && val !== null && val !== '') {
|
|
1641
|
+
if (!out[feat.slotId]) out[feat.slotId] = {};
|
|
1642
|
+
out[feat.slotId][feat.fieldId] = feat.type === 'boolean' ? val === '1' || val === 'true' ? 1 : 0 : val;
|
|
1643
|
+
}
|
|
1644
|
+
}
|
|
1645
|
+
return out;
|
|
1583
1646
|
},
|
|
1584
1647
|
params() {
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
return p;
|
|
1648
|
+
const p = {
|
|
1649
|
+
limit: 500
|
|
1650
|
+
};
|
|
1651
|
+
for (const key of ['from', 'to', 'unit']) {
|
|
1652
|
+
const s = String(this[key] ?? '').trim();
|
|
1653
|
+
if (s) p[key] = s;
|
|
1654
|
+
}
|
|
1655
|
+
const a = this.analytics();
|
|
1656
|
+
if (Object.keys(a).length) p.analytics = JSON.stringify(a);
|
|
1657
|
+
const sub = this.subanalytics();
|
|
1658
|
+
if (Object.keys(sub).length) p.subanalytics = JSON.stringify(sub);
|
|
1659
|
+
return p;
|
|
1598
1660
|
},
|
|
1599
1661
|
_syncPacketRange(res) {
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
if (!
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
this.packetsEnd = _yearEnd();
|
|
1606
|
-
}
|
|
1607
|
-
return false;
|
|
1608
|
-
}
|
|
1609
|
-
const r = res.range;
|
|
1610
|
-
if (!r || !r.start || !r.end) {
|
|
1611
|
-
this.packetsStart = '';
|
|
1612
|
-
this.packetsEnd = '';
|
|
1613
|
-
this.packetDays = null;
|
|
1614
|
-
return false;
|
|
1615
|
-
}
|
|
1616
|
-
this.packetsStart = r.start;
|
|
1617
|
-
this.packetsEnd = r.end;
|
|
1618
|
-
this.packetDays = Array.isArray(r.days) && r.days.length ? r.days : null;
|
|
1619
|
-
const keyStr = typeof this.packetsKey === 'string' ? this.packetsKey : '';
|
|
1620
|
-
const isNowKey = keyStr === 'now' || keyStr.startsWith('now:');
|
|
1621
|
-
if (this._packetFiltered && !isNowKey && this.to && this.to < r.start) {
|
|
1622
|
-
this._initializingPackets = true;
|
|
1623
|
-
try {
|
|
1624
|
-
this._packetFiltered = false;
|
|
1625
|
-
this.from = '';
|
|
1626
|
-
this.to = '';
|
|
1627
|
-
this.packetsKey = '*';
|
|
1628
|
-
_writeSavedPeriod('*', '', '');
|
|
1629
|
-
}
|
|
1630
|
-
finally {
|
|
1631
|
-
this._initializingPackets = false;
|
|
1632
|
-
}
|
|
1633
|
-
return true;
|
|
1662
|
+
if (!res) return false;
|
|
1663
|
+
if (!('range' in res)) {
|
|
1664
|
+
if (!this.packetsStart) {
|
|
1665
|
+
this.packetsStart = _yearStart();
|
|
1666
|
+
this.packetsEnd = _yearEnd();
|
|
1634
1667
|
}
|
|
1635
1668
|
return false;
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1669
|
+
}
|
|
1670
|
+
const r = res.range;
|
|
1671
|
+
if (!r || !r.start || !r.end) {
|
|
1672
|
+
this.packetsStart = '';
|
|
1673
|
+
this.packetsEnd = '';
|
|
1674
|
+
this.packetDays = null;
|
|
1675
|
+
return false;
|
|
1676
|
+
}
|
|
1677
|
+
this.packetsStart = r.start;
|
|
1678
|
+
this.packetsEnd = r.end;
|
|
1679
|
+
this.packetDays = Array.isArray(r.days) && r.days.length ? r.days : null;
|
|
1680
|
+
const keyStr = typeof this.packetsKey === 'string' ? this.packetsKey : '';
|
|
1681
|
+
const isNowKey = keyStr === 'now' || keyStr.startsWith('now:');
|
|
1682
|
+
if (this._packetFiltered && !isNowKey && this.to && this.to < r.start) {
|
|
1683
|
+
this._initializingPackets = true;
|
|
1649
1684
|
try {
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
this.names = { objects: {}, classes: {}, paths: {}, ...(res?.names || {}) };
|
|
1662
|
-
this.sheetRows = Array.isArray(res?.rows) ? res.rows : [];
|
|
1663
|
-
this.sheetTotal = res?.total || null;
|
|
1664
|
-
this.selectedAnalysisRow = this.analysisRows.find(r => r.detail) || this.analysisRows[0] || null;
|
|
1665
|
-
return;
|
|
1666
|
-
}
|
|
1667
|
-
if (this.mode === 'turnovers') {
|
|
1668
|
-
const p = { ...this.params(), groupBy: this.groupBy || 'quarter' };
|
|
1669
|
-
const res = await this.$item.fetch('db_turnovers', p);
|
|
1670
|
-
if (this._syncPacketRange(res))
|
|
1671
|
-
return await this.reload();
|
|
1672
|
-
this.names = { objects: {}, classes: {}, paths: {}, ...(res?.names || {}) };
|
|
1673
|
-
this.groups = Array.isArray(res?.groups) ? res.groups : [];
|
|
1674
|
-
this.items = Array.isArray(res?.items) ? res.items : [];
|
|
1675
|
-
this.count = Number(res?.total) || this.items.length;
|
|
1676
|
-
this.opening = res?.opening || { debit: 0, credit: 0 };
|
|
1677
|
-
this.closing = res?.closing || { debit: 0, credit: 0 };
|
|
1678
|
-
this.turnover = { debit: res?.closing?.debit ?? 0, credit: res?.closing?.credit ?? 0 };
|
|
1679
|
-
if (!this.selectedGroupKey && this.groups.length)
|
|
1680
|
-
this.selectedGroupKey = this.groups[0].key;
|
|
1681
|
-
return;
|
|
1682
|
-
}
|
|
1683
|
-
const res = await this.$item.fetch('db_card', this.params());
|
|
1684
|
-
if (this._syncPacketRange(res))
|
|
1685
|
-
return await this.reload();
|
|
1686
|
-
this.names = { objects: {}, classes: {}, paths: {}, ...(res?.names || {}) };
|
|
1687
|
-
this.items = Array.isArray(res?.items) ? res.items : [];
|
|
1688
|
-
this.count = Number(res?.total) || this.items.length;
|
|
1689
|
-
this.opening = res?.opening || { debit: 0, credit: 0 };
|
|
1690
|
-
this.turnover = res?.turnover || { debit: 0, credit: 0 };
|
|
1691
|
-
this.closing = res?.closing || { debit: 0, credit: 0 };
|
|
1692
|
-
}
|
|
1693
|
-
catch (e) {
|
|
1694
|
-
this.error = String(e?.message || e);
|
|
1695
|
-
}
|
|
1696
|
-
finally {
|
|
1697
|
-
this._notifyConsultantContext();
|
|
1698
|
-
}
|
|
1685
|
+
this._packetFiltered = false;
|
|
1686
|
+
this.from = '';
|
|
1687
|
+
this.to = '';
|
|
1688
|
+
this.packetsKey = '*';
|
|
1689
|
+
_writeSavedPeriod('*', '', '');
|
|
1690
|
+
} finally {
|
|
1691
|
+
this._initializingPackets = false;
|
|
1692
|
+
}
|
|
1693
|
+
return true;
|
|
1694
|
+
}
|
|
1695
|
+
return false;
|
|
1699
1696
|
},
|
|
1697
|
+
async reload() {
|
|
1698
|
+
this.error = '';
|
|
1699
|
+
if (!this.$item) {
|
|
1700
|
+
this.items = [];
|
|
1701
|
+
this.groups = [];
|
|
1702
|
+
this.sheetRows = [];
|
|
1703
|
+
this.sheetTotal = null;
|
|
1704
|
+
this.count = 0;
|
|
1705
|
+
this.opening = this.turnover = this.closing = {
|
|
1706
|
+
debit: 0,
|
|
1707
|
+
credit: 0
|
|
1708
|
+
};
|
|
1709
|
+
return;
|
|
1710
|
+
}
|
|
1711
|
+
this._lastFilterSig = JSON.stringify(this.analytics());
|
|
1712
|
+
try {
|
|
1713
|
+
if (this._slotsPromise) await this._slotsPromise;
|
|
1714
|
+
if (this.mode === 'analysis') {
|
|
1715
|
+
const p = this.params();
|
|
1716
|
+
delete p.limit;
|
|
1717
|
+
const by = (this.activeSlots?.length ? this.activeSlots : (this.slots || []).map(s => s.id)).filter(Boolean);
|
|
1718
|
+
if (by.length) p.by = JSON.stringify(by);
|
|
1719
|
+
const res = await this.$item.fetch('db_sheet', p);
|
|
1720
|
+
if (this._syncPacketRange(res)) return await this.reload();
|
|
1721
|
+
this.names = {
|
|
1722
|
+
objects: {},
|
|
1723
|
+
classes: {},
|
|
1724
|
+
paths: {},
|
|
1725
|
+
...(res?.names || {})
|
|
1726
|
+
};
|
|
1727
|
+
this.sheetRows = Array.isArray(res?.rows) ? res.rows : [];
|
|
1728
|
+
this.sheetTotal = res?.total || null;
|
|
1729
|
+
this.selectedAnalysisRow = this.analysisRows.find(r => r.detail) || this.analysisRows[0] || null;
|
|
1730
|
+
return;
|
|
1731
|
+
}
|
|
1732
|
+
if (this.mode === 'turnovers') {
|
|
1733
|
+
const p = {
|
|
1734
|
+
...this.params(),
|
|
1735
|
+
groupBy: this.groupBy || 'quarter'
|
|
1736
|
+
};
|
|
1737
|
+
const res = await this.$item.fetch('db_turnovers', p);
|
|
1738
|
+
if (this._syncPacketRange(res)) return await this.reload();
|
|
1739
|
+
this.names = {
|
|
1740
|
+
objects: {},
|
|
1741
|
+
classes: {},
|
|
1742
|
+
paths: {},
|
|
1743
|
+
...(res?.names || {})
|
|
1744
|
+
};
|
|
1745
|
+
this.groups = Array.isArray(res?.groups) ? res.groups : [];
|
|
1746
|
+
this.items = Array.isArray(res?.items) ? res.items : [];
|
|
1747
|
+
this.count = Number(res?.total) || this.items.length;
|
|
1748
|
+
this.opening = res?.opening || {
|
|
1749
|
+
debit: 0,
|
|
1750
|
+
credit: 0
|
|
1751
|
+
};
|
|
1752
|
+
this.closing = res?.closing || {
|
|
1753
|
+
debit: 0,
|
|
1754
|
+
credit: 0
|
|
1755
|
+
};
|
|
1756
|
+
this.turnover = {
|
|
1757
|
+
debit: res?.closing?.debit ?? 0,
|
|
1758
|
+
credit: res?.closing?.credit ?? 0
|
|
1759
|
+
};
|
|
1760
|
+
if (!this.selectedGroupKey && this.groups.length) this.selectedGroupKey = this.groups[0].key;
|
|
1761
|
+
return;
|
|
1762
|
+
}
|
|
1763
|
+
const res = await this.$item.fetch('db_card', this.params());
|
|
1764
|
+
if (this._syncPacketRange(res)) return await this.reload();
|
|
1765
|
+
this.names = {
|
|
1766
|
+
objects: {},
|
|
1767
|
+
classes: {},
|
|
1768
|
+
paths: {},
|
|
1769
|
+
...(res?.names || {})
|
|
1770
|
+
};
|
|
1771
|
+
this.items = Array.isArray(res?.items) ? res.items : [];
|
|
1772
|
+
this.count = Number(res?.total) || this.items.length;
|
|
1773
|
+
this.opening = res?.opening || {
|
|
1774
|
+
debit: 0,
|
|
1775
|
+
credit: 0
|
|
1776
|
+
};
|
|
1777
|
+
this.turnover = res?.turnover || {
|
|
1778
|
+
debit: 0,
|
|
1779
|
+
credit: 0
|
|
1780
|
+
};
|
|
1781
|
+
this.closing = res?.closing || {
|
|
1782
|
+
debit: 0,
|
|
1783
|
+
credit: 0
|
|
1784
|
+
};
|
|
1785
|
+
} catch (e) {
|
|
1786
|
+
this.error = String(e?.message || e);
|
|
1787
|
+
} finally {
|
|
1788
|
+
this._notifyConsultantContext();
|
|
1789
|
+
}
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1700
1792
|
};
|