project init
This commit is contained in:
311
src/views/system/client.vue
Normal file
311
src/views/system/client.vue
Normal file
@@ -0,0 +1,311 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud :option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
:page.sync="page"
|
||||
@row-del="rowDel"
|
||||
v-model="form"
|
||||
ref="crud"
|
||||
:permission="permissionList"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
:before-open="beforeOpen"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad">
|
||||
<template slot="menuLeft">
|
||||
<el-button type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
plain
|
||||
v-if="permission.client_delete"
|
||||
@click="handleDelete">删 除
|
||||
</el-button>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList, getDetail, add, update, remove} from "@/api/system/client";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
query: {},
|
||||
loading: true,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
selectionList: [],
|
||||
option: {
|
||||
height: 'auto',
|
||||
calcHeight: 30,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: "序号",
|
||||
viewBtn: true,
|
||||
selection: true,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "应用id",
|
||||
prop: "clientId",
|
||||
search: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入客户端id",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "应用密钥",
|
||||
prop: "clientSecret",
|
||||
search: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入客户端密钥",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "授权类型",
|
||||
prop: "authorizedGrantTypes",
|
||||
value: "refresh_token,password,authorization_code",
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入授权类型",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "授权范围",
|
||||
prop: "scope",
|
||||
value: "all",
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入授权范围",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "令牌秒数",
|
||||
prop: "accessTokenValidity",
|
||||
type: "number",
|
||||
value: 3600,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入令牌过期秒数",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "刷新秒数",
|
||||
prop: "refreshTokenValidity",
|
||||
type: "number",
|
||||
value: 604800,
|
||||
hide: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入刷新令牌过期秒数",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "回调地址",
|
||||
prop: "webServerRedirectUri",
|
||||
hide: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入回调地址",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "资源集合",
|
||||
prop: "resourceIds",
|
||||
hide: true,
|
||||
rules: [{
|
||||
message: "请输入资源集合",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "权限",
|
||||
prop: "authorities",
|
||||
hide: true,
|
||||
rules: [{
|
||||
message: "请输入权限",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "自动授权",
|
||||
prop: "autoapprove",
|
||||
hide: true,
|
||||
rules: [{
|
||||
message: "请输入自动授权",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "附加说明",
|
||||
hide: true,
|
||||
prop: "additionalInformation",
|
||||
span: 24,
|
||||
rules: [{
|
||||
message: "请输入附加说明",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
]
|
||||
},
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.client_add),
|
||||
viewBtn: this.vaildData(this.permission.client_view),
|
||||
delBtn: this.vaildData(this.permission.client_delete),
|
||||
editBtn: this.vaildData(this.permission.client_edit)
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rowSave(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
36
src/views/system/company.vue
Normal file
36
src/views/system/company.vue
Normal file
@@ -0,0 +1,36 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<el-tabs v-model="activeName" class="tabs">
|
||||
<el-tab-pane label="企业认证" name="registerSteps">
|
||||
<basic-info></basic-info>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="公司介绍" name="compnayDesc">
|
||||
<compnay-desc></compnay-desc>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</basic-container>
|
||||
</template>
|
||||
<script>
|
||||
import basicInfo from "./company/basicInfo";
|
||||
import compnayDesc from "./company/desc";
|
||||
|
||||
export default {
|
||||
props: {},
|
||||
name: "system_compan",
|
||||
data() {
|
||||
return {
|
||||
activeName: "registerSteps",
|
||||
};
|
||||
},
|
||||
components: { basicInfo, compnayDesc },
|
||||
methods: {},
|
||||
};
|
||||
</script>
|
||||
<style>
|
||||
.tabs {
|
||||
padding: 20px 10px 0;
|
||||
}
|
||||
.tabs .el-tabs__header {
|
||||
margin: 0px;
|
||||
}
|
||||
</style>
|
||||
113
src/views/system/company/basicInfo.vue
Normal file
113
src/views/system/company/basicInfo.vue
Normal file
@@ -0,0 +1,113 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<div v-loading="loading">
|
||||
<el-row>
|
||||
<el-col :sm="24" :md="{ span: 12, offset: 6 }">
|
||||
<img class="basic-info-container-stamp" src="/manage/img/stamp.png" />
|
||||
<div class="basic-info-container">
|
||||
<el-form
|
||||
:model="form"
|
||||
ref="form"
|
||||
class="content"
|
||||
label-position="right"
|
||||
label-width="180px"
|
||||
>
|
||||
<el-form-item label="法人姓名:">
|
||||
<span>{{ form.masterName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="法人身份证号:">
|
||||
<span>{{ form.masterIdentity }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="企业名称:">
|
||||
<span>{{ form.companyName }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="统一社会信用代码:">
|
||||
<span>{{ form.companyTid }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="所在地区:">
|
||||
<span>{{ cityId[0] }}/{{ cityId[1] }}/{{ cityId[2] }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="详细地址:">
|
||||
<span>{{ form.companyAddress }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属行业:">
|
||||
<span>{{ tradeId }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item label="企业营业执照:">
|
||||
<!--:src="props.row.cImg"-->
|
||||
<img :src="form.authUrlId" class="avatarImg" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</basic-container>
|
||||
</template>
|
||||
<script>
|
||||
import { getTradeDic } from "@/api/manage/trade";
|
||||
import { getBaseDetail } from "@/api/tenant/company";
|
||||
|
||||
export default {
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
loading: false,
|
||||
tradeDic: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.init();
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
getBaseDetail().then((res) => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
getTradeDic(true).then((res) => {
|
||||
this.tradeDic = res.data.data;
|
||||
});
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
tradeId() {
|
||||
let name = "";
|
||||
this.tradeDic.forEach((item) => {
|
||||
if (item.id === this.form.tradeId) {
|
||||
name = item.name;
|
||||
return;
|
||||
}
|
||||
});
|
||||
return name;
|
||||
},
|
||||
cityId() {
|
||||
const result = ["", "", ""];
|
||||
if (this.form.cityId) {
|
||||
const city = this.$store.getters.getAreaParents(this.form.cityId);
|
||||
for (let i = 0; i < city.length; i++) {
|
||||
const element = city[i];
|
||||
result[i] = element.label;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.avatarImg {
|
||||
width: 160px;
|
||||
height: 100px;
|
||||
}
|
||||
.basic-info-container {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
.basic-info-container-stamp {
|
||||
position: absolute;
|
||||
z-index: 0;
|
||||
top: 0;
|
||||
left: 40%;
|
||||
}
|
||||
</style>
|
||||
400
src/views/system/company/desc.vue
Normal file
400
src/views/system/company/desc.vue
Normal file
@@ -0,0 +1,400 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<div v-loading="loading" class="avue--view">
|
||||
<el-row>
|
||||
<el-col :span="24" class="title">
|
||||
企业信息
|
||||
<span style="float: right">
|
||||
<el-button
|
||||
type="text"
|
||||
@click="isCanEdit = true"
|
||||
v-show="!isCanEdit && type === 'add'"
|
||||
style="padding: 0"
|
||||
>新增</el-button
|
||||
>
|
||||
<el-button
|
||||
type="text"
|
||||
@click="isCanEdit = true"
|
||||
v-show="!isCanEdit && type === 'edit'"
|
||||
style="padding: 0"
|
||||
>编辑</el-button
|
||||
>
|
||||
</span>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row v-show="!isCanEdit && type === 'add'">
|
||||
<el-col :span="1"> </el-col>
|
||||
<el-col :span="22" class="empty-tip"
|
||||
>添加企业信息让用户更生动地了解公司吧~</el-col
|
||||
>
|
||||
<el-col :span="1"> </el-col>
|
||||
</el-row>
|
||||
|
||||
<el-form
|
||||
:model="form"
|
||||
ref="form"
|
||||
class="avue-form"
|
||||
:class="{'closeInputBorder': !isCanEdit}"
|
||||
v-show="isCanEdit || type === 'edit'"
|
||||
label-position="right"
|
||||
label-width="100px"
|
||||
style="padding: 10px 10px;"
|
||||
:disabled="!isCanEdit"
|
||||
:rules="rules"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="企业简称:" prop="companyName">
|
||||
<el-input v-model="form.companyName" maxlength="50" show-word-limit></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="公司规模:" prop="companySize">
|
||||
<el-input v-model="form.companySize"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="2"> </el-col>
|
||||
<el-col :span="11">
|
||||
<el-form-item label="公司网站:">
|
||||
<el-input v-model="form.websiteUrlId"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="公司logo:">
|
||||
<el-upload
|
||||
:class="{ disabled: !isCanEdit }"
|
||||
list-type="picture-card"
|
||||
:auto-upload="true"
|
||||
:file-list="logoList"
|
||||
:limit="1"
|
||||
:action="putFile"
|
||||
:on-preview="handleLogoPreview"
|
||||
:on-exceed="handleLogoLimit"
|
||||
:on-success="handleLogoSuccess"
|
||||
:on-remove="handleLogoRemove"
|
||||
:before-remove="beforeRemove"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<div slot="tip" class="el-upload__tip">
|
||||
图片大小:不超过5M,仅能上传1张
|
||||
</div>
|
||||
<i slot="default" class="el-icon-plus"></i>
|
||||
</el-upload>
|
||||
<el-dialog :visible.sync="dialogVisible2">
|
||||
<img width="100%" :src="dialogImageUrl2" alt />
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="企业简介:">
|
||||
<el-input
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 5, maxRows: 5 }"
|
||||
v-model="form.introduce"
|
||||
:readonly="!isCanEdit"
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="公司环境:">
|
||||
<el-upload
|
||||
:class="{ disabled: !isCanEdit }"
|
||||
list-type="picture-card"
|
||||
:auto-upload="true"
|
||||
:file-list="imgList"
|
||||
:limit="10"
|
||||
:action="putFile"
|
||||
:on-preview="handleImgPreview"
|
||||
:on-exceed="handleImgLimit"
|
||||
:on-success="handleImgSuccess"
|
||||
:on-remove="handleImgRemove"
|
||||
:before-remove="beforeRemove"
|
||||
:before-upload="beforeUpload"
|
||||
>
|
||||
<div slot="tip" class="el-upload__tip">
|
||||
添加公司环境、员工照片,给用户展示更生动的公司全貌,最多上传10张照片
|
||||
</div>
|
||||
<i slot="default" class="el-icon-plus"></i>
|
||||
</el-upload>
|
||||
<el-dialog :visible.sync="dialogVisible">
|
||||
<img width="100%" :src="dialogImageUrl" alt />
|
||||
</el-dialog>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item style="text-align: center; margin-left: -112px">
|
||||
<el-button
|
||||
@click="resetOrCancel"
|
||||
:loading="loading"
|
||||
v-show="isCanEdit && type === 'edit'"
|
||||
class="btn"
|
||||
>取消</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="submit"
|
||||
:loading="loading"
|
||||
v-show="isCanEdit"
|
||||
class="btn"
|
||||
>保存</el-button
|
||||
>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</div>
|
||||
</basic-container>
|
||||
</template>
|
||||
<script>
|
||||
import { getDetail, add, update } from "@/api/tenant/company";
|
||||
import { putFile } from "@/api/resource/oss";
|
||||
import { validatenull } from "@/util/validate";
|
||||
|
||||
const getReq = (type, form) => {
|
||||
if (type === "add") {
|
||||
return add(form);
|
||||
} else if (type === "edit") {
|
||||
return update(form);
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
disabled: false,
|
||||
dialogImageUrl: "",
|
||||
dialogVisible: false,
|
||||
dialogImageUrl2: "",
|
||||
dialogVisible2: false,
|
||||
logoList: [],
|
||||
imgList: [],
|
||||
form: {},
|
||||
isCanEdit: false,
|
||||
loading: false,
|
||||
putFile,
|
||||
rules: {
|
||||
companyName: [
|
||||
{ max: 50, message: "长度在 50 个字以内", trigger: "blur" },
|
||||
],
|
||||
companySize: [
|
||||
{ max: 50, message: "长度在 50 个字以内", trigger: "blur" },
|
||||
],
|
||||
websiteUrlId:[
|
||||
{ max: 50, message: "长度在 50 个字以内", trigger: "blur" },
|
||||
],
|
||||
introduce:[
|
||||
{ max: 50, message: "长度在 500 个字以内", trigger: "blur" },
|
||||
]
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getInfo();
|
||||
},
|
||||
computed: {
|
||||
uploadDisabled() {
|
||||
return this.isCanEdit;
|
||||
},
|
||||
type() {
|
||||
if (validatenull(this.form.id)) {
|
||||
return "add";
|
||||
} else {
|
||||
return "edit";
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/*获取公司主页 */
|
||||
getInfo() {
|
||||
this.loading = true;
|
||||
getDetail().then((res) => {
|
||||
let form = res.data.data || {};
|
||||
this.form = {
|
||||
id: form.id,
|
||||
companyName: form.companyName,
|
||||
companySize: form.companySize,
|
||||
logoUrlId: form.logoUrlId,
|
||||
websiteUrlId: form.websiteUrlId,
|
||||
baseUrlId: form.baseUrlId,
|
||||
introduce: form.introduce,
|
||||
};
|
||||
//给缩略图赋值url
|
||||
if (form.logoUrlId) {
|
||||
var arr = form.logoUrlId.split(",");
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
this.logoList.push({
|
||||
url: arr[i],
|
||||
});
|
||||
}
|
||||
}
|
||||
if (form.baseUrlId) {
|
||||
var arr2 = form.baseUrlId.split(",");
|
||||
for (var j = 0; j < arr2.length; j++) {
|
||||
this.imgList.push({
|
||||
url: arr2[j],
|
||||
});
|
||||
}
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
submit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (valid) {
|
||||
this.loading = true;
|
||||
getReq(this.type, this.form)
|
||||
.then(() => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!",
|
||||
});
|
||||
this.resetOrCancel();
|
||||
this.loading = false;
|
||||
})
|
||||
.catch((error) => {
|
||||
window.console.log(error);
|
||||
this.loading = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
/*取消 */
|
||||
resetOrCancel() {
|
||||
if (this.$refs.groups) {
|
||||
this.$refs.groups.clearValidate();
|
||||
}
|
||||
this.logoList = [];
|
||||
this.imgList = [];
|
||||
this.getInfo();
|
||||
this.isCanEdit = false;
|
||||
},
|
||||
/*上传logo */
|
||||
handleLogoSuccess(res) {
|
||||
if (res.code === 200) {
|
||||
this.form.logoUrlId = res.data.link;
|
||||
} else {
|
||||
this.$message.error(`上传失败`);
|
||||
}
|
||||
},
|
||||
/*删除logo */
|
||||
beforeRemove() {
|
||||
return this.$confirm(`是否确定移除该选项?`);
|
||||
},
|
||||
handleLogoRemove() {
|
||||
this.form.logoUrlId = "";
|
||||
},
|
||||
/*查看logo */
|
||||
handleLogoPreview(file) {
|
||||
this.dialogImageUrl = file.url;
|
||||
this.dialogVisible = true;
|
||||
},
|
||||
/*验证图片个数 */
|
||||
handleLogoLimit() {
|
||||
this.$message.warning(`当前限制选择 1 张图片`);
|
||||
},
|
||||
/*下载 */
|
||||
handleDownload() {},
|
||||
/*上传公司环境 */
|
||||
handleImgSuccess(res) {
|
||||
if (res.code === 200) {
|
||||
this.imgList.push({
|
||||
url: res.data.link,
|
||||
});
|
||||
var str = "";
|
||||
for (var i = 0; i < this.imgList.length; i++) {
|
||||
str += this.imgList[i].url + ",";
|
||||
}
|
||||
if (str.length > 0) {
|
||||
str = str.substr(0, str.length - 1);
|
||||
}
|
||||
this.form.baseUrlId = str;
|
||||
} else {
|
||||
this.$message.error(`上传失败`);
|
||||
}
|
||||
},
|
||||
/*查看图片 */
|
||||
handleImgPreview(file) {
|
||||
this.dialogImageUrl2 = file.url;
|
||||
this.dialogVisible2 = true;
|
||||
},
|
||||
handleImgRemove(file) {
|
||||
var index = 0;
|
||||
for (var i in this.imgList) {
|
||||
if (this.imgList[i]["uid"] == file.uid) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.imgList.splice(index, 1);
|
||||
|
||||
var str = "";
|
||||
for (var k = 0; k < this.imgList.length; k++) {
|
||||
str += this.imgList[k].url + ",";
|
||||
}
|
||||
if (str.length > 0) {
|
||||
str = str.substr(0, str.length - 1);
|
||||
}
|
||||
this.form.baseUrlId = str;
|
||||
},
|
||||
/*验证图片个数和大小 */
|
||||
handleImgLimit() {
|
||||
this.$message.warning(`当前限制选择 10 张图片`);
|
||||
},
|
||||
/*上传图片前 判断大小 */
|
||||
beforeUpload(file) {
|
||||
const isLt5M = file.size / 1024 / 1024 < 5;
|
||||
if (!isLt5M) {
|
||||
this.$message.error("上传图片大小不能超过 5MB!");
|
||||
}
|
||||
return isLt5M;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-row {
|
||||
margin-top: 10px;
|
||||
}
|
||||
.el-col {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin-bottom: 20px;
|
||||
background: #f8f8f8;
|
||||
padding: 10px 10px 10px 10px;
|
||||
}
|
||||
.empty-tip {
|
||||
height: 200px;
|
||||
line-height: 200px;
|
||||
border: 1px solid #ebebeb;
|
||||
text-align: center;
|
||||
}
|
||||
.el-button {
|
||||
padding: 14px 42px;
|
||||
}
|
||||
.closeInputBorder ::v-deep .el-input__inner {
|
||||
border: 0;
|
||||
}
|
||||
.closeInputBorder ::v-deep .el-textarea__inner {
|
||||
border: 0;
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.disabled .el-upload--picture-card {
|
||||
display: none !important;
|
||||
}
|
||||
</style>
|
||||
363
src/views/system/dept.vue
Normal file
363
src/views/system/dept.vue
Normal file
@@ -0,0 +1,363 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<!--搜索栏-->
|
||||
<el-form
|
||||
size="small"
|
||||
label-position="right"
|
||||
style="padding-left: 10px;padding-right: 10px;"
|
||||
:inline="true"
|
||||
>
|
||||
<el-row :span="24">
|
||||
<el-form-item label="部门名称:">
|
||||
<el-input v-model="query.deptName" placeholder="部门名称" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="部门全称:">
|
||||
<el-input v-model="query.fullName" placeholder="部门全称" clearable></el-input>
|
||||
</el-form-item>
|
||||
<div class="searchBtn">
|
||||
<el-button type="primary" size="small" icon="el-icon-search" @click="searchChange1">搜 索</el-button>
|
||||
<el-button size="small" icon="el-icon-delete" @click="searchReset1">清 空</el-button>
|
||||
</div>
|
||||
<!-- </el-col> -->
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!--搜索-->
|
||||
<avue-crud
|
||||
:option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
ref="crud"
|
||||
v-model="form"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
:before-close="beforeClose"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
@tree-load="treeLoad"
|
||||
>
|
||||
<template slot="menuLeft"> </template>
|
||||
<template v-slot:menu></template>
|
||||
<template slot-scope="{row}" slot="deptCategory">
|
||||
<el-tag>{{row.deptCategoryName}}</el-tag>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getLazyList,
|
||||
remove,
|
||||
update,
|
||||
add,
|
||||
getDept,
|
||||
getDeptTree
|
||||
} from "@/api/system/dept";
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "dept",
|
||||
data () {
|
||||
return {
|
||||
form: {},
|
||||
selectionList: [],
|
||||
query: {},
|
||||
loading: true,
|
||||
parentId: 0,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0,
|
||||
},
|
||||
option: {
|
||||
addTitle:'新增部门',
|
||||
lazy: true,
|
||||
tip: false,
|
||||
simplePage: true,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
tree: true,
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: "序号",
|
||||
selection: true,
|
||||
viewBtn: true,
|
||||
menuWidth: 300,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "部门名称",
|
||||
prop: "deptName",
|
||||
// search: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入部门名称",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "部门全称",
|
||||
prop: "fullName",
|
||||
// search: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入部门全称",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "机构类型",
|
||||
type: "select",
|
||||
dicUrl: "/api/jobslink-api/system/dict/dictionary?code=org_category",
|
||||
props: {
|
||||
label: "dictValue",
|
||||
value: "dictKey"
|
||||
},
|
||||
dataType: "number",
|
||||
width: 120,
|
||||
prop: "deptCategory",
|
||||
slot: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入机构类型",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "排序",
|
||||
prop: "sort",
|
||||
type: "number",
|
||||
align: "right",
|
||||
width: 80,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入排序",
|
||||
trigger: "blur"
|
||||
},{
|
||||
type: 'number',
|
||||
min: 0,
|
||||
message: '请输入为正整数的角色排序'
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "备注",
|
||||
prop: "remark",
|
||||
rules: [{
|
||||
required: false,
|
||||
message: "请输入备注",
|
||||
trigger: "blur"
|
||||
}],
|
||||
hide: true
|
||||
}
|
||||
]
|
||||
},
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["userInfo", "permission"]),
|
||||
permissionList () {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.dept_add, false),
|
||||
viewBtn: this.vaildData(this.permission.dept_view, false),
|
||||
delBtn: this.vaildData(this.permission.dept_delete, false),
|
||||
editBtn: this.vaildData(this.permission.dept_edit, false)
|
||||
};
|
||||
},
|
||||
ids () {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initData () {
|
||||
getDeptTree().then(res => {
|
||||
const column = this.findObject(this.option.column, "parentId");
|
||||
column.dicData = res.data.data;
|
||||
});
|
||||
},
|
||||
handleAdd (row) {
|
||||
this.$refs.crud.value.parentId = row.id;
|
||||
this.$refs.crud.option.column.filter(item => {
|
||||
if (item.prop === "parentId") {
|
||||
item.value = row.id;
|
||||
item.addDisabled = true;
|
||||
}
|
||||
});
|
||||
this.$refs.crud.rowAdd();
|
||||
},
|
||||
rowSave (row, done, loading) {
|
||||
add(row).then((res) => {
|
||||
// 获取新增数据的相关字段
|
||||
const data = res.data.data;
|
||||
row.id = data.id;
|
||||
row.deptCategoryName = data.deptCategoryName;
|
||||
row.tenantId = data.tenantId;
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
// 数据回调进行刷新
|
||||
done(row);
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdate (row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
// 数据回调进行刷新
|
||||
done(row);
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDel (row, index, done) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
// 数据回调进行刷新
|
||||
done(row);
|
||||
});
|
||||
},
|
||||
handleDelete () {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
// 刷新表格数据并重载
|
||||
this.data = [];
|
||||
this.parentId = 0;
|
||||
this.$refs.crud.refreshTable();
|
||||
this.$refs.crud.toggleSelection();
|
||||
// 表格数据重载
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
searchReset () {
|
||||
this.query = {};
|
||||
this.parentId = 0;
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange (params, done) {
|
||||
this.query = params;
|
||||
this.parentId = '';
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
searchReset1 () {
|
||||
this.query = {};
|
||||
this.parentId = 0;
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange1 () {
|
||||
this.parentId = '';
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
selectionChange (list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear () {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
beforeOpen (done, type) {
|
||||
if (["add", "edit"].includes(type)) {
|
||||
this.initData();
|
||||
}
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDept(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
beforeClose (done) {
|
||||
// this.$refs.crud.value.parentId = "";
|
||||
// this.$refs.crud.value.addDisabled = false;
|
||||
// this.$refs.crud.option.column.filter(item => {
|
||||
// if (item.prop === "parentId") {
|
||||
// item.value = "";
|
||||
// item.addDisabled = false;
|
||||
// }
|
||||
// });
|
||||
done();
|
||||
},
|
||||
currentChange (currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange (pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange () {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad (page, params = {}) {
|
||||
this.loading = true;
|
||||
getLazyList(this.parentId, Object.assign(params, this.query)).then(res => {
|
||||
this.data = res.data.data;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
},
|
||||
treeLoad (tree, treeNode, resolve) {
|
||||
const parentId = tree.id;
|
||||
getLazyList(parentId).then(res => {
|
||||
resolve(res.data.data);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-form-item {
|
||||
margin-bottom: 18px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.searchBtn {
|
||||
display: inline-block;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
</style>
|
||||
416
src/views/system/dict.vue
Normal file
416
src/views/system/dict.vue
Normal file
@@ -0,0 +1,416 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<basic-container>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>字典列表</span>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<avue-crud
|
||||
:option="optionParent"
|
||||
:table-loading="loading"
|
||||
:data="dataParent"
|
||||
:page="pageParent"
|
||||
ref="crud"
|
||||
v-model="formParent"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@row-click="handleRowClick"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoadParent"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
v-if="permission.dict_delete"
|
||||
plain
|
||||
@click="handleDelete"
|
||||
>删 除
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row}" slot="isSealed">
|
||||
<el-tag>{{row.isSealed===0?'否':'是'}}</el-tag>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</div>
|
||||
</el-card>
|
||||
</basic-container>
|
||||
</el-col>
|
||||
<el-col :span="13">
|
||||
<basic-container>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>[{{dictValue}}] 字典详情</span>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<avue-crud
|
||||
:option="optionChild"
|
||||
:table-loading="loadingChild"
|
||||
:data="dataChild"
|
||||
:page="pageChild"
|
||||
ref="crudChild"
|
||||
v-model="formChild"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpenChild"
|
||||
@row-del="rowDelChild"
|
||||
@row-update="rowUpdateChild"
|
||||
@row-save="rowSaveChild"
|
||||
@search-change="searchChangeChild"
|
||||
@search-reset="searchResetChild"
|
||||
@selection-change="selectionChangeChild"
|
||||
@current-change="currentChangeChild"
|
||||
@size-change="sizeChangeChild"
|
||||
@refresh-change="refreshChangeChild"
|
||||
@on-load="onLoadChild"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
v-if="permission.dict_delete"
|
||||
plain
|
||||
@click="handleDelete"
|
||||
>删 除
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row}" slot="isSealed">
|
||||
<el-tag>{{row.isSealed===0?'否':'是'}}</el-tag>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</div>
|
||||
</el-card>
|
||||
</basic-container>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getParentList,
|
||||
getChildList,
|
||||
remove,
|
||||
update,
|
||||
add,
|
||||
getDict,
|
||||
getDictTree
|
||||
} from "@/api/system/dict";
|
||||
import {optionParent, optionChild} from "@/const/system/dict";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "dict",
|
||||
data() {
|
||||
return {
|
||||
dictValue: '暂无',
|
||||
parentId: -1,
|
||||
formParent: {},
|
||||
formChild: {},
|
||||
selectionList: [],
|
||||
query: {},
|
||||
loading: true,
|
||||
loadingChild: true,
|
||||
pageParent: {
|
||||
pageSize: 10,
|
||||
pageSizes: [10, 30, 50, 100, 200],
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
pageChild: {
|
||||
pageSize: 10,
|
||||
pageSizes: [10, 30, 50, 100, 200],
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
dataParent: [],
|
||||
dataChild: [],
|
||||
optionParent: optionParent,
|
||||
optionChild: optionChild,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.dict_add, false),
|
||||
delBtn: this.vaildData(this.permission.dict_delete, false),
|
||||
editBtn: this.vaildData(this.permission.dict_edit, false),
|
||||
viewBtn: false,
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
getDictTree().then(res => {
|
||||
const column = this.findObject(this.optionChild.column, "parentId");
|
||||
column.dicData = res.data.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
rowSave(row, done, loading) {
|
||||
const form = {
|
||||
...row,
|
||||
dictKey: -1,
|
||||
};
|
||||
add(form).then(() => {
|
||||
this.onLoadParent(this.pageParent);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoadParent(this.pageParent);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadParent(this.pageParent);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.parentId = row.id;
|
||||
this.dictValue = row.dictValue;
|
||||
this.$refs.crudChild.value.code = row.code;
|
||||
this.$refs.crudChild.value.parentId = row.id;
|
||||
this.$refs.crudChild.option.column.filter(item => {
|
||||
if (item.prop === "code") {
|
||||
item.value = row.code;
|
||||
}
|
||||
if (item.prop === "parentId") {
|
||||
item.value = row.id;
|
||||
}
|
||||
});
|
||||
this.onLoadChild(this.pageChild);
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoadParent(this.pageParent);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.pageParent.currentPage = 1;
|
||||
this.onLoadParent(this.pageParent, params);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadParent(this.pageParent);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDict(this.formParent.id).then(res => {
|
||||
this.formParent = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.pageParent.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.pageParent.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoadParent(this.pageParent, this.query);
|
||||
},
|
||||
rowSaveChild(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoadChild(this.pageChild);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdateChild(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoadChild(this.pageChild);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDelChild(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadChild(this.pageChild);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
searchResetChild() {
|
||||
this.query = {};
|
||||
this.onLoadChild(this.pageChild);
|
||||
},
|
||||
searchChangeChild(params, done) {
|
||||
this.query = params;
|
||||
this.pageChild.currentPage = 1;
|
||||
this.onLoadChild(this.pageChild, params);
|
||||
done();
|
||||
},
|
||||
selectionChangeChild(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClearChild() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crudChild.toggleSelection();
|
||||
},
|
||||
handleDeleteChild() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadChild(this.pageChild);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crudChild.toggleSelection();
|
||||
});
|
||||
},
|
||||
beforeOpenChild(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDict(this.formChild.id).then(res => {
|
||||
this.formChild = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
currentChangeChild(currentPage) {
|
||||
this.pageChild.currentPage = currentPage;
|
||||
},
|
||||
sizeChangeChild(pageSize) {
|
||||
this.pageChild.pageSize = pageSize;
|
||||
},
|
||||
refreshChangeChild() {
|
||||
this.onLoadChild(this.pageChild, this.query);
|
||||
},
|
||||
onLoadParent(page, params = {}) {
|
||||
this.loading = true;
|
||||
getParentList(
|
||||
page.currentPage,
|
||||
page.pageSize,
|
||||
Object.assign(params, this.query)
|
||||
).then(res => {
|
||||
const data = res.data.data;
|
||||
this.pageParent.total = data.total;
|
||||
this.dataParent = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
},
|
||||
onLoadChild(page, params = {}) {
|
||||
this.loadingChild = true;
|
||||
getChildList(
|
||||
page.currentPage,
|
||||
page.pageSize,
|
||||
this.parentId,
|
||||
Object.assign(params, this.query)
|
||||
).then(res => {
|
||||
const data = res.data.data;
|
||||
this.pageChild.total = data.total;
|
||||
this.dataChild = data.records;
|
||||
this.loadingChild = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
415
src/views/system/dictbiz.vue
Normal file
415
src/views/system/dictbiz.vue
Normal file
@@ -0,0 +1,415 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<el-col :span="11">
|
||||
<basic-container>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>业务字典列表</span>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<avue-crud
|
||||
:option="optionParent"
|
||||
:table-loading="loading"
|
||||
:data="dataParent"
|
||||
:page="pageParent"
|
||||
ref="crud"
|
||||
v-model="formParent"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@row-click="handleRowClick"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoadParent"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
v-if="permission.dict_delete"
|
||||
plain
|
||||
@click="handleDelete"
|
||||
>删 除
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row}" slot="isSealed">
|
||||
<el-tag>{{row.isSealed===0?'否':'是'}}</el-tag>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</div>
|
||||
</el-card>
|
||||
</basic-container>
|
||||
</el-col>
|
||||
<el-col :span="13">
|
||||
<basic-container>
|
||||
<el-card class="box-card">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>[{{dictValue}}] 业务字典详情</span>
|
||||
</div>
|
||||
<div class="clearfix">
|
||||
<avue-crud
|
||||
:option="optionChild"
|
||||
:table-loading="loadingChild"
|
||||
:data="dataChild"
|
||||
:page="pageChild"
|
||||
ref="crudChild"
|
||||
v-model="formChild"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpenChild"
|
||||
@row-del="rowDelChild"
|
||||
@row-update="rowUpdateChild"
|
||||
@row-save="rowSaveChild"
|
||||
@search-change="searchChangeChild"
|
||||
@search-reset="searchResetChild"
|
||||
@selection-change="selectionChangeChild"
|
||||
@current-change="currentChangeChild"
|
||||
@size-change="sizeChangeChild"
|
||||
@refresh-change="refreshChangeChild"
|
||||
@on-load="onLoadChild"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
v-if="permission.dict_delete"
|
||||
plain
|
||||
@click="handleDelete"
|
||||
>删 除
|
||||
</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row}" slot="isSealed">
|
||||
<el-tag>{{row.isSealed===0?'否':'是'}}</el-tag>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</div>
|
||||
</el-card>
|
||||
</basic-container>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getParentList,
|
||||
getChildList,
|
||||
remove,
|
||||
update,
|
||||
add,
|
||||
getDict,
|
||||
getDictTree
|
||||
} from "@/api/system/dictbiz";
|
||||
import {optionParent, optionChild} from "@/const/system/dictbiz";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "dictbiz",
|
||||
data() {
|
||||
return {
|
||||
dictValue: '暂无',
|
||||
parentId: -1,
|
||||
formParent: {},
|
||||
formChild: {},
|
||||
selectionList: [],
|
||||
query: {},
|
||||
loading: true,
|
||||
loadingChild: true,
|
||||
pageParent: {
|
||||
pageSize: 10,
|
||||
pageSizes: [10, 30, 50, 100, 200],
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
pageChild: {
|
||||
pageSize: 10,
|
||||
pageSizes: [10, 30, 50, 100, 200],
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
dataParent: [],
|
||||
dataChild: [],
|
||||
optionParent: optionParent,
|
||||
optionChild: optionChild,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.dictbiz_add, false),
|
||||
delBtn: this.vaildData(this.permission.dictbiz_delete, false),
|
||||
editBtn: this.vaildData(this.permission.dictbiz_edit, false),
|
||||
viewBtn: false,
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
getDictTree().then(res => {
|
||||
const column = this.findObject(this.optionChild.column, "parentId");
|
||||
column.dicData = res.data.data;
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
rowSave(row, done, loading) {
|
||||
const form = {
|
||||
...row,
|
||||
dictKey: -1,
|
||||
};
|
||||
add(form).then(() => {
|
||||
this.onLoadParent(this.pageParent);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoadParent(this.pageParent);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadParent(this.pageParent);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
handleRowClick(row) {
|
||||
this.parentId = row.id;
|
||||
this.dictValue = row.dictValue;
|
||||
this.$refs.crudChild.value.code = row.code;
|
||||
this.$refs.crudChild.value.parentId = row.id;
|
||||
this.$refs.crudChild.option.column.filter(item => {
|
||||
if (item.prop === "code") {
|
||||
item.value = row.code;
|
||||
}
|
||||
if (item.prop === "parentId") {
|
||||
item.value = row.id;
|
||||
}
|
||||
});
|
||||
this.onLoadChild(this.pageChild);
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoadParent(this.pageParent);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.pageParent.currentPage = 1;
|
||||
this.onLoadParent(this.pageParent, params);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadParent(this.pageParent);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDict(this.formParent.id).then(res => {
|
||||
this.formParent = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.pageParent.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.pageParent.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoadParent(this.pageParent, this.query);
|
||||
},
|
||||
rowSaveChild(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoadChild(this.pageChild);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdateChild(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoadChild(this.pageChild);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDelChild(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadChild(this.pageChild);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
searchResetChild() {
|
||||
this.query = {};
|
||||
this.onLoadChild(this.pageChild);
|
||||
},
|
||||
searchChangeChild(params, done) {
|
||||
this.query = params;
|
||||
this.pageChild.currentPage = 1;
|
||||
this.onLoadChild(this.pageChild, params);
|
||||
done();
|
||||
},
|
||||
selectionChangeChild(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClearChild() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crudChild.toggleSelection();
|
||||
},
|
||||
handleDeleteChild() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoadChild(this.pageChild);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crudChild.toggleSelection();
|
||||
});
|
||||
},
|
||||
beforeOpenChild(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDict(this.formChild.id).then(res => {
|
||||
this.formChild = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
currentChangeChild(currentPage) {
|
||||
this.pageChild.currentPage = currentPage;
|
||||
},
|
||||
sizeChangeChild(pageSize) {
|
||||
this.pageChild.pageSize = pageSize;
|
||||
},
|
||||
refreshChangeChild() {
|
||||
this.onLoadChild(this.pageChild, this.query);
|
||||
},
|
||||
onLoadParent(page, params = {}) {
|
||||
this.loading = true;
|
||||
getParentList(
|
||||
page.currentPage,
|
||||
page.pageSize,
|
||||
Object.assign(params, this.query)
|
||||
).then(res => {
|
||||
const data = res.data.data;
|
||||
this.pageParent.total = data.total;
|
||||
this.dataParent = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
},
|
||||
onLoadChild(page, params = {}) {
|
||||
this.loadingChild = true;
|
||||
getChildList(
|
||||
page.currentPage,
|
||||
page.pageSize,
|
||||
this.parentId,
|
||||
Object.assign(params, this.query)
|
||||
).then(res => {
|
||||
const data = res.data.data;
|
||||
this.pageChild.total = data.total;
|
||||
this.dataChild = data.records;
|
||||
this.loadingChild = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
437
src/views/system/menu.vue
Normal file
437
src/views/system/menu.vue
Normal file
@@ -0,0 +1,437 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud
|
||||
:option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
ref="crud"
|
||||
v-model="form"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
:before-close="beforeClose"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
@tree-load="treeLoad"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
v-if="permission.menu_delete"
|
||||
plain
|
||||
@click="handleDelete"
|
||||
>删 除</el-button>
|
||||
<el-button
|
||||
type="primary"
|
||||
icon="el-icon-refresh"
|
||||
size="small"
|
||||
@click.stop="handleSynPre"
|
||||
>同步权限</el-button>
|
||||
</template>
|
||||
<template slot-scope="scope" slot="menu">
|
||||
<el-button
|
||||
type="text"
|
||||
icon="el-icon-circle-plus-outline"
|
||||
size="small"
|
||||
@click.stop="handleAdd(scope.row,scope.index)"
|
||||
v-if="userInfo.role_name.includes('admin')"
|
||||
>新增子项</el-button>
|
||||
|
||||
</template>
|
||||
<template slot-scope="{row}" slot="source">
|
||||
<div style="text-align:center">
|
||||
<i :class="row.source" />
|
||||
</div>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getLazyList, remove, update, add, getMenu, getMerges } from "@/api/system/menu";
|
||||
import { mapGetters } from "vuex";
|
||||
import iconList from "@/config/iconList";
|
||||
import func from "@/util/func";
|
||||
import { getMenuTree } from "@/api/system/menu";
|
||||
|
||||
export default {
|
||||
name: "menu",
|
||||
data () {
|
||||
return {
|
||||
form: {},
|
||||
query: {},
|
||||
loading: true,
|
||||
selectionList: [],
|
||||
parentId: 0,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0,
|
||||
},
|
||||
option: {
|
||||
lazy: true,
|
||||
tip: false,
|
||||
simplePage: true,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
dialogWidth: "60%",
|
||||
tree: true,
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: "序号",
|
||||
selection: true,
|
||||
viewBtn: true,
|
||||
menuWidth: 400,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "菜单名称",
|
||||
prop: "name",
|
||||
search: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单名称",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "路由地址",
|
||||
prop: "path",
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入路由地址",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "上级菜单",
|
||||
prop: "parentId",
|
||||
type: "tree",
|
||||
dicData: [],
|
||||
hide: true,
|
||||
props: {
|
||||
label: "title"
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
required: false,
|
||||
message: "请选择上级菜单",
|
||||
trigger: "click"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单图标",
|
||||
prop: "source",
|
||||
type: "icon",
|
||||
slot: true,
|
||||
iconList: iconList,
|
||||
width:70,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单图标",
|
||||
trigger: "click"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单编号",
|
||||
prop: "code",
|
||||
search: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单编号",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单类型",
|
||||
prop: "category",
|
||||
type: "radio",
|
||||
dicData: [
|
||||
{
|
||||
label: "菜单",
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: "按钮",
|
||||
value: 2
|
||||
}
|
||||
],
|
||||
hide: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择菜单类型",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单别名",
|
||||
prop: "alias",
|
||||
search: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单别名",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单排序",
|
||||
prop: "sort",
|
||||
type: "number",
|
||||
width:70,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单排序",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单备注",
|
||||
prop: "remark",
|
||||
type: "textarea",
|
||||
span: 24,
|
||||
minRows: 2,
|
||||
hide: true
|
||||
}
|
||||
]
|
||||
},
|
||||
data: []
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
'form.category' () {
|
||||
const category = func.toInt(this.form.category);
|
||||
this.$refs.crud.option.column.filter(item => {
|
||||
if (item.prop === "path") {
|
||||
item.rules[0].required = category === 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["userInfo", "permission"]),
|
||||
permissionList () {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.menu_add, false),
|
||||
viewBtn: this.vaildData(this.permission.menu_view, false),
|
||||
delBtn: this.vaildData(this.permission.menu_delete, false),
|
||||
editBtn: this.vaildData(this.permission.menu_edit, false)
|
||||
};
|
||||
},
|
||||
ids () {
|
||||
let ids = [];
|
||||
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
|
||||
});
|
||||
return ids.join(",");
|
||||
},
|
||||
menuCodes(){
|
||||
let menuIds = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
menuIds.push(ele.code);
|
||||
|
||||
});
|
||||
return menuIds.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initData () {
|
||||
getMenuTree().then(res => {
|
||||
const column = this.findObject(this.option.column, "parentId");
|
||||
column.dicData = res.data.data;
|
||||
});
|
||||
},
|
||||
handleAdd (row) {
|
||||
this.$refs.crud.value.parentId = row.id;
|
||||
this.$refs.crud.option.column.filter(item => {
|
||||
if (item.prop === "parentId") {
|
||||
item.value = row.id;
|
||||
item.addDisabled = true;
|
||||
}
|
||||
});
|
||||
this.$refs.crud.rowAdd();
|
||||
},
|
||||
//同步权限
|
||||
handleSynPre(){
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请至少选择一条数据");
|
||||
return;
|
||||
}
|
||||
getMerges(this.menuCodes).then(() => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
});
|
||||
},
|
||||
rowSave (row, done, loading) {
|
||||
add(row).then((res) => {
|
||||
// 获取新增数据的相关字段
|
||||
const data = res.data.data;
|
||||
row.id = data.id;
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
// 数据回调进行刷新
|
||||
done(row);
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdate (row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
// 数据回调进行刷新
|
||||
done(row);
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDel (row, index, done) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
// 数据回调进行刷新
|
||||
done(row);
|
||||
});
|
||||
},
|
||||
handleDelete () {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
// 刷新表格数据并重载
|
||||
this.data = [];
|
||||
this.parentId = 0;
|
||||
this.$refs.crud.refreshTable();
|
||||
this.$refs.crud.toggleSelection();
|
||||
// 表格数据重载
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
searchReset () {
|
||||
this.query = {};
|
||||
this.parentId = 0;
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange (params, done) {
|
||||
this.query = params;
|
||||
this.parentId = '';
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
selectionChange (list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear () {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
beforeOpen (done, type) {
|
||||
if (["add", "edit"].includes(type)) {
|
||||
this.initData();
|
||||
}
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getMenu(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
beforeClose (done) {
|
||||
this.$refs.crud.value.parentId = "";
|
||||
this.$refs.crud.value.addDisabled = false;
|
||||
this.$refs.crud.option.column.filter(item => {
|
||||
if (item.prop === "parentId") {
|
||||
item.value = "";
|
||||
item.addDisabled = false;
|
||||
}
|
||||
});
|
||||
done();
|
||||
},
|
||||
currentChange (currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange (pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange () {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad (page, params = {}) {
|
||||
this.loading = true;
|
||||
getLazyList(this.parentId, Object.assign(params, this.query)).then(res => {
|
||||
this.data = res.data.data;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
},
|
||||
treeLoad (tree, treeNode, resolve) {
|
||||
const parentId = tree.id;
|
||||
getLazyList(parentId).then(res => {
|
||||
resolve(res.data.data);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
227
src/views/system/param.vue
Normal file
227
src/views/system/param.vue
Normal file
@@ -0,0 +1,227 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud :option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
ref="crud"
|
||||
v-model="form"
|
||||
:page.sync="page"
|
||||
:permission="permissionList"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad">
|
||||
<template slot="menuLeft">
|
||||
<el-button type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
v-if="permission.param_delete"
|
||||
plain
|
||||
@click="handleDelete">删 除
|
||||
</el-button>
|
||||
</template>
|
||||
</avue-crud>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getList, remove, update, add} from "@/api/system/param";
|
||||
import {mapGetters} from "vuex";
|
||||
|
||||
export default {
|
||||
name: "param",
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
selectionList: [],
|
||||
query: {},
|
||||
loading: true,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
option: {
|
||||
height: 'auto',
|
||||
calcHeight: 30,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: "序号",
|
||||
selection: true,
|
||||
viewBtn: true,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "参数名称",
|
||||
prop: "paramName",
|
||||
search: true,
|
||||
span: 24,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入参数名称",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "参数键名",
|
||||
prop: "paramKey",
|
||||
search: true,
|
||||
span: 24,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入参数键名",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "参数键值",
|
||||
prop: "paramValue",
|
||||
type: "textarea",
|
||||
span: 24,
|
||||
minRows: 6,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入参数键值",
|
||||
trigger: "blur"
|
||||
}]
|
||||
}
|
||||
]
|
||||
},
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.param_add, false),
|
||||
viewBtn: this.vaildData(this.permission.param_view, false),
|
||||
delBtn: this.vaildData(this.permission.param_delete, false),
|
||||
editBtn: this.vaildData(this.permission.param_edit, false)
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rowSave(row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
310
src/views/system/produce.vue
Normal file
310
src/views/system/produce.vue
Normal file
@@ -0,0 +1,310 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud
|
||||
:option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
ref="crud"
|
||||
v-model="form"
|
||||
:page.sync="page"
|
||||
:permission="permissionList"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
v-if="permission.produce_delete"
|
||||
plain
|
||||
@click="handleDelete"
|
||||
>删 除</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
@click="handleMenuSetting"
|
||||
v-if="permission.topmenu_setting"
|
||||
plain
|
||||
>菜单配置</el-button>
|
||||
</template>
|
||||
</avue-crud>
|
||||
<el-dialog title="下级菜单配置" append-to-body :visible.sync="box" width="345px">
|
||||
<el-tree
|
||||
:data="menuGrantList"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
ref="treeMenu"
|
||||
:default-checked-keys="menuTreeObj"
|
||||
:props="props"
|
||||
></el-tree>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="box = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getList,
|
||||
remove,
|
||||
update,
|
||||
add,
|
||||
grant,
|
||||
grantTree,
|
||||
getProduceTree
|
||||
} from "@/api/system/produce";
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "produce",
|
||||
data() {
|
||||
return {
|
||||
box: false,
|
||||
menuGrantList: [],
|
||||
menuTreeObj: [],
|
||||
props: {
|
||||
label: "title",
|
||||
value: "key"
|
||||
},
|
||||
form: {},
|
||||
selectionList: [],
|
||||
query: {},
|
||||
loading: true,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
option: {
|
||||
height: "auto",
|
||||
calcHeight: 30,
|
||||
searchMenuSpan: 6,
|
||||
tip: false,
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: "序号",
|
||||
selection: true,
|
||||
viewBtn: true,
|
||||
column: [
|
||||
{
|
||||
label: "产品名称",
|
||||
prop: "produceName",
|
||||
search: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入参数",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "产品标志",
|
||||
prop: "produceSign",
|
||||
search: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入参数",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "产品类别",
|
||||
prop: "useType",
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入参数",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "产品说明",
|
||||
prop: "descInfo",
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入参数",
|
||||
trigger: "blur"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.produce_add, false),
|
||||
viewBtn: this.vaildData(this.permission.produce_view, false),
|
||||
delBtn: this.vaildData(this.permission.produce_delete, false),
|
||||
editBtn: this.vaildData(this.permission.produce_edit, false)
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit() {
|
||||
const menuList = this.$refs.treeMenu.getCheckedKeys().join(",");
|
||||
grant(this.ids, menuList).then(() => {
|
||||
this.box = false;
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.onLoad(this.page);
|
||||
});
|
||||
},
|
||||
rowSave(row, loading, done) {
|
||||
add(row).then(
|
||||
() => {
|
||||
loading();
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
},
|
||||
() => {
|
||||
done();
|
||||
}
|
||||
);
|
||||
},
|
||||
rowUpdate(row, index, loading, done) {
|
||||
update(row).then(
|
||||
() => {
|
||||
loading();
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
},
|
||||
() => {
|
||||
done();
|
||||
}
|
||||
);
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
handleMenuSetting() {
|
||||
if (this.selectionList.length !== 1) {
|
||||
this.$message.warning("只能选择一条数据");
|
||||
return;
|
||||
}
|
||||
this.menuTreeObj = [];
|
||||
//获取树形菜单
|
||||
grantTree().then(res => {
|
||||
this.menuGrantList = res.data.data.menu;
|
||||
getProduceTree(this.ids).then(res => {
|
||||
this.menuTreeObj = res.data.data.menu;
|
||||
this.box = true;
|
||||
});
|
||||
});
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(
|
||||
page.currentPage,
|
||||
page.pageSize,
|
||||
Object.assign(params, this.query)
|
||||
).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
364
src/views/system/tenant.vue
Normal file
364
src/views/system/tenant.vue
Normal file
@@ -0,0 +1,364 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud
|
||||
:option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
ref="crud"
|
||||
v-model="form"
|
||||
:page.sync="page"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
v-if="permission.tenant_delete"
|
||||
plain
|
||||
@click="handleDelete"
|
||||
>删 除</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
plain
|
||||
v-if="userInfo.role_name.includes('administrator')"
|
||||
icon="el-icon-setting"
|
||||
@click="handleSetting"
|
||||
>授权配置</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row}" slot="accountNumber">
|
||||
<el-tag>{{row.accountNumber>0?row.accountNumber:'不限制'}}</el-tag>
|
||||
</template>
|
||||
<template slot-scope="{row}" slot="expireTime">
|
||||
<el-tag>{{row.expireTime?row.expireTime:'不限制'}}</el-tag>
|
||||
</template>
|
||||
</avue-crud>
|
||||
<el-dialog title="租户授权配置" append-to-body :visible.sync="box" width="450px">
|
||||
<avue-form :option="settingOption" v-model="settingForm" @submit="handleSubmit" />
|
||||
</el-dialog>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, getDetail, remove, update, add, setting } from "@/api/system/tenant";
|
||||
import { mapGetters } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "tenant",
|
||||
data () {
|
||||
return {
|
||||
form: {},
|
||||
selectionList: [],
|
||||
query: {},
|
||||
loading: true,
|
||||
box: false,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
option: {
|
||||
height: 'auto',
|
||||
calcHeight: 30,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: "序号",
|
||||
selection: true,
|
||||
viewBtn: true,
|
||||
dialogWidth: 900,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "租户ID",
|
||||
prop: "tenantId",
|
||||
width: 100,
|
||||
search: true,
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
span: 24,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入租户ID",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "租户名称",
|
||||
prop: "id",
|
||||
search: true,
|
||||
width: 180,
|
||||
span: 24,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入参数名称",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "联系人",
|
||||
prop: "linkman",
|
||||
width: 100,
|
||||
search: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入联系人",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "联系电话",
|
||||
prop: "contactNumber",
|
||||
width: 150,
|
||||
},
|
||||
{
|
||||
label: "联系地址",
|
||||
prop: "address",
|
||||
span: 24,
|
||||
minRows: 2,
|
||||
type: "textarea",
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "账号额度",
|
||||
prop: "accountNumber",
|
||||
width: 90,
|
||||
slot: true,
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
label: "过期时间",
|
||||
prop: "expireTime",
|
||||
width: 180,
|
||||
slot: true,
|
||||
addDisplay: false,
|
||||
editDisplay: false,
|
||||
},
|
||||
{
|
||||
label: "绑定域名",
|
||||
prop: "domain",
|
||||
span: 24,
|
||||
},
|
||||
{
|
||||
label: "系统背景",
|
||||
prop: "backgroundUrl",
|
||||
type: 'upload',
|
||||
listType: 'picture-img',
|
||||
action: '/api/jobslink-api/resource/oss/endpoint/put-file',
|
||||
propsHttp: {
|
||||
res: 'data',
|
||||
url: 'link',
|
||||
},
|
||||
hide: true,
|
||||
span: 24,
|
||||
},
|
||||
]
|
||||
},
|
||||
data: [],
|
||||
settingForm: {},
|
||||
settingOption: {
|
||||
column: [
|
||||
{
|
||||
label: "账号额度",
|
||||
prop: "accountNumber",
|
||||
type: "number",
|
||||
span: 24,
|
||||
},
|
||||
{
|
||||
label: "过期时间",
|
||||
prop: "expireTime",
|
||||
type: "date",
|
||||
format: "yyyy-MM-dd hh:mm:ss",
|
||||
valueFormat: "yyyy-MM-dd hh:mm:ss",
|
||||
span: 24,
|
||||
},
|
||||
]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["userInfo", "permission"]),
|
||||
permissionList () {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.tenant_add, false),
|
||||
viewBtn: this.vaildData(this.permission.tenant_view, false),
|
||||
delBtn: this.vaildData(this.permission.tenant_delete, false),
|
||||
editBtn: this.vaildData(this.permission.tenant_edit, false)
|
||||
};
|
||||
},
|
||||
ids () {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
rowSave (row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdate (row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDel (row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
beforeOpen (done, type) {
|
||||
if (["view"].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
const data = res.data.data;
|
||||
if (!(data.accountNumber > 0)) {
|
||||
data.accountNumber = "不限制";
|
||||
}
|
||||
if (!data.expireTime) {
|
||||
data.expireTime = "不限制";
|
||||
}
|
||||
this.form = data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
searchReset () {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange (params, done) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
selectionChange (list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear () {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
handleDelete () {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
handleSetting () {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
if (this.selectionList.length === 1) {
|
||||
getDetail(this.selectionList[0].id).then(res => {
|
||||
const data = res.data.data;
|
||||
this.settingForm.accountNumber = data.accountNumber;
|
||||
this.settingForm.expireTime = data.expireTime;
|
||||
});
|
||||
} else {
|
||||
this.settingForm.accountNumber = -1;
|
||||
this.settingForm.expireTime = '';
|
||||
}
|
||||
this.box = true;
|
||||
},
|
||||
handleSubmit (form, done, loading) {
|
||||
setting(this.ids, form).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "配置成功!"
|
||||
});
|
||||
done();
|
||||
this.box = false;
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
currentChange (currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange (pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange () {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad (page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
315
src/views/system/topmenu.vue
Normal file
315
src/views/system/topmenu.vue
Normal file
@@ -0,0 +1,315 @@
|
||||
<template>
|
||||
<basic-container>
|
||||
<avue-crud
|
||||
:option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
:page.sync="page"
|
||||
:permission="permissionList"
|
||||
:before-open="beforeOpen"
|
||||
v-model="form"
|
||||
ref="crud"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
@row-del="rowDel"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button
|
||||
type="danger"
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
plain
|
||||
v-if="permission.topmenu_delete"
|
||||
@click="handleDelete"
|
||||
>删 除</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
@click="handleMenuSetting"
|
||||
v-if="permission.topmenu_setting"
|
||||
plain
|
||||
>菜单配置</el-button>
|
||||
</template>
|
||||
<template slot-scope="{row}" slot="source">
|
||||
<div style="text-align:center">
|
||||
<i :class="row.source"></i>
|
||||
</div>
|
||||
</template>
|
||||
</avue-crud>
|
||||
<el-dialog title="下级菜单配置" append-to-body :visible.sync="box" width="345px">
|
||||
<el-tree
|
||||
:data="menuGrantList"
|
||||
show-checkbox
|
||||
node-key="id"
|
||||
ref="treeMenu"
|
||||
:default-checked-keys="menuTreeObj"
|
||||
:props="props"
|
||||
></el-tree>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="box = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submit">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</basic-container>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getList, getDetail, add, update, remove, grant, grantTree, getTopTree } from "@/api/system/topmenu";
|
||||
import { mapGetters } from "vuex";
|
||||
import iconList from "@/config/iconList";
|
||||
|
||||
export default {
|
||||
name: "topmenu",
|
||||
data () {
|
||||
return {
|
||||
form: {},
|
||||
box: false,
|
||||
query: {},
|
||||
loading: true,
|
||||
props: {
|
||||
label: "title",
|
||||
value: "key"
|
||||
},
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0
|
||||
},
|
||||
selectionList: [],
|
||||
menuGrantList: [],
|
||||
menuTreeObj: [],
|
||||
option: {
|
||||
height: 'auto',
|
||||
calcHeight: 30,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: "序号",
|
||||
viewBtn: true,
|
||||
selection: true,
|
||||
dialogWidth: 900,
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "菜单名",
|
||||
prop: "name",
|
||||
search: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入菜单名",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "菜单图标",
|
||||
prop: "source",
|
||||
type: "icon",
|
||||
slot: true,
|
||||
iconList: iconList,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入菜单图标",
|
||||
trigger: "click"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: "菜单编号",
|
||||
prop: "code",
|
||||
search: true,
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入菜单编号",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
{
|
||||
label: "菜单排序",
|
||||
prop: "sort",
|
||||
type: "number",
|
||||
rules: [{
|
||||
required: true,
|
||||
message: "请输入菜单排序",
|
||||
trigger: "blur"
|
||||
}]
|
||||
},
|
||||
]
|
||||
},
|
||||
data: []
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["permission"]),
|
||||
permissionList () {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.topmenu_add, false),
|
||||
viewBtn: this.vaildData(this.permission.topmenu_view, false),
|
||||
delBtn: this.vaildData(this.permission.topmenu_delete, false),
|
||||
editBtn: this.vaildData(this.permission.topmenu_edit, false)
|
||||
};
|
||||
},
|
||||
ids () {
|
||||
let ids = [];
|
||||
this.selectionList.forEach(ele => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit () {
|
||||
const menuList = this.$refs.treeMenu.getCheckedKeys().join(",");
|
||||
grant(this.ids, menuList).then(() => {
|
||||
this.box = false;
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.onLoad(this.page);
|
||||
});
|
||||
},
|
||||
rowSave (row, done, loading) {
|
||||
add(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowUpdate (row, index, done, loading) {
|
||||
update(row).then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
done();
|
||||
}, error => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
});
|
||||
},
|
||||
rowDel (row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
});
|
||||
},
|
||||
handleDelete () {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!"
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
handleMenuSetting () {
|
||||
if (this.selectionList.length !== 1) {
|
||||
this.$message.warning("只能选择一条数据");
|
||||
return;
|
||||
}
|
||||
this.menuTreeObj = [];
|
||||
grantTree()
|
||||
.then(res => {
|
||||
this.menuGrantList = res.data.data.menu;
|
||||
getTopTree(this.ids).then(res => {
|
||||
this.menuTreeObj = res.data.data.menu;
|
||||
this.box = true;
|
||||
});
|
||||
});
|
||||
},
|
||||
beforeOpen (done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
getDetail(this.form.id).then(res => {
|
||||
this.form = res.data.data;
|
||||
});
|
||||
}
|
||||
done();
|
||||
},
|
||||
searchReset () {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange (params, done) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
selectionChange (list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear () {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
currentChange (currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange (pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange () {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad (page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.none-border {
|
||||
border: 0;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
730
src/views/system/user.vue
Normal file
730
src/views/system/user.vue
Normal file
@@ -0,0 +1,730 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<basic-container>
|
||||
<!--搜索栏-->
|
||||
<el-form
|
||||
size="small"
|
||||
label-position="right"
|
||||
style="padding-left: 10px; padding-right: 10px"
|
||||
:inline="true"
|
||||
>
|
||||
<el-row :span="24">
|
||||
<el-form-item label="登录账号:">
|
||||
<el-input
|
||||
v-model="query.account"
|
||||
placeholder="登录账号"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="用户姓名:">
|
||||
<el-input
|
||||
v-model="query.realName"
|
||||
placeholder="用户姓名"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
<div class="searchBtn">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
icon="el-icon-search"
|
||||
@click="searchChange1"
|
||||
>搜 索</el-button
|
||||
>
|
||||
<el-button
|
||||
size="small"
|
||||
icon="el-icon-delete"
|
||||
@click="searchReset1"
|
||||
>清 空</el-button
|
||||
>
|
||||
</div>
|
||||
<!-- </el-col> -->
|
||||
</el-row>
|
||||
</el-form>
|
||||
<!--搜索-->
|
||||
<avue-crud
|
||||
:option="option"
|
||||
:table-loading="loading"
|
||||
:data="data"
|
||||
ref="crud"
|
||||
v-model="form"
|
||||
:permission="permissionList"
|
||||
@row-del="rowDel"
|
||||
@row-update="rowUpdate"
|
||||
@row-save="rowSave"
|
||||
:before-open="beforeOpen"
|
||||
:page.sync="page"
|
||||
@search-change="searchChange"
|
||||
@search-reset="searchReset"
|
||||
@selection-change="selectionChange"
|
||||
@current-change="currentChange"
|
||||
@size-change="sizeChange"
|
||||
@refresh-change="refreshChange"
|
||||
@on-load="onLoad"
|
||||
>
|
||||
<template slot="menuLeft">
|
||||
<el-button
|
||||
type="info"
|
||||
size="small"
|
||||
plain
|
||||
v-if="permission.user_role"
|
||||
icon="el-icon-user"
|
||||
@click="handleGrant"
|
||||
>角色配置</el-button
|
||||
>
|
||||
<el-button
|
||||
size="small"
|
||||
plain
|
||||
v-if="permission.user_reset"
|
||||
icon="el-icon-refresh"
|
||||
@click="handleReset"
|
||||
>密码重置</el-button
|
||||
>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="companyName">
|
||||
<el-tag>{{ row.companyName }}</el-tag>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="roleName">
|
||||
<el-tag>{{ row.roleName }}</el-tag>
|
||||
</template>
|
||||
<template slot-scope="{ row }" slot="deptName">
|
||||
<el-tag>{{ row.deptName }}</el-tag>
|
||||
</template>
|
||||
</avue-crud>
|
||||
<el-dialog
|
||||
title="用户角色配置"
|
||||
append-to-body
|
||||
:visible.sync="roleBox"
|
||||
width="345px"
|
||||
>
|
||||
<el-tree
|
||||
:data="roleGrantList"
|
||||
show-checkbox
|
||||
default-expand-all
|
||||
node-key="id"
|
||||
ref="treeRole"
|
||||
:default-checked-keys="roleTreeObj"
|
||||
:props="props"
|
||||
></el-tree>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="roleBox = false">取 消</el-button>
|
||||
<el-button type="primary" @click="submitRole">确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="用户数据导入"
|
||||
append-to-body
|
||||
:visible.sync="excelBox"
|
||||
width="555px"
|
||||
>
|
||||
<avue-form
|
||||
:option="excelOption"
|
||||
v-model="excelForm"
|
||||
:upload-after="uploadAfter"
|
||||
:upload-error="uploadError"
|
||||
>
|
||||
<template slot="excelTemplate">
|
||||
<el-button type="primary" @click="handleTemplate()">
|
||||
点击下载
|
||||
<i class="el-icon-download el-icon--right"></i>
|
||||
</el-button>
|
||||
</template>
|
||||
</avue-form>
|
||||
</el-dialog>
|
||||
</basic-container>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
getList,
|
||||
remove,
|
||||
update,
|
||||
add,
|
||||
grant,
|
||||
resetPassword,
|
||||
} from "@/api/system/user";
|
||||
import { getDeptTree } from "@/api/system/dept";
|
||||
import { getRoleTree } from "@/api/system/role";
|
||||
import { mapGetters } from "vuex";
|
||||
import website from "@/config/website";
|
||||
import { getToken } from "@/util/auth";
|
||||
import { isMobile } from "@/util/validate";
|
||||
import md5 from "js-md5";
|
||||
import { excelAccept } from "@/common/accept";
|
||||
|
||||
export default {
|
||||
name: "user",
|
||||
data() {
|
||||
const validatePass = (rule, value, callback) => {
|
||||
if (value === "") {
|
||||
callback(new Error("请输入密码"));
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
const validateMobile = (rule, value, callback) => {
|
||||
if (isMobile(value)) {
|
||||
callback();
|
||||
} else {
|
||||
callback(new Error("手机号格式不正确"));
|
||||
}
|
||||
};
|
||||
return {
|
||||
form: {},
|
||||
roleBox: false,
|
||||
excelBox: false,
|
||||
selectionList: [],
|
||||
query: {},
|
||||
loading: true,
|
||||
page: {
|
||||
pageSize: 10,
|
||||
currentPage: 1,
|
||||
total: 0,
|
||||
},
|
||||
init: {
|
||||
roleTree: [],
|
||||
deptTree: [],
|
||||
},
|
||||
props: {
|
||||
label: "title",
|
||||
value: "key",
|
||||
},
|
||||
roleGrantList: [],
|
||||
roleTreeObj: [],
|
||||
treeDeptId: "",
|
||||
treeData: [],
|
||||
option: {
|
||||
height: "auto",
|
||||
calcHeight: 125,
|
||||
tip: false,
|
||||
searchShow: true,
|
||||
searchMenuSpan: 6,
|
||||
border: true,
|
||||
index: true,
|
||||
indexLabel: "序号",
|
||||
selection: true,
|
||||
viewBtn: true,
|
||||
dialogType: "drawer",
|
||||
dialogClickModal: false,
|
||||
column: [
|
||||
{
|
||||
label: "登录账号",
|
||||
prop: "account",
|
||||
// search: true,
|
||||
display: false,
|
||||
|
||||
},
|
||||
{
|
||||
label: "用户姓名",
|
||||
prop: "realName",
|
||||
// search: true,
|
||||
display: false,
|
||||
},
|
||||
{
|
||||
label: "所属角色",
|
||||
prop: "roleName",
|
||||
// slot: true,
|
||||
display: false,
|
||||
},
|
||||
{
|
||||
label: "所属部门",
|
||||
prop: "deptName",
|
||||
// slot: true,
|
||||
display: false,
|
||||
},
|
||||
],
|
||||
group: [
|
||||
{
|
||||
label: "基础信息",
|
||||
prop: "baseInfo",
|
||||
icon: "el-icon-user-solid",
|
||||
column: [
|
||||
{
|
||||
label: "登录账号",
|
||||
prop: "account",
|
||||
editDisabled: true,
|
||||
placeholder:'请输入 登录手机号',
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入登录手机号",
|
||||
trigger: "blur",
|
||||
},
|
||||
{ validator: validateMobile, trigger: "blur" },
|
||||
],
|
||||
span: website.tenantMode ? 12 : 24,
|
||||
},
|
||||
{
|
||||
label: "密码",
|
||||
prop: "password",
|
||||
hide: true,
|
||||
editDisplay: false,
|
||||
viewDisplay: false,
|
||||
rules: [
|
||||
{ required: true, validator: validatePass, trigger: "blur" },
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "详细信息",
|
||||
prop: "detailInfo",
|
||||
icon: "el-icon-s-order",
|
||||
column: [
|
||||
{
|
||||
label: "用户姓名",
|
||||
prop: "realName",
|
||||
hide: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入用户姓名",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "身份证号",
|
||||
prop: "idNumber",
|
||||
overHidden: true,
|
||||
},
|
||||
{
|
||||
label: "电子邮箱",
|
||||
prop: "email",
|
||||
hide: true,
|
||||
overHidden: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请输入电子邮箱",
|
||||
trigger: "blur",
|
||||
},
|
||||
{ type: 'email', message: '请输入正确的邮箱地址', trigger: ['blur', 'change'] }
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "用户性别",
|
||||
prop: "sex",
|
||||
type: "select",
|
||||
dicData: [
|
||||
{
|
||||
label: "男",
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: "女",
|
||||
value: 2,
|
||||
},
|
||||
{
|
||||
label: "不限",
|
||||
value: -1,
|
||||
},
|
||||
],
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "用户生日",
|
||||
type: "date",
|
||||
prop: "birthday",
|
||||
format: "yyyy-MM-dd",
|
||||
valueFormat: "yyyy-MM-dd hh:mm:ss",
|
||||
hide: true,
|
||||
},
|
||||
{
|
||||
label: "账号状态",
|
||||
prop: "statusName",
|
||||
hide: true,
|
||||
display: false,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "职责信息",
|
||||
prop: "dutyInfo",
|
||||
icon: "el-icon-s-custom",
|
||||
column: [
|
||||
{
|
||||
label: "所属角色",
|
||||
prop: "roleId",
|
||||
multiple: false,
|
||||
type: "tree",
|
||||
dicData: [],
|
||||
props: {
|
||||
label: "title",
|
||||
},
|
||||
checkStrictly: true,
|
||||
slot: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择所属角色",
|
||||
trigger: "click",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "所属部门",
|
||||
prop: "deptId",
|
||||
type: "tree",
|
||||
multiple: false,
|
||||
dicData: [],
|
||||
props: {
|
||||
label: "title",
|
||||
},
|
||||
checkStrictly: true,
|
||||
slot: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择所属部门",
|
||||
trigger: "click",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
data: [],
|
||||
excelForm: {},
|
||||
excelOption: {
|
||||
submitBtn: false,
|
||||
emptyBtn: false,
|
||||
column: [
|
||||
{
|
||||
label: "文件上传",
|
||||
prop: "excelFile",
|
||||
type: "upload",
|
||||
drag: true,
|
||||
loadText: "文件上传中,请稍等",
|
||||
span: 24,
|
||||
propsHttp: {
|
||||
res: "data",
|
||||
},
|
||||
accept: excelAccept,
|
||||
tip: "请上传 .xls,.xlsx 标准格式文件",
|
||||
action: "/api/jobslink-api/system/tuser/import-user",
|
||||
},
|
||||
{
|
||||
label: "数据覆盖",
|
||||
prop: "isCovered",
|
||||
type: "switch",
|
||||
align: "center",
|
||||
width: 80,
|
||||
dicData: [
|
||||
{
|
||||
label: "否",
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: "是",
|
||||
value: 1,
|
||||
},
|
||||
],
|
||||
value: 0,
|
||||
slot: true,
|
||||
rules: [
|
||||
{
|
||||
required: true,
|
||||
message: "请选择是否覆盖",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "模板下载",
|
||||
prop: "excelTemplate",
|
||||
formslot: true,
|
||||
span: 24,
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
"form.tenantId"() {
|
||||
if (this.form.tenantId !== "" && this.form.tenantId !== undefined) {
|
||||
this.initData(this.form.tenantId);
|
||||
}
|
||||
},
|
||||
"excelForm.isCovered"() {
|
||||
if (this.excelForm.isCovered !== "") {
|
||||
const column = this.findObject(this.excelOption.column, "excelFile");
|
||||
column.action = `/api/jobslink-api/system/tuser//import-user?isCovered=${this.excelForm.isCovered}`;
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(["userInfo", "permission"]),
|
||||
permissionList() {
|
||||
return {
|
||||
addBtn: this.vaildData(this.permission.user_add, false),
|
||||
viewBtn: this.vaildData(this.permission.user_view, false),
|
||||
delBtn: this.vaildData(this.permission.user_delete, false),
|
||||
editBtn: this.vaildData(this.permission.user_edit, false),
|
||||
};
|
||||
},
|
||||
ids() {
|
||||
let ids = [];
|
||||
this.selectionList.forEach((ele) => {
|
||||
ids.push(ele.id);
|
||||
});
|
||||
return ids.join(",");
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.initData(this.userInfo.tenant_id);
|
||||
|
||||
},
|
||||
methods: {
|
||||
nodeClick(data) {
|
||||
this.treeDeptId = data.id;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
initData(tenantId) {
|
||||
getRoleTree(tenantId).then((res) => {
|
||||
const column = this.findObject(this.option.group, "roleId");
|
||||
column.dicData = res.data.data;
|
||||
});
|
||||
getDeptTree(tenantId).then((res) => {
|
||||
const column = this.findObject(this.option.group, "deptId");
|
||||
column.dicData = res.data.data;
|
||||
});
|
||||
},
|
||||
submitRole() {
|
||||
const roleList = this.$refs.treeRole.getCheckedKeys().join(",");
|
||||
grant(this.ids, roleList).then(() => {
|
||||
this.roleBox = false;
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!",
|
||||
});
|
||||
this.onLoad(this.page);
|
||||
});
|
||||
},
|
||||
rowSave(row, done, loading) {
|
||||
row.password = md5(row.password);
|
||||
add(row).then(
|
||||
() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!",
|
||||
});
|
||||
done();
|
||||
},
|
||||
(error) => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
}
|
||||
);
|
||||
},
|
||||
searchReset1() {
|
||||
this.query = {};
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
rowUpdate(row, index, done, loading) {
|
||||
row.deptId =
|
||||
row.deptId instanceof Array ? row.deptId.join(",") : row.deptId;
|
||||
row.roleId =
|
||||
row.roleId instanceof Array ? row.roleId.join(",") : row.roleId;
|
||||
update(row).then(
|
||||
() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!",
|
||||
});
|
||||
done();
|
||||
},
|
||||
(error) => {
|
||||
window.console.log(error);
|
||||
loading();
|
||||
}
|
||||
);
|
||||
},
|
||||
rowDel(row) {
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
return remove(row.id);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!",
|
||||
});
|
||||
});
|
||||
},
|
||||
searchReset() {
|
||||
this.query = {};
|
||||
this.treeDeptId = "";
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange(params, done) {
|
||||
this.query = params;
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, params);
|
||||
done();
|
||||
},
|
||||
searchRese1t() {
|
||||
this.query = {};
|
||||
this.treeDeptId = "";
|
||||
this.onLoad(this.page);
|
||||
},
|
||||
searchChange1() {
|
||||
this.page.currentPage = 1;
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
selectionChange(list) {
|
||||
this.selectionList = list;
|
||||
},
|
||||
selectionClear() {
|
||||
this.selectionList = [];
|
||||
this.$refs.crud.toggleSelection();
|
||||
},
|
||||
handleDelete() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择数据删除?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
return remove(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.onLoad(this.page);
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!",
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
handleReset() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.$confirm("确定将选择账号密码重置为手机号后六位吗?", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
})
|
||||
.then(() => {
|
||||
return resetPassword(this.ids);
|
||||
})
|
||||
.then(() => {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "操作成功!",
|
||||
});
|
||||
this.$refs.crud.toggleSelection();
|
||||
});
|
||||
},
|
||||
handleGrant() {
|
||||
if (this.selectionList.length === 0) {
|
||||
this.$message.warning("请选择至少一条数据");
|
||||
return;
|
||||
}
|
||||
this.roleTreeObj = [];
|
||||
if (this.selectionList.length === 1) {
|
||||
this.roleTreeObj = this.selectionList[0].roleId.split(",");
|
||||
}
|
||||
getRoleTree().then((res) => {
|
||||
this.roleGrantList = res.data.data;
|
||||
this.roleBox = true;
|
||||
});
|
||||
},
|
||||
handleImport() {
|
||||
this.excelBox = true;
|
||||
},
|
||||
uploadAfter(res, done, loading, column) {
|
||||
window.console.log(column);
|
||||
this.excelBox = false;
|
||||
this.refreshChange();
|
||||
done();
|
||||
},
|
||||
uploadError(error) {
|
||||
if (error) {
|
||||
this.$message.error(error);
|
||||
}
|
||||
},
|
||||
handleExport() {
|
||||
this.$confirm("是否导出用户数据?", "提示", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
const searchForm = this.$refs.crud.searchForm;
|
||||
window.open(
|
||||
`/api/jobslink-api/system/tuser//export-user?Jobslink-Auth=${getToken()}&account=${
|
||||
searchForm.account
|
||||
}&realName=${searchForm.realName}`
|
||||
);
|
||||
});
|
||||
},
|
||||
handleTemplate() {
|
||||
window.open(
|
||||
`/api/jobslink-api/system/tuser//export-template?Jobslink-Auth=${getToken()}`
|
||||
);
|
||||
},
|
||||
beforeOpen(done, type) {
|
||||
if (["edit", "view"].includes(type)) {
|
||||
//预留
|
||||
}
|
||||
done();
|
||||
},
|
||||
currentChange(currentPage) {
|
||||
this.page.currentPage = currentPage;
|
||||
},
|
||||
sizeChange(pageSize) {
|
||||
this.page.pageSize = pageSize;
|
||||
},
|
||||
refreshChange() {
|
||||
this.onLoad(this.page, this.query);
|
||||
},
|
||||
onLoad(page, params = {}) {
|
||||
this.loading = true;
|
||||
getList(
|
||||
page.currentPage,
|
||||
page.pageSize,
|
||||
Object.assign(params, this.query),
|
||||
this.treeDeptId
|
||||
).then((res) => {
|
||||
const data = res.data.data;
|
||||
this.page.total = data.total;
|
||||
this.data = data.records;
|
||||
this.loading = false;
|
||||
this.selectionClear();
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-form-item {
|
||||
margin-bottom: 18px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.searchBtn {
|
||||
display: inline-block;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
</style>
|
||||
|
||||
83
src/views/system/userinfo.vue
Normal file
83
src/views/system/userinfo.vue
Normal file
@@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<div>
|
||||
<basic-container>
|
||||
<avue-tabs :option="option" v-model="form" @change="handleChange" @submit="handleSubmit"></avue-tabs>
|
||||
</basic-container>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import option from "@/const/user/info";
|
||||
import { getUserInfo, updateInfo, updatePassword } from "@/api/system/user";
|
||||
import md5 from 'js-md5'
|
||||
|
||||
|
||||
export default {
|
||||
name: "userinfo",
|
||||
data () {
|
||||
return {
|
||||
type: "info",
|
||||
option: option,
|
||||
form: {}
|
||||
};
|
||||
},
|
||||
created () {
|
||||
this.handleWitch();
|
||||
},
|
||||
methods: {
|
||||
handleSubmit () {
|
||||
if (this.type === "info") {
|
||||
updateInfo(this.form).then(res => {
|
||||
if (res.data.success) {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "修改信息成功!"
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
type: "error",
|
||||
message: res.data.msg
|
||||
});
|
||||
}
|
||||
})
|
||||
} else {
|
||||
updatePassword(md5(this.form.oldPassword), md5(this.form.newPassword), md5(this.form.newPassword1)).then(res => {
|
||||
if (res.data.success) {
|
||||
this.$message({
|
||||
type: "success",
|
||||
message: "修改密码成功!"
|
||||
});
|
||||
} else {
|
||||
this.$message({
|
||||
type: "error",
|
||||
message: res.data.msg
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
handleWitch () {
|
||||
if (this.type === "info") {
|
||||
getUserInfo().then(res => {
|
||||
const user = res.data.data;
|
||||
this.form = {
|
||||
id: user.id,
|
||||
avatar: user.avatar,
|
||||
name: user.name,
|
||||
realName: user.realName,
|
||||
phone: user.phone,
|
||||
email: user.email,
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
handleChange (item) {
|
||||
this.type = item.prop;
|
||||
this.handleWitch();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
Reference in New Issue
Block a user