odant-work 1.0.97 → 1.0.99
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/auto-update.json.4727984.tmp +15 -0
- package/#system/package-manifest.json +859 -863
- package/$server/$folder/$class/$data/handlers/pages/form/objects/$handler/class.js +26 -4
- package/$server/$folder/$class/$data/handlers/pages/form/objects/object/$handler/class.js +7 -2
- package/$server/$folder/$class/$domain/class.js +1 -0
- package/$server/$folder/$class/$module/handlers/pages/form/system/modules/$handler/class.js +1 -1
- package/$server/$folder/$class/$structure/$project/class.js +1 -0
- package/$server/$folder/$class/$structure/{handlers → $project/handlers}/pages/form/system/modules/$handler/class.js +21 -4
- package/$server/$folder/$class/$structure/$server/class.js +1 -0
- package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/license/$handler/class.js +1 -1
- package/$server/$folder/$class/$structure/$user/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +14 -1
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +34 -5
- package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +28 -4
- package/$server/$folder/$class/$structure/handlers/pages/form/system/database/$handler/class.js +10 -6
- package/$server/$folder/$class/$structure/handlers/pages/form/system/messengers/$handler/class.js +41 -10
- package/$server/$folder/$class/$structure/handlers/pages/form/system/skills/$handler/class.js +27 -16
- package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +19 -6
- package/$server/$folder/$class/ai/system.md +2 -2
- package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +4 -1
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +7 -1
- package/$server/$folder/handlers/pages/form/$handler/class.js +14 -4
- package/$server/$folder/handlers/pages/form/folder/$handler/class.js +100 -2
- package/$server/$folder/handlers/readme.md +1 -1
- package/$server/$folder/lib/explorer/explorer.js +53 -8
- package/$server/$folder/lib/messenger-settings/messenger-settings.js +63 -21
- package/$server/$folder/lib/readme.md +0 -1
- package/$server/$folder/lib/tree/tree.js +67 -11
- package/AGENTS.md +2 -2
- package/PROJECTS/$domain/readme.md +2 -2
- package/package.json +1 -1
- package/sources/client/handler.js +4 -1
- package/sources/modules/agent/node-rules.js +5 -0
- package/sources/server/class/base-template.js +19 -81
- package/sources/server/class/security.js +19 -1
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/modules/$handler/class.js +0 -3
- package/$server/$folder/$class/handlers/pages/form/system/files/$handler/class.js +0 -7
- package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +0 -43
- package/$server/$folder/lib/file-viewer/file-viewer.js +0 -9
|
@@ -217,7 +217,7 @@ ODA({
|
|
|
217
217
|
</div>
|
|
218
218
|
<div class="error" ~if="owner.error">{{owner.error}}</div>
|
|
219
219
|
<div class="bar" no-flex>
|
|
220
|
-
<oda-button ~if="owner.canSave" icon="editor:save" :disabled="owner.busy" @tap="save">Сохранить</oda-button>
|
|
220
|
+
<oda-button ~if="owner.canSave" icon="editor:save" :disabled="owner.busy || !owner.isDirty()" @tap="save">Сохранить</oda-button>
|
|
221
221
|
<oda-button ~if="owner.canRemove" icon="icons:delete" :disabled="owner.busy"
|
|
222
222
|
@tap="removeObject">Удалить</oda-button>
|
|
223
223
|
<oda-button ~if="owner.canRestore" icon="icons:restore" :disabled="owner.busy"
|
|
@@ -236,8 +236,11 @@ ODA({
|
|
|
236
236
|
});
|
|
237
237
|
},
|
|
238
238
|
onFormInput() {
|
|
239
|
-
if (this.owner
|
|
240
|
-
|
|
239
|
+
if (this.owner) {
|
|
240
|
+
if (this.owner.fieldErrors && Object.keys(this.owner.fieldErrors).length) this.owner.fieldErrors = {};
|
|
241
|
+
this.owner._dirtyTick = (this.owner._dirtyTick || 0) + 1;
|
|
242
|
+
this.owner.schedulePreview?.();
|
|
243
|
+
}
|
|
241
244
|
},
|
|
242
245
|
async save() {
|
|
243
246
|
if (await this.owner.save()) this.close();
|
|
@@ -385,7 +388,6 @@ export default {
|
|
|
385
388
|
<div class="list">
|
|
386
389
|
<div class="bar" ~if="!inWorkForm">
|
|
387
390
|
<oda-button ~if="canCreate && !inWorkForm" icon="icons:plus" @tap="create">Создать</oda-button>
|
|
388
|
-
<oda-button icon="icons:refresh" @tap="reload">Обновить</oda-button>
|
|
389
391
|
<input class="search" type="search" :value="searchQuery" placeholder="Поиск…" @change="onSearch($this.value)">
|
|
390
392
|
<select title="Статус" @change="filterStatus($this.value)">
|
|
391
393
|
<option ~for="statusOptions" :value="$for.item.id" :selected="$for.item.id === statusFilter">{{$for.item.label}}</option>
|
|
@@ -415,6 +417,20 @@ export default {
|
|
|
415
417
|
</div>
|
|
416
418
|
</div>
|
|
417
419
|
`,
|
|
420
|
+
$item: {
|
|
421
|
+
$def: null,
|
|
422
|
+
set(n, o) {
|
|
423
|
+
if (o && this._onItemChanged) o.unlisten?.('changed', this._onItemChanged);
|
|
424
|
+
if (n) {
|
|
425
|
+
this._onItemChanged ??= () => {
|
|
426
|
+
if (!this.editorOpen && !this.isObjectView && !this.busy) {
|
|
427
|
+
this.debounce?.('objects-changed', () => this.reload(), 200);
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
n.listen?.('changed', this._onItemChanged);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
},
|
|
418
434
|
rows: [],
|
|
419
435
|
columns: [],
|
|
420
436
|
schema: null,
|
|
@@ -453,6 +469,7 @@ export default {
|
|
|
453
469
|
busy: false,
|
|
454
470
|
/** снимок значений на момент открытия/успешного действия — база для isDirty */
|
|
455
471
|
_snapshot: '',
|
|
472
|
+
_dirtyTick: 0,
|
|
456
473
|
/** поиск, фильтр статуса, фильтры по полям и постраничность списка */
|
|
457
474
|
searchQuery: '',
|
|
458
475
|
statusFilter: '',
|
|
@@ -1058,9 +1075,11 @@ export default {
|
|
|
1058
1075
|
/** Запомнить текущее состояние как чистое (открытие, сохранение, проведение). */
|
|
1059
1076
|
snapshot() {
|
|
1060
1077
|
this._snapshot = this.fingerprint(this.editing);
|
|
1078
|
+
this._dirtyTick++;
|
|
1061
1079
|
},
|
|
1062
1080
|
/** Есть ли несохранённые изменения относительно снимка. */
|
|
1063
1081
|
isDirty() {
|
|
1082
|
+
void this._dirtyTick;
|
|
1064
1083
|
return !!this.editing && this.fingerprint(this.editing) !== this._snapshot;
|
|
1065
1084
|
},
|
|
1066
1085
|
/** Собрать описание схемы для формы и колонок из ответа db_schema.schema. */
|
|
@@ -2153,6 +2172,9 @@ export default {
|
|
|
2153
2172
|
}
|
|
2154
2173
|
if (result === 1) return await this.save();
|
|
2155
2174
|
return result === 2;
|
|
2175
|
+
},
|
|
2176
|
+
detached() {
|
|
2177
|
+
if (this.$item && this._onItemChanged) this.$item.unlisten?.('changed', this._onItemChanged);
|
|
2156
2178
|
}
|
|
2157
2179
|
}
|
|
2158
2180
|
};
|
|
@@ -1228,8 +1228,7 @@ if (typeof ODA === 'function') {
|
|
|
1228
1228
|
<div style="display:flex; align-items:center; gap:6px;">
|
|
1229
1229
|
<span style="font-weight:600; font-size:12px;">Имя шаблона:</span>
|
|
1230
1230
|
<input type="text" :value="templateName" @input="templateName = $event.target.value" style="flex:1; padding:3px 6px; font-size:12.5px; border:1px solid var(--border-color); border-radius:3px;">
|
|
1231
|
-
<button type="button" class="btn" @tap="
|
|
1232
|
-
<button type="button" class="btn primary" @tap="saveTemplate()">Сохранить</button>
|
|
1231
|
+
<button type="button" class="btn primary" :disabled="!templateDirty || !templateHtml.trim()" @tap="saveTemplate()">Сохранить</button>
|
|
1233
1232
|
</div>
|
|
1234
1233
|
<div class="hint-bar">
|
|
1235
1234
|
Переменные: <code>{{doc.number}}</code>, <code>{{doc.date}}</code>, <code>{{org.name}}</code>, <code>{{org.inn}}</code>, <code>{{party.name}}</code>, <code>{{party.inn}}</code>, <code>{{money(sum)}}</code>, <code>{{words(sum)}}</code>
|
|
@@ -1254,8 +1253,13 @@ if (typeof ODA === 'function') {
|
|
|
1254
1253
|
renderedHtml: '',
|
|
1255
1254
|
templateHtml: '',
|
|
1256
1255
|
templateName: '',
|
|
1256
|
+
_savedTemplateSnap: '',
|
|
1257
1257
|
editingTemplate: false,
|
|
1258
1258
|
errorMsg: '',
|
|
1259
|
+
get templateDirty() {
|
|
1260
|
+
if (!this._savedTemplateSnap) return false;
|
|
1261
|
+
return JSON.stringify({ n: this.templateName || '', h: this.templateHtml || '' }) !== this._savedTemplateSnap;
|
|
1262
|
+
},
|
|
1259
1263
|
attached() {
|
|
1260
1264
|
this.loadForm(this.selectedName);
|
|
1261
1265
|
},
|
|
@@ -1273,6 +1277,7 @@ if (typeof ODA === 'function') {
|
|
|
1273
1277
|
this.templateName = res?.name || 'Печатная форма';
|
|
1274
1278
|
this.renderedHtml = res?.html || '';
|
|
1275
1279
|
this.templateHtml = res?.templateHtml || res?.html || '';
|
|
1280
|
+
this._savedTemplateSnap = JSON.stringify({ n: this.templateName || '', h: this.templateHtml || '' });
|
|
1276
1281
|
} catch (e) {
|
|
1277
1282
|
this.errorMsg = String(e?.message || e);
|
|
1278
1283
|
}
|
|
@@ -86,7 +86,6 @@ export default {
|
|
|
86
86
|
<oda-button ~if="!isModuleItem" icon="icons:add" @tap="openInstallModule($event)">Подключить модуль</oda-button>
|
|
87
87
|
<oda-button icon="icons:create-new-folder" @tap="openCreateClass($event)">Создать класс</oda-button>
|
|
88
88
|
<oda-button icon="icons:open-in-new" @tap="openFocusedClass()">Открыть</oda-button>
|
|
89
|
-
<oda-button icon="icons:refresh" @tap="reload()">Обновить</oda-button>
|
|
90
89
|
</div>
|
|
91
90
|
|
|
92
91
|
<div ~if="error" style="padding:8px 16px;color:var(--error-color, #dc2626);font-size:12.5px;">{{error}}</div>
|
|
@@ -99,11 +98,25 @@ export default {
|
|
|
99
98
|
$handler: null,
|
|
100
99
|
$item: {
|
|
101
100
|
$def: null,
|
|
102
|
-
set(n) {
|
|
103
|
-
if (
|
|
101
|
+
set(n, o) {
|
|
102
|
+
if (o && this._onChanged) o.unlisten?.('changed', this._onChanged);
|
|
103
|
+
if (n) {
|
|
104
|
+
this._onChanged ??= () => this.debounce?.('mod-reload', () => this.reload(), 200) ?? this.reload();
|
|
105
|
+
n.listen?.('changed', this._onChanged);
|
|
106
|
+
this.reload();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
modulesRoot: {
|
|
111
|
+
$def: null,
|
|
112
|
+
set(n, o) {
|
|
113
|
+
if (o && o !== this.$item && this._onRootChanged) o.unlisten?.('changed', this._onRootChanged);
|
|
114
|
+
if (n && n !== this.$item) {
|
|
115
|
+
this._onRootChanged ??= () => this.debounce?.('mod-root-reload', () => this.reload(), 200) ?? this.reload();
|
|
116
|
+
n.listen?.('changed', this._onRootChanged);
|
|
117
|
+
}
|
|
104
118
|
}
|
|
105
119
|
},
|
|
106
|
-
modulesRoot: null,
|
|
107
120
|
systemModules: [],
|
|
108
121
|
modRootPath: '',
|
|
109
122
|
loading: false,
|
|
@@ -125,6 +138,10 @@ export default {
|
|
|
125
138
|
async attached() {
|
|
126
139
|
if (this.$item) await this.reload();
|
|
127
140
|
},
|
|
141
|
+
detached() {
|
|
142
|
+
if (this.$item && this._onChanged) this.$item.unlisten?.('changed', this._onChanged);
|
|
143
|
+
if (this.modulesRoot && this.modulesRoot !== this.$item && this._onRootChanged) this.modulesRoot.unlisten?.('changed', this._onRootChanged);
|
|
144
|
+
},
|
|
128
145
|
openTreeClass(item) {
|
|
129
146
|
if (item && typeof window?.execute === 'function') window.execute(item);
|
|
130
147
|
},
|
|
@@ -290,7 +290,7 @@ export default {
|
|
|
290
290
|
</div>
|
|
291
291
|
<div class="token-row" ~if="!isTokenBound">
|
|
292
292
|
<input type="text" ::value="ownerTokenInput" placeholder="Вставьте токен владельца (owk1...) из личного кабинета work.odant.org">
|
|
293
|
-
<button type="button" class="btn-primary" @tap="bindOwnerToken">Привязать токен</button>
|
|
293
|
+
<button type="button" class="btn-primary" :disabled="!String(ownerTokenInput || '').trim()" @tap="bindOwnerToken">Привязать токен</button>
|
|
294
294
|
</div>
|
|
295
295
|
|
|
296
296
|
<div class="notice" ~if="message">{{message}}</div>
|
|
@@ -130,7 +130,6 @@ export default {
|
|
|
130
130
|
<div slot="left-panel" label="Классы" icon="icons:tree-structure" class="left-wrap">
|
|
131
131
|
<div class="search-box">
|
|
132
132
|
<input class="search-input" type="search" placeholder="Поиск класса, модуля, счёта…" :value="filter" @input="filter = $event.target.value">
|
|
133
|
-
<oda-button icon="icons:refresh" title="Обновить дерево классов" @tap="reload()"></oda-button>
|
|
134
133
|
</div>
|
|
135
134
|
<div class="tree-scroll">
|
|
136
135
|
<div ~if="loading" class="sec-title">Загрузка…</div>
|
|
@@ -178,6 +177,17 @@ export default {
|
|
|
178
177
|
</div>
|
|
179
178
|
</oda-app-layout>
|
|
180
179
|
`,
|
|
180
|
+
$item: {
|
|
181
|
+
$def: null,
|
|
182
|
+
set(n, o) {
|
|
183
|
+
if (o && this._onChanged) o.unlisten?.('changed', this._onChanged);
|
|
184
|
+
if (n) {
|
|
185
|
+
this._onChanged ??= () => this.debounce?.('data-reload', () => this.reload(), 200) ?? this.reload();
|
|
186
|
+
n.listen?.('changed', this._onChanged);
|
|
187
|
+
this.reload();
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
181
191
|
filter: '',
|
|
182
192
|
loading: false,
|
|
183
193
|
isBoss: false,
|
|
@@ -190,6 +200,9 @@ export default {
|
|
|
190
200
|
async attached() {
|
|
191
201
|
await this.reload();
|
|
192
202
|
},
|
|
203
|
+
detached() {
|
|
204
|
+
if (this.$item && this._onChanged) this.$item.unlisten?.('changed', this._onChanged);
|
|
205
|
+
},
|
|
193
206
|
get selectedPath() {
|
|
194
207
|
return this.selectedNode?.path || '';
|
|
195
208
|
},
|
|
@@ -881,15 +881,15 @@ export default {
|
|
|
881
881
|
</div>
|
|
882
882
|
<div class="compose-field">
|
|
883
883
|
<label>Кому:</label>
|
|
884
|
-
<input placeholder="recipient@example.com" :value="draft.to" @input="
|
|
884
|
+
<input placeholder="recipient@example.com" :value="draft.to" @input="setDraftField('to', $event.target.value)">
|
|
885
885
|
</div>
|
|
886
886
|
<div class="compose-field">
|
|
887
887
|
<label>Копия:</label>
|
|
888
|
-
<input placeholder="cc@example.com (необязательно)" :value="draft.cc" @input="
|
|
888
|
+
<input placeholder="cc@example.com (необязательно)" :value="draft.cc" @input="setDraftField('cc', $event.target.value)">
|
|
889
889
|
</div>
|
|
890
890
|
<div class="compose-field">
|
|
891
891
|
<label>Тема:</label>
|
|
892
|
-
<input placeholder="Тема письма" :value="draft.subject" @input="
|
|
892
|
+
<input placeholder="Тема письма" :value="draft.subject" @input="setDraftField('subject', $event.target.value)">
|
|
893
893
|
</div>
|
|
894
894
|
|
|
895
895
|
<div class="att-bar" style="padding:6px 0;border:none;background:transparent;" ~if="draft.attachments?.length">
|
|
@@ -900,11 +900,11 @@ export default {
|
|
|
900
900
|
</div>
|
|
901
901
|
</div>
|
|
902
902
|
|
|
903
|
-
<textarea class="compose-body" placeholder="Текст письма…" :value="draft.body" @input="
|
|
903
|
+
<textarea class="compose-body" placeholder="Текст письма…" :value="draft.body" @input="setDraftField('body', $event.target.value)"></textarea>
|
|
904
904
|
|
|
905
905
|
<div class="compose-footer">
|
|
906
906
|
<oda-button icon="icons:send" info-invert @tap="sendDraft()">Отправить</oda-button>
|
|
907
|
-
<oda-button icon="icons:save" @tap="saveDraft()">Сохранить черновик</oda-button>
|
|
907
|
+
<oda-button icon="icons:save" :disabled="!canSaveDraft" @tap="saveDraft()">Сохранить черновик</oda-button>
|
|
908
908
|
<label class="icon-btn" style="cursor:pointer;">
|
|
909
909
|
<oda-icon icon="editor:attach-file" icon-size="15"></oda-icon>
|
|
910
910
|
<span>Прикрепить</span>
|
|
@@ -969,6 +969,31 @@ export default {
|
|
|
969
969
|
selected: null,
|
|
970
970
|
mode: 'idle',
|
|
971
971
|
draft: EMPTY_DRAFT(),
|
|
972
|
+
_draftTick: 0,
|
|
973
|
+
_savedDraftSnap: '',
|
|
974
|
+
_draftSnap(d = this.draft) {
|
|
975
|
+
return JSON.stringify({
|
|
976
|
+
from: d?.from || '',
|
|
977
|
+
to: d?.to || '',
|
|
978
|
+
cc: d?.cc || '',
|
|
979
|
+
subject: d?.subject || '',
|
|
980
|
+
body: d?.body || '',
|
|
981
|
+
attachments: d?.attachments || [],
|
|
982
|
+
});
|
|
983
|
+
},
|
|
984
|
+
get canSaveDraft() {
|
|
985
|
+
void this._draftTick;
|
|
986
|
+
const d = this.draft;
|
|
987
|
+
if (!d || this.mode !== 'compose') return false;
|
|
988
|
+
const hasContent = Boolean(String(d.to || '').trim() || String(d.cc || '').trim() || String(d.subject || '').trim() || String(d.body || '').trim() || (d.attachments && d.attachments.length));
|
|
989
|
+
if (!hasContent) return false;
|
|
990
|
+
return this._draftSnap(d) !== this._savedDraftSnap;
|
|
991
|
+
},
|
|
992
|
+
setDraftField(field, val) {
|
|
993
|
+
if (!this.draft) return;
|
|
994
|
+
this.draft[field] = val;
|
|
995
|
+
this._draftTick++;
|
|
996
|
+
},
|
|
972
997
|
get activeBoxLabel() {
|
|
973
998
|
return this.folders.find(f => f.id === this.activeBox)?.label || 'Входящие';
|
|
974
999
|
},
|
|
@@ -1167,6 +1192,8 @@ export default {
|
|
|
1167
1192
|
from: this.selectedAccount || this.accounts[0]?.address || '',
|
|
1168
1193
|
...init
|
|
1169
1194
|
};
|
|
1195
|
+
this._savedDraftSnap = this._draftSnap(this.draft);
|
|
1196
|
+
this._draftTick++;
|
|
1170
1197
|
this.mode = 'compose';
|
|
1171
1198
|
},
|
|
1172
1199
|
editDraft(msg) {
|
|
@@ -1257,6 +1284,8 @@ export default {
|
|
|
1257
1284
|
...this.draft,
|
|
1258
1285
|
uid: res?.uid || this.draft.uid
|
|
1259
1286
|
};
|
|
1287
|
+
this._savedDraftSnap = this._draftSnap(this.draft);
|
|
1288
|
+
this._draftTick++;
|
|
1260
1289
|
ODA.showMessage?.('Черновик сохранён');
|
|
1261
1290
|
await this.reload();
|
|
1262
1291
|
} catch (e) {
|
package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js
CHANGED
|
@@ -246,7 +246,7 @@ export default {
|
|
|
246
246
|
</div>
|
|
247
247
|
</div>
|
|
248
248
|
|
|
249
|
-
<div ~if="editing" class="rule-item" style="border-color:var(--accent-color);">
|
|
249
|
+
<div ~if="editing" class="rule-item" style="border-color:var(--accent-color);" @input="_ruleTick++" @change="_ruleTick++">
|
|
250
250
|
<div class="row" style="justify-content:space-between;">
|
|
251
251
|
<span style="font-weight:700;">{{editingIsNew ? 'Новая реакция' : (form.label || form.name)}}</span>
|
|
252
252
|
<div ~if="editingIsNew" class="row">
|
|
@@ -339,7 +339,7 @@ export default {
|
|
|
339
339
|
</div>
|
|
340
340
|
|
|
341
341
|
<div class="row" style="justify-content:flex-end;">
|
|
342
|
-
<oda-button icon="icons:check" info-invert @tap="saveRule()">Сохранить</oda-button>
|
|
342
|
+
<oda-button icon="icons:check" info-invert :disabled="!canSaveRule" @tap="saveRule()">Сохранить</oda-button>
|
|
343
343
|
<oda-button icon="icons:close" @tap="editing = false">Отмена</oda-button>
|
|
344
344
|
</div>
|
|
345
345
|
</div>
|
|
@@ -442,10 +442,26 @@ export default {
|
|
|
442
442
|
`,
|
|
443
443
|
$item: {
|
|
444
444
|
$def: null,
|
|
445
|
-
set(n) {
|
|
446
|
-
if (
|
|
445
|
+
set(n, o) {
|
|
446
|
+
if (o && this._onChanged) o.unlisten?.('changed', this._onChanged);
|
|
447
|
+
if (n) {
|
|
448
|
+
this._onChanged ??= () => this.debounce?.('agent-reload', () => this.reload(), 200) ?? this.reload();
|
|
449
|
+
n.listen?.('changed', this._onChanged);
|
|
450
|
+
this.reload();
|
|
451
|
+
}
|
|
447
452
|
}
|
|
448
453
|
},
|
|
454
|
+
_ruleTick: 0,
|
|
455
|
+
_savedRuleSnap: '',
|
|
456
|
+
get canSaveRule() {
|
|
457
|
+
void this._ruleTick;
|
|
458
|
+
const f = this.form;
|
|
459
|
+
if (!f || !this.editing) return false;
|
|
460
|
+
const snap = JSON.stringify(f);
|
|
461
|
+
if (this.editingIsNew)
|
|
462
|
+
return Boolean(String(f.label || '').trim() || String(f.body || '').trim());
|
|
463
|
+
return Boolean(this._savedRuleSnap) && snap !== this._savedRuleSnap;
|
|
464
|
+
},
|
|
449
465
|
triggers: [],
|
|
450
466
|
schedules: [],
|
|
451
467
|
proactivity: {
|
|
@@ -503,6 +519,9 @@ export default {
|
|
|
503
519
|
async attached() {
|
|
504
520
|
if (this.$item) await this.reload();
|
|
505
521
|
},
|
|
522
|
+
detached() {
|
|
523
|
+
if (this.$item && this._onChanged) this.$item.unlisten?.('changed', this._onChanged);
|
|
524
|
+
},
|
|
506
525
|
get maskPreview() {
|
|
507
526
|
const days = this.schedMode === 'workdays' ? [1, 2, 3, 4, 5] : null;
|
|
508
527
|
return describeClientMask(this.schedMask, days);
|
|
@@ -611,6 +630,8 @@ export default {
|
|
|
611
630
|
maxPerHour: 20,
|
|
612
631
|
enabled: true
|
|
613
632
|
};
|
|
633
|
+
this._savedRuleSnap = JSON.stringify(this.form);
|
|
634
|
+
this._ruleTick++;
|
|
614
635
|
this.editing = true;
|
|
615
636
|
},
|
|
616
637
|
applyRulePreset(kind) {
|
|
@@ -645,6 +666,7 @@ export default {
|
|
|
645
666
|
body: 'Оцени срочность входящего сообщения и подготовь краткий ответ по делу.'
|
|
646
667
|
};
|
|
647
668
|
}
|
|
669
|
+
this._ruleTick++;
|
|
648
670
|
},
|
|
649
671
|
editRule(r) {
|
|
650
672
|
this.editingIsNew = false;
|
|
@@ -666,6 +688,8 @@ export default {
|
|
|
666
688
|
enabled: r.enabled !== false,
|
|
667
689
|
as: r.as || 'BOSS'
|
|
668
690
|
};
|
|
691
|
+
this._savedRuleSnap = JSON.stringify(this.form);
|
|
692
|
+
this._ruleTick++;
|
|
669
693
|
this.editing = true;
|
|
670
694
|
},
|
|
671
695
|
async saveRule() {
|
package/$server/$folder/$class/$structure/handlers/pages/form/system/database/$handler/class.js
CHANGED
|
@@ -550,10 +550,6 @@ export default {
|
|
|
550
550
|
</div>
|
|
551
551
|
<div class="top-right">
|
|
552
552
|
<oda-tabs variant="pills" compact :allow-list="false" :items="dbModeTabItems" :focused-index="dbModeTabIndex" @tab-select="onDbModeTabSelect($event)"></oda-tabs>
|
|
553
|
-
<button class="btn" @tap="reloadAll()" :disabled="loading">
|
|
554
|
-
<oda-icon icon="icons:refresh" :icon-size="16"></oda-icon>
|
|
555
|
-
<span>Обновить</span>
|
|
556
|
-
</button>
|
|
557
553
|
</div>
|
|
558
554
|
</div>
|
|
559
555
|
|
|
@@ -912,8 +908,13 @@ export default {
|
|
|
912
908
|
$public: {
|
|
913
909
|
$item: {
|
|
914
910
|
$def: null,
|
|
915
|
-
set(n) {
|
|
916
|
-
if (
|
|
911
|
+
set(n, o) {
|
|
912
|
+
if (o && this._onChanged) o.unlisten?.('changed', this._onChanged);
|
|
913
|
+
if (n) {
|
|
914
|
+
this._onChanged ??= () => this.debounce?.('db-reload', () => this.reloadAll(), 250) ?? this.reloadAll();
|
|
915
|
+
n.listen?.('changed', this._onChanged);
|
|
916
|
+
this.initForItem();
|
|
917
|
+
}
|
|
917
918
|
}
|
|
918
919
|
},
|
|
919
920
|
databases: {
|
|
@@ -1525,6 +1526,9 @@ export default {
|
|
|
1525
1526
|
} catch {
|
|
1526
1527
|
return '';
|
|
1527
1528
|
}
|
|
1529
|
+
},
|
|
1530
|
+
detached() {
|
|
1531
|
+
if (this.$item && this._onChanged) this.$item.unlisten?.('changed', this._onChanged);
|
|
1528
1532
|
}
|
|
1529
1533
|
}
|
|
1530
1534
|
};
|
package/$server/$folder/$class/$structure/handlers/pages/form/system/messengers/$handler/class.js
CHANGED
|
@@ -167,7 +167,6 @@ export default {
|
|
|
167
167
|
<span ~if="!effectiveBot" class="badge warn">
|
|
168
168
|
Бот не задан (работает браузерный Web-Push)
|
|
169
169
|
</span>
|
|
170
|
-
<oda-button icon="icons:refresh" label="Обновить" title="Обновить статус и проверить коды привязки" @tap="pollAndReload()"></oda-button>
|
|
171
170
|
</div>
|
|
172
171
|
</div>
|
|
173
172
|
|
|
@@ -217,9 +216,8 @@ export default {
|
|
|
217
216
|
</div>
|
|
218
217
|
|
|
219
218
|
<div ~if="linkCodeInfo && linkCodeInfo.target === 'group'" class="code-box">
|
|
220
|
-
<span>Добавьте бота в групповой чат подразделения и отправьте туда
|
|
219
|
+
<span>Добавьте бота в групповой чат подразделения и отправьте туда команду (привязка определится автоматически):</span>
|
|
221
220
|
<span class="code-mono">{{linkCodeInfo.command}}</span>
|
|
222
|
-
<oda-button icon="icons:check" label="Я отправил код — проверить" @tap="pollAndReload()"></oda-button>
|
|
223
221
|
</div>
|
|
224
222
|
|
|
225
223
|
<div class="row">
|
|
@@ -261,10 +259,9 @@ export default {
|
|
|
261
259
|
</div>
|
|
262
260
|
|
|
263
261
|
<div ~if="linkCodeInfo && linkCodeInfo.target === 'user'" class="code-box">
|
|
264
|
-
<span>Отправьте боту {{linkCodeInfo.bot?.username ? '@' + linkCodeInfo.bot.username : (linkCodeInfo.bot?.label || 'мессенджера')}}
|
|
262
|
+
<span>Отправьте боту {{linkCodeInfo.bot?.username ? '@' + linkCodeInfo.bot.username : (linkCodeInfo.bot?.label || 'мессенджера')}} команду (привязка определится автоматически):</span>
|
|
265
263
|
<span class="code-mono">{{linkCodeInfo.command}}</span>
|
|
266
264
|
<a ~if="linkCodeInfo.deepLink" class="deep-link" :href="linkCodeInfo.deepLink" target="_blank" rel="noopener">Открыть бота</a>
|
|
267
|
-
<oda-button icon="icons:check" label="Я отправил код — проверить" @tap="pollAndReload()"></oda-button>
|
|
268
265
|
</div>
|
|
269
266
|
</div>
|
|
270
267
|
|
|
@@ -283,6 +280,16 @@ export default {
|
|
|
283
280
|
</div>
|
|
284
281
|
</div>
|
|
285
282
|
`,
|
|
283
|
+
$item: {
|
|
284
|
+
$def: null,
|
|
285
|
+
set(n, o) {
|
|
286
|
+
if (o && this._onChanged) o.unlisten?.('changed', this._onChanged);
|
|
287
|
+
if (n) {
|
|
288
|
+
this._onChanged ??= () => this.debounce?.('msg-reload', () => this.reload(), 200) ?? this.reload();
|
|
289
|
+
n.listen?.('changed', this._onChanged);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
286
293
|
$form: null,
|
|
287
294
|
allowSave: true,
|
|
288
295
|
_savedSnap: '',
|
|
@@ -337,6 +344,26 @@ export default {
|
|
|
337
344
|
async attached() {
|
|
338
345
|
await this.reload();
|
|
339
346
|
},
|
|
347
|
+
detached() {
|
|
348
|
+
this._stopLinkPolling();
|
|
349
|
+
if (this.$item && this._onChanged) this.$item.unlisten?.('changed', this._onChanged);
|
|
350
|
+
},
|
|
351
|
+
_startLinkPolling() {
|
|
352
|
+
this._stopLinkPolling();
|
|
353
|
+
this._pollTimer = setInterval(() => {
|
|
354
|
+
if (!this.isConnected || !this.linkCodeInfo) {
|
|
355
|
+
this._stopLinkPolling();
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
this.pollAndReload(true);
|
|
359
|
+
}, 3000);
|
|
360
|
+
},
|
|
361
|
+
_stopLinkPolling() {
|
|
362
|
+
if (this._pollTimer) {
|
|
363
|
+
clearInterval(this._pollTimer);
|
|
364
|
+
this._pollTimer = null;
|
|
365
|
+
}
|
|
366
|
+
},
|
|
340
367
|
get hasPersonalLink() {
|
|
341
368
|
return Boolean(this.currentUser?.telegram || this.currentUser?.max);
|
|
342
369
|
},
|
|
@@ -447,24 +474,28 @@ export default {
|
|
|
447
474
|
}
|
|
448
475
|
});
|
|
449
476
|
this.linkCodeInfo = info;
|
|
477
|
+
if (info) this._startLinkPolling();
|
|
450
478
|
} catch (e) {
|
|
451
479
|
this.error = String(e?.message || e);
|
|
452
480
|
}
|
|
453
481
|
},
|
|
454
|
-
async pollAndReload() {
|
|
455
|
-
|
|
456
|
-
|
|
482
|
+
async pollAndReload(silent = false) {
|
|
483
|
+
if (!silent) {
|
|
484
|
+
this.error = '';
|
|
485
|
+
this.notice = '';
|
|
486
|
+
}
|
|
457
487
|
try {
|
|
458
488
|
const st = await this.$item.fetch('messenger_poll');
|
|
459
489
|
this.applyStatus(st);
|
|
460
490
|
if (Array.isArray(st?.matched) && st.matched.length) {
|
|
461
491
|
this.linkCodeInfo = null;
|
|
492
|
+
this._stopLinkPolling();
|
|
462
493
|
this.notice = `Привязка выполнена (${st.matched.map(m => m.type === 'group' ? 'группа ' + m.chatTitle : 'пользователь ' + m.uid).join(', ')})`;
|
|
463
|
-
} else {
|
|
494
|
+
} else if (!silent) {
|
|
464
495
|
this.notice = 'Статус обновлён';
|
|
465
496
|
}
|
|
466
497
|
} catch (e) {
|
|
467
|
-
this.error = String(e?.message || e);
|
|
498
|
+
if (!silent) this.error = String(e?.message || e);
|
|
468
499
|
}
|
|
469
500
|
},
|
|
470
501
|
async unbind(target = 'user', channel = '') {
|
package/$server/$folder/$class/$structure/handlers/pages/form/system/skills/$handler/class.js
CHANGED
|
@@ -58,6 +58,7 @@ export default {
|
|
|
58
58
|
padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 500;
|
|
59
59
|
cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
|
|
60
60
|
}
|
|
61
|
+
.btn:disabled { opacity: 0.45; cursor: default; }
|
|
61
62
|
.btn-primary { background: var(--accent-color, #2563eb); color: #fff; border-color: transparent; }
|
|
62
63
|
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
|
|
63
64
|
.field { display: flex; flex-direction: column; gap: 4px; }
|
|
@@ -85,7 +86,6 @@ export default {
|
|
|
85
86
|
<p>Навыки <span class="code-chip">ai/skills/</span> наследуются вниз по ветке структур; вызываются через <span class="code-chip">@имя</span></p>
|
|
86
87
|
</div>
|
|
87
88
|
</div>
|
|
88
|
-
<button class="btn" @tap="reload">↻ Обновить</button>
|
|
89
89
|
</div>
|
|
90
90
|
|
|
91
91
|
<div ~if="noticeText" class="notice" :error="noticeError">{{noticeText}}</div>
|
|
@@ -111,7 +111,7 @@ export default {
|
|
|
111
111
|
<div class="cmd-box">{{$for.item.filePath}}</div>
|
|
112
112
|
<div class="btn-row">
|
|
113
113
|
<button class="btn btn-primary" @tap="importHostSkill($for.item)">
|
|
114
|
-
{{$for.item.installedInWork ? '
|
|
114
|
+
{{$for.item.installedInWork ? '⬇ Перезаписать с ПК' : '⬇ Импортировать в WORK'}}
|
|
115
115
|
</button>
|
|
116
116
|
</div>
|
|
117
117
|
</div>
|
|
@@ -137,7 +137,7 @@ export default {
|
|
|
137
137
|
<textarea :value="skillContentInput" @input="skillContentInput = $event.target.value" placeholder="---\nname: my-skill\ndescription: Когда применять навык\n---\n\nИнструкция..."></textarea>
|
|
138
138
|
</div>
|
|
139
139
|
<div class="btn-row">
|
|
140
|
-
<button class="btn btn-primary" @tap="installCustomSkill">⚡ Сохранить навык</button>
|
|
140
|
+
<button class="btn btn-primary" :disabled="!canSaveCustomSkill" @tap="installCustomSkill">⚡ Сохранить навык</button>
|
|
141
141
|
</div>
|
|
142
142
|
</div>
|
|
143
143
|
|
|
@@ -166,23 +166,34 @@ export default {
|
|
|
166
166
|
</div>
|
|
167
167
|
</div>
|
|
168
168
|
`,
|
|
169
|
-
|
|
170
|
-
$
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
169
|
+
$item: {
|
|
170
|
+
$def: null,
|
|
171
|
+
set(n, o) {
|
|
172
|
+
if (o && this._onChanged) o.unlisten?.('changed', this._onChanged);
|
|
173
|
+
if (n) {
|
|
174
|
+
this._onChanged ??= () => this.debounce?.('skills-reload', () => this.reload(), 150) ?? this.reload();
|
|
175
|
+
n.listen?.('changed', this._onChanged);
|
|
176
|
+
this.reload();
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
},
|
|
180
|
+
skills: [],
|
|
181
|
+
hostSkills: [],
|
|
182
|
+
expandedSkillId: '',
|
|
183
|
+
noticeText: '',
|
|
184
|
+
noticeError: false,
|
|
185
|
+
skillUrlInput: '',
|
|
186
|
+
skillIdInput: '',
|
|
187
|
+
skillContentInput: '',
|
|
188
|
+
get canSaveCustomSkill() {
|
|
189
|
+
return Boolean(String(this.skillUrlInput || '').trim() || String(this.skillContentInput || '').trim());
|
|
179
190
|
},
|
|
180
|
-
observers: [function onItem($item) {
|
|
181
|
-
if ($item) this.reload();
|
|
182
|
-
}],
|
|
183
191
|
attached() {
|
|
184
192
|
this.reload();
|
|
185
193
|
},
|
|
194
|
+
detached() {
|
|
195
|
+
if (this.$item && this._onChanged) this.$item.unlisten?.('changed', this._onChanged);
|
|
196
|
+
},
|
|
186
197
|
showNotice(text, isError = false) {
|
|
187
198
|
this.noticeText = String(text || '');
|
|
188
199
|
this.noticeError = Boolean(isError);
|