配置管理

This commit is contained in:
熊丽君
2022-01-15 09:31:24 +08:00
parent 83cfd47571
commit de0f6081f3
9 changed files with 363 additions and 66 deletions

View File

@ -1,5 +1,29 @@
import request from '@/utils/request'
// 项目配置
export function config(data) {
return request({
url: '/admin/v1/config',
method: 'post',
data,
})
}
// 项目配置 添加
export function configAdd(data) {
return request({
url: '/admin/v1/config/add',
method: 'post',
data,
})
}
// 项目配置 修改
export function configEdit(data) {
return request({
url: '/admin/v1/config/edit',
method: 'post',
data,
})
}
// 租户列表 省市区选择
export function areaList(params) {
return request({

View File

@ -42,7 +42,7 @@ export function getInfo() {
// 退出方法
export function logout() {
return request({
url: '/logout',
url: '/admin/v1/account/logout',
method: 'post',
})
}

View File

@ -0,0 +1,32 @@
import request from '@/utils/request'
// 行业领域信息
export function industryList() {
return request({
url: '/admin/v1/sys/industry',
})
}
// 行业领域 添加
export function industryAdd(data) {
return request({
url: '/admin/v1/sys/industry/add',
method: 'post',
data,
})
}
// 行业领域 修改
export function industryEdit(data) {
return request({
url: '/admin/v1/sys/industry/edit',
method: 'post',
data,
})
}
// 行业领域 删除
export function industryDelete(data) {
return request({
url: '/admin/v1/sys/industry/delete',
method: 'post',
data,
})
}

View File

@ -1,6 +1,10 @@
<template>
<div :class="{'show':show}" class="header-search">
<svg-icon class-name="search-icon" icon-class="search" @click.stop="click" />
<div :class="{ show: show }" class="header-search">
<svg-icon
class-name="search-icon"
icon-class="search"
@click.stop="click"
/>
<el-select
ref="headerSearchSelect"
v-model="search"
@ -12,7 +16,12 @@
class="header-search-select"
@change="change"
>
<el-option v-for="option in options" :key="option.item.path" :value="option.item" :label="option.item.title.join(' > ')" />
<el-option
v-for="option in options"
:key="option.item.path"
:value="option.item"
:label="option.item.title.join(' > ')"
/>
</el-select>
</div>
</template>
@ -20,69 +29,68 @@
<script>
// fuse is a lightweight fuzzy-search module
// make search results more in line with expectations
import Fuse from 'fuse.js/dist/fuse.min.js'
import path from 'path'
import Fuse from "fuse.js/dist/fuse.min.js";
import path from "path";
export default {
name: 'HeaderSearch',
name: "HeaderSearch",
data() {
return {
search: '',
search: "",
options: [],
searchPool: [],
show: false,
fuse: undefined
}
fuse: undefined,
};
},
computed: {
routes() {
return this.$store.getters.permission_routes
}
return this.$store.getters.permission_routes;
},
},
watch: {
routes() {
this.searchPool = this.generateRoutes(this.routes)
this.searchPool = this.generateRoutes(this.routes);
},
searchPool(list) {
this.initFuse(list)
this.initFuse(list);
},
show(value) {
if (value) {
document.body.addEventListener('click', this.close)
document.body.addEventListener("click", this.close);
} else {
document.body.removeEventListener('click', this.close)
document.body.removeEventListener("click", this.close);
}
}
},
},
mounted() {
this.searchPool = this.generateRoutes(this.routes)
this.searchPool = this.generateRoutes(this.routes);
},
methods: {
click() {
this.show = !this.show
this.show = !this.show;
if (this.show) {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus()
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.focus();
}
},
close() {
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur()
this.options = []
this.show = false
this.$refs.headerSearchSelect && this.$refs.headerSearchSelect.blur();
this.options = [];
this.show = false;
},
change(val) {
const path = val.path;
if(this.ishttp(val.path)) {
if (this.ishttp(val.path)) {
// http(s):// 路径新窗口打开
const pindex = path.indexOf("http");
window.open(path.substr(pindex, path.length), "_blank");
window.open(val.path, "_blank");
} else {
this.$router.push(val.path)
this.$router.push(val.path);
}
this.search = ''
this.options = []
this.search = "";
this.options = [];
this.$nextTick(() => {
this.show = false
})
this.show = false;
});
},
initFuse(list) {
this.fuse = new Fuse(list, {
@ -92,61 +100,72 @@ export default {
distance: 100,
maxPatternLength: 32,
minMatchCharLength: 1,
keys: [{
name: 'title',
weight: 0.7
}, {
name: 'path',
weight: 0.3
}]
})
keys: [
{
name: "title",
weight: 0.7,
},
{
name: "path",
weight: 0.3,
},
],
});
},
// Filter out the routes that can be displayed in the sidebar
// And generate the internationalized title
generateRoutes(routes, basePath = '/', prefixTitle = []) {
let res = []
generateRoutes(routes, basePath = "/", prefixTitle = []) {
let res = [];
for (const router of routes) {
// skip hidden router
if (router.hidden) { continue }
const data = {
path: !this.ishttp(router.path) ? path.resolve(basePath, router.path) : router.path,
title: [...prefixTitle]
if (router.hidden) {
continue;
}
if (router.meta && router.meta.title) {
data.title = [...data.title, router.meta.title]
const data = {
path: !this.ishttp(router.path)
? path.resolve(basePath, router.path)
: router.path,
title: [...prefixTitle],
};
if (router.redirect !== 'noRedirect') {
if (router.meta && router.meta.title) {
data.title = [...data.title, router.meta.title];
if (router.redirect !== "noRedirect") {
// only push the routes with title
// special case: need to exclude parent router without redirect
res.push(data)
res.push(data);
}
}
// recursive child routes
if (router.children) {
const tempRoutes = this.generateRoutes(router.children, data.path, data.title)
const tempRoutes = this.generateRoutes(
router.children,
data.path,
data.title
);
if (tempRoutes.length >= 1) {
res = [...res, ...tempRoutes]
res = [...res, ...tempRoutes];
}
}
}
return res
return res;
},
querySearch(query) {
if (query !== '') {
this.options = this.fuse.search(query)
if (query !== "") {
this.options = this.fuse.search(query);
} else {
this.options = []
this.options = [];
}
},
ishttp(url) {
return url.indexOf('http://') !== -1 || url.indexOf('https://') !== -1
}
}
}
return url.indexOf("http://") !== -1 || url.indexOf("https://") !== -1;
},
},
};
</script>
<style lang="scss" scoped>

View File

@ -16,7 +16,7 @@
<div class="right-menu">
<template v-if="device !== 'mobile'">
<search id="header-search" class="right-menu-item" />
<!-- <search id="header-search" class="right-menu-item" /> -->
<!-- <el-tooltip content="源码地址" effect="dark" placement="bottom">
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
@ -42,9 +42,9 @@
<i class="el-icon-caret-bottom" />
</div>
<el-dropdown-menu slot="dropdown">
<router-link to="/user/profile">
<!-- <router-link to="/user/profile">
<el-dropdown-item>个人中心</el-dropdown-item>
</router-link>
</router-link> -->
<el-dropdown-item @click.native="setting = true">
<span>布局设置</span>
</el-dropdown-item>

View File

@ -0,0 +1,216 @@
<template>
<div class="app-container">
<!-- <el-form
:model="queryParams"
ref="queryForm"
v-show="showSearch"
:inline="true"
@submit.native.prevent
>
<el-form-item label="子系统名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入子系统名称"
clearable
size="small"
style="width: 240px"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form> -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
>新增</el-button
>
</el-col>
<!-- <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar> -->
</el-row>
<el-table v-loading="loading" :data="configList">
<el-table-column label="kind" prop="kind" width="120" />
<el-table-column label="名称" prop="name" width="120" />
<el-table-column label="key" prop="key" align="center" />
<el-table-column label="value" prop="value" align="center" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button
>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
>删除</el-button
> -->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.page_num"
:limit.sync="queryParams.page_size"
@pagination="getList"
/>
<!-- 添加或修改对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px">
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="名称:" prop="name">
<el-input v-model="form.name" placeholder="请输入名称" />
</el-form-item>
<el-form-item label="key:" prop="key" v-if="!form.id">
<el-input v-model="form.key" placeholder="请输入key" />
</el-form-item>
<el-form-item label="value:" prop="value">
<el-input v-model="form.value" placeholder="请输入value" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { config, configAdd, configEdit } from "@/api/config";
import { resetUserPwd } from "@/api/system/user";
export default {
data() {
return {
loading: true,
showSearch: true,
queryParams: {
page_num: 1,
page_size: 10,
},
total: 0,
configList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 表单参数
form: {},
// 表单校验
rules: {
name: [{ required: true, message: "名称不能为空", trigger: "blur" }],
key: [{ required: true, message: "key不能为空", trigger: "blur" }],
value: [{ required: true, message: "value不能为空", trigger: "blur" }],
},
};
},
methods: {
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
handleQuery() {
this.queryParams.page_num = 1;
this.getList();
},
getList() {
this.loading = true;
config(this.queryParams).then((res) => {
this.configList = res.data.data;
this.total = res.data.count;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.form = {
kind: 1,
name: undefined,
key: undefined,
value: undefined,
};
this.resetForm("form");
},
handleAdd() {
this.reset();
this.open = true;
this.title = "添加子系统";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.form = Object.assign({}, row);
this.open = true;
this.title = "修改子系统";
},
/** 提交按钮 - 修改名称普通数据 */
submitForm() {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.id != undefined) {
configEdit(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
configAdd(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm('是否确认删除子系统名为"' + row.name + '"的数据项?')
.then(function () {
return configDelete({ id: row.id });
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
},
created() {
this.getList();
},
};
</script>

View File

@ -0,0 +1,3 @@
<template>
<div>八大领域</div>
</template>

View File

@ -0,0 +1,3 @@
<template>
<div>企业发布描述</div>
</template>

View File

@ -430,7 +430,7 @@ export default {
// 表单重置
reset() {
this.form = {
parent_id: undefined,
parent_id: "",
name: undefined,
icon: undefined,
kind: 1,
@ -453,8 +453,8 @@ export default {
/** 新增按钮操作 */
handleAdd(row) {
this.reset();
if (row != null && row.parent_id) {
this.form.parent_id = row.parent_id;
if (row != null && row.parent_id != "" && row.id != undefined) {
this.form.parent_id = row.id;
} else {
this.form.parent_id = "";
}