@dssp/supervision 1.0.0-alpha.0 → 1.0.0-alpha.1
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/building-inspection/building-inspection-detail-checklist.js +1 -1
- package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
- package/dist-client/route.d.ts +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/client/bootstrap.ts +0 -1
- package/client/index.ts +0 -0
- package/client/pages/action-plan/action-plan-importer.ts +0 -94
- package/client/pages/action-plan/action-plan-list-page.ts +0 -340
- package/client/pages/building-inspection/building-inspection-detail-camera.ts +0 -277
- package/client/pages/building-inspection/building-inspection-detail-checklist.ts +0 -258
- package/client/pages/building-inspection/building-inspection-detail-drawing.ts +0 -288
- package/client/pages/building-inspection/building-inspection-list.ts +0 -565
- package/client/pages/building-inspection/component/building-inspection-detail-header.ts +0 -123
- package/client/pages/building-inspection/component/inspection-event-provider.ts +0 -81
- package/client/pages/building-inspection/inspection-create-popup.ts +0 -785
- package/client/pages/checklist/attachment-list-popup.ts +0 -301
- package/client/pages/checklist/checklist-view.ts +0 -581
- package/client/pages/checklist/comment-list-popup.ts +0 -328
- package/client/pages/checklist/file-preview-popup.ts +0 -70
- package/client/pages/checklist-template/checklist-template-item.ts +0 -240
- package/client/pages/checklist-template/checklist-template-list.ts +0 -368
- package/client/pages/checklist-template/checklist-type-management.ts +0 -262
- package/client/pages/issue/issue-importer.ts +0 -94
- package/client/pages/issue/issue-list-page.ts +0 -340
- package/client/pages/project-report/project-report-importer.ts +0 -94
- package/client/pages/project-report/project-report-list-page.ts +0 -340
- package/client/pages/supervisor/supervisor-importer.ts +0 -94
- package/client/pages/supervisor/supervisor-list-page.ts +0 -340
- package/client/route.ts +0 -27
- package/client/tsconfig.json +0 -11
- package/server/controllers/index.ts +0 -0
- package/server/index.ts +0 -4
- package/server/middlewares/index.ts +0 -3
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -28
- package/server/service/action-plan/action-plan-mutation.ts +0 -198
- package/server/service/action-plan/action-plan-query.ts +0 -62
- package/server/service/action-plan/action-plan-type.ts +0 -61
- package/server/service/action-plan/action-plan.ts +0 -103
- package/server/service/action-plan/index.ts +0 -7
- package/server/service/building-inspection/building-inspection-history.ts +0 -72
- package/server/service/building-inspection/building-inspection-mutation.ts +0 -276
- package/server/service/building-inspection/building-inspection-query.ts +0 -242
- package/server/service/building-inspection/building-inspection-type.ts +0 -145
- package/server/service/building-inspection/building-inspection.ts +0 -108
- package/server/service/building-inspection/event-subscriber.ts +0 -20
- package/server/service/building-inspection/index.ts +0 -11
- package/server/service/checklist/checklist-history.ts +0 -96
- package/server/service/checklist/checklist-mutation.ts +0 -103
- package/server/service/checklist/checklist-query.ts +0 -58
- package/server/service/checklist/checklist-type.ts +0 -49
- package/server/service/checklist/checklist.ts +0 -127
- package/server/service/checklist/event-subscriber.ts +0 -17
- package/server/service/checklist/index.ts +0 -9
- package/server/service/checklist-item/checklist-item-mutation.ts +0 -5
- package/server/service/checklist-item/checklist-item-query.ts +0 -84
- package/server/service/checklist-item/checklist-item-type.ts +0 -12
- package/server/service/checklist-item/checklist-item.ts +0 -103
- package/server/service/checklist-item/index.ts +0 -7
- package/server/service/checklist-item-comment/checklist-item-comment-history.ts +0 -69
- package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +0 -80
- package/server/service/checklist-item-comment/checklist-item-comment-query.ts +0 -36
- package/server/service/checklist-item-comment/checklist-item-comment-type.ts +0 -32
- package/server/service/checklist-item-comment/checklist-item-comment.ts +0 -56
- package/server/service/checklist-item-comment/event-subscriber.ts +0 -17
- package/server/service/checklist-item-comment/index.ts +0 -9
- package/server/service/checklist-template/checklist-template-mutation.ts +0 -66
- package/server/service/checklist-template/checklist-template-query.ts +0 -39
- package/server/service/checklist-template/checklist-template-type.ts +0 -23
- package/server/service/checklist-template/checklist-template.ts +0 -71
- package/server/service/checklist-template/index.ts +0 -6
- package/server/service/checklist-template-item/checklist-template-item-mutation.ts +0 -64
- package/server/service/checklist-template-item/checklist-template-item-query.ts +0 -44
- package/server/service/checklist-template-item/checklist-template-item-type.ts +0 -39
- package/server/service/checklist-template-item/checklist-template-item.ts +0 -68
- package/server/service/checklist-template-item/index.ts +0 -6
- package/server/service/checklist-type/checklist-type-mutation.ts +0 -66
- package/server/service/checklist-type/checklist-type-query.ts +0 -39
- package/server/service/checklist-type/checklist-type-type.ts +0 -26
- package/server/service/checklist-type/checklist-type.ts +0 -64
- package/server/service/checklist-type/index.ts +0 -6
- package/server/service/index.ts +0 -88
- package/server/service/issue/index.ts +0 -7
- package/server/service/issue/issue-mutation.ts +0 -198
- package/server/service/issue/issue-query.ts +0 -62
- package/server/service/issue/issue-type.ts +0 -61
- package/server/service/issue/issue.ts +0 -100
- package/server/service/project-report/index.ts +0 -7
- package/server/service/project-report/project-report-mutation.ts +0 -198
- package/server/service/project-report/project-report-query.ts +0 -62
- package/server/service/project-report/project-report-type.ts +0 -61
- package/server/service/project-report/project-report.ts +0 -113
- package/server/service/supervisor/index.ts +0 -7
- package/server/service/supervisor/supervisor-mutation.ts +0 -198
- package/server/service/supervisor/supervisor-query.ts +0 -62
- package/server/service/supervisor/supervisor-type.ts +0 -61
- package/server/service/supervisor/supervisor.ts +0 -108
- package/server/tsconfig.json +0 -10
|
@@ -1,328 +0,0 @@
|
|
|
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 { BuildingInspectionStatus } from '../building-inspection/building-inspection-list'
|
|
12
|
-
|
|
13
|
-
@customElement('comment-list-popup')
|
|
14
|
-
class CommentListPopup extends connect(store)(LitElement) {
|
|
15
|
-
static styles = [
|
|
16
|
-
ButtonContainerStyles,
|
|
17
|
-
ScrollbarStyles,
|
|
18
|
-
css`
|
|
19
|
-
:host {
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
padding: 15px 20px;
|
|
23
|
-
background-color: var(--md-sys-color-surface);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
div[body] {
|
|
27
|
-
height: 100%;
|
|
28
|
-
display: flex;
|
|
29
|
-
flex-direction: column;
|
|
30
|
-
gap: 12px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
div[comments-container] {
|
|
34
|
-
overflow-y: auto;
|
|
35
|
-
gap: 10px;
|
|
36
|
-
display: flex;
|
|
37
|
-
flex-direction: column;
|
|
38
|
-
flex: 1;
|
|
39
|
-
|
|
40
|
-
div[comment-row] {
|
|
41
|
-
display: flex;
|
|
42
|
-
flex-direction: column;
|
|
43
|
-
padding-right: 10px;
|
|
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
|
-
}
|
|
65
|
-
|
|
66
|
-
div[comment] {
|
|
67
|
-
margin-left: 20px;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
h3 {
|
|
73
|
-
position: relative;
|
|
74
|
-
color: rgb(5, 149, 229);
|
|
75
|
-
font-size: 17px;
|
|
76
|
-
font-weight: 700;
|
|
77
|
-
background-color: var(--md-sys-color-surface);
|
|
78
|
-
margin-top: 0px;
|
|
79
|
-
margin-bottom: 5px;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
textarea {
|
|
83
|
-
height: 75px;
|
|
84
|
-
border: 1px solid #ccc;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
div[button-container] {
|
|
88
|
-
display: flex;
|
|
89
|
-
justify-content: flex-end;
|
|
90
|
-
gap: 10px;
|
|
91
|
-
|
|
92
|
-
md-elevated-button[blue] {
|
|
93
|
-
--md-elevated-button-container-color: #0595e5;
|
|
94
|
-
|
|
95
|
-
--md-elevated-button-label-text-color: #fff;
|
|
96
|
-
--md-elevated-button-hover-label-text-color: #fff;
|
|
97
|
-
--md-elevated-button-pressed-label-text-color: #fff;
|
|
98
|
-
--md-elevated-button-focus-label-text-color: #fff;
|
|
99
|
-
--md-elevated-button-icon-color: #fff;
|
|
100
|
-
--md-elevated-button-hover-icon-color: #fff;
|
|
101
|
-
--md-elevated-button-pressed-icon-color: #fff;
|
|
102
|
-
--md-elevated-button-focus-icon-color: #fff;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
`
|
|
106
|
-
]
|
|
107
|
-
|
|
108
|
-
@property({ type: String }) checklistItemId: string = ''
|
|
109
|
-
@property({ type: String }) status: BuildingInspectionStatus = BuildingInspectionStatus.WAIT
|
|
110
|
-
|
|
111
|
-
@state() item: any = { count: 0 }
|
|
112
|
-
@state() checklistItemComments: any = []
|
|
113
|
-
@state() comment: string = ''
|
|
114
|
-
@state() checklistItemCommentCount: number = 0
|
|
115
|
-
@state() user: User = {}
|
|
116
|
-
@state() page: number = 1
|
|
117
|
-
@state() loading: boolean = false
|
|
118
|
-
@state() hasMoreComments: boolean = true
|
|
119
|
-
|
|
120
|
-
@query('div[comments-container]') commentsContainer!: HTMLDivElement
|
|
121
|
-
|
|
122
|
-
render() {
|
|
123
|
-
return html`
|
|
124
|
-
<div body>
|
|
125
|
-
<h3>제품검사에 대한 확인: ${this.checklistItemCommentCount || 0}건</h3>
|
|
126
|
-
|
|
127
|
-
<div comments-container @scroll=${this._onScroll}>
|
|
128
|
-
${this.checklistItemComments.map(comment => {
|
|
129
|
-
return html`
|
|
130
|
-
<div comment-row>
|
|
131
|
-
<div creator-container>
|
|
132
|
-
<span creator><md-icon slot="icon">account_circle</md-icon> ${comment.creator.name}</span>
|
|
133
|
-
<span createdAt>
|
|
134
|
-
<md-icon slot="icon">schedule</md-icon> ${this._formatDate(comment.createdAt)}
|
|
135
|
-
${comment.creator.email === this.user.email && this.status != BuildingInspectionStatus.PASS
|
|
136
|
-
? html` <md-icon delete slot="icon" @click=${() => this._deleteComment(comment.id)}>delete</md-icon>`
|
|
137
|
-
: ''}
|
|
138
|
-
</span>
|
|
139
|
-
</div>
|
|
140
|
-
<div comment>${comment.comment}</div>
|
|
141
|
-
</div>
|
|
142
|
-
`
|
|
143
|
-
})}
|
|
144
|
-
</div>
|
|
145
|
-
|
|
146
|
-
<textarea
|
|
147
|
-
.value=${this.comment || ''}
|
|
148
|
-
?disabled=${this.status == BuildingInspectionStatus.PASS}
|
|
149
|
-
@input=${this._onInputChange}
|
|
150
|
-
></textarea>
|
|
151
|
-
|
|
152
|
-
<div button-container>
|
|
153
|
-
<md-elevated-button blue ?disabled=${this.status == BuildingInspectionStatus.PASS} @click=${this._createComment}>
|
|
154
|
-
<md-icon slot="icon">task</md-icon>저장
|
|
155
|
-
</md-elevated-button>
|
|
156
|
-
<md-elevated-button @click=${this._close}> <md-icon slot="icon">cancel</md-icon>취소 </md-elevated-button>
|
|
157
|
-
</div>
|
|
158
|
-
</div>
|
|
159
|
-
`
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async firstUpdated() {
|
|
163
|
-
this.user = (store.getState() as any).auth?.user
|
|
164
|
-
this.comment = ''
|
|
165
|
-
this.page = 1
|
|
166
|
-
await this._loadComments()
|
|
167
|
-
this._scrollBottom()
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
private async _loadComments() {
|
|
171
|
-
if (this.loading || !this.hasMoreComments) return
|
|
172
|
-
|
|
173
|
-
this.loading = true
|
|
174
|
-
|
|
175
|
-
const response = await client.query({
|
|
176
|
-
query: gql`
|
|
177
|
-
query ChecklistItemComments($pagination: Pagination!, $checklistItemId: String!) {
|
|
178
|
-
checklistItemComments(pagination: $pagination, checklistItemId: $checklistItemId) {
|
|
179
|
-
id
|
|
180
|
-
comment
|
|
181
|
-
creator {
|
|
182
|
-
id
|
|
183
|
-
email
|
|
184
|
-
name
|
|
185
|
-
}
|
|
186
|
-
createdAt
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
checklistItem(id: $checklistItemId) {
|
|
190
|
-
id
|
|
191
|
-
checklistItemCommentCount
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
`,
|
|
195
|
-
variables: {
|
|
196
|
-
checklistItemId: this.checklistItemId,
|
|
197
|
-
pagination: {
|
|
198
|
-
page: this.page,
|
|
199
|
-
limit: 10
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
if (response.errors) return
|
|
205
|
-
|
|
206
|
-
const items = response.data.checklistItemComments
|
|
207
|
-
if (items.length < 10) this.hasMoreComments = false
|
|
208
|
-
|
|
209
|
-
this.checklistItemComments = [...items.reverse(), ...this.checklistItemComments]
|
|
210
|
-
this.page += 1
|
|
211
|
-
this.checklistItemCommentCount = response.data.checklistItem.checklistItemCommentCount
|
|
212
|
-
this.loading = false
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
// 스크롤이 맨 위에 가까울 때 데이터 요청
|
|
216
|
-
private _onScroll() {
|
|
217
|
-
const { scrollTop } = this.commentsContainer
|
|
218
|
-
if (scrollTop <= 5) {
|
|
219
|
-
this._loadComments()
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
private async _createComment() {
|
|
224
|
-
if (!this.comment) {
|
|
225
|
-
notify({ message: '조치사항을 입력해주세요.', level: 'warn' })
|
|
226
|
-
return
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const response = await client.mutate({
|
|
230
|
-
mutation: gql`
|
|
231
|
-
mutation CreateChecklistItemComment($checklistItemComment: NewChecklistItemComment!) {
|
|
232
|
-
createChecklistItemComment(checklistItemComment: $checklistItemComment) {
|
|
233
|
-
id
|
|
234
|
-
comment
|
|
235
|
-
creator {
|
|
236
|
-
id
|
|
237
|
-
email
|
|
238
|
-
}
|
|
239
|
-
createdAt
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
`,
|
|
243
|
-
variables: {
|
|
244
|
-
checklistItemComment: {
|
|
245
|
-
comment: this.comment,
|
|
246
|
-
checklistItemId: this.checklistItemId
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
})
|
|
250
|
-
|
|
251
|
-
if (!response.errors) {
|
|
252
|
-
this.comment = ''
|
|
253
|
-
this.checklistItemComments = [...this.checklistItemComments, { ...response.data.createChecklistItemComment }]
|
|
254
|
-
this._scrollBottom()
|
|
255
|
-
this.checklistItemCommentCount++
|
|
256
|
-
} else {
|
|
257
|
-
notify({ message: response.errors?.[0]?.message || '조치사항 등록에 실패하였습니다.', level: 'error' })
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
this._dispatchEvent()
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
private async _deleteComment(commentId: string) {
|
|
264
|
-
if (
|
|
265
|
-
await OxPrompt.open({
|
|
266
|
-
title: '조치 사항을 삭제',
|
|
267
|
-
text: '조치 사항을 삭제 하시겠습니까?',
|
|
268
|
-
confirmButton: { text: '삭제' },
|
|
269
|
-
cancelButton: { text: '취소' }
|
|
270
|
-
})
|
|
271
|
-
) {
|
|
272
|
-
const response = await client.mutate({
|
|
273
|
-
mutation: gql`
|
|
274
|
-
mutation DeleteChecklistItemComment($id: String!) {
|
|
275
|
-
deleteChecklistItemComment(id: $id)
|
|
276
|
-
}
|
|
277
|
-
`,
|
|
278
|
-
variables: {
|
|
279
|
-
id: commentId
|
|
280
|
-
}
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
if (!response.errors) {
|
|
284
|
-
this.checklistItemComments = [...this.checklistItemComments.filter(comment => comment.id != commentId)]
|
|
285
|
-
notify({ message: '조치사항을 삭제하였습니다.', level: 'info' })
|
|
286
|
-
} else {
|
|
287
|
-
notify({ message: response.errors?.[0]?.message || '조치사항 삭제에 실패하였습니다.', level: 'error' })
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
this._dispatchEvent()
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
private _close() {
|
|
295
|
-
history.back()
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// Input 요소의 값이 변경될 때 호출되는 콜백 함수
|
|
299
|
-
private _onInputChange(event: InputEvent) {
|
|
300
|
-
const target = event.target as HTMLInputElement
|
|
301
|
-
this.comment = target.value
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
private _formatDate(date) {
|
|
305
|
-
const _date = new Date(date.toLocaleString('en-US', { timeZone: 'Asia/Seoul' }))
|
|
306
|
-
|
|
307
|
-
const year = _date.getFullYear()
|
|
308
|
-
const month = String(_date.getMonth() + 1).padStart(2, '0')
|
|
309
|
-
const day = String(_date.getDate()).padStart(2, '0')
|
|
310
|
-
const hours = String(_date.getHours()).padStart(2, '0')
|
|
311
|
-
const minutes = String(_date.getMinutes()).padStart(2, '0')
|
|
312
|
-
const seconds = String(_date.getSeconds()).padStart(2, '0')
|
|
313
|
-
|
|
314
|
-
return `${year}.${month}.${day} ${hours}:${minutes}:${seconds}`
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
// 댓글 스크롤 맨 밑으로
|
|
318
|
-
private async _scrollBottom() {
|
|
319
|
-
setTimeout(() => {
|
|
320
|
-
this.commentsContainer.scrollTop = this.commentsContainer.scrollHeight
|
|
321
|
-
}, 100)
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// 조치사항 변경 이벤트 디스패치
|
|
325
|
-
_dispatchEvent() {
|
|
326
|
-
this.dispatchEvent(new CustomEvent('change-comment', { detail: { checklistItemId: this.checklistItemId } }))
|
|
327
|
-
}
|
|
328
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
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,240 +0,0 @@
|
|
|
1
|
-
import '@material/web/icon/icon.js'
|
|
2
|
-
import '@operato/data-grist/ox-grist.js'
|
|
3
|
-
|
|
4
|
-
import gql from 'graphql-tag'
|
|
5
|
-
import { css, html, LitElement } from 'lit'
|
|
6
|
-
import { customElement, property, query } from 'lit/decorators.js'
|
|
7
|
-
|
|
8
|
-
import { DataGrist } from '@operato/data-grist/ox-grist.js'
|
|
9
|
-
import { client } from '@operato/graphql'
|
|
10
|
-
import { ButtonContainerStyles } from '@operato/styles'
|
|
11
|
-
import { FetchOption } from '@operato/data-grist'
|
|
12
|
-
import { notify } from '@operato/layout'
|
|
13
|
-
import { CHECKLIST_MAIN_TYPE_LIST } from './checklist-type-management'
|
|
14
|
-
|
|
15
|
-
@customElement('checklist-template-item')
|
|
16
|
-
class ChecklistTemplateItem extends LitElement {
|
|
17
|
-
static styles = [
|
|
18
|
-
ButtonContainerStyles,
|
|
19
|
-
css`
|
|
20
|
-
:host {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
|
|
24
|
-
background-color: var(--md-sys-color-surface);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
ox-grist {
|
|
28
|
-
flex: 1;
|
|
29
|
-
}
|
|
30
|
-
`
|
|
31
|
-
]
|
|
32
|
-
|
|
33
|
-
@property({ type: Object }) checklistDetailTypes: any
|
|
34
|
-
@property({ type: Object }) checklistTemplate: any
|
|
35
|
-
@property({ type: Object }) gristConfig: any
|
|
36
|
-
|
|
37
|
-
@query('ox-grist') grist!: DataGrist
|
|
38
|
-
|
|
39
|
-
render() {
|
|
40
|
-
return html`
|
|
41
|
-
<ox-grist .mode=${'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}></ox-grist>
|
|
42
|
-
<div class="button-container">
|
|
43
|
-
<button danger @click=${this._deleteChecklistTemplateItems.bind(this)}><md-icon>delete</md-icon>삭제</button>
|
|
44
|
-
<button @click=${this._updateChecklistTemplateItems.bind(this)}><md-icon>save</md-icon>저장</button>
|
|
45
|
-
</div>
|
|
46
|
-
`
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async firstUpdated() {
|
|
50
|
-
this.gristConfig = {
|
|
51
|
-
columns: [
|
|
52
|
-
{ type: 'gutter', gutterName: 'row-selector', multiple: true },
|
|
53
|
-
{
|
|
54
|
-
type: 'gutter',
|
|
55
|
-
gutterName: 'button',
|
|
56
|
-
fixed: true,
|
|
57
|
-
icon: 'add',
|
|
58
|
-
handlers: {
|
|
59
|
-
click: 'record-copy'
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
{ type: 'gutter', gutterName: 'sequence' },
|
|
63
|
-
{
|
|
64
|
-
type: 'gutter',
|
|
65
|
-
gutterName: 'button',
|
|
66
|
-
icon: 'arrow_upward',
|
|
67
|
-
handlers: {
|
|
68
|
-
click: 'move-up'
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
type: 'gutter',
|
|
73
|
-
gutterName: 'button',
|
|
74
|
-
icon: 'arrow_downward',
|
|
75
|
-
handlers: {
|
|
76
|
-
click: 'move-down'
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: 'number',
|
|
81
|
-
name: 'sequence',
|
|
82
|
-
hidden: true
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: 'string',
|
|
86
|
-
name: 'id',
|
|
87
|
-
hidden: true
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
type: 'select',
|
|
91
|
-
name: 'mainType',
|
|
92
|
-
header: '구분',
|
|
93
|
-
record: {
|
|
94
|
-
editable: true,
|
|
95
|
-
options: [{ display: '', value: '' }].concat(
|
|
96
|
-
Object.keys(CHECKLIST_MAIN_TYPE_LIST).map(key => ({ display: CHECKLIST_MAIN_TYPE_LIST[key], value: key }))
|
|
97
|
-
)
|
|
98
|
-
},
|
|
99
|
-
width: 150
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
type: 'select',
|
|
103
|
-
name: 'detailType',
|
|
104
|
-
header: '상세 구분',
|
|
105
|
-
record: {
|
|
106
|
-
editable: true,
|
|
107
|
-
options: (columns, data, column) => [
|
|
108
|
-
{ display: '', value: '' },
|
|
109
|
-
...this.checklistDetailTypes.filter(v => v.mainType == column.mainType)
|
|
110
|
-
]
|
|
111
|
-
},
|
|
112
|
-
width: 250
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
type: 'string',
|
|
116
|
-
name: 'name',
|
|
117
|
-
header: '검사 항목',
|
|
118
|
-
record: {
|
|
119
|
-
editable: true
|
|
120
|
-
},
|
|
121
|
-
width: 200
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
type: 'string',
|
|
125
|
-
name: 'inspctionCriteria',
|
|
126
|
-
header: '검사 기준',
|
|
127
|
-
record: {
|
|
128
|
-
editable: true
|
|
129
|
-
},
|
|
130
|
-
width: 200
|
|
131
|
-
}
|
|
132
|
-
],
|
|
133
|
-
rows: {
|
|
134
|
-
selectable: {
|
|
135
|
-
multiple: true
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
pagination: {
|
|
139
|
-
infinite: true
|
|
140
|
-
},
|
|
141
|
-
sorters: [{ name: 'mainType' }, { name: 'sequence' }]
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
async fetchHandler({ page, limit, sorters = [] }: FetchOption) {
|
|
146
|
-
const response = await client.query({
|
|
147
|
-
query: gql`
|
|
148
|
-
query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
149
|
-
checklistTemplateItems(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
150
|
-
items {
|
|
151
|
-
id
|
|
152
|
-
sequence
|
|
153
|
-
name
|
|
154
|
-
inspctionCriteria
|
|
155
|
-
mainType
|
|
156
|
-
detailType
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
`,
|
|
161
|
-
variables: {
|
|
162
|
-
filters: {
|
|
163
|
-
name: 'checklistTemplateId',
|
|
164
|
-
value: this.checklistTemplate.id,
|
|
165
|
-
operator: 'eq'
|
|
166
|
-
},
|
|
167
|
-
sortings: [{ name: 'mainType' }, { name: 'sequence' }]
|
|
168
|
-
}
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
return {
|
|
172
|
-
total: response.data.checklistTemplateItems.total || 0,
|
|
173
|
-
records: response.data.checklistTemplateItems.items || []
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
private async _deleteChecklistTemplateItems() {
|
|
178
|
-
if (confirm('삭제하시겠습니까?')) {
|
|
179
|
-
const ids = this.grist.selected.map(record => record.id)
|
|
180
|
-
if (ids && ids.length > 0) {
|
|
181
|
-
const response = await client.mutate({
|
|
182
|
-
mutation: gql`
|
|
183
|
-
mutation ($ids: [String!]!) {
|
|
184
|
-
deleteChecklistTemplateItems(ids: $ids)
|
|
185
|
-
}
|
|
186
|
-
`,
|
|
187
|
-
variables: {
|
|
188
|
-
ids
|
|
189
|
-
}
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
if (!response.errors) {
|
|
193
|
-
this.grist.fetch()
|
|
194
|
-
notify({ message: '삭제되었습니다.' })
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
async _updateChecklistTemplateItems() {
|
|
201
|
-
let patches = this.grist.dirtyData.records
|
|
202
|
-
if (patches) {
|
|
203
|
-
patches = patches.map(patch => {
|
|
204
|
-
const { __origin__: { __typename, ...patchField } = {}, __dirtyfields__ } = patch
|
|
205
|
-
|
|
206
|
-
for (let key in __dirtyfields__) {
|
|
207
|
-
patchField[key] = __dirtyfields__[key].after
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
return patchField
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
const response = await client.mutate({
|
|
214
|
-
mutation: gql`
|
|
215
|
-
mutation UpdateMultipleChecklistTemplateItems($checklistTemplateId: String!, $patches: [ChecklistTemplateItemPatch!]!) {
|
|
216
|
-
updateMultipleChecklistTemplateItems(checklistTemplateId: $checklistTemplateId, patches: $patches) {
|
|
217
|
-
id
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
`,
|
|
221
|
-
variables: {
|
|
222
|
-
checklistTemplateId: this.checklistTemplate.id,
|
|
223
|
-
patches
|
|
224
|
-
}
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
if (!response.errors) {
|
|
228
|
-
this.grist.fetch()
|
|
229
|
-
notify({ message: '저장되었습니다.' })
|
|
230
|
-
this.requestRefresh()
|
|
231
|
-
} else {
|
|
232
|
-
notify({ message: '저장에 실패하였습니다.', level: 'error' })
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
requestRefresh() {
|
|
238
|
-
this.dispatchEvent(new CustomEvent('requestRefresh'))
|
|
239
|
-
}
|
|
240
|
-
}
|