{{ btnText }}
@@ -47,16 +50,18 @@ export default {
title: {
type: String,
default: function() {
- return this.$t('assets.PushSetting')
+ return this.$t('assets.PushParams')
}
},
btnText: {
type: String,
- default: null
+ default: function() {
+ return this.$t('common.Setting')
+ }
},
icon: {
type: String,
- default: 'el-icon-setting'
+ default: ''
},
url: {
type: String,
@@ -65,41 +70,55 @@ export default {
method: {
type: String,
default: ''
+ },
+ visible: {
+ type: Boolean,
+ default: false
+ },
+ hasButton: {
+ type: Boolean,
+ default: true
}
},
data() {
return {
- visible: false,
- isDisabled: true,
+ isVisible: this.visible,
+ canSetting: true,
form: this.value,
remoteMeta: {},
config: {
url: this.url,
hasSaveContinue: false,
hasButtons: true,
+ hasReset: false,
fields: [],
method: 'get',
fieldsMeta: {}
- },
- iValue: this.value
+ }
+ }
+ },
+ watch: {
+ visible(val) {
+ this.isVisible = val
}
},
mounted() {
- this.init()
+ this.getUrlMeta()
},
methods: {
- async init() {
+ async getUrlMeta() {
const data = await this.$store.dispatch('common/getUrlMeta', { url: this.url })
this.remoteMeta = data.actions[this.config.method.toUpperCase()] || {}
- if (this.hasDisabled()) {
+ if (this.onCanSetting()) {
this.setFormConfig()
}
},
- hasDisabled() {
+ onCanSetting() {
const filterField = Object.keys(this.remoteMeta)
- this.isDisabled = filterField.includes(this.method)
- return this.isDisabled
+ this.canSetting = filterField.includes(this.method)
+ this.$emit('canSetting', this.canSetting)
+ return this.canSetting
},
setFormConfig() {
const { method } = this
@@ -129,34 +148,16 @@ export default {
return fieldsMeta
},
onSetting() {
- this.visible = true
- console.log('method: ', this.method)
- console.log('this.value', this.value)
+ this.isVisible = true
},
onSubmit(form) {
this.$emit('input', form)
- this.visible = false
+ this.isVisible = false
+ this.$emit('update:visible', this.isVisible)
}
}
}
From 777d31e56296e91ee69292e9d7f6ac75e1495f9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E2=80=9Chuailei000=E2=80=9D?= <2280131253@qq.com>
Date: Fri, 14 Apr 2023 17:45:59 +0800
Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=B4=A6=E5=8F=B7?=
=?UTF-8?q?=E6=8E=A8=E9=80=81=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE=E6=98=AF?=
=?UTF-8?q?=E5=90=A6=E5=8F=AF=E7=82=B9=E5=87=BB=E9=80=BB=E8=BE=91=E5=88=A4?=
=?UTF-8?q?=E6=96=AD=EF=BC=9B=E4=BF=AE=E6=94=B9=E8=A1=A8=E5=8D=95=E6=A0=87?=
=?UTF-8?q?=E9=A2=98=E6=98=BE=E7=A4=BA=EF=BC=9B=E8=B0=83=E6=95=B4=E8=87=AA?=
=?UTF-8?q?=E5=8A=A8=E6=8E=A8=E9=80=81helpText?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/i18n/langs/zh.json | 2 +-
.../accounts/AccountPush/AccountAutoPush.vue | 45 +++++++++----------
.../Platform/AutomationParamsSetting.vue | 10 ++---
3 files changed, 27 insertions(+), 30 deletions(-)
diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json
index 42cbc550b..4ccc93c04 100644
--- a/src/i18n/langs/zh.json
+++ b/src/i18n/langs/zh.json
@@ -21,7 +21,7 @@
"AccountPushList": "账号推送",
"AccountPushCreate": "账号推送创建",
"AccountPushUpdate": "账号推送更新",
- "AutoPushHelpText": "请先选择资产或者节点在进行设置",
+ "AutoPushHelpText": "请先选择资产或者节点再进行设置",
"AccountPushExecutionList": "执行列表"
},
"AccountBackup": {
diff --git a/src/views/accounts/AccountPush/AccountAutoPush.vue b/src/views/accounts/AccountPush/AccountAutoPush.vue
index ad1302238..30563eab5 100644
--- a/src/views/accounts/AccountPush/AccountAutoPush.vue
+++ b/src/views/accounts/AccountPush/AccountAutoPush.vue
@@ -117,9 +117,10 @@ export default {
const platforms = await this.getFilterPlatforms()
let pushAccountMethods = platforms.map(i => i.automation?.push_account_method)
pushAccountMethods = _.uniq(pushAccountMethods)
- this.setFormConfig(pushAccountMethods)
-
- if (pushAccountMethods.length > 0) {
+ // 检测是否有可设置的推送方式
+ const hasCanSettingPushMethods = _.intersection(pushAccountMethods, Object.keys(this.remoteMeta))
+ this.setFormConfig(hasCanSettingPushMethods)
+ if (hasCanSettingPushMethods.length > 0) {
this.isDisabled = false
this.$emit('input', this.form)
} else {
@@ -134,27 +135,25 @@ export default {
this.config.fields = []
for (const method of methods) {
- const filterField = this.remoteMeta[method]
- if (filterField) {
- // 修改资产、节点时不点击设置按钮也需要获取form表单值暴露出去
- if (this.form.hasOwnProperty(method)) {
- newForm[method] = this.form[method]
- }
- fields.push([method, [method]])
- fieldsMeta[method] = {
- fields: [],
- fieldsMeta: {}
- }
- if (Object.keys(filterField?.children || {}).length > 0) {
- for (const [k, v] of Object.entries(filterField.children)) {
- const item = {
- ...v,
- type: 'input'
- }
- delete item.default
- fieldsMeta[method].fields.push(k)
- fieldsMeta[method].fieldsMeta[k] = item
+ const filterField = this.remoteMeta[method] || {}
+ // 修改资产、节点时不点击设置按钮也需要获取form表单值暴露出去
+ if (this.form.hasOwnProperty(method)) {
+ newForm[method] = this.form[method]
+ }
+ fields.push([filterField.label, [method]])
+ fieldsMeta[method] = {
+ fields: [],
+ fieldsMeta: {}
+ }
+ if (Object.keys(filterField?.children || {}).length > 0) {
+ for (const [k, v] of Object.entries(filterField.children)) {
+ const item = {
+ ...v,
+ type: 'input'
}
+ delete item.default
+ fieldsMeta[method].fields.push(k)
+ fieldsMeta[method].fieldsMeta[k] = item
}
}
}
diff --git a/src/views/assets/Platform/AutomationParamsSetting.vue b/src/views/assets/Platform/AutomationParamsSetting.vue
index aac964dd7..cc3b3947b 100644
--- a/src/views/assets/Platform/AutomationParamsSetting.vue
+++ b/src/views/assets/Platform/AutomationParamsSetting.vue
@@ -121,14 +121,11 @@ export default {
return this.canSetting
},
setFormConfig() {
- const { method } = this
- this.config.fieldsMeta = this.getFieldsMeta()
- this.config.fields = [[method, [method]]]
- },
- getFieldsMeta() {
+ let fields = []
const fieldsMeta = {}
const { method } = this
const filterField = this.remoteMeta[method]
+ fields = [[filterField.label, [method]]]
fieldsMeta[method] = {
fields: [],
fieldsMeta: {}
@@ -145,7 +142,8 @@ export default {
}
}
- return fieldsMeta
+ this.config.fields = fields
+ this.config.fieldsMeta = fieldsMeta
},
onSetting() {
this.isVisible = true
From 3d0b7224099a57aca96f0cd00b790dcfbc6f984f Mon Sep 17 00:00:00 2001
From: jiangweidong
Date: Fri, 14 Apr 2023 18:31:35 +0800
Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E9=83=A8?=
=?UTF-8?q?=E5=88=86=E8=B5=84=E6=BA=90=E7=9A=84=E8=87=AA=E5=AE=9A=E4=B9=89?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E5=8C=96=E4=BB=BB=E5=8A=A1(Ping/VerifyAccoun?=
=?UTF-8?q?t/ChangeSecret)=20(#3016)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* perf: 自定义指令自动化任务
* feat: 增加自定义改密指令
* perf: 优化
* perf: 优化
* perf: 调换顺序
* perf: 添加国际化
---
src/components/FormFields/DynamicInput.vue | 83 +++++++++++++++++++
src/components/FormFields/index.js | 3 +
src/i18n/langs/en.json | 1 +
src/i18n/langs/ja.json | 1 +
src/i18n/langs/zh.json | 1 +
.../Platform/AutomationParamsSetting.vue | 15 +++-
.../assets/Platform/PlatformCreateUpdate.vue | 3 +-
.../Platform/PlatformDetail/Automation.vue | 8 +-
src/views/assets/Platform/const.js | 29 ++++++-
9 files changed, 135 insertions(+), 9 deletions(-)
create mode 100644 src/components/FormFields/DynamicInput.vue
diff --git a/src/components/FormFields/DynamicInput.vue b/src/components/FormFields/DynamicInput.vue
new file mode 100644
index 000000000..3248f3214
--- /dev/null
+++ b/src/components/FormFields/DynamicInput.vue
@@ -0,0 +1,83 @@
+
+
+
+
+ {{ inputTitle + ' ' + (index + 1) }}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/FormFields/index.js b/src/components/FormFields/index.js
index 0f4d0fabf..eb69b3167 100644
--- a/src/components/FormFields/index.js
+++ b/src/components/FormFields/index.js
@@ -9,6 +9,7 @@ import PhoneInput from './PhoneInput'
import UploadField from './UploadField'
import UpdateToken from './UpdateToken'
import UserPassword from './UserPassword'
+import DynamicInput from './DynamicInput'
import PasswordInput from './PasswordInput'
import UploadSecret from './UploadSecret'
import WeekCronSelect from './WeekCronSelect'
@@ -27,6 +28,7 @@ export default {
PhoneInput,
UploadField,
UserPassword,
+ DynamicInput,
PasswordInput,
UploadSecret,
WeekCronSelect,
@@ -46,6 +48,7 @@ export {
PhoneInput,
UploadField,
UserPassword,
+ DynamicInput,
PasswordInput,
UploadSecret,
WeekCronSelect,
diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json
index 72b617cd9..c071601af 100644
--- a/src/i18n/langs/en.json
+++ b/src/i18n/langs/en.json
@@ -360,6 +360,7 @@
"PublicIp": "Public ip",
"Push": "Push",
"PushParams": "Push params",
+ "ChangeSecretParams": "Change secret params",
"PushSystemUserNow": "Push system user now",
"PushAllSystemUsersToAsset": "Push all system users to asset",
"QuickUpdate": "Quick update",
diff --git a/src/i18n/langs/ja.json b/src/i18n/langs/ja.json
index 243bf0a3a..71c90b4d6 100644
--- a/src/i18n/langs/ja.json
+++ b/src/i18n/langs/ja.json
@@ -354,6 +354,7 @@
"PublicIp": "パブリックネットワークIP",
"Push": "プッシュ",
"PushParams": "プッシュパラメータ",
+ "ChangeSecretParams": "改密パラメータです",
"PushSystemUserNow": "プッシュシステムユーザー",
"PushAllSystemUsersToAsset": "すべてのシステムユーザーをアセットにプッシュ",
"QuickUpdate": "クイックアップデート",
diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json
index 4ccc93c04..8be844475 100644
--- a/src/i18n/langs/zh.json
+++ b/src/i18n/langs/zh.json
@@ -372,6 +372,7 @@
"PublicIp": "公网IP",
"Push": "推送",
"PushParams": "推送参数",
+ "ChangeSecretParams": "改密参数",
"PushSystemUserNow": "推送系统用户",
"PushAllSystemUsersToAsset": "推送所有系统用户到资产",
"QuickUpdate": "快速更新",
diff --git a/src/views/assets/Platform/AutomationParamsSetting.vue b/src/views/assets/Platform/AutomationParamsSetting.vue
index cc3b3947b..333cb9347 100644
--- a/src/views/assets/Platform/AutomationParamsSetting.vue
+++ b/src/views/assets/Platform/AutomationParamsSetting.vue
@@ -36,6 +36,7 @@