isdata-customer-sdk 0.1.1 → 0.1.2

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": "isdata-customer-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "main": "dist/index.js",
5
5
  "author": "rojohn",
6
6
  "scripts": {
package/babel.config.js DELETED
@@ -1,12 +0,0 @@
1
- module.exports = {
2
- presets: ["@vue/cli-plugin-babel/preset", "@vue/babel-preset-jsx"],
3
- plugins: [
4
- [
5
- "component",
6
- {
7
- libraryName: "element-ui",
8
- styleLibraryName: "theme-chalk",
9
- },
10
- ],
11
- ],
12
- };
@@ -1,64 +0,0 @@
1
- import axios from "axios"
2
- import qs from "querystringify"
3
-
4
- let apiContextPath = ""
5
- const onlineDevelopmentMode = process.env.VUE_APP_ONLINE_DEVELOPMENT_MODE === "true" || process.env.REACT_APP_ONLINE_DEVELOPMENT_MODE === "true"
6
- if (process.env.NODE_ENV === "development" && !onlineDevelopmentMode) {
7
- document.cookie =
8
- "token=eyJhbGciOiJIUzI1NiJ9.eyJsb2dpblRpbWVzdGFtcCI6MTY0NjcyMjI2ODY4NSwidXNlcklkIjoiMTIzNDU2Nzg5MCJ9.F8wr84ha-dW18J9wZOQeTXj55mXTdqKfLBeNlNueoLY"
9
- document.cookie =
10
- "refreshToken=eyJhbGciOiJIUzI1NiJ9.eyJsb2dpblRpbWVzdGFtcCI6MTY0NjcyMjI2ODY4Nn0.TEVE_nopHNZlvSQM_RUZrLcCzkaERiHo8nz0q-ksL3E"
11
- document.cookie = "username=admin"
12
- document.cookie = "windowOnline=true"
13
- apiContextPath = "/api"
14
- }
15
- export const getInstance = (prefix = "") => {
16
- if (prefix) {
17
- prefix.startsWith("/") && (prefix = prefix.slice(1, prefix.length))
18
- prefix.endsWith("/") && (prefix = prefix.slice(0, -1))
19
- }
20
- const instance = axios.create({
21
- baseURL: `${apiContextPath}/${prefix ? prefix + "/" : ""}sdata/rest`,
22
- timeout: 60000,
23
- validateStatus: function(status) {
24
- return status >= 200 && status < 300 // default
25
- },
26
- headers:
27
- (window.location.search && qs.parse(window.location.search).token) ||
28
- window.token
29
- ? { token: qs.parse(window.location.search).token || window.token }
30
- : {}
31
- })
32
-
33
- instance.defaults.headers.post["Content-Type"] = "application/json"
34
-
35
- instance.interceptors.response.use(
36
- response => {
37
- let { data } = response
38
- if (typeof data === "string") {
39
- data = JSON.parse(data)
40
- }
41
- if (data && data.status !== 200 && !(data instanceof Blob)) {
42
- return Promise.reject(response)
43
- }
44
- if (data instanceof Blob) {
45
- response.data = data
46
- return response
47
- }
48
-
49
- response.data = data && data.result
50
- return response
51
- },
52
- error => {
53
- if (error.response && error.response.status === 401) {
54
- return
55
- }
56
-
57
- return Promise.reject(error.response)
58
- }
59
- )
60
- return instance
61
- }
62
- let prefixPath = window.prefixPath || ""
63
-
64
- export default getInstance(prefixPath)
package/src/index.js DELETED
@@ -1,126 +0,0 @@
1
- import request from "./api/request";
2
-
3
- /**
4
- * 查询资产
5
- * @param id 资产ID
6
- *
7
- */
8
- export const queryAssetById = (id, count = 200) =>
9
- request.post(`/asset/getAssetData?asset_id=${id}&count=${count}`, { filters: [] });
10
-
11
-
12
- /**
13
- * 查询当前企业门户菜单信息
14
- * @param id GroupID
15
- *
16
- */
17
- export const getMenuDatasByGroupID =async (id) =>{
18
- let queryData_groupData = {
19
- "param": {
20
- "id": id
21
- }
22
- };
23
- let result =await request.post(`/dataservice/rest/orchestration/getMenuDatasByGroupID`,queryData_groupData);
24
- let portalMenuDatas = result.data.resultDatas;
25
- portalMenuDatas =transformPortalData(portalMenuDatas);
26
- //获取菜单数据
27
- return portalMenuDatas;
28
- };
29
-
30
- export const transformPortalData =(datas) =>{
31
- // console.log(datas);
32
- let menuMaps={};
33
- for (const data of datas) {
34
- let id = data.id;
35
- let tempMenuData={
36
- id:data.menu_id,
37
- name:data.title,
38
- sort:data.sort,
39
- actionType:data.actionType,
40
- url:data.url,
41
- iconClass:data.image,
42
- types:[],
43
- app_id:data.app_id,
44
- menu_id:data.menu_id,
45
- beyond_type:data.menu_type_name?data.menu_type_name:"其他",
46
- beyond_type_sort:data.menu_type_sort?data.menu_type_sort:999,
47
- }
48
- menuMaps[id]=tempMenuData;
49
- }
50
- for (const data of datas) {
51
- let type = data.type;
52
- //5:子菜单入口
53
- if(type =="5")
54
- {
55
- let tempMenuData =menuMaps[data.id];
56
- let parent_id =data.parent_id;
57
- let tempType =tempMenuData.beyond_type;
58
- let tempType_sort =tempMenuData.beyond_type_sort;
59
- let tempParentMenu = menuMaps[parent_id];
60
- let parentTypes=tempParentMenu.types;
61
- let parentType=parentTypes.find((tempTypeItem)=>{return tempTypeItem.name==tempType});
62
- if(parentType)
63
- {
64
- let type_childens =parentType.children;
65
- type_childens.push(tempMenuData);
66
- }
67
- else
68
- {
69
- let parentType = {name:tempType,children:[],sort:tempType_sort};
70
- let type_childens =parentType.children;
71
- type_childens.push(tempMenuData);
72
- parentTypes.push(parentType);
73
- }
74
- }
75
- }
76
- const menuList =[];
77
- for (const data of datas) {
78
- let type = data.type;
79
- //4:主菜单入口
80
- if(type =="4")
81
- {
82
- let tempMenuData =menuMaps[data.id];
83
- menuList.push(tempMenuData);
84
- let types = tempMenuData.types;
85
- types.sort((data1,data2)=>{
86
- if(Number.isNaN(data1.sort)) return 1;
87
- if(Number.isNaN(data2.sort)) return -1;
88
- return data1.sort - data2.sort;
89
- });
90
- for(let typeItem of types)
91
- {
92
- let tempArrys =typeItem.children;
93
- tempArrys.sort((data1,data2)=>{
94
- if(Number.isNaN(data1.sort)) return 1;
95
- if(Number.isNaN(data2.sort)) return -1;
96
- return data1.sort - data2.sort;
97
- });
98
- }
99
- }
100
- }
101
- menuList.sort((data1,data2)=>{
102
- if(Number.isNaN(data1.sort)) return 1;
103
- if(Number.isNaN(data2.sort)) return -1;
104
- return data1.sort - data2.sort;
105
- });
106
- // console.log(menuList);
107
- return menuList;
108
- }
109
-
110
- /**
111
- * 查询当前企业组织的集团组织ID
112
- * @param id 组织ID
113
- *
114
- */
115
- export const queryGroupIDByOfficeId =async(id) =>{
116
- let queryData_office = {
117
- "param": {
118
- "id": id
119
- }
120
- };
121
- let result =await request.post(`/dataservice/rest/orchestration/getGroupIDByDptID`,queryData_office);
122
- let groupDptData = result.data.resultDptData;
123
- let group_id = groupDptData.id;
124
- return group_id;
125
- };
126
-
package/webpack.config.js DELETED
@@ -1,28 +0,0 @@
1
- module.exports = (env)=>({
2
- mode: "production",
3
- entry: {
4
- "index":"./src/index.js",
5
- },
6
- output: {
7
- filename: "[name].js",
8
- libraryTarget: 'commonjs2'
9
- },
10
- optimization: {
11
- minimize: env.compress === 'true' // 通过环境变量控制压缩
12
- },
13
- devtool: env.sourcemap ? 'source-map' : false,
14
- module: {
15
- rules: [
16
- {
17
- test: /\.(jpg|png|gif)$/,
18
- loader: "url-loader",
19
- options: {
20
- name: "[name]_[hash:10].[ext]",
21
- }
22
- }
23
- ]
24
- },
25
- target: "node",
26
- externals: {
27
- },
28
- });