diff --git a/src/services/setting.ts b/src/services/setting.ts index 3829c2d8..d95d42ce 100644 --- a/src/services/setting.ts +++ b/src/services/setting.ts @@ -234,39 +234,10 @@ export default () => return request.post('/engine/hook/rule_type/add', params) } - ruleAdd(params: { - rule_type_id: string - rule_value: string - rule_source: string - rule_target: string - inherit: string - track: string - language_id: number, - ignore_blacklist?: boolean, - ignore_internal?: boolean, - tags?: any, - untags?: any, - command?: any, - stack_blacklist?: any - }): Promise { + ruleAdd(params: any): Promise { return request.post('/engine/hook/rule/add', params) } - modifyAdd(params: { - rule_id: number - rule_type_id: string - rule_value: string - rule_source: string - rule_target: string - inherit: string - track: string - language_id: number, - ignore_blacklist?: boolean, - ignore_internal?: boolean, - tags?: any, - untags?: any, - command?: any, - stack_blacklist?: any - }): Promise { + modifyAdd(params: any): Promise { return request.post('/engine/hook/rule/modify', params) } diff --git a/src/views/setting/components/hookTable.vue b/src/views/setting/components/hookTable.vue index 6951033a..28d12a5a 100644 --- a/src/views/setting/components/hookTable.vue +++ b/src/views/setting/components/hookTable.vue @@ -40,11 +40,11 @@ class="resetAllBtn" @click="hookTypeDialog = true" > - {{ $t('views.hookPage.addHookType') }} - {{ $t('views.hookPage.addHook') }} @@ -212,17 +212,17 @@ - - + + - + {{ fmtType(hook.type) }} @@ -356,6 +356,7 @@ + {{ $t('views.hookPage.onlyNow') @@ -424,7 +426,7 @@ $t('views.hookPage.nowChildren') }} - + @@ -528,7 +530,7 @@ export default class HookTable extends VueBase { ignore_blacklist: false, tags: [], untags: [], - command: '' + command: '', } relations = [ { label: this.$t('views.hookPage.or'), value: '|' }, @@ -630,7 +632,7 @@ export default class HookTable extends VueBase { this.hookDialog = true this.hook.ignore_internal = row.ignore_internal this.hook.ignore_blacklist = row.ignore_blacklist - this.hook.tags = row.tags + this.hook.tags = row.tags this.hook.untags = row.untags this.hook.command = row.command } @@ -862,21 +864,22 @@ export default class HookTable extends VueBase { if (this.hook.id) { this.loadingStart() const rule_source = this.fmtParams(this.hook.source) - const rule_target = this.fmtParams(this.hook.target) + const rule_target: any = this.fmtParams(this.hook.target) const { status, msg } = await this.services.setting.modifyAdd({ rule_id: this.hook.id, rule_type_id: this.hook.rule_type_id, rule_value: this.hook.rule_value, - rule_target: rule_target, + rule_target: rule_target || undefined, rule_source: rule_source, inherit: this.hook.inherit, track: 'false', language_id: this.activeLanguage, - ignore_internal: this.hook.ignore_internal, + ignore_internal: this.hook.ignore_internal || undefined, ignore_blacklist: this.hook.ignore_blacklist, tags: this.hook.tags, untags: this.hook.untags, command: this.hook.command, + type: Number(this.ruleType) }) this.loadingDone() @@ -888,26 +891,27 @@ export default class HookTable extends VueBase { }) return } + this.$message.success('操作成功') await this.getTable() this.clearHook() } else { this.loadingStart() const rule_source = this.fmtParams(this.hook.source) const rule_target = this.fmtParams(this.hook.target) - const { status, msg } = await this.services.setting.ruleAdd({ rule_type_id: this.hook.rule_type_id, rule_value: this.hook.rule_value, - rule_target: rule_target, + rule_target: rule_target || undefined, rule_source: rule_source, inherit: this.hook.inherit, track: 'false', language_id: this.activeLanguage, - ignore_internal: this.hook.ignore_internal, + ignore_internal: this.hook.ignore_internal || undefined, ignore_blacklist: this.hook.ignore_blacklist, tags: this.hook.tags, untags: this.hook.untags, command: this.hook.command, + type: Number(this.ruleType) }) this.loadingDone() @@ -919,6 +923,8 @@ export default class HookTable extends VueBase { }) return } + console.log('操作成功') + this.$message.success('操作成功') await this.getBase() await this.getTable() this.clearHook()