olp-table 5.3.4 → 5.3.5
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 +12 -92
- package/.env.build +0 -1
- package/README.md +0 -26
- package/babel.config.js +0 -5
- package/jsconfig.json +0 -22
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/rmMode.bat +0 -1
- package/src/App.vue +0 -199
- package/src/api/crud.js +0 -22
- package/src/api/dist.js +0 -6
- package/src/assets/iconfont/iconfont.css +0 -20
- package/src/assets/iconfont/iconfont.json +0 -16
- package/src/assets/iconfont/iconfont.ttf +0 -0
- package/src/assets/iconfont/iconfont.woff +0 -0
- package/src/assets/iconfont/iconfont.woff2 +0 -0
- package/src/assets/logo.png +0 -0
- package/src/components/auto-height/index.vue +0 -75
- package/src/components/codemirror-tag.vue +0 -100
- package/src/components/lazy-load-select.vue +0 -107
- package/src/components/ol-dialog-excel.vue +0 -112
- package/src/components/ol-dialog-import.vue +0 -304
- package/src/components/ol-dialog-json.vue +0 -82
- package/src/components/ol-dialog-table.vue +0 -81
- package/src/components/ol-dialog-upload-file.vue +0 -208
- package/src/components/ol-dict-tag.vue +0 -271
- package/src/components/ol-select-dom.vue +0 -71
- package/src/components/ol-table-filter.vue +0 -28
- package/src/components/ol-table-render.vue +0 -44
- package/src/components/ol-table-select.vue +0 -150
- package/src/components/pinia-init.vue +0 -18
- package/src/components/table/model/ModelMixins.js +0 -43
- package/src/components/table/model/model-index.vue +0 -121
- package/src/components/table/model/ot-left-right.vue +0 -18
- package/src/components/table/model/ot-left-tree-right-table.scss +0 -14
- package/src/components/table/model/ot-left-tree-right-table.vue +0 -41
- package/src/components/table/model/ot-top-1-bottom-2.vue +0 -39
- package/src/components/table/model/ot-top-2-bottom-1.vue +0 -38
- package/src/components/table/model/ot-top-2-bottom-2.vue +0 -38
- package/src/components/table/model/ot-top-bottom.vue +0 -18
- package/src/components/table/model/splitpanesModel.css +0 -22
- package/src/components/table/model/splitpanesModel.vue +0 -54
- package/src/components/table/ol-form/index.vue +0 -537
- package/src/components/table/ol-form-v3/index.vue +0 -455
- package/src/components/table/ol-main-form-sub-table/index.vue +0 -601
- package/src/components/table/ol-pager/index.vue +0 -46
- package/src/components/table/ol-table/components/ol-table-column-config/columnIndex.vue +0 -233
- package/src/components/table/ol-table/components/ol-table-column-config/index.vue +0 -145
- package/src/components/table/ol-table/components/ol-table-column-dict-color/index.vue +0 -88
- package/src/components/table/ol-table/index.vue +0 -232
- package/src/components/table/ol-table-operate/index.vue +0 -61
- package/src/components/table/ol-table-search/index.vue +0 -17
- package/src/components/table/ol-table-tool-btn/index.vue +0 -60
- package/src/components/tree/components/o-tree.vue +0 -289
- package/src/components/tree/index.vue +0 -46
- package/src/components/v-component/index.vue +0 -43
- package/src/config/dev-config.js +0 -5
- package/src/config/prod-config.js +0 -5
- package/src/config/shared-config.js +0 -20
- package/src/data.js +0 -9378
- package/src/directives/permission/hasPermi.js +0 -63
- package/src/directives/permission/hasRole.js +0 -30
- package/src/main.js +0 -55
- package/src/mixins/VTMixin/DefaultMethods.js +0 -749
- package/src/mixins/VTMixin/OTMixinBody.js +0 -105
- package/src/mixins/VTMixin/OTMixinBodyFooter.js +0 -93
- package/src/mixins/VTMixin/OTMixinBodyMethods.js +0 -420
- package/src/mixins/VTMixin/OTMixinColumnMethod.js +0 -450
- package/src/mixins/VTMixin/OTMixinInitMethod.js +0 -130
- package/src/mixins/VTMixin/OTMixinPager.js +0 -38
- package/src/mixins/VTMixin/OTMixinSortable.js +0 -43
- package/src/mixins/VTMixin/index.js +0 -18
- package/src/package/index.js +0 -20
- package/src/plugins/axios.js +0 -61
- package/src/store/dict.js +0 -76
- package/src/store/dictType.js +0 -52
- package/src/store/permi.js +0 -45
- package/src/styles/common.scss +0 -37
- package/src/styles/index.scss +0 -48
- package/src/styles/theme.scss +0 -32
- package/src/utils/AESCRUDUtils.js +0 -87
- package/src/utils/DateUtils.js +0 -35
- package/src/utils/ExcelUtil.js +0 -159
- package/src/utils/TableSortUtil.js +0 -91
- package/src/utils/columnProp.js +0 -3
- package/src/utils/groupCompute.js +0 -68
- package/src/utils/http/httpFactory.js +0 -92
- package/src/utils/http/httpFactory2.js +0 -79
- package/src/utils/http/httpUtil.js +0 -123
- package/src/utils/http/httpUtils.js +0 -38
- package/src/utils/loadStyle.js +0 -14
- package/src/utils/message.js +0 -56
- package/src/utils/object.js +0 -80
- package/src/utils/security/TokenUtil.js +0 -19
- package/src/utils/tree.js +0 -54
- package/src/utils/util.js +0 -127
- package/src/views/Test/index.vue +0 -77
- package/src/views/Test/index2.vue +0 -33
- package/src/views/components/btn-config/index.vue +0 -202
- package/src/views/components/option-config/index.vue +0 -192
- package/src/views/db/chineseToEnglish.vue +0 -127
- package/src/views/db/filed.vue +0 -395
- package/src/views/db/index.vue +0 -192
- package/src/views/db/preview/index.vue +0 -139
- package/src/views/db/preview/left.vue +0 -204
- package/src/views/db/preview/right.vue +0 -466
- package/src/views/groupTable/index.vue +0 -137
- package/src/views/groupTable/ol-table-column-config/columnIndex.vue +0 -194
- package/src/views/groupTable/ol-table-column-config/index.vue +0 -92
- package/src/views/table/add-or-edit/config/base-config/index.vue +0 -539
- package/src/views/table/add-or-edit/config/base-config/table-form.vue +0 -333
- package/src/views/table/add-or-edit/config/column-config/header-config.vue +0 -475
- package/src/views/table/add-or-edit/config/column-config/index.vue +0 -790
- package/src/views/table/add-or-edit/config/data/column.js +0 -218
- package/src/views/table/add-or-edit/config/data/crud.js +0 -122
- package/src/views/table/add-or-edit/config/data/events.js +0 -109
- package/src/views/table/add-or-edit/config/data/method.js +0 -127
- package/src/views/table/add-or-edit/config/data/option.js +0 -725
- package/src/views/table/add-or-edit/config/data/page.js +0 -79
- package/src/views/table/add-or-edit/config/field-config/filed-config-table.vue +0 -42
- package/src/views/table/add-or-edit/config/field-config/index.vue +0 -91
- package/src/views/table/add-or-edit/config/form-config/index.vue +0 -1179
- package/src/views/table/add-or-edit/config/index.vue +0 -376
- package/src/views/table/add-or-edit/config/initFormObject.js +0 -25
- package/src/views/table/add-or-edit/config/script-config/LeftMeun.vue +0 -71
- package/src/views/table/add-or-edit/config/script-config/index.vue +0 -70
- package/src/views/table/add-or-edit/config/table-config/btn-config.vue +0 -340
- package/src/views/table/add-or-edit/config/table-config/btn-sort.vue +0 -132
- package/src/views/table/add-or-edit/config/table-config/index.vue +0 -446
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config-table-model.vue +0 -41
- package/src/views/table/add-or-edit/configOld/dataTags/filed-config.vue +0 -74
- package/src/views/table/add-or-edit/configOld/dataTags/index.vue +0 -439
- package/src/views/table/add-or-edit/configOld/dataTags/set-table-sql.vue +0 -79
- package/src/views/table/add-or-edit/configOld/dataTags/table-on-config.vue +0 -74
- package/src/views/table/add-or-edit/configOld/index.vue +0 -127
- package/src/views/table/add-or-edit/configOld/tableTags/columnConfig.js +0 -5
- package/src/views/table/add-or-edit/configOld/tableTags/index.vue +0 -353
- package/src/views/table/add-or-edit/configOld/tableTags/operation-but-config.vue +0 -75
- package/src/views/table/add-or-edit/configOld/tableTags/tool-but-config.vue +0 -92
- package/src/views/table/add-or-edit/index.vue +0 -201
- package/src/views/table/add-or-edit/themeModel/index.vue +0 -53
- package/src/views/table/add-or-edit/themeModel/init-model-table.vue +0 -48
- package/src/views/table/add-or-edit/themeModel/init-model.vue +0 -81
- package/src/views/table/add-or-edit/themeModel/left-right.vue +0 -24
- package/src/views/table/add-or-edit/themeModel/left-tree-right-table.vue +0 -75
- package/src/views/table/add-or-edit/themeModel/olTableSearchModelMixins.js +0 -42
- package/src/views/table/add-or-edit/themeModel/splitpanesThemeModel.vue +0 -49
- package/src/views/table/add-or-edit/themeModel/top-1-bottom-2.vue +0 -29
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-1.vue +0 -32
- package/src/views/table/add-or-edit/themeModel/top-2-bottom-2.vue +0 -32
- package/src/views/table/add-or-edit/themeModel/top-bottom.vue +0 -14
- package/src/views/table/index.vue +0 -43
- package/src/views/table/index2.vue +0 -199
- package/src/views/table/preview/index.vue +0 -29
- package/src/views/tree/components/config-core-data.vue +0 -85
- package/src/views/tree/components/config-core-table.vue +0 -362
- package/src/views/tree/components/config-core-tree/data/events.js +0 -95
- package/src/views/tree/components/config-core-tree/data/option.js +0 -88
- package/src/views/tree/components/config-core-tree/data/prop.js +0 -28
- package/src/views/tree/components/config-core-tree/index.vue +0 -181
- package/src/views/tree/components/config-core.vue +0 -42
- package/src/views/tree/components/form-config/index.vue +0 -967
- package/src/views/tree/index.vue +0 -424
- package/vue.config.js +0 -44
- /package/{olp-table/demo.html → demo.html} +0 -0
- /package/{olp-table/fonts → fonts}/iconfont.1720006583309.7e4906d9.woff +0 -0
- /package/{olp-table/fonts → fonts}/iconfont.1720006583309.947a27f0.ttf +0 -0
- /package/{olp-table/olp-table.common.js → olp-table.common.js} +0 -0
- /package/{olp-table/olp-table.css → olp-table.css} +0 -0
- /package/{olp-table/olp-table.umd.js → olp-table.umd.js} +0 -0
- /package/{olp-table/olp-table.umd.min.js → olp-table.umd.min.js} +0 -0
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import {nextTick} from "vue";
|
|
2
|
-
import Sortable from "sortablejs";
|
|
3
|
-
|
|
4
|
-
export const updateSort = (vexGridRef, gridOptions, key) => {
|
|
5
|
-
nextTick(() => {
|
|
6
|
-
if (!key) {
|
|
7
|
-
key = 'sort';
|
|
8
|
-
}
|
|
9
|
-
vexGridRef = vexGridRef.value? vexGridRef.value : vexGridRef;
|
|
10
|
-
//el绑定元素需要找到vxe的DOM下的tbody元素
|
|
11
|
-
Sortable.create(vexGridRef.$el.querySelector('.body--wrapper>.vxe-table--body tbody'), {
|
|
12
|
-
animation: 150,//拖拽动画过渡时间
|
|
13
|
-
sort: true,
|
|
14
|
-
handle: '.move', //必须设置该属性,属性值为你要拖动的该单元格的样式名
|
|
15
|
-
// 开始拖拽的时候
|
|
16
|
-
onStart: function (/**Event*/evt) {
|
|
17
|
-
evt.oldIndex;
|
|
18
|
-
},
|
|
19
|
-
onEnd: function ({oldIndex, newIndex, item}) {
|
|
20
|
-
let rowNode = vexGridRef.getRowNode(item);
|
|
21
|
-
newIndex = rowNode.index - oldIndex + newIndex
|
|
22
|
-
let newsArr = getNewArrData(rowNode.index, newIndex, gridOptions.data)
|
|
23
|
-
|
|
24
|
-
for (let i = 0; i < newsArr.length; i++) {
|
|
25
|
-
newsArr[i][key] = i + 1;
|
|
26
|
-
}
|
|
27
|
-
gridOptions.data = newsArr
|
|
28
|
-
gridOptions.updateSortMethod(undefined);
|
|
29
|
-
},
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const updateSortRowCall = (vexGridRef, call) => {
|
|
35
|
-
let el = vexGridRef.value ? vexGridRef.value.$el : vexGridRef.$el;
|
|
36
|
-
//el绑定元素需要找到vxe的DOM下的tbody元素
|
|
37
|
-
return Sortable.create(el.querySelector('.body--wrapper>.vxe-table--body tbody'), {
|
|
38
|
-
animation: 150,//拖拽动画过渡时间
|
|
39
|
-
onEnd: function ({oldIndex, newIndex, item}) {
|
|
40
|
-
let rowNode = vexGridRef.getRowNode(item);
|
|
41
|
-
newIndex = rowNode.index - oldIndex + newIndex
|
|
42
|
-
call(rowNode.index, newIndex)
|
|
43
|
-
},
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const updateSortCall = (vexGridRef, call) => {
|
|
48
|
-
let el = vexGridRef.value ? vexGridRef.value.$el : vexGridRef.$el;
|
|
49
|
-
return nextTick(() => {
|
|
50
|
-
//el绑定元素需要找到vxe的DOM下的tbody元素
|
|
51
|
-
return Sortable.create(el.querySelector('.body--wrapper>.vxe-table--body tbody'), {
|
|
52
|
-
animation: 150,//拖拽动画过渡时间
|
|
53
|
-
sort: true,
|
|
54
|
-
handle: '.move', //必须设置该属性,属性值为你要拖动的该单元格的样式名
|
|
55
|
-
onEnd: function ({oldIndex, newIndex, item}) {
|
|
56
|
-
call(oldIndex, newIndex, item)
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const getNewArrData = (oldIndex, newIndex, data, reFiled) => {
|
|
63
|
-
const list = JSON.parse(JSON.stringify(data)) //保存旧数据
|
|
64
|
-
const targetRow = list.splice(oldIndex, 1)[0] //保存移动的元素并删除原列表中移动的元素
|
|
65
|
-
list.splice(newIndex, 0, targetRow) //插入到目标新索引中
|
|
66
|
-
if (reFiled) {
|
|
67
|
-
let start = Math.min(oldIndex, newIndex)
|
|
68
|
-
let end = Math.max(oldIndex, newIndex)
|
|
69
|
-
for (let i = start; i <= end; i++) {
|
|
70
|
-
start[i][reFiled] = data[i][reFiled]
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return JSON.parse(JSON.stringify(list)) //重新赋值数组
|
|
74
|
-
}
|
|
75
|
-
export const getNewArrDataToolBtn = (oldIndex, newIndex, data, toolBtn) => {
|
|
76
|
-
const list = JSON.parse(JSON.stringify(data)) //保存旧数据
|
|
77
|
-
const targetRow = list.splice(oldIndex, 1)[0] //保存移动的元素并删除原列表中移动的元素
|
|
78
|
-
list.splice(newIndex, 0, targetRow) //插入到目标新索引中
|
|
79
|
-
if (toolBtn) {
|
|
80
|
-
let kw = toolBtn.beforeFunction.split(",");
|
|
81
|
-
let start = Math.min(oldIndex, newIndex)
|
|
82
|
-
let end = Math.max(oldIndex, newIndex)
|
|
83
|
-
for (let i = start; i <= end; i++) {
|
|
84
|
-
list[i][kw[0]] = data[i][kw[0]]
|
|
85
|
-
if (kw.length == 2) {
|
|
86
|
-
toolBtn.updateData[list[i][kw[1]]] = list[i][kw[0]]
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return JSON.parse(JSON.stringify(list)) //重新赋值数组
|
|
91
|
-
}
|
package/src/utils/columnProp.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
function isNumber(value) {
|
|
2
|
-
return!isNaN(parseFloat(value)) && Number.isFinite(Number(value));
|
|
3
|
-
}
|
|
4
|
-
export function groupAndCompute(groupKey, comValue, data) {
|
|
5
|
-
const result = {};
|
|
6
|
-
|
|
7
|
-
// 辅助函数,用于计算分组内的统计值
|
|
8
|
-
function calculateGroupStats(groupItems) {
|
|
9
|
-
const stats = {};
|
|
10
|
-
comValue.forEach(val => {
|
|
11
|
-
const [key, operation = 'sum'] = val.split(':');
|
|
12
|
-
let values = [];
|
|
13
|
-
for (let item of groupItems) {
|
|
14
|
-
if (isNumber(item[key])) {
|
|
15
|
-
values.push(Number(item[key]))
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (values.length === 0) {
|
|
19
|
-
// 如果没有有效值,则设置为 undefined 或其他适当值
|
|
20
|
-
for (let i = 0; i < groupItems.length; i++) {
|
|
21
|
-
if(groupItems[i][key] != undefined){
|
|
22
|
-
stats[key] = groupItems[i][key];
|
|
23
|
-
break
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
} else {
|
|
27
|
-
switch (operation.toLowerCase()) {
|
|
28
|
-
case 'sum':
|
|
29
|
-
stats[key] = values.reduce((a, b) => a + b, 0).toFixed(3);
|
|
30
|
-
break;
|
|
31
|
-
case 'avg':
|
|
32
|
-
stats[key] = (values.reduce((a, b) => a + b, 0) / values.length).toFixed(3);
|
|
33
|
-
break;
|
|
34
|
-
case 'max':
|
|
35
|
-
stats[key] = Math.max(...values).toFixed(3);
|
|
36
|
-
break;
|
|
37
|
-
case 'min':
|
|
38
|
-
stats[key] = Math.min(...values).toFixed(3);
|
|
39
|
-
break;
|
|
40
|
-
default:
|
|
41
|
-
throw new Error(`Unsupported operation: ${operation}`);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
return stats;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
data.forEach(item => {
|
|
49
|
-
const groupKeyStr = groupKey.map(key => item[key]).join('|');
|
|
50
|
-
|
|
51
|
-
if (!result[groupKeyStr]) {
|
|
52
|
-
result[groupKeyStr] = [];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
result[groupKeyStr].push(item);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
// 转换结果为所需格式
|
|
59
|
-
return Object.values(result).map(groupItems => {
|
|
60
|
-
const groupStats = calculateGroupStats(groupItems);
|
|
61
|
-
const group = {};
|
|
62
|
-
groupKey.forEach(key => {
|
|
63
|
-
// 取分组中第一项的分组键值作为代表(假设所有项在分组键上都是相同的)
|
|
64
|
-
group[key] = groupItems[0][key];
|
|
65
|
-
});
|
|
66
|
-
return { ...group, ...groupStats };
|
|
67
|
-
});
|
|
68
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import axios from 'axios'
|
|
2
|
-
|
|
3
|
-
import CONFIG from "@/config/shared-config"
|
|
4
|
-
import object from "@/utils/object";
|
|
5
|
-
import qs from "qs";
|
|
6
|
-
import {ElMessage} from 'element-plus'
|
|
7
|
-
|
|
8
|
-
const httpFactory = axios.create({
|
|
9
|
-
timeout: CONFIG.REQUEST_TIME_OUT,
|
|
10
|
-
baseURL: CONFIG.SERVER_ADDR,
|
|
11
|
-
withCredentials: false,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
httpFactory.defaults.headers.post['Content-Type'] = 'application/json; charset=utf-8'
|
|
16
|
-
httpFactory.defaults.crossDomain = true;
|
|
17
|
-
httpFactory.defaults.withCredentials = true; //设置cross跨域 并设置访问权限 允许跨域携带cookie信息
|
|
18
|
-
|
|
19
|
-
httpFactory.interceptors.request.use(config => {
|
|
20
|
-
config.meta = {startTime: new Date()}; // 为这个请求设置开始时间
|
|
21
|
-
/*CONFIG.SECURITY.TOKEN.EXCLUDE_URL.forEach((url) => {
|
|
22
|
-
if (!config.url.endsWith(url)) {
|
|
23
|
-
//添加认证token
|
|
24
|
-
config.headers[CONFIG.TOKEN_AUTHENTICATION] = securityUtils.getToken();
|
|
25
|
-
}
|
|
26
|
-
});*/
|
|
27
|
-
if (config.Accept == "KV") {
|
|
28
|
-
config.headers['Content-Type'] = "application/x-www-form-urlencoded; charset=UTF-8";
|
|
29
|
-
}
|
|
30
|
-
return config
|
|
31
|
-
}, error => {
|
|
32
|
-
console.error(error)
|
|
33
|
-
})
|
|
34
|
-
httpFactory.interceptors.response.use(response => {
|
|
35
|
-
const headers = response.headers
|
|
36
|
-
if (headers['content-type'] === 'application/octet-stream;charset=utf-8') {
|
|
37
|
-
return response.data
|
|
38
|
-
}
|
|
39
|
-
// data里面的数据要解析,而params里的则不用
|
|
40
|
-
let reqData = response.config.method === 'get' ? response.config.params : response.config.data;
|
|
41
|
-
const resData = response.data;
|
|
42
|
-
if (process.env.NODE_ENV !== 'production' && response.config.url.indexOf("sysDictData/list") == -1) {
|
|
43
|
-
if (typeof reqData === 'string') {
|
|
44
|
-
try {
|
|
45
|
-
if(response.config.Accept == "KV"){
|
|
46
|
-
reqData = decodeURIComponent(reqData);
|
|
47
|
-
reqData = JSON.parse('{"' + reqData.replace(/&/g, '","').replace(/=/g, '":"') + '"}')
|
|
48
|
-
}else{
|
|
49
|
-
reqData = JSON.parse(reqData)
|
|
50
|
-
}
|
|
51
|
-
} catch (e) {
|
|
52
|
-
qs.parse(reqData);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
console.log('\n')
|
|
56
|
-
const duration = new Date() - response.config.meta.startTime; // 计算请求耗时
|
|
57
|
-
console.group(`${duration}ms -> ` + response.config.method + `: ${response.config.url}`)
|
|
58
|
-
console.log('request: ', reqData)
|
|
59
|
-
console.log('response: ', resData, object.clone(resData.data || null));
|
|
60
|
-
console.groupEnd();
|
|
61
|
-
}
|
|
62
|
-
/* if (response.status === httpResponseStatus.SUCCESS) {
|
|
63
|
-
if (resData.code === httpResponseStatus.SUCCESS) {
|
|
64
|
-
return resData
|
|
65
|
-
}
|
|
66
|
-
switch (resData.code) {
|
|
67
|
-
case httpResponseStatus.RESULT_STATUS_OVERTIME:
|
|
68
|
-
router.push("/login")
|
|
69
|
-
break;
|
|
70
|
-
case httpResponseStatus.UNAUTHORIZED || httpResponseStatus.UNAUTHORIZED:
|
|
71
|
-
router.push("/login")
|
|
72
|
-
break
|
|
73
|
-
}
|
|
74
|
-
return Promise.resolve(resData)
|
|
75
|
-
}*/
|
|
76
|
-
return resData;
|
|
77
|
-
}, error => {
|
|
78
|
-
console.error('请求错误', error)
|
|
79
|
-
let {message} = error;
|
|
80
|
-
if (message == "Network Error") {
|
|
81
|
-
message = "后端接口连接异常";
|
|
82
|
-
} else if (message.includes("timeout")) {
|
|
83
|
-
message = "系统接口请求超时";
|
|
84
|
-
} else if (message.includes("Request failed with status code")) {
|
|
85
|
-
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
|
86
|
-
}
|
|
87
|
-
ElMessage.error(message);
|
|
88
|
-
return Promise.reject({code: 500, data: error})
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
export default httpFactory
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import axios from 'axios'
|
|
2
|
-
|
|
3
|
-
import CONFIG from "@/config/shared-config"
|
|
4
|
-
import object from "@/utils/object";
|
|
5
|
-
import qs from "qs";
|
|
6
|
-
import {ElMessage} from 'element-plus'
|
|
7
|
-
|
|
8
|
-
const httpFactory = axios.create({
|
|
9
|
-
timeout: CONFIG.REQUEST_TIME_OUT,
|
|
10
|
-
//baseURL: "http://10.200.16.34/prod-api/",
|
|
11
|
-
//baseURL: "http://172.18.10.21:8888/",
|
|
12
|
-
baseURL: "http://127.0.0.1:8888",
|
|
13
|
-
withCredentials: false,
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
httpFactory.defaults.headers.post['Content-Type'] = 'application/json; charset=utf-8'
|
|
19
|
-
httpFactory.defaults.crossDomain = true;
|
|
20
|
-
|
|
21
|
-
httpFactory.interceptors.request.use(config => {
|
|
22
|
-
config.headers['Authorization'] = 'Bearer 432e0949e0214dd69eb2f652841b3cba';
|
|
23
|
-
config.meta = {startTime: new Date()}; // 为这个请求设置开始时间
|
|
24
|
-
/*CONFIG.SECURITY.TOKEN.EXCLUDE_URL.forEach((url) => {
|
|
25
|
-
if (!config.url.endsWith(url)) {
|
|
26
|
-
//添加认证token
|
|
27
|
-
config.headers[CONFIG.TOKEN_AUTHENTICATION] = securityUtils.getToken();
|
|
28
|
-
}
|
|
29
|
-
});*/
|
|
30
|
-
if (config.Accept == "KV") {
|
|
31
|
-
config.headers['Content-Type'] = "application/x-www-form-urlencoded; charset=UTF-8";
|
|
32
|
-
}
|
|
33
|
-
return config
|
|
34
|
-
}, error => {
|
|
35
|
-
console.error(error)
|
|
36
|
-
})
|
|
37
|
-
httpFactory.interceptors.response.use(response => {
|
|
38
|
-
// data里面的数据要解析,而params里的则不用
|
|
39
|
-
const reqData = response.config.method === 'get' ? response.config.params : response.config.data;
|
|
40
|
-
const resData = response.data;
|
|
41
|
-
if (process.env.NODE_ENV !== 'production' && response.config.url.indexOf("sysDictData/list") == -1) {
|
|
42
|
-
console.log('\n')
|
|
43
|
-
const duration = new Date() - response.config.meta.startTime; // 计算请求耗时
|
|
44
|
-
console.group(response.config.method + `: ${response.config.url} 请求耗时: ${duration}ms`)
|
|
45
|
-
console.log('request: ', typeof reqData === 'string' ? qs.parse(reqData) : reqData ? reqData : null)
|
|
46
|
-
console.log('response: ', resData, object.clone(resData.data || null));
|
|
47
|
-
console.groupEnd();
|
|
48
|
-
}
|
|
49
|
-
/* if (response.status === httpResponseStatus.SUCCESS) {
|
|
50
|
-
if (resData.code === httpResponseStatus.SUCCESS) {
|
|
51
|
-
return resData
|
|
52
|
-
}
|
|
53
|
-
switch (resData.code) {
|
|
54
|
-
case httpResponseStatus.RESULT_STATUS_OVERTIME:
|
|
55
|
-
router.push("/login")
|
|
56
|
-
break;
|
|
57
|
-
case httpResponseStatus.UNAUTHORIZED || httpResponseStatus.UNAUTHORIZED:
|
|
58
|
-
router.push("/login")
|
|
59
|
-
break
|
|
60
|
-
}
|
|
61
|
-
return Promise.resolve(resData)
|
|
62
|
-
}*/
|
|
63
|
-
return resData;
|
|
64
|
-
}, error => {
|
|
65
|
-
console.error('请求错误', error)
|
|
66
|
-
let {message} = error;
|
|
67
|
-
if (message == "Network Error") {
|
|
68
|
-
message = "后端接口连接异常";
|
|
69
|
-
} else if (message.includes("timeout")) {
|
|
70
|
-
message = "系统接口请求超时";
|
|
71
|
-
} else if (message.includes("Request failed with status code")) {
|
|
72
|
-
message = "系统接口" + message.substr(message.length - 3) + "异常";
|
|
73
|
-
}
|
|
74
|
-
ElMessage.error(message);
|
|
75
|
-
return Promise.reject({code: 500, data: error})
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
export default httpFactory
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import http from './httpFactory'
|
|
2
|
-
import qs from 'qs'
|
|
3
|
-
import {ElMessage} from 'element-plus'
|
|
4
|
-
|
|
5
|
-
export const axios = () => {
|
|
6
|
-
return http;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const getBaseURL = () => {
|
|
10
|
-
return http.defaults.baseURL;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param url
|
|
15
|
-
* @param params
|
|
16
|
-
* @param returnDataOnly boolean类型 只返回数据
|
|
17
|
-
* @returns {Promise<unknown>}
|
|
18
|
-
*/
|
|
19
|
-
export const get = (url, params, returnDataOnly, isParams) => {
|
|
20
|
-
params = params ? JSON.parse(JSON.stringify(params)) : {};
|
|
21
|
-
return new Promise((resolve, reject) => {
|
|
22
|
-
http.get(url, isParams == true ? {params: params} : {params}).then(res => {
|
|
23
|
-
if (returnDataOnly != false) {
|
|
24
|
-
if (res.code && res.code !== 200 && res.code !== 0) {
|
|
25
|
-
ElMessage.error(res.msg)
|
|
26
|
-
reject(res);
|
|
27
|
-
}
|
|
28
|
-
resolve(res.data)
|
|
29
|
-
} else {
|
|
30
|
-
resolve(res)
|
|
31
|
-
}
|
|
32
|
-
}).catch(err => {
|
|
33
|
-
reject(err);
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
export const post = (url, params, autoMessage, returnStatus) => {
|
|
38
|
-
return new Promise((resolve, reject) => {
|
|
39
|
-
http.post(url, params).then(res => {
|
|
40
|
-
message(res, autoMessage, returnStatus, resolve);
|
|
41
|
-
}).catch(err => {
|
|
42
|
-
reject(err);
|
|
43
|
-
})
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
export const request = (config, autoMessage, returnStatus) => {
|
|
47
|
-
return new Promise((resolve, reject) => {
|
|
48
|
-
http.request(config).then(res => {
|
|
49
|
-
message(res, autoMessage, returnStatus, resolve);
|
|
50
|
-
}).catch(err => {
|
|
51
|
-
reject(err);
|
|
52
|
-
})
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
export const postQs = (url, params, autoMessage, returnStatus) => {
|
|
56
|
-
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
http.post(url, qs.stringify(params), {Accept: "KV"}).then(res => {
|
|
59
|
-
message(res, autoMessage, returnStatus, resolve);
|
|
60
|
-
}).catch(err => {
|
|
61
|
-
reject(err);
|
|
62
|
-
})
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export const put = (url, params, autoMessage, returnStatus) => {
|
|
67
|
-
return new Promise((resolve, reject) => {
|
|
68
|
-
http.put(url, params).then(res => {
|
|
69
|
-
message(res, autoMessage, returnStatus, resolve);
|
|
70
|
-
}).catch(err => {
|
|
71
|
-
reject(err);
|
|
72
|
-
})
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export const del = (url, params, autoMessage, returnStatus) => {
|
|
77
|
-
return new Promise((resolve, reject) => {
|
|
78
|
-
http({
|
|
79
|
-
url: url, method: 'delete', params: params
|
|
80
|
-
}).then(res => {
|
|
81
|
-
message(res, autoMessage, returnStatus, resolve);
|
|
82
|
-
}).catch(err => {
|
|
83
|
-
reject(err);
|
|
84
|
-
})
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
export const upload = (url, params, onUploadProgress) => {
|
|
88
|
-
return new Promise((resolve, reject) => {
|
|
89
|
-
http.post(url, params,
|
|
90
|
-
{
|
|
91
|
-
timeout: 1000 * 90 * 90,
|
|
92
|
-
onUploadProgress: onUploadProgress,
|
|
93
|
-
headers: {'Content-Type': 'multipart/form-data'}
|
|
94
|
-
}).then(res => {
|
|
95
|
-
resolve(res)
|
|
96
|
-
}).catch(err => {
|
|
97
|
-
reject(err);
|
|
98
|
-
})
|
|
99
|
-
})
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function message(res, autoMessage, returnStatus, resolve) {
|
|
103
|
-
if (autoMessage || autoMessage == undefined) {
|
|
104
|
-
if (res.code == 200 || res.code == 0) {
|
|
105
|
-
if (res.msg) {
|
|
106
|
-
ElMessage.success(res.msg)
|
|
107
|
-
} else {
|
|
108
|
-
ElMessage.success("操作成功!")
|
|
109
|
-
}
|
|
110
|
-
} else {
|
|
111
|
-
ElMessage.error(res.msg)
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
if (returnStatus || returnStatus == undefined) {
|
|
115
|
-
resolve(res.code === 200 || res.code === 0)
|
|
116
|
-
} else {
|
|
117
|
-
resolve(res)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export default {
|
|
122
|
-
get, post, put, del, postQs, request, axios, getBaseURL, upload
|
|
123
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {encryptWithCompress} from "@/utils/AESCRUDUtils";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param url
|
|
6
|
-
* @param params
|
|
7
|
-
* @param returnDataOnly boolean类型 只返回数据
|
|
8
|
-
* @returns {Promise<unknown>}
|
|
9
|
-
*/
|
|
10
|
-
export const get = (http, url, params, returnDataOnly, isParams) => {
|
|
11
|
-
return http.get(url, params, returnDataOnly, isParams);
|
|
12
|
-
}
|
|
13
|
-
export const post = (http, url, params, autoMessage, returnStatus) => {
|
|
14
|
-
return http.post(url, params, autoMessage, returnStatus);
|
|
15
|
-
}
|
|
16
|
-
export const postAes = (http, url, params, autoMessage, returnStatus) => {
|
|
17
|
-
return http.post(url, encryptWithCompress(params), autoMessage, returnStatus);
|
|
18
|
-
}
|
|
19
|
-
export const request = (http, config, autoMessage, returnStatus) => {
|
|
20
|
-
return http.request(config, autoMessage, returnStatus);
|
|
21
|
-
}
|
|
22
|
-
export const postQs = (http, url, params, autoMessage, returnStatus) => {
|
|
23
|
-
return http.postQs(url, params, autoMessage, returnStatus)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const put = (http, url, params, autoMessage, returnStatus) => {
|
|
27
|
-
return http.put(url, params, autoMessage, returnStatus)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const del = (http, url, params, autoMessage, returnStatus) => {
|
|
31
|
-
return http.del(url, params, autoMessage, returnStatus)
|
|
32
|
-
}
|
|
33
|
-
export const upload = (http, url, params, onUploadProgress) => {
|
|
34
|
-
return http.upload(url, params, onUploadProgress)
|
|
35
|
-
}
|
|
36
|
-
export default {
|
|
37
|
-
get, post, put, del, postQs, request
|
|
38
|
-
}
|
package/src/utils/loadStyle.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 动态插入css
|
|
3
|
-
*/
|
|
4
|
-
const url = '//at.alicdn.com/t/c/font_4539076_h16t172a78b.css'
|
|
5
|
-
|
|
6
|
-
export const loadStyle = () => {
|
|
7
|
-
const link = document.createElement('link')
|
|
8
|
-
link.type = 'text/css'
|
|
9
|
-
link.rel = 'stylesheet'
|
|
10
|
-
link.href = url
|
|
11
|
-
const head = document.getElementsByTagName('head')[0]
|
|
12
|
-
head.appendChild(link)
|
|
13
|
-
}
|
|
14
|
-
|
package/src/utils/message.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import {ElMessage, ElNotification} from 'element-plus'
|
|
2
|
-
|
|
3
|
-
export const useMessage = () => {
|
|
4
|
-
|
|
5
|
-
return {
|
|
6
|
-
// 消息提示
|
|
7
|
-
info(content) {
|
|
8
|
-
ElMessage.info(content)
|
|
9
|
-
},
|
|
10
|
-
// 错误消息
|
|
11
|
-
error(content) {
|
|
12
|
-
ElMessage.error(content)
|
|
13
|
-
},
|
|
14
|
-
// 成功消息
|
|
15
|
-
success(content) {
|
|
16
|
-
ElMessage.success(content)
|
|
17
|
-
},
|
|
18
|
-
// 警告消息
|
|
19
|
-
warning(content) {
|
|
20
|
-
ElMessage.warning(content)
|
|
21
|
-
},
|
|
22
|
-
/* // 弹出提示
|
|
23
|
-
alert(content) {
|
|
24
|
-
ElMessageBox.alert(content, t('common.confirmTitle'))
|
|
25
|
-
},
|
|
26
|
-
// 错误提示
|
|
27
|
-
alertError(content) {
|
|
28
|
-
ElMessageBox.alert(content, t('common.confirmTitle'), { type: 'error' })
|
|
29
|
-
},
|
|
30
|
-
// 成功提示
|
|
31
|
-
alertSuccess(content) {
|
|
32
|
-
ElMessageBox.alert(content, t('common.confirmTitle'), { type: 'success' })
|
|
33
|
-
},
|
|
34
|
-
// 警告提示
|
|
35
|
-
alertWarning(content) {
|
|
36
|
-
ElMessageBox.alert(content, t('common.confirmTitle'), { type: 'warning' })
|
|
37
|
-
},*/
|
|
38
|
-
// 通知提示
|
|
39
|
-
notify(content) {
|
|
40
|
-
ElNotification.info(content)
|
|
41
|
-
},
|
|
42
|
-
// 错误通知
|
|
43
|
-
notifyError(content) {
|
|
44
|
-
ElNotification.error(content)
|
|
45
|
-
},
|
|
46
|
-
// 成功通知
|
|
47
|
-
notifySuccess(content) {
|
|
48
|
-
ElNotification.success(content)
|
|
49
|
-
},
|
|
50
|
-
// 警告通知
|
|
51
|
-
notifyWarning(content) {
|
|
52
|
-
ElNotification.warning(content)
|
|
53
|
-
},
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
}
|
package/src/utils/object.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 对象深拷贝
|
|
3
|
-
* @param {Object} obj
|
|
4
|
-
*/
|
|
5
|
-
export const clone = (obj) => {
|
|
6
|
-
return JSON.parse(JSON.stringify(obj));
|
|
7
|
-
}
|
|
8
|
-
export const clear = (obj) => {
|
|
9
|
-
Object.keys(obj).map(key => {
|
|
10
|
-
delete obj[key]
|
|
11
|
-
})
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 对象属性赋值
|
|
15
|
-
* @param obj 被复制对象
|
|
16
|
-
* @param target 赋值对象
|
|
17
|
-
*/
|
|
18
|
-
export const copeProperties = (obj, target) => {
|
|
19
|
-
if (obj && target) {
|
|
20
|
-
Object.keys(obj).forEach((key) => {
|
|
21
|
-
target[key] = obj[key];
|
|
22
|
-
})
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export const convertToStringifiedJson = (str) => {
|
|
26
|
-
// 替换单引号为双引号(如果字符串值本应该包含单引号,这会导致问题)
|
|
27
|
-
let jsonStr = str.replace(/'/g, '"');
|
|
28
|
-
// 确保整个对象用双引号包围
|
|
29
|
-
jsonStr = `{${jsonStr}}`;
|
|
30
|
-
// 移除花括号(如果它们是因为错误地包含在原始字符串中)
|
|
31
|
-
jsonStr = jsonStr.replace(/^{/, '').replace(/}$/, '').replace(/(\w+):(\d+)/g, '"$1":$2');
|
|
32
|
-
// 尝试解析JSON字符串
|
|
33
|
-
let obj = JSON.parse(jsonStr);
|
|
34
|
-
for (let key in obj) {
|
|
35
|
-
if (typeof obj[key] === 'number') {
|
|
36
|
-
obj[key] = obj[key].toString();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return obj;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* 获取两个对象差异属性
|
|
43
|
-
* @param o1 被对照对象
|
|
44
|
-
* @param o2 目标对象
|
|
45
|
-
*/
|
|
46
|
-
const getDifferenceProperties = (o1, o2) => {
|
|
47
|
-
let differenceProperties = {};
|
|
48
|
-
if (o1 && o2) {
|
|
49
|
-
Object.keys(o1).forEach((k) => {
|
|
50
|
-
if (o2[k] !== undefined && o2[k] != o1[k]) {
|
|
51
|
-
differenceProperties[k] = o2[k];
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
}
|
|
55
|
-
return differenceProperties;
|
|
56
|
-
}
|
|
57
|
-
export const fillTemplate = (template, params) => {
|
|
58
|
-
return template.replace(/\$\{(\w+)\}/g, (_, key) => params[key] || '');
|
|
59
|
-
}
|
|
60
|
-
export const setArrayObjectKeyValue = (array, key, value, prop) => {
|
|
61
|
-
let props = prop.split(",");
|
|
62
|
-
for (let o of array) {
|
|
63
|
-
if (props.indexOf(o.prop) != -1 || props.indexOf(o.field) != -1) {
|
|
64
|
-
o[key] = value;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export const getFirstLetter = (str) => {
|
|
70
|
-
let unicode = str.charCodeAt(0);
|
|
71
|
-
if (unicode >= 19968 && unicode <= 40869) {
|
|
72
|
-
let index = parseInt((unicode - 19968) / 408) + 1;
|
|
73
|
-
return String.fromCharCode(64 + index);
|
|
74
|
-
} else {
|
|
75
|
-
return str.charAt(0);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
export default {
|
|
79
|
-
clone, clear, copeProperties, getDifferenceProperties, getFirstLetter, convertToStringifiedJson
|
|
80
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const CONFIG = require("./../../config/shared-config")
|
|
2
|
-
const setToken = (token) => {
|
|
3
|
-
localStorage.setItem(CONFIG.TOKEN_AUTHENTICATION, token);
|
|
4
|
-
}
|
|
5
|
-
const removeToken = () => {
|
|
6
|
-
localStorage.removeItem(CONFIG.TOKEN_AUTHENTICATION);
|
|
7
|
-
}
|
|
8
|
-
const getToken = () => {
|
|
9
|
-
return localStorage.getItem(CONFIG.TOKEN_AUTHENTICATION);
|
|
10
|
-
}
|
|
11
|
-
const getUserInfo = (token) => {
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
export default {
|
|
15
|
-
setToken,
|
|
16
|
-
getToken,
|
|
17
|
-
getUserInfo,
|
|
18
|
-
removeToken,
|
|
19
|
-
}
|