adtec-core-package 2.1.4 → 2.1.6

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": "adtec-core-package",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -71,6 +71,7 @@
71
71
  height="100%"
72
72
  @select="selectRows"
73
73
  @select-all="selectRows"
74
+ :row-class-name="rowClassName"
74
75
  style="margin-top: 8px"
75
76
  >
76
77
  <el-table-column
@@ -78,6 +79,7 @@
78
79
  width="38"
79
80
  :show-overflow-tooltip="false"
80
81
  header-align="center"
82
+ :selectable="(row: IMdmEmployee) => row.isValid === '1'"
81
83
  v-if="multiple"
82
84
  >
83
85
  </el-table-column>
@@ -144,15 +146,18 @@ const props = withDefaults(defineProps<Props<IMdmEmployeeQuery, IMdmEmployee>>()
144
146
  fetchData: EmployeeInfoApi.getMdmEmployeeListByIds,
145
147
  defalutQueryParam: {
146
148
  disabled: false,
147
- deptIds: []
149
+ deptIds: [],
148
150
  },
149
151
  multiple: true,
150
152
  showOrgInfo: true,
151
153
  })
152
- const [queryParam, resetQueryParam] = useResetRefHooks<IMdmEmployeeQuery>({...{
154
+ const [queryParam, resetQueryParam] = useResetRefHooks<IMdmEmployeeQuery>({
155
+ ...{
153
156
  current: 1,
154
- size: frameworkUtils.getPageSize()
155
- }, ...props.defalutQueryParam})
157
+ size: frameworkUtils.getPageSize(),
158
+ },
159
+ ...props.defalutQueryParam,
160
+ })
156
161
  const emit = defineEmits(['success'])
157
162
  const orgDeptTree = ref<IOrgDeptInfo[]>([])
158
163
  const loading = ref(false)
@@ -168,6 +173,11 @@ const [userList, resetUserList] = useResetRefHooks<PageData<IMdmEmployee>>({
168
173
  pages: 0,
169
174
  current: 1,
170
175
  })
