@dssp/project 1.0.0-alpha.8 → 1.0.0-alpha.9
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/dist-client/pages/project/popup/checklist/attachment-list-popup.d.ts +1 -0
- package/dist-client/pages/project/popup/checklist/attachment-list-popup.js +309 -0
- package/dist-client/pages/project/popup/checklist/attachment-list-popup.js.map +1 -0
- package/dist-client/pages/project/popup/checklist/comment-list-popup.d.ts +1 -0
- package/dist-client/pages/project/popup/checklist/comment-list-popup.js +357 -0
- package/dist-client/pages/project/popup/checklist/comment-list-popup.js.map +1 -0
- package/dist-client/pages/project/popup/checklist/schedule-checklist-create-popup.d.ts +2 -0
- package/dist-client/pages/project/popup/checklist/schedule-checklist-create-popup.js +684 -0
- package/dist-client/pages/project/popup/checklist/schedule-checklist-create-popup.js.map +1 -0
- package/dist-client/pages/project/popup/checklist/schedule-checklist-view.d.ts +37 -0
- package/dist-client/pages/project/popup/checklist/schedule-checklist-view.js +627 -0
- package/dist-client/pages/project/popup/checklist/schedule-checklist-view.js.map +1 -0
- package/dist-client/pages/project/project-schedule.d.ts +2 -0
- package/dist-client/pages/project/project-schedule.js +16 -1
- package/dist-client/pages/project/project-schedule.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js';
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import { __decorate, __metadata } from "tslib";
|
|
2
|
+
import '@material/web/icon/icon.js';
|
|
3
|
+
import gql from 'graphql-tag';
|
|
4
|
+
import { client } from '@operato/graphql';
|
|
5
|
+
import { css, html, LitElement } from 'lit';
|
|
6
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
7
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles';
|
|
8
|
+
import { notify } from '@operato/layout';
|
|
9
|
+
import { store, User } from '@operato/shell';
|
|
10
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
11
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js';
|
|
12
|
+
import { openPopup } from '@operato/layout';
|
|
13
|
+
import { BuildingInspectionStatus } from './schedule-checklist-view';
|
|
14
|
+
let AttachmentListPopup = class AttachmentListPopup extends connect(store)(LitElement) {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.checklistItemId = '';
|
|
18
|
+
this.status = BuildingInspectionStatus.WAIT;
|
|
19
|
+
this.item = { count: 0 };
|
|
20
|
+
this.checklistItemAttachments = [];
|
|
21
|
+
this.checklistItemAttachmentCount = 0;
|
|
22
|
+
this.user = {};
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html `
|
|
26
|
+
<div body>
|
|
27
|
+
<h3>제품검사에 대한 파일: ${this.checklistItemAttachmentCount || 0}건</h3>
|
|
28
|
+
|
|
29
|
+
<div attachment-container>
|
|
30
|
+
${this.checklistItemAttachments.map(attachment => {
|
|
31
|
+
return html `
|
|
32
|
+
<div attachment-row>
|
|
33
|
+
<div creator-container>
|
|
34
|
+
<span creator><md-icon slot="icon">account_circle</md-icon> ${attachment.creator.name}</span>
|
|
35
|
+
<span createdAt>
|
|
36
|
+
<md-icon slot="icon">schedule</md-icon> ${this._formatDate(attachment.createdAt)}
|
|
37
|
+
${attachment.creator.email === this.user.email && this.status != BuildingInspectionStatus.PASS
|
|
38
|
+
? html ` <md-icon delete slot="icon" @click=${() => this._deleteAttachment(attachment.id)}>delete</md-icon>`
|
|
39
|
+
: ''}
|
|
40
|
+
<a button-download href=${attachment.fullpath} download=${attachment.name}>
|
|
41
|
+
<md-icon slot="icon">download</md-icon></a
|
|
42
|
+
>
|
|
43
|
+
</span>
|
|
44
|
+
</div>
|
|
45
|
+
<a attachment @click=${() => this._onClickPreview(attachment.fullpath)}>${attachment.name}</a>
|
|
46
|
+
</div>
|
|
47
|
+
`;
|
|
48
|
+
})}
|
|
49
|
+
</div>
|
|
50
|
+
|
|
51
|
+
<ox-input-file
|
|
52
|
+
accept="*/*"
|
|
53
|
+
multiple="true"
|
|
54
|
+
hide-filelist
|
|
55
|
+
?disabled=${this.status == BuildingInspectionStatus.PASS}
|
|
56
|
+
@change=${this.onCreateAttachment.bind(this)}
|
|
57
|
+
></ox-input-file>
|
|
58
|
+
|
|
59
|
+
<div button-container>
|
|
60
|
+
<md-elevated-button @click=${this._close}> <md-icon slot="icon">cancel</md-icon>취소 </md-elevated-button>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
async firstUpdated() {
|
|
66
|
+
var _a;
|
|
67
|
+
this.user = (_a = store.getState().auth) === null || _a === void 0 ? void 0 : _a.user;
|
|
68
|
+
await this._loadAttachments();
|
|
69
|
+
}
|
|
70
|
+
async _loadAttachments() {
|
|
71
|
+
const response = await client.query({
|
|
72
|
+
query: gql `
|
|
73
|
+
query ChecklistItem($id: String!) {
|
|
74
|
+
checklistItem(id: $id) {
|
|
75
|
+
id
|
|
76
|
+
checklistItemAttachmentCount
|
|
77
|
+
checklistItemAttachments {
|
|
78
|
+
id
|
|
79
|
+
name
|
|
80
|
+
fullpath
|
|
81
|
+
creator {
|
|
82
|
+
id
|
|
83
|
+
name
|
|
84
|
+
email
|
|
85
|
+
}
|
|
86
|
+
createdAt
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
`,
|
|
91
|
+
variables: {
|
|
92
|
+
id: this.checklistItemId
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
if (response.errors)
|
|
96
|
+
return;
|
|
97
|
+
this.checklistItemAttachments = response.data.checklistItem.checklistItemAttachments || [];
|
|
98
|
+
this.checklistItemAttachmentCount = response.data.checklistItem.checklistItemAttachmentCount;
|
|
99
|
+
}
|
|
100
|
+
async _deleteAttachment(attachmentId) {
|
|
101
|
+
var _a, _b;
|
|
102
|
+
if (this.status == BuildingInspectionStatus.PASS) {
|
|
103
|
+
notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' });
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (await OxPrompt.open({
|
|
107
|
+
title: '첨부 자료를 삭제',
|
|
108
|
+
text: '첨부 자료를 삭제 하시겠습니까?',
|
|
109
|
+
confirmButton: { text: '삭제' },
|
|
110
|
+
cancelButton: { text: '취소' }
|
|
111
|
+
})) {
|
|
112
|
+
const response = await client.mutate({
|
|
113
|
+
mutation: gql `
|
|
114
|
+
mutation DeleteAttachment($deleteAttachmentId: String!) {
|
|
115
|
+
deleteAttachment(id: $deleteAttachmentId)
|
|
116
|
+
}
|
|
117
|
+
`,
|
|
118
|
+
variables: {
|
|
119
|
+
deleteAttachmentId: attachmentId
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
if (!response.errors) {
|
|
123
|
+
this.checklistItemAttachments = [...this.checklistItemAttachments.filter(attachment => attachment.id != attachmentId)];
|
|
124
|
+
notify({ message: '첨부 자료를 삭제하였습니다.', level: 'info' });
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
notify({ message: ((_b = (_a = response.errors) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.message) || '첨부 자료 삭제에 실패하였습니다.', level: 'error' });
|
|
128
|
+
}
|
|
129
|
+
this._dispatchEvent();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
_close() {
|
|
133
|
+
history.back();
|
|
134
|
+
}
|
|
135
|
+
// 파일 변경 시 파일을 저장할 핸들러
|
|
136
|
+
async onCreateAttachment(e) {
|
|
137
|
+
if (this.status == BuildingInspectionStatus.PASS) {
|
|
138
|
+
notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' });
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const files = e.detail;
|
|
142
|
+
await this._createAttachments(files);
|
|
143
|
+
this._dispatchEvent();
|
|
144
|
+
}
|
|
145
|
+
async _createAttachments(files) {
|
|
146
|
+
const checklistItemId = this.checklistItemId;
|
|
147
|
+
const response = await client.mutate({
|
|
148
|
+
mutation: gql `
|
|
149
|
+
mutation ($attachments: [NewAttachment!]!) {
|
|
150
|
+
createAttachments(attachments: $attachments) {
|
|
151
|
+
id
|
|
152
|
+
name
|
|
153
|
+
fullpath
|
|
154
|
+
creator {
|
|
155
|
+
id
|
|
156
|
+
name
|
|
157
|
+
email
|
|
158
|
+
}
|
|
159
|
+
createdAt
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
`,
|
|
163
|
+
variables: {
|
|
164
|
+
attachments: files.map(file => {
|
|
165
|
+
return { file, refBy: checklistItemId, refType: 'ChecklistItem' };
|
|
166
|
+
})
|
|
167
|
+
},
|
|
168
|
+
context: {
|
|
169
|
+
hasUpload: true
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
const attachments = response.data.createAttachments;
|
|
173
|
+
this.checklistItemAttachments = [...attachments, ...this.checklistItemAttachments];
|
|
174
|
+
this.checklistItemAttachmentCount = this.checklistItemAttachmentCount + attachments.length;
|
|
175
|
+
}
|
|
176
|
+
_formatDate(date) {
|
|
177
|
+
const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }));
|
|
178
|
+
const year = _date.getFullYear();
|
|
179
|
+
const month = String(_date.getMonth() + 1).padStart(2, '0');
|
|
180
|
+
const day = String(_date.getDate()).padStart(2, '0');
|
|
181
|
+
const hours = String(_date.getHours()).padStart(2, '0');
|
|
182
|
+
const minutes = String(_date.getMinutes()).padStart(2, '0');
|
|
183
|
+
const seconds = String(_date.getSeconds()).padStart(2, '0');
|
|
184
|
+
return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`;
|
|
185
|
+
}
|
|
186
|
+
// 첨부 자료 변경 이벤트 디스패치
|
|
187
|
+
_dispatchEvent() {
|
|
188
|
+
this.dispatchEvent(new CustomEvent('change-attachment', { detail: { checklistItemId: this.checklistItemId } }));
|
|
189
|
+
}
|
|
190
|
+
_onClickPreview(filepath) {
|
|
191
|
+
openPopup(html ` <file-preview-popup .filepath=${filepath}></file-preview-popup> `, {
|
|
192
|
+
backdrop: true,
|
|
193
|
+
size: 'large',
|
|
194
|
+
title: '미리보기'
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
AttachmentListPopup.styles = [
|
|
199
|
+
ButtonContainerStyles,
|
|
200
|
+
ScrollbarStyles,
|
|
201
|
+
css `
|
|
202
|
+
:host {
|
|
203
|
+
display: flex;
|
|
204
|
+
flex-direction: column;
|
|
205
|
+
padding: 15px 20px;
|
|
206
|
+
background-color: var(--md-sys-color-surface);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
div[body] {
|
|
210
|
+
height: 100%;
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
gap: 12px;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
div[attachment-container] {
|
|
217
|
+
overflow-y: auto;
|
|
218
|
+
gap: 10px;
|
|
219
|
+
display: flex;
|
|
220
|
+
flex-direction: column;
|
|
221
|
+
flex: 1;
|
|
222
|
+
|
|
223
|
+
div[attachment-row] {
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-direction: column;
|
|
226
|
+
|
|
227
|
+
div[creator-container] {
|
|
228
|
+
display: flex;
|
|
229
|
+
justify-content: space-between;
|
|
230
|
+
|
|
231
|
+
span[creator] {
|
|
232
|
+
font-weight: 600;
|
|
233
|
+
display: flex;
|
|
234
|
+
align-items: center;
|
|
235
|
+
gap: 3px;
|
|
236
|
+
}
|
|
237
|
+
span[createdAt] {
|
|
238
|
+
display: flex;
|
|
239
|
+
align-items: center;
|
|
240
|
+
gap: 3px;
|
|
241
|
+
|
|
242
|
+
md-icon[delete] {
|
|
243
|
+
cursor: pointer;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
a[button-download] {
|
|
247
|
+
display: flex;
|
|
248
|
+
color: #000;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
a[attachment] {
|
|
254
|
+
margin-left: 20px;
|
|
255
|
+
text-decoration: none;
|
|
256
|
+
color: #000;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
h3 {
|
|
262
|
+
position: relative;
|
|
263
|
+
color: rgb(5, 149, 229);
|
|
264
|
+
font-size: 17px;
|
|
265
|
+
font-weight: 700;
|
|
266
|
+
background-color: var(--md-sys-color-surface);
|
|
267
|
+
margin-top: 0px;
|
|
268
|
+
margin-bottom: 5px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
div[button-container] {
|
|
272
|
+
display: flex;
|
|
273
|
+
justify-content: flex-end;
|
|
274
|
+
gap: 10px;
|
|
275
|
+
}
|
|
276
|
+
`
|
|
277
|
+
];
|
|
278
|
+
__decorate([
|
|
279
|
+
property({ type: String }),
|
|
280
|
+
__metadata("design:type", String)
|
|
281
|
+
], AttachmentListPopup.prototype, "checklistItemId", void 0);
|
|
282
|
+
__decorate([
|
|
283
|
+
property({ type: String }),
|
|
284
|
+
__metadata("design:type", String)
|
|
285
|
+
], AttachmentListPopup.prototype, "status", void 0);
|
|
286
|
+
__decorate([
|
|
287
|
+
state(),
|
|
288
|
+
__metadata("design:type", Object)
|
|
289
|
+
], AttachmentListPopup.prototype, "item", void 0);
|
|
290
|
+
__decorate([
|
|
291
|
+
state(),
|
|
292
|
+
__metadata("design:type", Object)
|
|
293
|
+
], AttachmentListPopup.prototype, "checklistItemAttachments", void 0);
|
|
294
|
+
__decorate([
|
|
295
|
+
state(),
|
|
296
|
+
__metadata("design:type", Number)
|
|
297
|
+
], AttachmentListPopup.prototype, "checklistItemAttachmentCount", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
state(),
|
|
300
|
+
__metadata("design:type", User)
|
|
301
|
+
], AttachmentListPopup.prototype, "user", void 0);
|
|
302
|
+
__decorate([
|
|
303
|
+
query('div[attachment-container]'),
|
|
304
|
+
__metadata("design:type", HTMLDivElement)
|
|
305
|
+
], AttachmentListPopup.prototype, "attachmentContainer", void 0);
|
|
306
|
+
AttachmentListPopup = __decorate([
|
|
307
|
+
customElement('attachment-list-popup')
|
|
308
|
+
], AttachmentListPopup);
|
|
309
|
+
//# sourceMappingURL=attachment-list-popup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment-list-popup.js","sourceRoot":"","sources":["../../../../../client/pages/project/popup/checklist/attachment-list-popup.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,GAAG,MAAM,aAAa,CAAA;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAA;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAGpE,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,OAAO,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;IAA5D;;QAkF8B,oBAAe,GAAW,EAAE,CAAA;QAC5B,WAAM,GAA6B,wBAAwB,CAAC,IAAI,CAAA;QAEnF,SAAI,GAAQ,EAAE,K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,CAAC,IAAI,WAAW,CAAC,mBAAmB,EAAE,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,IAAI,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAA;IACjH,CAAC;IAEO,eAAe,CAAC,QAAgB;QACtC,SAAS,CAAC,IAAI,CAAA,kCAAkC,QAAQ,yBAAyB,EAAE;YACjF,QAAQ,EAAE,IAAI;YACd,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,MAAM;SACd,CAAC,CAAA;IACJ,CAAC;;AA3RM,0BAAM,GAAG;IACd,qBAAqB;IACrB,eAAe;IACf,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2EF;CACF,AA/EY,CA+EZ;AAE2B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4DAA6B;AAC5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDAAiE;AAEnF;IAAR,KAAK,EAAE;;iDAAyB;AACxB;IAAR,KAAK,EAAE;;qEAAmC;AAClC;IAAR,KAAK,EAAE;;yEAAyC;AACxC;IAAR,KAAK,EAAE;8BAAO,IAAI;iDAAK;AACY;IAAnC,KAAK,CAAC,2BAA2B,CAAC;8BAAuB,cAAc;gEAAA;AAzFpE,mBAAmB;IADxB,aAAa,CAAC,uBAAuB,CAAC;GACjC,mBAAmB,CA6RxB","sourcesContent":["import '@material/web/icon/icon.js'\nimport gql from 'graphql-tag'\nimport { client } from '@operato/graphql'\nimport { css, html, LitElement } from 'lit'\nimport { customElement, property, query, state } from 'lit/decorators.js'\nimport { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'\nimport { notify } from '@operato/layout'\nimport { store, User } from '@operato/shell'\nimport { connect } from 'pwa-helpers/connect-mixin.js'\nimport { OxPrompt } from '@operato/popup/ox-prompt.js'\nimport { openPopup } from '@operato/layout'\nimport { BuildingInspectionStatus } from './schedule-checklist-view'\n\n@customElement('attachment-list-popup')\nclass AttachmentListPopup extends connect(store)(LitElement) {\n static styles = [\n ButtonContainerStyles,\n ScrollbarStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n padding: 15px 20px;\n background-color: var(--md-sys-color-surface);\n }\n\n div[body] {\n height: 100%;\n display: flex;\n flex-direction: column;\n gap: 12px;\n }\n\n div[attachment-container] {\n overflow-y: auto;\n gap: 10px;\n display: flex;\n flex-direction: column;\n flex: 1;\n\n div[attachment-row] {\n display: flex;\n flex-direction: column;\n\n div[creator-container] {\n display: flex;\n justify-content: space-between;\n\n span[creator] {\n font-weight: 600;\n display: flex;\n align-items: center;\n gap: 3px;\n }\n span[createdAt] {\n display: flex;\n align-items: center;\n gap: 3px;\n\n md-icon[delete] {\n cursor: pointer;\n }\n\n a[button-download] {\n display: flex;\n color: #000;\n }\n }\n }\n\n a[attachment] {\n margin-left: 20px;\n text-decoration: none;\n color: #000;\n }\n }\n }\n\n h3 {\n position: relative;\n color: rgb(5, 149, 229);\n font-size: 17px;\n font-weight: 700;\n background-color: var(--md-sys-color-surface);\n margin-top: 0px;\n margin-bottom: 5px;\n }\n\n div[button-container] {\n display: flex;\n justify-content: flex-end;\n gap: 10px;\n }\n `\n ]\n\n @property({ type: String }) checklistItemId: string = ''\n @property({ type: String }) status: BuildingInspectionStatus = BuildingInspectionStatus.WAIT\n\n @state() item: any = { count: 0 }\n @state() checklistItemAttachments: any = []\n @state() checklistItemAttachmentCount: number = 0\n @state() user: User = {}\n @query('div[attachment-container]') attachmentContainer!: HTMLDivElement\n\n render() {\n return html`\n <div body>\n <h3>제품검사에 대한 파일: ${this.checklistItemAttachmentCount || 0}건</h3>\n\n <div attachment-container>\n ${this.checklistItemAttachments.map(attachment => {\n return html`\n <div attachment-row>\n <div creator-container>\n <span creator><md-icon slot=\"icon\">account_circle</md-icon> ${attachment.creator.name}</span>\n <span createdAt>\n <md-icon slot=\"icon\">schedule</md-icon> ${this._formatDate(attachment.createdAt)}\n ${attachment.creator.email === this.user.email && this.status != BuildingInspectionStatus.PASS\n ? html` <md-icon delete slot=\"icon\" @click=${() => this._deleteAttachment(attachment.id)}>delete</md-icon>`\n : ''}\n <a button-download href=${attachment.fullpath} download=${attachment.name}>\n <md-icon slot=\"icon\">download</md-icon></a\n >\n </span>\n </div>\n <a attachment @click=${() => this._onClickPreview(attachment.fullpath)}>${attachment.name}</a>\n </div>\n `\n })}\n </div>\n\n <ox-input-file\n accept=\"*/*\"\n multiple=\"true\"\n hide-filelist\n ?disabled=${this.status == BuildingInspectionStatus.PASS}\n @change=${this.onCreateAttachment.bind(this)}\n ></ox-input-file>\n\n <div button-container>\n <md-elevated-button @click=${this._close}> <md-icon slot=\"icon\">cancel</md-icon>취소 </md-elevated-button>\n </div>\n </div>\n `\n }\n\n async firstUpdated() {\n this.user = (store.getState() as any).auth?.user\n\n await this._loadAttachments()\n }\n\n private async _loadAttachments() {\n const response = await client.query({\n query: gql`\n query ChecklistItem($id: String!) {\n checklistItem(id: $id) {\n id\n checklistItemAttachmentCount\n checklistItemAttachments {\n id\n name\n fullpath\n creator {\n id\n name\n email\n }\n createdAt\n }\n }\n }\n `,\n variables: {\n id: this.checklistItemId\n }\n })\n\n if (response.errors) return\n\n this.checklistItemAttachments = response.data.checklistItem.checklistItemAttachments || []\n this.checklistItemAttachmentCount = response.data.checklistItem.checklistItemAttachmentCount\n }\n\n private async _deleteAttachment(attachmentId: string) {\n if (this.status == BuildingInspectionStatus.PASS) {\n notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' })\n return\n }\n\n if (\n await OxPrompt.open({\n title: '첨부 자료를 삭제',\n text: '첨부 자료를 삭제 하시겠습니까?',\n confirmButton: { text: '삭제' },\n cancelButton: { text: '취소' }\n })\n ) {\n const response = await client.mutate({\n mutation: gql`\n mutation DeleteAttachment($deleteAttachmentId: String!) {\n deleteAttachment(id: $deleteAttachmentId)\n }\n `,\n variables: {\n deleteAttachmentId: attachmentId\n }\n })\n\n if (!response.errors) {\n this.checklistItemAttachments = [...this.checklistItemAttachments.filter(attachment => attachment.id != attachmentId)]\n notify({ message: '첨부 자료를 삭제하였습니다.', level: 'info' })\n } else {\n notify({ message: response.errors?.[0]?.message || '첨부 자료 삭제에 실패하였습니다.', level: 'error' })\n }\n\n this._dispatchEvent()\n }\n }\n\n private _close() {\n history.back()\n }\n\n // 파일 변경 시 파일을 저장할 핸들러\n private async onCreateAttachment(e: CustomEvent) {\n if (this.status == BuildingInspectionStatus.PASS) {\n notify({ message: '완료 상태인 검측정보를 변경할 수 없습니다.', level: 'error' })\n return\n }\n\n const files = e.detail\n\n await this._createAttachments(files)\n\n this._dispatchEvent()\n }\n\n async _createAttachments(files: File[]) {\n const checklistItemId = this.checklistItemId\n\n const response = await client.mutate({\n mutation: gql`\n mutation ($attachments: [NewAttachment!]!) {\n createAttachments(attachments: $attachments) {\n id\n name\n fullpath\n creator {\n id\n name\n email\n }\n createdAt\n }\n }\n `,\n variables: {\n attachments: files.map(file => {\n return { file, refBy: checklistItemId, refType: 'ChecklistItem' }\n })\n },\n context: {\n hasUpload: true\n }\n })\n\n const attachments = response.data.createAttachments\n\n this.checklistItemAttachments = [...attachments, ...this.checklistItemAttachments]\n this.checklistItemAttachmentCount = this.checklistItemAttachmentCount + attachments.length\n }\n\n private _formatDate(date) {\n const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))\n\n const year = _date.getFullYear()\n const month = String(_date.getMonth() + 1).padStart(2, '0')\n const day = String(_date.getDate()).padStart(2, '0')\n const hours = String(_date.getHours()).padStart(2, '0')\n const minutes = String(_date.getMinutes()).padStart(2, '0')\n const seconds = String(_date.getSeconds()).padStart(2, '0')\n\n return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`\n }\n\n // 첨부 자료 변경 이벤트 디스패치\n _dispatchEvent() {\n this.dispatchEvent(new CustomEvent('change-attachment', { detail: { checklistItemId: this.checklistItemId } }))\n }\n\n private _onClickPreview(filepath: string) {\n openPopup(html` <file-preview-popup .filepath=${filepath}></file-preview-popup> `, {\n backdrop: true,\n size: 'large',\n title: '미리보기'\n })\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js';
|