diff --git a/app/controller/envManagement.js b/app/controller/envManagement.js index fb02683..1c31b11 100644 --- a/app/controller/envManagement.js +++ b/app/controller/envManagement.js @@ -12,12 +12,14 @@ class EnvManagementController extends Controller { // 新增环境 async addEnv() { const { ctx, app } = this; - const { envName, hostIp, url, remark, tagIds } = ctx.request.body; + const { envName, hostIp, uicUsername, uicPasswd, url, remark, tagIds } = ctx.request.body; if (_.isNil(envName)) throw new Error('缺少必要参数 envName'); if (_.isNil(url)) throw new Error('缺少必要参数 url'); const result = await ctx.service.envManagement.addEnv({ envName, hostIp, + uicUsername, + uicPasswd, url, remark, tags: tagIds.join(','), @@ -32,11 +34,14 @@ class EnvManagementController extends Controller { // 编辑环境 async editEnv() { const { ctx, app } = this; - const { id, envName, hostIp, url, remark, tagIds } = ctx.request.body; + const { id, envName, hostIp, uicUsername, uicPasswd, url, remark, tagIds } = + ctx.request.body; if (_.isNil(id)) throw new Error('缺少必要参数id'); await ctx.service.envManagement.editEnv({ id, envName, + uicUsername, + uicPasswd, hostIp, url, remark, diff --git a/app/model/env_management.js b/app/model/env_management.js index f97bb24..cb23cf6 100644 --- a/app/model/env_management.js +++ b/app/model/env_management.js @@ -6,6 +6,8 @@ module.exports = (app) => { id: { type: INTEGER, primaryKey: true, autoIncrement: true }, envName: { type: STRING(255), field: 'env_name' }, hostIp: { type: STRING(20), field: 'host_ip' }, + uicUsername: { type: STRING(255), field: 'uic_username' }, + uicPasswd: { type: STRING(255), field: 'uic_passwd' }, url: { type: STRING(2048), field: 'url' }, remark: STRING(255), tags: { type: STRING(60), field: 'tag_ids' }, diff --git a/app/service/envManagement.js b/app/service/envManagement.js index cf0a6e8..b38804d 100644 --- a/app/service/envManagement.js +++ b/app/service/envManagement.js @@ -6,7 +6,16 @@ class EnvManagementService extends Service { const { ctx } = this; const { tags = '', search = '' } = params; const envResult = await ctx.model.EnvManagement.findAll({ - attributes: ['id', 'envName', 'hostIp', 'url', 'remark', 'tags'], + attributes: [ + 'id', + 'envName', + 'hostIp', + 'uicUsername', + 'uicPasswd', + 'url', + 'remark', + 'tags', + ], where: { status: 1, $or: [ @@ -43,10 +52,12 @@ class EnvManagementService extends Service { } editEnv(env) { const { ctx } = this; - const { id, envName, hostIp, url, remark, tags } = env; + const { id, envName, hostIp, uicUsername, uicPasswd, url, remark, tags } = env; const newEnv = {}; if (!_.isNil(envName)) newEnv.envName = envName; if (!_.isNil(hostIp)) newEnv.hostIp = hostIp; + if (!_.isNil(uicUsername)) newEnv.uicUsername = uicUsername; + if (!_.isNil(uicPasswd)) newEnv.uicPasswd = uicPasswd; if (!_.isNil(url)) newEnv.url = url; if (!_.isNil(remark)) newEnv.remark = remark; if (!_.isNil(tags)) newEnv.tags = tags; diff --git a/app/web/pages/envManagement/components/envModal/index.tsx b/app/web/pages/envManagement/components/envModal/index.tsx index aaa5c07..04f7634 100644 --- a/app/web/pages/envManagement/components/envModal/index.tsx +++ b/app/web/pages/envManagement/components/envModal/index.tsx @@ -3,13 +3,14 @@ import { Form, Input, message as Message, Modal, Select, Spin } from 'antd'; import { isEmpty, isFunction, isNull } from 'lodash'; import { API } from '@/api'; +import { urlReg } from '@/utils/reg'; const FormItem = Form.Item; const { TextArea } = Input; const { Option } = Select; const EnvForm = (props: any) => { const { value, tagList = [], forwardRef } = props; - const { envName, hostIp, url, remark, tags = [] } = value; + const { envName, hostIp, uicUsername, uicPasswd, url, remark, tags = [] } = value; const tagIds = tags.map((item: any) => Number(item.id)); return (
{ initialValues={{ envName, hostIp, + uicUsername, + uicPasswd, url, tagIds, remark, @@ -30,7 +33,7 @@ const EnvForm = (props: any) => { rules={[{ required: true, message: '请输入环境名称' }]} hasFeedback > - + { rules={[{ required: true, message: '请输入主机IP' }]} hasFeedback > - + + + + + + + -