176
+ const rowClassName = ({row, rowIndex}: { row: IMdmEmployee; rowIndex: number }) => {
177
+ if (row.isValid !== '1') {
178
+ return 'table-row-disabled'
179
+ }
180
+ }
171
181
  const getTreeData = async () => {
172
182
  try {
173
183
  orgDeptTree.value = await deptInfoApi.getMdmOrgDeptTree({})
@@ -235,7 +245,7 @@ const resetQuery = async () => {
235
245
  queryRef.value?.resetFields()
236
246
  ref_tree.value?.setCheckedKeys([])
237
247
  resetQueryParam()
238
- queryParam.value = {...queryParam.value,...props.defalutQueryParam}
248
+ queryParam.value = {...queryParam.value, ...props.defalutQueryParam}
239
249
  nextTick(() => {
240
250
  ref_tree.value?.setCheckedKeys(queryParam.value.deptIds ?? [])
241
251
  handleQuery()
@@ -292,4 +302,10 @@ defineExpose({
292
302
  resetQuery,
293
303
  })
294
304
  </script>
295
- <style lang="scss" scoped></style>
305
+ <style lang="scss" scoped>
306
+ :deep {
307
+ .table-row-disabled {
308
+ color: var(--el-color-warning);
309
+ }
310
+ }
311
+ </style>
@@ -9,7 +9,6 @@
9
9
  v-for="(data, index) of datas"
10
10
  labelPosition="top"
11
11
  size="default"
12
- :key="data.procInsId"
13
12
  :style="{ width: '100%' }"
14
13
  >
15
14
  <el-form-item label="任务名">
@@ -0,0 +1,115 @@
1
+ import { useEventListener } from '@vueuse/core'
2
+ import { onMounted, onUnmounted } from 'vue'
3
+ const applicationModule = import.meta.env.VITE_APPLICATION_MODULE
4
+ export default function useListenerHooks ({keyUp=true,blur=true,submit=true}:{keyUp?:boolean,blur?:boolean,submit?:boolean} = {}){
5
+ const cleanupFunctions: (() => void)[] = [];
6
+
7
+ onMounted(() => {
8
+
9
+ if (keyUp) {
10
+ const cleanupKeyUp = useEventListener(document, 'keyup', keyUpEvent, true);
11
+ cleanupFunctions.push(cleanupKeyUp);
12
+ }
13
+
14
+ if (blur) {
15
+ const cleanupBlur = useEventListener(document, 'blur', blurEvent, true);
16
+ cleanupFunctions.push(cleanupBlur);
17
+ }
18
+
19
+ if (submit) {
20
+ const cleanupSubmit = useEventListener(document, 'submit', submitEvent, true);
21
+ cleanupFunctions.push(cleanupSubmit);
22
+ }
23
+ });
24
+
25
+ onUnmounted(() => {
26
+ cleanupFunctions.forEach(cleanup => cleanup());
27
+ });
28
+ }
29
+
30
+
31
+ const submitEvent = (event: KeyboardEvent) => {
32
+ const target = event.target as Element
33
+ if (target) {
34
+ const elForm = target.closest?.('.el-form')
35
+ if (elForm) {
36
+ event.stopPropagation()
37
+ }
38
+ }
39
+ }
40
+
41
+
42
+ const blurEvent = (event: KeyboardEvent) => {
43
+ // 确保 target 是 HTMLInputElement 类型
44
+ const inputEl = event.target as HTMLInputElement | null
45
+ if (!inputEl || !(inputEl instanceof HTMLInputElement)) {
46
+ return // 不是 input 元素,跳过
47
+ }
48
+
49
+ // 找到 el-input 根容器
50
+ const elInputWrapper = inputEl.closest('.el-input')
51
+ if (!elInputWrapper) {
52
+ return // 不是 el-input 组件,跳过
53
+ }
54
+
55
+ // 检查是否需要保留空格
56
+ const keepSpace = elInputWrapper.hasAttribute('data-keep-space')
57
+
58
+ // 去空格逻辑(仅当不保留空格时执行)
59
+ if (!keepSpace) {
60
+ const originalValue = inputEl.value
61
+ // 确保值为字符串
62
+ const trimmedValue = (originalValue ?? '').trim()
63
+
64
+ // 避免重复处理导致死循环(值不变时不触发后续逻辑)
65
+ if (trimmedValue !== originalValue) {
66
+ inputEl.value = trimmedValue
67
+ // 手动触发 input 事件,确保 v-model 同步更新
68
+ const inputEvent = new Event('input', {
69
+ bubbles: true,
70
+ cancelable: true
71
+ })
72
+ inputEl.dispatchEvent(inputEvent)
73
+ }
74
+ }
75
+ }
76
+
77
+ const keyUpEvent = (event: KeyboardEvent) => {
78
+ if (event.key === 'Enter') {
79
+ const am = sessionStorage.getItem('applicationModule')
80
+ if (am === applicationModule) {
81
+ //首先判断当前页面有没有抽屉
82
+ const docTemp = event.currentTarget as any
83
+ const doc = docTemp[applicationModule].document as Document
84
+ const loginButton = doc.body.querySelector('.login_button')
85
+ if (loginButton) {
86
+ event.stopPropagation()
87
+ ;(loginButton as HTMLElement).click()
88
+ return
89
+ }
90
+ if (
91
+ doc.body.className === 'el-popup-parent--hidden' ||
92
+ doc.body.querySelector('.el-drawer .open')
93
+ ) {
94
+ const drawer = doc.body.querySelector('.el-drawer__body')
95
+ if (drawer) {
96
+ const target = drawer.querySelector(
97
+ '.' + (sessionStorage.getItem('activationRouteCode') as string) + '_search',
98
+ )
99
+ if (target) {
100
+ event.stopPropagation()
101
+ ;(target as HTMLElement).click()
102
+ }
103
+ }
104
+ } else {
105
+ const target = doc.body.querySelector(
106
+ '.' + (sessionStorage.getItem('activationRouteCode') as string) + '_search',
107
+ )
108
+ if (target) {
109
+ event.stopPropagation()
110
+ ;(target as HTMLElement).click()
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }