adtec-core-package 0.0.8 → 0.0.9

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/eslint.config.js CHANGED
@@ -1,19 +1,56 @@
1
- import pluginVue from 'eslint-plugin-vue'
2
- import vueTsEslintConfig from '@vue/eslint-config-typescript'
3
- import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'
4
-
1
+ import pluginVue from 'eslint-plugin-vue';
2
+ import vueTsEslintConfig from '@vue/eslint-config-typescript';
3
+ import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
5
4
  export default [
6
5
  {
7
6
  name: 'app/files-to-lint',
8
- files: ['**/*.{ts,mts,tsx,vue}'],
7
+ files: ['**/*.{js,ts,mts,tsx,vue}'],
8
+ rules: {
9
+ 'no-console': 'off',
10
+ 'no-debugger': 'off',
11
+ 'no-undef': 'off',
12
+ 'no-unused-vars': 'off',
13
+ 'no-restricted-syntax': 'off',
14
+ 'no-plusplus': 'off',
15
+ 'no-param-reassign': 'off',
16
+ '@typescript-eslint/no-explicit-any': 'off',
17
+ parserOptions: {
18
+ parser: '@typescript-eslint/parser',
19
+ },
20
+ },
9
21
  },
10
-
11
22
  {
12
23
  name: 'app/files-to-ignore',
13
24
  ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
25
+ rules: {
26
+ 'no-console': 'off',
27
+ 'no-debugger': 'off',
28
+ 'no-undef': 'off',
29
+ 'no-unused-vars': 'off',
30
+ 'no-restricted-syntax': 'off',
31
+ 'no-plusplus': 'off',
32
+ 'no-param-reassign': 'off',
33
+ '@typescript-eslint/no-explicit-any': 'off',
34
+ parserOptions: {
35
+ parser: '@typescript-eslint/parser',
36
+ },
37
+ },
38
+ },
39
+ {
40
+ files: ['**/*.{ts,mts,tsx,vue}'],
41
+ rules: {
42
+ 'no-console': 'off',
43
+ 'no-debugger': 'off',
44
+ 'no-undef': 'off',
45
+ 'no-unused-vars': 'off',
46
+ 'no-restricted-syntax': 'off',
47
+ 'no-plusplus': 'off',
48
+ 'no-param-reassign': 'off',
49
+ '@typescript-eslint/no-explicit-any': 'off',
50
+ },
51
+ ignores: ['**/dist/**', '**/dist-ssr/**', '**/coverage/**'],
14
52
  },
15
-
16
53
  ...pluginVue.configs['flat/essential'],
17
54
  ...vueTsEslintConfig(),
18
55
  skipFormatting,
19
- ]
56
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adtec-core-package",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -13,14 +13,16 @@
13
13
  "format": "prettier --write src/"
14
14
  },
15
15
  "dependencies": {
16
- "pinia": "^2.3.0",
17
- "vue": "^3.5.13",
18
- "vue-router": "^4.5.0",
16
+ "@element-plus/icons-vue": "^2.3.1",
17
+ "axios": "^1.7.7",
19
18
  "element-plus": "^2.8.7",
19
+ "pinia": "^2.3.0",
20
20
  "scss": "^0.2.4",
21
21
  "scss-loader": "^0.0.1",
22
- "axios": "^1.7.7",
23
- "@element-plus/icons-vue": "^2.3.1"
22
+ "vue": "^3.5.13",
23
+ "vue-focus-lock": "^3.0.0",
24
+ "vue-router": "^4.5.0",
25
+ "uuid": "^11.0.3"
24
26
  },
25
27
  "devDependencies": {
26
28
  "@tsconfig/node22": "^22.0.0",
@@ -31,15 +33,15 @@
31
33
  "@vue/eslint-config-typescript": "^14.1.3",
32
34
  "@vue/tsconfig": "^0.7.0",
33
35
  "eslint": "^9.14.0",
34
- "sass-embedded": "^1.83.1",
35
36
  "eslint-plugin-vue": "^9.30.0",
37
+ "less": "^4.2.0",
36
38
  "npm-run-all2": "^7.0.2",
37
39
  "prettier": "^3.3.3",
40
+ "sass-embedded": "^1.83.1",
38
41
  "typescript": "~5.6.3",
39
42
  "vite": "^6.0.5",
40
43
  "vite-plugin-vue-devtools": "^7.6.8",
41
- "vue-tsc": "^2.1.10",
42
- "less": "^4.2.0"
44
+ "vue-tsc": "^2.1.10"
43
45
  },
