@dssp/supervision 0.0.33 → 0.0.35
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/client/pages/building-inspection/building-inspection-detail-checklist.ts +1 -0
- package/client/pages/checklist/attachment-list-popup.ts +283 -0
- package/client/pages/checklist/checklist-view.ts +32 -7
- package/client/pages/checklist/comment-list-popup.ts +2 -1
- package/client/pages/checklist/file-preview-popup.ts +70 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +1 -0
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
- package/dist-client/pages/checklist/attachment-list-popup.d.ts +2 -0
- package/dist-client/pages/checklist/attachment-list-popup.js +290 -0
- package/dist-client/pages/checklist/attachment-list-popup.js.map +1 -0
- package/dist-client/pages/checklist/checklist-view.d.ts +1 -0
- package/dist-client/pages/checklist/checklist-view.js +29 -8
- package/dist-client/pages/checklist/checklist-view.js.map +1 -1
- package/dist-client/pages/checklist/comment-list-popup.d.ts +0 -1
- package/dist-client/pages/checklist/comment-list-popup.js +2 -1
- package/dist-client/pages/checklist/comment-list-popup.js.map +1 -1
- package/dist-client/pages/checklist/file-preview-popup.d.ts +1 -0
- package/dist-client/pages/checklist/file-preview-popup.js +78 -0
- package/dist-client/pages/checklist/file-preview-popup.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/checklist-item/checklist-item-query.d.ts +3 -0
- package/dist-server/service/checklist-item/checklist-item-query.js +34 -2
- package/dist-server/service/checklist-item/checklist-item-query.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/service/checklist-item/checklist-item-query.ts +25 -6
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
import gql from 'graphql-tag'
|
|
3
|
+
import { client } from '@operato/graphql'
|
|
4
|
+
import { css, html, LitElement } from 'lit'
|
|
5
|
+
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
6
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
|
|
7
|
+
import { notify } from '@operato/layout'
|
|
8
|
+
import { store, User } from '@operato/shell'
|
|
9
|
+
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
10
|
+
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
11
|
+
import { openPopup } from '@operato/layout'
|
|
12
|
+
import './file-preview-popup'
|
|
13
|
+
|
|
14
|
+
@customElement('attachment-list-popup')
|
|
15
|
+
class AttachmentListPopup extends connect(store)(LitElement) {
|
|
16
|
+
static styles = [
|
|
17
|
+
ButtonContainerStyles,
|
|
18
|
+
ScrollbarStyles,
|
|
19
|
+
css`
|
|
20
|
+
:host {
|
|
21
|
+
display: flex;
|
|
22
|
+
flex-direction: column;
|
|
23
|
+
padding: 15px 20px;
|
|
24
|
+
background-color: var(--md-sys-color-surface);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
div[body] {
|
|
28
|
+
height: 100%;
|
|
29
|
+
display: flex;
|
|
30
|
+
flex-direction: column;
|
|
31
|
+
gap: 12px;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
div[attachment-container] {
|
|
35
|
+
overflow-y: auto;
|
|
36
|
+
gap: 10px;
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
flex: 1;
|
|
40
|
+
|
|
41
|
+
div[attachment-row] {
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
|
|
45
|
+
div[creator-container] {
|
|
46
|
+
display: flex;
|
|
47
|
+
justify-content: space-between;
|
|
48
|
+
|
|
49
|
+
span[creator] {
|
|
50
|
+
font-weight: 600;
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: 3px;
|
|
54
|
+
}
|
|
55
|
+
span[createdAt] {
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
gap: 3px;
|
|
59
|
+
|
|
60
|
+
md-icon[delete] {
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
a[button-download] {
|
|
65
|
+
display: flex;
|
|
66
|
+
color: #000;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
a[attachment] {
|
|
72
|
+
margin-left: 20px;
|
|
73
|
+
text-decoration: none;
|
|
74
|
+
color: #000;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
h3 {
|
|
80
|
+
position: relative;
|
|
81
|
+
color: rgb(5, 149, 229);
|
|
82
|
+
font-size: 17px;
|
|
83
|
+
font-weight: 700;
|
|
84
|
+
background-color: var(--md-sys-color-surface);
|
|
85
|
+
margin-top: 0px;
|
|
86
|
+
margin-bottom: 5px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
div[button-container] {
|
|
90
|
+
display: flex;
|
|
91
|
+
justify-content: flex-end;
|
|
92
|
+
gap: 10px;
|
|
93
|
+
}
|
|
94
|
+
`
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
@property({ type: String }) checklistItemId: string = ''
|
|
98
|
+
|
|
99
|
+
@state() item: any = { count: 0 }
|
|
100
|
+
@state() checklistItemAttachments: any = []
|
|
101
|
+
@state() checklistItemAttachmentCount: number = 0
|
|
102
|
+
@state() user: User = {}
|
|
103
|
+
@query('div[attachment-container]') attachmentContainer!: HTMLDivElement
|
|
104
|
+
|
|
105
|
+
render() {
|
|
106
|
+
return html`
|
|
107
|
+
<div body>
|
|
108
|
+
<h3>제품검사에 대한 파일: ${this.checklistItemAttachmentCount || 0}건</h3>
|
|
109
|
+
|
|
110
|
+
<div attachment-container>
|
|
111
|
+
${this.checklistItemAttachments.map(attachment => {
|
|
112
|
+
return html`
|
|
113
|
+
<div attachment-row>
|
|
114
|
+
<div creator-container>
|
|
115
|
+
<span creator><md-icon slot="icon">account_circle</md-icon> ${attachment.creator.name}</span>
|
|
116
|
+
<span createdAt>
|
|
117
|
+
<md-icon slot="icon">schedule</md-icon> ${this._formatDate(attachment.createdAt)}
|
|
118
|
+
${attachment.creator.email === this.user.email
|
|
119
|
+
? html` <md-icon delete slot="icon" @click=${() => this._deleteAttachment(attachment.id)}>delete</md-icon>`
|
|
120
|
+
: ''}
|
|
121
|
+
<a button-download href=${attachment.fullpath} download=${attachment.name}>
|
|
122
|
+
<md-icon slot="icon">download</md-icon></a
|
|
123
|
+
>
|
|
124
|
+
</span>
|
|
125
|
+
</div>
|
|
126
|
+
<a attachment @click=${() => this._onClickPreview(attachment.fullpath)}>${attachment.name}</a>
|
|
127
|
+
</div>
|
|
128
|
+
`
|
|
129
|
+
})}
|
|
130
|
+
</div>
|
|
131
|
+
|
|
132
|
+
<ox-input-file accept="*/*" multiple="true" hide-filelist @change=${this.onCreateAttachment.bind(this)}></ox-input-file>
|
|
133
|
+
|
|
134
|
+
<div button-container>
|
|
135
|
+
<md-elevated-button @click=${this._close}> <md-icon slot="icon">cancel</md-icon>취소 </md-elevated-button>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
`
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
async firstUpdated() {
|
|
142
|
+
this.user = (store.getState() as any).auth?.user
|
|
143
|
+
|
|
144
|
+
await this._loadAttachments()
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
private async _loadAttachments() {
|
|
148
|
+
const response = await client.query({
|
|
149
|
+
query: gql`
|
|
150
|
+
query ChecklistItem($id: String!) {
|
|
151
|
+
checklistItem(id: $id) {
|
|
152
|
+
id
|
|
153
|
+
checklistItemAttachmentCount
|
|
154
|
+
checklistItemAttachments {
|
|
155
|
+
id
|
|
156
|
+
name
|
|
157
|
+
fullpath
|
|
158
|
+
creator {
|
|
159
|
+
id
|
|
160
|
+
name
|
|
161
|
+
email
|
|
162
|
+
}
|
|
163
|
+
createdAt
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
`,
|
|
168
|
+
variables: {
|
|
169
|
+
id: this.checklistItemId
|
|
170
|
+
}
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
if (response.errors) return
|
|
174
|
+
|
|
175
|
+
this.checklistItemAttachments = response.data.checklistItem.checklistItemAttachments || []
|
|
176
|
+
this.checklistItemAttachmentCount = response.data.checklistItem.checklistItemAttachmentCount
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private async _deleteAttachment(attachmentId: string) {
|
|
180
|
+
if (
|
|
181
|
+
await OxPrompt.open({
|
|
182
|
+
title: '첨부 자료를 삭제',
|
|
183
|
+
text: '첨부 자료를 삭제 하시겠습니까?',
|
|
184
|
+
confirmButton: { text: '삭제' },
|
|
185
|
+
cancelButton: { text: '취소' }
|
|
186
|
+
})
|
|
187
|
+
) {
|
|
188
|
+
const response = await client.mutate({
|
|
189
|
+
mutation: gql`
|
|
190
|
+
mutation DeleteAttachment($deleteAttachmentId: String!) {
|
|
191
|
+
deleteAttachment(id: $deleteAttachmentId)
|
|
192
|
+
}
|
|
193
|
+
`,
|
|
194
|
+
variables: {
|
|
195
|
+
deleteAttachmentId: attachmentId
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
if (!response.errors) {
|
|
200
|
+
this.checklistItemAttachments = [...this.checklistItemAttachments.filter(attachment => attachment.id != attachmentId)]
|
|
201
|
+
notify({ message: '첨부 자료를 삭제하였습니다.', level: 'info' })
|
|
202
|
+
} else {
|
|
203
|
+
notify({ message: response.errors?.[0]?.message || '첨부 자료 삭제에 실패하였습니다.', level: 'error' })
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
this._dispatchEvent()
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
private _close() {
|
|
211
|
+
history.back()
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// 파일 변경 시 파일을 저장할 핸들러
|
|
215
|
+
private async onCreateAttachment(e: CustomEvent) {
|
|
216
|
+
const files = e.detail
|
|
217
|
+
|
|
218
|
+
await this._createAttachments(files)
|
|
219
|
+
|
|
220
|
+
this._dispatchEvent()
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async _createAttachments(files: File[]) {
|
|
224
|
+
const checklistItemId = this.checklistItemId
|
|
225
|
+
|
|
226
|
+
const response = await client.mutate({
|
|
227
|
+
mutation: gql`
|
|
228
|
+
mutation ($attachments: [NewAttachment!]!) {
|
|
229
|
+
createAttachments(attachments: $attachments) {
|
|
230
|
+
id
|
|
231
|
+
name
|
|
232
|
+
fullpath
|
|
233
|
+
creator {
|
|
234
|
+
id
|
|
235
|
+
name
|
|
236
|
+
email
|
|
237
|
+
}
|
|
238
|
+
createdAt
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
`,
|
|
242
|
+
variables: {
|
|
243
|
+
attachments: files.map(file => {
|
|
244
|
+
return { file, refBy: checklistItemId, refType: 'ChecklistItem' }
|
|
245
|
+
})
|
|
246
|
+
},
|
|
247
|
+
context: {
|
|
248
|
+
hasUpload: true
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
const attachments = response.data.createAttachments
|
|
253
|
+
|
|
254
|
+
this.checklistItemAttachments = [...attachments, ...this.checklistItemAttachments]
|
|
255
|
+
this.checklistItemAttachmentCount = this.checklistItemAttachmentCount + attachments.length
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
private _formatDate(date) {
|
|
259
|
+
const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))
|
|
260
|
+
|
|
261
|
+
const year = _date.getFullYear()
|
|
262
|
+
const month = String(_date.getMonth() + 1).padStart(2, '0')
|
|
263
|
+
const day = String(_date.getDate()).padStart(2, '0')
|
|
264
|
+
const hours = String(_date.getHours()).padStart(2, '0')
|
|
265
|
+
const minutes = String(_date.getMinutes()).padStart(2, '0')
|
|
266
|
+
const seconds = String(_date.getSeconds()).padStart(2, '0')
|
|
267
|
+
|
|
268
|
+
return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// 첨부 자료 변경 이벤트 디스패치
|
|
272
|
+
_dispatchEvent() {
|
|
273
|
+
this.dispatchEvent(new CustomEvent('change-attachment', { detail: { checklistItemId: this.checklistItemId } }))
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private _onClickPreview(filepath: string) {
|
|
277
|
+
openPopup(html` <file-preview-popup .filepath=${filepath}></file-preview-popup> `, {
|
|
278
|
+
backdrop: true,
|
|
279
|
+
size: 'large',
|
|
280
|
+
title: '미리보기'
|
|
281
|
+
})
|
|
282
|
+
}
|
|
283
|
+
}
|
|
@@ -14,6 +14,7 @@ import { store } from '@operato/shell'
|
|
|
14
14
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
15
15
|
import { openPopup } from '@operato/layout'
|
|
16
16
|
import './comment-list-popup'
|
|
17
|
+
import './attachment-list-popup'
|
|
17
18
|
|
|
18
19
|
export const enum ChecklistMode {
|
|
19
20
|
VIEWER = 'VIEWER',
|
|
@@ -119,8 +120,12 @@ class ChecklistView extends connect(store)(LitElement) {
|
|
|
119
120
|
}
|
|
120
121
|
|
|
121
122
|
&[attachment] {
|
|
122
|
-
width: 90px;
|
|
123
123
|
text-align: center;
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
|
|
126
|
+
* {
|
|
127
|
+
vertical-align: middle;
|
|
128
|
+
}
|
|
124
129
|
}
|
|
125
130
|
&[comment] {
|
|
126
131
|
cursor: pointer;
|
|
@@ -344,7 +349,10 @@ class ChecklistView extends connect(store)(LitElement) {
|
|
|
344
349
|
@change=${this._onChangeConfirmStatus}
|
|
345
350
|
></md-radio>
|
|
346
351
|
</td>
|
|
347
|
-
<td attachment
|
|
352
|
+
<td attachment @click=${() => this._onClickAttachment(item.id)}>
|
|
353
|
+
<md-icon slot="icon">attach_file</md-icon>
|
|
354
|
+
<span>${item?.checklistItemAttachmentCount || ''}</span>
|
|
355
|
+
</td>
|
|
348
356
|
<td comment @click=${() => this._onClickComment(item.id)}>
|
|
349
357
|
<md-icon slot="icon">chat</md-icon>
|
|
350
358
|
<span>${item?.checklistItemCommentCount || ''}</span>
|
|
@@ -508,18 +516,34 @@ class ChecklistView extends connect(store)(LitElement) {
|
|
|
508
516
|
html`
|
|
509
517
|
<comment-list-popup
|
|
510
518
|
.checklistItemId=${checklistItemId}
|
|
511
|
-
@change-comment=${this.
|
|
519
|
+
@change-comment=${this._refreshItem.bind(this)}
|
|
512
520
|
></comment-list-popup>
|
|
513
521
|
`,
|
|
514
522
|
{
|
|
515
523
|
backdrop: true,
|
|
516
524
|
size: 'medium',
|
|
517
|
-
title: '
|
|
525
|
+
title: '조치 사항'
|
|
526
|
+
}
|
|
527
|
+
)
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
private _onClickAttachment(checklistItemId: string) {
|
|
531
|
+
openPopup(
|
|
532
|
+
html`
|
|
533
|
+
<attachment-list-popup
|
|
534
|
+
.checklistItemId=${checklistItemId}
|
|
535
|
+
@change-attachment=${this._refreshItem.bind(this)}
|
|
536
|
+
></attachment-list-popup>
|
|
537
|
+
`,
|
|
538
|
+
{
|
|
539
|
+
backdrop: true,
|
|
540
|
+
size: 'medium',
|
|
541
|
+
title: '첨부 자료'
|
|
518
542
|
}
|
|
519
543
|
)
|
|
520
544
|
}
|
|
521
545
|
|
|
522
|
-
private async
|
|
546
|
+
private async _refreshItem(e) {
|
|
523
547
|
const { checklistItemId } = e.detail
|
|
524
548
|
const response = await client.query({
|
|
525
549
|
query: gql`
|
|
@@ -527,6 +551,7 @@ class ChecklistView extends connect(store)(LitElement) {
|
|
|
527
551
|
checklistItem(id: $checklistItemId) {
|
|
528
552
|
id
|
|
529
553
|
checklistItemCommentCount
|
|
554
|
+
checklistItemAttachmentCount
|
|
530
555
|
}
|
|
531
556
|
}
|
|
532
557
|
`,
|
|
@@ -535,9 +560,9 @@ class ChecklistView extends connect(store)(LitElement) {
|
|
|
535
560
|
}
|
|
536
561
|
})
|
|
537
562
|
|
|
538
|
-
const
|
|
563
|
+
const checklistItem = response.data?.checklistItem || []
|
|
539
564
|
this.checklist.checklistItems = this.checklist.checklistItems.map(item => {
|
|
540
|
-
return item.id != checklistItemId ? item : { ...item,
|
|
565
|
+
return item.id != checklistItemId ? item : { ...item, ...checklistItem }
|
|
541
566
|
})
|
|
542
567
|
|
|
543
568
|
this.requestUpdate()
|
|
@@ -8,7 +8,6 @@ import { notify } from '@operato/layout'
|
|
|
8
8
|
import { store, User } from '@operato/shell'
|
|
9
9
|
import { connect } from 'pwa-helpers/connect-mixin.js'
|
|
10
10
|
import { OxPrompt } from '@operato/popup/ox-prompt.js'
|
|
11
|
-
import './checklist-view'
|
|
12
11
|
|
|
13
12
|
@customElement('comment-list-popup')
|
|
14
13
|
class CommentListPopup extends connect(store)(LitElement) {
|
|
@@ -80,6 +79,7 @@ class CommentListPopup extends connect(store)(LitElement) {
|
|
|
80
79
|
|
|
81
80
|
textarea {
|
|
82
81
|
height: 75px;
|
|
82
|
+
border: 1px solid #ccc;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
div[button-container] {
|
|
@@ -172,6 +172,7 @@ class CommentListPopup extends connect(store)(LitElement) {
|
|
|
172
172
|
creator {
|
|
173
173
|
id
|
|
174
174
|
email
|
|
175
|
+
name
|
|
175
176
|
}
|
|
176
177
|
createdAt
|
|
177
178
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import '@material/web/icon/icon.js'
|
|
2
|
+
import { css, html, LitElement } from 'lit'
|
|
3
|
+
import { customElement, property, query } from 'lit/decorators.js'
|
|
4
|
+
import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
|
|
5
|
+
|
|
6
|
+
@customElement('file-preview-popup')
|
|
7
|
+
class FilePreviewPopup extends LitElement {
|
|
8
|
+
static styles = [
|
|
9
|
+
ButtonContainerStyles,
|
|
10
|
+
ScrollbarStyles,
|
|
11
|
+
css`
|
|
12
|
+
:host {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
padding: 15px 20px;
|
|
16
|
+
overflow-y: auto;
|
|
17
|
+
background-color: var(--md-sys-color-surface);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.modal-content {
|
|
21
|
+
margin: 5% auto;
|
|
22
|
+
width: 90%;
|
|
23
|
+
background-color: white;
|
|
24
|
+
text-align: center;
|
|
25
|
+
}
|
|
26
|
+
`
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
@property({ type: String }) filepath: string = ''
|
|
30
|
+
|
|
31
|
+
@query('#previewContent') previewContent!: HTMLDivElement
|
|
32
|
+
|
|
33
|
+
render() {
|
|
34
|
+
return html` <div class="modal-content" id="previewContent"></div>`
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async firstUpdated() {
|
|
38
|
+
this.showPreview(this.filepath)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
showPreview(fileUrl) {
|
|
42
|
+
// 파일 확장자 확인
|
|
43
|
+
const fileExtension = fileUrl.split('.').pop().toLowerCase()
|
|
44
|
+
this.previewContent.innerHTML = ''
|
|
45
|
+
|
|
46
|
+
console.log(fileExtension)
|
|
47
|
+
|
|
48
|
+
if (['jpg', 'jpeg', 'png', 'gif', 'webp'].includes(fileExtension)) {
|
|
49
|
+
// 이미지 미리보기
|
|
50
|
+
const img = document.createElement('img')
|
|
51
|
+
img.src = fileUrl
|
|
52
|
+
img.alt = '미리보기 이미지'
|
|
53
|
+
img.style.width = '100%'
|
|
54
|
+
this.previewContent.appendChild(img)
|
|
55
|
+
} else if (fileExtension === 'pdf') {
|
|
56
|
+
// PDF 미리보기
|
|
57
|
+
const iframe = document.createElement('iframe')
|
|
58
|
+
iframe.src = `${fileUrl}#toolbar=0&navpanes=0&scrollbar=0` // 툴바, 내비게이션 및 스크롤바 숨기기
|
|
59
|
+
iframe.style.width = '100%'
|
|
60
|
+
iframe.style.height = '100vh'
|
|
61
|
+
iframe.style.border = 'none'
|
|
62
|
+
this.previewContent.appendChild(iframe)
|
|
63
|
+
} else {
|
|
64
|
+
// 미리보기가 지원되지 않는 파일 형식 안내
|
|
65
|
+
const message = document.createElement('p')
|
|
66
|
+
message.innerText = '미리보기가 지원되지 않는 파일 형식입니다.'
|
|
67
|
+
this.previewContent.appendChild(message)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"building-inspection-detail-checklist.js","sourceRoot":"","sources":["../../../client/pages/building-inspection/building-inspection-detail-checklist.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,iBAAiB,EAAsB,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,GAAG,MAAM,aAAa,CAAA;AAG7B,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,+CAA+C,CAAA;AACtD,OAAO,6BAA6B,CAAA;AAI7B,IAAM,iCAAiC,GAAvC,MAAM,iCAAkC,SAAQ,QAAQ;IAAxD;;QAwCI,YAAO,GAAQ,EAAE,CAAA;QACjB,uBAAkB,GAAQ,EAAE,CAAA;IA8LvC,CAAC;IA5LC,IAAI,OAAO;QACT,OAAO;YACL,KAAK,EAAE,qBAAqB;SAC7B,CAAA;IACH,CAA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import { CommonGristStyles, CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\nimport { PageLifecycle } from '@operato/shell/dist/src/app/pages/page-view'\nimport { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport gql from 'graphql-tag'\nimport { openPopup } from '@operato/layout'\n\nimport { verifyBiometric } from '@things-factory/auth-base/client'\n\nimport './component/building-inspection-detail-header'\nimport '../checklist/checklist-view'\nimport { ChecklistMode } from '../checklist/checklist-view'\n\n@customElement('building-inspection-detail-checklist')\nexport class BuildingInspectionDetailChecklist extends PageView {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: grid;\n grid-template-rows: 75px auto;\n color: #4e5055;\n\n width: 100%;\n background-color: #f7f7f7;\n overflow-y: auto;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n\n *[bold] {\n font-weight: bold;\n }\n\n div[body] {\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n\n div[button-container] {\n display: flex;\n justify-content: flex-end;\n width: 100%;\n gap: 10px;\n margin-right: 50px;\n margin-bottom: 15px;\n }\n }\n `\n ]\n\n @state() project: any = {}\n @state() buildingInspection: any = {}\n\n get context() {\n return {\n title: '검측 관리 상세 - 검측 체크리스트'\n }\n }\n\n render() {\n return html`\n <building-inspection-detail-header\n .buildingInspectionId=${this.buildingInspection?.id}\n .buildingLevelId=${this.buildingInspection?.buildingLevel?.id}\n .projectName=${this.project.name}\n .buildingName=${this.buildingInspection?.buildingLevel?.building?.name}\n .buildingLevelFloor=${this.buildingInspection?.buildingLevel?.floor}\n ></building-inspection-detail-header>\n\n <div body>\n ${keyed(\n this.buildingInspection.id,\n html`\n <checklist-view\n .mode=${ChecklistMode.EDITOR}\n status=${this.buildingInspection.status}\n .checklist=${this.buildingInspection.checklist || {}}\n .buildingComplex=${this.buildingInspection?.buildingLevel?.building?.buildingComplex || {}}\n ></checklist-view>\n `\n )}\n\n <div button-container>\n <md-elevated-button @click=${this._onClickModifyChecklist}>\n <md-icon slot=\"icon\">assignment</md-icon>등록\n </md-elevated-button>\n </div>\n </div>\n `\n }\n\n async pageUpdated(changes: any, lifecycle: PageLifecycle) {\n if (this.active) {\n const buildingInspectionId = lifecycle.resourceId || ''\n await this.initBuildingInspection(buildingInspectionId)\n }\n }\n\n async initBuildingInspection(buildingInspectionId: string = '') {\n const response = await client.query({\n query: gql`\n query BuildingInspection($buildingInspectionId: String!) {\n buildingInspection(id: $buildingInspectionId) {\n id\n status\n requestDate\n checklist {\n id\n name\n constructionType\n constructionDetailType\n location\n inspectionParts\n documentNo\n constructionInspectionDate\n supervisorInspectionDate\n overallConstructorSignature\n taskConstructorSignature\n overallSupervisorySignature\n taskSupervisorySignature\n buildingInspection {\n status\n }\n checklistItems {\n id\n name\n sequence\n mainType\n detailType\n inspctionCriteria\n constructionConfirmStatus\n supervisoryConfirmStatus\n checklistItemCommentCount\n }\n }\n buildingLevel {\n id\n floor\n mainDrawing {\n id\n name\n fullpath\n }\n mainDrawingImage\n building {\n id\n name\n buildingComplex {\n id\n overallConstructorEmails\n taskConstructorEmails\n overallSupervisoryEmails\n taskSupervisoryEmails\n }\n }\n }\n }\n }\n `,\n variables: {\n buildingInspectionId\n }\n })\n\n if (response.errors) return\n\n this.buildingInspection = response.data.buildingInspection\n\n await this._getProjectByBuildingComplexId(this.buildingInspection?.buildingLevel?.building?.buildingComplex?.id)\n }\n\n private async _getProjectByBuildingComplexId(buildingComplexId) {\n const response = await client.query({\n query: gql`\n query ProjectByBuildingComplexId($buildingComplexId: String!) {\n project: projectByBuildingComplexId(buildingComplexId: $buildingComplexId) {\n id\n name\n }\n }\n `,\n variables: {\n buildingComplexId\n }\n })\n\n if (response.errors) return\n\n this.project = response.data.project\n }\n\n private _onClickModifyChecklist() {\n this.validateChecklist(this.buildingInspection.checklist)\n }\n\n private async validateChecklist(checklist: any) {\n try {\n const result = await verifyBiometric()\n if (result.verified) {\n console.log('Verification successful. Proceeding with sensitive action.')\n } else {\n notify({ message: 'Verification failed:' + result.message })\n return\n }\n } catch (error) {\n notify({ message: 'Error during biometric verification:' + error })\n return\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation UpdateBuildingInspectionChecklist($buildingInspection: UpdateBuildingInspectionSubmitType!) {\n updateBuildingInspectionChecklist(buildingInspection: $buildingInspection)\n }\n `,\n variables: {\n buildingInspection: {\n id: this.buildingInspection.id,\n checklist: {\n id: checklist.id,\n overallConstructorSignature: checklist.overallConstructorSignature,\n taskConstructorSignature: checklist.taskConstructorSignature,\n overallSupervisorySignature: checklist.overallSupervisorySignature,\n taskSupervisorySignature: checklist.taskSupervisorySignature\n },\n checklistItem: checklist.checklistItems.map(item => ({\n id: item.id,\n constructionConfirmStatus: item.constructionConfirmStatus,\n supervisoryConfirmStatus: item.supervisoryConfirmStatus\n }))\n }\n }\n })\n\n if (!response.errors) {\n notify({ message: '검측요청서를 등록하였습니다.' })\n this.initBuildingInspection(this.buildingInspection.id)\n } else {\n notify({ message: response.errors?.[0]?.message || '검측 요청서 등록에 실패하였습니다.', level: 'error' })\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"building-inspection-detail-checklist.js","sourceRoot":"","sources":["../../../client/pages/building-inspection/building-inspection-detail-checklist.ts"],"names":[],"mappings":";AAAA,OAAO,4BAA4B,CAAA;AACnC,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,iBAAiB,EAAsB,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;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AAA,MAAA,MAAA,QAAQ,CAAC,MAAM,0CAAG,CAAC,CAAC,0CAAE,OAAO,KAAI,qBAAqB,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;SAC5F;IACH,CAAC;;AAtOM,wCAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiCF;CACF,CAAA;AAED;IAAC,KAAK,EAAE;;kEAAkB;AAC1B;IAAC,KAAK,EAAE;;6EAA6B;AAzC1B,iCAAiC;IAD7C,aAAa,CAAC,sCAAsC,CAAC;GACzC,iCAAiC,CAwO7C;SAxOY,iCAAiC","sourcesContent":["import '@material/web/icon/icon.js'\nimport '@operato/data-grist'\n\nimport { CommonGristStyles, CommonButtonStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, state } from 'lit/decorators.js'\nimport { keyed } from 'lit/directives/keyed.js'\nimport { PageLifecycle } from '@operato/shell/dist/src/app/pages/page-view'\nimport { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport gql from 'graphql-tag'\nimport { openPopup } from '@operato/layout'\n\nimport { verifyBiometric } from '@things-factory/auth-base/client'\n\nimport './component/building-inspection-detail-header'\nimport '../checklist/checklist-view'\nimport { ChecklistMode } from '../checklist/checklist-view'\n\n@customElement('building-inspection-detail-checklist')\nexport class BuildingInspectionDetailChecklist extends PageView {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: grid;\n grid-template-rows: 75px auto;\n color: #4e5055;\n\n width: 100%;\n background-color: #f7f7f7;\n overflow-y: auto;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n\n *[bold] {\n font-weight: bold;\n }\n\n div[body] {\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n\n div[button-container] {\n display: flex;\n justify-content: flex-end;\n width: 100%;\n gap: 10px;\n margin-right: 50px;\n margin-bottom: 15px;\n }\n }\n `\n ]\n\n @state() project: any = {}\n @state() buildingInspection: any = {}\n\n get context() {\n return {\n title: '검측 관리 상세 - 검측 체크리스트'\n }\n }\n\n render() {\n return html`\n <building-inspection-detail-header\n .buildingInspectionId=${this.buildingInspection?.id}\n .buildingLevelId=${this.buildingInspection?.buildingLevel?.id}\n .projectName=${this.project.name}\n .buildingName=${this.buildingInspection?.buildingLevel?.building?.name}\n .buildingLevelFloor=${this.buildingInspection?.buildingLevel?.floor}\n ></building-inspection-detail-header>\n\n <div body>\n ${keyed(\n this.buildingInspection.id,\n html`\n <checklist-view\n .mode=${ChecklistMode.EDITOR}\n status=${this.buildingInspection.status}\n .checklist=${this.buildingInspection.checklist || {}}\n .buildingComplex=${this.buildingInspection?.buildingLevel?.building?.buildingComplex || {}}\n ></checklist-view>\n `\n )}\n\n <div button-container>\n <md-elevated-button @click=${this._onClickModifyChecklist}>\n <md-icon slot=\"icon\">assignment</md-icon>등록\n </md-elevated-button>\n </div>\n </div>\n `\n }\n\n async pageUpdated(changes: any, lifecycle: PageLifecycle) {\n if (this.active) {\n const buildingInspectionId = lifecycle.resourceId || ''\n await this.initBuildingInspection(buildingInspectionId)\n }\n }\n\n async initBuildingInspection(buildingInspectionId: string = '') {\n const response = await client.query({\n query: gql`\n query BuildingInspection($buildingInspectionId: String!) {\n buildingInspection(id: $buildingInspectionId) {\n id\n status\n requestDate\n checklist {\n id\n name\n constructionType\n constructionDetailType\n location\n inspectionParts\n documentNo\n constructionInspectionDate\n supervisorInspectionDate\n overallConstructorSignature\n taskConstructorSignature\n overallSupervisorySignature\n taskSupervisorySignature\n buildingInspection {\n status\n }\n checklistItems {\n id\n name\n sequence\n mainType\n detailType\n inspctionCriteria\n constructionConfirmStatus\n supervisoryConfirmStatus\n checklistItemCommentCount\n checklistItemAttachmentCount\n }\n }\n buildingLevel {\n id\n floor\n mainDrawing {\n id\n name\n fullpath\n }\n mainDrawingImage\n building {\n id\n name\n buildingComplex {\n id\n overallConstructorEmails\n taskConstructorEmails\n overallSupervisoryEmails\n taskSupervisoryEmails\n }\n }\n }\n }\n }\n `,\n variables: {\n buildingInspectionId\n }\n })\n\n if (response.errors) return\n\n this.buildingInspection = response.data.buildingInspection\n\n await this._getProjectByBuildingComplexId(this.buildingInspection?.buildingLevel?.building?.buildingComplex?.id)\n }\n\n private async _getProjectByBuildingComplexId(buildingComplexId) {\n const response = await client.query({\n query: gql`\n query ProjectByBuildingComplexId($buildingComplexId: String!) {\n project: projectByBuildingComplexId(buildingComplexId: $buildingComplexId) {\n id\n name\n }\n }\n `,\n variables: {\n buildingComplexId\n }\n })\n\n if (response.errors) return\n\n this.project = response.data.project\n }\n\n private _onClickModifyChecklist() {\n this.validateChecklist(this.buildingInspection.checklist)\n }\n\n private async validateChecklist(checklist: any) {\n try {\n const result = await verifyBiometric()\n if (result.verified) {\n console.log('Verification successful. Proceeding with sensitive action.')\n } else {\n notify({ message: 'Verification failed:' + result.message })\n return\n }\n } catch (error) {\n notify({ message: 'Error during biometric verification:' + error })\n return\n }\n\n const response = await client.mutate({\n mutation: gql`\n mutation UpdateBuildingInspectionChecklist($buildingInspection: UpdateBuildingInspectionSubmitType!) {\n updateBuildingInspectionChecklist(buildingInspection: $buildingInspection)\n }\n `,\n variables: {\n buildingInspection: {\n id: this.buildingInspection.id,\n checklist: {\n id: checklist.id,\n overallConstructorSignature: checklist.overallConstructorSignature,\n taskConstructorSignature: checklist.taskConstructorSignature,\n overallSupervisorySignature: checklist.overallSupervisorySignature,\n taskSupervisorySignature: checklist.taskSupervisorySignature\n },\n checklistItem: checklist.checklistItems.map(item => ({\n id: item.id,\n constructionConfirmStatus: item.constructionConfirmStatus,\n supervisoryConfirmStatus: item.supervisoryConfirmStatus\n }))\n }\n }\n })\n\n if (!response.errors) {\n notify({ message: '검측요청서를 등록하였습니다.' })\n this.initBuildingInspection(this.buildingInspection.id)\n } else {\n notify({ message: response.errors?.[0]?.message || '검측 요청서 등록에 실패하였습니다.', level: 'error' })\n }\n }\n}\n"]}
|