eztech-core-components 1.0.67 → 1.0.69

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.
@@ -340,10 +340,10 @@ export default {
340
340
  },
341
341
  handleDownload (item) {
342
342
  if (item.mimetype === 'application/pdf') {
343
- this.set_pdf_url({ title: 'Файл харах', url: `${this.permittedPath}/${item._id}?tid=${item.tid}${ this.routeId ? `&routeId=${this.routeId}` : ''}` })
343
+ this.set_pdf_url({ title: 'Файл харах', url: `${this.permittedPath}/${item._id}?tid=${item.tid}${this.routeId ? `&routeId=${this.routeId}` : ''}` })
344
344
  } else {
345
345
  const link = document.createElement('a')
346
- link.href = item.public_link || `/api${this.permittedPath}/${item._id}?tid=${item.tid}${ this.routeId ? `&routeId=${this.routeId}` : ''}`
346
+ link.href = item.public_link || `/api${this.permittedPath}/${item._id}?tid=${item.tid}${this.routeId ? `&routeId=${this.routeId}` : ''}`
347
347
  link.setAttribute('download', `${item.orignalname}`)
348
348
  document.body.appendChild(link)
349
349
  link.click()
@@ -224,7 +224,7 @@
224
224
  :no-search="true"
225
225
  :plain-button="true"
226
226
  :parent-level="level"
227
- :serviceName="serviceName"
227
+ :service-name="serviceName"
228
228
  />
229
229
  </div>
230
230
  </fieldset>
@@ -90,7 +90,6 @@
90
90
  </div>
91
91
  </template>
92
92
  <script>
93
- import { isReadonly } from 'vue'
94
93
  import { tableData, tableMethods, tableComputed, tableWatch, getAsyncData } from '../utils/table-helper'
95
94
  export default {
96
95
  name: 'CoreFormTable',
@@ -24,7 +24,7 @@ export default {
24
24
  disabled: { type: Boolean, default: false },
25
25
  controlsPosition: { type: String, default: 'right' },
26
26
  precision: { type: Number, default: null },
27
- size: { type: String, default: null },
27
+ size: { type: String, default: null }
28
28
  },
29
29
  computed: {
30
30
  modelValue: {
@@ -3,13 +3,20 @@
3
3
  <div v-if="loading" class="bg-[#525659] px-20 h-[900px] flex items-center justify-center text-slate-200 text-lg font-medium gap-2">
4
4
  <i class="el-icon-loading" /> Түр хүлээнэ үү..
5
5
  </div>
6
- <div v-else-if="hrefBlob" class="relative w-full h-[900px]">
6
+ <div v-else-if="hrefBlob" class="iframe-wrapper relative w-full h-[900px]">
7
+ <div v-if="isReadonly" class="bg-[#282828] flex flex-col items-center py-10">
8
+ <div class="w-[210mm] max-w-full">
9
+ <pdf-viewer :src="hrefBlob" />
10
+ </div>
11
+ </div>
7
12
  <iframe
13
+ v-else="isReadonly"
8
14
  id="pdfFrame"
9
- :src="hrefBlob + pdfUrlParams"
15
+ :src="hrefBlob"
10
16
  class="w-full h-full"
11
17
  frameborder="0"
12
18
  @load="handlePrintPdf"
19
+ @contextmenu="return false"
13
20
  />
14
21
  </div>
15
22
  </el-dialog>
@@ -27,11 +34,8 @@ export default {
27
34
  },
28
35
  computed: {
29
36
  ...mapGetters('settings', ['env', 'pdfUrl', 'pdfTitle', 'isPdfPrint', 'pdfPageSize']),
30
- pdfUrlParams () {
31
- if (this.pdfUrl.includes('#')) {
32
- return '#' + this.pdfUrl.split('#')[1]
33
- }
34
- return ''
37
+ isReadonly () {
38
+ return this.pdfUrl.includes('#')
35
39
  },
36
40
  visible: {
37
41
  get () {
@@ -73,10 +77,6 @@ export default {
73
77
  }
74
78
  },
75
79
  handlePrintPdf () {
76
- const iframe = document.getElementById('pdfFrame')
77
- if (iframe.contentWindow) {
78
- iframe.contentWindow.document.addEventListener('contextmenu', e => e.preventDefault())
79
- }
80
80
  if (!this.isPdfPrint) {
81
81
  return
82
82
  }
@@ -17,8 +17,8 @@
17
17
  }"
18
18
  >
19
19
  <component
20
- :value="getValue(item.field)"
21
20
  :is="item.component"
21
+ :value="getValue(item.field)"
22
22
  v-bind="item.props"
23
23
  :parent-temp="getParentTemp(item)"
24
24
  :placeholder="item.placeholder || ''"
@@ -1,8 +1,10 @@
1
1
  <template>
2
- <tr :class="['border-b', {
3
- 'bg-coreDanger/20 text-coreDanger font-bold !border-b-coreDanger/30': value?.next_receive_date && $moment(value?.next_receive_date).isBefore($moment()),
4
- 'bg-coreWarning/20 text-coreWarning font-bold !border-b-coreWarning/30': value?.next_receive_date && $moment().isBefore(value?.next_receive_date) && $moment().add(10, 'days').isAfter(value.next_receive_date)
5
- }]">
2
+ <tr
3
+ :class="['border-b', {
4
+ 'bg-coreDanger/20 text-coreDanger font-bold !border-b-coreDanger/30': value?.next_receive_date && $moment(value?.next_receive_date).isBefore($moment()),
5
+ 'bg-coreWarning/20 text-coreWarning font-bold !border-b-coreWarning/30': value?.next_receive_date && $moment().isBefore(value?.next_receive_date) && $moment().add(10, 'days').isAfter(value.next_receive_date)
6
+ }]"
7
+ >
6
8
  <td class="text-center">
7
9
  {{ ind + 1 }}
8
10
  </td>
@@ -110,10 +110,12 @@
110
110
  {{ item.clothe_reg_id?.type_general_id?.name }}
111
111
  </td>
112
112
  </tr>
113
- <tr :key="item._id" :class="['border-b', {
114
- 'bg-coreDanger/20 text-coreDanger font-bold !border-b-coreDanger/30': !item.next_receive_date || $moment(item.next_receive_date).isBefore($moment()),
115
- 'bg-coreWarning/20 text-coreWarning font-bold !border-b-coreWarning/30': item.next_receive_date && $moment().isBefore(item.next_receive_date) && $moment().add(10, 'days').isAfter(item.next_receive_date)
116
- }]">
113
+ <tr
114
+ :key="item._id" :class="['border-b', {
115
+ 'bg-coreDanger/20 text-coreDanger font-bold !border-b-coreDanger/30': !item.next_receive_date || $moment(item.next_receive_date).isBefore($moment()),
116
+ 'bg-coreWarning/20 text-coreWarning font-bold !border-b-coreWarning/30': item.next_receive_date && $moment().isBefore(item.next_receive_date) && $moment().add(10, 'days').isAfter(item.next_receive_date)
117
+ }]"
118
+ >
117
119
  <td class="text-center">
