eztech-core-components 1.0.10 → 1.0.12

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.
@@ -91,22 +91,22 @@ export default {
91
91
  try {
92
92
  this.initted = false
93
93
  const config = await getAsyncData({
94
- tableName: this.refColumn ? this.refColumn.ref_table : this.table_name,
94
+ tableName: this.refColumn?.ref_table || this.table_name,
95
95
  projectId: this.projectId,
96
- sub: this.refColumn ? this.refColumn._id : this.sub,
96
+ sub: this.refColumn?._id || this.sub,
97
97
  $axios: this.$axios,
98
98
  id: this.tempId,
99
99
  apiName: this.apiName,
100
- error: this.$nuxt.error
100
+ error: this.$nuxt.error,
101
+ skipFormReadonly: true
101
102
  })
102
103
  for (const configKey in config) {
103
104
  this[configKey] = config[configKey]
104
105
  }
105
- this.$nextTick(() => {
106
- this.resetSearch()
107
- this.resetDefaultTemp()
108
- this.resetTemp()
109
- })
106
+ await this.$nextTick()
107
+ this.resetSearch()
108
+ this.resetDefaultTemp()
109
+ await this.resetTemp()
110
110
  } catch (err) {
111
111
  this.$showError(err)
112
112
  } finally {
@@ -193,7 +193,7 @@ export default {
193
193
  await this.$showConfirm('Та тухайн хүснэгтийн анхны тохиргоонд буцаах уу?')
194
194
  this.loading = true
195
195
  for (const r of this.list) {
196
- await this.$axios.delete(`1/config_table_users/${r._id}`, { data: { tid: r.tid }})
196
+ await this.$axios.delete(`1/config_table_users/${r._id}`, { data: { tid: r.tid } })
197
197
  }
198
198
  this.handleReload()
199
199
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eztech-core-components",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -0,0 +1,32 @@
1
+ /* eslint-disable */
2
+ import moment from 'moment'
3
+ Number.prototype.$format = function () {
4
+ return new Intl.NumberFormat('mn-MN', { maximumFractionDigits: 2 }).format(this)
5
+ }
6
+ String.prototype.$format = function () {
7
+ const parsedNumber = this.replace(/,/g, '')
8
+ if (parsedNumber && !isNaN(parsedNumber)) {
9
+ return new Intl.NumberFormat('mn-MN', { maximumFractionDigits: 2 }).format(Number(parsedNumber))
10
+ }
11
+ return this
12
+ }
13
+ String.prototype.$date = function () {
14
+ return moment(this).isValid() ? moment(this).format('YYYY/MM/DD') : '-'
15
+ }
16
+ String.prototype.$datetime = function () {
17
+ return moment(this).isValid() ? moment(this).format('YYYY/MM/DD HH:mm') : '-'
18
+ }
19
+ String.prototype.$number = function () {
20
+ const parsedNumber = this.replace(/,/g, '')
21
+ if (parsedNumber && !isNaN(parsedNumber)) {
22
+ return Number(parsedNumber)
23
+ }
24
+ return this
25
+ }
26
+ String.prototype.$postmanLink = function () {
27
+ return this.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>')
28
+ .replace(/\[(.*?)\]/g, '')
29
+ .replace(/[\(](\b(https?|ftp|file):\/\/([-A-Z0-9+&@#%?=~_|!:,.;]*)([-A-Z0-9+&@#%?\/=~_|!:,.;]*)[-A-Z0-9+&@#\/%=~_|])[\)]/ig,
30
+ '<a class="underline text-blue-500" href="$1" target="_blank">$1</a>')
31
+ }
32
+ /* eslint-enable */
package/readme.md ADDED
@@ -0,0 +1 @@
1
+ test
package/store/user.js CHANGED
@@ -1,4 +1,3 @@
1
- import Vue from 'vue'
2
1
  import { cloneDeep } from 'lodash'
3
2
  export const state = () => ({
4
3
  token: null,
@@ -189,7 +188,7 @@ export const actions = {
189
188
  // dispatch('set_user')
190
189
  // dispatch('remove_token')
191
190
  // } catch (err) {
192
- // Vue.prototype.$showError(err)
191
+ // this.$showError(err)
193
192
  // }
194
193
  // },
195
194
  async logout_locked ({ dispatch }) {
@@ -198,19 +197,19 @@ export const actions = {
198
197
  dispatch('remove_token')
199
198
  location.reload()
200
199
  } catch (err) {
201
- Vue.prototype.$showError(err)
200
+ this.$showError(err)
202
201
  }
203
202
  },
204
203
  async logout ({ dispatch, getters }) {
205
204
  try {
206
205
  // console.log('Vue', Vue)
207
- await Vue.prototype.$showConfirm('Та системээс гарах уу?')
206
+ await this.$showConfirm('Та системээс гарах уу?')
208
207
  this.$cookies.remove('idle_email', { path: '/' })
209
208
  await this.$axios.post('auth/logout')
210
209
  dispatch('remove_token')
211
210
  location.reload()
212
211
  } catch (err) {
213
- Vue.prototype.$showError(err)
212
+ this.$showError(err)
214
213
  }
215
214
  }
216
215
  }
@@ -143,9 +143,6 @@ export const getFormComponent = ({
143
143
  props = { ...props, isSimple: true, height: 350 }
144
144
  }
145
145
  } else if (['manyToOne', 'table'].includes(col_type)) {
146
- // if (ref_table === 'hrm_employees') {
147
- // name = 'CustomEmployeeSelect'
148
- // } else
149
146
  if (ref_table === 'hrm_users' && ['archive_classification_item', 'archive_classification_list'].includes(table_name)) {
150
147
  name = 'DocUserSelect'
151
148
  props = { ...props }
@@ -190,9 +187,6 @@ export const getFormComponent = ({
190
187
  name = 'CoreSelect'
191
188
  }
192
189
  const customProps = {}
193
- // if (col_field === 'status_id') {
194
- // customProps.disabled = true
195
- // }
196
190
  props = { ...props, col_field, table_name: ref_table, ref_column, col_multiple, trigger_fields, ...customProps }
197
191
  }
198
192
  return { name, props }
@@ -227,6 +221,7 @@ export const getFormRowSpan = ({ col_field, col_type, col_length }, form_col) =>
227
221
  }
228
222
  return rowSpan
229
223
  }
224
+
230
225
  export const getFormWidth = ({ col_field, col_type, col_length }, form_col) => {
231
226
  let colCount = Number(form_col || 1)
232
227
  if (['html_'].some(c => col_field.startsWith(c))) {
@@ -262,10 +257,7 @@ export const getColWidth = ({ col_type, col_multiple, col_length, col_key, col_f
262
257
  } else if (['manyToOne'].includes(col_type)) {
263
258
  if (col_multiple) {
264
259
  valWidth.width = '180px'
265
- } else {
266
- // console.log('-)
267
260
  }
268
- // console.log(col_type, col_multiple, col_length, col_key)
269
261
  } else if (['datetime'].includes(col_type)) {
270
262
  valWidth.width = isInline ? '160px' : '90px'
271
263
  } else if (['date'].includes(col_type)) {
@@ -310,7 +302,6 @@ export const getColWidth = ({ col_type, col_multiple, col_length, col_key, col_f
310
302
  width: '120px'
311
303
  }
312
304
  }
313
- // console.log('col_field', col_field, col_type, col_key, valWidth)
314
305
  return valWidth
315
306
  }
316
307
  export const isHidden = ({ col_field, col_hidden }, subColumn) => {
@@ -8,5 +8,6 @@ module.exports = {
8
8
  'promise/param-names': 'off',
9
9
  'prefer-regex-literals': 'off',
10
10
  'vue/max-attributes-per-line': 'off',
11
- 'no-irregular-whitespace': 'off'
11
+ 'no-irregular-whitespace': 'off',
12
+ 'no-console': 'off'
12
13
  }
@@ -330,7 +330,7 @@ export const tableMethods = {
330
330
  }
331
331
  }
332
332
  } catch (err) {
333
- this.$log(err)
333
+ this.$log('handleFormSearch', err)
334
334
  }
335
335
  if (!idDownload) {
336
336
  const { data } = await this.$axios.get('xypservice/birth/info', {
@@ -741,13 +741,15 @@ export const tableMethods = {
741
741
  }
742
742
  })
743
743
  if (!data) {
744
- this.$nuxt.error({ statusCode: 402 })
744
+ // Тусламж тэтгэмж ажиллахгүй байсныг засварлав.
745
+ // this.$nuxt.error({ statusCode: 402 })
745
746
  }
746
747
  const temp = {
747
748
  [this.pk_field_name]: data[this.pk_field_name],
748
749
  work_families: data.work_families,
749
750
  employee_history_text: data.employee_history_text,
750
- employee_degree_text: data.employee_degree_text
751
+ employee_degree_text: data.employee_degree_text,
752
+ tid: data.tid
751
753
  }
752
754
  for (const key in this.defaultTemp) {
753
755
  const col = this.columns.find(c => c.col_field === key)
@@ -767,7 +769,7 @@ export const tableMethods = {
767
769
  if (this.parentRow && has(this.parentRow, this.pk_field_name)) {
768
770
  temp[this.subColumn.col_field] = this.parentRow[this.pk_field_name]
769
771
  }
770
- this.temp = Object.assign({}, this.defaultTemp)
772
+ this.temp = Object.assign({}, this.defaultTemp, temp)
771
773
  if (this.resetedTemp) {
772
774
  this.resetedTemp()
773
775
  }