fix: 新增资源选择标签问题修复、项目文档转移

This commit is contained in:
meilin.huang
2023-06-29 20:20:58 +08:00
parent d9807b1bf0
commit d423572e01
10 changed files with 33 additions and 36 deletions

View File

@@ -13,7 +13,7 @@
<img src="https://img.shields.io/docker/pulls/mayflygo/mayfly-go.svg?label=docker%20pulls&color=fac858" alt="docker pulls"/>
</a>
<a href="https://github.com/golang/go" target="_blank">
<img src="https://img.shields.io/badge/Golang-1.18%2B-yellow.svg" alt="golang"/>
<img src="https://img.shields.io/badge/Golang-1.20%2B-yellow.svg" alt="golang"/>
</a>
<a href="https://cn.vuejs.org" target="_blank">
<img src="https://img.shields.io/badge/Vue-3.x-green.svg" alt="vue">
@@ -35,15 +35,14 @@ web版 **linux(终端[终端回放] 文件 脚本 进程)、数据库mysql po
### 系统相关资料
- 项目文档: https://objs.gitee.io/mayfly-go-docs
- 项目文档: https://www.yuque.com/may-fly/mayfly-go
- 系统操作视频: https://space.bilibili.com/484091081/channel/collectiondetail?sid=392854
- 部署文档https://objs.gitee.io/mayfly-go-docs/download
### 系统核心功能截图
##### 记录操作记录
![记录操作记录](https://images.gitee.com/uploads/images/2021/0508/204608_83ef7c33_1240250.png "屏幕截图.png")
![记录操作记录](https://objs.gitee.io/mayfly-go-docs/home/log.jpg "屏幕截图.png")
#### 机器操作
##### 状态查看
@@ -84,4 +83,4 @@ web版 **linux(终端[终端回放] 文件 脚本 进程)、数据库mysql po
![资源管理](https://images.gitee.com/uploads/images/2021/0607/174436_e9e1535c_1240250.png "屏幕截图.png")
**其他更多功能&操作指南可查看在线文档**: https://objs.gitee.io/mayfly-go-docs
**其他更多功能&操作指南可查看在线文档**: https://www.yuque.com/may-fly/mayfly-go

View File

@@ -1,6 +1,6 @@
<template>
<div>
<el-tree-select @check="changeTag" style="width: 100%" v-model="selectTags" :data="tags" placeholder="请选择关联标签"
<el-tree-select v-bind="$attrs" @check="changeTag" style="width: 100%" :data="tags" placeholder="请选择关联标签"
:render-after-expand="true" :default-expanded-keys="[selectTags]" show-checkbox check-strictly node-key="id"
:props="{
value: 'id',
@@ -26,17 +26,8 @@
import { toRefs, reactive, onMounted } from 'vue';
import { tagApi } from '../tag/api';
const props = defineProps({
tagId: {
type: Number,
},
tagPath: {
type: String,
},
})
//定义事件
const emit = defineEmits(['changeTag', 'update:tagId', 'update:tagPath'])
const emit = defineEmits(['changeTag', 'update:tagPath'])
const state = reactive({
tags: [],
@@ -50,19 +41,14 @@ const {
} = toRefs(state)
onMounted(async () => {
if (props.tagId) {
state.selectTags = props.tagId;
}
state.tags = await tagApi.getTagTrees.request(null);
});
const changeTag = (tag: any, checkInfo: any) => {
if (checkInfo.checkedNodes.length > 0) {
emit('update:tagId', tag.id);
emit('update:tagPath', tag.codePath);
emit('changeTag', tag);
} else {
emit('update:tagId', null);
emit('update:tagPath', null);
}
};

View File

@@ -6,7 +6,7 @@
<el-tabs v-model="tabActiveName">
<el-tab-pane label="基础信息" name="basic">
<el-form-item prop="tagId" label="标签:" required>
<tag-select v-model:tag-id="form.tagId" v-model:tag-path="form.tagPath" style="width: 100%" />
<tag-select v-model="form.tagId" v-model:tag-path="form.tagPath" style="width: 100%" />
</el-form-item>
<el-form-item prop="name" label="别名:" required>

View File

@@ -5,12 +5,8 @@
<el-form :model="form" ref="machineForm" :rules="rules" label-width="85px">
<el-tabs v-model="tabActiveName">
<el-tab-pane label="基础信息" name="basic">
<el-form-item prop="tagId" label="标签:" required :rules="{
required: true,
message: '请选择标签',
trigger: ['change', 'blur'],
}">
<tag-select v-model:tag-id="form.tagId" v-model:tag-path="form.tagPath" style="width: 100%" />
<el-form-item prop="tagId" label="标签:">
<tag-select v-model="form.tagId" v-model:tag-path="form.tagPath" style="width: 100%" />
</el-form-item>
<el-form-item prop="name" label="名称:" required>
<el-input v-model.trim="form.name" placeholder="请输入机器别名" auto-complete="off"></el-input>
@@ -100,6 +96,11 @@ const props = defineProps({
const emit = defineEmits(['update:visible', 'cancel', 'val-change'])
const rules = {
tagId: [{
required: true,
message: '请选择标签',
trigger: ['blur', 'change'],
}],
name: [
{
required: true,
@@ -250,7 +251,6 @@ const btnOk = async () => {
const getReqForm = () => {
const reqForm: any = { ...state.form };
debugger
// 如果为密码认证则置空授权凭证id
if (state.authType == 1) {
reqForm.authCertId = -1;

View File

@@ -6,7 +6,7 @@
<el-tabs v-model="tabActiveName">
<el-tab-pane label="基础信息" name="basic">
<el-form-item prop="tagId" label="标签:" required>
<tag-select v-model:tag-id="form.tagId" v-model:tag-path="form.tagPath" style="width: 100%" />
<tag-select v-model="form.tagId" v-model:tag-path="form.tagPath" style="width: 100%" />
</el-form-item>
<el-form-item prop="name" label="名称" required>

View File

@@ -6,7 +6,7 @@
<el-tabs v-model="tabActiveName">
<el-tab-pane label="基础信息" name="basic">
<el-form-item prop="tagId" label="标签:" required>
<tag-select v-model:tag-id="form.tagId" v-model:tag-path="form.tagPath" style="width: 100%" />
<tag-select v-model="form.tagId" v-model:tag-path="form.tagPath" style="width: 100%" />
</el-form-item>
<el-form-item prop="name" label="名称:" required>
<el-input v-model.trim="form.name" placeholder="请输入redis名称" auto-complete="off"></el-input>
@@ -89,6 +89,18 @@ const props = defineProps({
const emit = defineEmits(['update:visible', 'val-change', 'cancel'])
const rules = {
tagId: [{
required: true,
message: '请选择标签',
trigger: ['blur', 'change'],
}],
name: [
{
required: true,
message: '请输入名称',
trigger: ['change', 'blur'],
},
],
host: [
{
required: true,

View File

@@ -11,8 +11,8 @@ type DbForm struct {
Params string `json:"params"`
Database string `json:"database"`
Remark string `json:"remark"`
TagId uint64 `json:"tagId"`
TagPath string `json:"tagPath"`
TagId uint64 `binding:"required" json:"tagId"`
TagPath string `binding:"required" json:"tagPath"`
SshTunnelMachineId int `json:"sshTunnelMachineId"`
}

View File

@@ -8,7 +8,7 @@ type MachineForm struct {
// 资产授权凭证信息列表
AuthCertId int `json:"authCertId"`
TagId uint64 `json:"tagId"`
TagId uint64 `json:"tagId" binding:"required"`
TagPath string `json:"tagPath" binding:"required"`
Username string `json:"username"`
Password string `json:"password"`

View File

@@ -6,7 +6,7 @@ type Mongo struct {
SshTunnelMachineId int `json:"sshTunnelMachineId"` // ssh隧道机器id
Name string `binding:"required" json:"name"`
TagId uint64 `binding:"required" json:"tagId"`
TagPath string `json:"tagPath"`
TagPath string `binding:"required" json:"tagPath"`
}
type MongoCommand struct {

View File

@@ -9,7 +9,7 @@ type Redis struct {
Db string `json:"db"`
SshTunnelMachineId int `json:"sshTunnelMachineId"` // ssh隧道机器id
TagId uint64 `binding:"required" json:"tagId"`
TagPath string `json:"tagPath"`
TagPath string `binding:"required" json:"tagPath"`
Remark string `json:"remark"`
}