SqlServer企业配置

This commit is contained in:
xielue 2023-04-20 12:09:32 +08:00
parent 2128170f71
commit 7434c14171
6 changed files with 208 additions and 10 deletions

View File

@ -1,4 +1,5 @@
VUE_APP_API_BASE_URL=http://zxx4.f3322.net:46000
VUE_APP_USER_MODEL3=AdminUser
VUE_APP_USER_MODEL=BaseAdmin
VUE_APP_USER_MODEL=AdminUser
VUE_APP_USER_MODEL2=BaseAdmin
VUE_APP_BEID=1

View File

@ -9,7 +9,7 @@
</vxe-form>
<div>
<div class="footerbar">
<a-button type="primary" @click="ok">确定</a-button>
<a-button @click="cancel">取消</a-button>
</div>

View File

@ -37,6 +37,7 @@
</template>
<template #op="{ row }">
<div class="oplinks">
<a @click.stop="pageEditSql(row)" title="SQL配置"><a-icon type="database" /></a>
<a @click.stop="pageEdit(row)" title="编辑"><a-icon type="edit" /></a>
<a @click.stop="pageDelete(row)" title="删除"><a-icon type="delete" /></a>
</div>
@ -170,7 +171,7 @@ export default {
{ field: 'admin_count', width: 110, sortable: true, title: '用户数', showHeaderOverflow: true }, //
{ field: 'status', slots: { default: 'status' }, width: 80, sortable: true, title: '状态', showHeaderOverflow: true }, //
{ field: 'create_time', formatter: "formatDate", width: 160, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ title: '操作', slots: { default: 'op' }, width: 120 }
{ title: '操作', slots: { default: 'op' }, width: 150 }
]
}
@ -290,6 +291,23 @@ export default {
}
this.$openPage("/BaseCompany/BaseCompanyUpdate/" + row[this.keyName]); //
},
pageEditSql(row) {
if (!row) { //
this.$mk.msg("请选择行"); //
return; //
}
this.$mk.dialog.open({
page: () => import("./server"),
title: "修改SQL配置",
dataId: row[this.keyName],
callback: ({ success }) => {
success && this.$refs.xGrid.commitProxy('query')
}
})
},
//
pageDelete(row) {

View File

@ -0,0 +1,158 @@
<template>
<div class="page-body">
<vxe-form :data="formOptions.data" ref="xForm" :title-width="formOptions.titleWidth"
:title-align="formOptions.titleAlign" :rules="formOptions.rules" :items="formOptions.items" titleColon>
<template #myregion="{}">
<a-input-search placeholder="input search text" enter-button />
</template>
</vxe-form>
<div class="footerbar">
<a-button type="primary" @click="ok">确定</a-button>
<a-button @click="cancel">取消</a-button>
</div>
</div>
</template>
<script>
import BASE_URL from '@/services/base/api.js';
export default {
i18n: require('./i18n'),
props: {
pageMode: {
type: String,
default: "edit"
},
dataId: {
}
},
data() {
//
var pageData = {
actions: {
update: `${BASE_URL.BASE_URL}/SqlServer/v1/sql/server/update`,
get: `${BASE_URL.BASE_URL}/SqlServer/v1/sql/server/detail`
},
formOptions: {
data: {
company_id:0,
ipaddress:'',
port:'',
username:'',
password:'',
database:'',
},
titleWidth: 100,
titleAlign: 'right',
rules: {
},
items: [
{ field: 'ipaddress', title: 'IP', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入IP' } } },
{ field: 'port', title: '端口', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入端口' } } },
{ field: 'username', title: '用户名', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入用户名' } } },
{ field: 'password', title: '密码', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入密码' } } },
{ field: 'database', title: '数据库', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入数据库' } } }
]
}
};
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
return pageData;
},
created() {
if (this.dataId) {
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: {
company_id: this.dataId
}
}).then(a => {
if(a.data && a.data.sql_server){
this.formOptions.data = a.data.sql_server;
}else{
this.formOptions.data.company_id = this.dataId;
}
}).catch((a) => {
console.log(a)
//this.$mk.error(a.data.msg);
});
} else {
this.formOptions.data.company_id = this.dataId;
}
},
//
methods: {
loadData() {
},
ok() {
let save = () => {
let action = this.actions.update;
let postdata = Object.assign({}, this.formOptions.data);
postdata.company_id = this.dataId;
this.$mk.post({
url: action,
loading: "保存中...",
data: postdata,
useBigInt: true
}).then(() => {
this.$mk.success("保存成功");
this.$emit("callback", { success: true });
}).catch((a) => {
this.$mk.error(a.data.msg);
});
};
this.$refs.xForm.validate((a) => {
if (a) {
let count = 0;
for (let name in a) {
a[name];
count++;
}
this.$mk.error(`存在${count}项错误,请检查`);
} else {
save();
}
});
},
cancel() {
this.$emit("callback", {});
}
},
//
watch: {
}
};
</script>
<style></style>

View File

@ -4,7 +4,7 @@
<div class="header">
<img alt="logo" class="logo" :src="Project.project_logo" />
<div class="title">{{ Project.project_name }}
<div class="title">{{ Project.project_name }}
<!-- 如果 Project.project_sub_title 不为空则显示 -->
<i v-if="Project.project_sub_title"><b>|</b> {{ Project.project_sub_title }}</i>
</div>
@ -210,9 +210,27 @@ export default {
const loginRes = res.data
if (loginRes.code == 200) {
if (!this.isMiddleAdmin()) {
this.companyShow = true;
this.companyData = loginRes.data.company_switch;
this.loginResult = loginRes;
if (!this.companyData || !this.companyData.length) {
this.afterLoginSuccess({
token: this.loginResult.data.access_token,
access_expire: this.loginResult.data.access_expire,
uid: this.loginResult.data.uid,
loginResMsg: this.loginResult.msg
});
} else {
this.companyShow = true;
}
return;
}
@ -260,7 +278,7 @@ export default {
.logo {
height: 80px;
vertical-align: top;
margin-bottom:10px;
margin-bottom: 10px;
// border: 1px solid black;
}
@ -273,14 +291,15 @@ export default {
// margin-left: 25%;
// border: 1px solid black;
position: relative;
margin-bottom:10px;
margin-bottom: 10px;
i {
font-size: 16px;
margin-right: 4px;
position: absolute;
right:0px;
color:rgb(194, 194, 194);
right: 0px;
color: rgb(194, 194, 194);
b {
font-weight: 10;
}

View File

@ -15,6 +15,8 @@ export async function login(name, password) {
if (process.env.VUE_APP_USER_MODEL != "AdminUser") {
params.beid = parseInt(process.env.VUE_APP_BEID)
}
console.log(params)
return request(LOGIN.url, LOGIN.method, params)
}