@dssp/supervision 0.0.36 → 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.
Files changed (106) hide show
  1. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js +1 -1
  2. package/dist-client/pages/building-inspection/building-inspection-detail-checklist.js.map +1 -1
  3. package/dist-client/pages/checklist/checklist-view.js +2 -5
  4. package/dist-client/pages/checklist/checklist-view.js.map +1 -1
  5. package/dist-client/route.d.ts +1 -1
  6. package/dist-client/tsconfig.tsbuildinfo +1 -1
  7. package/dist-server/service/index.d.ts +1 -1
  8. package/dist-server/tsconfig.tsbuildinfo +1 -1
  9. package/package.json +13 -13
  10. package/client/bootstrap.ts +0 -1
  11. package/client/index.ts +0 -0
  12. package/client/pages/action-plan/action-plan-importer.ts +0 -94
  13. package/client/pages/action-plan/action-plan-list-page.ts +0 -340
  14. package/client/pages/building-inspection/building-inspection-detail-camera.ts +0 -277
  15. package/client/pages/building-inspection/building-inspection-detail-checklist.ts +0 -258
  16. package/client/pages/building-inspection/building-inspection-detail-drawing.ts +0 -288
  17. package/client/pages/building-inspection/building-inspection-list.ts +0 -565
  18. package/client/pages/building-inspection/component/building-inspection-detail-header.ts +0 -123
  19. package/client/pages/building-inspection/component/inspection-event-provider.ts +0 -81
  20. package/client/pages/building-inspection/inspection-create-popup.ts +0 -785
  21. package/client/pages/checklist/attachment-list-popup.ts +0 -301
  22. package/client/pages/checklist/checklist-view.ts +0 -581
  23. package/client/pages/checklist/comment-list-popup.ts +0 -328
  24. package/client/pages/checklist/file-preview-popup.ts +0 -70
  25. package/client/pages/checklist-template/checklist-template-item.ts +0 -240
  26. package/client/pages/checklist-template/checklist-template-list.ts +0 -368
  27. package/client/pages/checklist-template/checklist-type-management.ts +0 -262
  28. package/client/pages/issue/issue-importer.ts +0 -94
  29. package/client/pages/issue/issue-list-page.ts +0 -340
  30. package/client/pages/project-report/project-report-importer.ts +0 -94
  31. package/client/pages/project-report/project-report-list-page.ts +0 -340
  32. package/client/pages/supervisor/supervisor-importer.ts +0 -94
  33. package/client/pages/supervisor/supervisor-list-page.ts +0 -340
  34. package/client/route.ts +0 -27
  35. package/client/tsconfig.json +0 -11
  36. package/dist-client/pages/checklist/comment-list-popup copy.d.ts +0 -2
  37. package/dist-client/pages/checklist/comment-list-popup copy.js +0 -344
  38. package/dist-client/pages/checklist/comment-list-popup copy.js.map +0 -1
  39. package/server/controllers/index.ts +0 -0
  40. package/server/index.ts +0 -4
  41. package/server/middlewares/index.ts +0 -3
  42. package/server/migrations/index.ts +0 -9
  43. package/server/routes.ts +0 -28
  44. package/server/service/action-plan/action-plan-mutation.ts +0 -198
  45. package/server/service/action-plan/action-plan-query.ts +0 -62
  46. package/server/service/action-plan/action-plan-type.ts +0 -61
  47. package/server/service/action-plan/action-plan.ts +0 -103
  48. package/server/service/action-plan/index.ts +0 -7
  49. package/server/service/building-inspection/building-inspection-history.ts +0 -72
  50. package/server/service/building-inspection/building-inspection-mutation.ts +0 -276
  51. package/server/service/building-inspection/building-inspection-query.ts +0 -242
  52. package/server/service/building-inspection/building-inspection-type.ts +0 -145
  53. package/server/service/building-inspection/building-inspection.ts +0 -108
  54. package/server/service/building-inspection/event-subscriber.ts +0 -20
  55. package/server/service/building-inspection/index.ts +0 -11
  56. package/server/service/checklist/checklist-history.ts +0 -96
  57. package/server/service/checklist/checklist-mutation.ts +0 -103
  58. package/server/service/checklist/checklist-query.ts +0 -58
  59. package/server/service/checklist/checklist-type.ts +0 -49
  60. package/server/service/checklist/checklist.ts +0 -127
  61. package/server/service/checklist/event-subscriber.ts +0 -17
  62. package/server/service/checklist/index.ts +0 -9
  63. package/server/service/checklist-item/checklist-item-mutation.ts +0 -5
  64. package/server/service/checklist-item/checklist-item-query.ts +0 -84
  65. package/server/service/checklist-item/checklist-item-type.ts +0 -12
  66. package/server/service/checklist-item/checklist-item.ts +0 -103
  67. package/server/service/checklist-item/index.ts +0 -7
  68. package/server/service/checklist-item-comment/checklist-item-comment-history.ts +0 -69
  69. package/server/service/checklist-item-comment/checklist-item-comment-mutation.ts +0 -80
  70. package/server/service/checklist-item-comment/checklist-item-comment-query.ts +0 -36
  71. package/server/service/checklist-item-comment/checklist-item-comment-type.ts +0 -32
  72. package/server/service/checklist-item-comment/checklist-item-comment.ts +0 -56
  73. package/server/service/checklist-item-comment/event-subscriber.ts +0 -17
  74. package/server/service/checklist-item-comment/index.ts +0 -9
  75. package/server/service/checklist-template/checklist-template-mutation.ts +0 -66
  76. package/server/service/checklist-template/checklist-template-query.ts +0 -39
  77. package/server/service/checklist-template/checklist-template-type.ts +0 -23
  78. package/server/service/checklist-template/checklist-template.ts +0 -71
  79. package/server/service/checklist-template/index.ts +0 -6
  80. package/server/service/checklist-template-item/checklist-template-item-mutation.ts +0 -64
  81. package/server/service/checklist-template-item/checklist-template-item-query.ts +0 -44
  82. package/server/service/checklist-template-item/checklist-template-item-type.ts +0 -39
  83. package/server/service/checklist-template-item/checklist-template-item.ts +0 -68
  84. package/server/service/checklist-template-item/index.ts +0 -6
  85. package/server/service/checklist-type/checklist-type-mutation.ts +0 -66
  86. package/server/service/checklist-type/checklist-type-query.ts +0 -39
  87. package/server/service/checklist-type/checklist-type-type.ts +0 -26
  88. package/server/service/checklist-type/checklist-type.ts +0 -64
  89. package/server/service/checklist-type/index.ts +0 -6
  90. package/server/service/index.ts +0 -88
  91. package/server/service/issue/index.ts +0 -7
  92. package/server/service/issue/issue-mutation.ts +0 -198
  93. package/server/service/issue/issue-query.ts +0 -62
  94. package/server/service/issue/issue-type.ts +0 -61
  95. package/server/service/issue/issue.ts +0 -100
  96. package/server/service/project-report/index.ts +0 -7
  97. package/server/service/project-report/project-report-mutation.ts +0 -198
  98. package/server/service/project-report/project-report-query.ts +0 -62
  99. package/server/service/project-report/project-report-type.ts +0 -61
  100. package/server/service/project-report/project-report.ts +0 -113
  101. package/server/service/supervisor/index.ts +0 -7
  102. package/server/service/supervisor/supervisor-mutation.ts +0 -198
  103. package/server/service/supervisor/supervisor-query.ts +0 -62
  104. package/server/service/supervisor/supervisor-type.ts +0 -61
  105. package/server/service/supervisor/supervisor.ts +0 -108
  106. package/server/tsconfig.json +0 -10
