@dssp/project 0.0.18 → 0.0.20

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 (51) hide show
  1. package/client/pages/project/project-completed-list.ts +281 -0
  2. package/client/pages/project/project-detail.ts +8 -2
  3. package/client/pages/project/project-list.ts +19 -16
  4. package/client/pages/project/project-plan-management.ts +0 -2
  5. package/client/pages/project/project-schedule-list.ts +5 -5
  6. package/client/pages/project/project-setting-list.ts +73 -4
  7. package/client/pages/resource/inspection-drawing-type-management.ts +54 -19
  8. package/client/route.ts +4 -4
  9. package/dist-client/pages/project/project-completed-list.d.ts +18 -0
  10. package/dist-client/pages/project/project-completed-list.js +294 -0
  11. package/dist-client/pages/project/project-completed-list.js.map +1 -0
  12. package/dist-client/pages/project/project-detail.js +8 -2
  13. package/dist-client/pages/project/project-detail.js.map +1 -1
  14. package/dist-client/pages/project/project-list.d.ts +1 -2
  15. package/dist-client/pages/project/project-list.js +24 -20
  16. package/dist-client/pages/project/project-list.js.map +1 -1
  17. package/dist-client/pages/project/project-plan-management.js +0 -1
  18. package/dist-client/pages/project/project-plan-management.js.map +1 -1
  19. package/dist-client/pages/project/project-schedule-list.d.ts +0 -1
  20. package/dist-client/pages/project/project-schedule-list.js +6 -5
  21. package/dist-client/pages/project/project-schedule-list.js.map +1 -1
  22. package/dist-client/pages/project/project-setting-list.d.ts +1 -1
  23. package/dist-client/pages/project/project-setting-list.js +74 -5
  24. package/dist-client/pages/project/project-setting-list.js.map +1 -1
  25. package/dist-client/pages/resource/inspection-drawing-type-management.d.ts +20 -6
  26. package/dist-client/pages/resource/inspection-drawing-type-management.js +54 -18
  27. package/dist-client/pages/resource/inspection-drawing-type-management.js.map +1 -1
  28. package/dist-client/route.d.ts +1 -1
  29. package/dist-client/route.js +3 -3
  30. package/dist-client/route.js.map +1 -1
  31. package/dist-client/tsconfig.tsbuildinfo +1 -1
  32. package/dist-server/migrations/1723861478420-seed-/bsample-project.js +1 -1
  33. package/dist-server/migrations/1723861478420-seed-/bsample-project.js.map +1 -1
  34. package/dist-server/service/project/project-mutation.js +3 -2
  35. package/dist-server/service/project/project-mutation.js.map +1 -1
  36. package/dist-server/service/project/project-query.js +1 -1
  37. package/dist-server/service/project/project-query.js.map +1 -1
  38. package/dist-server/service/project/project.d.ts +2 -2
  39. package/dist-server/service/project/project.js +7 -7
  40. package/dist-server/service/project/project.js.map +1 -1
  41. package/dist-server/tsconfig.tsbuildinfo +1 -1
  42. package/package.json +3 -3
  43. package/server/migrations/1723861478420-seed-/bsample-project.ts +2 -2
  44. package/server/service/project/project-mutation.ts +4 -3
  45. package/server/service/project/project-query.ts +1 -1
  46. package/server/service/project/project.ts +3 -3
  47. package/things-factory.config.js +0 -1
  48. package/client/pages/resource/manager-management.ts +0 -175
  49. package/dist-client/pages/resource/manager-management.d.ts +0 -31
  50. package/dist-client/pages/resource/manager-management.js +0 -169
  51. package/dist-client/pages/resource/manager-management.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dssp/project",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -27,7 +27,7 @@
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.18",
30
+ "@dssp/building-complex": "^0.0.20",
31
31
  "@operato/graphql": "^8.0.0-alpha",
32
32
  "@operato/shell": "^8.0.0-alpha",
33
33
  "@things-factory/auth-base": "^8.0.0-alpha",
@@ -38,5 +38,5 @@
38
38
  "@things-factory/shell": "^8.0.0-alpha",
39
39
  "exceljs": "^4.4.0"
40
40
  },
