Commit fca1bd44 authored by 张耀's avatar 张耀

Merge branch 'dev' into zy

parents 302fb2f2 6fc4729c
......@@ -115,11 +115,11 @@ export default {
mounted() {
// this.getSysOptions();
// 用户登录状态有效检测
if (this.userInfo) {
setInterval(() => {
$axios.get("/apaas/system/v5/user/login/check");
}, 15 * 1000);
}
// if (this.userInfo) {
// setInterval(() => {
// $axios.get("/apaas/system/v5/user/login/check");
// }, 15 * 1000);
// }
},
methods: {
openMsg(data) {
......
......@@ -12,7 +12,7 @@
</template>
<script setup>
import { reactive, ref, onBeforeMount, toRefs } from "vue";
import { reactive, ref, onBeforeMount, toRefs, watch } from "vue";
const props = defineProps({
modelValue: {
type: [String, Number],
......@@ -35,6 +35,13 @@ const emit = defineEmits(["update:modelValue", "change"]);
const nowIndex = ref("");
watch(
() => props.modelValue,
() => {
nowIndex.value = props.modelValue;
}
);
const changeInner = (val) => {
nowIndex.value = val;
emit("update:modelValue", val);
......@@ -42,7 +49,7 @@ const changeInner = (val) => {
};
onBeforeMount(() => {
nowIndex.value = props.default;
nowIndex.value = props.modelValue;
});
</script>
......
<template>
<div class="bg-breadcrumb">
<el-breadcrumb separator="/">
<el-breadcrumb-item v-if="state.breadcrumbData.length>=2" v-for="(item,index) in state.dataArr" :to="{ path: item.path }"> {{item.name}} </el-breadcrumb-item>
<el-breadcrumb-item> {{state.breadcrumbData[state.breadcrumbData.length-1].name}} </el-breadcrumb-item>
<el-breadcrumb-item
v-if="state.breadcrumbData.length >= 2"
v-for="(item, index) in state.dataArr"
:to="{ path: item.path }">
{{ item.name }}
</el-breadcrumb-item>
<el-breadcrumb-item> {{ state.breadcrumbData[state.breadcrumbData.length - 1].name }} </el-breadcrumb-item>
</el-breadcrumb>
</div>
</template>
<script setup>
import { reactive, ref,onBeforeMount,toRefs } from 'vue'
import { useRouter,useRoute } from 'vue-router'
import { reactive, ref, onBeforeMount, toRefs } from "vue";
import { useRouter, useRoute } from "vue-router";
import store from "@/store";
import { ElMessage } from 'element-plus'
const router = useRouter()
const route = useRoute()
import { ElMessage } from "element-plus";
const router = useRouter();
const route = useRoute();
const state = reactive({
dataArr:[],
breadcrumbData:[]
})
dataArr: [],
breadcrumbData: [],
});
const props = defineProps({
isMenu:{
type:Boolean,
default:false
}
})
isMenu: {
type: Boolean,
default: false,
},
});
const getBreadcrumbData = (menuObj,menu,path)=>{
//获取整体需要路径
let parentPath = menuObj[path].rowPath.slice(1,menuObj[path].rowPath.length).split('.')
getFirstPath(parentPath,menu)
//有2层以上的面包屑显示,则继续向下处理
if(parentPath.length>=2){
getOtherPath(parentPath,menu)
}
}
const getBreadcrumbData = (menuObj, menu, path) => {
//获取整体需要路径
let parentPath = menuObj[path].rowPath.slice(1, menuObj[path].rowPath.length).split(".");
getFirstPath(parentPath, menu);
//有2层以上的面包屑显示,则继续向下处理
if (parentPath.length >= 2) {
getOtherPath(parentPath, menu);
}
};
const getFirstPath = (parentPath,menu)=>{
let tempMenu = menu[parentPath[0]]
if (!props.isMenu) {
tempMenu = tempMenu.children[parentPath[1]]
}
//目录则跳转第一个子类,菜单子菜单则跳转自身
if(tempMenu.menuType==0){
if(tempMenu.children&&tempMenu.children.length){
const getFirstPath = (parentPath, menu) => {
let tempMenu = menu[parentPath[0]];
if (!props.isMenu) {
tempMenu = tempMenu.children[parentPath[1]];
}
//目录则跳转第一个子类,菜单子菜单则跳转自身
if (tempMenu.menuType == 0) {
if (tempMenu.children && tempMenu.children.length) {
for (let index = 0; index < tempMenu.children.length; index++) {
const e = tempMenu.children[index];
if(e.menuType!==0){
state.breadcrumbData.push(
{
path:e.path,
name:tempMenu.menuName
}
)
break
if (e.menuType !== 0) {
state.breadcrumbData.push({
path: e.path,
name: tempMenu.menuName,
});
break;
}
}
}
}else{
state.breadcrumbData.push(
{
path:tempMenu.path,
name:tempMenu.menuName
} else {
state.breadcrumbData.push({
path: tempMenu.path,
name: tempMenu.menuName,
});
}
)
}
}
};
const getOtherPath = (parentPath,menu)=>{
let tempMenu = menu[parentPath[0]]
let index
if (!props.isMenu) {
index = 2
tempMenu = tempMenu.children[parentPath[1]].children||[]
}else {
tempMenu = tempMenu.children || []
index = 1
}
if(tempMenu.length&&parentPath[index]){
getPath(tempMenu,parentPath,index)
}
}
const getOtherPath = (parentPath, menu) => {
let tempMenu = menu[parentPath[0]];
let index;
if (!props.isMenu) {
index = 2;
tempMenu = tempMenu.children[parentPath[1]].children || [];
} else {
tempMenu = tempMenu.children || [];
index = 1;
}
if (tempMenu.length && parentPath[index]) {
getPath(tempMenu, parentPath, index);
}
};
const getPath = (tempMenu,parentPath,index)=>{
if(!tempMenu[parentPath[index]]){
return
}
tempMenu = tempMenu[parentPath[index]]
index = index+1
state.breadcrumbData.push(
{
path:tempMenu.path,
name:tempMenu.menuName
const getPath = (tempMenu, parentPath, index) => {
if (!tempMenu[parentPath[index]]) {
return;
}
tempMenu = tempMenu[parentPath[index]];
index = index + 1;
state.breadcrumbData.push({
path: tempMenu.path,
name: tempMenu.menuName,
});
if (tempMenu.children && tempMenu.children.length && parentPath[index]) {
getPath(tempMenu.children, parentPath, index);
}
)
if(tempMenu.children&&tempMenu.children.length&&parentPath[index]){
getPath(tempMenu.children,parentPath,index)
}
}
};
onBeforeMount(()=>{
getBreadcrumbData(store.state.menuObj,store.state.menu,route.path)
state.breadcrumbData.forEach((e,idx) => {
if(idx!==state.breadcrumbData.length-1){
state.dataArr.push(e)
onBeforeMount(() => {
getBreadcrumbData(store.state.menuObj, store.state.menu, route.path);
state.breadcrumbData.forEach((e, idx) => {
if (idx !== state.breadcrumbData.length - 1) {
state.dataArr.push(e);
}
});
});
})
</script>
<style scoped>
</style>
<style scoped></style>
......@@ -233,7 +233,7 @@ export default {
},
menuAction(n, parent) {
if (n == "logout") {
this.$axios.post("/apaas/system/v5/user/logout").then((res) => {
this.$axios.post("/v1/api/user/logout").then((res) => {
if (res.data.code == "200") {
window.location.href = "/so/manage/ui//#/login";
this.$store.commit("setUserInfo", null);
......
......@@ -60,6 +60,7 @@ import axios from "@/request/http.js";
import { Encrypt } from "@/services/secret.js";
import { useStore } from "vuex";
import { useRouter } from "vue-router";
import { menuData } from "./menu";
const router = useRouter();
......@@ -95,7 +96,7 @@ const loginAction = () => {
loginFormRef.value.validate((valid) => {
if (valid) {
axios.get(`/apaas/system/v5/user/verifyCaptcha?id=${state.imgId}&value=${state.loginForm.yzm}`).then((res) => {
axios.get(`/v1/api/user/verifyCaptcha?id=${state.imgId}&value=${state.loginForm.yzm}`).then((res) => {
if (res.data.code == 200) {
login();
} else {
......@@ -107,7 +108,7 @@ const loginAction = () => {
};
const login = () => {
axios
.post(`/apaas/system/v5/user/login`, {
.post(`/v1/api/user/login`, {
system_account: state.loginForm.userid,
password: Encrypt(state.loginForm.password),
})
......@@ -124,13 +125,17 @@ const login = () => {
});
};
const getUserInfo = () => {
return axios.get(`/apaas/system/v5/user/getUserInfo`);
return axios.get(`/v1/api/user/getUserInfo`);
};
const getMenu = (search) => {
return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`);
// return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`);
return new Promise((resolve, reject) => {
resolve(menuData);
});
};
const getUser = () => {
Promise.all([getUserInfo(), getMenu("79a8f214-db78-4db7-9c28-db66276b4be2")]).then((res) => {
console.log("res", res);
if (res[0].data.code == 200 && res[1].data.code == 200) {
let data = (res[1].data.data && res[1].data.data[0].children) || [];
store.commit("setUserInfo", res[0].data.data);
......@@ -162,7 +167,7 @@ const getMenuObj = (menu, parentRowPath, menuObj) => {
});
};
const getImg = (clearInput = false) => {
axios.get(`/apaas/system/v5/user/getCaptcha??width=138&height=36`).then((res) => {
axios.get(`/v1/api/user/getCaptcha?width=138&height=36`).then((res) => {
if (res.data.code == 200) {
state.imgId = res.data.data.id;
state.imgSrc = res.data.data.captcha;
......
......@@ -142,7 +142,7 @@ const loginAction = () => {
}; // 短信验证码登录
const getUserInfo = () => {
return axios.get(`/apaas/system/v5/user/getUserInfo`);
return axios.get(`/v1/api/user/getUserInfo`);
};
const getMenu = (search) => {
return axios.get(`/apaas/system/v5/menu/user/tree?search=${search}`);
......
This diff is collapsed.
......@@ -65,7 +65,7 @@ import menu from "./router/function.js";
//获取用户信息
function getUser() {
return axios.get(`/apaas/system/v5/user/getUserInfo`);
return axios.get(`/v1/api/user/getUserInfo`);
}
//获取用户菜单信息
......
......@@ -4,10 +4,18 @@
<p class="login-title">登录</p>
<el-form :model="form" ref="form" class="login_forms">
<el-form-item>
<el-input v-model.trim="form.userid" autofocus="autofocus" placeholder="请输入账号" @keyup.enter="login_remember_info()"></el-input>
<el-input
v-model.trim="form.userid"
autofocus="autofocus"
placeholder="请输入账号"
@keyup.enter="login_remember_info()"></el-input>
</el-form-item>
<el-form-item>
<el-input type="password" v-model.trim="form.password" placeholder="请输入密码" @keyup.enter="login_remember_info()">
<el-input
type="password"
v-model.trim="form.password"
placeholder="请输入密码"
@keyup.enter="login_remember_info()">
<!-- <span
slot="suffix"
:title="visible ? '显示密码' : '隐藏密码'"
......@@ -19,7 +27,12 @@
</el-form-item>
<el-form-item prop="yzm" class="yzm">
<div class="yzm_ctx">
<el-input class="yzm_ipt" v-model.trim="form.yzm" placeholder="请输入验证码" :validate-event="false" @keyup.enter="login_remember_info()"></el-input>
<el-input
class="yzm_ipt"
v-model.trim="form.yzm"
placeholder="请输入验证码"
:validate-event="false"
@keyup.enter="login_remember_info()"></el-input>
<img class="yzm_img" title="看不清?换一张" :src="imgSrc" @click="getImg()" />
</div>
</el-form-item>
......@@ -33,17 +46,17 @@
<script>
import { setCookie, clearCookie } from "../../services/cookie.js";
import menu from '../../router/function'
import {generateRoutes} from '../../router/index'
import inputTable from '../../components/input-table.vue';
import inputObjectTable from '../../components/input-object-table.vue';
import menu from "../../router/function";
import { generateRoutes } from "../../router/index";
import inputTable from "../../components/input-table.vue";
import inputObjectTable from "../../components/input-object-table.vue";
import CryptoJS from "crypto-js";
export default {
props: {},
components: {
inputTable,
inputObjectTable
inputObjectTable,
},
data() {
return {
......@@ -63,36 +76,36 @@ export default {
},
mounted() {},
methods: {
getMenuObj(menu,parentRowPath,menuObj){
menu.forEach((e,idx) => {
e.rowPath = parentRowPath + '.' + idx
menuObj[e.path] = e
if(e.children&&e.children.length){
this.getMenuObj(e.children,e.rowPath,menuObj)
getMenuObj(menu, parentRowPath, menuObj) {
menu.forEach((e, idx) => {
e.rowPath = parentRowPath + "." + idx;
menuObj[e.path] = e;
if (e.children && e.children.length) {
this.getMenuObj(e.children, e.rowPath, menuObj);
}
});
},
getUser() {
this.$axios.get(`/apaas/system/v5/user/getUserInfo`).then((res) => {
this.$axios.get(`/v1/api/user/getUserInfo`).then((res) => {
if (res.data.code == 200) {
this.$store.commit("setUserInfo", res.data.data);
// if (res.data.data.userType == 1) {
//超管
this.$store.commit("setMenu", menu.adminMenu);
menu.menuToRouter(menu.adminMenu)
menu.menuToRouter(menu.adminMenu);
this.$store.commit('setRoute',menu.adminMenu)
this.$store.commit("setRoute", menu.adminMenu);
//存储菜单对象信息
let menuObj = {}
this.getMenuObj(menu.adminMenu,'',menuObj)
this.$store.commit('setMenuObj',menuObj)
let menuObj = {};
this.getMenuObj(menu.adminMenu, "", menuObj);
this.$store.commit("setMenuObj", menuObj);
// }
generateRoutes()
generateRoutes();
// this.$router.push("/");
//跳转到工作台页面
window.location.href = '/so/manage/ui/#/'
window.location.href = "/so/manage/ui/#/";
}
});
},
......@@ -106,9 +119,7 @@ export default {
if (!this.form.yzm) {
return this.$message.error("请输入验证码");
}
this.$axios
.get(`/apaas/system/v5/user/verifyCaptcha?id=${this.imgId}&value=${this.form.yzm}`)
.then((res) => {
this.$axios.get(`/apaas/system/v5/user/verifyCaptcha?id=${this.imgId}&value=${this.form.yzm}`).then((res) => {
if (res.data.code == 200) {
this.login();
} else {
......@@ -117,11 +128,10 @@ export default {
});
},
login() {
this.$axios
.post(`/apaas/system/v5/user/login`, {
system_account: this.form.userid,
password: CryptoJS.AES.encrypt(this.form.password,"swuE9cmCZQwrkYRV").toString(),
password: CryptoJS.AES.encrypt(this.form.password, "swuE9cmCZQwrkYRV").toString(),
})
.then((res) => {
if (res.data.code == 200) {
......@@ -183,7 +193,6 @@ export default {
height: 32px;
margin-left: 10px;
display: inline-block;
}
.btn_sub {
width: 400px;
......
......@@ -9,7 +9,7 @@
placeholder="请输入关键字">
<template v-slot:left_action>
<div class="apaas_button">
<el-button type="default" @click="deleteAllTips"> 返回 </el-button>
<el-button type="default" @click="router.go(-1)"> 返回 </el-button>
</div>
<span class="filter-group-item">执行ping命令</span>
</template>
......@@ -18,8 +18,8 @@
<div class="table bg-scroll">
<bg-table ref="dataTable" :headers="headers" :rows="tableRows" :stripe="true">
<template v-slot:desc="{ row }">
<span class="can_click_text" @click="getChildren(row)">
{{ row.name }}
<span class="can_click_text" @click="gotoPage(`/auto-maintenance/task-history/list/record?id=${row.id}`)">
{{ row.desc }}
</span>
</template>
<template v-slot:state="{ row }">
......@@ -41,11 +41,15 @@
<script setup>
import { reactive, ref, onBeforeMount, toRefs, computed, watch, nextTick, watchEffect } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessage } from "element-plus";
import axios from "@/request/http.js";
import { Search } from "@element-plus/icons-vue";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
const bgForm = ref(null);
const router = useRouter();
const route = useRoute();
const dataTable = ref(null);
const headers = [
{
......@@ -71,100 +75,30 @@ const headers = [
];
const state = reactive({
bgForm,
typeList: [], // 分类数据
typeKeyword: "", // 分类删选关键词
nodeClassifyId: null, // 当前选中分类的uuid 用于新增字典
nodeId: null, // 当前选中分类的id 用于请求列表
timer: null, // 定时器
tableRows: [], // 表格数据
selected: [], //选择数据
tableRows: [
{
state: "执行中",
desc: "asda",
},
], // 表格数据
tableTotal: 0, // 表格数据条数
filter: {
time: "",
search: "",
page: 1,
limit: 10,
}, // 表格筛选项
actionRow: null, // 当前操作的数据
dialogDelete: false, // 删除弹窗
addType: 0, //
addDialog: false,
formData: {
name: "",
describe: "",
state: 1,
p_dict_id: "",
},
rules: {
name: [{ required: true, message: "请输入名称", trigger: "blur" }],
describe: [
{ required: true, message: "请输入描述", trigger: "blur" },
{ max: 200, message: "描述最大为200字", trigger: "blur" },
],
state: [{ required: true, message: "请选择是否启用", trigger: "change" }],
},
fatherRow: null,
});
const selectRows = (data) => {
state.selected = data.selection;
};
const clearSelected = () => {
dataTable.value.clearTable();
};
const deleteAllTips = () => {};
const getChildren = (row) => {
state.tableRows = row.children || [];
state.tableTotal = row.total_children;
state.fatherRow = row;
const gotoPage = (url) => {
router.push(url);
};
const getTypeList = () => {
let params = {
name: state.typeKeyword,
};
axios
.get(`/apaas/system/v5/dictionary/classify/list`, { params })
.then((res) => {
if (res.data.code == 200) {
state.typeList = res.data.data || [];
state.nodeClassifyId = state.typeList[0].classify_id || null;
state.nodeId = state.typeList[0].id || null;
if (state.nodeId) {
getTableRows();
}
} else {
ElMessage.error(res.data.data);
}
})
.catch((err) => {
console.log(err);
});
}; // 获取字典分类
const changeSearch = (val) => {
state.filter.search = val;
changePage(1);
}; // 表格关键字筛选
const filterAction = () => {
changePage(1);
}; // 查询按钮
const filterClear = () => {
state.filter = {
time: "",
search: "",
limit: 10,
page: 1,
};
changePage(1);
}; // 重置筛选项
const getTableRows = () => {
let params = { ...state.filter };
params.id = state.nodeId;
......@@ -193,29 +127,7 @@ const changeSize = (size) => {
changePage(1);
}; // 改变每页条数
const register = () => {
state.formData = {
name: "",
describe: "",
state: 1,
p_dict_id: state.fatherRow ? state.fatherRow.dict_id : "",
};
if (state.bgForm) {
nextTick().then(() => {
state.bgForm.validate((valid) => {
if (!valid) {
state.bgForm.clearValidate();
}
});
});
}
state.addType = 1;
state.addDialog = true;
}; // 新增字典按钮
onBeforeMount(() => {
getTypeList();
});
onBeforeMount(() => {});
const { tableRows, tableTotal, filter } = toRefs(state);
</script>
......
<template>
<div class="detail_container">
<bg-breadcrumb></bg-breadcrumb>
<div class="main_container">
<div class="top-container">
<el-button class="back" type="default" @click="router.go(-1)"> 返回 </el-button>
执行ping命令 / 执行说明1
</div>
<div class="middle-container">
<finish-use :state="true" height="calc(100vh - 330px)" time="00:00:11"></finish-use>
</div>
<div class="bottom-container">
<el-button class="use-script" type="primary" @click="router.go(-1)"> 重新执行 </el-button>
</div>
</div>
</div>
</template>
<script setup>
import { reactive, ref, onBeforeMount, toRefs } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessage } from "element-plus";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
import finishUse from "@/page/main/auto-maintenance/task-manage/add/finish-use.vue";
const router = useRouter();
const route = useRoute();
const state = reactive({ data: 1 });
const { data } = toRefs(state);
</script>
<style lang="scss" scoped>
.top-container {
width: 100%;
height: 70px;
line-height: 70px;
text-align: center;
font-size: 14px;
color: #202531;
position: relative;
.back {
position: absolute;
top: 16px;
left: 16px;
}
}
.middle-container {
flex: 1;
padding: 30px 30px 10px 30px;
border-top: 1px solid #e6e9ef;
border-bottom: 1px solid #e6e9ef;
}
.bottom-container {
width: 100%;
height: 50px;
.use-script {
margin: 16px;
float: right;
}
}
</style>
......@@ -33,10 +33,12 @@ const props = defineProps({
},
});
const ruleFormRef = ref(null);
const state = reactive({
ruleForm: {
name: props.data?.name,
desc: props.data?.desc,
name: props.data?.name || "",
desc: props.data?.desc || "",
},
rules: {
name: [
......@@ -47,10 +49,28 @@ const state = reactive({
},
});
const save = () => {};
const save = () => {
return new Promise((resolve, reject) => {
ruleFormRef.value.validate((valid, fields) => {
if (valid) {
props.data.name = state.ruleForm.name;
props.data.desc = state.ruleForm.desc;
resolve();
} else {
reject();
console.log("error submit!", fields);
}
});
});
};
const clear = () => {
ruleFormRef.value.resetFields();
};
defineExpose({
save,
clear,
});
</script>
......
<template>
<div>
<div class="state-box">
<span
><bg-icon style="font-size: 12px; color: #909bb6" icon="#bg-ic-time"></bg-icon> 已经过:{{ props.time }}</span
>
<div class="state-show success" v-if="props.state">
<bg-icon style="color: #429e8a" icon="#bg-ic-s-circle-check"></bg-icon> 执行成功
</div>
<div class="state-show fail" v-else>
<bg-icon style="color: #d75138" icon="#bg-ic-s-circle-close"></bg-icon> 执行失败
</div>
</div>
<div class="log-bg bg-scroll" :style="{ height: props.height }">
<div class="log-box">
<div v-for="(item, i) in stateData.codes" :key="i" class="codes-box">
<span class="codes-num">{{ item.pos + 1 }}</span>
<span class="codes-out" v-html="item.out"></span>
</div>
</div>
</div>
</div>
</template>
<script setup>
import { reactive, ref, onBeforeMount, toRefs } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessage } from "element-plus";
const router = useRouter();
const route = useRoute();
const props = defineProps({
codes: {
type: Array,
default: () => [],
},
state: {
type: Boolean,
default: true,
},
time: {
type: String,
default: "",
},
height: {
type: String,
default: "",
},
});
const stateData = reactive({
codes: [
{
pos: 0,
out: "SSH password:",
},
{
pos: 1,
out: "[WARNING]: Platform darwin on host 192.168.1.199 is using the discovered Pythoninterpreter at /usr/bin/python3, but future installation of another Pythoninterpreter could change ",
},
{
pos: 2,
out: "the meaning of that path. See",
},
{
pos: 3,
out: "https://docs.ansible.com/ansible-",
},
{
pos: 0,
out: "SSH password:",
},
{
pos: 1,
out: "[WARNING]: Platform darwin on host 192.168.1.199 is using the discovered Pythoninterpreter at /usr/bin/python3, but future installation of another Pythoninterpreter could change ",
},
{
pos: 2,
out: "the meaning of that path. See",
},
{
pos: 3,
out: "https://docs.ansible.com/ansible-",
},
{
pos: 0,
out: "SSH password:",
},
{
pos: 1,
out: "[WARNING]: Platform darwin on host 192.168.1.199 is using the discovered Pythoninterpreter at /usr/bin/python3, but future installation of another Pythoninterpreter could change ",
},
{
pos: 2,
out: "the meaning of that path. See",
},
{
pos: 3,
out: "https://docs.ansible.com/ansible-",
},
{
pos: 3,
out: "https://docs.ansible.com/ansible-",
},
{
pos: 0,
out: "SSH password:",
},
{
pos: 1,
out: "[WARNING]: Platform darwin on host 192.168.1.199 is using the discovered Pythoninterpreter at /usr/bin/python3, but future installation of another Pythoninterpreter could change ",
},
{
pos: 2,
out: "the meaning of that path. See",
},
{
pos: 3,
out: "https://docs.ansible.com/ansible-",
},
{
pos: 3,
out: "https://docs.ansible.com/ansible-",
},
{
pos: 0,
out: "SSH password:",
},
{
pos: 1,
out: "[WARNING]: Platform darwin on host 192.168.1.199 is using the discovered Pythoninterpreter at /usr/bin/python3, but future installation of another Pythoninterpreter could change ",
},
{
pos: 2,
out: "the meaning of that path. See",
},
{
pos: 3,
out: "https://docs.ansible.com/ansible-",
},
{
pos: 3,
out: "https://docs.ansible.com/ansible-",
},
{
pos: 0,
out: "SSH password:",
},
{
pos: 1,
out: "[WARNING]: Platform darwin on host 192.168.1.199 is using the discovered Pythoninterpreter at /usr/bin/python3, but future installation of another Pythoninterpreter could change ",
},
{
pos: 2,
out: "the meaning of that path. See",
},
{
pos: 3,
out: "https://docs.ansible.com/ansible-",
},
],
});
</script>
<style lang="scss" scoped>
.state-box {
width: 100%;
height: 36px;
margin-top: -18px;
margin-bottom: 12px;
position: relative;
font-size: 14px;
color: #404a62;
span {
position: absolute;
left: 0;
top: 10px;
}
.state-show {
width: 200px;
height: 36px;
line-height: 36px;
text-align: center;
border-radius: 4px;
margin: 0 auto;
}
.success {
background-color: #ecf5f4;
}
.fail {
background-color: #fbeeeb;
}
}
.log-bg {
background-color: #f7f7f9;
border-radius: 6px;
padding: 20px;
height: calc(100vh - 370px);
overflow-x: hidden;
.log-box {
width: 100%;
.codes-box {
padding: 6px 0;
display: flex;
display: -webkit-flex;
align-items: center;
font-size: 14px;
}
.codes-num {
width: 60px;
color: #8890a7;
display: inline-block;
height: inherit;
}
.codes-out {
width: calc(100% - 70px);
color: #242c43;
display: inline-block;
white-space: pre-wrap;
word-wrap: break-word;
height: inherit;
}
}
}
</style>
......@@ -2,10 +2,11 @@
<div class="step-container">
<div class="step-base">
<img src="@/assets/imgs/img_data-complete.png" />
<p class="tips">新增成功</p>
<div class="apaas_button btns">
<el-button type="default" @click="goStepOne"> 返回列表 </el-button>
<el-button type="primary" @click="putawayAction"> 继续新增 </el-button>
<p class="tips" v-if="props.state">新增成功</p>
<p class="tips" v-else>新增失败</p>
<div class="apaas_button btns" v-if="props.state">
<el-button type="default" @click="goToList"> 返回列表 </el-button>
<el-button type="primary" @click="goStepOne"> 继续新增 </el-button>
</div>
</div>
</div>
......@@ -17,8 +18,23 @@ import { useRouter, useRoute } from "vue-router";
import { ElMessage } from "element-plus";
const router = useRouter();
const route = useRoute();
const state = reactive({ data: 1 });
const { data } = toRefs(state);
const props = defineProps({
state: {
type: Boolean,
default: true,
},
});
const emit = defineEmits(["clear"]);
const goToList = () => {
router.push("/auto-maintenance/task-manage");
};
const goStepOne = () => {
emit("clear");
};
</script>
<style scoped>
......
......@@ -39,19 +39,44 @@
</el-steps>
</div>
</div>
<div class="content_main log_content_nor" :style="step == 3 ? { height: 'calc(100vh - 234px)' } : {}">
<base-info v-show="step == 1"></base-info>
<use-content v-show="step == 2"></use-content>
<finish v-show="step == 3"></finish>
<div
class="content_main log_content_nor"
:style="step == 3 && state.isSave ? { height: 'calc(100vh - 234px)' } : {}">
<base-info v-show="step == 1" :data="state.data" ref="baseInfoRef"></base-info>
<use-content v-show="step == 2" :data="state.data" ref="useContentRef"></use-content>
<finish v-show="step == 3 && state.isSave" :state="true" @clear="clearData"></finish>
<finish-use v-show="step == 3 && !state.isSave" :state="true" time="00:00:11"></finish-use>
</div>
<div class="content_foot apaas_button" v-if="step == 1 || step == 2">
<el-button type="default" @click="cancel"> 取消 </el-button>
<div class="content_foot apaas_button" v-if="step == 1 || step == 2 || (step == 3 && !state.isSave)">
<el-button type="default" v-if="step == 1 || step == 2" @click="cancel"> 取消 </el-button>
<el-button type="default" v-if="step == 2" @click="confirm(-1)"> 上一步 </el-button>
<el-button type="primary" v-if="step == 1" @click="confirm(1)"> 下一步 </el-button>
<el-button type="primary" v-if="step == 2" @click="confirm(1)"> 保存 </el-button>
<el-button type="primary" v-if="step == 2" @click="saveTask()"> 保存 </el-button>
<el-button type="success" v-if="step == 2" @click="useScript"> 立即执行 </el-button>
<el-button type="default" v-if="step == 3" @click="cancel"> 返回列表 </el-button>
<el-button type="primary" v-if="step == 3" @click="postScript"> 重新执行 </el-button>
</div>
</div>
<el-dialog class="dialog_box" title="立即执行" v-model="state.useScriptShow" width="1024px">
<div>
<div class="dialog-tips">
<bg-icon icon="#bg-ic-s-circle-warning" style="color: #a9b1c7"></bg-icon> 向执行脚本传递额外的命令行变量。这是
ansible-playbook 的 -e 或 --extra-vars 命令行参数。使用 YAML 或 JSON 提供键/值对,此项为非必填项。
</div>
<bg-inner-tabs v-model="state.useType" :data="state.useData" style="float: left"></bg-inner-tabs>
<div style="clear: both"></div>
<div style="height: 370px">
<bg-code-editor v-model="state.useText"></bg-code-editor>
</div>
</div>
<template v-slot:footer>
<div class="apaas_button">
<el-button type="default" @click="cancelUse">取消</el-button>
<el-button type="primary" @click="confirmUse">保存</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
......@@ -64,22 +89,87 @@ import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
import baseInfo from "./base-info.vue";
import useContent from "./use-content.vue";
import finish from "./finish.vue";
import finishUse from "./finish-use.vue";
const router = useRouter();
const route = useRoute();
const step = ref(1);
const baseInfoRef = ref(null);
const useContentRef = ref(null);
const state = reactive({ data: 1 });
const state = reactive({
data: {},
useScriptShow: false,
useType: 0,
useData: ["yaml", "json"],
useText: "",
isSave: true,
});
const cancel = () => {
router.back();
};
const confirm = (val) => {
const confirm = async (val) => {
let flag = true;
if (val == 1) {
await baseInfoRef.value
.save()
.then()
.catch(() => {
flag = false;
});
}
if (flag) {
step.value = step.value + val;
}
};
//保存
const saveTask = async () => {
await useContentRef.value
.save()
.then(() => {
step.value = 3;
//todo:掉接口保存,并获取状态
})
.catch(() => {});
};
const useScript = async () => {
//填写完成才可以进行执行
await useContentRef.value
.save()
.then(() => {
state.useScriptShow = true;
})
.catch(() => {
ElMessage.error("请先完善表单再执行");
});
};
const cancelUse = () => {
state.useScriptShow = false;
};
const confirmUse = () => {
state.useScriptShow = false;
state.isSave = false;
step.value = 3;
// TODO:调用接口立即执行
postScript();
};
const useScript = () => {};
const postScript = () => {};
const clearData = () => {
baseInfoRef.value.clear();
useContentRef.value.clear();
state.data = {};
step.value = 1;
};
onBeforeMount(() => {});
</script>
<style scoped>
......@@ -161,4 +251,14 @@ const useScript = () => {};
.process_complete :deep(.el-step__head.is-finish .el-step__line) {
background: linear-gradient(to right, #2b4695 100%, #e6e9ef 0%);
}
.dialog-tips {
height: 38px;
line-height: 38px;
background-color: #f7f7f9;
border-radius: 4px;
font-size: 14px;
color: #404a62;
margin-bottom: 16px;
}
</style>
......@@ -14,9 +14,9 @@
</bg-upload>
</div>
<bg-form-gap title="执行主机"></bg-form-gap>
<el-form ref="ruleFormRef" :model="state.ruleForm" :rules="state.rules" label-position="top" label-width="120px">
<el-form-item label="主机分组名称" prop="name" style="width: 1100px">
<el-select v-model="state.ruleForm.name" style="width: 1020px" clearable placeholder="请选择">
<el-form ref="pcFormRef" :model="state.ruleForm" :rules="state.rules" label-position="top" label-width="120px">
<el-form-item label="主机分组名称" prop="pcName" style="width: 1100px">
<el-select v-model="state.ruleForm.pcName" style="width: 1020px" clearable placeholder="请选择">
<el-option v-for="item in state.options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
<span class="add-pc can_click_text">去创建</span>
......@@ -26,21 +26,31 @@
</template>
<script setup>
import { reactive, ref, onBeforeMount, toRefs } from "vue";
import { reactive, ref, onBeforeMount, toRefs, onMounted } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessage } from "element-plus";
const router = useRouter();
const route = useRoute();
const props = defineProps({
data: {
type: Object,
default: () => {},
},
});
const pcFormRef = ref(null);
const state = reactive({
useType: 0,
useData: ["文本执行", "文件执行"],
useText: "",
doc_file: [],
useText: props.data?.useText || "",
doc_file: props.data?.doc_file || [],
ruleForm: {
name: "",
pcName: props.data?.pcName || "",
},
rules: {
name: [{ required: true, message: "请选择主机分组", trigger: "change" }],
pcName: [{ required: true, message: "请选择主机分组", trigger: "change" }],
},
options: [
{
......@@ -49,6 +59,50 @@ const state = reactive({
},
],
});
const save = () => {
return new Promise((resolve, reject) => {
pcFormRef.value.validate((valid, fields) => {
if (valid) {
props.data.pcName = state.ruleForm.pcName;
if (state.useType == 0) {
props.data.useText = state.useText;
} else {
props.data.doc_file = state.doc_file;
}
resolve();
} else {
reject();
console.log("error submit!", fields);
}
});
});
};
const clear = () => {
pcFormRef.value.resetFields();
state.useText = "";
state.doc_file = [];
state.useType = 0;
};
onMounted(() => {
if (
(props.data && props.data.useText == "" && props.data.doc_file.length == 0) ||
(!props.data.useText && !props.data.doc_file)
) {
state.useType = 0;
} else if (props.data && props.data.useText !== "") {
state.useType = 1;
} else if (props.data && props.data.doc_file.length == 0) {
state.useType = 0;
}
});
defineExpose({
save,
clear,
});
</script>
<style lang="scss" scoped>
......
<template>
<div class="detail_container">
<bg-breadcrumb></bg-breadcrumb>
<div class="main_container">
<bg-form-gap title="基本信息"></bg-form-gap>
<bg-form-gap title="执行脚本"></bg-form-gap>
<bg-form-gap title="执行主机"></bg-form-gap>
<bg-form-gap title="任务历史"></bg-form-gap>
</div>
</div>
</template>
<script setup>
import { reactive, ref, onBeforeMount, toRefs } from "vue";
import { useRouter, useRoute } from "vue-router";
import { ElMessage } from "element-plus";
import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
const router = useRouter();
const route = useRoute();
const state = reactive({ data: 1 });
const { data } = toRefs(state);
</script>
<style lang="scss" scoped>
.main_container {
padding: 24px 32px;
}
</style>
......@@ -37,7 +37,7 @@
</template>
<script setup>
import { reactive, toRefs } from "vue";
import { reactive, toRefs, ref } from "vue";
import { ElMessage } from "element-plus";
import axios from "@/request/http.js";
......@@ -52,6 +52,7 @@ const state = reactive({
license_inform_day: [{ type: "number", min: 0, max: 90, message: "请输入0~90的整数", trigger: "blur" }],
},
});
const authorizeFormRef = ref(null);
//根据license获取授权信息
const getLicenseInfo = () => {
if (!state.authorizeFormData.license) return;
......@@ -69,5 +70,25 @@ const getLicenseInfo = () => {
}
});
};
//保存
const save = () => {
authorizeFormRef.value.validate((valid) => {
if (valid) {
params = {
...props.authorizeFormData,
};
axios.post("/apaas/system/v5/sysOptions/licenseOpts", params).then((res) => {
if (res.data.code == 200) {
ElMessage.success(res.data.msg);
} else {
ElMessage.error(res.data.data);
}
});
}
});
};
const { authorizeRules } = toRefs(state);
defineExpose({
save,
});
</script>
......@@ -20,13 +20,19 @@
</div>
<div class="right_container bgc_white">
<!-- license授权表单 -->
<authorityForm v-if="activeIndex == 1" :authorizeFormData="authorizeFormData"></authorityForm>
<authorityForm
ref="authorityFormRef"
v-if="activeIndex == 1"
:authorizeFormData="authorizeFormData"></authorityForm>
<loginPageForm v-if="activeIndex == 2" :loginPageFormData="loginPageFormData"></loginPageForm>
<loginPageForm
ref="loginPageFormRef"
v-if="activeIndex == 2"
:loginPageFormData="loginPageFormData"></loginPageForm>
<!-- 安全相关表单 -->
<secureForm v-if="activeIndex == 3" :secureFormData="secureFormData"></secureForm>
<secureForm ref="secureFormRef" v-if="activeIndex == 3" :secureFormData="secureFormData"></secureForm>
<!-- 登录注册配置表单 -->
<registerForm v-if="activeIndex == 4" :registerFormData="registerFormData"></registerForm>
<registerForm ref="registerFormRef" v-if="activeIndex == 4" :registerFormData="registerFormData"></registerForm>
<div class="operate_btns">
<el-button type="primary" @click="save"> 保存 </el-button>
</div>
......@@ -54,7 +60,8 @@ import secureForm from "./secureForm.vue";
import registerForm from "./registerForm.vue";
import axios from "@/request/http.js";
const authorizeFormRef = ref(null);
const authorityFormRef = ref(null);
const loginPageFormRef = ref(null);
const secureFormRef = ref(null);
const registerFormRef = ref(null);
const state = reactive({
......@@ -133,39 +140,21 @@ const getPreferenceConfig = () => {
//保存表单项
const save = () => {
let params = {};
if (state.activeIndex == 1) {
authorizeFormRef.value.validate((valid) => {
if (valid) {
params = {
...state.authorizeFormData,
};
postData("/apaas/system/v5/sysOptions/licenseOpts", params);
}
});
} else if (state.activeIndex == 2) {
secureFormRef.value.validate((valid) => {
if (valid) {
params = {
...state.secureFormData,
};
postData("/apaas/system/v5/sysOptions/safeOpts", params);
}
});
} else {
registerFormRef.value.validate((valid) => {
if (valid) {
params = {
...state.registerFormData,
};
if (params.login_config_state == 0) {
params.login_limit_time = 0;
params.login_pwd_error = 0;
params.login_lock_time = 0;
}
postData("/apaas/system/v5/sysOptions/loginOpts", params);
}
});
switch (state.activeIndex) {
case 1:
authorityFormRef.value.save();
break;
case 2:
loginPageFormRef.value.save();
break;
case 3:
secureFormRef.value.save();
break;
case 4:
registerFormRef.value.save();
break;
default:
break;
}
};
// 请求接口发送消息
......
......@@ -72,7 +72,9 @@
<script setup>
import { reactive, ref, toRefs } from "vue";
import { ElMessage } from "element-plus";
import { validateLink } from "@/services/rules.js";
import axios from "@/request/http.js";
const props = defineProps({
loginPageFormData: {
......@@ -101,7 +103,27 @@ const changeBanner = (value) => {
refForm.value.clearValidate("backgroundUrl");
}
};
//保存
const save = () => {
loginPageRef.value.validate((valid) => {
if (valid) {
params = {
...props.loginPageFormData,
};
axios.post("/apaas/system/v5/sysOptions/licenseOpts", params).then((res) => {
if (res.data.code == 200) {
ElMessage.success(res.data.msg);
} else {
ElMessage.error(res.data.data);
}
});
}
});
};
const { loginPageRules } = toRefs(state);
defineExpose({
save,
});
</script>
<style lang="scss" scoped>
......
......@@ -53,8 +53,11 @@
</template>
<script setup>
import { reactive, toRefs } from "vue";
import { reactive, toRefs, ref } from "vue";
import { ElMessage } from "element-plus";
import axios from "@/request/http.js";
const registerFormRef = ref(null);
const props = defineProps({
registerFormData: {
type: Object,
......@@ -90,6 +93,30 @@ const state = reactive({
],
},
});
//保存
const save = () => {
registerFormRef.value.validate((valid) => {
if (valid) {
params = {
...props.registerFormData,
};
if (params.login_config_state == 0) {
params.login_limit_time = 0;
params.login_pwd_error = 0;
params.login_lock_time = 0;
}
axios.post("/apaas/system/v5/sysOptions/loginOpts", params).then((res) => {
if (res.data.code == 200) {
ElMessage.success(res.data.msg);
} else {
ElMessage.error(res.data.data);
}
});
}
});
};
const { registerRules } = toRefs(state);
defineExpose({
save,
});
</script>
......@@ -74,8 +74,11 @@
</template>
<script setup>
import { reactive, toRefs } from "vue";
import { reactive, toRefs, ref } from "vue";
import { ElMessage } from "element-plus";
import axios from "@/request/http.js";
const secureFormRef = ref(null);
const props = defineProps({
secureFormData: {
type: Object,
......@@ -105,6 +108,26 @@ const state = reactive({
],
},
});
//保存
const save = () => {
secureFormRef.value.validate((valid) => {
if (valid) {
params = {
...props.secureFormData,
};
axios.post("/apaas/system/v5/sysOptions/safeOpts", params).then((res) => {
if (res.data.code == 200) {
ElMessage.success(res.data.msg);
} else {
ElMessage.error(res.data.data);
}
});
}
});
};
const { secureRules } = toRefs(state);
defineExpose({
save,
});
</script>
......@@ -65,6 +65,12 @@ export default {
changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL
secure: false, //解决证书缺失问题
},
"/v1/api": {
target: "https://so.wodcloud.com/v1/api", // 所要代理的目标地址
rewrite: (path) => path.replace(/^\/v1\/api/, ""), // 重写传过来的path路径,比如 `/api/index/1?id=10&name=zs`(注意:path路径最前面有斜杠(/),因此,正则匹配的时候不要忘了是斜杠(/)开头的;选项的 key 也是斜杠(/)开头的)
changeOrigin: true, // true/false, Default: false - changes the origin of the host header to the target URL
secure: false, //解决证书缺失问题
},
},
},
build: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment