vue2-client 1.12.78 → 1.12.80

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.
@@ -908,21 +908,22 @@ export default {
908
908
  this.innerSelectedRows = selectedRows
909
909
  if (this.selectRowMode === 'listView' && !this.clearSelectRowAfterQuery) {
910
910
  if (this.primaryKey) {
911
- // 使用主键去重合并选中的行
912
- const uniqueKeys = [...new Set([...this.selectedRowKeys, ...this.innerSelectedRowKeys])]
913
- this.selectedRowKeys = uniqueKeys
914
- // 使用主键去重合并选中的行数据
915
- const uniqueRows = [...this.selectedRows, ...this.innerSelectedRows].reduce((acc, current) => {
916
- const x = acc.find(item => item[this.primaryKey] === current[this.primaryKey])
917
- if (!x) {
918
- return acc.concat([current])
919
- }
920
- return acc
921
- }, [])
922
- this.selectedRows = uniqueRows
911
+ // 找出被取消选中的行
912
+ const deselectedKeys = this.selectedRowKeys.filter(key => !selectedRowKeys.includes(key))
913
+ // 从已选中的行中移除被取消选中的行
914
+ if (deselectedKeys.length > 0) {
915
+ this.selectedRowKeys = this.selectedRowKeys.filter(key => !deselectedKeys.includes(key))
916
+ this.selectedRows = this.selectedRows.filter(row => !deselectedKeys.includes(row[this.primaryKey]))
917
+ }
918
+ // 添加新选中的行(去重)
919
+ const newSelectedKeys = selectedRowKeys.filter(key => !this.selectedRowKeys.includes(key))
920
+ const newSelectedRows = selectedRows.filter(row => newSelectedKeys.includes(row[this.primaryKey]))
921
+ this.selectedRowKeys = [...this.selectedRowKeys, ...newSelectedKeys]
922
+ this.selectedRows = [...this.selectedRows, ...newSelectedRows]
923
923
  } else {
924
- this.selectedRowKeys = this.selectedRowKeys.concat(this.innerSelectedRowKeys)
925
- this.selectedRows = this.selectedRows.concat(this.innerSelectedRows)
924
+ // 如果没有主键,则直接使用当前选中的行
925
+ this.selectedRowKeys = selectedRowKeys
926
+ this.selectedRows = selectedRows
926
927
  }
927
928
  } else {
928
929
  this.selectedRowKeys = this.innerSelectedRowKeys
@@ -931,7 +932,7 @@ export default {
931
932
  this.isModify = this.innerSelectedRowKeys.length === 1
932
933
  this.isDelete = this.innerSelectedRowKeys.length > 0
933
934
  this.isChoose = this.allowSelectRowNum === 0 ? this.innerSelectedRowKeys.length > 0 : this.innerSelectedRowKeys.length === this.allowSelectRowNum
934
- this.$emit('selectRow', selectedRowKeys, selectedRows)
935
+ this.$emit('selectRow', this.selectedRowKeys, this.selectedRows)
935
936
  },
936
937
  /**
937
938
  * 清除表格选中项
@@ -67,7 +67,7 @@ export default {
67
67
  },
68
68
 
69
69
  // 定义组件事件
70
- emits: ['update:modelValue', 'change', 'prev-week', 'next-week', 'prev-day', 'next-day'],
70
+ emits: ['update:modelValue', 'change', 'prev-week', 'next-week', 'prev-day', 'next-day', 'init'],
71
71
 
72
72
  data () {
73
73
  return {
@@ -122,14 +122,13 @@ export default {
122
122
  async getData (data) {
123
123
  getConfigByName(data, 'af-his', res => {
124
124
  this.config = res
125
+ // 触发初始化事件,传递配置和默认日期
126
+ this.$emit('init', this.baseDate)
125
127
  if (res.defaultValue) {
126
128
  // 如果有默认值,则设置当前选中日期和基准日期
127
129
  this.currentDate = res.defaultValue
128
130
  this.baseDate = res.defaultValue
129
131
  this.$emit('update:modelValue', res.defaultValue)
130
- } else {
131
- // 如果没有默认值,则设置当前选中日期为今天
132
- this.currentDate = dayjs().format('YYYY-MM-DD')
133
132
  }
134
133
 
135
134
  // 执行配置中指定的业务逻辑
@@ -1,90 +1,90 @@
1
- <template>
2
- <div class="list-wrapper" >
3
- <a-list size="large" :data-source="data" itemLayout="horizontal" class="list-container">
4
- <a-list-item slot="renderItem" slot-scope="item, index" class="list-item" @click="handleClick(index)">
5
- {{ item.number }} {{ item.name }}
6
- </a-list-item>
7
- </a-list>
8
- </div>
9
- </template>
10
-
11
- <script>
12
-
13
- import { runLogic } from '@vue2-client/services/api/common'
14
-
15
- export default {
16
- name: 'XList',
17
- props: {
18
- queryParamsName: {
19
- type: Object,
20
- default: 'outpatientWaitLogic'
21
- },
22
- },
23
- inject: ['getComponentByName'],
24
- data () {
25
- return {
26
- data: []
27
- }
28
- },
29
- created () {
30
- this.getData(this.queryParamsName)
31
- },
32
- methods: {
33
- async getData (config) {
34
- runLogic(config, {}, 'af-his').then(res => {
35
- this.data = res
36
- })
37
- },
38
- handleClick (index) {
39
- this.$emit('listClick', this.data[index])
40
- },
41
- refreshList () {
42
- this.getData(this.queryParamsName)
43
- },
44
-
45
- }
46
- }
47
- </script>
48
-
49
- <style scoped>
50
- .list-wrapper {
51
- max-height: 240px;
52
- overflow-y: auto;
53
- cursor: pointer;
54
- padding-right: 2px;
55
- }
56
-
57
- .list-container {
58
- width: 100%;
59
- }
60
-
61
- .list-item {
62
- height: 35px;
63
- border-radius: 6px;
64
- background-color: #F4F4F4;
65
- padding: 8px 15px 7px 15px;
66
- font-size: 16px;
67
- display: flex;
68
- align-items: center;
69
- width: 100%;
70
- border: 1px solid #D9D9D9;
71
- box-sizing: border-box;
72
- margin-bottom: 16px;
73
- white-space: nowrap;
74
- overflow: clip;
75
- }
76
-
77
- /* 自定义滚动条样式 */
78
- .list-wrapper::-webkit-scrollbar {
79
- width: 6px;
80
- }
81
-
82
- .list-wrapper::-webkit-scrollbar-thumb {
83
- background-color: #d9d9d9;
84
- border-radius: 3px;
85
- }
86
-
87
- .list-wrapper::-webkit-scrollbar-track {
88
- background-color: #f0f0f0;
89
- }
90
- </style>
1
+ <template>
2
+ <div class="list-wrapper" >
3
+ <a-list size="large" :data-source="data" itemLayout="horizontal" class="list-container" ref="listRef">
4
+ <a-list-item slot="renderItem" slot-scope="item, index" class="list-item" @click="handleClick(index)">
5
+ {{ item.number }} {{ item.name }}
6
+ </a-list-item>
7
+ </a-list>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+
13
+ import { runLogic } from '@vue2-client/services/api/common'
14
+
15
+ export default {
16
+ name: 'XList',
17
+ props: {
18
+ queryParamsName: {
19
+ type: Object,
20
+ default: 'outpatientWaitLogic'
21
+ },
22
+ },
23
+ inject: ['getComponentByName'],
24
+ data () {
25
+ return {
26
+ data: []
27
+ }
28
+ },
29
+ created () {
30
+ this.getData(this.queryParamsName)
31
+ },
32
+ methods: {
33
+ async getData (config) {
34
+ runLogic(config, {}, 'af-his').then(res => {
35
+ this.data = res
36
+ })
37
+ },
38
+ handleClick (index) {
39
+ this.$emit('listClick', this.data[index])
40
+ },
41
+ refreshList () {
42
+ this.getData(this.queryParamsName)
43
+ },
44
+
45
+ }
46
+ }
47
+ </script>
48
+
49
+ <style scoped>
50
+ .list-wrapper {
51
+ max-height: 240px;
52
+ overflow-y: auto;
53
+ cursor: pointer;
54
+ padding-right: 2px;
55
+ }
56
+
57
+ .list-container {
58
+ width: 100%;
59
+ }
60
+
61
+ .list-item {
62
+ height: 35px;
63
+ border-radius: 6px;
64
+ background-color: #F4F4F4;
65
+ padding: 8px 15px 7px 15px;
66
+ font-size: 16px;
67
+ display: flex;
68
+ align-items: center;
69
+ width: 100%;
70
+ border: 1px solid #D9D9D9;
71
+ box-sizing: border-box;
72
+ margin-bottom: 16px;
73
+ white-space: nowrap;
74
+ overflow: clip;
75
+ }
76
+
77
+ /* 自定义滚动条样式 */
78
+ .list-wrapper::-webkit-scrollbar {
79
+ width: 6px;
80
+ }
81
+
82
+ .list-wrapper::-webkit-scrollbar-thumb {
83
+ background-color: #d9d9d9;
84
+ border-radius: 3px;
85
+ }
86
+
87
+ .list-wrapper::-webkit-scrollbar-track {
88
+ background-color: #f0f0f0;
89
+ }
90
+ </style>
@@ -1,50 +1,50 @@
1
- <template>
2
- <div>
3
- <a-radio-group v-model="innerValue" @change="onChange">
4
- <a-radio v-for="item in data" :key="item.value" :value="item.value">
5
- {{ item.label }}
6
- </a-radio>
7
- </a-radio-group>
8
- </div>
9
- </template>
10
-
11
- <script>
12
- import { getConfigByName } from '@vue2-client/services/api/common'
13
-
14
- export default {
15
- name: 'XRadio',
16
- inject: ['getComponentByName'],
17
- props: {
18
- queryParamsName: {
19
- type: Object,
20
- default: null
21
- },
22
- value: [String, Number]
23
- },
24
- data () {
25
- return {
26
- data: [],
27
- innerValue: null
28
- }
29
- },
30
- created () {
31
- this.getData(this.queryParamsName)
32
- },
33
- watch: {
34
- value (val) {
35
- this.innerValue = val
36
- }
37
- },
38
- methods: {
39
- async getData (data) {
40
- getConfigByName(data, 'af-his', res => {
41
- console.warn(res.radio)
42
- this.data = res.radio
43
- })
44
- },
45
- onChange (e) {
46
- this.$emit('radio', e.target.value)
47
- }
48
- }
49
- }
50
- </script>
1
+ <template>
2
+ <div>
3
+ <a-radio-group v-model="innerValue" @change="onChange">
4
+ <a-radio v-for="item in data" :key="item.value" :value="item.value">
5
+ {{ item.label }}
6
+ </a-radio>
7
+ </a-radio-group>
8
+ </div>
9
+ </template>
10
+
11
+ <script>
12
+ import { getConfigByName } from '@vue2-client/services/api/common'
13
+
14
+ export default {
15
+ name: 'XRadio',
16
+ inject: ['getComponentByName'],
17
+ props: {
18
+ queryParamsName: {
19
+ type: Object,
20
+ default: null
21
+ },
22
+ value: [String, Number]
23
+ },
24
+ data () {
25
+ return {
26
+ data: [],
27
+ innerValue: null
28
+ }
29
+ },
30
+ created () {
31
+ this.getData(this.queryParamsName)
32
+ },
33
+ watch: {
34
+ value (val) {
35
+ this.innerValue = val
36
+ }
37
+ },
38
+ methods: {
39
+ async getData (data) {
40
+ getConfigByName(data, 'af-his', res => {
41
+ console.warn(res.radio)
42
+ this.data = res.radio
43
+ })
44
+ },
45
+ onChange (e) {
46
+ this.$emit('radio', e.target.value)
47
+ }
48
+ }
49
+ }
50
+ </script>
@@ -1,126 +1,126 @@
1
- import { manageApi, post } from '@vue2-client/services/api'
2
- import { handleTree } from '@vue2-client/utils/util'
3
- import { indexedDB } from '@vue2-client/utils/indexedDB'
4
- import { getConfigByName } from '@vue2-client/services/api/common'
5
-
6
- const GetAppDataService = {
7
- install (Vue) {
8
- // 给vue增添对话框显示方法
9
- Vue.$appdata = Vue.prototype.$appdata = GetAppDataService
10
- },
11
- async load () {
12
- const params = {}
13
- await post(manageApi.getDictionaryValue, {}).then((res) => {
14
- Object.assign(params, res)
15
- const badgeItemArray = {}
16
- for (const key of Object.keys(params)) {
17
- badgeItemArray[key] = {}
18
- for (const item of params[key]) {
19
- let status
20
- if (!item.status) {
21
- status = 'none'
22
- } else {
23
- status = item.status
24
- }
25
- badgeItemArray[key][item.value] = {
26
- status: status,
27
- text: item.text
28
- }
29
- }
30
- }
31
- // 追加参数
32
- localStorage.setItem(process.env.VUE_APP_DICTIONARY_KEY, JSON.stringify(params))
33
- localStorage.setItem(process.env.VUE_APP_BADGE_KEY, JSON.stringify(badgeItemArray))
34
- })
35
- },
36
- // 返回树形省市区
37
- async getDivisionsOhChinaForTree () {
38
- // 获取省市区数据
39
- return new Promise((resolve, reject) => {
40
- try {
41
- indexedDB.getByWeb('divisionsOhChina', manageApi.getDivisionsOhChina, {}, res => {
42
- resolve(res)
43
- }, processRes => {
44
- return handleTree(processRes, 'code', 'parentcode')
45
- })
46
- } catch (e) {
47
- reject(e)
48
- }
49
- })
50
- },
51
- // 旧版获取配置中心字典
52
- getDictionaryList (key) {
53
- const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
54
- const object = JSON.parse(str)
55
- return object[key]
56
- },
57
- async getDictValue (dictKey, value, func, isDev = false, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
58
- const processResult = (result) => {
59
- if (!result.value) {
60
- return {
61
- status: 'none',
62
- text: value
63
- }
64
- }
65
- const item = result.value.find(item => item.value == value)
66
- if (item) {
67
- return {
68
- status: item.status || 'none',
69
- text: item.label
70
- }
71
- }
72
- return {
73
- status: 'none',
74
- text: value
75
- }
76
- }
77
- if (func) {
78
- getConfigByName(dictKey, serviceName, result => {
79
- func(processResult(result))
80
- }, isDev)
81
- } else {
82
- const result = await new Promise((resolve) => {
83
- getConfigByName(dictKey, serviceName, resolve, isDev)
84
- })
85
- return processResult(result)
86
- }
87
- },
88
- // 新版获取配置中心字典推荐使用 服务名默认为当前服务
89
- getDictByKey (dictKey, serviceName = process.env.VUE_APP_SYSTEM_NAME, callback, isDev) {
90
- getConfigByName(dictKey, undefined, result => {
91
- callback(result.value)
92
- }, isDev)
93
- },
94
- getParam (key, value, callback) {
95
- const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
96
- const object = JSON.parse(str)
97
- if (object && object[key]) {
98
- const result = object[key]
99
- if (Object.prototype.hasOwnProperty.call(result, value)) {
100
- return result[value]
101
- } else {
102
- return { status: 'none', text: value }
103
- }
104
- }
105
- return null
106
- },
107
- getParams () {
108
- const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
109
- return JSON.parse(str)
110
- },
111
- getSingleValues () {
112
- const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
113
- return JSON.parse(str)
114
- },
115
- getWebConfigByKey (key) {
116
- const str = localStorage.getItem(process.env.VUE_APP_WEB_CONFIG_KEY)
117
- const object = JSON.parse(str)
118
- return object[key]
119
- },
120
- getStylesByKey (key) {
121
- const str = localStorage.getItem(process.env.VUE_APP_WEB_STYLES_KEY)
122
- const object = JSON.parse(str)
123
- return object[key]
124
- },
125
- }
126
- export default GetAppDataService
1
+ import { manageApi, post } from '@vue2-client/services/api'
2
+ import { handleTree } from '@vue2-client/utils/util'
3
+ import { indexedDB } from '@vue2-client/utils/indexedDB'
4
+ import { getConfigByName } from '@vue2-client/services/api/common'
5
+
6
+ const GetAppDataService = {
7
+ install (Vue) {
8
+ // 给vue增添对话框显示方法
9
+ Vue.$appdata = Vue.prototype.$appdata = GetAppDataService
10
+ },
11
+ async load () {
12
+ const params = {}
13
+ await post(manageApi.getDictionaryValue, {}).then((res) => {
14
+ Object.assign(params, res)
15
+ const badgeItemArray = {}
16
+ for (const key of Object.keys(params)) {
17
+ badgeItemArray[key] = {}
18
+ for (const item of params[key]) {
19
+ let status
20
+ if (!item.status) {
21
+ status = 'none'
22
+ } else {
23
+ status = item.status
24
+ }
25
+ badgeItemArray[key][item.value] = {
26
+ status: status,
27
+ text: item.text
28
+ }
29
+ }
30
+ }
31
+ // 追加参数
32
+ localStorage.setItem(process.env.VUE_APP_DICTIONARY_KEY, JSON.stringify(params))
33
+ localStorage.setItem(process.env.VUE_APP_BADGE_KEY, JSON.stringify(badgeItemArray))
34
+ })
35
+ },
36
+ // 返回树形省市区
37
+ async getDivisionsOhChinaForTree () {
38
+ // 获取省市区数据
39
+ return new Promise((resolve, reject) => {
40
+ try {
41
+ indexedDB.getByWeb('divisionsOhChina', manageApi.getDivisionsOhChina, {}, res => {
42
+ resolve(res)
43
+ }, processRes => {
44
+ return handleTree(processRes, 'code', 'parentcode')
45
+ })
46
+ } catch (e) {
47
+ reject(e)
48
+ }
49
+ })
50
+ },
51
+ // 旧版获取配置中心字典
52
+ getDictionaryList (key) {
53
+ const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
54
+ const object = JSON.parse(str)
55
+ return object[key]
56
+ },
57
+ async getDictValue (dictKey, value, func, isDev = false, serviceName = process.env.VUE_APP_SYSTEM_NAME) {
58
+ const processResult = (result) => {
59
+ if (!result.value) {
60
+ return {
61
+ status: 'none',
62
+ text: value
63
+ }
64
+ }
65
+ const item = result.value.find(item => item.value == value)
66
+ if (item) {
67
+ return {
68
+ status: item.status || 'none',
69
+ text: item.label
70
+ }
71
+ }
72
+ return {
73
+ status: 'none',
74
+ text: value
75
+ }
76
+ }
77
+ if (func) {
78
+ getConfigByName(dictKey, serviceName, result => {
79
+ func(processResult(result))
80
+ }, isDev)
81
+ } else {
82
+ const result = await new Promise((resolve) => {
83
+ getConfigByName(dictKey, serviceName, resolve, isDev)
84
+ })
85
+ return processResult(result)
86
+ }
87
+ },
88
+ // 新版获取配置中心字典推荐使用 服务名默认为当前服务
89
+ getDictByKey (dictKey, serviceName = process.env.VUE_APP_SYSTEM_NAME, callback, isDev) {
90
+ getConfigByName(dictKey, undefined, result => {
91
+ callback(result.value)
92
+ }, isDev)
93
+ },
94
+ getParam (key, value, callback) {
95
+ const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
96
+ const object = JSON.parse(str)
97
+ if (object && object[key]) {
98
+ const result = object[key]
99
+ if (Object.prototype.hasOwnProperty.call(result, value)) {
100
+ return result[value]
101
+ } else {
102
+ return { status: 'none', text: value }
103
+ }
104
+ }
105
+ return null
106
+ },
107
+ getParams () {
108
+ const str = localStorage.getItem(process.env.VUE_APP_DICTIONARY_KEY)
109
+ return JSON.parse(str)
110
+ },
111
+ getSingleValues () {
112
+ const str = localStorage.getItem(process.env.VUE_APP_BADGE_KEY)
113
+ return JSON.parse(str)
114
+ },
115
+ getWebConfigByKey (key) {
116
+ const str = localStorage.getItem(process.env.VUE_APP_WEB_CONFIG_KEY)
117
+ const object = JSON.parse(str)
118
+ return object[key]
119
+ },
120
+ getStylesByKey (key) {
121
+ const str = localStorage.getItem(process.env.VUE_APP_WEB_STYLES_KEY)
122
+ const object = JSON.parse(str)
123
+ return object[key]
124
+ },
125
+ }
126
+ export default GetAppDataService