118
120
  {{ index + 1 }}
119
121
  </td>
@@ -180,10 +182,12 @@
180
182
  Хугацаа болсон авах хувцас хэрэгсэл байхгүй байна..
181
183
  </td>
182
184
  </tr>
183
- <tr v-for="(item, index) in expiredClothes" :key="item._id" :class="['border-b', {
184
- 'bg-coreDanger/20 text-coreDanger font-bold !border-b-coreDanger/30': !item.next_receive_date || $moment(item.next_receive_date).isBefore($moment()),
185
- 'bg-coreWarning/20 text-coreWarning font-bold !border-b-coreWarning/30': item.next_receive_date && $moment().isBefore(item.next_receive_date) && $moment().add(10, 'days').isAfter(item.next_receive_date)
186
- }]">
185
+ <tr
186
+ v-for="(item, index) in expiredClothes" :key="item._id" :class="['border-b', {
187
+ 'bg-coreDanger/20 text-coreDanger font-bold !border-b-coreDanger/30': !item.next_receive_date || $moment(item.next_receive_date).isBefore($moment()),
188
+ 'bg-coreWarning/20 text-coreWarning font-bold !border-b-coreWarning/30': item.next_receive_date && $moment().isBefore(item.next_receive_date) && $moment().add(10, 'days').isAfter(item.next_receive_date)
189
+ }]"
190
+ >
187
191
  <td class="text-center">
188
192
  {{ index + 1 }}
189
193
  </td>
@@ -212,10 +216,10 @@
212
216
  </el-tab-pane> -->
213
217
  </el-tabs>
214
218
  <el-dialog
219
+ v-el-drag-dialog
215
220
  :visible.sync="visible"
216
221
  :title="title"
217
222
  width="950px"
218
- v-el-drag-dialog
219
223
  append-to-body
