@dssp/project 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 (100) hide show
  1. package/dist-client/pages/project/project-schedule.js +31 -22
  2. package/dist-client/pages/project/project-schedule.js.map +1 -1
  3. package/dist-client/tsconfig.tsbuildinfo +1 -1
  4. package/dist-server/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +11 -11
  6. package/client/bootstrap.ts +0 -0
  7. package/client/index.ts +0 -0
  8. package/client/pages/lib/select2-component.ts +0 -175
  9. package/client/pages/lib/waether.ts +0 -159
  10. package/client/pages/project/component/project-update-header.ts +0 -88
  11. package/client/pages/project/popup/popup-plan-upload.ts +0 -138
  12. package/client/pages/project/popup/popup-project-create.ts +0 -147
  13. package/client/pages/project/popup/popup-schedule-upload.ts +0 -102
  14. package/client/pages/project/project-completed-list.ts +0 -281
  15. package/client/pages/project/project-detail.ts +0 -738
  16. package/client/pages/project/project-list.ts +0 -418
  17. package/client/pages/project/project-plan-management.ts +0 -476
  18. package/client/pages/project/project-schedule-list.ts +0 -294
  19. package/client/pages/project/project-schedule.ts +0 -393
  20. package/client/pages/project/project-setting-list.ts +0 -393
  21. package/client/pages/project/project-update.ts +0 -876
  22. package/client/pages/resource/construction-detail-type-popup.ts +0 -201
  23. package/client/pages/resource/construction-type-management.ts +0 -212
  24. package/client/pages/resource/inspection-drawing-type-management.ts +0 -245
  25. package/client/pages/resource/inspection-part-popup.ts +0 -201
  26. package/client/pages/resource/resource-importer.ts +0 -97
  27. package/client/pages/resource/resource-list-page.ts +0 -356
  28. package/client/pages/resource/worker-type-management.ts +0 -192
  29. package/client/pages/task/task-importer.ts +0 -94
  30. package/client/pages/task/task-list-page.ts +0 -340
  31. package/client/pages/task-resource/task-resource-importer.ts +0 -97
  32. package/client/pages/task-resource/task-resource-list-page.ts +0 -356
  33. package/client/route.ts +0 -55
  34. package/client/tsconfig.json +0 -11
  35. package/server/controllers/export-tasks.ts +0 -40
  36. package/server/controllers/import-task.ts +0 -134
  37. package/server/controllers/index.ts +0 -0
  38. package/server/controllers/parse-excel.ts +0 -86
  39. package/server/controllers/types.ts +0 -20
  40. package/server/index.ts +0 -4
  41. package/server/middlewares/index.ts +0 -3
  42. package/server/migrations/1723861466413-seed-roles.ts +0 -128
  43. package/server/migrations/1723861466414-seed-codes.ts +0 -157
  44. package/server/migrations/1723861476419-seed-resources.ts +0 -62
  45. package/server/migrations/1723861478420-seed-/bsample-project.ts +0 -87
  46. package/server/migrations/1723861478421-seed-/bsample-tasks.ts +0 -194
  47. package/server/migrations/index.ts +0 -9
  48. package/server/routes.ts +0 -108
  49. package/server/service/construction-detail-type/construction-detail-type-mutation.ts +0 -57
  50. package/server/service/construction-detail-type/construction-detail-type-query.ts +0 -31
  51. package/server/service/construction-detail-type/construction-detail-type-type.ts +0 -26
  52. package/server/service/construction-detail-type/construction-detail-type.ts +0 -52
  53. package/server/service/construction-detail-type/index.ts +0 -6
  54. package/server/service/construction-type/construction-type-mutation.ts +0 -66
  55. package/server/service/construction-type/construction-type-query.ts +0 -56
  56. package/server/service/construction-type/construction-type-type.ts +0 -26
  57. package/server/service/construction-type/construction-type.ts +0 -74
  58. package/server/service/construction-type/index.ts +0 -6
  59. package/server/service/index.ts +0 -56
  60. package/server/service/inspection-drawing-type/index.ts +0 -6
  61. package/server/service/inspection-drawing-type/inspection-drawing-type-mutation.ts +0 -69
  62. package/server/service/inspection-drawing-type/inspection-drawing-type-query.ts +0 -55
  63. package/server/service/inspection-drawing-type/inspection-drawing-type-type.ts +0 -23
  64. package/server/service/inspection-drawing-type/inspection-drawing-type.ts +0 -68
  65. package/server/service/inspection-part/index.ts +0 -6
  66. package/server/service/inspection-part/inspection-part-mutation.ts +0 -52
  67. package/server/service/inspection-part/inspection-part-query.ts +0 -41
  68. package/server/service/inspection-part/inspection-part-type.ts +0 -26
  69. package/server/service/inspection-part/inspection-part.ts +0 -51
  70. package/server/service/manager/index.ts +0 -6
  71. package/server/service/manager/manager-mutation.ts +0 -42
  72. package/server/service/manager/manager-query.ts +0 -28
  73. package/server/service/manager/manager-type.ts +0 -40
  74. package/server/service/manager/manager.ts +0 -29
  75. package/server/service/project/index.ts +0 -6
  76. package/server/service/project/project-mutation.ts +0 -255
  77. package/server/service/project/project-query.ts +0 -105
  78. package/server/service/project/project-type.ts +0 -72
  79. package/server/service/project/project.ts +0 -134
  80. package/server/service/resource/index.ts +0 -7
  81. package/server/service/resource/resource-mutation.ts +0 -137
  82. package/server/service/resource/resource-query.ts +0 -50
  83. package/server/service/resource/resource-type.ts +0 -41
  84. package/server/service/resource/resource.ts +0 -82
  85. package/server/service/task/index.ts +0 -6
  86. package/server/service/task/task-mutation.ts +0 -135
  87. package/server/service/task/task-query.ts +0 -169
  88. package/server/service/task/task-type.ts +0 -75
  89. package/server/service/task/task.ts +0 -130
  90. package/server/service/task-resource/index.ts +0 -7
  91. package/server/service/task-resource/task-resource-mutation.ts +0 -140
  92. package/server/service/task-resource/task-resource-query.ts +0 -36
  93. package/server/service/task-resource/task-resource-type.ts +0 -41
  94. package/server/service/task-resource/task-resource.ts +0 -51
  95. package/server/service/worker-type/index.ts +0 -6
  96. package/server/service/worker-type/worker-type-mutation.ts +0 -66
  97. package/server/service/worker-type/worker-type-query.ts +0 -47
  98. package/server/service/worker-type/worker-type-type.ts +0 -26
  99. package/server/service/worker-type/worker-type.ts +0 -68
  100. package/server/tsconfig.json +0 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dssp/project",
