2025-05-30 19:59:25 +08:00
|
|
|
<template>
|
|
|
|
<base-right-dialog
|
|
|
|
@handleClose="examineHandleClose"
|
|
|
|
@handleConfirmClick="handleConfirmClick"
|
|
|
|
:dialogVisible="dialogVisible"
|
|
|
|
size="500px"
|
|
|
|
:appendBody="true"
|
|
|
|
:loading="true"
|
|
|
|
:footerShow="true"
|
2025-06-20 18:58:03 +08:00
|
|
|
:submitShow="submitShow"
|
2025-05-30 19:59:25 +08:00
|
|
|
:submitTitle="'保存'"
|
2025-06-20 18:58:03 +08:00
|
|
|
title="新增账号"
|
2025-05-30 19:59:25 +08:00
|
|
|
>
|
2025-06-20 18:58:03 +08:00
|
|
|
<template #addButton>
|
|
|
|
<el-button type="primary" @click="VerifyAccount">验证账号</el-button>
|
|
|
|
</template>
|
2025-05-30 19:59:25 +08:00
|
|
|
<div class="rightDialogClass_main" style="background: #fff; padding: 10px">
|
|
|
|
<base-form
|
|
|
|
style="padding-top: 0 !important"
|
2025-06-20 18:58:03 +08:00
|
|
|
spanWidth="80px"
|
2025-05-30 19:59:25 +08:00
|
|
|
ref="customForm"
|
|
|
|
:formRow="accountFormRow"
|
|
|
|
:isFunBtn="false"
|
|
|
|
:rules="accountRules"
|
|
|
|
alignAt="block"
|
|
|
|
:span="24"
|
|
|
|
>
|
|
|
|
</base-form>
|
2025-06-20 18:58:03 +08:00
|
|
|
<div class="custom-error-box" v-if="!submitShow && message">
|
|
|
|
<el-alert
|
|
|
|
title="验证失败"
|
|
|
|
type="error"
|
|
|
|
show-icon
|
|
|
|
:closable="false"
|
|
|
|
:description="message"
|
|
|
|
>
|
|
|
|
</el-alert>
|
|
|
|
</div>
|
|
|
|
<div class="custom-error-box" v-if="submitShow && message">
|
|
|
|
<el-alert
|
|
|
|
title="验证成功"
|
|
|
|
type="success"
|
|
|
|
show-icon
|
|
|
|
:closable="false"
|
|
|
|
:description="message"
|
|
|
|
>
|
|
|
|
</el-alert>
|
|
|
|
</div>
|
2025-05-30 19:59:25 +08:00
|
|
|
</div>
|
|
|
|
</base-right-dialog>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { authApi } from "@/api/apis/auth";
|
|
|
|
import baseRightDialog from "@/components/base/baseRightDialog/index.vue";
|
|
|
|
import baseForm from "@/components/base/baseNewForm";
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
baseRightDialog,
|
|
|
|
baseForm,
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
dialogVisible: false,
|
|
|
|
accountFormRow: [
|
|
|
|
{
|
|
|
|
elCol: [
|
|
|
|
{
|
|
|
|
label: "账号名称",
|
|
|
|
prop: "name",
|
|
|
|
tag: "elInput",
|
|
|
|
span: 24,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elCol: [
|
|
|
|
{
|
|
|
|
label: "登录账号",
|
|
|
|
prop: "userName",
|
|
|
|
tag: "elInput",
|
|
|
|
span: 24,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elCol: [
|
|
|
|
{
|
|
|
|
label: "登录密码",
|
|
|
|
prop: "password",
|
|
|
|
tag: "elInput",
|
|
|
|
span: 24,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elCol: [
|
|
|
|
{
|
|
|
|
label: "数据库类型",
|
|
|
|
prop: "dbType",
|
|
|
|
tag: "elSelect",
|
|
|
|
options: [],
|
|
|
|
optionValue: "columnContent",
|
|
|
|
optionLabel: "columnValue",
|
|
|
|
span: 24,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elCol: [
|
|
|
|
{
|
|
|
|
label: "数据库名称",
|
|
|
|
prop: "dbName",
|
|
|
|
tag: "elInput",
|
|
|
|
span: 24,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elCol: [
|
|
|
|
{
|
|
|
|
label: "ip地址",
|
|
|
|
prop: "ipAddress",
|
|
|
|
tag: "elInput",
|
|
|
|
span: 24,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
elCol: [
|
|
|
|
{
|
|
|
|
label: "端口",
|
|
|
|
prop: "port",
|
|
|
|
tag: "elInput",
|
|
|
|
span: 24,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
accountRules: {
|
|
|
|
name: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: "请输入",
|
|
|
|
trigger: "change, blur",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
userName: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: "请输入",
|
|
|
|
trigger: "change, blur",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
password: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: "请输入",
|
|
|
|
trigger: "change, blur",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
dbType: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: "请选择",
|
|
|
|
trigger: "change, blur",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
dbName: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: "请输入",
|
|
|
|
trigger: "change, blur",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
ipAddress: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: "请输入",
|
|
|
|
trigger: "change, blur",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
port: [
|
|
|
|
{
|
|
|
|
required: true,
|
|
|
|
message: "请输入",
|
|
|
|
trigger: "change, blur",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
appID: "",
|
2025-06-20 18:58:03 +08:00
|
|
|
sceneID: "",
|
|
|
|
stepID: "",
|
2025-05-30 19:59:25 +08:00
|
|
|
accountType: "",
|
2025-06-20 18:58:03 +08:00
|
|
|
submitShow: false, //是否显示查看按钮
|
|
|
|
message: "",
|
2025-05-30 19:59:25 +08:00
|
|
|
};
|
|
|
|
},
|
|
|
|
methods: {
|
2025-06-20 18:58:03 +08:00
|
|
|
openDialog(appID, sceneID, stepID) {
|
|
|
|
this.submitShow = false;
|
|
|
|
this.message = "";
|
2025-05-30 19:59:25 +08:00
|
|
|
this.queryDictionaryList();
|
|
|
|
this.appID = appID;
|
2025-06-20 18:58:03 +08:00
|
|
|
this.sceneID = sceneID;
|
|
|
|
this.stepID = stepID;
|
2025-05-30 19:59:25 +08:00
|
|
|
this.dialogVisible = true;
|
|
|
|
this.$nextTick(() => {
|
|
|
|
this.$refs.customForm?.resetFields("ruleForm");
|
|
|
|
});
|
|
|
|
},
|
|
|
|
async queryDictionaryList() {
|
|
|
|
let params = {
|
|
|
|
tabName: "sys_flow_step_account",
|
|
|
|
columnName: "db_type",
|
|
|
|
};
|
|
|
|
let res = await authApi(
|
|
|
|
"sysdictionaryshopnewService",
|
|
|
|
"",
|
|
|
|
"queryDictionaryList",
|
|
|
|
"",
|
|
|
|
params
|
|
|
|
);
|
|
|
|
if (res.status == 200) {
|
|
|
|
this.accountFormRow[3].elCol[0].options = res.attribute;
|
|
|
|
}
|
|
|
|
},
|
2025-06-20 18:58:03 +08:00
|
|
|
VerifyAccount() {
|
|
|
|
this.$refs.customForm.$refs["ruleForm"].validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
let params = {
|
|
|
|
...this.$refs.customForm.ruleForm,
|
|
|
|
};
|
|
|
|
this.verifyDataBase(params);
|
|
|
|
} else {
|
|
|
|
this.$message({ message: "请选择必填项", type: "warning" });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
async verifyDataBase(params) {
|
|
|
|
this.openLoading("验证");
|
|
|
|
let res = await authApi(
|
|
|
|
"sysFlowStepAccountService",
|
|
|
|
"",
|
|
|
|
"verifyDataBase",
|
|
|
|
"",
|
|
|
|
params
|
|
|
|
);
|
|
|
|
if (res.status == "200") {
|
|
|
|
this.message = res.attribute.msg || "";
|
|
|
|
if (res.attribute.flag == true) {
|
|
|
|
this.submitShow = true;
|
|
|
|
} else {
|
|
|
|
this.submitShow = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
2025-05-30 19:59:25 +08:00
|
|
|
handleConfirmClick() {
|
|
|
|
this.$refs.customForm.$refs["ruleForm"].validate((valid) => {
|
|
|
|
if (valid) {
|
|
|
|
let params = {
|
|
|
|
...this.$refs.customForm.ruleForm,
|
|
|
|
appId: this.appID,
|
2025-06-20 18:58:03 +08:00
|
|
|
status: 1,
|
|
|
|
flowId: this.sceneID,
|
|
|
|
stepId: this.stepID,
|
2025-05-30 19:59:25 +08:00
|
|
|
};
|
|
|
|
this.SaveAccountData(params);
|
|
|
|
} else {
|
|
|
|
this.$message({ message: "请选择必填项", type: "warning" });
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
async SaveAccountData(params) {
|
|
|
|
let res = await authApi(
|
2025-06-20 18:58:03 +08:00
|
|
|
"sysFlowStepAccountService",
|
2025-05-30 19:59:25 +08:00
|
|
|
"",
|
|
|
|
"saveAccount",
|
|
|
|
"",
|
|
|
|
params
|
|
|
|
);
|
|
|
|
if (res.status == "200") {
|
|
|
|
this.$vmNews("新增账号成功", "success");
|
|
|
|
this.dialogVisible = false;
|
|
|
|
this.$emit("handleConfirmClick");
|
|
|
|
}
|
|
|
|
},
|
|
|
|
examineHandleClose() {
|
|
|
|
this.dialogVisible = false;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
::v-deep .el-form-item__content {
|
|
|
|
width: 100% !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
::v-deep .label {
|
|
|
|
text-align: left !important;
|
|
|
|
}
|
2025-06-20 18:58:03 +08:00
|
|
|
|
|
|
|
::v-deep .custom-error-box .el-alert {
|
|
|
|
padding: 15px 16px !important;
|
|
|
|
}
|
|
|
|
::v-deep .custom-error-box .el-alert__title {
|
|
|
|
font-size: 14px !important;
|
|
|
|
}
|
|
|
|
::v-deep .custom-error-box .el-alert__description {
|
|
|
|
font-size: 13px !important;
|
|
|
|
}
|
2025-05-30 19:59:25 +08:00
|
|
|
</style>
|