eztech-core-components 1.0.45 → 1.0.46

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.
@@ -8,7 +8,7 @@
8
8
  </div>
9
9
  <card-item
10
10
  v-for="item in list"
11
- :key="item[pk_field_name]"
11
+ :key="item._id"
12
12
  :item="item"
13
13
  :name-field="nameField"
14
14
  :note-field="noteField"
@@ -30,10 +30,6 @@ export default {
30
30
  type: Array,
31
31
  default: () => { return [] }
32
32
  },
33
- pk_field_name: {
34
- type: String,
35
- default: '_id'
36
- },
37
33
  loading: {
38
34
  type: Boolean,
39
35
  default: false
@@ -17,7 +17,6 @@ export default {
17
17
  value: { type: [String], default: null },
18
18
  table_name: { type: String, default: null },
19
19
  ref_column: { type: String, default: null },
20
- pk_field_name: { type: String, default: '_id' },
21
20
  projectId: { type: [String, Number], default: '5' },
22
21
  disabled: { type: Boolean, default: false },
23
22
  size: { type: String, default: null },
@@ -93,7 +93,6 @@
93
93
  :project-id="projectId"
94
94
  :root-api-id="rootApiId"
95
95
  :root-temp-id="rootTempId"
96
- :pk_field_name="pk_field_name"
97
96
  :default-size="defaultSize"
98
97
  :temp="temp"
99
98
  :group="group"
@@ -177,7 +176,6 @@
177
176
  :ref="`REF_GROUP_${group.name}`"
178
177
  :table="table"
179
178
  :project-id="projectId"
180
- :pk_field_name="pk_field_name"
181
179
  :default-size="defaultSize"
182
180
  :root-api-id="rootApiId"
183
181
  :root-temp-id="rootTempId || tempId || temp?._id"
@@ -266,7 +264,6 @@ export default {
266
264
  rules: { type: Object, default: () => { return {} } },
267
265
  labelWidth: { type: String, default: '140px' },
268
266
  formLabelPosition: { type: String, default: null },
269
- pk_field_name: { type: String, default: '_id' },
270
267
  showPkid: { type: Boolean, default: false },
271
268
  projectId: { type: String, default: null },
272
269
  fullWidth: { type: Boolean, default: false },
@@ -322,7 +319,7 @@ export default {
322
319
  return this.table?.form_label_position || 'left'
323
320
  },
324
321
  visibleLog () {
325
- return !this.hideLog && this.temp && this.temp[this.pk_field_name]
322
+ return !this.hideLog && this.temp && this.temp._id
326
323
  },
327
324
  groupTitles () {
328
325
  const list = []
@@ -4,7 +4,7 @@
4
4
  v-loading="loadingForm"
5
5
  v-el-drag-dialog
6
6
  :visible.sync="visible"
7
- :title="title || (temp && !temp[pk_field_name] ? (buttons.textCreate || 'Бүртгэх') : (buttons.textEdit || 'Харах'))"
7
+ :title="title || (temp && !temp._id ? (buttons.textCreate || 'Бүртгэх') : (buttons.textEdit || 'Харах'))"
8
8
  :width="width"
9
9
  :append-to-body="appendToBody"
10
10
  :close-on-click-modal="false"
@@ -83,7 +83,6 @@ export default {
83
83
  saving: { type: Boolean, default: false },
84
84
  restoringPassword: { type: Boolean, default: false },
85
85
  width: { type: String, default: '700px' },
86
- pk_field_name: { type: String, default: '_id' },
87
86
  loadingForm: { type: Boolean, default: false },
88
87
  readOnly: { type: Boolean, default: false },
89
88
  sizeButton: { type: String, default: null },
@@ -95,10 +94,10 @@ export default {
95
94
  },
96
95
  computed: {
97
96
  isCreate () {
98
- return this.temp && !this.temp[this.pk_field_name]
97
+ return this.temp && !this.temp._id
99
98
  },
100
99
  isEdit () {
101
- return this.temp && this.temp[this.pk_field_name]
100
+ return this.temp && this.temp._id
102
101
  },
103
102
  visible: {
104
103
  get () {
@@ -169,7 +169,6 @@
169
169
  :temp="temp"
170
170
  :project-id="projectId"
171
171
  :root-temp-id="rootTempId"
172
- :pk_field_name="pk_field_name"
173
172
  :default-size="defaultSize"
174
173
  :loading="searching"
175
174
  :disabled="checkDisabledColumn(col)"
@@ -189,7 +188,7 @@
189
188
  >
190
189
  </div>
191
190
  </div>
192
- <custom-table-logs v-if="isShow && group.name === 'LOG' && table?._id && temp" :project_id="projectId" :table_id="table._id" :pk_id="temp[pk_field_name]" />
191
+ <custom-table-logs v-if="isShow && group.name === 'LOG' && table?._id && temp" :project_id="projectId" :table_id="table._id" :pk_id="temp._id" />
193
192
  </div>
194
193
  </template>
195
194
  <script>
@@ -199,7 +198,7 @@ export default {
199
198
  name: 'CoreFormFields',
200
199
  props: [
201
200
  'group', 'parentTemp', 'rootTempId', 'rootApiId',
202
- 'temp', 'pk_field_name', 'defaultSize', 'table',
201
+ 'temp', 'defaultSize', 'table',
203
202
  'projectId', 'searching', 'refColumns', 'disabled',
204
203
  'isSubMenu', 'showPkid', 'level', 'isLocaleLabel',
205
204
  'noPadding', 'noPaddingAll', 'parentFormCol',
@@ -244,7 +243,7 @@ export default {
244
243
  const localVal = r.localVal
245
244
  const operation = r.operation
246
245
  let tempVal = get(this.temp, localKey)
247
- if (tempVal && typeof tempVal === 'object' && has(tempVal, this.pk_field_name)) {
246
+ if (tempVal && typeof tempVal === 'object' && has(tempVal, '_id')) {
248
247
  tempVal = type === 'number' ? Number(tempVal._id) : tempVal._id
249
248
  }
250
249
  if (operation === 'ne' && localVal !== tempVal) {
@@ -4,7 +4,6 @@
4
4
  ref="refComponent"
5
5
  v-bind="componentProps"
6
6
  v-model="modelValue"
7
- :pk_field_name="pk_field_name"
8
7
  :size="defaultSize"
9
8
  :loading="loading"
10
9
  :project-id="projectId"
@@ -28,7 +27,6 @@ export default {
28
27
  temp: { type: Object, default: () => { return null } },
29
28
  projectId: { type: String, default: null },
30
29
  rootTempId: { type: String, default: null },
31
- pk_field_name: { type: String, default: '_id' },
32
30
  loading: { type: Boolean, default: false },
33
31
  defaultSize: { type: String, default: null },
34
32
  disabled: { type: Boolean, default: null },
@@ -122,7 +122,6 @@ export default {
122
122
  col: { type: Object, default: () => { return null } },
123
123
  temp: { type: Object, default: () => { return null } },
124
124
  projectId: { type: String, default: null },
125
- pk_field_name: { type: String, default: '_id' },
126
125
  searching: { type: Boolean, default: false },
127
126
  defaultSize: { type: String, default: null }
128
127
  },
@@ -6,7 +6,6 @@
6
6
  :columns="columns"
7
7
  :rules="rules"
8
8
  :table="table"
9
- :pk_field_name="project.pk_field_name"
10
9
  :show-pkid="showPkid"
11
10
  :has-password="hasPassword"
12
11
  :project-id="project._id"
@@ -12,7 +12,6 @@
12
12
  :current-page="currentPage"
13
13
  :list-page="listPage"
14
14
  :search="search"
15
- :pk_field_name="project.pk_field_name"
16
15
  :sub-column="subColumn"
17
16
  :current-row-id="id"
18
17
  :loading-excel="loadingExcel"
@@ -52,7 +51,6 @@
52
51
  <core-form-dialog
53
52
  :temp="temp"
54
53
  :saving="saving"
55
- :pk_field_name="project.pk_field_name"
56
54
  :has-password="hasPassword"
57
55
  :loading-form="loadingForm"
58
56
  default-size="small"
@@ -72,7 +70,6 @@
72
70
  :columns="columns"
73
71
  :rules="rules"
74
72
  :table="table"
75
- :pk_field_name="project.pk_field_name"
76
73
  :has-password="hasPassword"
77
74
  :project-id="project._id"
78
75
  :root-api-id="rootApiId"
@@ -34,7 +34,6 @@
34
34
  :parent-temp="parentTemp"
35
35
  :temp="scope.row"
36
36
  :project-id="projectId"
37
- :pk_field_name="pk_field_name"
38
37
  default-size="small"
39
38
  :disabled="disabled || col.disabled || col.form?.col_readonly || !buttons.textEdit || readOnly"
40
39
  @temp-change="($event) => handleChangeRow(scope.$index, col, $event)"
@@ -182,8 +181,8 @@ export default {
182
181
  for (const key in obj) {
183
182
  if (typeof obj[key] === 'object' && Array.isArray(obj[key])) {
184
183
  newObj[key] = obj[key].map(c => getObj(c))
185
- } else if (typeof obj[key] === 'object' && has(obj[key], this.pk_field_name)) {
186
- newObj[key] = obj[key][this.pk_field_name]
184
+ } else if (typeof obj[key] === 'object' && has(obj[key], '_id')) {
185
+ newObj[key] = obj[key]._id
187
186
  } else {
188
187
  newObj[key] = obj[key]
189
188
  }
@@ -43,7 +43,6 @@
43
43
  :parent-temp="parentTemp || scope.row"
44
44
  :temp="scope.row"
45
45
  :project-id="projectId"
46
- :pk_field_name="pk_field_name"
47
46
  default-size="small"
48
47
  :disabled="disabled || col.disabled || col.form?.col_readonly || ['duration_days', 'duration_total'].includes(col.col_field)"
49
48
  @temp-change="($event) => handleChangeRow(scope.$index, col, $event)"
@@ -158,8 +157,8 @@ export default {
158
157
  for (const key in obj) {
159
158
  if (typeof obj[key] === 'object' && Array.isArray(obj[key])) {
160
159
  newObj[key] = obj[key].map(c => getObj(c))
161
- } else if (typeof obj[key] === 'object' && has(obj[key], this.pk_field_name)) {
162
- newObj[key] = obj[key][this.pk_field_name]
160
+ } else if (typeof obj[key] === 'object' && has(obj[key], '_id')) {
161
+ newObj[key] = obj[key]._id
163
162
  } else {
164
163
  newObj[key] = obj[key]
165
164
  }
@@ -8,7 +8,6 @@
8
8
  :controls-position="controlsPosition"
9
9
  :precision="precision"
10
10
  :size="size"
11
- :pk_field_name="pk_field_name"
12
11
  :disabled="disabled"
13
12
  @change="$emit('change', $event)"
14
13
  @keydown.native.enter="$emit('keydown-enter', $event)"
@@ -26,7 +25,6 @@ export default {
26
25
  controlsPosition: { type: String, default: 'right' },
27
26
  precision: { type: Number, default: null },
28
27
  size: { type: String, default: null },
29
- pk_field_name: { type: String, default: '_id' }
30
28
  },
31
29
  computed: {
32
30
  modelValue: {
@@ -11,7 +11,7 @@
11
11
  :remote-method="handleDebounce"
12
12
  :multiple="isMultiple"
13
13
  :size="size"
14
- :value-key="pk_field_name"
14
+ value-key="_id"
15
15
  :placeholder="placeholder"
16
16
  @clear="handleClear"
17
17
  @visible-change="handleVisibleChange"
@@ -20,7 +20,7 @@
20
20
  >
21
21
  <el-option
22
22
  v-for="item of list"
23
- :key="item[pk_field_name]"
23
+ :key="item._id"
24
24
  :label="get(item, columnName)"
25
25
  :value="item"
26
26
  :style="{ color: columnName1 && columnName1.toLowerCase().includes('color') ? item[columnName1] : null }"
@@ -47,7 +47,6 @@ export default {
47
47
  value: { type: [String, Array, Number, Object], default: null },
48
48
  table_name: { type: String, default: null },
49
49
  ref_column: { type: String, default: null },
50
- pk_field_name: { type: String, default: '_id' },
51
50
  projectId: { type: [String, Number], default: null },
52
51
  col_multiple: { type: [Boolean, Number, String], default: false },
53
52
  trigger_fields: { type: String, default: '' },
@@ -109,7 +108,7 @@ export default {
109
108
  }
110
109
  return this.value.split(',')
111
110
  } else {
112
- return this.value && this.value[this.pk_field_name] ? this.value : null
111
+ return this.value && this.value._id ? this.value : null
113
112
  }
114
113
  },
115
114
  set (val) {
@@ -134,10 +133,10 @@ export default {
134
133
  let newValue = get(newVal, tempKey)
135
134
  let oldValue = get(oldVal, tempKey)
136
135
  if (newValue && typeof newValue === 'object') {
137
- newValue = newValue[this.pk_field_name]
136
+ newValue = newValue._id
138
137
  }
139
138
  if (oldValue && typeof oldValue === 'object') {
140
- oldValue = oldValue[this.pk_field_name]
139
+ oldValue = oldValue._id
141
140
  }
142
141
  if (!isEqual(newValue, oldValue)) {
143
142
  if (oldValue) {
@@ -174,10 +173,10 @@ export default {
174
173
  if (this.isMultiple) {
175
174
  vals = this.value ? [...this.value] : []
176
175
  } else if (typeof this.value === 'object') {
177
- vals = this.value && this.value[this.pk_field_name] ? [this.value] : []
176
+ vals = this.value && this.value._id ? [this.value] : []
178
177
  }
179
178
  for (const val of vals) {
180
- if (!this.list.some(c => c[this.pk_field_name] === val[this.pk_field_name])) {
179
+ if (!this.list.some(c => c._id === val._id)) {
181
180
  this.list.unshift(val)
182
181
  }
183
182
  }
@@ -207,7 +206,7 @@ export default {
207
206
  const vals = newValue.map(c => c._id)
208
207
  triggerSearch[localKey] = { val: vals, t: type, op: operation }
209
208
  } else if (newValue) {
210
- const val = typeof newValue === 'object' ? newValue[this.pk_field_name] : newValue
209
+ const val = typeof newValue === 'object' ? newValue._id : newValue
211
210
  if (localKey === 'reg_type_id' && this.table_name === 'ref_reg_sub_types' && this.isSearch && val === '5') {
212
211
  triggerSearch[localKey] = { val: '7,8,9,10,5', t: type, op: 'in' }
213
212
  } else {
@@ -226,9 +225,9 @@ export default {
226
225
  locale_id: this.parentTemp?.locale_id
227
226
  }
228
227
  })
229
- const list = this.value ? (this.isMultiple ? [...this.value] : (this.value[this.pk_field_name] ? [this.value] : [])) : []
228
+ const list = this.value ? (this.isMultiple ? [...this.value] : (this.value._id ? [this.value] : [])) : []
230
229
  for (const r of data.list) {
231
- const index = list.findIndex(c => c[this.pk_field_name] === r[this.pk_field_name])
230
+ const index = list.findIndex(c => c._id === r._id)
232
231
  if (index > -1) {
233
232
  list.splice(index, 1)
234
233
  }
@@ -330,7 +330,7 @@ export default {
330
330
  const vals = newValue.map(c => c._id)
331
331
  triggerSearch[localKey] = { val: vals, t: type, op: operation }
332
332
  } else {
333
- const val = typeof newValue === 'object' ? newValue[this.pk_field_name] : newValue
333
+ const val = typeof newValue === 'object' ? newValue._id : newValue
334
334
  triggerSearch[localKey] = { val, t: type, op: operation }
335
335
  }
336
336
  } else {
@@ -62,7 +62,6 @@
62
62
  :temp="temp"
63
63
  :saving="saving"
64
64
  :restoring-password="restoringPassword"
65
- :pk_field_name="project.pk_field_name"
66
65
  :has-password="hasPassword"
67
66
  :default-size="defaultSize"
68
67
  :size-button="defaultSize"
@@ -81,7 +80,6 @@
81
80
  :rules="rules"
82
81
  :table="table"
83
82
  :loading-form="loadingForm"
84
- :pk_field_name="project.pk_field_name"
85
83
  :project-id="project._id"
86
84
  :has-password="hasPassword"
87
85
  :default-size="defaultSize"
@@ -17,7 +17,6 @@
17
17
  :current-page="currentPage"
18
18
  :list-page="listPage"
19
19
  :search="search"
20
- :pk_field_name="project.pk_field_name"
21
20
  :current-row-id="id"
22
21
  :init-current-row="currentRow"
23
22
  :loading-excel="loadingExcel"
@@ -61,7 +60,6 @@
61
60
  :temp="temp"
62
61
  :saving="saving"
63
62
  :restoring-password="restoringPassword"
64
- :pk_field_name="project.pk_field_name"
65
63
  :has-password="hasPassword"
66
64
  :default-size="defaultSize"
67
65
  :size-button="defaultSize"
@@ -80,7 +78,6 @@
80
78
  :rules="rules"
81
79
  :table="table"
82
80
  :loading-form="loadingForm"
83
- :pk_field_name="project.pk_field_name"
84
81
  :project-id="project._id"
85
82
  :has-password="hasPassword"
86
83
  :default-size="defaultSize"
@@ -228,7 +225,7 @@ export default {
228
225
  const vals = newValue.map(c => c._id)
229
226
  triggerSearch[localKey] = { val: vals, t: type, op: operation }
230
227
  } else {
231
- const val = typeof newValue === 'object' ? newValue[this.pk_field_name] : newValue
228
+ const val = typeof newValue === 'object' ? newValue._id : newValue
232
229
  triggerSearch[localKey] = { val, t: type, op: operation }
233
230
  }
234
231
  } else {
@@ -224,7 +224,7 @@
224
224
  <div
225
225
  v-else
226
226
  :class="['size-5 rounded-full border bg-white cursor-pointer', {
227
- '!border-coreBlue border-[6px]': currentRow && scope.row[pk_field_name] === currentRow[pk_field_name]
227
+ '!border-coreBlue border-[6px]': currentRow && scope.row._id === currentRow._id
228
228
  }]"
229
229
  />
230
230
  </div>
@@ -247,7 +247,7 @@
247
247
  <el-table-column v-if="selectedList" width="35" label="#">
248
248
  <template slot-scope="scope">
249
249
  <div @click.prevent="$emit('selection-change', scope.row)">
250
- <el-checkbox :value="selectedList.some(c => c[pk_field_name] === scope.row[pk_field_name])" />
250
+ <el-checkbox :value="selectedList.some(c => c._id === scope.row._id)" />
251
251
  </div>
252
252
  </template>
253
253
  </el-table-column>
@@ -367,7 +367,6 @@
367
367
  <card-list
368
368
  :list="list"
369
369
  :columns="columns"
370
- :pk_field_name="pk_field_name"
371
370
  :loading="loading"
372
371
  @update="$emit('update', $event)"
373
372
  @delete="$emit('delete', $event)"
@@ -471,7 +470,6 @@ export default {
471
470
  api_id: { type: [String, Number], default: null },
472
471
  api_title: { type: [String, Number], default: null },
473
472
  hasHandbook: { type: Boolean, default: false },
474
- pk_field_name: { type: String, default: '_id' },
475
473
  fill_field: { type: String, default: '' },
476
474
  showPkid: { type: Boolean, default: false },
477
475
  loading: { type: Boolean, default: false },
@@ -822,9 +820,9 @@ export default {
822
820
  const { row } = props
823
821
  let classNames = ''
824
822
  if (this.multiple) {
825
- classNames = [this.currentRows.some(c => c[this.pk_field_name] === row[this.pk_field_name]) ? 'current-row' : '']
823
+ classNames = [this.currentRows.some(c => c._id === row._id) ? 'current-row' : '']
826
824
  } else {
827
- classNames = [this.currentRow && row[this.pk_field_name] === this.currentRow[this.pk_field_name] ? 'current-row' : '']
825
+ classNames = [this.currentRow && row._id === this.currentRow._id ? 'current-row' : '']
828
826
  }
829
827
  const dangerDay = 0
830
828
  const warningDay = 2
@@ -4,7 +4,6 @@
4
4
  :col="col"
5
5
  :temp="scope.row"
6
6
  project-id="5"
7
- pk_field_name="_id"
8
7
  default-size="small"
9
8
  com-type="inline"
10
9
  @temp-change="modelValue = $event"
@@ -215,7 +215,7 @@ export default {
215
215
  const vals = newValue.map(c => c._id)
216
216
  triggerSearch[localKey] = { val: vals, t: type, op: operation }
217
217
  } else {
218
- const val = typeof newValue === 'object' ? newValue[this.pk_field_name] : newValue
218
+ const val = typeof newValue === 'object' ? newValue._id : newValue
219
219
  triggerSearch[localKey] = { val, t: type, op: operation }
220
220
  }
221
221
  } else {
@@ -147,8 +147,7 @@ export default {
147
147
  type: [Boolean, Number, String],
148
148
  default: false
149
149
  },
150
- trigger_fields: { type: String, default: null },
151
- pk_field_name: { type: String, default: null }
150
+ trigger_fields: { type: String, default: null }
152
151
  },
153
152
  data () {
154
153
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eztech-core-components",
3
- "version": "1.0.45",
3
+ "version": "1.0.46",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -40,9 +40,6 @@ export const tableComputed = {
40
40
  localeId () {
41
41
  return this.tempLocaleId || this.locale?._id || (this.locales?.length ? this.locales[0]._id : null)
42
42
  },
43
- pk_field_name () {
44
- return this.project ? this.project.pk_field_name : '_id'
45
- },
46
43
  url () {
47
44
  return this.customUrl || `${this.subUrl || ''}${this.projectId}/${this.tableName}`
48
45
  },
@@ -399,7 +396,7 @@ export const tableMethods = {
399
396
  this.selectedList = []
400
397
  },
401
398
  handleSelectionChange (row) {
402
- const index = this.selectedList.findIndex(c => c[this.pk_field_name] === row[this.pk_field_name])
399
+ const index = this.selectedList.findIndex(c => c._id === row._id)
403
400
  if (index > -1) {
404
401
  this.selectedList.splice(index, 1)
405
402
  } else {
@@ -591,7 +588,7 @@ export const tableMethods = {
591
588
  setParentVal (obj) {
592
589
  if (this.subColumn && obj) {
593
590
  if (this.inlineParentTemp) {
594
- obj[this.subColumn.col_field] = cloneDeep(this.inlineParentTemp) // ? this.parentRow[this.pk_field_name] : null
591
+ obj[this.subColumn.col_field] = cloneDeep(this.inlineParentTemp)
595
592
  } else {
596
593
  obj[this.subColumn.col_field] = cloneDeep(this.parentRow)
597
594
  }
@@ -685,7 +682,7 @@ export const tableMethods = {
685
682
  this.$nuxt.error({ statusCode: 402 })
686
683
  }
687
684
  const temp = {
688
- [this.pk_field_name]: data[this.pk_field_name],
685
+ _id: data._id,
689
686
  work_families: data.work_families,
690
687
  employee_history_text: data.employee_history_text,
691
688
  employee_degree_text: data.employee_degree_text,
@@ -717,7 +714,7 @@ export const tableMethods = {
717
714
  this.resetedTemp()
718
715
  }
719
716
  } else if (this.isFormSub) {
720
- this.search[this.subColumn.col_field] = { val: this.parentRow ? this.parentRow[this.pk_field_name] : 'null', t: 'number', op: 'eq' }
717
+ this.search[this.subColumn.col_field] = { val: this.parentRow ? this.parentRow._id : 'null', t: 'number', op: 'eq' }
721
718
  const trigger_fields = getTriggerFields(this.subColumn.trigger_fields)
722
719
  for (const { localKey, localVal, type, operation } of trigger_fields) {
723
720
  if (localVal.includes('#')) {
@@ -740,7 +737,7 @@ export const tableMethods = {
740
737
  // this.$nuxt.error({ statusCode: 402 })
741
738
  }
742
739
  const temp = {
743
- [this.pk_field_name]: data[this.pk_field_name],
740
+ _id: data._id,
744
741
  work_families: data.work_families,
745
742
  employee_history_text: data.employee_history_text,
746
743
  employee_degree_text: data.employee_degree_text,
@@ -761,8 +758,8 @@ export const tableMethods = {
761
758
  if (this.isXypLog) {
762
759
  temp.xyp_log_id = data.xyp_log_id ?? null
763
760
  }
764
- if (this.parentRow && has(this.parentRow, this.pk_field_name)) {
765
- temp[this.subColumn.col_field] = this.parentRow[this.pk_field_name]
761
+ if (this.parentRow && has(this.parentRow, '_id')) {
762
+ temp[this.subColumn.col_field] = this.parentRow._id
766
763
  }
767
764
  this.temp = Object.assign({}, this.defaultTemp, temp)
768
765
  if (this.resetedTemp) {
@@ -794,14 +791,14 @@ export const tableMethods = {
794
791
  this.updateGroupName = updateGroupName
795
792
  this.tid = row.tid
796
793
  setTimeout(() => {
797
- this.id = row[this.pk_field_name]
794
+ this.id = row._id
798
795
  }, 100)
799
796
  },
800
797
  handleCurrentRowChange (row) {
801
798
  if (Array.isArray(row)) {
802
799
  this.currentRows = row
803
800
  } else {
804
- this.currentRowId = row[this.pk_field_name]
801
+ this.currentRowId = row._id
805
802
  this.currentRow = row
806
803
  }
807
804
  },
@@ -972,7 +969,7 @@ export const tableMethods = {
972
969
  if (this.locales?.length && data.locale_id !== this.localeId) {
973
970
  // console.log('Хэлний сонголтын тоог нэмнэ.')
974
971
  } else if (has(this.data, 'list')) {
975
- const index = this.data.list.findIndex(c => c[this.pk_field_name] === data[this.pk_field_name])
972
+ const index = this.data.list.findIndex(c => c._id === data._id)
976
973
  if (index > -1) {
977
974
  this.list.splice(index, 1, data)
978
975
  } else {
@@ -982,7 +979,6 @@ export const tableMethods = {
982
979
  this.data.list.sort(this.handleListSort)
983
980
  }
984
981
  this.set_unsaved_changes(false)
985
- // this.currentRowId = data[this.pk_field_name]
986
982
  if (this.handleSaved) {
987
983
  this.handleSaved(data)
988
984
  } else {
@@ -1002,7 +998,7 @@ export const tableMethods = {
1002
998
  handleListSort (a, b) {
1003
999
  const getOrder = (ind = 0) => {
1004
1000
  if ((this.sorts?.length || 0) <= ind) {
1005
- return Number(get(a, this.pk_field_name)) - Number(get(b, this.pk_field_name))
1001
+ return Number(get(a, '_id')) - Number(get(b, '_id'))
1006
1002
  }
1007
1003
  const sort = this.sorts[ind]
1008
1004
  let aVal = get(a, sort.prop)
@@ -1036,7 +1032,7 @@ export const tableMethods = {
1036
1032
  ref_column: 'name'
1037
1033
  })
1038
1034
  this.loading = true
1039
- await this.$axios.delete(`${this.urlDelete || this.url}/${row[this.pk_field_name]}`, {
1035
+ await this.$axios.delete(`${this.urlDelete || this.url}/${row._id}`, {
1040
1036
  data: { ...data, tid: row.tid }
1041
1037
  })
1042
1038
  } else {
@@ -1045,11 +1041,11 @@ export const tableMethods = {
1045
1041
  inputErrorMessage: '300 тэмдэгтээс хэтрэхгүй тэмдэгт бичнэ үү.'
1046
1042
  })
1047
1043
  this.loading = true
1048
- await this.$axios.delete(`${this.urlDelete || this.url}/${row[this.pk_field_name]}`, {
1044
+ await this.$axios.delete(`${this.urlDelete || this.url}/${row._id}`, {
1049
1045
  data: { description: result.value, tid: row.tid }
1050
1046
  })
1051
1047
  }
1052
- const index = this.list.findIndex(c => c[this.pk_field_name] === row[this.pk_field_name])
1048
+ const index = this.list.findIndex(c => c._id === row._id)
1053
1049
  if (index > -1) {
1054
1050
  this.count--
1055
1051
  this.list.splice(index, 1)
@@ -1074,7 +1070,7 @@ export const tableMethods = {
1074
1070
  await this.beforeGetList()
1075
1071
  }
1076
1072
  if (this.subColumn) {
1077
- this.search[this.subColumn.col_field] = { val: this.parentRow[this.pk_field_name], t: 'number', op: 'eq' }
1073
+ this.search[this.subColumn.col_field] = { val: this.parentRow._id, t: 'number', op: 'eq' }
1078
1074
  const trigger_fields = getTriggerFields(this.subColumn.trigger_fields)
1079
1075
  for (const { localKey, localVal, type, operation } of trigger_fields) {
1080
1076
  if (localVal.includes('#')) {
@@ -1134,7 +1130,7 @@ export const tableMethods = {
1134
1130
  this.count = 0
1135
1131
  return
1136
1132
  }
1137
- this.search[this.subColumn.col_field] = { val: this.parentRow ? this.parentRow[this.pk_field_name] : 'null', t: 'number', op: 'eq' }
1133
+ this.search[this.subColumn.col_field] = { val: this.parentRow ? this.parentRow._id : 'null', t: 'number', op: 'eq' }
1138
1134
  const trigger_fields = getTriggerFields(this.subColumn.trigger_fields)
1139
1135
  for (const { localKey, localVal, type, operation } of trigger_fields) {
1140
1136
  if (localVal.includes('#')) {