3
- "version": "0.0.36",
3
+ "version": "1.0.0-alpha.1",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -27,16 +27,16 @@
27
27
  "migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
28
28
  },
29
29
  "dependencies": {
30
- "@dssp/building-complex": "^0.0.36",
31
- "@operato/graphql": "^8.0.0-alpha",
32
- "@operato/shell": "^8.0.0-alpha",
33
- "@things-factory/auth-base": "^8.0.0-alpha",
34
- "@things-factory/contact": "^8.0.0-alpha",
35
- "@things-factory/integration-headless": "^8.0.0-alpha",
36
- "@things-factory/integration-ui": "^8.0.0-alpha",
37
- "@things-factory/organization": "^8.0.0-alpha",
38
- "@things-factory/shell": "^8.0.0-alpha",
30
+ "@dssp/building-complex": "^1.0.0-alpha.1",
31
+ "@operato/graphql": "^8.0.0-beta",
32
+ "@operato/shell": "^8.0.0-beta",
33
+ "@things-factory/auth-base": "^8.0.0-beta",
34
+ "@things-factory/contact": "^8.0.0-beta",
35
+ "@things-factory/integration-headless": "^8.0.0-beta",
36
+ "@things-factory/integration-ui": "^8.0.0-beta",
37
+ "@things-factory/organization": "^8.0.0-beta",
38
+ "@things-factory/shell": "^8.0.0-beta",
39
39
  "exceljs": "^4.4.0"
40
40
  },
