cloud-web-corejs 1.1.0-dev.85 → 1.1.0-dev.88
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 +1 -1
- package/src/components/jsonImport/index.js +5 -2
- package/src/store/modules/user.js +5 -0
- package/src/utils/aes.js +133 -12
- package/src/utils/request.js +37 -25
- package/src/views/bd/setting/form_template/copyAppendDialog.vue +173 -0
- package/src/views/bd/setting/form_template/list.vue +15 -0
- package/src/views/bd/setting/form_template/mixins/list.js +21 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import vue from "vue";
|
|
|
3
3
|
import excelImport from "./index.vue";
|
|
4
4
|
import exportDialog from "./exportDialog.vue";
|
|
5
5
|
import { getBdEnv } from "@base/api/user";
|
|
6
|
-
import { encrypt } from "@base/utils/aes";
|
|
6
|
+
import { encrypt, loadAesKeys } from "@base/utils/aes";
|
|
7
7
|
import {
|
|
8
8
|
getExportArchiveType,
|
|
9
9
|
processArchiveExport,
|
|
@@ -88,8 +88,11 @@ moudule.install = function (Vue) {
|
|
|
88
88
|
if (options.plaintext) {
|
|
89
89
|
reqData.plaintext = options.plaintext;
|
|
90
90
|
}
|
|
91
|
+
loadAesKeys().catch(function () {});
|
|
92
|
+
const plain = JSON.stringify(reqData);
|
|
93
|
+
const cipher = encrypt(plain);
|
|
91
94
|
let data = {
|
|
92
|
-
datas:
|
|
95
|
+
datas: cipher === null ? plain : cipher,
|
|
93
96
|
};
|
|
94
97
|
|
|
95
98
|
that.$http({
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getLogicParamValue,
|
|
10
10
|
} from "../../api/user";
|
|
11
11
|
import { getToken, setToken, clearToken } from "../../utils/auth";
|
|
12
|
+
import { loadAesKeys, clearAesKeys } from "../../utils/aes";
|
|
12
13
|
import { clearBaseDictsCache } from "../../utils/baseDictsCache";
|
|
13
14
|
import router, { resetRouter } from "@base/router";
|
|
14
15
|
import { unmountAllMicroApps } from "@base/microRouter";
|
|
@@ -142,6 +143,7 @@ actions = {
|
|
|
142
143
|
let token = opts.token;
|
|
143
144
|
commit("SET_TOKEN", token);
|
|
144
145
|
configUtil.setToken(token);
|
|
146
|
+
loadAesKeys(token).catch(function () {});
|
|
145
147
|
sessionStorage.setItem(
|
|
146
148
|
"easyweb",
|
|
147
149
|
JSON.stringify({
|
|
@@ -156,6 +158,8 @@ actions = {
|
|
|
156
158
|
|
|
157
159
|
// get user info
|
|
158
160
|
getInfo2({ commit, state, dispatch }) {
|
|
161
|
+
// 刷新页面或主应用注入 token 时不会再走登录,这里补拉一次密钥。失败不提示、不阻塞。
|
|
162
|
+
loadAesKeys().catch(function () {});
|
|
159
163
|
return new Promise((resolve, reject) => {
|
|
160
164
|
configUtil
|
|
161
165
|
.getInfo({
|
|
@@ -320,6 +324,7 @@ actions = {
|
|
|
320
324
|
// remove token
|
|
321
325
|
resetToken({ commit, state, dispatch }) {
|
|
322
326
|
return new Promise((resolve) => {
|
|
327
|
+
clearAesKeys();
|
|
323
328
|
commit("SET_TOKEN", "");
|
|
324
329
|
commit("SET_ROLES", []);
|
|
325
330
|
commit("SET_NICK_NAME", "");
|
package/src/utils/aes.js
CHANGED
|
@@ -1,21 +1,142 @@
|
|
|
1
|
+
import request from "./request.js";
|
|
1
2
|
import CryptoJS from "crypto-js";
|
|
3
|
+
import prefixConfig from "@base/prefixConfig.js";
|
|
4
|
+
import { getToken } from "./auth.js";
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
6
|
+
// 密钥只存在内存里,跟当前 token 绑定。退出登录或 token 变化后作废。
|
|
7
|
+
// 接口 404、objx 为空、解密失败时记成「本次不加密」,请求继续发原始内容。
|
|
8
|
+
let keys = null;
|
|
9
|
+
let pending = null;
|
|
10
|
+
let unavailableToken = null;
|
|
11
|
+
let generation = 0;
|
|
12
|
+
|
|
13
|
+
function currentKeys() {
|
|
14
|
+
const token = getToken();
|
|
15
|
+
if (!keys || !token || keys.token !== token || !keys.k || !keys.iv)
|
|
16
|
+
return null;
|
|
17
|
+
return keys;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function setAesKeys(k, iv, token) {
|
|
21
|
+
const boundToken = token == null ? getToken() : token;
|
|
22
|
+
if (!k || !iv || !boundToken) {
|
|
23
|
+
keys = null;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
keys = { k: k, iv: iv, token: boundToken };
|
|
27
|
+
unavailableToken = null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function clearAesKeys() {
|
|
31
|
+
generation += 1;
|
|
32
|
+
keys = null;
|
|
33
|
+
pending = null;
|
|
34
|
+
unavailableToken = null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function decryptKok(objx, token) {
|
|
38
|
+
try {
|
|
39
|
+
const material = String(token || "").substring(0, 16);
|
|
40
|
+
if (material.length < 16) return null;
|
|
41
|
+
const plain = CryptoJS.AES.decrypt(
|
|
42
|
+
objx,
|
|
43
|
+
CryptoJS.enc.Utf8.parse(material),
|
|
44
|
+
{
|
|
45
|
+
iv: CryptoJS.enc.Utf8.parse(material),
|
|
46
|
+
}
|
|
47
|
+
).toString(CryptoJS.enc.Utf8);
|
|
48
|
+
const sep = plain.indexOf(":");
|
|
49
|
+
if (sep <= 0) return null;
|
|
50
|
+
const k = plain.slice(0, sep);
|
|
51
|
+
const iv = plain.slice(sep + 1);
|
|
52
|
+
if (!k || !iv) return null;
|
|
53
|
+
return { k: k, iv: iv };
|
|
54
|
+
} catch (e) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function requestKok(token) {
|
|
60
|
+
const prefix = String(prefixConfig.USER_PREFIX || "/user").replace(/\/$/, "");
|
|
61
|
+
// 走统一请求。失败不弹窗;fetchAesKey: false 避免本请求再进去取一次密钥。
|
|
62
|
+
return request({
|
|
63
|
+
url: prefix + "/common/kok",
|
|
64
|
+
method: "post",
|
|
65
|
+
timeout: 10000,
|
|
66
|
+
isLoading: false,
|
|
67
|
+
modal: false,
|
|
68
|
+
failMsg: false,
|
|
69
|
+
errorMsg: false,
|
|
70
|
+
fetchAesKey: false,
|
|
71
|
+
filterConfig: { enabled: false },
|
|
72
|
+
})
|
|
73
|
+
.then(function (data) {
|
|
74
|
+
if (!data || typeof data !== "object") return null;
|
|
75
|
+
if (data.type && data.type !== "success") return null;
|
|
76
|
+
if (!data.objx) return null;
|
|
77
|
+
return decryptKok(data.objx, token);
|
|
78
|
+
})
|
|
79
|
+
.catch(function () {
|
|
80
|
+
return null;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// 登录成功或刷新后调用。同一 token 只请求一次,进行中的调用共用同一个 Promise。
|
|
85
|
+
export function loadAesKeys(token) {
|
|
86
|
+
const current = token || getToken();
|
|
87
|
+
if (!current) return Promise.resolve(null);
|
|
88
|
+
if (keys && keys.token === current && keys.k && keys.iv) {
|
|
89
|
+
return Promise.resolve(keys);
|
|
90
|
+
}
|
|
91
|
+
if (unavailableToken === current) return Promise.resolve(null);
|
|
92
|
+
if (pending && pending.token === current) return pending.promise;
|
|
93
|
+
|
|
94
|
+
const gen = generation;
|
|
95
|
+
const promise = requestKok(current)
|
|
96
|
+
.then(function (result) {
|
|
97
|
+
if (gen !== generation || getToken() !== current) return null;
|
|
98
|
+
if (!result) {
|
|
99
|
+
unavailableToken = current;
|
|
100
|
+
if (keys && keys.token === current) keys = null;
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
keys = { k: result.k, iv: result.iv, token: current };
|
|
104
|
+
unavailableToken = null;
|
|
105
|
+
return keys;
|
|
106
|
+
})
|
|
107
|
+
.catch(function () {
|
|
108
|
+
if (gen !== generation) return null;
|
|
109
|
+
unavailableToken = current;
|
|
110
|
+
return null;
|
|
111
|
+
})
|
|
112
|
+
.finally(function () {
|
|
113
|
+
if (pending && pending.promise === promise) pending = null;
|
|
114
|
+
});
|
|
115
|
+
pending = { token: current, promise: promise };
|
|
116
|
+
return promise;
|
|
117
|
+
}
|
|
5
118
|
|
|
6
|
-
// 加密函数
|
|
7
119
|
export function encrypt(text) {
|
|
8
|
-
|
|
9
|
-
|
|
120
|
+
const key = currentKeys();
|
|
121
|
+
if (!key) return null;
|
|
122
|
+
return CryptoJS.AES.encrypt(text, CryptoJS.enc.Utf8.parse(key.k), {
|
|
123
|
+
iv: CryptoJS.enc.Utf8.parse(key.iv),
|
|
10
124
|
}).toString();
|
|
11
125
|
}
|
|
12
126
|
|
|
13
|
-
// 解密函数
|
|
14
127
|
export function decrypt(ciphertext) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
128
|
+
const key = currentKeys();
|
|
129
|
+
if (!key || ciphertext == null || ciphertext === "") return ciphertext;
|
|
130
|
+
try {
|
|
131
|
+
const bytes = CryptoJS.AES.decrypt(
|
|
132
|
+
ciphertext,
|
|
133
|
+
CryptoJS.enc.Utf8.parse(key.k),
|
|
134
|
+
{
|
|
135
|
+
iv: CryptoJS.enc.Utf8.parse(key.iv),
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
return bytes.toString(CryptoJS.enc.Utf8);
|
|
139
|
+
} catch (e) {
|
|
140
|
+
return ciphertext;
|
|
141
|
+
}
|
|
21
142
|
}
|
package/src/utils/request.js
CHANGED
|
@@ -8,7 +8,7 @@ import ErroreBox from "../components/errorMsg/index.js";
|
|
|
8
8
|
import PopupManager from "element-ui/src/utils/popup/popup-manager.js";
|
|
9
9
|
import settingConfig from "@/settings.js";
|
|
10
10
|
import { encode } from "js-base64";
|
|
11
|
-
import { encrypt } from "@base/utils/aes";
|
|
11
|
+
import { encrypt, loadAesKeys } from "@base/utils/aes";
|
|
12
12
|
import { handleRequestNetworkError } from "@base/utils/runtimeRecovery";
|
|
13
13
|
|
|
14
14
|
let configUtil = {
|
|
@@ -95,14 +95,23 @@ function aesPlainText(data, useEmptyObject) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
function wrapAesBody(data, useEmptyObject) {
|
|
98
|
+
const cipher = encrypt(aesPlainText(data, useEmptyObject));
|
|
99
|
+
if (!cipher) return null;
|
|
98
100
|
return {
|
|
99
|
-
_aeenboda:
|
|
101
|
+
_aeenboda: cipher,
|
|
100
102
|
};
|
|
101
103
|
}
|
|
102
104
|
|
|
105
|
+
function applyAesBody(config, useEmptyObject) {
|
|
106
|
+
const wrapped = wrapAesBody(config.data, useEmptyObject);
|
|
107
|
+
if (!wrapped) return false;
|
|
108
|
+
config.data = wrapped;
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
|
|
103
112
|
// request interceptor
|
|
104
113
|
service.interceptors.request.use(
|
|
105
|
-
(config) => {
|
|
114
|
+
async (config) => {
|
|
106
115
|
if (config.useToken !== false) {
|
|
107
116
|
let token = getToken();
|
|
108
117
|
if (token) {
|
|
@@ -123,30 +132,33 @@ service.interceptors.request.use(
|
|
|
123
132
|
);
|
|
124
133
|
}
|
|
125
134
|
const canEncryptBody = !isBinaryRequestBody(config.data);
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
// fetchAesKey: false 强制本请求不取密钥,也不加密。
|
|
136
|
+
const skipAesKey = config.fetchAesKey === false;
|
|
137
|
+
const wantGlobalAes
|
|
138
|
+
= !skipAesKey
|
|
139
|
+
&& settingConfig.requestAesEnabled === true
|
|
140
|
+
&& canEncryptBody
|
|
141
|
+
&& isOwnBackendRequest(config);
|
|
142
|
+
const isFormUrlEncoded
|
|
143
|
+
= config.headers["Content-Type"] === "application/x-www-form-urlencoded"
|
|
144
|
+
|| config.headers["Content-Type"]
|
|
145
|
+
=== "application/x-www-form-urlencoded;charset=UTF-8";
|
|
146
|
+
const wantListedAes
|
|
147
|
+
= !skipAesKey
|
|
148
|
+
&& canEncryptBody
|
|
149
|
+
&& settingConfig.base64Urls
|
|
150
|
+
&& settingConfig.base64Urls.includes(config.url);
|
|
151
|
+
const wantFlagAes = !skipAesKey && canEncryptBody && config.aes;
|
|
152
|
+
// 密钥在后台取。没取到或接口 404/报错时不等待、不提示,直接发原始请求体。
|
|
153
|
+
if (wantGlobalAes || wantListedAes || wantFlagAes) {
|
|
154
|
+
loadAesKeys().catch(function () {});
|
|
155
|
+
}
|
|
156
|
+
if (wantGlobalAes && applyAesBody(config, true)) {
|
|
132
157
|
config.headers["Content-Type"] = "application/json;charset=UTF-8";
|
|
133
|
-
} else if (
|
|
134
|
-
(config.headers["Content-Type"] === "application/x-www-form-urlencoded" ||
|
|
135
|
-
config.headers["Content-Type"] ===
|
|
136
|
-
"application/x-www-form-urlencoded;charset=UTF-8") &&
|
|
137
|
-
typeof config.data !== "string" &&
|
|
138
|
-
config.data
|
|
139
|
-
) {
|
|
158
|
+
} else if (isFormUrlEncoded && typeof config.data !== "string" && config.data) {
|
|
140
159
|
config.data = qs.stringify(config.data);
|
|
141
|
-
} else if (
|
|
142
|
-
|
|
143
|
-
settingConfig.base64Urls &&
|
|
144
|
-
settingConfig.base64Urls.includes(config.url)
|
|
145
|
-
) {
|
|
146
|
-
// config.data = {"_baenboda": encode(JSON.stringify(config.data))};
|
|
147
|
-
config.data = wrapAesBody(config.data);
|
|
148
|
-
} else if (canEncryptBody && config.aes) {
|
|
149
|
-
config.data = wrapAesBody(config.data);
|
|
160
|
+
} else if (wantListedAes || wantFlagAes) {
|
|
161
|
+
applyAesBody(config);
|
|
150
162
|
}
|
|
151
163
|
|
|
152
164
|
if (config.modal !== false && config.loadingTarget) {
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<el-dialog
|
|
3
|
+
:title="$t1('复制表单模板')"
|
|
4
|
+
:append-to-body="true"
|
|
5
|
+
:modal-append-to-body="true"
|
|
6
|
+
:close-on-click-modal="false"
|
|
7
|
+
:visible.sync="showDialog"
|
|
8
|
+
:modal="false"
|
|
9
|
+
custom-class="dialog-style list-dialog dialog-checkbox pd_8"
|
|
10
|
+
width="360px"
|
|
11
|
+
v-el-drag-dialog
|
|
12
|
+
v-el-dialog-center
|
|
13
|
+
@close="close"
|
|
14
|
+
>
|
|
15
|
+
<div class="cont">
|
|
16
|
+
<el-form
|
|
17
|
+
ref="editForm"
|
|
18
|
+
:model="formData"
|
|
19
|
+
label-width="110px"
|
|
20
|
+
class="adSearchForm"
|
|
21
|
+
style="width: 322px; height: auto;"
|
|
22
|
+
>
|
|
23
|
+
<el-form-item :label="$t1('后缀')" prop="suffix" :rules="suffixRules">
|
|
24
|
+
<el-input
|
|
25
|
+
v-model="formData.suffix"
|
|
26
|
+
clearable
|
|
27
|
+
:placeholder="$t1('追加到编码和名称')"
|
|
28
|
+
/>
|
|
29
|
+
</el-form-item>
|
|
30
|
+
<el-form-item :label="$t1('表单分类')" prop="menuKindName">
|
|
31
|
+
<el-input
|
|
32
|
+
class="search-input"
|
|
33
|
+
v-model="formData.menuKindName"
|
|
34
|
+
@clear="clearMenuKind"
|
|
35
|
+
v-el-readonly
|
|
36
|
+
clearable
|
|
37
|
+
:placeholder="$t1('不填则保持原分类')"
|
|
38
|
+
>
|
|
39
|
+
<i
|
|
40
|
+
slot="suffix"
|
|
41
|
+
class="el-input__icon el-icon-search"
|
|
42
|
+
@click="showMenuKindDialog = true"
|
|
43
|
+
></i>
|
|
44
|
+
</el-input>
|
|
45
|
+
</el-form-item>
|
|
46
|
+
</el-form>
|
|
47
|
+
</div>
|
|
48
|
+
<span slot="footer" class="dialog-footer">
|
|
49
|
+
<el-button type="primary" plain class="button-sty" @click="close">
|
|
50
|
+
<i class="el-icon-close el-icon"></i>
|
|
51
|
+
{{ $t1('取 消') }}
|
|
52
|
+
</el-button>
|
|
53
|
+
<el-button type="primary" @click="saveData" class="button-sty">
|
|
54
|
+
<i class="el-icon-check el-icon"></i>
|
|
55
|
+
{{ $t1('确 定') }}
|
|
56
|
+
</el-button>
|
|
57
|
+
</span>
|
|
58
|
+
<MenuKindDialog
|
|
59
|
+
v-if="showMenuKindDialog"
|
|
60
|
+
:visiable.sync="showMenuKindDialog"
|
|
61
|
+
:serviceName="serviceName"
|
|
62
|
+
@confirm="confirmMenuKind"
|
|
63
|
+
:param="{ taType: 0 }"
|
|
64
|
+
:multi="false"
|
|
65
|
+
/>
|
|
66
|
+
</el-dialog>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script>
|
|
70
|
+
import MenuKindDialog from "@base/views/bd/setting/menu_kind/dialog.vue";
|
|
71
|
+
|
|
72
|
+
export default {
|
|
73
|
+
name: "formTemplateCopyAppendDialog",
|
|
74
|
+
components: { MenuKindDialog },
|
|
75
|
+
props: {
|
|
76
|
+
visiable: Boolean,
|
|
77
|
+
ids: {
|
|
78
|
+
type: Array,
|
|
79
|
+
default() {
|
|
80
|
+
return [];
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
serviceName: String,
|
|
84
|
+
},
|
|
85
|
+
data() {
|
|
86
|
+
return {
|
|
87
|
+
showDialog: true,
|
|
88
|
+
showMenuKindDialog: false,
|
|
89
|
+
formData: {
|
|
90
|
+
suffix: "",
|
|
91
|
+
menuKindCode: "",
|
|
92
|
+
menuKindName: "",
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
computed: {
|
|
97
|
+
suffixRules() {
|
|
98
|
+
return [
|
|
99
|
+
{
|
|
100
|
+
required: true,
|
|
101
|
+
message: this.$t1("请输入后缀"),
|
|
102
|
+
trigger: "blur",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
validator: (rule, value, callback) => {
|
|
106
|
+
let suffix = (value || "").trim();
|
|
107
|
+
if (!suffix) {
|
|
108
|
+
callback(new Error(this.$t1("请输入后缀")));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (!/^[A-Za-z0-9_.-]+$/.test(suffix)) {
|
|
112
|
+
callback(new Error(this.$t1("后缀只允许是字母或数字或'_.-'")));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
callback();
|
|
116
|
+
},
|
|
117
|
+
trigger: "blur",
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
methods: {
|
|
123
|
+
clearMenuKind() {
|
|
124
|
+
this.formData.menuKindCode = "";
|
|
125
|
+
this.formData.menuKindName = "";
|
|
126
|
+
},
|
|
127
|
+
confirmMenuKind(rows) {
|
|
128
|
+
if (rows && rows.length) {
|
|
129
|
+
let row = rows[0];
|
|
130
|
+
this.formData.menuKindCode = row.menuKindCode;
|
|
131
|
+
this.formData.menuKindName = row.name;
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
saveData() {
|
|
135
|
+
this.$refs.editForm.validate((valid) => {
|
|
136
|
+
if (!valid) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
this.$baseConfirm(this.$t1("您确定要复制吗?")).then(() => {
|
|
140
|
+
let data = {
|
|
141
|
+
ids: this.ids,
|
|
142
|
+
suffix: (this.formData.suffix || "").trim(),
|
|
143
|
+
};
|
|
144
|
+
if (this.formData.menuKindCode) {
|
|
145
|
+
data.menuKindCode = this.formData.menuKindCode;
|
|
146
|
+
}
|
|
147
|
+
this.$http({
|
|
148
|
+
url: USER_PREFIX + "/formTemplate/copyAppend",
|
|
149
|
+
method: "post",
|
|
150
|
+
data,
|
|
151
|
+
isLoading: true,
|
|
152
|
+
success: (res) => {
|
|
153
|
+
this.$message({
|
|
154
|
+
message: res.content,
|
|
155
|
+
type: "success",
|
|
156
|
+
duration: 500,
|
|
157
|
+
onClose: () => {
|
|
158
|
+
this.close();
|
|
159
|
+
this.$emit("confirm");
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
},
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
},
|
|
167
|
+
close() {
|
|
168
|
+
this.showDialog = false;
|
|
169
|
+
this.$emit("update:visiable", false);
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
</script>
|
|
@@ -63,6 +63,14 @@
|
|
|
63
63
|
v-if="isDev && currentFormType.addAuth === 1"
|
|
64
64
|
>{{ $t1("新增") }}
|
|
65
65
|
</vxe-button>
|
|
66
|
+
<vxe-button
|
|
67
|
+
status="primary"
|
|
68
|
+
class="button-sty"
|
|
69
|
+
icon="el-icon-document-copy"
|
|
70
|
+
@click="openCopyAppendDialog"
|
|
71
|
+
v-if="isDev && currentFormType.addAuth === 1"
|
|
72
|
+
>{{ $t1("复制") }}
|
|
73
|
+
</vxe-button>
|
|
66
74
|
<vxe-button
|
|
67
75
|
status="success"
|
|
68
76
|
class="button-sty"
|
|
@@ -290,6 +298,13 @@
|
|
|
290
298
|
:rows="checkTags"
|
|
291
299
|
:multi="true"
|
|
292
300
|
></projectTagDialog>
|
|
301
|
+
<copyAppendDialog
|
|
302
|
+
v-if="showCopyAppendDialog"
|
|
303
|
+
:visiable.sync="showCopyAppendDialog"
|
|
304
|
+
:ids="copyIds"
|
|
305
|
+
:serviceName="copyServiceName"
|
|
306
|
+
@confirm="confirmCopyAppendDialog"
|
|
307
|
+
></copyAppendDialog>
|
|
293
308
|
</div>
|
|
294
309
|
</template>
|
|
295
310
|
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
getJsxStatus,
|
|
20
20
|
} from "@base/views/bd/setting/utils/index";
|
|
21
21
|
import formVersionButton from "@base/views/bd/setting/formVersion/link.vue";
|
|
22
|
+
import copyAppendDialog from "@base/views/bd/setting/form_template/copyAppendDialog.vue";
|
|
22
23
|
import settingConfig from "@/settings";
|
|
23
24
|
import {
|
|
24
25
|
getDesignerLayoutType,
|
|
@@ -45,6 +46,7 @@ modules = {
|
|
|
45
46
|
formDesignerDialog: () =>
|
|
46
47
|
import("@base/views/bd/setting/form_template/formDesignerDialog.vue"),
|
|
47
48
|
formVersionButton,
|
|
49
|
+
copyAppendDialog,
|
|
48
50
|
},
|
|
49
51
|
data() {
|
|
50
52
|
return {
|
|
@@ -148,6 +150,9 @@ modules = {
|
|
|
148
150
|
showTree: false,
|
|
149
151
|
designerReadonly: false,
|
|
150
152
|
designerLayoutType: "PC",
|
|
153
|
+
showCopyAppendDialog: false,
|
|
154
|
+
copyIds: [],
|
|
155
|
+
copyServiceName: "",
|
|
151
156
|
};
|
|
152
157
|
},
|
|
153
158
|
computed: {
|
|
@@ -190,6 +195,22 @@ modules = {
|
|
|
190
195
|
this.checkTags = [];
|
|
191
196
|
this.$refs["table-m1"].commitProxy("reload");
|
|
192
197
|
},
|
|
198
|
+
openCopyAppendDialog() {
|
|
199
|
+
let rows = this.$refs["table-m1"].getCheckboxRecords(true) || [];
|
|
200
|
+
if (!rows.length) {
|
|
201
|
+
this.$baseAlert(this.$t1("请选择需要复制的数据"));
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
this.copyIds = rows.map((item) => item.id);
|
|
205
|
+
let serviceNames = [
|
|
206
|
+
...new Set(rows.map((item) => item.serviceName).filter((item) => item)),
|
|
207
|
+
];
|
|
208
|
+
this.copyServiceName = serviceNames.length === 1 ? serviceNames[0] : "";
|
|
209
|
+
this.showCopyAppendDialog = true;
|
|
210
|
+
},
|
|
211
|
+
confirmCopyAppendDialog() {
|
|
212
|
+
this.searchEvent();
|
|
213
|
+
},
|
|
193
214
|
openEditDialog(row) {
|
|
194
215
|
let dataId = row?.id || 0;
|
|
195
216
|
/*this.dataId = !id || typeof id === 'object' ? 0 : id;
|