44
46
  "description": "This template should help get you started developing with Vue 3 in Vite.",
45
47
  "main": "/adtec-core-package/adtec-core-package.umd.cjs",
@@ -0,0 +1,218 @@
1
+ <!--创建人 丁盼-->
2
+ <!--说明: ElTableColumnTable-->
3
+ <!--创建时间: 2024/11/27 上午11:56-->
4
+ <!--修改时间: 2024/11/27 上午11:56-->
5
+ <template>
6
+ <div
7
+ @click.stop.prevent="displayClick"
8
+ style="width: 100%; min-height: 35px"
9
+ ref="ref_divView"
10
+ :id="guid"
11
+ :class="getClass"
12
+ tabindex="0"
13
+ >
14
+ <FocusLock v-if="display" :no-focus-guards="false" class="foucs-lock">
15
+ <slot name="edit" v-if="display" tabindex="9"></slot>
16
+ </FocusLock>
17
+ <slot v-else name="view"></slot>
18
+ </div>
19
+ </template>
20
+ <script setup lang="ts">
21
+ import { computed, getCurrentInstance, onMounted, onUnmounted, ref, watch } from 'vue'
22
+ import {
23
+ useActiveElement,
24
+ useEventBus,
25
+ useFocus,
26
+ watchPausable,
27
+ } from '@vueuse/core'
28
+ import FocusLock from 'vue-focus-lock'
29
+ const ref_divView = ref()
30
+ import { v4 as uuidv4 } from 'uuid'
31
+ // const { focused } = useFocusWithin(ref_divView)
32
+ const { focused: paragraphFocus } = useFocus(ref_divView)
33
+ const display = ref(false)
34
+ const guid = uuidv4()
35
+ const bus = useEventBus<string>('elTableColumnEdit')
36
+ const bus1 = useEventBus<string>(guid)
37
+ // const props = defineProps<{
38
+ // tableRef: any
39
+ // }>()
40
+ const activeElement = useActiveElement()
41
+ watch(activeElement, (el: any) => {
42
+ // //判断当前点击元素是否在表格范围内
43
+ if (props.isEdit) {
44
+ let el1: any = el
45
+ let b = true
46
+ let c = false
47
+ let f = true
48
+ while (b) {
49
+ if (el1.className?.indexOf('el-table') > -1) {
50
+ c = true
51
+ b = false
52
+ } else if (el1.className?.indexOf('el-popper') > -1) {
53
+ b = false
54
+ f = false
55
+ } else {
56
+ el1 = el1.parentNode
57
+ if (el1 === null) {
58
+ b = false
59
+ }
60
+ }
61
+ }
62
+ if (f) {
63
+ if (!c) {
64
+ paragraphFocus.value = false
65
+ display.value = false
66
+ } else {
67
+ //判断当前点击元素ID 是否是当前组件ID
68
+ let el2: any = el
69
+ let d = true
70
+ let e = false
71
+ while (d) {
72
+ if (el2.id === guid) {
73
+ d = false
74
+ e = true
75
+ } else {
76
+ el2 = el2.parentNode
77
+ if (el2 === null) {
78
+ d = false
79
+ }
80
+ }
81
+ }
82
+ if (e) {
83
+ display.value = true
84
+ } else {
85
+ display.value = false
86
+ }
87
+ }
88
+ }
89
+ }
90
+ })
91
+ const instance = getCurrentInstance()
92
+ const table = ref()
93
+ const showOverflowTooltip = ref(false)
94
+ const oldValue = ref()
95
+ const props = withDefaults(
96
+ defineProps<{
97
+ scope?: any
98
+ /**
99
+ * @type boolean
100
+ * @default ''
101
+ * @description 设置是否记录编辑状态,默认为false
102
+ */
103
+ enableEditingStatus?: boolean
104
+ isEdit?: boolean
105
+ }>(),
106
+ {
107
+ /**
108
+ * @type string
109
+ * @default ''
110
+ * @description 设置是否记录编辑状态,默认为falseenableEditingStatus
111
+ */
112
+ enableEditingStatus: false,
113
+ isEdit: true,
114
+ },
115
+ )
116
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
117
+ const { stop, pause, resume } = watchPausable(
118
+ () => props.scope?.row[props.scope.column.property],
119
+ (v) => {
120
+ let val
121
+ if (oldValue.value === undefined || oldValue.value === null) {
122
+ val = ''
123
+ } else {
124
+ val = oldValue.value + ''
125
+ }
126
+ if (v + '' !== val) {
127
+ if (!props.scope.row.isRowEditArr) {
128
+ // eslint-disable-next-line vue/no-mutating-props
129
+ props.scope.row.isRowEditArr = []
130
+ }
131
+ if (props.scope.row.isRowEditArr.indexOf(props.scope.column.property) === -1) {
132
+ // eslint-disable-next-line vue/no-mutating-props
133
+ props.scope.row.isRowEditArr.push(props.scope.column.property)
134
+ }
135
+ } else {
136
+ if (props.scope.row.isRowEditArr) {
137
+ // eslint-disable-next-line vue/no-mutating-props
138
+ props.scope.row.isRowEditArr.splice(
139
+ props.scope.row.isRowEditArr.indexOf(props.scope.column.property),
140
+ 1,
141
+ )
142
+ }
143
+ }
144
+ if (props.scope.row.isRowEditArr && props.scope.row.isRowEditArr.length > 0) {
145
+ // eslint-disable-next-line vue/no-mutating-props
146
+ props.scope.row.isRowEdit = true
147
+ } else {
148
+ // eslint-disable-next-line vue/no-mutating-props
149
+ props.scope.row.isRowEdit = false
150
+ }
151
+ },
152
+ )
153
+
154
+ onMounted(() => {
155
+ if (props.enableEditingStatus) {
156
+ resume()
157
+ } else {
158
+ stop()
159
+ }
160
+ if (props.scope) {
161
+ oldValue.value = props.scope.row[props.scope.column.property]
162
+ }
163
+ let b = true
164
+ let instance1: any = instance
165
+ while (b) {
166
+ if (instance1?.type?.name === 'ElTable' || instance1?.type?.__name === 'ElTable') {
167
+ b = false
168
+ } else {
169
+ instance1 = instance1?.parent
170
+ if (instance1 === null) {
171
+ b = false
172
+ }
173
+ }
174
+ }
175
+ table.value = instance1
176
+ showOverflowTooltip.value = table.value?.props?.showOverflowTooltip
177
+ })
178
+ onUnmounted(() => {
179
+ bus.off(listener)
180
+ bus1.off(listener)
181
+ })
182
+ const getClass = computed(() => {
183
+ let className = showOverflowTooltip.value ? 'showOverflowTooltip' : ''
184
+ if (props.isEdit) {
185
+ return (className += ' el-table-column-edit')
186
+ } else {
187
+ return (className += ' el-table-column-view')
188
+ }
189
+ })
190
+ function listener() {
191
+ display.value = false
192
+ bus.off(listener)
193
+ bus1.off(listener)
194
+ }
195
+ const displayClick = () => {
196
+ if (props.isEdit) {
197
+ bus.emit()
198
+ display.value = true
199
+ bus.on(listener)
200
+ bus1.on(listener)
201
+ }
202
+ }
203
+ </script>
204
+ <style scoped lang="scss">
205
+ .showOverflowTooltip {
206
+ white-space: nowrap;
207
+ overflow: hidden;
208
+ text-overflow: ellipsis;
209
+ }
210
+ .foucs-lock {
211
+ :deep {
212
+ div[data-lock=''] {
213
+ display: flex;
214
+ margin-top: 1.5px;
215
+ }
216
+ }
217
+ }
218
+ </style>
@@ -0,0 +1,61 @@
1
+ <!--创建人 胡啸东-->
2
+ <!--说明: index-->
3
+ <!--创建时间: 2024/12/17 下午3:27-->
4
+ <!--修改时间: 2024/12/17 下午3:27-->
5
+ <template>
6
+ <el-tooltip
7
+ effect="light"
8
+ :content="props.tooltipContent ? props.tooltipContent : props.content"
9
+ placement="top"
10
+ :disabled="isShow"
11
+ >
12
+ <template #content>
13
+ <!-- 此处的默认值先看tooltipContent有没有,没有就给默认content -->
14
+ <slot name="tooltipContent">{{
15
+ props.tooltipContent ? props.tooltipContent : props.content
16
+ }}</slot>
17
+ </template>
18
+ <div class="content" :style="{ width: props.width }" @mouseover="isShowTooltip">
19
+ <span ref="contentRef">
20
+ <!-- 给一个没有写插槽的默认值,兼容纯文本的情况 -->
21
+ <slot name="content">{{ props.content }}</slot>
22
+ </span>
23
+ </div>
24
+ </el-tooltip>
25
+ </template>
26
+ <script setup lang="ts">
27
+ import { ref } from 'vue'
28
+
29
+ // 定义props的类型
30
+
31
+ interface Props {
32
+ content: string
33
+ width: string
34
+ tooltipContent?: string
35
+ }
36
+ // 使用withDefaults来给props赋默认值
37
+ const props = withDefaults(defineProps<Props>(), {
38
+ content: '',
39
+ width: '',
40
+ tooltipContent: '',
41
+ })
42
+ // 使用isShow来控制tooltip是否显示
43
+ let isShow = ref<boolean>(true)
44
+ // 在span标签上定义一个ref
45
+ const contentRef = ref()
46
+ const isShowTooltip = function (): void {
47
+ // 计算span标签的offsetWidth与盒子元素的offsetWidth,给isShow赋值
48
+ if (contentRef.value.parentNode.offsetWidth > contentRef.value.offsetWidth) {
49
+ isShow.value = true
50
+ } else {
51
+ isShow.value = false
52
+ }
53
+ }
54
+ </script>
55
+ <style scoped lang="scss">
56
+ .content {
57
+ overflow: hidden;
58
+ white-space: nowrap;
59
+ text-overflow: ellipsis;
60
+ }
61
+ </style>
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Create by丁盼
3
+ * 说明: ISysUploadFiles
4
+ * 创建时间: 2024/12/2 下午3:29
5
+ * 修改时间: 2024/12/2 下午3:29
6
+ */
7
+ export interface ISysUploadFiles {
8
+ id: string
9
+ name: string
10
+ type: string
11
+ size: number
12
+ md5: string
13
+ path: string
14
+ business: string
15
+ businessId?: string
16
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Create by丁盼
3
+ * 说明: ResponseData
4
+ * 创建时间: 2025/1/14 16:59
5
+ * 修改时间: 2025/1/14 16:59
6
+ */
7
+ export interface ResponseData<T = any> {
8
+ code: string
9
+ msg: string
10
+ data: T
11
+ }
12
+ export interface ResponseError {
13
+ code: string
14
+ msg: string
15
+ url: string
16
+ }
@@ -0,0 +1,216 @@
1
+ /**
2
+ * Create by丁盼
3
+ * 说明: AxiosConfig
4
+ * 创建时间: 2025/1/14 16:58
5
+ * 修改时间: 2025/1/14 16:58
6
+ */
7
+ import axios, { type AxiosResponse } from 'axios'
8
+ import type { ResponseData } from '../interface/ResponseData'
9
+ import { v4 as uuidv4 } from 'uuid'
10
+ import encrypt from './encrypt'
11
+ // @ts-ignore
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+
14
+ import { Md5 } from 'ts-md5'
15
+ import { ElMessage } from 'element-plus'
16
+ import { useEventBus } from '@vueuse/core'
17
+ /** 是否正在刷新的标志 */
18
+ let isRefreshing = false
19
+ const loginAgainBus = useEventBus<string>('loginAgainBus')
20
+ /** 存储请求的数组 */
21
+ let requests: any[] = []
22
+ const request = axios.create({
23
+ timeout: 60000,
24
+ validateStatus(status) {
25
+ return status >= 200 && status < 500
26
+ },
27
+ })
28
+ function setHeaders(config: any) {
29
+ //数据防止篡改
30
+ const Authorization = sessionStorage.getItem('Authorization')
31
+ const signa = 'F2E49299-D0D2-4AA1-87A3-270272EA3D6A'
32
+ let dataJson: string = ''
33
+ if (config.method === 'get') {
34
+ if (config.params) {
35
+ if (typeof config.params === 'string') {
36
+ dataJson = JSON.stringify(JSON.parse(config.params))
37
+ } else {
38
+ dataJson = JSON.stringify(config.params)
39
+ }
40
+ }
41
+ dataJson += config.url
42
+ } else {
43
+ if (config.data) {
44
+ if (typeof config.data === 'string') {
45
+ dataJson = JSON.stringify(JSON.parse(config.data))
46
+ } else {
47
+ dataJson = JSON.stringify(config.data)
48
+ }
49
+ }
50
+ }
51
+
52
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
53
+ // @ts-ignore
54
+ dataJson = dataJson
55
+ .replaceAll('"', '')
56
+ .replaceAll(',', '')
57
+ .replaceAll(':', '')
58
+ .replaceAll('.', '')
59
+ .replaceAll('/', '')
60
+ dataJson = dataJson.split('').sort().join('')
61
+ config.headers.sessionId = sessionStorage.getItem('sessionId')
62
+ config.headers.Authorization = Authorization
63
+ config.headers.signa = Md5.hashStr(Authorization + signa + dataJson)
64
+ config.headers.antiShakeKey = Md5.hashStr(dataJson)
65
+ //防止重放 GUID+当前时间+TOKEN 加密
66
+ const timeDifference = sessionStorage.getItem('timeDifference')
67
+ const id = uuidv4()
68
+ const localTime = new Date().getTime()
69
+ const obj = { timeDifference: timeDifference, guid: id, localTime }
70
+ config.headers.replayToken = encrypt.encrypt(JSON.stringify(obj))
71
+ }
72
+ //用于前端axios 请求防抖
73
+ const debounceTokenCancel = new Map()
74
+ request.interceptors.request.use(
75
+ (config) => {
76
+ setHeaders(config)
77
+ // @ts-ignore
78
+ if (config.isAntiShake) {
79
+ // @ts-ignore
80
+ const antiShakeTime = config.antiShakeTime
81
+ //@ts-ignore
82
+ const antiShakeKey = `${config.method}-${config.url}-${config.antiShakeKey}`
83
+ const cancel = debounceTokenCancel.get(antiShakeKey)
84
+ if (cancel) {
85
+ cancel()
86
+ }
87
+ return new Promise((resolve) => {
88
+ const timer = setTimeout(() => {
89
+ clearTimeout(timer)
90
+ resolve(config)
91
+ }, antiShakeTime)
92
+ debounceTokenCancel.set(antiShakeKey, () => {
93
+ clearTimeout(timer)
94
+ })
95
+ })
96
+ } else {
97
+ return config
98
+ }
99
+ },
100
+ (error: any) => {
101
+ return Promise.resolve(error)
102
+ },
103
+ )
104
+
105
+ // response 拦截
106
+ request.interceptors.response.use(
107
+ async (response: AxiosResponse<ResponseData>) => {
108
+ const { status, data, config } = response
109
+ if (status === 200) {
110
+ if (data.code === '0') {
111
+ return Promise.resolve(response)
112
+ } else if (data.code == '10508') {
113
+ isRefreshing = true
114
+ } else if (data.code == '10401') {
115
+ //TOKen过期
116
+ if (!isRefreshing) {
117
+ isRefreshing = true
118
+ const rToken = sessionStorage.getItem('refreshToken')
119
+ const data = await request.post('/api/system/login/refreshToken', {
120
+ rToken: rToken,
121
+ })
122
+ if (data.data.code === '0') {
123
+ sessionStorage.setItem('Authorization', data.data.data.token)
124
+ sessionStorage.setItem('refreshToken', data.data.data.refreshToken)
125
+ const r = request(config)
126
+ requests.forEach((cb) => {
127
+ cb.fn()
128
+ })
129
+ isRefreshing = false
130
+ requests = []
131
+ return r
132
+ } else {
133
+ isRefreshing = false
134
+ requests = []
135
+ ElMessage.warning({
136
+ showClose: true,
137
+ message: '用户信息已过期,请重新登录',
138
+ grouping: true,
139
+ })
140
+ loginAgainBus.emit('loginAgain')
141
+ throw {
142
+ code: '10508',
143
+ msg: '用户信息已过期,请重新登录',
144
+ url: config.url,
145
+ }
146
+ }
147
+ } else {
148
+ return new Promise((resolve) => {
149
+ requests.push({
150
+ fn: () => {
151
+ //需要重新设置signa
152
+ // setHeaders(config)
153
+ resolve(request(config))
154
+ },
155
+ url: config.url,
156
+ })
157
+ })
158
+ }
159
+ } else {
160
+ return Promise.resolve(response)
161
+ }
162
+ }
163
+ return Promise.resolve(response)
164
+ },
165
+ (error: any) => {
166
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
167
+ // @ts-ignore
168
+ return Promise.reject(error)
169
+ },
170
+ )
171
+ export default <T = any>(config: any) => {
172
+ return request(config)
173
+ .then((res: any) => {
174
+ if (res.status !== 200) {
175
+ throw {
176
+ code: res.status + '',
177
+ msg: res.status + res.statusText,
178
+ url: config.url,
179
+ }
180
+ } else {
181
+ const data = res.data as ResponseData<T>
182
+ if (data.code === '0') {
183
+ return data.data
184
+ } else if (data.code == '10508') {
185
+ ElMessage.warning({
186
+ showClose: true,
187
+ message: '用户信息已过期,请重新登录',
188
+ grouping: true,
189
+ })
190
+ loginAgainBus.emit('loginAgain')
191
+ throw {
192
+ code: data.code,
193
+ msg: data.msg,
194
+ url: config.url,
195
+ }
196
+ } else {
197
+ throw {
198
+ code: data.code,
199
+ msg: data.msg,
200
+ url: config.url,
201
+ }
202
+ }
203
+ }
204
+ })
205
+ .catch((error) => {
206
+ if (error.msg) {
207
+ throw error
208
+ } else {
209
+ throw {
210
+ code: error.response.status + '',
211
+ msg: error.message,
212
+ url: config.url,
213
+ }
214
+ }
215
+ })
216
+ }
@@ -0,0 +1,10 @@
1
+ import JSEncrypt from 'jsencrypt'
2
+ export default {
3
+ encrypt(data: string): string {
4
+ // 读取解析pem格式的秘钥, 生成秘钥实例 (RSAKey)
5
+ const pk = `MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiDRlNQzjeuGxJoXmD1O5fZR/BxmEUdngGQKkFPLshR7x4AZR4gcH9PZu4phJUmZ1F/TEL6BwY0dqIVBQgjhwY4ypKOviCFD85H6dgOzaQ/Akl6QfSpP717vYPgeDC+P1+2+205qoQPyQ7+RiQYgnjyDs8TeVQ3nRaTC+XvxjyS06kIpbobMP5texJ74O96JMSZv6u6QBz+vq7lW0oWMowezWOyv9k+bHfqxUxlvw1gD7WrG3DKy8K9qba3mKJ4SQDJ5kKQ+C4Bb5PakiVB4XTJzNqbXWdQvRs0ZP8TgOJKIkTemjjyTxfa0HSp0U9iHAGBBPt25wc0s8dz4w45mOvQIDAQAB`
6
+ const jsEncrypt = new JSEncrypt()
7
+ jsEncrypt.setPublicKey(pk)
8
+ return jsEncrypt.encrypt(data).toString()
9
+ }
10
+ }
@@ -0,0 +1,55 @@
1
+ import request from './AxiosConfig'
2
+
3
+ export default {
4
+ /**
5
+ * get 请求
6
+ * @param url URL地址
7
+ * @param data 请求数据
8
+ * @param isAntiShake 防抖
9
+ * @param antiShakeTime 防抖时间
10
+ * @param menuId 菜单ID,setInterval 调用接口 请传入当前菜单的菜单ID否则会重新接口权限不正确情况
11
+ */
12
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
13
+ get<T = unknown>(
14
+ url: string,
15
+ params?: any,
16
+ isAntiShake: boolean = false,
17
+ antiShakeTime: number = 500,
18
+ menuId?: string,
19
+ ): Promise<T> {
20
+ //@ts-ignore
21
+ return request<T>({
22
+ url: url,
23
+ method: 'get',
24
+ params: params,
25
+ isAntiShake: isAntiShake,
26
+ antiShakeTime: antiShakeTime,
27
+ menuId: menuId,
28
+ })
29
+ },
30
+ /**
31
+ * post 请求
32
+ * @param url URL地址
33
+ * @param data 请求数据
34
+ * @param isAntiShake 防抖
35
+ * @param antiShakeTime 防抖时间
36
+ * @param menuId 菜单ID,setInterval 调用接口 请传入当前菜单的菜单ID否则会重新接口权限不正确情况
37
+ */
38
+ post<T = unknown>(
39
+ url: string,
40
+ data?: any,
41
+ isAntiShake: boolean = false,
42
+ antiShakeTime: number = 500,
43
+ menuId?: string,
44
+ ): Promise<T> {
45
+ //@ts-ignore
46
+ return request<T>({
47
+ url: url,
48
+ method: 'post',
49
+ data: data,
50
+ isAntiShake: isAntiShake,
51
+ antiShakeTime: antiShakeTime,
52
+ menuId: menuId,
53
+ })
54
+ },
55
+ }