vue2-client 1.8.394 → 1.8.396

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue2-client",
3
- "version": "1.8.394",
3
+ "version": "1.8.396",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --no-eslint",
@@ -26,12 +26,12 @@
26
26
  </template>
27
27
  <script>
28
28
  import { mapState } from 'vuex'
29
- import XReport from '@vue2-client/pages/XReportGridView/XReport.vue'
29
+ // import XReport from '@vue2-client/pages/XReportGridView/XReport.vue'
30
30
 
31
31
  export default {
32
32
  name: 'XAddReport',
33
33
  components: {
34
- XReport
34
+ XReport: () => import('@vue2-client/pages/XReportGridView/XReport.vue'),
35
35
  },
36
36
  props: {
37
37
 
@@ -51,7 +51,14 @@ export default {
51
51
  // 新增或修改业务是否执行中
52
52
  loading: false,
53
53
  // 是否显示新增/修改模态框
54
- visible: false
54
+ visible: false,
55
+ // 选中的处理对象的id号
56
+ selectedId: null,
57
+ }
58
+ },
59
+ provide () {
60
+ return {
61
+ getSelectedId: () => { return this.selectedId }
55
62
  }
56
63
  },
57
64
  computed: {
@@ -64,12 +71,16 @@ export default {
64
71
  init (params) {
65
72
  console.log('params', params)
66
73
  const {
67
- configName = 'medicalRecordCover', serverName = 'af-his', displayOnly = true
74
+ configName = 'medicalRecordCover', serverName = 'af-his', displayOnly = true, selectedId = null
68
75
  } = params
69
76
  this.configName = configName
70
77
  this.serverName = serverName
71
78
  this.displayOnly = displayOnly
72
79
  this.visible = true
80
+ // 有选中项,给选中项赋值
81
+ if (selectedId) {
82
+ this.selectedId = selectedId
83
+ }
73
84
  },
74
85
  close () {
75
86
  this.loading = false
@@ -662,7 +662,10 @@ export default {
662
662
  }
663
663
  // 人员联动框增加监听
664
664
  if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动人员')) {
665
- this.debouncedUserLinkFunc = debounce(this.updateUserOptions, 200)
665
+ this.debouncedUserLinkFunc = debounce(this.updateResOptions('人员'), 200)
666
+ }
667
+ if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动部门')) {
668
+ this.debouncedDepLinkFunc = debounce(this.updateResOptions('部门'), 200)
666
669
  }
667
670
  if (this.attr.type === 'richText') {
668
671
  this.richText = await this.getRichText()
@@ -700,6 +703,10 @@ export default {
700
703
  if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动人员')) {
701
704
  this.debouncedUserLinkFunc()
702
705
  }
706
+ // 数据源来自人员联动时更新数据
707
+ if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString().endsWith(']联动部门')) {
708
+ this.debouncedDepLinkFunc()
709
+ }
703
710
  },
704
711
  deep: true
705
712
  }
@@ -787,9 +794,9 @@ export default {
787
794
  }
788
795
  },
789
796
  // 更新人员下拉框数据
790
- async updateUserOptions () {
791
- if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString()?.endsWith(']联动人员')) {
792
- const searchData = { source: '获取人员', userid: this.currUser.id }
797
+ async updateResOptions (type) {
798
+ if (this?.attr?.keyName?.toString()?.startsWith('search@根据表单项[') && this?.attr?.keyName?.toString()?.endsWith(`]联动${type}`)) {
799
+ const searchData = { source: `获取${type}`, userid: this.currUser.id }
793
800
  const startIndex = this.attr.keyName.indexOf('[') + 1
794
801
  const endIndex = this.attr.keyName.indexOf(']', startIndex)
795
802
  const fromModel = this.attr.keyName.substring(startIndex, endIndex).replace('.', '_')
@@ -904,7 +911,9 @@ export default {
904
911
  const searchData = { source, userid, roleName }
905
912
  // 判断是否根据某个表单项联动 仅返回列表结构并筛选
906
913
  if (source.startsWith('根据表单项[') && source.endsWith(']联动人员')) {
907
- this.updateUserOptions()
914
+ this.updateResOptions('人员')
915
+ } else if (source.startsWith('根据表单项[') && source.endsWith(']联动部门')) {
916
+ this.updateResOptions('部门')
908
917
  } else if (this.attr.type === 'select' || this.attr.type === 'checkbox') {
909
918
  // 仅获取最内层数据
910
919
  searchToListOption(searchData, res => this.getDataCallback(res))
@@ -138,6 +138,7 @@ export default {
138
138
  XAddReport,
139
139
  XImportExcel
140
140
  },
141
+ inject: ['getSelectedId'],
141
142
  data () {
142
143
  return {
143
144
  // 加载状态
@@ -601,6 +602,11 @@ export default {
601
602
  break
602
603
  }
603
604
  }
605
+ },
606
+ mounted () {
607
+ console.log('注入数据', this.getSelectedId()) // 访问祖先组件的数据
608
+ Object.assign(this.fixedAddForm, { selected_id: this.getSelectedId() })
609
+ Object.assign(this.fixedQueryForm, { selected_id: this.getSelectedId() })
604
610
  }
605
611
  }
606
612
  </script>
package/src/main.js CHANGED
@@ -4,10 +4,12 @@ import Router from 'vue-router'
4
4
  import Vuex from 'vuex'
5
5
  import { routerOptions, modules, i18n, message, bootstrap } from '../index'
6
6
  import eventLogPlugin from '@/plugins/EventLogPlugin'
7
+ import findParentData from '@/plugins/FindParentsData'
7
8
 
8
9
  Vue.use(Router)
9
10
  Vue.use(Vuex)
10
11
  Vue.use(eventLogPlugin)
12
+ Vue.use(findParentData)
11
13
 
12
14
  // 创建router store
13
15
  const store = new Vuex.Store({ modules })
@@ -8,7 +8,6 @@
8
8
  @action="action"
9
9
  ref="xFormTable">
10
10
  </x-form-table>
11
- <router-view></router-view>
12
11
  <a-button @click="navigateToAnotherPage">跳转到另一个页面</a-button> <!-- 使用方法进行跳转 -->
13
12
  <a-drawer
14
13
  title="详情信息"
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div>
3
+ <button @click="useExampleMethod">Click Me</button>
4
+ </div>
5
+ </template>
6
+
7
+ <script>
8
+ export default {
9
+ methods: {
10
+ useExampleMethod () {
11
+ console.log(this.$findParentData('experimentData'))
12
+ }
13
+ }
14
+ }
15
+ </script>
@@ -1,9 +1,30 @@
1
1
  <template>
2
- <router-view />
2
+ <div>
3
+ <report-grid />
4
+ <router-view />
5
+ <child-index /> <!-- 添加 childIndex 组件 -->
6
+ </div>
3
7
  </template>
4
8
 
5
9
  <script>
10
+ import ChildIndex from './childIndex.vue' // 引入 ChildIndex 组件
11
+ import ReportGrid from '../ReportGrid/index.vue'
12
+
6
13
  export default {
7
14
  name: 'Example',
15
+ components: {
16
+ ChildIndex, // 注册 ChildIndex 组件
17
+ ReportGrid,
18
+ },
19
+ data () {
20
+ return {
21
+ // 实验数据
22
+ experimentData: {
23
+ // 在这里添加您的实验数据
24
+ key1: 'value1',
25
+ key2: 'value2',
26
+ },
27
+ }
28
+ },
8
29
  }
9
30
  </script>
@@ -0,0 +1,76 @@
1
+ <template>
2
+ <div id="test" v-if="showReport">
3
+ <XReport
4
+ @updateImg="updateImg"
5
+ ref="main"
6
+ :use-oss-for-img="false"
7
+ config-name="medicineMouldCover"
8
+ server-name="af-his"
9
+ :show-img-in-cell="true"
10
+ :display-only="displayOnly"
11
+ :edit-mode="false"
12
+ :show-save-button="false"
13
+ :dont-format="true"/>
14
+ </div>
15
+ </template>
16
+
17
+ <script>
18
+ import XReport from '@vue2-client/pages/XReportGridView/XReport'
19
+ // eslint-disable-next-line no-unused-vars
20
+ import { exportHTMLNodeToPDF } from '@vue2-client/utils/htmlToPDFApi'
21
+
22
+ export default {
23
+ name: 'Example',
24
+ components: {
25
+ XReport
26
+ },
27
+ mounted () {
28
+ console.log(this.$route)
29
+ },
30
+ data () {
31
+ return {
32
+ test: {
33
+ title: {
34
+ type: 'titleKey',
35
+ value: 'f_type'
36
+ },
37
+ designMode: 'json',
38
+ },
39
+ total: 1,
40
+ registerMap: [],
41
+ displayOnly: true,
42
+ showReport: true
43
+ }
44
+ },
45
+ methods: {
46
+ updateImg (data) {
47
+ console.warn('demo', data)
48
+ },
49
+ testExport () {
50
+ this.showReport = false
51
+ this.displayOnly = true
52
+ this.$nextTick(() => {
53
+ this.showReport = true
54
+ setTimeout(() => {
55
+ exportHTMLNodeToPDF('123', '#test')
56
+ this.showReport = false
57
+ this.displayOnly = false
58
+ this.$nextTick(() => {
59
+ this.showReport = true
60
+ })
61
+ }, 500)
62
+ })
63
+ },
64
+ testSave () {
65
+ const result = []
66
+ this.registerMap.forEach(item => {
67
+ result.push(item.exportData())
68
+ })
69
+ console.warn('save', result)
70
+ }
71
+ }
72
+ }
73
+ </script>
74
+ <style scoped>
75
+
76
+ </style>
@@ -68,6 +68,10 @@
68
68
  </XReportDesign>
69
69
  </a-card>
70
70
  </template>
71
+ <!-- 弹出框 -->
72
+ <x-add-report
73
+ ref="xAddReport"
74
+ />
71
75
  </div>
72
76
  </template>
73
77
 
@@ -77,6 +81,7 @@ import HtmlToPdf from '@vue2-client/utils/htmlToPDF'
77
81
  import { getConfigByName } from '@vue2-client/services/api/common'
78
82
  import XReportDesign from './XReportDesign.vue'
79
83
  import { printElement } from './print'
84
+ // import XAddReport from '@vue2-client/base-client/components/common/XAddReport'
80
85
 
81
86
  export default {
82
87
  name: 'XReport',
@@ -173,6 +178,7 @@ export default {
173
178
  }
174
179
  },
175
180
  components: {
181
+ XAddReport: () => import('@vue2-client/base-client/components/common/XAddReport'),
176
182
  XReportDesign
177
183
  },
178
184
  data () {
@@ -233,7 +239,20 @@ export default {
233
239
  }
234
240
  },
235
241
  },
242
+ provide () {
243
+ return {
244
+ openDialog: this.openDialog
245
+ }
246
+ },
236
247
  methods: {
248
+ // 打开弹出框
249
+ openDialog (configName, selectedId) {
250
+ console.log('openDialog', configName, selectedId)
251
+ this.$refs.xAddReport.init({
252
+ configName: configName,
253
+ selectedId: selectedId
254
+ })
255
+ },
237
256
  // 向外暴露图片修改后的数据,某些外部需要自己管理图片的保存与修改
238
257
  updateImg (data) {
239
258
  this.$emit('updateImg', data)
@@ -475,6 +475,7 @@ export default {
475
475
  // tableConfig: {}
476
476
  }
477
477
  },
478
+ inject: ['openDialog'],
478
479
  methods: {
479
480
  executeCustomFunction (cell, ...args) {
480
481
  console.info('Event handled:', cell.eventType, args)
@@ -0,0 +1,17 @@
1
+ export default {
2
+ install (Vue) {
3
+ // 添加公共方法到 Vue 原型上
4
+ Vue.prototype.$findParentData = function (dataName) {
5
+ // 尝试从父组件获取数据
6
+ let parent = this.$parent
7
+ while (parent) {
8
+ const parentData = parent[dataName]
9
+ if (parentData !== undefined) {
10
+ return parentData // 找到返回数据
11
+ }
12
+ parent = parent.$parent // 继续向上寻找
13
+ }
14
+ return null // 如果没有找到,返回空
15
+ }
16
+ }
17
+ }
@@ -169,7 +169,8 @@ const loginGuard = (to, from, next, options) => {
169
169
  r: v4LoginData.r
170
170
  }
171
171
  Vue.$store.commit('account/setLogin', login)
172
- if (!Vue.$store.state?.setting?.menuData) {
172
+ console.log('Vue.$store.state?.setting?.menuData', JSON.stringify(Vue.$store.state?.setting?.menuData))
173
+ if (!Vue.$store.state?.setting?.menuData || Vue.$store.state?.setting?.menuData?.length === 0) {
173
174
  loadRoutes(funcToRouter(v4LoginData.functions))
174
175
  }
175
176
  next()