41
- "gitHead": "91ab5e849f08f4a991f588be3e1f79b60a0e7ea7"
41
+ "gitHead": "6c30a83bb7199f0478d4488b814c76725de3fc62"
42
42
  }
@@ -4,7 +4,7 @@ import { logger } from '@things-factory/env'
4
4
  import { Domain, getRepository } from '@things-factory/shell'
5
5
  import { User } from '@things-factory/auth-base'
6
6
  import { BuildingComplex } from '@dssp/building-complex'
7
- import { Project, ProjectStatus } from '../service/project/project'
7
+ import { Project, ProjectState } from '../service/project/project'
8
8
 
9
9
  const SEED_SAMPLE_BUILDING_COMPLEX = {
10
10
  address: '서울시 마포구 공덕동 아파트 17번지',
@@ -26,7 +26,7 @@ const SEED_SAMPLE_BUILDING_COMPLEX = {
26
26
 
27
27
  const SEED_SAMPLE_PROJECT = {
28
28
  name: '서울시 마포구 공덕동 아파트 신축공사',
29
- state: ProjectStatus.ONGOING,
29
+ state: ProjectState.ONGOING,
30
30
  startDate: '2024-01-01',
31
31
  endDate: '2025-12-31',
32
32
  totalProgress: 40,
@@ -1,7 +1,7 @@
1
1
  import { Resolver, Mutation, Arg, Ctx, Directive } from 'type-graphql'
2
2
  import { In } from 'typeorm'
3
3
  import { createAttachment, deleteAttachmentsByRef, ATTACHMENT_PATH } from '@things-factory/attachment-base'
4
- import { Project } from './project'
4
+ import { Project, ProjectState } from './project'
5
5
  import { NewProject, ProjectPatch } from './project-type'
6
6
  import { BuildingComplex, Building, BuildingLevel } from '@dssp/building-complex'
7
7
  import { pdfToImage } from '@things-factory/board-service/dist-server/controllers/headless-pdf-to-image'
@@ -45,7 +45,8 @@ export class ProjectMutation {
45
45
  const buildings = project.buildingComplex?.buildings || []
46
46
 
47
47
  // 1. 프로젝트 수정
48
- const projectResult = await projectRepo.save({ ...project, updater: user })
48
+ const projectState = project.totalProgress == 100 ? ProjectState.COMPLETED : ProjectState.ONGOING
49
+ const projectResult = await projectRepo.save({ ...project, state: projectState, updater: user })
49
50
 
50
51
  // 2. 단지 정보 수정
51
52
  await buildingComplexRepo.save({ ...buildingComplex, updater: user })
@@ -54,7 +55,7 @@ export class ProjectMutation {
54
55
  await createAttachmentAfterDelete(context, project?.mainPhotoUpload, project.id, Project.name)
55
56
 
56
57
  // 2-2. 단지 BIM 이미지 첨부파일 나머지 삭제 후 저장
57
- await createAttachmentAfterDelete(context, buildingComplex?.drawingUpload, buildingComplex.id, BuildingComplex.name)
58
+ await createAttachmentAfterDelete(context, buildingComplex?.drawingUpload, buildingComplex.id, BuildingComplex.name + '_bim')
58
59
 
59
60
  // 3. 동의 층 정보가 바뀌었으면 층 초기화 후 다시 생성
60
61
  const originBuilding = await buildingRepo.findBy({ buildingComplex: { id: buildingComplex.id } }) // 이전 동 정보 가져오기
@@ -27,7 +27,7 @@ export class ProjectQuery {
27
27
  domain,
28
28
  params,
29
29
  repository: await getRepository(Project),
30
- searchables: ['name', 'description']
30
+ searchables: ['name', 'description', 'state']
31
31
  })
32
32
 
33
33
  const [items, total] = await queryBuilder.getManyAndCount()
@@ -20,7 +20,7 @@ import { Task } from '../task/task'
20
20
  import { BuildingComplex } from '@dssp/building-complex'
21
21
  import { Attachment } from '@things-factory/attachment-base'
22
22
 
23
- export enum ProjectStatus {
23
+ export enum ProjectState {
24
24
  'ONGOING' = '10',
25
25
  'COMPLETED' = '20'
26
26
  }
@@ -44,9 +44,9 @@ export class Project {
44
44
  @Field({ nullable: false })
45
45
  name?: string
46
46
 
47
- @Column({ nullable: false, default: ProjectStatus.ONGOING, comment: '프로젝트 상태 (10: 진행중, 20: 완료)' })
47
+ @Column({ nullable: false, default: ProjectState.ONGOING, comment: '프로젝트 상태 (10: 진행중, 20: 완료)' })
48
48
  @Field({ nullable: false })
49
- state?: ProjectStatus
49
+ state?: ProjectState
50
50
 
51
51
  @Column({ type: 'date', nullable: true, comment: '착공일정' })
52
52
  @Field({ nullable: true })
@@ -11,7 +11,6 @@ export default {
11
11
  'project-setting-list', // 셋팅 리스트
12
12
  'project-update', // 프로젝트 정보 관리
13
13
  'project-plan-management', // 프로젝트 도면 관리
14
- 'manager-management', // 담당자 관리
15
14
  'worker-type-management', // 인력 관리
16
15
  'construction-type-management', // 공종 관리
17
16
  'inspection-drawing-type-management', // 도면 타입 및 검측 부위 관리
@@ -1,175 +0,0 @@
1
- import '@operato/data-grist'
2
-
3
- import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'
4
- import { PageView } from '@operato/shell'
5
- import { css, html } from 'lit'
6
- import { customElement, property, query } from 'lit/decorators.js'
7
- import { DataGrist } from '@operato/data-grist'
8
- import { client } from '@operato/graphql'
9
- import { notify } from '@operato/layout'
10
- import gql from 'graphql-tag'
11
-
12
- @customElement('manager-management')
13
- export class ManagerManagement extends PageView {
14
- static styles = [
15
- ScrollbarStyles,
16
- CommonGristStyles,
17
- css`
18
- :host {
19
- display: flex;
20
- flex-direction: column;
21
-
22
- width: 100%;
23
-
24
- --grid-record-emphasized-background-color: red;
25
- --grid-record-emphasized-color: yellow;
26
- }
27
- `
28
- ]
29
-
30
- @property({ type: Object }) gristConfig: any
31
- @query('ox-grist') private grist!: DataGrist
32
-
33
- get context() {
34
- return {
35
- title: '담당자 관리',
36
- actions: [
37
- {
38
- title: '저장',
39
- action: this._updateManagers.bind(this),
40
- ...CommonButtonStyles.save
41
- }
42
- ]
43
- }
44
- }
45
-
46
- render() {
47
- return html`
48
- <ox-grist .mode=${'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist>
49
- `
50
- }
51
-
52
- async pageInitialized(lifecycle: any) {
53
- this.gristConfig = {
54
- columns: [
55
- { type: 'gutter', gutterName: 'sequence' },
56
- {
57
- type: 'string',
58
- name: 'name',
59
- header: '이름',
60
- record: {
61
- editable: true
62
- },
63
- width: 150
64
- },
65
- {
66
- type: 'string',
67
- name: 'phone',
68
- header: '휴대폰 번호',
69
- record: {
70
- editable: true
71
- },
72
- width: 150
73
- },
74
- {
75
- type: 'string',
76
- name: 'position',
77
- header: '직위',
78
- record: {
79
- editable: true
80
- },
81
- width: 150
82
- },
83
- {
84
- type: 'datetime',
85
- name: 'updatedAt',
86
- header: '수정 시간',
87
- record: {
88
- renderer: value => {
89
- const date = new Date(value + ' UTC')
90
-
91
- return new Intl.DateTimeFormat('ko-KR', {
92
- timeZone: 'Asia/Seoul',
93
- year: 'numeric',
94
- month: '2-digit',
95
- day: '2-digit',
96
- hour: '2-digit',
97
- minute: '2-digit',
98
- second: '2-digit'
99
- }).format(date)
100
- }
101
- },
102
- width: 200
103
- }
104
- ],
105
- rows: {
106
- appendable: false
107
- },
108
- sorters: [{ name: 'name' }],
109
- pagination: { infinite: true }
110
- }
111
- }
112
-
113
- async fetchHandler() {
114
- const response = await client.query({
115
- query: gql`
116
- query Managers {
117
- managers {
118
- id
119
- phone
120
- position
121
- userId
122
- name
123
- updatedAt
124
- }
125
- }
126
- `
127
- })
128
-
129
- console.log('response.data.managers :', response.data.managers)
130
-
131
- if (response.errors) return {}
132
-
133
- return {
134
- total: response.data.managers.length || 0,
135
- records: response.data.managers || []
136
- }
137
- }
138
-
139
- async _updateManagers() {
140
- let patches = this.grist.dirtyRecords
141
- if (patches && patches.length) {
142
- patches = patches.map(patch => {
143
- let patchField: any = patch.userId ? { userId: patch.userId } : {}
144
- if (patch.id) patchField['id'] = patch.id
145
-
146
- const dirtyFields = patch.__dirtyfields__
147
- for (let key in dirtyFields) {
148
- patchField[key] = dirtyFields[key].after
149
- }
150
-
151
- return patchField
152
- })
153
-
154
- const response = await client.mutate({
155
- mutation: gql`
156
- mutation UpdateMultipleManager($patches: [ManagerPatch!]!) {
157
- updateMultipleManager(patches: $patches) {
158
- id
159
- }
160
- }
161
- `,
162
- variables: {
163
- patches
164
- }
165
- })
166
-
167
- if (!response.errors) {
168
- this.grist.fetch()
169
- notify({ message: '저장되었습니다.' })
170
- } else {
171
- notify({ message: '저장에 실패하였습니다.', level: 'error' })
172
- }
173
- }
174
- }
175
- }
@@ -1,31 +0,0 @@
1
- import '@operato/data-grist';
2
- import { PageView } from '@operato/shell';
3
- export declare class ManagerManagement extends PageView {
4
- static styles: import("lit").CSSResult[];
5
- gristConfig: any;
6
- private grist;
7
- get context(): {
8
- title: string;
9
- actions: {
10
- icon: string;
11
- emphasis: {
12
- raised: boolean;
13
- outlined: boolean;
14
- dense: boolean;
15
- danger: boolean;
16
- };
17
- title: string;
18
- action: () => Promise<void>;
19
- }[];
20
- };
21
- render(): import("lit-html").TemplateResult<1>;
22
- pageInitialized(lifecycle: any): Promise<void>;
23
- fetchHandler(): Promise<{
24
- total?: undefined;
25
- records?: undefined;
26
- } | {
27
- total: any;
28
- records: any;
29
- }>;
30
- _updateManagers(): Promise<void>;
31
- }
@@ -1,169 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import '@operato/data-grist';
3
- import { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles';
4
- import { PageView } from '@operato/shell';
5
- import { css, html } from 'lit';
6
- import { customElement, property, query } from 'lit/decorators.js';
7
- import { DataGrist } from '@operato/data-grist';
8
- import { client } from '@operato/graphql';
9
- import { notify } from '@operato/layout';
10
- import gql from 'graphql-tag';
11
- let ManagerManagement = class ManagerManagement extends PageView {
12
- get context() {
13
- return {
14
- title: '담당자 관리',
15
- actions: [
16
- Object.assign({ title: '저장', action: this._updateManagers.bind(this) }, CommonButtonStyles.save)
17
- ]
18
- };
19
- }
20
- render() {
21
- return html `
22
- <ox-grist .mode=${'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist>
23
- `;
24
- }
25
- async pageInitialized(lifecycle) {
26
- this.gristConfig = {
27
- columns: [
28
- { type: 'gutter', gutterName: 'sequence' },
29
- {
30
- type: 'string',
31
- name: 'name',
32
- header: '이름',
33
- record: {
34
- editable: true
35
- },
36
- width: 150
37
- },
38
- {
39
- type: 'string',
40
- name: 'phone',
41
- header: '휴대폰 번호',
42
- record: {
43
- editable: true
44
- },
45
- width: 150
46
- },
47
- {
48
- type: 'string',
49
- name: 'position',
50
- header: '직위',
51
- record: {
52
- editable: true
53
- },
54
- width: 150
55
- },
56
- {
57
- type: 'datetime',
58
- name: 'updatedAt',
59
- header: '수정 시간',
60
- record: {
61
- renderer: value => {
62
- const date = new Date(value + ' UTC');
63
- return new Intl.DateTimeFormat('ko-KR', {
64
- timeZone: 'Asia/Seoul',
65
- year: 'numeric',
66
- month: '2-digit',
67
- day: '2-digit',
68
- hour: '2-digit',
69
- minute: '2-digit',
70
- second: '2-digit'
71
- }).format(date);
72
- }
73
- },
74
- width: 200
75
- }
76
- ],
77
- rows: {
78
- appendable: false
79
- },
80
- sorters: [{ name: 'name' }],
81
- pagination: { infinite: true }
82
- };
83
- }
84
- async fetchHandler() {
85
- const response = await client.query({
86
- query: gql `
87
- query Managers {
88
- managers {
89
- id
90
- phone
91
- position
92
- userId
93
- name
94
- updatedAt
95
- }
96
- }
97
- `
98
- });
99
- console.log('response.data.managers :', response.data.managers);
100
- if (response.errors)
101
- return {};
102
- return {
103
- total: response.data.managers.length || 0,
104
- records: response.data.managers || []
105
- };
106
- }
107
- async _updateManagers() {
108
- let patches = this.grist.dirtyRecords;
109
- if (patches && patches.length) {
110
- patches = patches.map(patch => {
111
- let patchField = patch.userId ? { userId: patch.userId } : {};
112
- if (patch.id)
113
- patchField['id'] = patch.id;
114
- const dirtyFields = patch.__dirtyfields__;
115
- for (let key in dirtyFields) {
116
- patchField[key] = dirtyFields[key].after;
117
- }
118
- return patchField;
119
- });
120
- const response = await client.mutate({
121
- mutation: gql `
122
- mutation UpdateMultipleManager($patches: [ManagerPatch!]!) {
123
- updateMultipleManager(patches: $patches) {
124
- id
125
- }
126
- }
127
- `,
128
- variables: {
129
- patches
130
- }
131
- });
132
- if (!response.errors) {
133
- this.grist.fetch();
134
- notify({ message: '저장되었습니다.' });
135
- }
136
- else {
137
- notify({ message: '저장에 실패하였습니다.', level: 'error' });
138
- }
139
- }
140
- }
141
- };
142
- ManagerManagement.styles = [
143
- ScrollbarStyles,
144
- CommonGristStyles,
145
- css `
146
- :host {
147
- display: flex;
148
- flex-direction: column;
149
-
150
- width: 100%;
151
-
152
- --grid-record-emphasized-background-color: red;
153
- --grid-record-emphasized-color: yellow;
154
- }
155
- `
156
- ];
157
- __decorate([
158
- property({ type: Object }),
159
- __metadata("design:type", Object)
160
- ], ManagerManagement.prototype, "gristConfig", void 0);
161
- __decorate([
162
- query('ox-grist'),
163
- __metadata("design:type", DataGrist)
164
- ], ManagerManagement.prototype, "grist", void 0);
165
- ManagerManagement = __decorate([
166
- customElement('manager-management')
167
- ], ManagerManagement);
168
- export { ManagerManagement };
169
- //# sourceMappingURL=manager-management.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"manager-management.js","sourceRoot":"","sources":["../../../client/pages/resource/manager-management.ts"],"names":[],"mappings":";AAAA,OAAO,qBAAqB,CAAA;AAE5B,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,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,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,GAAG,MAAM,aAAa,CAAA;AAGtB,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,QAAQ;IAoB7C,IAAI,OAAO;QACT,OAAO;YACL,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE;gCAEL,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,IACpC,kBAAkB,CAAC,IAAI;aAE7B;SACF,CAAA;IACH,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;wBACS,MAAM,YAAY,IAAI,CAAC,WAAW,kBAAkB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CA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AAA;YACnB,CAAC,CAAC,CAAA;YAEF,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC;gBACnC,QAAQ,EAAE,GAAG,CAAA;;;;;;SAMZ;gBACD,SAAS,EAAE;oBACT,OAAO;iBACR;aACF,CAAC,CAAA;YAEF,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;gBACpB,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;gBAClB,MAAM,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;aAChC;iBAAM;gBACL,MAAM,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;aACpD;SACF;IACH,CAAC;;AAhKM,wBAAM,GAAG;IACd,eAAe;IACf,iBAAiB;IACjB,GAAG,CAAA;;;;;;;;;;KAUF;CACF,CAAA;AAED;IAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sDAAiB;AAC5C;IAAC,KAAK,CAAC,UAAU,CAAC;8BAAiB,SAAS;gDAAA;AAlBjC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CAkK7B;SAlKY,iBAAiB","sourcesContent":["import '@operato/data-grist'\n\nimport { CommonButtonStyles, CommonGristStyles, ScrollbarStyles } from '@operato/styles'\nimport { PageView } from '@operato/shell'\nimport { css, html } from 'lit'\nimport { customElement, property, query } from 'lit/decorators.js'\nimport { DataGrist } from '@operato/data-grist'\nimport { client } from '@operato/graphql'\nimport { notify } from '@operato/layout'\nimport gql from 'graphql-tag'\n\n@customElement('manager-management')\nexport class ManagerManagement extends PageView {\n static styles = [\n ScrollbarStyles,\n CommonGristStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n\n width: 100%;\n\n --grid-record-emphasized-background-color: red;\n --grid-record-emphasized-color: yellow;\n }\n `\n ]\n\n @property({ type: Object }) gristConfig: any\n @query('ox-grist') private grist!: DataGrist\n\n get context() {\n return {\n title: '담당자 관리',\n actions: [\n {\n title: '저장',\n action: this._updateManagers.bind(this),\n ...CommonButtonStyles.save\n }\n ]\n }\n }\n\n render() {\n return html`\n <ox-grist .mode=${'GRID'} .config=${this.gristConfig} .fetchHandler=${this.fetchHandler.bind(this)}> </ox-grist>\n `\n }\n\n async pageInitialized(lifecycle: any) {\n this.gristConfig = {\n columns: [\n { type: 'gutter', gutterName: 'sequence' },\n {\n type: 'string',\n name: 'name',\n header: '이름',\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'phone',\n header: '휴대폰 번호',\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'string',\n name: 'position',\n header: '직위',\n record: {\n editable: true\n },\n width: 150\n },\n {\n type: 'datetime',\n name: 'updatedAt',\n header: '수정 시간',\n record: {\n renderer: value => {\n const date = new Date(value + ' UTC')\n\n return new Intl.DateTimeFormat('ko-KR', {\n timeZone: 'Asia/Seoul',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n }).format(date)\n }\n },\n width: 200\n }\n ],\n rows: {\n appendable: false\n },\n sorters: [{ name: 'name' }],\n pagination: { infinite: true }\n }\n }\n\n async fetchHandler() {\n const response = await client.query({\n query: gql`\n query Managers {\n managers {\n id\n phone\n position\n userId\n name\n updatedAt\n }\n }\n `\n })\n\n console.log('response.data.managers :', response.data.managers)\n\n if (response.errors) return {}\n\n return {\n total: response.data.managers.length || 0,\n records: response.data.managers || []\n }\n }\n\n async _updateManagers() {\n let patches = this.grist.dirtyRecords\n if (patches && patches.length) {\n patches = patches.map(patch => {\n let patchField: any = patch.userId ? { userId: patch.userId } : {}\n if (patch.id) patchField['id'] = patch.id\n\n const dirtyFields = patch.__dirtyfields__\n for (let key in dirtyFields) {\n patchField[key] = dirtyFields[key].after\n }\n\n return patchField\n })\n\n const response = await client.mutate({\n mutation: gql`\n mutation UpdateMultipleManager($patches: [ManagerPatch!]!) {\n updateMultipleManager(patches: $patches) {\n id\n }\n }\n `,\n variables: {\n patches\n }\n })\n\n if (!response.errors) {\n this.grist.fetch()\n notify({ message: '저장되었습니다.' })\n } else {\n notify({ message: '저장에 실패하였습니다.', level: 'error' })\n }\n }\n }\n}\n"]}