220
224
  :close-on-click-modal="false"
221
225
  >
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div ref="pdfContainer" class="pdf-container" @contextmenu.prevent />
3
+ </template>
4
+
5
+ <script>
6
+ import * as pdfjsLib from 'pdfjs-dist/legacy/build/pdf'
7
+ import pdfjsWorker from 'pdfjs-dist/legacy/build/pdf.worker.entry'
8
+
9
+ pdfjsLib.GlobalWorkerOptions.workerSrc = pdfjsWorker
10
+
11
+ export default {
12
+ props: {
13
+ src: { type: String, required: true } // PDF file path or URL
14
+ },
15
+ mounted () {
16
+ this.renderPDF()
17
+ },
18
+ methods: {
19
+ async renderPDF () {
20
+ const loadingTask = pdfjsLib.getDocument(this.src)
21
+ const pdf = await loadingTask.promise
22
+ const container = this.$refs.pdfContainer
23
+ container.innerHTML = ''
24
+ for (let pageNum = 1; pageNum <= pdf.numPages; pageNum++) {
25
+ const page = await pdf.getPage(pageNum)
26
+ const viewport = page.getViewport({ scale: 2 })
27
+ const canvas = document.createElement('canvas')
28
+ const context = canvas.getContext('2d')
29
+ canvas.height = viewport.height
30
+ canvas.width = viewport.width
31
+ await page.render({ canvasContext: context, viewport }).promise
32
+ container.appendChild(canvas)
33
+ }
34
+ }
35
+ }
36
+ }
37
+ </script>
38
+
39
+ <style>
40
+ .pdf-container {
41
+ display: flex;
42
+ flex-direction: column;
43
+ gap: 10px;
44
+ overflow: auto;
45
+ }
46
+ </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eztech-core-components",
3
- "version": "1.0.67",
3
+ "version": "1.0.69",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -229,7 +229,7 @@ export const tableMethods = {
229
229
  this.formSearching = true
230
230
  const isEmployee = this.table?.name === 'hrm_employees'
231
231
  if (isEmployee && !this.temp?._id) {
232
- const { data } = await this.$axios.get(`one/5/service_search_hrm_employees`, {
232
+ const { data } = await this.$axios.get('one/5/service_search_hrm_employees', {
233
233
  params: {
234
234
  search: JSON.stringify({ [col_field]: { val: this.temp[col_field], t: 'string', op: 'eq' } }),
235
235
  locale_id: this.localeId,
@@ -1551,8 +1551,18 @@ export const getAsyncData = async ({
1551
1551
  }
1552
1552
  }
1553
1553
  if (col.columns && col.columns.length > 0 && !conf.tableHidden) {
1554
- const searchStringTables = ['firearm_gun', 'cstm_crime_places']
1555
- const searchStringFields = ['model_id', 'calibre_id', 'expert_id']
1554
+ const searchStringTables = [
1555
+ 'firearm_gun',
1556
+ 'cstm_crime_places'
1557
+ ]
1558
+ const searchStringFields = [
1559
+ 'model_id',
1560
+ 'calibre_id',
1561
+ 'expert_id'
1562
+ ]
1563
+ const searchAllStringFields = [
1564
+ 'position_id'
1565
+ ]
1556
1566
  conf.columns = getColumns(col.columns, parentKeys.concat(col.col_field), parentFields[col.col_field] || {})
1557
1567
  const showChildColumn = conf.columns?.filter(c => !c.tableHidden && !['color', 'is_ping', 'code'].includes(c.col_field))
1558
1568
  conf.hasChildren = showChildColumn.length > 1
@@ -1577,11 +1587,12 @@ export const getAsyncData = async ({
1577
1587
  conf.props.width = get(confChild, 'props.width')
1578
1588
  conf.props['min-width'] = get(confChild, 'props.min-width')
1579
1589
  }
1580
- if (searchStringTables.includes(table?.name) && searchStringFields.includes(col.col_field)) {
1590
+ if ((searchStringTables.includes(table?.name) && searchStringFields.includes(col.col_field)) || searchAllStringFields.includes(col.col_field)) {
1581
1591
  conf.search_type = confChild?.col_type
1582
1592
  conf.search_key = confChild?.col_key
1583
1593
  conf.search_op = 'start'
1584
1594
  }
1595
+
1585
1596
  // if (['created_by'].includes(conf.col_key)) {
1586
1597
  // conf.child_key = `${conf.col_key}.full_name`
1587
1598
  // conf.search_type = 'string'