cloud-web-corejs 1.0.54-dev.694 → 1.0.54-dev.695
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,17 +1,15 @@
|
|
|
1
1
|
const moudule = {};
|
|
2
|
-
import vue from "vue"
|
|
3
|
-
import excelImport from
|
|
2
|
+
import vue from "vue";
|
|
3
|
+
import excelImport from "./index.vue";
|
|
4
4
|
import exportDialog from "./exportDialog.vue";
|
|
5
|
-
import {getBdEnv} from "@base/api/user";
|
|
6
|
-
import {encrypt, decrypt} from "@base/utils/aes";
|
|
5
|
+
import { getBdEnv } from "@base/api/user";
|
|
6
|
+
import { encrypt, decrypt } from "@base/utils/aes";
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
getToken
|
|
10
|
-
} from '../../utils/auth'
|
|
8
|
+
import { getToken } from "../../utils/auth";
|
|
11
9
|
|
|
12
10
|
let configUtil = {
|
|
13
11
|
baseUrl: process.env.VUE_APP_BASE_API,
|
|
14
|
-
getToken
|
|
12
|
+
getToken,
|
|
15
13
|
};
|
|
16
14
|
const ExcelImportInstance = vue.extend(excelImport);
|
|
17
15
|
const ExportDialogInstance = vue.extend(exportDialog);
|
|
@@ -19,9 +17,9 @@ const initInstance = function (containter, flag) {
|
|
|
19
17
|
// 实例化vue实例
|
|
20
18
|
let currentInstance;
|
|
21
19
|
if (flag == 1) {
|
|
22
|
-
currentInstance = new ExcelImportInstance({i18n: window.$vueRoot._i18n});
|
|
20
|
+
currentInstance = new ExcelImportInstance({ i18n: window.$vueRoot._i18n });
|
|
23
21
|
} else {
|
|
24
|
-
currentInstance = new ExportDialogInstance({i18n: window.$vueRoot._i18n});
|
|
22
|
+
currentInstance = new ExportDialogInstance({ i18n: window.$vueRoot._i18n });
|
|
25
23
|
}
|
|
26
24
|
let dom = currentInstance.$mount().$el;
|
|
27
25
|
containter.appendChild(dom);
|
|
@@ -34,9 +32,9 @@ function toDo(options) {
|
|
|
34
32
|
let vueTarget = this && this.$el ? this : window.$vueRoot;
|
|
35
33
|
let currentInstance = initInstance(containter, 1);
|
|
36
34
|
currentInstance.param = {};
|
|
37
|
-
Object.assign(currentInstance.param, {vue: vueTarget}, options);
|
|
35
|
+
Object.assign(currentInstance.param, { vue: vueTarget }, options);
|
|
38
36
|
return currentInstance.exc();
|
|
39
|
-
}
|
|
37
|
+
}
|
|
40
38
|
|
|
41
39
|
function openExportDialog(options, callback) {
|
|
42
40
|
// let containter = this && this.$el ? this.$el : document.body;
|
|
@@ -44,9 +42,11 @@ function openExportDialog(options, callback) {
|
|
|
44
42
|
let vueTarget = this && this.$el ? this : window.$vueRoot;
|
|
45
43
|
let currentInstance = initInstance(containter, 2);
|
|
46
44
|
currentInstance.param = {};
|
|
47
|
-
Object.assign(currentInstance.param, {vue: vueTarget}, options, {
|
|
45
|
+
Object.assign(currentInstance.param, { vue: vueTarget }, options, {
|
|
46
|
+
confirm: callback,
|
|
47
|
+
});
|
|
48
48
|
// return currentInstance.exc();
|
|
49
|
-
}
|
|
49
|
+
}
|
|
50
50
|
|
|
51
51
|
// 定义插件对象
|
|
52
52
|
// vue的install方法,用于定义vue插件
|
|
@@ -62,23 +62,23 @@ moudule.install = function (Vue) {
|
|
|
62
62
|
let selectTypeAuth = options.selectTypeAuth;
|
|
63
63
|
let that = this;
|
|
64
64
|
|
|
65
|
-
let ids = []
|
|
65
|
+
let ids = [];
|
|
66
66
|
if (options.data) {
|
|
67
|
-
ids = options.data
|
|
67
|
+
ids = options.data;
|
|
68
68
|
} else if (targetRef) {
|
|
69
|
-
let url = options
|
|
69
|
+
let url = options;
|
|
70
70
|
let checkRows = this.$refs[targetRef].getCheckboxRecords(true);
|
|
71
71
|
if (!checkRows.length) {
|
|
72
|
-
this.$baseAlert(this.$t1(
|
|
73
|
-
return
|
|
72
|
+
this.$baseAlert(this.$t1("请选择需要导出的数据"));
|
|
73
|
+
return;
|
|
74
74
|
}
|
|
75
|
-
ids = checkRows.map(item => item.id);
|
|
75
|
+
ids = checkRows.map((item) => item.id);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
let handle = function (abc) {
|
|
79
79
|
let reqData = {
|
|
80
|
-
ids
|
|
81
|
-
}
|
|
80
|
+
ids,
|
|
81
|
+
};
|
|
82
82
|
if (abc) {
|
|
83
83
|
reqData.abc = abc;
|
|
84
84
|
}
|
|
@@ -86,61 +86,64 @@ moudule.install = function (Vue) {
|
|
|
86
86
|
reqData.plaintext = options.plaintext;
|
|
87
87
|
}
|
|
88
88
|
let data = {
|
|
89
|
-
datas: encrypt(JSON.stringify(reqData))
|
|
90
|
-
}
|
|
89
|
+
datas: encrypt(JSON.stringify(reqData)),
|
|
90
|
+
};
|
|
91
91
|
|
|
92
92
|
that.$http({
|
|
93
93
|
url: options.url,
|
|
94
94
|
method: `post`,
|
|
95
95
|
data: data,
|
|
96
96
|
isLoading: true,
|
|
97
|
-
success: res => {
|
|
98
|
-
let content = res.objx
|
|
97
|
+
success: (res) => {
|
|
98
|
+
let content = res.objx;
|
|
99
99
|
if (content && content !== "[]") {
|
|
100
100
|
let fileName;
|
|
101
101
|
if (options.fileName) {
|
|
102
102
|
fileName = options.fileName;
|
|
103
103
|
} else {
|
|
104
|
-
let timeStr = res.time
|
|
105
|
-
|
|
104
|
+
let timeStr = res.time
|
|
105
|
+
.replaceAll(":", "")
|
|
106
|
+
.replaceAll("-", "")
|
|
107
|
+
.replaceAll(" ", "");
|
|
108
|
+
fileName = options.title + "(" + timeStr + ")";
|
|
106
109
|
}
|
|
107
|
-
if (options.plaintext) {
|
|
110
|
+
/* if (options.plaintext) {
|
|
108
111
|
try {
|
|
109
112
|
content = JSON.stringify(JSON.parse(content), null, 2);
|
|
110
113
|
} catch (e) {
|
|
111
114
|
// content is not valid JSON, keep original
|
|
112
115
|
}
|
|
113
|
-
}
|
|
114
|
-
downloadTxt(fileName, content)
|
|
116
|
+
} */
|
|
117
|
+
downloadTxt(fileName, content);
|
|
115
118
|
} else {
|
|
116
|
-
this.$baseAlert(this.$t1(
|
|
119
|
+
this.$baseAlert(this.$t1("不存在需要导出的数据"));
|
|
117
120
|
}
|
|
118
|
-
}
|
|
121
|
+
},
|
|
119
122
|
});
|
|
120
|
-
}
|
|
123
|
+
};
|
|
121
124
|
let isDev = true;
|
|
122
125
|
if (abcEnabled) {
|
|
123
126
|
await getBdEnv({
|
|
124
127
|
isLoading: true,
|
|
125
|
-
success: res => {
|
|
126
|
-
isDev = res.objx == "dev"
|
|
127
|
-
}
|
|
128
|
+
success: (res) => {
|
|
129
|
+
isDev = res.objx == "dev";
|
|
130
|
+
},
|
|
128
131
|
});
|
|
129
132
|
}
|
|
130
133
|
if (isDev && abcEnabled && editAuth === 1 && selectTypeAuth == 1) {
|
|
131
134
|
openExportDialog(options, (abc) => {
|
|
132
|
-
handle(abc)
|
|
133
|
-
})
|
|
135
|
+
handle(abc);
|
|
136
|
+
});
|
|
134
137
|
} else {
|
|
135
|
-
this.$baseConfirm(this.$t1(
|
|
136
|
-
let abc = null
|
|
138
|
+
this.$baseConfirm(this.$t1("您确定要导出吗?")).then(() => {
|
|
139
|
+
let abc = null;
|
|
137
140
|
if (abcEnabled) {
|
|
138
141
|
if (isDev) {
|
|
139
142
|
if (!editAuth || !selectTypeAuth) {
|
|
140
|
-
abc = "B"
|
|
143
|
+
abc = "B";
|
|
141
144
|
}
|
|
142
145
|
} else {
|
|
143
|
-
abc = "A"
|
|
146
|
+
abc = "A";
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
149
|
handle(abc);
|
|
@@ -151,13 +154,13 @@ moudule.install = function (Vue) {
|
|
|
151
154
|
|
|
152
155
|
function downloadTxt(fileName, content) {
|
|
153
156
|
// 创建Blob对象
|
|
154
|
-
const blob = new Blob([content], {type:
|
|
157
|
+
const blob = new Blob([content], { type: "text/plain;charset=utf-8" });
|
|
155
158
|
// 创建URL
|
|
156
159
|
const url = URL.createObjectURL(blob);
|
|
157
160
|
// 创建a标签
|
|
158
|
-
const link = document.createElement(
|
|
161
|
+
const link = document.createElement("a");
|
|
159
162
|
link.href = url;
|
|
160
|
-
link.setAttribute(
|
|
163
|
+
link.setAttribute("download", fileName + ".txt");
|
|
161
164
|
document.body.appendChild(link);
|
|
162
165
|
// 触发下载
|
|
163
166
|
link.click();
|
|
@@ -171,11 +174,11 @@ function download(ippaaapp, uuid) {
|
|
|
171
174
|
let params = {
|
|
172
175
|
// n: fileName
|
|
173
176
|
};
|
|
174
|
-
params[
|
|
177
|
+
params["access_token"] = getToken();
|
|
175
178
|
|
|
176
|
-
let form = document.createElement(
|
|
179
|
+
let form = document.createElement("form");
|
|
177
180
|
|
|
178
|
-
let randomNum =
|
|
181
|
+
let randomNum = new Date().valueOf() + Math.floor(Math.random() * 1000000);
|
|
179
182
|
let formId = "formId-" + randomNum;
|
|
180
183
|
let formName = "formName-" + randomNum;
|
|
181
184
|
|
|
@@ -185,8 +188,8 @@ function download(ippaaapp, uuid) {
|
|
|
185
188
|
document.body.appendChild(form);
|
|
186
189
|
for (let obj in params) {
|
|
187
190
|
if (params.hasOwnProperty(obj)) {
|
|
188
|
-
let input = document.createElement(
|
|
189
|
-
input.tpye =
|
|
191
|
+
let input = document.createElement("input");
|
|
192
|
+
input.tpye = "hidden";
|
|
190
193
|
input.name = obj;
|
|
191
194
|
input.value = params[obj];
|
|
192
195
|
form.appendChild(input);
|
|
@@ -487,7 +487,7 @@ modules = {
|
|
|
487
487
|
data: [row.id],
|
|
488
488
|
url: USER_PREFIX + "/form_develop/exportFormScript",
|
|
489
489
|
plaintext: 1,
|
|
490
|
-
fileName: row.scriptCode
|
|
490
|
+
fileName: `${row.scriptCode} - ${row.formCode}(script)`,
|
|
491
491
|
abcEnabled: true,
|
|
492
492
|
editAuth: this.currentFormType.editAuth,
|
|
493
493
|
selectTypeAuth: this.currentFormType.selectTypeAuth,
|