41
- "gitHead": "07e0389d1068f9bd054d1e054d0ee2e5e88a65f2"
41
+ "gitHead": "8c26a413785d48f6b51df56968b77d711305a84c"
42
42
  }
File without changes
package/client/index.ts DELETED
File without changes
@@ -1,175 +0,0 @@
1
- import { LitElement, html, css } from 'lit'
2
- import { customElement, property, state } from 'lit/decorators.js'
3
-
4
- @customElement('select2-component')
5
- export class Select2Component extends LitElement {
6
- static styles = css`
7
- div[select-container] {
8
- position: relative;
9
- border: 1px solid rgba(51,51,51,.20);
10
- border-radius: 5px;
11
- padding: var(--spacing-small, 4px) var(--spacing-medium, 8px);
12
- font-size: 14px;
13
- color: var(--md-sys-color-primary);
14
- }
15
- div[select-container]:focus {
16
- border: 1px solid #1f7fd9;
17
- }
18
-
19
- div[dropdown] {
20
- border: 1px solid #ccc;
21
- padding: var(--spacing-small, 4px);
22
- cursor: pointer;
23
- }
24
-
25
- div[options] {
26
- position: absolute;
27
- left: 0;
28
- top: 30px;
29
- min-width: 50%;
30
- border: 1px solid #ccc;
31
- background-color: var(--md-sys-color-surface-tint);
32
- color:var(--md-sys-color-on-primary);
33
- max-height: 150px;
34
- overflow-y: auto;
35
- display: block;
36
- z-index: 1;
37
- }
38
-
39
- div[option] {
40
- padding: var(--spacing-small, 4px) var(--spacing-medium, 8px);
41
- cursor: pointer;
42
- border-bottom: 1px solid rgba(0,0,0,.4);
43
- }
44
- div[option]:last-child {
45
- border-bottom: none;
46
- }
47
-
48
- div[option]:hover {
49
- background-color: var(--md-sys-color-tertiary-container);
50
- }
51
-
52
- div[option][selected] {
53
- background-color: var(--md-sys-color-tertiary-container);
54
- font-weight: bold;
55
- color:var(--md-sys-color-on-primary);
56
- }
57
-
58
- div[selected-tags] {
59
- display: flex;
60
- flex-wrap: wrap;
61
- gap: var(--spacing-small, 4px);
62
- margin-top: var(--spacing-small, 4px);
63
- }
64
-
65
- div[tag] {
66
- background-color: #2e79be;
67
- color: white;
68
- padding: var(--spacing-tiny, 2px) var(--spacing-medium, 8px);
69
- border-radius: 20px;
70
- font-size: 12px;
71
- display: inline-flex;
72
- align-items: center;
73
- cursor: pointer;
74
- }
75
-
76
- span[tag-close] {
77
- margin-left: var(--spacing-small, 4px);
78
- }
79
- `
80
-
81
- @property({ type: String }) placeholder: string = ''
82
- @property({ type: Array }) options: Array<{ name: string; value: string }> = []
83
- @property({ type: Array }) selectedValues: string[] = []
84
-
85
- @state() showOptions: boolean = false
86
-
87
- get selectedItems() {
88
- return this.selectedValues.map(id => this.options.find(option => option.value === id)).filter(Boolean)
89
- }
90
-
91
- connectedCallback() {
92
- super.connectedCallback()
93
- document.addEventListener('click', this._handleOutsideClick)
94
- }
95
-
96
- disconnectedCallback() {
97
- super.disconnectedCallback()
98
- document.removeEventListener('click', this._handleOutsideClick)
99
- }
100
-
101
- private _handleOutsideClick = (event: MouseEvent) => {
102
- const path = event.composedPath()
103
- if (!path.includes(this)) {
104
- this.showOptions = false
105
- }
106
- }
107
-
108
- private _toggleOptions() {
109
- this.showOptions = !this.showOptions
110
- }
111
-
112
- private _handleSelect(optionValue: string) {
113
- if (this.selectedValues.includes(optionValue)) {
114
- // 이미 선택된 옵션을 선택한 경우 해제
115
- this.selectedValues = this.selectedValues.filter(value => value !== optionValue)
116
- } else {
117
- // 선택되지 않은 옵션 추가
118
- this.selectedValues = [...this.selectedValues, optionValue]
119
- }
120
-
121
- this.showOptions = false
122
- this._dispatchEvent(this.selectedValues)
123
- }
124
-
125
- private _handleRemove(tagValue: string) {
126
- this.selectedValues = this.selectedValues.filter(value => value !== tagValue)
127
- this._dispatchEvent(this.selectedValues)
128
- }
129
-
130
- private _dispatchEvent(selectedValues: string[]) {
131
- this.dispatchEvent(
132
- new CustomEvent('selection-changed', {
133
- detail: { selectedValues }, // ID 배열을 부모로 전달
134
- bubbles: true,
135
- composed: true
136
- })
137
- )
138
- }
139
-
140
- render() {
141
- return html`
142
- <div select-container>
143
- <div tags @click="${this._toggleOptions}">${this.placeholder}</div>
144
- ${this.showOptions
145
- ? html`
146
- <div options>
147
- ${this.options.map(
148
- option => html`
149
- <div
150
- option
151
- ?selected=${this.selectedValues.includes(option.value)}
152
- @click=${() => this._handleSelect(option.value)}
153
- >
154
- ${option.name}
155
- </div>
156
- `
157
- )}
158
- </div>
159
- `
160
- : ''}
161
- </div>
162
-
163
- <div selected-tags>
164
- ${this.selectedItems.map(
165
- (tag: any) => html`
166
- <div tag @click=${() => this._handleRemove(tag.value)}>
167
- ${tag!.name}
168
- <span tag-close>&times;</span>
169
- </div>
170
- `
171
- )}
172
- </div>
173
- `
174
- }
175
- }
@@ -1,159 +0,0 @@
1
- const API_KEY = '9epdR01s19phfu%2B3%2F0elTxTi92Nibl3qEO1HSm2QydrWOlrDqyNn9qzeQRJ3jPOh3hV8TesHg1L%2BQ9D6UOPmWQ%3D%3D'
2
- const URL = 'https://apis.data.go.kr/1360000/VilageFcstInfoService_2.0/getVilageFcst'
3
- const NUM_OF_ROWS = 12
4
- const DATA_TYPE = 'JSON'
5
-
6
- export default async function _getWeather(latitude: number, longitude: number) {
7
- const { nx, ny } = _getIndexByLatAndLong(latitude, longitude)
8
- const { base_date, base_time } = _getTodayAndHour()
9
- const result = await fetch(
10
- `${URL}?serviceKey=${API_KEY}&base_date=${base_date}&base_time=${base_time}&nx=${nx}&ny=${ny}&pageNo=1&numOfRows=${NUM_OF_ROWS}&dataType=${DATA_TYPE}`
11
- )
12
-
13
- let rain = 0
14
- let temperature = 0
15
- let humidity = 0
16
- let wind = ''
17
-
18
- if (result.status == 200) {
19
- let weather = await result.json().then(data => data?.response?.body)
20
- weather = weather?.items?.item
21
-
22
- for (let key in weather) {
23
- const data = weather?.[key] || {}
24
-
25
- if (data.category === 'POP') {
26
- rain = data.fcstValue
27
- }
28
- if (data.category === 'REH') {
29
- humidity = data.fcstValue
30
- }
31
- if (data.category === 'TMP') {
32
- temperature = data.fcstValue
33
- }
34
- if (data.category === 'VEC') {
35
- wind = _getWindDirectionByValue(data.fcstValue)
36
- }
37
- }
38
-
39
- console.log('weather :', weather)
40
- }
41
-
42
- return { rain, temperature, humidity, wind }
43
- }
44
-
45
- const RE = 6371.00877 // 지구 반경(km)
46
- const GRID = 5.0 // 격자 간격(km)
47
- const SLAT1 = 30.0 // 투영 위도1(degree)
48
- const SLAT2 = 60.0 // 투영 위도2(degree)
49
- const OLON = 126.0 // 기준점 경도(degree)
50
- const OLAT = 38.0 // 기준점 위도(degree)
51
- const XO = 43 // 기준점 X좌표(GRID)
52
- const YO = 136 // 기1준점 Y좌표(GRID)
53
-
54
- // 위경도 -> 기상청 좌표
55
- function _getIndexByLatAndLong(latitude: number, longitude: number) {
56
- const DEGRAD = Math.PI / 180.0
57
- const re = RE / GRID
58
- const slat1 = SLAT1 * DEGRAD
59
- const slat2 = SLAT2 * DEGRAD
60
- const olon = OLON * DEGRAD
61
- const olat = OLAT * DEGRAD
62
-
63
- let sn = Math.tan(Math.PI * 0.25 + slat2 * 0.5) / Math.tan(Math.PI * 0.25 + slat1 * 0.5)
64
- sn = Math.log(Math.cos(slat1) / Math.cos(slat2)) / Math.log(sn)
65
- let sf = Math.tan(Math.PI * 0.25 + slat1 * 0.5)
66
- sf = (Math.pow(sf, sn) * Math.cos(slat1)) / sn
67
- let ro = Math.tan(Math.PI * 0.25 + olat * 0.5)
68
- ro = (re * sf) / Math.pow(ro, sn)
69
- let ra = Math.tan(Math.PI * 0.25 + latitude * DEGRAD * 0.5)
70
- ra = (re * sf) / Math.pow(ra, sn)
71
- let theta = longitude * DEGRAD - olon
72
- if (theta > Math.PI) theta -= 2.0 * Math.PI
73
- if (theta < -Math.PI) theta += 2.0 * Math.PI
74
- theta *= sn
75
-
76
- return {
77
- nx: Math.floor(ra * Math.sin(theta) + XO + 0.5),
78
- ny: Math.floor(ro - ra * Math.cos(theta) + YO + 0.5),
79
- latitude,
80
- longitude
81
- }
82
- }
83
-
84
- function _getTodayAndHour() {
85
- const now = new Date()
86
- const todayDate = now.toISOString().slice(0, 10).replace(/-/g, '')
87
- const yesterday = new Date(now)
88
- yesterday.setDate(yesterday.getDate() - 1)
89
- const yesterdayDate = yesterday.toISOString().slice(0, 10).replace(/-/g, '')
90
-
91
- // 1일 총 8번 데이터가 업데이트 된다. (0200, 0500, 0800, 1100, 1400, 1700, 2000, 2300)
92
- let base_date
93
- let base_time
94
-
95
- if (now.getHours() < 2 || (now.getHours() === 2 && now.getMinutes() <= 10)) {
96
- base_date = yesterdayDate
97
- base_time = '2300'
98
- } else if (now.getHours() < 5 || (now.getHours() === 5 && now.getMinutes() <= 10)) {
99
- base_date = todayDate
100
- base_time = '0200'
101
- } else if (now.getHours() < 8 || (now.getHours() === 8 && now.getMinutes() <= 10)) {
102
- base_date = todayDate
103
- base_time = '0500'
104
- } else if (now.getHours() <= 11 || now.getMinutes() <= 10) {
105
- base_date = todayDate
106
- base_time = '0800'
107
- } else if (now.getHours() < 14 || (now.getHours() === 14 && now.getMinutes() <= 10)) {
108
- base_date = todayDate
109
- base_time = '1100'
110
- } else if (now.getHours() < 17 || (now.getHours() === 17 && now.getMinutes() <= 10)) {
111
- base_date = todayDate
112
- base_time = '1400'
113
- } else if (now.getHours() < 20 || (now.getHours() === 20 && now.getMinutes() <= 10)) {
114
- base_date = todayDate
115
- base_time = '1700'
116
- } else if (now.getHours() < 23 || (now.getHours() === 23 && now.getMinutes() <= 10)) {
117
- base_date = todayDate
118
- base_time = '2000'
119
- } else {
120
- base_date = todayDate
121
- base_time = '2300'
122
- }
123
-
124
- return { base_time, base_date }
125
- }
126
-
127
- const windTable = {
128
- 0: 'N',
129
- 1: 'NNE',
130
- 2: 'NE',
131
- 3: 'ENE',
132
- 4: 'E',
133
- 5: 'ESE',
134
- 6: 'SE',
135
- 7: 'SSE',
136
- 8: 'S',
137
- 9: 'SSW',
138
- 10: 'SW',
139
- 11: 'WSW',
140
- 12: 'W',
141
- 13: 'WNW',
142
- 14: 'NW',
143
- 15: 'NNW',
144
- 16: 'N'
145
- }
146
- const directoinMapping = {
147
- N: '북',
148
- S: '남',
149
- E: '동',
150
- W: '서'
151
- }
152
-
153
- function _getWindDirectionByValue(value: number): string {
154
- const calc: number | null = Math.floor((Number(value) + 22.5 * 0.5) / 22.5) || null
155
-
156
- if (calc === null) return ''
157
-
158
- return windTable[calc]?.replace(/[NSEW]/g, match => directoinMapping[match]) || ''
159
- }
@@ -1,88 +0,0 @@
1
- import '@material/web/icon/icon.js'
2
- import { css, html, LitElement } from 'lit'
3
- import { customElement, property } from 'lit/decorators.js'
4
- import { ButtonContainerStyles, ScrollbarStyles } from '@operato/styles'
5
-
6
- @customElement('project-update-header')
7
- class ProjectUpdateHeader extends LitElement {
8
- static styles = [
9
- ButtonContainerStyles,
10
- ScrollbarStyles,
11
- css`
12
- div[header] {
13
- display: flex;
14
- margin: 0px var(--spacing-large, 12px);
15
-
16
- h2 {
17
- flex: 1;
18
- margin-bottom: var(--spacing-medium, 8px);
19
- color: #3f71a0;
20
- font-size:18px;
21
- }
22
- }
23
-
24
- div[button-container] {
25
- display: flex;
26
- align-items: center;
27
- justify-content: end;
28
- flex: 1;
29
- padding-top: var(--spacing-medium, 8px);
30
-
31
- md-elevated-button {
32
- margin: 0 var(--spacing-small, 4px);
33
-
34
- --md-elevated-button-container-height: 32px;
35
- --md-elevated-button-label-text-size: 16px;
36
- --md-elevated-button-container-color: #0595e5;
37
-
38
- --md-elevated-button-label-text-color: var(--md-sys-color-on-primary);
39
- --md-elevated-button-hover-label-text-color: var(--md-sys-color-on-primary);
40
- --md-elevated-button-pressed-label-text-color: var(--md-sys-color-on-primary);
41
- --md-elevated-button-focus-label-text-color: var(--md-sys-color-on-primary);
42
- --md-elevated-button-icon-color: var(--md-sys-color-on-primary);
43
- --md-elevated-button-hover-icon-color: var(--md-sys-color-on-primary);
44
- --md-elevated-button-pressed-icon-color: var(--md-sys-color-on-primary);
45
- --md-elevated-button-focus-icon-color: var(--md-sys-color-on-primary);
46
-
47
- &[green] {
48
- --md-elevated-button-container-color: #42b382;
49
- }
50
- }
51
- }
52
- `
53
- ]
54
-
55
- @property({ type: String }) projectId: string = ''
56
- @property({ type: String }) title: string = ''
57
-
58
- render() {
59
- const path = window.location.pathname
60
-
61
- return html`
62
- <div header>
63
- <h2>${this.title}</h2>
64
- <div button-container>
65
- <md-elevated-button green @click=${this._dispatchEvent} ?disabled=${!this.projectId}>
66
- <md-icon slot="icon">save</md-icon>정보 저장
67
- </md-elevated-button>
68
- <md-elevated-button
69
- href=${`project-update/${this.projectId}`}
70
- ?disabled=${!this.projectId || path.includes('project-update/')}
71
- >
72
- <md-icon slot="icon">assignment</md-icon>프로젝트 정보 수정
73
- </md-elevated-button>
74
- <md-elevated-button
75
- href=${`project-plan-management/${this.projectId}`}
76
- ?disabled=${!this.projectId || path.includes('project-plan-management/')}
77
- >
78
- <md-icon slot="icon">description</md-icon>도면 관리
79
- </md-elevated-button>
80
- </div>
81
- </div>
82
- `
83
- }
84
-
85
- private _dispatchEvent() {
86
- this.dispatchEvent(new CustomEvent('custom-click'))
87
- }
88
- }
@@ -1,138 +0,0 @@
1
- import { css, html, LitElement } from 'lit'
2
- import { customElement, property } from 'lit/decorators.js'
3
- import { BuildingLevel } from '../project-list'
4
-
5
- @customElement('popup-plan-upload')
6
- export class PopupPlanUpload extends LitElement {
7
- static styles = [
8
- css`
9
- :host {
10
- display: flex;
11
- flex-direction: column;
12
- background-color: #fff;
13
- width: 100%;
14
- }
15
-
16
- div[body] {
17
- flex: 1;
18
-
19
- div[input-container] {
20
- display: flex;
21
- align-items: center;
22
- justify-content: center;
23
- gap: 25px;
24
- background-color: #f7f7f7;
25
- padding: 35px 27px 27px 27px;
26
-
27
- ox-input-file {
28
- height: 100px;
29
- width: 120px;
30
- line-height: 100%;
31
- }
32
- }
33
-
34
- div[button-container] {
35
- display: flex;
36
- align-items: center;
37
- justify-content: center;
38
- margin-top: 20px;
39
- }
40
- }
41
- `
42
- ]
43
-
44
- @property({ type: Object }) private buildingLevel: BuildingLevel = {}
45
- @property({ type: Number }) private selectedIdx: number | undefined
46
-
47
- render() {
48
- const noUploadStyle = '--file-uploader-icon-size: 0; --file-uploader-label-padding; 0;'
49
-
50
- // 메인 도면 스타일
51
- const { mainDrawing, mainDrawingThumbnail } = this.buildingLevel
52
- const mainDrawingIcon = mainDrawing ? '' : 'upload'
53
- const mainDrawingStyle = mainDrawing ? noUploadStyle : ''
54
- const mainDrawingLabel = mainDrawingThumbnail ? ' ' : '업로드'
55
- const mainDrawingDesc = mainDrawingThumbnail ? ' ' : '평면 파일'
56
- const mainDrawingThumbnailStyle = mainDrawingThumbnail ? this._getThumbnailStyle(mainDrawingThumbnail) : ''
57
-
58
- // 입면 도면 스타일
59
- const { elevationDrawing, elevationDrawingThumbnail } = this.buildingLevel
60
- const elevationDrawingIcon = elevationDrawing ? '' : 'upload'
61
- const elevationDrawingLabel = elevationDrawingThumbnail ? ' ' : '업로드'
62
- const elevationDrawingDesc = elevationDrawingThumbnail ? ' ' : '입면 파일'
63
- const elevationDrawingStyle = elevationDrawing ? noUploadStyle : ''
64
- const elevationDrawingThumbnailStyle = elevationDrawingThumbnail ? this._getThumbnailStyle(elevationDrawingThumbnail) : ''
65
-
66
- // 철근배근도 도면 스타일
67
- const { rebarDistributionDrawing, rebarDistributionDrawingThumbnail } = this.buildingLevel
68
- const rebarDistributionDrawingIcon = rebarDistributionDrawing ? '' : 'upload'
69
- const rebarDistributionDrawingStyle = rebarDistributionDrawing ? noUploadStyle : ''
70
- const rebarDistributionDrawingLabel = rebarDistributionDrawingThumbnail ? ' ' : '업로드'
71
- const rebarDistributionDrawingDesc = rebarDistributionDrawingThumbnail ? ' ' : '철근배근도 파일'
72
- const rebarDistributionDrawingThumbnailStyle = rebarDistributionDrawingThumbnail
73
- ? this._getThumbnailStyle(rebarDistributionDrawingThumbnail)
74
- : ''
75
-
76
- return html`
77
- <div body>
78
- <div input-container>
79
- <ox-input-file
80
- name="mainDrawing"
81
- .value=${mainDrawing || undefined}
82
- icon=${mainDrawingIcon}
83
- label=${mainDrawingLabel}
84
- description=${mainDrawingDesc}
85
- @change=${this._onChangeAttachment.bind(this)}
86
- style="${mainDrawingStyle + mainDrawingThumbnailStyle}"
87
- ></ox-input-file>
88
-
89
- <ox-input-file
90
- name="elevationDrawing"
91
- .value=${elevationDrawing || undefined}
92
- icon=${elevationDrawingIcon}
93
- label=${elevationDrawingLabel}
94
- description=${elevationDrawingDesc}
95
- @change=${this._onChangeAttachment.bind(this)}
96
- style="${elevationDrawingStyle + elevationDrawingThumbnailStyle}"
97
- ></ox-input-file>
98
-
99
- <ox-input-file
100
- name="rebarDistributionDrawing"
101
- .value=${rebarDistributionDrawing || undefined}
102
- icon=${rebarDistributionDrawingIcon}
103
- label=${rebarDistributionDrawingLabel}
104
- description=${rebarDistributionDrawingDesc}
105
- @change=${this._onChangeAttachment.bind(this)}
106
- style="${rebarDistributionDrawingStyle + rebarDistributionDrawingThumbnailStyle}"
107
- ></ox-input-file>
108
- </div>
109
-
110
- <div button-container>
111
- <md-outlined-button @click=${this._close}><md-icon slot="icon">cancel</md-icon>취소</md-outlined-button>
112
- </div>
113
- </div>
114
- `
115
- }
116
-
117
- private _close() {
118
- history.back()
119
- }
120
-
121
- // 이미지 업로드
122
- async _onChangeAttachment(e: CustomEvent) {
123
- const target = e.target as HTMLInputElement
124
- const file = e.detail[0] || null
125
-
126
- this.buildingLevel[target.name] = file
127
- this.buildingLevel[`${target.name}Upload`] = file
128
-
129
- this.buildingLevel = { ...this.buildingLevel }
130
-
131
- const detail = { buildingLevel: this.buildingLevel, selectedIdx: this.selectedIdx }
132
- this.dispatchEvent(new CustomEvent('file_change', { bubbles: false, detail: detail }))
133
- }
134
-
135
- private _getThumbnailStyle(path) {
136
- return `background: url(${path}); background-size: cover; background-repeat: round; justify-content: flex-end;`
137
- }
138
- }