@@ -1,785 +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, state } from 'lit/decorators.js'
7
- import { DataGrist } from '@operato/data-grist/ox-grist.js'
8
- import { client } from '@operato/graphql'
9
- import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
10
- import { notify } from '@operato/layout'
11
- import { BuildingInspectionStatus, CHECKLIST_MAIN_TYPE_LIST } from './building-inspection-list'
12
- import '../checklist/checklist-view'
13
- import { ChecklistMode } from '../checklist/checklist-view'
14
-
15
- @customElement('inspection-create-popup')
16
- class InspectionCreatePopup extends LitElement {
17
- static styles = [
18
- ButtonContainerStyles,
19
- ScrollbarStyles,
20
- css`
21
- :host {
22
- display: flex;
23
- flex-direction: column;
24
- padding: 15px 20px;
25
-
26
- background-color: var(--md-sys-color-surface);
27
- }
28
-
29
- md-filled-select {
30
- width: auto;
31
- min-width: 150px;
32
- --md-filled-select-text-field-container-color: transparent;
33
- --md-filled-select-text-field-active-indicator-color: #999;
34
- --md-filled-select-text-field-input-text-size: 14px;
35
- --md-filled-select-text-field-input-text-weight: bold;
36
- --md-filled-select-text-field-input-text-line-height: 6px;
37
- }
38
- md-filled-select[level] {
39
- min-width: 110px;
40
- margin-left: 20px;
41
- }
42
-
43
- checklist-view {
44
- pointer-events: none;
45
- transform-origin: top left;
46
- }
47
-
48
- div[body] {
49
- height: 100%;
50
- overflow-y: auto;
51
-
52
- div[tab-container][inactive] {
53
- display: none !important;
54
- }
55
-
56
- div[edit] {
57
- width: 100%;
58
-
59
- div[detail] {
60
- margin-bottom: 30px;
61
- }
62
-
63
- h3 {
64
- position: relative;
65
- color: #0595e5;
66
- font-size: 17px;
67
- font-weight: 700;
68
- background-color: var(--md-sys-color-surface);
69
- margin-top: 0;
70
- margin-bottom: 5px;
71
- }
72
-
73
- div[data-row] {
74
- display: grid;
75
- grid-template-columns: 100px 1fr 0.3fr 100px 1fr;
76
- gap: 15px;
77
- margin-bottom: 11px;
78
-
79
- & > label {
80
- display: flex;
81
- justify-content: flex-end;
82
- align-items: center;
83
- font-size: 15px;
84
- }
85
-
86
- div[inspection-parts] {
87
- display: block;
88
- margin-top: 7px;
89
-
90
- & > span {
91
- display: inline-block;
92
- margin-right: 5px;
93
- margin-bottom: 5px;
94
-
95
- & > md-checkbox {
96
- margin-top: 2px;
97
- }
98
- }
99
- }
100
- }
101
- }
102
-
103
- div[preview] {
104
- display: flex;
105
- overflow-y: auto;
106
- overflow-x: hidden;
107
- }
108
- }
109
-
110
- div[tabs] {
111
- display: flex;
112
-
113
- button {
114
- background-color: #fff;
115
- padding: 6px 14px;
116
- color: #999;
117
- border: solid 1px #999;
118
- border-top: none;
119
- border-radius: 0px 0px 8px 8px;
120
- margin-right: -2px;
121
- cursor: pointer;
122
-
123
- &[active] {
124
- color: var(--button-color, var(--md-sys-color-on-secondary-container));
125
- font-weight: 600;
126
- }
127
- }
128
- }
129
-
130
- div[button-container] {
131
- display: flex;
132
- justify-content: flex-end;
133
- gap: 10px;
134
-
135
- md-elevated-button[blue] {
136
- --md-elevated-button-container-color: #0595e5;
137
-
138
- --md-elevated-button-label-text-color: #fff;
139
- --md-elevated-button-hover-label-text-color: #fff;
140
- --md-elevated-button-pressed-label-text-color: #fff;
141
- --md-elevated-button-focus-label-text-color: #fff;
142
- --md-elevated-button-icon-color: #fff;
143
- --md-elevated-button-hover-icon-color: #fff;
144
- --md-elevated-button-pressed-icon-color: #fff;
145
- --md-elevated-button-focus-icon-color: #fff;
146
- }
147
- }
148
- `
149
- ]
150
-
151
- @property({ type: Object }) gristConfig: any
152
- @property({ type: Object }) checklistDetailTypes: any
153
- @property({ type: String }) projectId: string = ''
154
- @property({ type: String }) checklistTemplateId: string = ''
155
- @property({ type: String }) selectedBuildingId: string = ''
156
- @property({ type: String }) selectedBuildingLevelId: string = ''
157
-
158
- @state() buildings: any = []
159
- @state() selectedBuilding: any = {}
160
- @state() selectedLevel: any = {}
161
-
162
- @state() constructionTypes: any = []
163
- @state() selectedConstructionType: any = {}
164
- @state() selectedConstructionDetailType: any = {}
165
-
166
- @state() inspectionDrawingTypes: any = []
167
- @state() selectedInspectionDrawingType: any = {}
168
- @state() selectedInspectionParts: Array<string> = []
169
-
170
- @state() checklistTemplates: any = []
171
- @state() checklist: any = {}
172
-
173
- @state() activeTab: 'edit' | 'preview' = 'edit'
174
-
175
- @query('md-filled-select[building]') htmlSelectBuilding
176
- @query('md-filled-select[level]') htmlSelectLevel
177
- @query('md-filled-select[constructionType]') htmlSelectConstructionType
178
- @query('md-filled-select[constructionDetailType]') htmlSelectConstructionDetailType
179
- @query('md-filled-select[inspectionDrawingType]') htmlSelectInspectionDrawingType
180
- @query('md-filled-select[inspectionPart]') htmlSelectInspectionPart
181
- @query('md-filled-select[checklistTemplate]') htmlSelectChecklistTemplate
182
- @query('ox-grist') grist!: DataGrist
183
- @query('div[preview]') checklistViewContainer!: HTMLDivElement
184
- @query('checklist-view') checklistView!: HTMLElement
185
-
186
- render() {
187
- return html`
188
- <div body>
189
- <div tab-container ?inactive=${this.activeTab !== 'edit'} edit>
190
- <div detail>
191
- <h3>세부 정보</h3>
192
-
193
- <div data-row>
194
- <label>공종</label>
195
- <md-filled-select constructionType @change=${this._onSelectConstructionType}>
196
- ${this.constructionTypes?.map(constructionType => {
197
- const selected = constructionType.id === this.selectedConstructionType?.id
198
- return html`<md-select-option ?selected=${selected} .value=${constructionType.id}>
199
- <div slot="headline">${constructionType.name}</div>
200
- </md-select-option>`
201
- })}
202
- </md-filled-select>
203
-
204
- <div partition></div>
205
-
206
- <label>세부 공종</label>
207
- <md-filled-select constructionDetailType @change=${this._onSelectConstructionDetailType}>
208
- ${this.selectedConstructionType?.constructionDetailTypes?.map(constructionDetailType => {
209
- const selected = constructionDetailType.id === this.selectedConstructionDetailType.id
210
- return html`<md-select-option ?selected=${selected} .value=${constructionDetailType.id}>
211
- <div slot="headline">${constructionDetailType.name}</div>
212
- </md-select-option>`
213
- })}
214
- </md-filled-select>
215
- </div>
216
-
217
- <div data-row>
218
- <label>동</label>
219
- <md-filled-select building @change=${this._onSelectBuilding}>
220
- ${this.buildings?.map(building => {
221
- return html` <md-select-option .value=${building.id}>
222
- <div slot="headline">${building.name}</div>
223
- </md-select-option>`
224
- })}
225
- </md-filled-select>
226
-
227
- <div partition></div>
228
-
229
- <label>층</label>
230
- <md-filled-select level @change=${this._onSelectBuildingLevel}>
231
- ${this.selectedBuilding?.buildingLevels?.map(level => {
232
- return html`<md-select-option .value=${level.id}>
233
- <div slot="headline">${level.floor}</div>
234
- </md-select-option>`
235
- })}
236
- </md-filled-select>
237
- </div>
238
-
239
- <div data-row>
240
- <label>검측 도면</label>
241
- <md-filled-select inspectionDrawingType @change=${this._onSelectInspectionDrawingType}>
242
- ${this.inspectionDrawingTypes?.map(inspectionDrawingType => {
243
- return html` <md-select-option .value=${inspectionDrawingType.id}>
244
- <div slot="headline">${inspectionDrawingType.name}</div>
245
- </md-select-option>`
246
- })}
247
- </md-filled-select>
248
-
249
- <div partition></div>
250
-
251
- <label>검측 부위</label>
252
- <div inspection-parts>
253
- ${this.selectedInspectionDrawingType?.inspectionParts?.map(inspectionPart => {
254
- return html`
255
- <span>
256
- <md-checkbox
257
- id=${'check_' + inspectionPart.id}
258
- ?checked="${this.isSelected(inspectionPart)}"
259
- @click=${() => this._onSelectInspectionPart(inspectionPart)}
260
- ></md-checkbox>
261
- <label>${inspectionPart.name}</label>
262
- </span>
263
- `
264
- })}
265
- </div>
266
- </div>
267
- </div>
268
-
269
- <div checklist>
270
- <h3>체크리스트</h3>
271
-
272
- <div data-row>
273
- <label>이름</label>
274
- <md-filled-text-field
275
- name="checklistName"
276
- type="text"
277
- .value=${this.checklist?.name || ''}
278
- @input=${this._onInputChange}
279
- >
280
- </md-filled-text-field>
281
-
282
- <div partition></div>
283
-
284
- <label>템플릿</label>
285
- <md-filled-select checklistTemplate @change=${this._onSelectChecklistTemplate}>
286
- <md-select-option></md-select-option>
287
- ${this.checklistTemplates?.map((checklistTemplate, idx) => {
288
- return html` <md-select-option .value=${checklistTemplate.id}>
289
- <div slot="headline">${checklistTemplate.name}</div>
290
- </md-select-option>`
291
- })}
292
- </md-filled-select>
293
- </div>
294
- </div>
295
-
296
- <ox-grist
297
- .mode=${'GRID'}
298
- .config=${this.gristConfig}
299
- .fetchHandler=${this.fetchHandler.bind(this)}
300
- @field-change=${this.onChangeGird}
301
- >
302
- </ox-grist>
303
- </div>
304
-
305
- <div tab-container ?inactive=${this.activeTab !== 'preview'} preview>
306
- <checklist-view .mode=${ChecklistMode.VIEWER} .checklist=${this.checklist}></checklist-view>
307
- </div>
308
- </div>
309
-
310
- <div tabs>
311
- <button ?active=${this.activeTab === 'edit'} @click=${() => (this.activeTab = 'edit')}>검측 요청 정보</button>
312
- <button ?active=${this.activeTab === 'preview'} @click=${() => (this.activeTab = 'preview')}>미리보기</button>
313
- </div>
314
-
315
- <div button-container>
316
- <md-elevated-button blue @click=${this._createInspection}>
317
- <md-icon slot="icon">task</md-icon>검측 요청서 등록
318
- </md-elevated-button>
319
- <md-elevated-button @click=${this._close}> <md-icon slot="icon">cancel</md-icon>취소</md-elevated-button>
320
- </div>
321
- `
322
- }
323
-
324
- updated() {
325
- const ratio = Math.round((this.checklistViewContainer?.offsetWidth / this.checklistView?.offsetWidth) * 100) / 100 || 1
326
- this.checklistView.style.transform = `scale(${ratio})`
327
- }
328
-
329
- async firstUpdated() {
330
- const response = await client.query({
331
- query: gql`
332
- query Project($id: String!) {
333
- project(id: $id) {
334
- id
335
- name
336
- buildingComplex {
337
- id
338
- buildings {
339
- id
340
- name
341
- }
342
- }
343
- }
344
-
345
- constructionTypes {
346
- items {
347
- name
348
- id
349
- }
350
- }
351
-
352
- inspectionDrawingTypes {
353
- items {
354
- name
355
- id
356
- }
357
- }
358
-
359
- checklistTemplates {
360
- items {
361
- id
362
- name
363
- }
364
- }
365
-
366
- checklistTypes {
367
- items {
368
- id
369
- mainType
370
- detailType
371
- }
372
- }
373
- }
374
- `,
375
- variables: {
376
- id: this.projectId
377
- }
378
- })
379
-
380
- if (response.errors) return
381
-
382
- const project = response.data?.project
383
- const constructionTypes = response.data?.constructionTypes?.items || []
384
- const inspectionDrawingTypes = response.data?.inspectionDrawingTypes?.items || []
385
- const checklistTemplates = response.data?.checklistTemplates?.items || []
386
- this.checklistDetailTypes = response.data.checklistTypes?.items?.map(v => {
387
- return {
388
- display: v.detailType,
389
- value: v.id,
390
- mainType: v.mainType
391
- }
392
- })
393
-
394
- this.buildings = [...(project?.buildingComplex?.buildings || [])]
395
- this.constructionTypes = [...constructionTypes]
396
- this.inspectionDrawingTypes = [...inspectionDrawingTypes]
397
- this.checklistTemplates = [...checklistTemplates]
398
-
399
- // selectedBuildingId가 있으면 해당 빌딩 선택, 없으면 첫번째 빌딩 선택
400
- this.selectedBuilding = this.selectedBuildingId
401
- ? this.buildings.find(building => building.id == this.selectedBuildingId)
402
- : this.buildings[0]
403
-
404
- this.selectedConstructionType = constructionTypes?.[0]
405
- this.selectedInspectionDrawingType = inspectionDrawingTypes?.[0]
406
-
407
- // 선택된 동의 층 리스트 가져오기
408
- this.selectedBuilding = await this._getBuilding(this.selectedBuilding.id)
409
- this.selectedConstructionType = await this._getConstructionType(this.selectedConstructionType.id)
410
- this.selectedInspectionDrawingType = await this._getInspectionDrawingType(this.selectedInspectionDrawingType.id)
411
-
412
- // selectedBuildingLevelId가 있으면 선택된 층, 없으면 첫번째 층 선택
413
- this.selectedLevel = this.selectedBuildingLevelId
414
- ? this.selectedBuilding?.buildingLevels?.find(level => level.id == this.selectedBuildingLevelId)
415
- : this.selectedBuilding?.buildingLevels?.[0]
416
-
417
- this.selectedConstructionDetailType = this.selectedConstructionType?.constructionDetailTypes?.[0]
418
- this.selectedInspectionParts = []
419
-
420
- // 동, 층이 랜더링 된 후에 select를 위해 이 시점에서 랜더링
421
- this.selectedBuilding = await { ...this.selectedBuilding }
422
- this.selectedConstructionType = await { ...this.selectedConstructionType }
423
-
424
- // 기본 값 셋팅 select
425
- await this.htmlSelectBuilding.select(this.selectedBuilding.id)
426
- await this.htmlSelectLevel.select(this.selectedLevel.id)
427
- await this.htmlSelectConstructionType.select(this.selectedConstructionType.id)
428
- await this.htmlSelectConstructionDetailType.select(this.selectedConstructionDetailType.id)
429
- await this.htmlSelectInspectionDrawingType.select(this.selectedInspectionDrawingType.id)
430
- await this.htmlSelectChecklistTemplate.selectIndex(0)
431
-
432
- this.checklist = {
433
- constructionType: this.selectedConstructionType?.name,
434
- constructionDetailType: this.selectedConstructionDetailType?.name,
435
- location: `${this.selectedBuilding?.name || ''} ${this.selectedLevel.floor || ''}층`,
436
- documentNo: '0000-000-000000',
437
- buildingInspection: {
438
- status: BuildingInspectionStatus.WAIT
439
- }
440
- }
441
-
442
- // 그리드 셋팅
443
- this.setGristConfig()
444
- }
445
-
446
- async _getBuilding(buildingId: string = '') {
447
- const response = await client.query({
448
- query: gql`
449
- query Building($id: String!) {
450
- building(id: $id) {
451
- id
452
- name
453
- buildingLevels {
454
- id
455
- floor
456
- mainDrawing {
457
- id
458
- name
459
- fullpath
460
- }
461
- mainDrawingImage
462
- }
463
- }
464
- }
465
- `,
466
- variables: {
467
- id: buildingId
468
- }
469
- })
470
-
471
- if (response.errors) return
472
-
473
- return response.data?.building || {}
474
- }
475
-
476
- async _getConstructionType(id: string = '') {
477
- const response = await client.query({
478
- query: gql`
479
- query ConstructionType($id: String!) {
480
- constructionType(id: $id) {
481
- id
482
- name
483
- description
484
- constructionDetailTypes {
485
- id
486
- name
487
- }
488
- }
489
- }
490
- `,
491
- variables: { id }
492
- })
493
-
494
- if (response.errors) return
495
-
496
- return response.data?.constructionType || {}
497
- }
498
-
499
- async _getInspectionDrawingType(id: string = '') {
500
- const response = await client.query({
501
- query: gql`
502
- query InspectionDrawingType($id: String!) {
503
- inspectionDrawingType(id: $id) {
504
- id
505
- name
506
- inspectionParts {
507
- id
508
- name
509
- }
510
- }
511
- }
512
- `,
513
- variables: { id }
514
- })
515
-
516
- if (response.errors) return
517
-
518
- return response.data?.inspectionDrawingType || {}
519
- }
520
-
521
- private async _onSelectBuilding(e) {
522
- const buildingId = e.target.value
523
- this.selectedBuilding = await this._getBuilding(buildingId)
524
- this.selectedLevel = await { ...this.selectedBuilding?.buildingLevels?.[0] }
525
- this.checklist = { ...this.checklist, location: `${this.selectedBuilding?.name || ''} ${this.selectedLevel.floor || ''}층` }
526
-
527
- await this.htmlSelectLevel.selectIndex(0)
528
- }
529
-
530
- private _onSelectBuildingLevel(e) {
531
- const buildingLevelId = e.target.value
532
- this.selectedLevel = {
533
- ...(this.selectedBuilding?.buildingLevels?.find(v => v.id == buildingLevelId) || {})
534
- }
535
- this.checklist = { ...this.checklist, location: `${this.selectedBuilding?.name || ''} ${this.selectedLevel.floor || ''}층` }
536
- }
537
-
538
- private async _onSelectConstructionType(e) {
539
- const constructionTypeId = e.target.value
540
- this.selectedConstructionType = await this._getConstructionType(constructionTypeId)
541
- this.selectedConstructionDetailType = await { ...this.selectedConstructionType?.constructionDetailTypes?.[0] }
542
- this.checklist = {
543
- ...this.checklist,
544
- constructionType: this.selectedConstructionType?.name,
545
- constructionDetailType: this.selectedConstructionDetailType?.name
546
- }
547
-
548
- await this.htmlSelectConstructionDetailType.selectIndex(0)
549
- }
550
-
551
- private _onSelectConstructionDetailType(e) {
552
- const constructionDetailTypeId = e.target.value
553
- this.selectedConstructionDetailType = {
554
- ...(this.selectedConstructionType?.constructionDetailTypes?.find(v => v.id == constructionDetailTypeId) || {})
555
- }
556
- this.checklist = {
557
- ...this.checklist,
558
- constructionType: this.selectedConstructionType?.name,
559
- constructionDetailType: this.selectedConstructionDetailType?.name
560
- }
561
- }
562
-
563
- private async _onSelectInspectionDrawingType(e) {
564
- const inspectionDrawingTypeId = e.target.value
565
- this.selectedInspectionDrawingType = await this._getInspectionDrawingType(inspectionDrawingTypeId)
566
- this.selectedInspectionParts = []
567
- this.checklist = {
568
- ...this.checklist,
569
- inspectionParts: this.selectedInspectionParts
570
- }
571
- }
572
-
573
- private async _onSelectInspectionPart(part) {
574
- if (this.selectedInspectionParts.includes(part.name)) {
575
- this.selectedInspectionParts = this.selectedInspectionParts.filter(item => item !== part.name)
576
- } else {
577
- this.selectedInspectionParts.push(part.name)
578
- }
579
-
580
- this.selectedInspectionParts = [...this.selectedInspectionParts]
581
- this.checklist = {
582
- ...this.checklist,
583
- inspectionParts: this.selectedInspectionParts
584
- }
585
- }
586
-
587
- isSelected(option: any): boolean {
588
- return this.selectedInspectionParts.includes(option.name)
589
- }
590
-
591
- requestRefresh() {
592
- this.dispatchEvent(new CustomEvent('requestRefresh'))
593
- }
594
-
595
- private _close() {
596
- history.back()
597
- }
598
-
599
- setGristConfig() {
600
- this.gristConfig = {
601
- columns: [
602
- { type: 'gutter', gutterName: 'row-selector', multiple: true },
603
- {
604
- type: 'gutter',
605
- gutterName: 'button',
606
- icon: 'arrow_upward',
607
- handlers: {
608
- click: 'move-up'
609
- }
610
- },
611
- {
612
- type: 'gutter',
613
- gutterName: 'button',
614
- icon: 'arrow_downward',
615
- handlers: {
616
- click: 'move-down'
617
- }
618
- },
619
- {
620
- type: 'select',
621
- name: 'mainType',
622
- header: '구분',
623
- record: {
624
- editable: true,
625
- options: [{ display: '', value: '' }].concat(
626
- Object.keys(CHECKLIST_MAIN_TYPE_LIST).map(key => ({ display: CHECKLIST_MAIN_TYPE_LIST[key], value: key }))
627
- )
628
- },
629
- width: 100
630
- },
631
- {
632
- type: 'select',
633
- name: 'detailType',
634
- header: '상세 구분',
635
- record: {
636
- editable: true,
637
- options: (columns, data, column) => [
638
- { display: '', value: '' },
639
- ...this.checklistDetailTypes.filter(v => v.mainType == column.mainType)
640
- ]
641
- },
642
- width: 200
643
- },
644
- {
645
- type: 'string',
646
- name: 'name',
647
- header: '검사 항목',
648
- record: {
649
- editable: true
650
- },
651
- width: 200
652
- },
653
- {
654
- type: 'string',
655
- name: 'inspctionCriteria',
656
- header: '검사 기준',
657
- record: {
658
- editable: true
659
- },
660
- width: 200
661
- }
662
- ],
663
- pagination: {
664
- infinite: true
665
- },
666
- sorters: [{ name: 'mainType' }, { name: 'sequence' }]
667
- }
668
- }
669
-
670
- async fetchHandler() {
671
- if (!this.checklistTemplateId) return []
672
-
673
- const response = await client.query({
674
- query: gql`
675
- query ($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
676
- checklistTemplateItems(filters: $filters, pagination: $pagination, sortings: $sortings) {
677
- items {
678
- id
679
- sequence
680
- name
681
- inspctionCriteria
682
- mainType
683
- detailType
684
- }
685
- }
686
- }
687
- `,
688
- variables: {
689
- filters: {
690
- name: 'checklistTemplateId',
691
- value: this.checklistTemplateId,
692
- operator: 'eq'
693
- },
694
- sortings: [{ name: 'mainType' }, { name: 'sequence' }]
695
- }
696
- })
697
-
698
- // 체크리스트 아이템 데이터 갱신
699
- this.onChangeGird()
700
-
701
- return {
702
- records: response.data.checklistTemplateItems.items || []
703
- }
704
- }
705
-
706
- private _onSelectChecklistTemplate(e) {
707
- const checklistTemplateId = e.target.value
708
-
709
- // 체크 리스트 이름 셋팅
710
- this.checklist = { ...this.checklist, name: e.target.displayText }
711
-
712
- // 그리드 아이템 셋팅
713
- if (checklistTemplateId) {
714
- this.checklistTemplateId = checklistTemplateId
715
- this.grist.fetch()
716
- }
717
- }
718
-
719
- async _createInspection() {
720
- let patch: any = {}
721
-
722
- patch.buildingLevelId = this.htmlSelectLevel.value
723
- patch.checklist = {
724
- name: this.checklist.name,
725
- constructionType: this.htmlSelectConstructionType.displayText,
726
- constructionDetailType: this.htmlSelectConstructionDetailType.displayText,
727
- location: `${this.htmlSelectBuilding.displayText} ${this.htmlSelectLevel.displayText}층`,
728
- inspectionDrawingType: this.selectedInspectionDrawingType.name,
729
- inspectionParts: this.checklist.inspectionParts
730
- }
731
- patch.checklistItem = this.checklist.checklistItems?.map(item => {
732
- return {
733
- name: item.name,
734
- mainType: item.mainType,
735
- detailType: item.detailType,
736
- inspctionCriteria: item.inspctionCriteria
737
- }
738
- })
739
-
740
- const response = await client.mutate({
741
- mutation: gql`
742
- mutation CreateBuildingInspection($patch: NewBuildingInspection!) {
743
- createBuildingInspection(patch: $patch) {
744
- id
745
- }
746
- }
747
- `,
748
- variables: {
749
- patch
750
- }
751
- })
752
-
753
- if (!response.errors) {
754
- notify({ message: '검측 요청서를 등록하였습니다.' })
755
- this.requestRefresh()
756
- this._close()
757
- } else {
758
- notify({ message: response.errors?.[0]?.message || '검측 요청서 등록에 실패하였습니다.', level: 'error' })
759
- }
760
- }
761
- // Input 요소의 값이 변경될 때 호출되는 콜백 함수
762
- private _onInputChange(event: InputEvent) {
763
- const target = event.target as HTMLInputElement
764
- this[target.name] = target.value
765
- this.checklist = { ...this.checklist, name: target.value }
766
- }
767
-
768
- // 체크리스트 아이템 데이터 갱신
769
- private onChangeGird() {
770
- const checklistDetailTypes = Object.fromEntries(this.checklistDetailTypes.map(item => [item.value, item.display]))
771
- const grist = this.grist
772
-
773
- // grist field-change가 오는 시점이 데이터 변경 전이라 setTimeout으로 변경
774
- setTimeout(() => {
775
- this.checklist.checklistItems = grist.dirtyData.records.map((row, idx) => {
776
- return {
777
- ...row,
778
- detailType: checklistDetailTypes[row.detailType],
779
- sequence: idx
780
- }
781
- })
782
- this.checklist = { ...this.checklist }
783
- }, 100)
784
- }
785
- }