This commit is contained in:
GGJ
2025-01-09 19:02:44 +08:00
commit 92e7a7a5eb
2943 changed files with 1152283 additions and 0 deletions

View File

@@ -0,0 +1,411 @@
<!--
* @Author: 仲春阳
* @Date: 2023/09/06 09:15:44
* @LastEditors: 仲春阳
* @Description: 定时任务配置
-->
<template>
<Page :loading="false">
<div class="timer">
<div id="select-form">
<el-form :inline="true">
<el-form-item label="任务名称:">
<el-input v-model="store.params.searchValue" placeholder="请输入"></el-input>
</el-form-item>
<el-form-item label="任务状态:">
<el-select v-model="store.params.searchState" placeholder="请选择" clearable>
<el-option label="运行" :value="1"></el-option>
<el-option label="停止" :value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item class="box1">
<el-button type="primary" icon="el-icon-search" @click="store.reload">查询</el-button>
<el-button type="primary" icon="el-icon-search" @click="add">新增定时任务</el-button>
</el-form-item>
</el-form>
</div>
<el-table
stripe
v-if="tableHeight"
:height="tableHeight"
:data="store.data"
highlight-current-row
header-cell-class-name="table_header"
v-loading="store.loading"
style="width: 100%"
border
>
<el-table-column prop="timerName" label="任务名称" width="270"></el-table-column>
<el-table-column prop="actionClass" label="任务执行器" width="480"></el-table-column>
<el-table-column prop="cron" label="定时任务表达式" width="150"></el-table-column>
<el-table-column prop="remark" width="320" label="备注"></el-table-column>
<el-table-column prop="jobStatus" label="状态" width="110">
<template slot-scope="scope">
<div :class="scope.row.jobStatus === 1 ? 'start' : 'stop'" @click="auditTimerStatus(scope.row)">
<i class="el-icon-video-play" v-if="scope.row.jobStatus === 1"></i>
<i class="el-icon-video-pause" v-else></i>
{{ scope.row.jobStatus === 1 ? '运行中' : '未启动' }}
</div>
</template>
</el-table-column>
<el-table-column prop="sort" label="排序" width="90"></el-table-column>
<el-table-column label="操作" min-width="380" fixed="right">
<template slot-scope="scope">
<el-button type="primary" size="small" icon="el-icon-check" @click="runOnce(scope.row)">执行</el-button>
<el-button type="primary" size="small" icon="el-icon-edit" @click="auditTimer(scope.row)">编辑</el-button>
<el-button type="danger" size="small" icon="el-icon-delete" @click="deleteTimer(scope.row)">删除</el-button>
<el-button type="primary" size="small" icon="el-icon-check" @click="dialogRe(scope.row)">补招</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
align="right"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="store.params.pageNum"
:page-sizes="[20, 30, 40, 50, 100]"
:page-size="store.params.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="store.total"
class="mt10"
></el-pagination>
<el-dialog :title="dialogTitle" :visible.sync="dialogVisible" width="30%">
<el-form
ref="form"
class="forms"
:model="form"
label-width="120px"
:rules="rules"
style="padding: 10px 0 20px 0"
>
<el-form-item label="任务名称:" prop="timerName">
<el-input v-model="form.timerName"></el-input>
</el-form-item>
<el-form-item label="任务执行器:" prop="actionClass" style="margin-top: 10px">
<el-select v-model="form.actionClass" placeholder="请选择">
<el-option
v-for="item in actionClassesOptions"
:key="item"
:label="item"
:value="item"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="任务表达式:" prop="cron" style="margin-top: 10px">
<el-input v-model="form.cron"></el-input>
</el-form-item>
<el-form-item label="排序:" prop="sort" style="margin-top: 10px">
<el-input v-model="form.sort"></el-input>
</el-form-item>
<el-form-item label="备注:" style="margin-top: 10px">
<el-input type="textarea" v-model="form.remark"></el-input>
</el-form-item>
<el-form-item></el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="addTimer"> </el-button>
</span>
</el-dialog>
<el-dialog title="选择日期" :visible.sync="dateVisible" width="20%" :before-close="handleClose">
<el-form
ref="formDate"
class="forms"
:model="formDate"
label-width="120px"
style="padding: 10px 0 20px 0"
>
<el-form-item label="执行日期:" prop="date">
<el-date-picker
v-model="formDate.date"
type="date"
value-format = 'yyyy-MM-dd'
placeholder="选择日期">
</el-date-picker>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="okRun"> </el-button>
</span>
</el-dialog>
</div>
</Page>
</template>
<script>
import list from '@/mixins/list'
import request from '@/utils/request'
export default {
mixins: [list],
data() {
return {
form: {
cron: '',
actionClass: '',
timerName: '',
remark: '',
jobStatus: 1,
sort:100,
},
formDate:{
date:''
},
dialogTitle: '新增定时任务',
dialogVisible: false,
actionClassesOptions: [],
dateVisible:false,
rowId:'',
rules: {
actionClass: [{ required: true, message: '请选择任务执行器', trigger: 'change' }],
timerName: [{ required: true, message: '请输入任务名称', trigger: 'blur' }],
cron: [{ required: true, message: '任务表达式', trigger: 'blur' }],
sort: [{ required: true, message: '排序号', trigger: 'blur' }],
date: [{ required: true, message: '日期不可为空', trigger: 'blur' }],
}
}
},
created() {
this.store = this.dataSource('/system-boot/timer/list')
this.store.reload()
this.getActionClasses()
let day = new Date()
day.setDate(day.getDate() - 1)
this.formDate.date = this.$tools.formatDate(day, 'yyyy-MM-dd')
},
methods: {
// 获取所有的action
getActionClasses() {
request({
url: '/system-boot/timer/getActionClasses',
method: 'get'
}).then(res => {
if (res.code === 'A0000') {
this.actionClassesOptions = res.data
}
})
},
dialogRe(row){
this.dateVisible = true
this.rowId = row.id;
},
okRun(){
if(!this.formDate.date || this.formDate.date === ''){
this.$message({
message: '时间不可为空',
type: 'warning'
})
return false;
}
this.$confirm('是否确认执行该定时任务?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request({
url: '/system-boot/timer/run',
method: 'get',
params: {
id: this.rowId,
date:this.formDate.date
}
}).then(res => {
if (res.code === 'A0000') {
this.$message({
message: '操作成功',
type: 'success'
})
}
})
})
},
// 执行一次
runOnce(row) {
this.$confirm('是否确认执行该定时任务?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request({
url: '/system-boot/timer/run',
method: 'get',
params: {
id: row.id
}
}).then(res => {
if (res.code === 'A0000') {
this.$message({
message: '操作成功',
type: 'success'
})
}
})
})
},
add() {
this.dialogTitle = '新增定时任务'
;(this.form = {
cron: '',
actionClass: '',
timerName: '',
remark: '',
jobStatus: 1,
sort:100,
}),
(this.dialogVisible = true)
},
// 修改定时任务状态
auditTimerStatus(row) {
let url = '/system-boot/timer/start'
if (row.jobStatus === 1) {
url = '/system-boot/timer/stop'
}
request({
url,
method: 'get',
params: {
id: row.id
}
}).then(res => {
if (res.code === 'A0000') {
this.$message({
message: res.message,
type: 'success'
})
this.store.search()
}
})
},
// 删除
deleteTimer(row) {
this.$confirm('此操作将永久删除该定时任务, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
request({
url: '/system-boot/timer/delete',
method: 'post',
data: [row.id]
}).then(res => {
if (res.code === 'A0000') {
this.$message({
message: '删除成功',
type: 'success'
})
this.store.search()
}
})
})
},
// 编辑定时器
auditTimer(row) {
this.dialogTitle = '编辑定时任务'
for (const key in this.form) {
this.form[key] = row[key]
}
this.form.id = row.id
this.dialogVisible = true
},
// 新增以及编辑
addTimer() {
this.$refs['form'].validate(valid => {
if (valid) {
let url = '/system-boot/timer/add'
if (this.dialogTitle === '新增定时任务') {
this.form.jobStatus = 1
delete this.form.id
} else {
url = '/system-boot/timer/update'
}
// for (const key in this.form) {
// if (!this.form[key]) {
// this.$message({
// message: '请填写完整',
// type: 'warning'
// })
// flag = false
// }
// }
request({
url,
method: 'post',
data: this.form
}).then(res => {
if (res.code === 'A0000') {
let message = this.dialogTitle === '新增定时任务' ? '新增成功' : '修改成功'
this.$message({
message,
type: 'success'
})
for (const key in this.form) {
this.form[key] = ''
}
this.store.search()
this.dialogVisible = false
}
})
}
})
},
handleClose() {
this.dateVisible = false
let day = new Date()
day.setDate(day.getDate() - 1)
this.formDate.date = this.$tools.formatDate(day, 'yyyy-MM-dd')
},
}
}
</script>
<style lang="scss">
.timer {
.start {
color: #3ca541;
cursor: pointer;
}
.stop {
color: #ee6d6f;
cursor: pointer;
}
}
::v-deep.forms {
.el-form-item {
margin-bottom: 15px !important;
}
}
</style>

View File

@@ -0,0 +1,343 @@
<template>
<div class="pd10">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item label="类型:">
<el-switch v-model="value" active-text="企业部门" inactive-text="行政区域"></el-switch>
</el-form-item>
<el-form-item>
<el-button
v-if="value ? true : false"
@click="AddClick1"
type="primary"
size="mini"
icon="el-icon-plus"
>
新增部门
</el-button>
</el-form-item>
</el-form>
<el-table
stripe
:data="tableData"
:height="tableheight + 'px'"
v-loading="loading"
highlight-current-row
header-cell-class-name="table_header"
row-key="id"
border
lazy
:load="load"
:default-expand-all="false"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column prop="name" :label="value ? '企业部门' : '行政区域'"></el-table-column>
<el-table-column align="center" prop="shortName" label="简称"></el-table-column>
<el-table-column align="center" prop="lng" label="经度"></el-table-column>
<el-table-column align="center" prop="lat" label="纬度"></el-table-column>
<el-table-column align="center" prop="areaCode" label="行政编码" sortable></el-table-column>
<el-table-column v-if="value" align="center" label="操作" min-width="100">
<template slot-scope="scope">
<el-button @click="AddClick(scope.row)" type="primary" size="mini" icon="el-icon-plus">
新增
</el-button>
<el-button @click="EditClick(scope.row)" type="primary" size="mini" icon="el-icon-edit">
修改
</el-button>
<el-button @click="DeleteClick(scope.row)" type="danger" size="mini" icon="el-icon-delete">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!--修改-->
<el-dialog
:close-on-click-modal="false"
:title="RowName + '部门'"
:visible.sync="dialogFormVisible"
width="30%"
:before-close="closeDialog"
>
<el-form :model="formData" ref="form" label-width="110px" :rules="rules">
<el-form-item v-if="flag" label="父级节点:">
<el-input v-model="parentName" placeholder="请输入父级节点"></el-input>
</el-form-item>
<el-form-item label="企业部门:" prop="name" class="top">
<el-input v-model="formData.name" placeholder="请输入企业部门"></el-input>
</el-form-item>
<el-form-item label="简称:" prop="shortName" class="top">
<el-input v-model="formData.shortName" placeholder="请输入简称"></el-input>
</el-form-item>
<el-form-item label="排序:" prop="areaCode" class="top">
<el-input v-model="formData.areaCode" placeholder="请输入排序"></el-input>
</el-form-item>
<el-form-item label="经度:" prop="lng" class="top">
<el-input v-model="formData.lng" placeholder="请输入经度"></el-input>
</el-form-item>
<el-form-item label="纬度:" prop="lat" class="top">
<el-input v-model="formData.lat" placeholder="请输入纬度"></el-input>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submitEvent"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { addtest } from '../../../../api/user'
import { areaTree, areaAdd, areaDelete, update, selectPid } from '../../../../api/admin/area'
import { getTreeData } from '@/components/ELTreeSelect/utils/utils'
export default {
name: 'areaanagement',
data() {
return {
rules: {
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
shortName: [{ required: true, message: '简称不能为空', trigger: 'blur' }],
areaCode: [{ required: true, message: '排序不能为空', trigger: 'blur' }],
lng: [{ required: true, message: '经度不能为空', trigger: 'blur' }],
lat: [{ required: true, message: '纬度不能为空', trigger: 'blur' }]
},
loading: false,
value: false,
flag: true,
length: undefined,
formInline: {},
type: 0,
RowName: '',
dialogFormVisible: false,
tableData: [],
// childrenData:[],
defaultProps: {
children: 'children',
label: 'name'
},
formData: {
type: 0,
id: '',
pid: '',
name: '',
shortName: '',
areaCode: '',
lng: 0,
lat: 0
},
formLabelWidth: '100px',
parentName: '',
length: 0,
flag1: undefined,
row: undefined
}
},
components: {},
watch: {
value(val, newval) {
if (val) {
this.type = 1
this.tableData = []
this.getAreaTree()
} else {
this.type = 0
this.getAreaTree()
}
}
},
created() {},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.getAreaTree()
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.tableheight = window.sessionStorage.getItem('appheight') - 55
},
//外部新增
AddClick1() {
this.flag = true
this.formData = {}
this.RowName = '新增'
this.parentName = '企业'
this.dialogFormVisible = true
this.formData.type = 1
this.formData.pid = '0'
this.flag1 = 'add'
},
//行类新增
AddClick(row) {
this.flag = true
this.formData = {}
this.RowName = row.name + '下新增'
this.parentName = row.name
this.dialogFormVisible = true
this.formData.type = 1
this.formData.pid = row.id
this.formData.id = row.id
this.flag1 = 'add'
},
//行类修改
EditClick(row) {
this.flag = false
this.RowName = row.name + '下修改'
this.dialogFormVisible = true
var data = {
type: 1,
id: row.id,
pid: row.pid,
name: row.name,
shortName: row.shortName,
areaCode: row.areaCode,
lng: row.lng,
lat: row.lat
}
this.formData = data
this.flag1 = 'edit'
this.row = row
},
//删除
DeleteClick(row) {
var p = row.id
var arr = []
arr.push(p)
arr = JSON.stringify(arr)
selectPid(arr).then(response => {
// const {data} =response
//debugger
this.$confirm('确认删除该节点吗?', '提示', {
confirmButtonText: '确认删除',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
areaDelete(arr).then(response => {
if (response.code === 'A0000') {
this.$message.success('删除成功')
this.getAreaTree()
}
})
this.handleQuery()
})
.catch(() => {
// this.$message({
// type: "info",
// message: "已取消删除",
// });
})
})
},
//下拉触发
treeTable(row, expandedRows) {
if (expandedRows) {
// alert(22222)
// var data={id:row.id,type:this.type}
// areaTree(data).then(response=> {
// var childrenData=[]
// childrenData = response.data
// this.tableData.forEach(m=>{
// if(m.id ===row.id){
// m.children = childrenData
// }
// m.children.forEach(n=>{
// if(n.id ===row.id){
// n.children = childrenData
// }
// })
// })
// })
} else {
//alert('触发关闭事件')
}
},
//提交操作
submitEvent() {
this.dialogFormVisible = false
//新增提交
if (this.flag1 == 'add') {
//列表为空时
areaAdd(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('新增成功')
this.getAreaTree()
}
})
}
//修改提交
if (this.flag1 == 'edit') {
update(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('修改成功')
this.tableData = []
this.getAreaTree()
}
})
}
},
//查询一层树表
getAreaTree() {
var data = { id: '', type: this.type }
JSON.stringify(data)
if (this.type == 0) {
areaTree(data).then(response => {
if (response.code == 'A0000') {
response.data.forEach(m => {
delete m.children
m.hasChildren = true
})
// console.log("------------------------");
// console.log(response.data);
// console.log("------------------------");
this.tableData = response.data
}
})
} else {
areaTree(data).then(response => {
if (response.code == 'A0001') {
this.tableData = []
}
if (response.code == 'A0000') {
this.tableData = response.data
}
})
}
},
load(tree, treeNode, resolve) {
// console.log(tree);
var id = tree.id
// console.log(treeNode);
var data = { id: id, type: this.type }
areaTree(data).then(response => {
var childrenData = []
childrenData = response.data
childrenData.forEach(n => {
delete n.children
n.hasChildren = true
})
setTimeout(() => {
resolve(childrenData)
}, 30)
})
},
resetForm() {
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
closeDialog() {
this.resetForm()
this.dialogFormVisible = false
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
::v-deep .el-form-item--small .el-form-item__content,
.el-form-item--small .el-form-item__label {
// height: 32px;
}
</style>

View File

@@ -0,0 +1,245 @@
<template>
<div class="app-container" style="padding: 20px">
<el-row :gutter="40">
<el-col :span="24" :xs="24">
<el-form
ref="queryForm"
:inline="true"
:model="queryParams"
label-width="68px"
size="small"
>
<el-form-item>
<el-button
icon="el-icon-check"
type="primary"
@click="handleAuditSubmit"
>审核用户</el-button
>
</el-form-item>
</el-form>
<el-table
stripe
v-loading="loading"
element-loading-text="数据载入中"
element-loading-spinner="el-icon-loading"
tooltip-effect="dark"
@selection-change="handleSelectionChange"
border
:data="tables"
>
<el-table-column
align="center"
type="selection"
width="40"
prop="userIndex"
></el-table-column>
<el-table-column align="center" label="名称" prop="name" />
<el-table-column align="center" label="登录名" prop="loginName" />
<el-table-column align="center" label="角色" prop="roleNames" />
<el-table-column align="center" label="部门" prop="deptName" />
<el-table-column align="center" label="电话" prop="phone" />
<el-table-column align="center" label="注册时间" prop="registerTime">
<template slot-scope="scope">{{
scope.row.registerTime | formatDate
}}</template>
</el-table-column>
<el-table-column
align="center"
label="类型"
prop="casualUser"
width="100"
>
<template slot-scope="scope">
<span
v-if="scope.row.casualUser === 0"
type="primary"
size="small"
>长期用户</span
>
<span
v-if="scope.row.casualUser === 1"
type="success"
size="small"
>临时用户</span
>
</template>
</el-table-column>
<el-table-column align="center" label="状态" prop="state" width="150">
<template>
<span type="warning" size="small">待审核</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="260">
<template slot-scope="scope">
<el-button
type="primary"
icon="el-icon-check"
size="mini"
@click.stop="handleAudit(scope.row)"
>审核通过</el-button
>
<el-button
type="primary"
size="mini"
@click.stop="handleDelete(scope.row)"
>审核不通过</el-button
>
</template>
</el-table-column>
</el-table>
<el-pagination
style="float: right; margin-top: 10px"
v-show="page.total > 0"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.current"
:page-sizes="[5, 10, 15]"
:page-size="page.size"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total"
>
</el-pagination>
</el-col>
</el-row>
</div>
</template>
<script>
import { listsh, checkUser } from "@/api/admin/user";
import { gongkey } from "@/api/user";
import { sm3Digest } from "@/assets/commjs/sm3";
import { sm2, encrypt } from "@/assets/commjs/sm2.js";
export default {
computed: {
// 实时监听表格
tables: function () {
const search = this.search;
if (search) {
return this.pageList.filter((dataNews) => {
return Object.keys(dataNews).some((key) => {
return String(dataNews[key]).toLowerCase().indexOf(search) > -1;
});
});
}
return this.pageList;
},
},
filters: {
formatDate: function (value) {
//这里的 value 就是需要过滤的数据
var date = new Date(value);
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
return (
year +
"-" +
month +
"-" +
day +
" " +
hours +
":" +
minutes +
":" +
seconds
);
},
},
data() {
return {
// 遮罩层
loading: true,
queryParams: {
type: -1,
state: -1,
},
page: {
current: 1,
size: 15,
total: 0,
},
pageList: [],
multipleSelection: [],
};
},
created() {
this.loadData();
},
mounted() {},
methods: {
loadData() {
this.handleQuery();
},
handleQuery() {
this.queryParams.page = this.page.current;
this.queryParams.limit = this.page.size;
listsh(this.queryParams).then((response) => {
if (response.code === "A0000") {
const { data, total } = response;
this.pageList = data;
this.page.total = total;
this.loading = false;
}
if (response.code === "A0110") {
this.$message.success("暂无用户");
const { data, total } = response;
this.pageList = [];
this.loading = false;
}
});
},
handleSizeChange(val) {
this.page.size = val;
this.handleQuery();
},
handleCurrentChange(val) {
this.page.current = val;
this.handleQuery();
},
handleUnlock(row) {},
handleReset() {},
submint() {},
handleSelectionChange(val) {
this.multipleSelection = val;
// alert(val)
// console.log(val);
},
handleAudit(row) {
// alert('审核')
let arr = [];
let userIndex = row.userIndex;
arr.push(userIndex);
checkUser(arr).then((response) => {
if (response.code === "A0000") {
this.$message({ message: response.message, type: "success" });
}
this.handleQuery();
});
},
handleDelete() {
alert("删除");
},
handleAuditSubmit() {
// alert('批量提交')
var arr = [];
for (var i = 0; i < this.multipleSelection.length; i++) {
arr.push(this.multipleSelection[i].userIndex);
}
checkUser(arr).then((response) => {
if (response.code === "A0000") {
this.$message({ message: response.message, type: "success" });
}
this.handleQuery();
});
},
},
};
</script>
<style >
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,605 @@
<template>
<div>
<el-row>
<el-col :span="4" style="padding: 10px">
<div class="dept-left-input">
<el-input
v-model="keyword"
clearable
placeholder="请输入关键词"
prefix-icon="el-icon-search"
size="small"
/>
</div>
<div style="margin-top: 10px; font-size: 14px">
<el-tree
ref="tree"
:data="treeMenus"
:props="defaultProps"
node-key="id"
highlight-current
:show-checkbox="false"
:expand-on-click-node="true"
:default-expand-all="true"
accordion
:filter-node-method="filterNode"
@node-click="handleNodeClick"
>
</el-tree>
</div>
</el-col>
<el-form
:inline="true"
:model="query"
size="mini"
class="demo-form-inline"
style="float: left; margin-top: 10px"
>
<el-form-item label="筛选数据">
<el-input v-model="query.search"></el-input>
</el-form-item>
<el-form-item>
<!-- <el-button icon="el-icon-search" type="primary" @click="queryData">查询</el-button> -->
<el-button
icon="el-icon-circle-plus-outline"
type="primary"
@click="openAdd"
>新增</el-button
>
</el-form-item>
</el-form>
<el-col :span="20" style="padding: 10px">
<el-table :data="tables" border>
<el-table-column
align="center"
type="index"
label="序号"
width="60"
></el-table-column>
<el-table-column
align="center"
prop="deptsName"
label="名称"
></el-table-column>
<el-table-column
align="center"
prop="parentNodeId"
label="父节点"
></el-table-column>
<el-table-column
align="center"
prop="updateTime"
label="创建时间"
width="180"
>
<template slot-scope="scope">{{
scope.row.updateTime | formatDate
}}</template>
</el-table-column>
<el-table-column
align="center"
prop="area"
label="区域"
></el-table-column>
<el-table-column align="center" prop="customDept" label="部门类型">
<template slot-scope="scope">
<el-tag v-if="scope.row.customDept === 0" type="primary"
>非自定义</el-tag
>
<el-tag v-if="scope.row.customDept === 1" type="success"
>web自定义</el-tag
>
<el-tag v-if="scope.row.customDept === 2" type="warning"
>APP自定义</el-tag
>
</template>
</el-table-column>
<el-table-column
align="center"
prop="deptsDescription"
label="描述"
></el-table-column>
<el-table-column align="center" prop="state" label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.state === 0" type="primary">注销</el-tag>
<el-tag v-if="scope.row.state === 1" type="success">正常</el-tag>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="300">
<template slot-scope="scope">
<el-button
@click="handlePermission(scope.row)"
size="mini"
type="primary"
>绑定监测点</el-button
>
<el-button
type="primary"
@click="handleEditid(scope.row)"
size="mini"
>修改</el-button
>
<el-button
type="danger"
@click="handleDelete(scope.row)"
size="mini"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
</el-col>
<!-- 新增或修改参数配置对话框 -->
<el-dialog
:close-on-click-modal="false"
:title="dialog.title"
:visible.sync="dialog.visible"
width="500px"
>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-col :span="12">
<el-form-item label="部门名称" prop="deptsName">
<el-input
v-model="form.deptsName"
placeholder="请输入昵称"
style="width: 260px"
/>
</el-form-item>
<el-form-item label="父节点" prop="parentNodeId">
<el-select
v-model="form.parentNodeId"
placeholder="请选择父节点"
style="width: 260px"
>
<el-option
v-for="item in father"
:label="item.deptsName"
:value="item.parentNodeId"
:key="item.index"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="区域" prop="area">
<el-select
v-model="form.area"
placeholder="请选择区域"
style="width: 260px"
>
<el-option
v-for="item in city"
:label="item.dicName"
:value="item.area"
:key="item.index"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="部门类型" prop="customDept">
<el-select
v-model="form.customDept"
placeholder="请选择部门类型"
style="width: 260px"
>
<el-option
v-for="item in dept"
:label="item.label"
:value="item.customDept"
:key="item.index"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="部门描述"
prop="deptsDescription"
style="width: 360px"
>
<el-input
type="textarea"
v-model="form.deptsDescription"
placeholder="请输入中文描述"
></el-input>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item style="margin-left: 10%">
<el-button
text-align="center"
type="success"
@click="handleSubmit"
>提交</el-button
>
<el-button
text-align="center"
type="primary"
@click="dialog.visible = false"
> </el-button
>
</el-form-item>
</el-col>
</el-row>
</el-form>
</el-dialog>
<el-pagination
style="float: right; margin-top: 10px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.current"
:page-sizes="[10, 20, 50]"
:page-size="page.size"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total"
>
</el-pagination>
</el-row>
</div>
</template>
<script>
import {
tree,
list,
quyu,
depts,
datalist,
add,
del,
panduan,
updated,
getById,
} from "@/api/admin/dept";
export default {
data() {
return {
/**树结构 */
dialog: {
title: "",
visible: false,
},
treeMenus: [],
queryParams: {},
query: {
search: "",
},
list: [],
form: {},
page: {
size: 10,
current: 1,
total: 0,
},
city: [],
father: [],
dept: [
{ label: "非自定义", customDept: 0 },
{ label: "web自定义", customDept: 1 },
{ label: "app自定义", customDept: 2 },
],
/**树配置选项 */
defaultProps: {
children: "children",
label: "label",
},
/**搜索关键字 */
keyword: "",
rules: {
deptName: [
{ required: true, message: "部门名称不能为空", trigger: "blur" },
],
},
};
},
computed: {
// 实时监听表格
tables: function () {
const search = this.query.search;
if (search) {
return this.list.filter((dataNews) => {
return Object.keys(dataNews).some((key) => {
return String(dataNews[key]).toLowerCase().indexOf(search) > -1;
});
});
}
return this.list;
},
},
filters: {
formatDate: function (value) {
//这里的 value 就是需要过滤的数据
var date = new Date(value);
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
var hours = date.getHours();
var minutes = date.getMinutes();
var seconds = date.getSeconds();
return (
year +
"-" +
month +
"-" +
day +
" " +
hours +
":" +
minutes +
":" +
seconds
);
},
},
watch: {
/**根据名称筛选树 */
keyword(val) {
this.$refs.tree.filter(val);
},
},
created() {
this.treedata();
},
mounted() {
this.queryData();
this.city1();
this.fathered();
},
methods: {
/**筛选节点 */
filterNode(value, data) {
if (!value) return true;
return data.label.indexOf(value) !== -1;
},
/**
* 缩放条拖动进而改变左侧div宽度方法
*/
bindResize() {
/**开始坐标 */
let startX;
/**开始宽度 */
let startWidth = getScalableDivWidth();
document
.querySelector("#drag-dept")
.addEventListener("mousedown", startDrag);
function startDrag(e) {
startX = e.clientX;
startWidth = getScalableDivWidth();
document.documentElement.addEventListener("mousemove", onDrag);
document.documentElement.addEventListener("mouseup", stopDrag);
}
function onDrag(e) {
let newWidth = startWidth + e.clientX - startX;
document.querySelector("#drag-dept-left").style.width = newWidth + "px";
}
function stopDrag() {
document.documentElement.removeEventListener("mousemove", onDrag);
document.documentElement.removeEventListener("mouseup", stopDrag);
}
/**获取宽度 */
function getScalableDivWidth() {
return parseInt(
window.getComputedStyle(document.querySelector("#drag-dept-left"))
.width,
10
);
}
},
/**
* 获取树结构
*/
treedata() {
tree().then((response) => {
if (response.code === "A0000") {
this.treeMenus = response.data;
}
});
},
queryData() {
this.list = {};
this.queryParams.page = this.page.current;
this.queryParams.limit = this.page.size;
list(this.queryParams).then((response) => {
if (response.code === "A0000") {
this.list = response.data;
this.page.total = response.total;
}
});
},
city1() {
quyu().then((response) => {
if (response.code === "A0000") {
var arr = [];
for (var i = 0; i < response.data.length; i++) {
let p = {
area: response.data[i].dicIndex,
dicName: response.data[i].dicName,
};
arr.push(p);
}
this.city = arr;
}
});
},
// fathered(){
// depts().then(response => {
// if(response.code==='A0000'){
// var arr = []
// for(var i=0;i<response.data.length;i++){
// let p = {
// parentNodeId:response.data[i].deptsIndex,
// deptsName:response.data[i].deptsName
// }
// arr.push(p)
// }
// this.father = arr
// }
// })
// },
openAdd() {
this.resetForm();
this.dialog = {
title: "新增部门",
visible: true,
//flag: 0
};
},
handleEditid(row) {
this.resetForm();
this.dialog = {
title: "修改部门",
visible: true,
//flag: 0
};
let data = {
deptsIndex: row.deptsIndex,
};
getById(data).then((response) => {
if (response.code === "A0000") {
console.log(response.data);
this.form = response.data;
}
});
},
handleSubmit: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
const id = this.form.deptsIndex;
if (id !== undefined) {
let p = {
area: this.form.area,
customDept: this.form.customDept,
deptsName: this.form.deptsName,
deptId: this.form.deptsIndex,
deptsDescription: this.form.deptsDescription,
parentNodeId: this.form.parentNodeId,
};
updated(p).then((response) => {
if (response.code === "A0000") {
this.$message.success("修改成功");
this.dialog.visible = false;
this.queryData();
this.treedata();
}
});
} else {
let p = {
area: this.form.area,
customDept: this.form.customDept,
deptsName: this.form.deptsName,
deptsDescription: this.form.deptsDescription,
parentNodeId: this.form.parentNodeId,
};
add(p).then((response) => {
if (response.code === "A0000") {
this.$message.success("添加部门成功");
this.dialog.visible = false;
this.queryData();
this.treedata();
}
});
// this.gkeyadd()
}
}
});
},
// 表单重置
resetForm() {
this.form = {};
if (this.$refs["form"]) {
this.$refs["form"].resetFields();
}
},
records() {},
handleSizeChange(val) {
this.page.size = val;
if (this.queryParams.deptsIndex) {
this.queryDatalist();
} else {
this.queryData();
}
},
handleCurrentChange(val) {
this.page.current = val;
if (this.queryParams.deptsIndex) {
this.queryDatalist();
} else {
this.queryData();
}
},
handleNodeClick(data, node) {
this.queryParams.deptsIndex = data.deptsIndex;
console.log(this.deptsIndex);
this.queryDatalist();
},
queryDatalist() {
this.queryParams.page = this.page.current;
this.queryParams.limit = this.page.size;
datalist(this.queryParams).then((response) => {
if (response.code === "A0000") {
this.list = response.data;
this.page.total = response.total;
}
});
},
// 删除
async handleDelete(row) {
// console.log(row)
// let data={
// 'deptIndex':row.deptsIndex
// }
// let response = null
//response = await panduan(data)
//console.log(response)
//if(response.data===1){
this.$confirm("此操作将永久删除该部门, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
let data = {
deptIndex: row.deptsIndex,
};
del(data).then((response) => {
this.$message({ type: "success", message: "部门删除成功" });
});
this.queryData();
this.treedata();
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除",
});
});
// }
// }else{
// this.$confirm("该部门未绑定了其他资源,此操作将永久删除该部门, 是否继续?", "提示", {
// confirmButtonText: "确定",
// cancelButtonText: "取消",
// type: "warning",
// }).then(() => {
// let data={
// 'deptIndex':row.deptsIndex
// }
// del(data).then(response => {
// this.$message({type: "success",message: "部门删除成功",});
// })
// this.queryData()
// }).catch(() => {
// this.$message({
// type: "info",
// message: "已取消删除",
// });
// });
// }
},
},
};
</script>
<style>
</style>

View File

@@ -0,0 +1,842 @@
<template>
<div class="pd10">
<el-form :inline="true" :model="formInline" class="demo-form-inline">
<el-form-item>
<el-button @click="handleAddClickAddType()" type="primary" icon="el-icon-plus">新增字典类型</el-button>
</el-form-item>
<el-form-item label="过滤筛选:">
<el-input v-model="searchValue" placeholder="请输入名称或编码筛选"></el-input>
</el-form-item>
<el-form-item>
<el-button @click="queryData()" type="primary" icon="el-icon-search">查询</el-button>
</el-form-item>
<el-form-item>
<el-button @click="rest" type="primary" icon="el-icon-setting">重置</el-button>
</el-form-item>
</el-form>
<el-table
stripe
:data="tableData"
@header-click="sort"
v-loading="loading"
header-cell-class-name="table_header"
highlight-current-row
border
:height="vh + 'px'"
>
<el-table-column min-width="60" align="center" sortable prop="sort" label="序号"></el-table-column>
<el-table-column
min-width="150"
align="center"
sortable
prop="name"
:show-overflow-tooltip="true"
label="名称"
column-key="date"
></el-table-column>
<el-table-column min-width="180" align="center" sortable prop="code" label="编码"></el-table-column>
<el-table-column min-width="100" align="center" prop="openLevel" label="开启等级">
<template slot-scope="scope">
<span v-if="scope.row.openLevel === 0" type="primary" size="small">不开启</span>
<span v-if="scope.row.openLevel === 1" type="primary" size="small">开启</span>
</template>
</el-table-column>
<el-table-column min-width="100" align="center" prop="openDescribe" label="开启算法">
<template slot-scope="scope">
<span v-if="scope.row.openDescribe === 0" type="primary" size="small">不开启</span>
<span v-if="scope.row.openDescribe === 1" type="primary" size="small">开启</span>
</template>
</el-table-column>
<el-table-column min-width="100" align="center" prop="state" label="状态">
<template slot-scope="scope">
<span v-if="scope.row.state === 0" type="primary" size="small">删除</span>
<span v-if="scope.row.state === 1" type="primary" size="small">正常</span>
</template>
</el-table-column>
<el-table-column
min-width="150"
align="center"
prop="remark"
label="字典描述"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
min-width="150"
align="center"
prop="createTime"
label="创建时间"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
min-width="150"
align="center"
prop="updateTime"
label="更新时间"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column align="center" label="操作" min-width="280">
<template slot-scope="scope">
<el-button @click="handleClick(scope.row)" type="primary" icon="el-icon-search" size="mini">
字典
</el-button>
<el-button @click="handleEditClick(scope.row)" type="primary" size="mini" icon="el-icon-edit">
编辑
</el-button>
<el-button @click="handleDeleteClick(scope.row)" type="danger" size="mini" icon="el-icon-delete">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
class="mt10"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pageData.pageNum"
:page-sizes="[20, 25, 30, 50]"
:page-size="pageData.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageData.total"
></el-pagination>
<!--字典详情-->
<el-dialog
class="bangdinfg"
:close-on-click-modal="false"
:title="RowName + '详情信息'"
:visible.sync="dialogTableVisible"
style="padding: 0 0 0 0"
width="77%"
>
<el-form :inline="true" :model="formdata" class="demo-form-inline">
<el-form-item>
<el-button type="primary" @click="dataAdd" icon="el-icon-plus">新增</el-button>
</el-form-item>
<el-form-item label="过滤筛选:">
<el-input
style="width: 200px"
v-model="formdata.searchValuedata"
placeholder="请输入名称或编码进行筛选"
></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="querydatashu" icon="el-icon-search">查询</el-button>
</el-form-item>
</el-form>
<el-table
stripe
:data="gridData"
@header-click="sortdata"
v-loading="loading"
highlight-current-row
header-cell-class-name="table_header"
border
:height="vhh + 'px'"
>
<el-table-column
align="center"
sortable
prop="name"
label="名称"
column-key="date"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
align="center"
sortable
prop="code"
label="编码"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column align="center" sortable prop="sort" label="排序"></el-table-column>
<el-table-column align="center" sortable prop="value" label="计算值"></el-table-column>
<el-table-column align="center" v-if="row.openLevel === 1" prop="level" label="事件等级">
<template slot-scope="scope">
<span v-if="scope.row.level === 0" type="primary" size="small">普通</span>
<span v-if="scope.row.level === 1" type="primary" size="small">中等</span>
<span v-if="scope.row.level === 2" type="primary" size="small">严重</span>
</template>
</el-table-column>
<el-table-column
v-if="row.openDescribe == 1"
align="center"
prop="algoDescribe"
label="算法描述"
></el-table-column>
<el-table-column align="center" prop="state" label="状态">
<template slot-scope="scope">
<span v-if="scope.row.state === 0" type="primary" size="small">删除</span>
<span v-if="scope.row.state === 1" type="primary" size="small">正常</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="200">
<template slot-scope="scope">
<el-button @click="EditClick(scope.row)" type="primary" size="mini" icon="el-icon-edit">
修改
</el-button>
<el-button @click="DeleteClick(scope.row)" type="danger" size="mini" icon="el-icon-delete">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
class="mt10"
background
@size-change="handleSizeChangedata"
@current-change="handleCurrentChangedata"
:current-page="pageData1.pageNum"
:page-sizes="[20, 25, 30, 50]"
:page-size="pageData1.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="pageData1.total"
></el-pagination>
</el-dialog>
<!--新增/修改-->
<el-dialog
:close-on-click-modal="false"
:title="RowName"
:visible.sync="dialogFormVisible1"
width="30%"
:before-close="closeDialog"
>
<!-- <el-row :gutter="10"> -->
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<!-- <el-col :span="24"> -->
<el-form-item label="名称:" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="编码:" class="top" prop="code">
<el-input v-model="form.code"></el-input>
</el-form-item>
<el-form-item label="排序:" class="top" prop="sort">
<el-input v-model="form.sort"></el-input>
</el-form-item>
<!-- </el-col> -->
<!-- <el-col :span="12"> -->
<el-form-item label="开启等级:" class="top">
<el-select v-model="form.openLevel" placeholder="选择开启等级" style="width: 100%">
<el-option
v-for="item in OpenLevel"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="开启算法:" class="top">
<el-select v-model="form.openDescribe" placeholder="选择开启算法" style="width: 100%">
<el-option
v-for="item in OpenDescribe"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="字典描述:" class="top">
<el-input v-model="form.remark" type="textarea" :rows="2"></el-input>
</el-form-item>
<!-- </el-col> -->
</el-form>
<!-- </el-row> -->
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submitEvent"> </el-button>
</span>
</el-dialog>
<!--字典数据新增-->
<el-dialog
:close-on-click-modal="false"
:title="dataName"
:visible.sync="dialogFormVisible3"
width="30%"
:before-close="closeDialog"
>
<el-form ref="form2" :model="form1" :rules="rules" label-width="110px">
<el-form-item label="父级类型:" prop="parentName">
<el-input v-model="parentName" disabled></el-input>
</el-form-item>
<el-form-item label="名称:" class="top" prop="name">
<el-input v-model="form1.name"></el-input>
</el-form-item>
<el-form-item label="计算值:" class="top">
<el-input v-model="form1.value"></el-input>
</el-form-item>
<el-form-item class="top" v-if="algoDescribeFalg == 1" label="对应算法:" prop="algoDescribe">
<el-input v-model="form1.algoDescribe" placeholder="请输入数字" :rows="1"></el-input>
</el-form-item>
<el-form-item class="top" label="编码:" prop="code">
<el-input v-model="form1.code"></el-input>
</el-form-item>
<el-form-item label="排序:" prop="sort" class="top">
<el-input v-model="form1.sort"></el-input>
</el-form-item>
<el-form-item v-if="levelFalg == 1" label="事件等级:">
<el-select v-model="form1.level" placeholder="选择开启等级">
<el-option
v-for="item in eventOpenLevel"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submitEvent"> </el-button>
</span>
</el-dialog>
<!--详情修改-->
<el-dialog
:close-on-click-modal="false"
:title="dataName"
:visible.sync="dialogFormVisible2"
width="30%"
:before-close="closeDialog"
>
<el-form ref="form1" :model="formData" :rules="rules">
<el-form-item
label="父级类型:"
prop="parentName"
:label-width="formLabelWidth"
style="margin-bottom: 20px"
>
<el-input v-model="parentName" disabled></el-input>
</el-form-item>
<el-form-item
label="名称:"
class="top"
prop="name"
:label-width="formLabelWidth"
style="margin-bottom: 20px"
>
<el-input v-model="formData.name"></el-input>
</el-form-item>
<el-form-item label="计算值:" class="top" :label-width="formLabelWidth" style="margin-bottom: 20px">
<el-input v-model="formData.value"></el-input>
</el-form-item>
<el-form-item
class="top"
label="对应算法:"
v-if="algoDescribeFalg == 1"
prop="algoDescribe"
:label-width="formLabelWidth"
style="margin-bottom: 20px"
>
<el-input v-model="formData.algoDescribe" placeholder="请输入数字"></el-input>
</el-form-item>
<el-form-item
class="top"
label="编码:"
prop="code"
:label-width="formLabelWidth"
style="margin-bottom: 20px"
>
<el-input v-model="formData.code"></el-input>
</el-form-item>
<el-form-item
label="排序:"
class="top"
prop="sort"
:label-width="formLabelWidth"
style="margin-bottom: 20px"
>
<el-input v-model="formData.sort"></el-input>
</el-form-item>
<el-form-item
class="top"
label="事件等级:"
v-if="levelFalg == 1"
:label-width="formLabelWidth"
style="margin-bottom: 20px"
>
<el-select v-model="formData.level" placeholder="选择开启等级">
<el-option
v-for="item in eventOpenLevel"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="submitEvent"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getheight } from '../../../../assets/commjs/common'
import {
list,
add,
addData,
updateType,
deleteType,
getTypeIdData,
updateData,
deleteData
} from '../../../../api/admin/dict'
import pagination from '../../../components/pagination/index'
export default {
name: 'dictanagement',
data() {
return {
formdata: {
searchValuedata: undefined
},
formInline: {},
vh: null,
algoDescribeFalg: undefined,
levelFalg: '',
dialogTableVisible: false,
dialogFormVisible1: false,
dialogFormVisible2: false,
dialogFormVisible3: false,
loading: true,
rowName: '',
RowName: '',
row: '',
tableheight: undefined,
dataName: '',
parentName: '',
typeId: '',
searchValue: '',
sortBy: '',
orderBy: '',
sortBdata: '',
orderBydata: '',
pageData: {
pageNum: 1,
pageSize: 25,
total: 0
},
pageData1: {
pageNum: 1,
pageSize: 25,
total: 0
},
tableData: [],
gridData: [],
t: undefined,
form: {
openLevel: 0,
openDescribe: 0,
remark: undefined,
name: '',
code: '',
sort: 0
},
form1: {
algoDescribe: undefined,
code: '',
level: 0,
name: '',
value: '',
sort: 0,
typeId: ''
},
formData: {
level: undefined,
algoDescribe: undefined,
name: '',
code: '',
value: '',
sort: undefined,
typeId: undefined
},
OpenLevel: [
{ value: 0, label: '不开启' },
{ value: 1, label: '开启' }
],
OpenDescribe: [
{ value: 0, label: '不开启' },
{ value: 1, label: '开启' }
],
StateOption: [
{ value: 0, label: '删除' },
{ value: 1, label: '正常' }
],
eventOpenLevel: [
{ value: 0, label: '普通' },
{ value: 1, label: '中等' },
{ value: 2, label: '严重' }
],
formLabelWidth: '90px',
rules: {
algoDescribe: [
{ required: false, message: '对应算法不能为空', trigger: 'blur' },
{
pattern: /^\d+$|^\d+[.]?\d+$/,
message: '请您数字对应算法',
trigger: 'blur'
}
],
code: [
{ required: false, message: '对应算法不能为空', trigger: 'blur' },
{
pattern: /^[a-zA-Z_]{1}[a-zA-Z0-9_]{2,25}$/,
message: '请输入英文',
trigger: 'blur'
}
],
parentName: [{ required: true, message: '父级类型不能为空', trigger: 'blur' }],
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
sort: [{ required: true, message: '排序不能为空', trigger: 'blur' }]
}
}
},
components: {},
created() {
this.queryData()
},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 106
this.vhh = window.sessionStorage.getItem('appheight') - 420
},
//重置按钮
rest() {
this.form = {
openLevel: 0,
openDescribe: 0,
remark: undefined,
name: '',
code: '',
sort: 0
}
this.formData = {
level: undefined,
algoDescribe: undefined,
name: '',
code: '',
sort: undefined,
typeId: undefined
}
this.form1 = {
algoDescribe: undefined,
code: '',
level: 0,
name: '',
value: '',
sort: 0,
typeId: ''
}
this.searchValue = ''
},
resetForm() {
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
if (this.$refs['form1']) {
this.$refs['form1'].resetFields()
}
if (this.$refs['form2']) {
this.$refs['form2'].resetFields()
}
},
closeDialog() {
this.resetForm()
this.dialogFormVisible1 = false
this.dialogFormVisible2 = false
this.dialogFormVisible3 = false
},
//点击获取字典类型表头字段等属性
sort(column, event) {
this.orderBy = column.order
this.sortBy = column.property
// console.log(this.orderBy + "=============" + this.sortBy);
this.queryData()
},
//点击获取字典类型表头字段等属性
sortdata(column, event) {
this.orderBydata = column.order
this.sortBydata = column.property
// console.log(this.orderBy + "=============" + this.sortBy);
this.querydatashu()
},
handleSizeChange(val) {
this.pageData.pageSize = val
this.queryData()
},
handleCurrentChange(val) {
this.pageData.pageNum = val
this.queryData()
},
handleSizeChangedata(val) {
this.pageData1.pageSize = val
this.querydatashu()
},
handleCurrentChangedata(val) {
this.pageData1.pageNum = val
this.querydatashu()
},
//新增字典类型
handleAddClickAddType() {
this.form = {
openLevel: 0,
openDescribe: 0,
remark: undefined,
name: '',
code: '',
sort: 100
}
this.RowName = '字典类型新增'
this.dialogFormVisible1 = true
this.t = 'add'
},
//查询字典列表
queryData() {
if (this.searchValue == '') {
var data = {
orderBy: this.orderBy,
pageNum: this.pageData.pageNum,
pageSize: this.pageData.pageSize,
searchBeginTime: '',
searchEndTime: '',
searchState: 0,
searchValue: this.searchValue,
sortBy: this.sortBy
}
} else {
var data = {
orderBy: this.orderBy,
pageNum: 1,
pageSize: this.pageData.pageSize,
searchBeginTime: '',
searchEndTime: '',
searchState: 0,
searchValue: this.searchValue,
sortBy: this.sortBy
}
}
list(data).then(response => {
if (response.code === 'A0000') {
this.tableData = response.data.records
window.sessionStorage.setItem('dicData', JSON.stringify(response.data.records))
this.pageData.total = response.data.total
this.loading = false
}
})
},
//字典类型查看
handleClick(row) {
this.levelFalg = row.openLevel
this.algoDescribeFalg = row.openDescribe
this.row = row
this.typeId = row.id
this.RowName = row.name
this.dialogTableVisible = true
this.typeId = row.id
this.querydatashu()
},
//字典详细数据查询
querydatashu() {
let data = {
orderBy: this.orderBydata,
pageNum: this.pageData1.pageNum,
pageSize: this.pageData1.pageSize,
searchBeginTime: '',
searchEndTime: '',
searchState: 0,
searchValue: this.formdata.searchValuedata,
sortBy: this.sortBydata,
typeId: this.typeId
}
getTypeIdData(data).then(response => {
this.gridData = response.data.records
this.pageData1.total = response.data.total
})
},
//字典数据新增
dataAdd() {
this.dataName = this.row.name + '数据新增'
this.parentName = this.row.name
this.form1.typeId = this.row.id
this.dialogFormVisible3 = true
this.t = 'add'
},
//字典类型修改
handleEditClick(row) {
this.RowName = '字典类型修改'
this.dialogFormVisible1 = true
let editData = {
id: row.id,
openLevel: row.openLevel,
openDescribe: row.openDescribe,
value: row.value,
remark: row.remark,
name: row.name,
code: row.code,
sort: row.sort
}
this.form = editData
this.parentName = this.row.name
this.t = 'edit'
},
//字典类型删除
handleDeleteClick(row) {
var p = row.id
var arrId = []
arrId.push(p)
arrId = JSON.stringify(arrId)
this.$confirm('是否确认删除', '提示', {
confirmButtonText: '确认删除',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
deleteType(arrId).then(response => {
if (response.code == 'A0000') {
this.$message.success('删除成功')
this.queryData()
}
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
//详情修改
EditClick(row) {
// this.typeId=row.id
this.dataName = row.name + '详情修改'
this.dialogFormVisible2 = true
let editData = {
id: row.id,
typeId: this.typeId,
level: row.level,
algoDescribe: row.algoDescribe,
state: row.state,
value: row.value,
name: row.name,
code: row.code,
sort: row.sort
}
this.formData = editData
this.parentName = this.row.name
this.t = 'edit'
},
//详情删除
DeleteClick(row) {
var p = row.id
var arrId = []
arrId.push(p)
arrId = JSON.stringify(arrId)
this.$confirm('是否确认删除', '提示', {
confirmButtonText: '确认删除',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
deleteData(arrId).then(response => {
if (response.code == 'A0000') {
this.$message.success('删除成功')
this.querydatashu()
}
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
//操作提交
submitEvent() {
if (this.t == 'add' && this.dialogFormVisible1) {
add(this.form).then(response => {
if (response.code == 'A0000') {
this.$message.success('新增类型成功')
this.dialogFormVisible1 = false
this.queryData()
this.form = {}
}
})
} else if (this.t == 'add' && this.dialogFormVisible3) {
addData(this.form1).then(response => {
if (response.code == 'A0000') {
this.$message.success('新增数据成功')
this.form1 = {}
this.dialogFormVisible3 = false
this.querydatashu()
}
})
}
if (this.t == 'edit' && this.dialogFormVisible1) {
updateType(this.form).then(response => {
if (response.code == 'A0000') {
this.$message.success('修改成功')
this.form = {}
this.dialogFormVisible1 = false
this.queryData()
}
})
} else if (this.t == 'edit' && this.dialogFormVisible2) {
updateData(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('修改成功')
this.dialogFormVisible2 = false
let data = {
orderBy: '',
pageNum: 1,
pageSize: 25,
searchBeginTime: '',
searchEndTime: '',
searchState: 0,
searchValue: '',
sortBy: '',
typeId: this.typeId
}
getTypeIdData(data).then(response => {
this.gridData = response.data.records
})
}
})
}
}
},
//多选
handleSelectionChange() {}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
::v-deep .el-form-item--small .el-form-item__content,
.el-form-item--small .el-form-item__label {
//height: 32px;
}
::v-deep .el-select {
width: 150px;
}
</style>
<style lang="scss" scoped>
::v-deep .bangdinfg .el-dialog .el-dialog__body {
max-height: 70vh;
padding: 10px !important;
// overflow-y: auto;
}
</style>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,137 @@
<template>
<div class="pd10">
<el-form :inline="true" class="demo-form-inline">
<el-form-item>
<el-button @click="AddClick()" type="primary" icon="el-icon-plus">保存</el-button>
<!-- <el-button @click="info()" type="primary" icon="el-icon-close">取消</el-button> -->
<!-- <el-button @click="unlock()" type="primary" icon="el-icon-user">解锁超级管理员</el-button>-->
</el-form-item>
</el-form>
<div style="width: 500px">
<el-form ref="form" :model="form" label-width="auto" :rules="rules">
<el-divider content-position="left">系统策略</el-divider>
<el-form-item label="最大并发数:" prop="errorsCount">
<el-input-number v-model.number="form.maxUseUser" :min="10" :max="99" style="width: 100%"></el-input-number>
</el-form-item>
<el-divider content-position="left">账号锁定策略</el-divider>
<el-form-item label="密码输入错误次数:" prop="errorsCount">
<el-input-number v-model.number="form.errorsCount" :min="3" :max="20" style="width: 100%"></el-input-number>
</el-form-item>
<el-form-item label="自动解锁(分钟):" prop="releaseTime">
<el-input-number v-model.number="form.releaseTime" :min="5" :max="60" style="width: 100%"></el-input-number>
</el-form-item>
<el-form-item label="会话超时时间(秒):" prop="sessionTime">
<el-input-number v-model.number="form.sessionTime" :min="10" style="width: 100%"></el-input-number>
</el-form-item>
<el-form-item label="token刷新时间(秒):" prop="sessionRefreshTime">
<el-input-number v-model.number="form.sessionRefreshTime" :min="10" style="width: 100%"></el-input-number>
</el-form-item>
<el-divider content-position="left">账号密码复杂度校验</el-divider>
<el-form-item label="密码有效期(月):" prop="passwordExpirationMonth">
<el-input-number
v-model.number="form.passwordExpirationMonth"
:min="1"
:max="6"
style="width: 100%"
></el-input-number>
</el-form-item>
<el-form-item label="账号长时间未登录休眠期(天):" prop="passwordExpirationMonth">
<el-input-number
v-model.number="form.sleepDay"
:min="1"
:max="180"
style="width: 100%"
></el-input-number>
</el-form-item>
<!-- <el-form-item label="">
<el-checkbox v-model="form.mixedCheckFlag" :true-label="1" :false-label="0">
密码符号混合校验
</el-checkbox>
</el-form-item>
<el-form-item label="">
<el-checkbox v-model="form.doubleCheckFlag" :true-label="1" :false-label="0">
密码重复校验
</el-checkbox>
</el-form-item>
<el-form-item label="">
<el-checkbox v-model="form.mixedCaseCheckFlag" :true-label="1" :false-label="0">
密码大小写混合校验
</el-checkbox>
</el-form-item>-->
</el-form>
</div>
</div>
</template>
<script>
import { ruleUpdate, getRule, unlockRoot } from '@/api/admin/user.js'
export default {
name: 'reportingmanagerdd',
components: {},
data() {
return {
form: {
//doubleCheckFlag: 0,
maxUseUser:50,
errorsCount: 0,
//mixedCaseCheckFlag: 1,
//mixedCheckFlag: 0,
passwordExpirationMonth: 0,
sleepDay:90,
releaseTime: 0,
sessionTime: 0,
sessionRefreshTime:0,
},
rules: {
errorsCount: [{ required: true, message: '请填写密码输入错误次数', trigger: 'blur' }],
releaseTime: [{ required: true, message: '请填写自动解锁(分钟)', trigger: 'blur' }],
sessionTime: [{ required: true, message: '请填写会话超时时间', trigger: 'blur' }],
sessionRefreshTime:[{ required: true, message: '请填写会话刷新时间', trigger: 'blur' }],
passwordExpirationMonth: [{ required: true, message: '请填写密码超期天数', trigger: 'blur' }]
}
}
},
created() {},
mounted() {
this.info()
},
methods: {
info() {
getRule().then(res => {
this.form = res.data
})
},
AddClick() {
this.$refs['form'].validate(valid => {
if (valid) {
ruleUpdate(this.form)
.then(res => {
this.form = res.data
})
.then(res => {
this.$message({
message: '保存成功',
type: 'success'
})
this.info()
})
}
})
},
unlock() {
unlockRoot().then(res => {
if(res.code === 'A0000'){
this.$message({
message: '解锁成功',
type: 'success'
})
}
})
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
</style>

View File

@@ -0,0 +1,674 @@
<template>
<div>
<el-card class="box-card" shadow="always" :style="'height:' + vh + 'px'">
<div class="clearfix" slot="header">
<b>
<!-- <svg-icon icon-class="menu"/> -->
菜单列表
</b>
</div>
<!-- 搜索表单 -->
<el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item>
<el-button type="primary" icon="el-icon-plus" @click="menuAdd">新增</el-button>
<el-input v-model="search" placeholder="输入关键字搜索" style="width: 500px" />
</el-form-item>
</el-form>
<!-- 数据表格 -->
<el-table
v-loading="loading"
:data="pageList"
:height="vhh"
row-key="id"
:expand-row-keys="expandRow"
highlight-current-row
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
@row-click="handleRowClick"
header-cell-class-name="table_header"
stripe
border
size="mini"
>
<el-table-column min-width="150" label="菜单名称">
<template slot-scope="scope">
<svg-icon :icon-class="scope.row.icon ? scope.row.icon : 'build'" />
{{ scope.row.title }}
</template>
</el-table-column>
<el-table-column label="操作" min-width="120" align="center">
<template slot-scope="scope">
<!-- v-if="scope.row.parentNode==='0'" -->
<el-button
v-if="scope.row.addflag"
type="primary"
icon="el-icon-plus"
size="mini"
@click.stop="menuHandAdd(scope.row)"
>
新增
</el-button>
<el-button type="primary" size="mini" icon="el-icon-edit" @click.stop="handleEdit(scope.row)">
修改
</el-button>
<el-button
type="danger"
size="mini"
icon="el-icon-delete"
@click.stop="handleDelete(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-dialog
:close-on-click-modal="false"
:title="rowName"
:visible.sync="dialogVisible"
width="30%"
:before-close="closemenu"
>
<el-form ref="form" :model="formData" :rules="rules" label-width="90px">
<el-form-item label="上级菜单:" prop="pid">
<!-- <el-select v-model="formData.pid" placeholder="请选择" style="width:100%">
<el-option
v-for="item in tableData"
:key="item.id"
:label="item.title"
:value="item.id">
</el-option>
</el-select> -->
<el-select style="width: 100%" ref="selectTree" v-model="formData.pid" placeholder="请选择上级菜单">
<el-option :value="formData.pid" :label="treename" style="height: auto">
<el-tree
ref="tree"
:data="categoryOptions"
:default-expand-all="false"
node-key="pid"
empty-text="无匹配数据"
:props="defaultProps1"
highlight-current
@node-click="handleNodeClick"
/>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="菜单名称:" class="top" prop="name">
<el-input v-model="formData.name" placeholder="请输入菜单名称" />
</el-form-item>
<el-form-item label="菜单别名:" class="top" prop="routeName">
<el-input v-model="formData.routeName" placeholder="请输入英文菜单名称" />
</el-form-item>
<el-form-item label="排序:" class="top" prop="sort">
<el-input v-model="formData.sort" placeholder="请输入排序" />
<!-- <el-radio-group v-model="form.state">
<el-radio :label="0">不启用</el-radio>
<el-radio :label="1">启用</el-radio>
</el-radio-group> -->
</el-form-item>
<el-form-item label="资源路径:" class="top" prop="path">
<el-input v-model="formData.path" placeholder="sys/admin/user或sys:user:add" style="width: 100%" />
</el-form-item>
<el-form-item label="菜单图标:" class="top" prop="icon">
<el-popover
placement="bottom-start"
width="500"
trigger="click"
@show="$refs['iconSelect'].reset()"
>
<IconSelect ref="iconSelect" @selected="handleIconSelected" />
<el-input slot="reference" v-model="formData.icon" placeholder="点击选择图标">
<svg-icon
v-if="formData.icon"
slot="prefix"
:icon-class="formData.icon"
class="el-input__icon"
style="height: 40px; width: 16px"
/>
<i v-else slot="prefix" class="el-icon-search el-input__icon" />
</el-input>
</el-popover>
</el-form-item>
<el-form-item label="资源类型:" prop="type">
<el-radio-group v-model="formData.type">
<el-radio :label="0">菜单</el-radio>
<!-- <el-radio :label="1">公共资源</el-radio> -->
<!-- <el-radio :label="2">服务间调用资源</el-radio> -->
</el-radio-group>
</el-form-item>
<el-form-item label="菜单描述:">
<el-input type="textarea" v-model="formData.remark" placeholder="请输入菜单描述" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="handleSubmit" > </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { add, list, update, listmesg, deleteMenu } from '@/api/admin/menu'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
// import TreeSelect from '@riophae/vue-treeselect'
import IconSelect from '@/components/IconSelect'
export default {
name: 'Menu',
components: { IconSelect },
computed: {
pageList: function () {
var searchValue = this.search
if (searchValue) {
// 一般表格的查询
// return this.tableData.filter(function(dataNews){
// return Object.keys(dataNews).some(function(key){
// return String(dataNews[key]).toLowerCase().indexOf(search) > -1
// })
// })
let treeData = this.tableData
let handleTreeData = this.handleTreeData(treeData, searchValue)
this.setExpandRow(handleTreeData)
this.expandRow = this.expandRow.join(',').split(',')
return handleTreeData
}
return this.tableData
}
},
data() {
return {
flag: -1,
categoryOptions: [],
// 树型数据
treename: '根节点',
defaultProps1: {
/** 唯一标识 **/
value: 'id',
/** 标签显示 **/
label: 'title',
/** 子级 **/
children: 'children',
/** 是否禁用 **/
disabled: function (data, node) {
if (data.isLeaf == 1) {
return false
} else {
return true
}
}
},
search: '',
expandRow: [],
vh: null,
vhh: null,
rowhang: undefined,
tableheight: null,
loading: true,
flagb: false,
defaultProps: {
children: 'children',
label: 'title'
},
ids: [],
single: true,
multiple: true,
addScode: false,
queryParams: {
name: undefined,
queryMode: undefined
},
pagination: {
page: 1,
limit: 10,
total: 0
},
tableData: [],
t: undefined,
rowName: '新增菜单',
dialogVisible: false,
parentName: '根节点',
formData: {
id: '',
code: 'menu',
routeName: '',
icon: '',
name: '',
path: '',
pid: '0',
remark: '',
sort: 0,
type: 0
},
rules: {
// parentId: [
// {required: true, message: '请选择顶级菜单', trigger: 'blur'}
// ],
pid: [{ required: true, message: '请选择上级菜单', trigger: 'blur' }],
name: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }],
routeName: [{ required: true, message: '请输入菜单别名', trigger: 'blur' }],
sort: [{ required: true, message: '请输入排序', trigger: 'blur' }],
path: [{ required: true, message: '请输入资源路径', trigger: 'blur' }],
icon: [{ required: true, message: '请选择菜单图标', trigger: 'blur' }],
type: [{ required: true, message: '请选择资源类型', trigger: 'blur' }],
diecable: [{ required: true, message: '请输入菜单名称', trigger: 'blur' }]
},
menuOptions: [],
currentRow: undefined
}
},
created() {
//this.loadMenuOptions()
this.handleQuery()
},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.loadCategoryList()
this.loadDataSet()
this.echoDataSet(this.formData)
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 10
this.vhh = window.sessionStorage.getItem('appheight') - 134
},
handleNodeClick(data, node, nodeData) {
if (this.t == 'edit') {
this.treename = data.title
//this.formData.id= data.pid;
this.formData.pid = data.id
this.formData.code = data.code
} else {
this.treename = data.title
this.formData.id = data.id
this.formData.pid = data.id
this.formData.code = data.code
}
// 选择器执行完成后,使其失去焦点隐藏下拉框的效果
this.$refs.selectTree.blur()
},
// 树形表格过滤
handleTreeData(treeData, searchValue) {
if (!treeData || treeData.length === 0) {
return []
}
const array = []
for (let i = 0; i < treeData.length; i += 1) {
let match = false
for (let pro in treeData[i]) {
if (typeof treeData[i][pro] == 'string') {
match |= treeData[i][pro].includes(searchValue)
if (match) break
}
}
if (this.handleTreeData(treeData[i].children, searchValue).length > 0 || match) {
if (treeData[i].type == 0 && match) {
this.flag = 0
searchValue = ''
array.push({
...treeData[i],
children: this.handleTreeData(treeData[i].children, searchValue)
})
} else if (treeData[i].type == 1 && match) {
if (this.flag == 0) {
this.flag = 1
}
searchValue = ''
array.push({
...treeData[i],
children: this.handleTreeData(treeData[i].children, searchValue)
})
if (this.flag != 1) {
searchValue = this.search
}
} else {
array.push({
...treeData[i],
children: this.handleTreeData(treeData[i].children, searchValue)
})
}
}
}
return array
},
// 将过滤好的树形数据展开
setExpandRow(handleTreeData) {
this.flag = -1
if (handleTreeData.length) {
for (let i of handleTreeData) {
this.expandRow.push(i.id)
if (i.children.length) {
this.setExpandRow(i.children)
}
}
}
},
//查询菜单树
handleQuery() {
this.resetForm()
//this.queryParams.queryMode = 'list'
list().then(response => {
var data = response.data
data.splice(0, 1)
data.forEach(m => {
m.addflag = true
m.children.forEach(n => {
n.addflag = true
n.children.forEach(d => {
d.addflag = false
})
})
})
this.switchDataVersonName(data)
this.tableData = data
var data1 = JSON.stringify(data)
data1 = JSON.parse(data1)
data1.push({
id: '001',
code: 'gen',
routeName: null,
icon: '1台账管理',
title: '根节点',
path: '/',
pid: '0',
remark: '根节点',
sort: 100,
type: 0,
children: []
})
this.categoryOptions = data1
// this.tableData = data
//console.log("++++++++++++++",data)
//console.log(this.pageList);
//this.pagination.total = response.total
this.loading = false
})
},
// 递归过滤
switchDataVersonName(data) {
// column 是表格数据, text是判断是否是含税// 先过滤第一层
let arr = data.filter(item => !item.type == 1) // 得到新的数组,但只是第一层的过滤,需要再次循环然后 判断有children的时候 在调用一次本函数 传入 x.children还有判断条件
arr.forEach(x => x.children && (x.children = this.switchDataVersonName(x.children))) // 最后把新数组 return 出去
return arr
},
handleReset() {
this.pagination = {
page: 1,
limit: 10,
total: 0
}
this.queryParams.name = undefined
this.handleQuery()
this.loadMenuOptions()
},
handleRowClick(row) {
this.rowhang = row
//row.panduan = false
const currentRow = JSON.parse(JSON.stringify(row))
//this.currentRow = currentRow
// this.form = currentRow
// this.title = '修改菜单'
this.$emit('menuClick', row)
},
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length != 1
this.multiple = !selection.length
},
handleStatusChange(row) {
const text = row.status === 1 ? '启用' : '停用'
this.$confirm('确认要"' + text + row.name + '"数据项吗?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(function () {
return patch(row.id, 1, { status: row.status })
})
.then(() => {
this.$message.success(text + '成功')
})
.catch(function () {
row.status = row.status === 1 ? 0 : 1
})
},
chuligen(data, row) {
if (data.length) {
data.forEach(m => {
if (m.id == row.pid) {
this.treename = m.title
// return treename
}
if (m.children.length) {
this.chuligen(m.children, row)
}
})
}
},
chuliadd(data, row) {
if (data.length) {
data.forEach(m => {
if (m.id == row.id) {
this.treename = row.title
//return treename
}
if (m.children.length) {
this.chuliadd(m.children, row)
}
// return
})
}
},
closemenu() {
this.resetForm()
this.dialogVisible = false
},
//新增
menuAdd() {
this.flagb = false
this.dialogVisible = true
this.rowName = '新增菜单'
this.t = 'add'
this.treename = '根节点'
this.formData = {
code: 'gen',
icon: '1台账管理',
name: '',
path: '',
pid: '0',
remark: '',
sort: '100',
type: 0
}
},
//行内新增
menuHandAdd(row) {
this.rowhang = row
this.flagb = false
this.treename = ''
this.formData.pid = ''
this.formData.sort == '100'
this.dialogVisible = true
this.parentName = row.title
this.rowName = row.title + '下新增'
this.t = 'add'
// if(row.pid =='0'){
// this.treename = '根节点'
// }
// this.categoryOptions.forEach((m) => {
// if(m.id == row.id){
// this.treename = row.title
// }
// });
this.chuliadd(this.categoryOptions, row)
this.formData = {
code: 'menu',
icon: row.icon,
name: '',
path: '',
pid: row.id,
remark: '',
sort: '100',
type: 0
}
},
//行类修改
handleEdit(row) {
this.rowhang = row
this.flagb = false
this.treename = ''
this.dialogVisible = true
if (row.pid == '0') {
this.treename = '根节点'
}
this.chuligen(this.categoryOptions, row)
// this.categoryOptions.forEach((m) => {
// if(m.id == row.pid){
// this.treename = m.title
// }
// });
this.parentName = row.title
this.rowName = row.title + '修改'
this.t = 'edit'
this.formData = {
id: row.id,
routeName: row.routeName,
code: row.code,
icon: row.icon,
name: row.title,
path: row.routePath,
pid: row.pid,
remark: row.remark,
sort: row.sort,
type: row.type
}
},
//提交
handleSubmit() {
this.flagb = true
if (this.t == 'add') {
add(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('新增成功')
this.flagb = false
this.handleQuery()
this.dialogVisible = false
} else {
this.flagb = false
}
})
}
if (this.t == 'edit') {
update(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('修改成功')
this.flagb = false
this.handleQuery()
this.dialogVisible = false
} else {
this.flagb = false
}
})
}
},
handleDelete(row) {
this.rowhang = row
const ids = [row.id || this.ids].join(',')
this.$confirm('是否确认删除当前菜单?', '警告', {
confirmButtonText: '删除',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
var p = {
id: row.id
}
deleteMenu(p).then(response => {
if (response.code == 'A0000') {
this.$message.success('删除成功')
this.handleQuery()
}
})
})
.catch(() => this.$message.info('已取消删除'))
},
resetForm() {
this.form = {
// visible: 1,
// parentId: 0,
// icon: undefined,
// sort: 1,
// component: 'Layout',
// routeName: undefined,
// routePath: undefined
}
if (this.$refs.form) {
this.$refs.form.resetFields()
}
},
loadMenuOptions() {
this.menuOptions = []
list().then(response => {
const data = response.data
this.menuOptions.push({ value: 0, label: '根节点' })
// for (var key in data) {
// let menuOption = {
// value:data[key].functionIndex,
// label:data[key].functionName
// }
// this.menuOptions.push(menuOption)
// }
this.$forceUpdate()
})
},
handleIconSelected(name) {
this.formData.icon = name
this.$forceUpdate()
},
handleMenuSelect(node) {
if (node.id == 0) {
this.form.component = 'Layout'
} else {
this.form.component = undefined
}
},
closeDialog() {
this.resetForm()
this.dialogVisible = false
this.dialog = {
title: undefined,
visible: false
}
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../../styles/comStyle.less');
</style>
<style lang="less" scoped>
::v-deep .el-card__body,
.el-main {
padding: 10px;
// background: #abacac;
}
::v-deep .svg-icon {
color: #5a5959;
}
</style>

View File

@@ -0,0 +1,471 @@
<template>
<div>
<el-card class="box-card" shadow="always" :style="'height:' + vh + 'px'">
<div class="clearfix" slot="header">
<b>
<!-- <svg-icon icon-class="route"/> -->
{{ menuName }}权限列表
</b>
</div>
<!-- 搜索表单 -->
<el-form ref="queryForm" :model="queryParams" :inline="true">
<el-form-item>
<el-button type="primary" :disabled="disabled" icon="el-icon-plus" @click="bottonAdd">
新增
</el-button>
</el-form-item>
<el-form-item>
<el-input v-model="input" placeholder="请输入关键字搜索" style="width: 500px"></el-input>
</el-form-item>
</el-form>
<!-- 数据表格 -->
<el-table
stripe
ref="table"
:data="pageList"
:height="vhh"
v-loading="loading"
row-key="id"
:expand-row-keys="expandRow"
highlight-current-row
header-cell-class-name="table_header"
@selection-change="handleSelectionChange"
border
size="mini"
>
<!-- <el-table-column type="selection" width="40" align="center"/> -->
<el-table-column
label="普通接口/接口名称"
:show-overflow-tooltip="true"
min-width="150"
prop="name"
width="280"
/>
<el-table-column
label="接口类型"
align="center"
:show-overflow-tooltip="true"
min-width="60"
prop="type"
>
<template slot-scope="scope">
<el-tag type="primary" style="background: blue; color: aliceblue" v-if="scope.row.type == 4">
tabs标签页
</el-tag>
<el-tag type="primary" v-if="scope.row.type == 1">普通接口</el-tag>
<el-tag style="background: forestgreen; color: aliceblue" v-if="scope.row.type == 2">
公共接口
</el-tag>
</template>
</el-table-column>
<el-table-column
label="URL接口路径"
align="center"
:show-overflow-tooltip="true"
min-width="220"
prop="path"
></el-table-column>
<!-- <el-table-column label="按钮权限标识" prop="btnPerm" width="150"/> -->
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button type="primary" size="mini" @click="handleEdit(scope.row)" icon="el-icon-edit">
修改
</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="handleDelete(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- <pagination
v-show="pagination.total>0"
:total="pagination.total"
:page.sync="pagination.page"
:limit.sync="pagination.limit"
@pagination="handleQuery"
/> -->
<el-dialog
:close-on-click-modal="false"
:title="rowName"
:visible.sync="dialogVisible"
width="30%"
:before-close="closeDialog"
>
<el-form ref="form" :model="formData" label-width="120px" :rules="rules">
<el-form-item label="接口/按钮名称:" prop="name">
<el-input v-model="formData.name" placeholder="请输入接口名称" />
</el-form-item>
<el-form-item label="接口/按钮标识:" class="top" prop="code">
<el-input v-model="formData.code" placeholder="请输入英文接口标识" />
</el-form-item>
<!-- <el-form-item label="状态">
<el-radio-group v-model="form.state">
<el-radio :label="0">不启用</el-radio>
<el-radio :label="1">启用</el-radio>
</el-radio-group>
</el-form-item> -->
<el-form-item label="接口路径:" class="top" prop="path">
<el-input
v-model="formData.path"
placeholder="sys/admin/user或sys:user:add"
style="width: 100%"
/>
</el-form-item>
<!-- <el-form-item label="接口图标:" prop="icon" style="margin-top:20px">
<el-popover
placement="bottom-start"
width="460"
trigger="click"
@show="$refs['iconSelect'].reset()"
>
<IconSelect ref="iconSelect" @selected="handleIconSelected" />
<el-input
slot="reference"
v-model="formData.icon"
placeholder="点击选择图标"
>
<svg-icon
v-if="formData.icon"
slot="prefix"
:icon-class="formData.icon"
class="el-input__icon"
style="height: 40px; width: 16px"
/>
<i v-else slot="prefix" class="el-icon-search el-input__icon" />
</el-input>
</el-popover>
</el-form-item> -->
<el-form-item label="排列序号:" prop="sort" class="top">
<el-input v-model="formData.sort" placeholder="请输入按钮排序" />
</el-form-item>
<el-form-item label="接口类型:" prop="type" class="top">
<el-radio-group v-model="formData.type">
<el-radio :label="1">普通接口</el-radio>
<el-radio :label="2">公用接口</el-radio>
<!-- <el-radio :label="3">服务间调用接口</el-radio> -->
<!-- <el-radio :label="4">tabs标签页</el-radio> -->
</el-radio-group>
</el-form-item>
<el-form-item label="接口/按钮描述:" prop="roleDescription">
<el-input type="textarea" v-model="formData.remark" placeholder="请输入接口描述" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<!-- <el-button type="primary" @click="handleSubmit" :disabled="flagb"
> </el-button
> -->
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="handleSubmit"> </el-button>
</div>
</el-dialog>
</el-card>
</div>
</template>
<script>
import { buttonlist } from '@/api/admin/permission'
import { add, update, deleteMenu } from '@/api/admin/menu'
import IconSelect from '@/components/IconSelect'
import request from '@/utils/request'
export default {
name: 'permission',
components: { IconSelect },
computed: {
pageList: function () {
var searchValue = this.input
if (searchValue) {
// 一般表格的查询
// return this.tableData.filter(function(dataNews){
// return Object.keys(dataNews).some(function(key){
// return String(dataNews[key]).toLowerCase().indexOf(search) > -1
// })
// })
let treeData = this.tableData
let handleTreeData = this.handleTreeData(treeData, searchValue)
this.setExpandRow(handleTreeData)
this.expandRow = this.expandRow.join(',').split(',')
return handleTreeData
}
return this.tableData
}
},
data() {
return {
expandRow: [],
vh: null,
vhh: null,
loading: false,
flagb: false,
ids: [],
single: true,
multiple: true,
queryParams: {
queryMode: 'page',
name: undefined,
menuId: undefined,
type: undefined
},
pagination: {
page: 1,
limit: 10,
total: 0
},
tableData: [],
rowName: '修改接口/按钮',
dialogVisible: false,
formData: {
code: '',
icon: '',
name: '',
path: '',
pid: undefined,
remark: '',
sort: 0,
type: 1
},
disabled: true,
t: undefined,
menu: {},
menuName: undefined,
urlPerm: {
requestMethod: undefined,
serviceName: undefined,
requestPath: undefined
},
microServiceList: [],
requestMethodList: [],
rules: {
code: [
{ required: true, message: '标识不能为空', trigger: 'blur' },
{
pattern: /^[a-zA-Z_]{1}[a-zA-Z0-9_]{2,15}$/,
message: '请输入至少3-20位英文',
min: 3,
max: 20,
trigger: 'blur'
}
],
name: [{ required: true, message: '请输入接口名称', trigger: 'blur' }],
sort: [{ required: true, message: '请输入排序', trigger: 'blur' }],
path: [{ required: true, message: '请输入接口路径', trigger: 'blur' }],
icon: [{ required: true, message: '请选择菜单图标', trigger: 'blur' }],
type: [{ required: true, message: '请选择接口类型', trigger: 'blur' }]
},
input: ''
}
},
created() {},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 10
this.vhh = window.sessionStorage.getItem('appheight') - 134
},
// 树形表格过滤
handleTreeData(treeData, searchValue) {
if (!treeData || treeData.length === 0) {
return []
}
const array = []
for (let i = 0; i < treeData.length; i += 1) {
let match = false
for (let pro in treeData[i]) {
if (typeof treeData[i][pro] == 'string') {
match |= treeData[i][pro].includes(searchValue)
if (match) break
}
}
if (this.handleTreeData(treeData[i].children, searchValue).length > 0 || match) {
array.push({
...treeData[i],
children: this.handleTreeData(treeData[i].children, searchValue)
})
}
}
return array
},
// 将过滤好的树形数据展开
setExpandRow(handleTreeData) {
if (handleTreeData.length) {
for (let i of handleTreeData) {
this.expandRow.push(i.id)
if (i.children.length) {
this.setExpandRow(i.children)
}
}
}
},
handleQuery() {
this.queryParams.id = this.menu.id
buttonlist(this.queryParams).then(response => {
this.tableData = response.data
//this.pagination.total = response.total
this.loading = false
})
},
handleReset() {
this.pagination = {
page: 1,
limit: 10,
total: 0
}
this.queryParams.name = undefined
this.handleQuery()
},
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length != 1
this.multiple = !selection.length
},
bottonAdd() {
this.rowName = '接口/按钮新增'
this.dialogVisible = true
this.t = 'add'
this.formData.code = ''
this.formData.icon = ''
this.formData.name = ''
this.formData.path = ''
this.formData.remark = ''
this.formData.sort = ''
this.formData.type = 1
// code:'',
// icon:'',
// name:'',
// path:'',
// pid:undefined,
// remark:'',
// sort:0,
// type:0
// }
},
loadMicroServices() {
this.listDictItemByCode('micro_service').then(response => {
this.microServiceList = response.data
})
},
handleIconSelected(name) {
this.formData.icon = name
this.$forceUpdate()
},
loadRequestMethods() {
this.listDictItemByCode('request_method').then(response => {
this.requestMethodList = response.data
})
},
handleEdit(row) {
this.resetForm()
this.t = 'edit'
this.dialogVisible = true
this.rowName = row.name + '接口/按钮修改'
this.formData = {
id: row.id,
code: row.code,
icon: row.icon,
name: row.name,
path: row.path,
pid: row.pid,
remark: row.remark,
sort: row.sort,
type: row.type
}
},
handleSubmit() {
this.flagb = true
if (this.t == 'add') {
add(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('新增成功')
this.flagb = false
this.handleQuery()
this.dialogVisible = false
}
})
}
if (this.t == 'edit') {
update(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('修改成功')
this.handleQuery()
this.dialogVisible = false
}
})
}
},
handleDelete(row) {
// const ids = [row.id || this.ids].join(',')
this.$confirm('是否确认删除当前按钮?', '警告', {
confirmButtonText: '删除',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
var p = {
id: row.id
}
deleteMenu(p).then(response => {
if (response.code == 'A0000') {
this.$message.success('删除成功')
this.handleQuery()
}
})
})
.catch(() => this.$message.info('已取消删除'))
},
closeDialog() {
this.resetForm()
this.dialogVisible = false
this.dialog = {
title: undefined,
visible: false
}
},
resetForm() {
this.form = {
// menuId: this.menu.functionIndex,
}
this.urlPerm = {}
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
menuClick(row) {
this.disabled = false
this.menu = row
//console.log(row);
this.menuName = '【' + this.menu.title + '】'
this.formData.pid = this.menu.id
//console.log(this.formData.pid);
this.handleQuery()
},
resetPermission() {
this.disabled = true
this.pageList = []
this.queryParams.menuId = undefined
this.menu = {}
this.menuName = undefined
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../../styles/comStyle.less');
</style>
<style lang="less" scoped>
::v-deep .el-card__body,
.el-main {
padding: 10px;
//background: #abacac;
}
</style>

View File

@@ -0,0 +1,42 @@
<template>
<div class="pd10" >
<el-row :gutter="10">
<el-col :span="10" :xs="24">
<menus @menuClick="menuClick" @resetPermission="resetPermission"></menus>
</el-col>
<el-col :span="14" :xs="24">
<permission ref="permission"></permission>
</el-col>
</el-row>
</div>
</template>
<script>
import Menus from './components/Menu'
import Permission from './components/Permission'
export default {
name: "menumanagement",
components: {Menus, Permission},
data() {
return {
}
},
methods: {
menuClick(row) {
this.$refs.permission.menuClick(row)
},
resetPermission() {
this.menuName = undefined
this.$refs.permission.resetPermission()
}
}
}
</script>
<style lang="less" scoped>
@import url("../../../../styles/comStyle.less");
</style>

View File

@@ -0,0 +1,741 @@
<template>
<div class="pd10">
<el-table
stripe
:data="tableData"
border
row-key="id"
highlight-current-row
header-cell-class-name="table_header"
:height="tableheight + 'px'"
style="width: 100%"
:default-expand-all="true"
:tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
>
<el-table-column prop="name" label="功能组件名称" :show-overflow-tooltip="true"></el-table-column>
<!-- <el-table-column align="center" prop="name" label="功能组件名称"></el-table-column> -->
<el-table-column align="center" prop="code" label="组件标识"></el-table-column>
<el-table-column align="center" prop="functionGroup" :formatter="gName" label="组件子功能">
<template slot-scope="scope">
<span
v-if="
scope.row.functionGroup[0] === 0 ||
scope.row.functionGroup[1] === 0 ||
scope.row.functionGroup[2] === 0
"
type="primary"
size="small"
>
切换组件功能
</span>
<span
v-if="
scope.row.functionGroup[0] === 1 ||
scope.row.functionGroup[1] === 1 ||
scope.row.functionGroup[2] === 1
"
type="primary"
size="small"
>
进入该功能
</span>
<span
v-if="
scope.row.functionGroup[0] === 2 ||
scope.row.functionGroup[1] === 2 ||
scope.row.functionGroup[2] === 2
"
type="primary"
size="small"
>
最大化
</span>
<span v-if="scope.row.functionGroup == null" type="primary" size="small">/</span>
</template>
</el-table-column>
<el-table-column
align="center"
prop="path"
label="组件路径"
:show-overflow-tooltip="true"
></el-table-column>
<!-- <el-table-column align="center" prop="state" label="组件状态">
<template slot-scope="scope">
<span v-if="scope.row.state === 0" type="delete" size="small"
>删除</span
>
<span v-if="scope.row.state === 1" type="success" size="small"
>正常</span
>
<span v-if="scope.row.state === null" type="primary" size="small"
>/</span
>
</template>
</el-table-column> -->
<!-- <el-table-column
align="center"
prop="sort"
label="排序"
></el-table-column> -->
<el-table-column align="center" label="操作" width="220">
<template slot-scope="scope">
<el-button
v-if="scope.row.state == 0"
@click="AddClick(scope.row)"
type="primary"
size="mini"
icon="el-icon-plus"
>
新增
</el-button>
<el-button @click="EditClick(scope.row)" type="primary" size="mini" icon="el-icon-edit">
修改
</el-button>
<el-button
v-if="scope.row.state == 1"
@click="DeleteClick(scope.row)"
type="danger"
size="mini"
icon="el-icon-delete"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- <pagination :pageData="pageData" @changePageNum="changePageNum" @changePageSize="changePageSize"></pagination> -->
<!--新增-->
<el-dialog
:close-on-click-modal="false"
:title="RowName"
:visible.sync="dialogFormVisible"
width="30%"
:before-close="closedf"
>
<el-row :gutter="10">
<el-form :model="formData" ref="form" :rules="rules" label-width="100px">
<el-col :span="24">
<el-form-item label="组件菜单选取:" prop="title" :label-width="formLabelWidth">
<el-select
ref="selectTree1"
v-model="form.title"
placeholder="请选择所属组件路径"
style="width: 100%"
>
<el-option :value="menuPathId" style="height: auto">
<el-tree
ref="tree"
:data="pathOptions"
node-key="id"
accordion
:default-expanded-keys="idArr2"
:props="defaultProps4"
@node-click="handNodeClick1"
>
<span class="span-ellipsis" slot-scope="{ node, data }">
<span :title="data.title">{{ data.title }}</span>
</span>
</el-tree>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="系统类型:"
prop="systemType"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-select
v-model="formData.systemType"
placeholder="选择系统类型"
@change="getchild"
class="options"
style="width: 100%"
>
<el-option
v-for="item in SystemTypeoption"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="父组件节点:"
prop="pid"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-select
v-model="formData.pid"
placeholder="选择父组件节点"
class="options"
style="width: 100%"
>
<el-option
v-for="item in pidOption"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="组件名称:"
prop="name"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-input v-model="formData.name" placeholder="请输组件名称"></el-input>
</el-form-item>
<el-form-item
label="组件标识"
prop="code"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-input v-model="formData.code" placeholder="请输入组件标识"></el-input>
</el-form-item>
<el-form-item
label="组件路径:"
prop="path"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-input v-model="formData.path" placeholder="请输入组件排序"></el-input>
</el-form-item>
<el-form-item
label="组件排序:"
prop="sort"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-input v-model="formData.sort" placeholder="请输入组件排序"></el-input>
</el-form-item>
<el-form-item
label="组件子功能:"
prop="functionGroup"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-select
multiple
collapse-tags
v-model="formData.functionGroup"
placeholder="选择子组件功能"
style="width: 100%"
>
<el-option
v-for="item in functionGroupOption"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="closedf">取 消</el-button>
<el-button type="primary" @click="submitEvent">确 定</el-button>
</span>
</el-dialog>
<!--修改-->
<el-dialog
:close-on-click-modal="false"
:title="RowName"
:visible.sync="dialogFormVisible1"
:before-close="closedf"
width="30%"
>
<el-row :gutter="10">
<el-form :model="editData" ref="form2" :rules="rules" label-width="100px">
<el-col :span="24">
<el-form-item label="菜单路径选取:" prop="title" :label-width="formLabelWidth">
<el-select
ref="selectTree"
v-model="editData.title"
placeholder="请选择所属组件路径"
style="width: 100%"
>
<el-option
:value="editData.functionId"
:label="editData.title"
style="height: auto"
class="options"
>
<el-tree
ref="tree"
:data="pathOptions"
node-key="id"
accordion
:default-expanded-keys="idArr2"
:props="defaultProps4"
@node-click="handNodeClick2"
>
<span slot-scope="{ node, data }">
<i
:class="[data.color != null ? 'ification_col' : '']"
:style="{ 'background-color': data.color }"
></i>
&nbsp;&nbsp;{{ data.title }}
</span>
</el-tree>
</el-option>
</el-select>
</el-form-item>
<el-form-item
label="系统类型:"
prop="systemType"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-select
v-model="editData.systemType"
placeholder="选择系统类型"
@change="getchilde"
class="options"
style="width: 100%"
>
<el-option
v-for="item in SystemTypeoption"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="父组件节点:"
prop="pid"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-select v-model="editData.pid" placeholder="选择父组件节点" style="width: 100%">
<el-option
v-for="item in pidOption"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="组件名称:"
prop="name"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-input v-model="editData.name" placeholder="请输组件名称"></el-input>
</el-form-item>
<el-form-item
label="组件标识"
prop="code"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-input v-model="editData.code" placeholder="请输入组件标识"></el-input>
</el-form-item>
<el-form-item
label="组件路径:"
prop="path"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-input v-model="editData.path" placeholder="请输入组件排序"></el-input>
</el-form-item>
<el-form-item
label="组件排序:"
prop="sort"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-input v-model="editData.sort" placeholder="请输入组件排序"></el-input>
</el-form-item>
<el-form-item
label="组件子功能:"
prop="functionGroup"
style="margin-top: 20px"
:label-width="formLabelWidth"
>
<el-select
multiple
collapse-tags
v-model="editData.functionGroup"
placeholder="选择子组件功能"
style="width: 100%"
>
<el-option
v-for="item in functionGroupOption"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-form>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="closedf">取 消</el-button>
<el-button type="primary" @click="submitEvent">确 定</el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getheight } from '../../../../assets/commjs/common'
import { componentlists, componentAdd, componentEdit, componentDel } from '../../../../api/admin/user'
import { list, baseData } from '../../../../api/admin/menu'
import { dicData } from '@/assets/commjs/dictypeData'
import pagination from '../../../components/pagination/index'
//import treeSelect from '@riophae/vue-treeselect'
//import '@riophae/vue-treeselect/dist/vue-treeselect.css'
export default {
name: 'componentmanage',
components: {
pagination
// treeSelect
},
data() {
return {
form: {
title: ''
},
defaultProps4: {
children: 'children',
label: 'title'
},
SystemTypeoption: [],
idArr2: [],
pathOptions: [],
menuPathId: undefined,
tableheight: undefined,
dialogFormVisible: false,
dialogFormVisible1: false,
formLabelWidth: '120px',
treeData: [],
treeData1: [],
defaultProps1: {
children: 'children',
label: 'label'
},
RowName: '',
pidOption: [],
functionGroupOption: [
{ value: 0, label: '切换组件功能' },
{ value: 1, label: '进入该功能' },
{ value: 2, label: '放大' }
],
formData: {
systemType: '',
code: '',
functionId: '',
pid: null,
name: '',
path: '',
code: '',
id: null,
sort: 0,
functionGroup: [0, 1]
},
group: undefined,
editData: {
systemType: '',
pid: null,
name: '',
code: '',
path: '',
id: null,
sort: 0,
title: '',
functionId: '',
functionGroup: []
},
pageData: {
pageNum: 3,
pageSize: 15,
total: 100
},
tableData: [],
defaultProps: {
children: 'children',
label: 'parentName'
},
t: undefined,
rules: {
title: [{ required: true, message: '请选择组件菜单', trigger: 'blur' }],
systemType: [{ required: true, message: '请选择系统类型', trigger: 'blur' }],
pid: [{ required: true, message: '请选择父组件节点', trigger: 'blur' }],
name: [{ required: true, message: '请输入组件名称', trigger: 'blur' }],
code: [{ required: true, message: '请输入组件标识', trigger: 'blur' }],
path: [{ required: true, message: '请选择组件路径', trigger: 'blur' }],
sort: [{ required: true, message: '请输入组件排序', trigger: 'blur' }],
functionGroup: [{ required: true, message: '请选择子功能', trigger: 'blur' }]
}
}
},
created() {},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.getSystemType()
this.queryData()
this.getTreeData()
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.tableheight = window.sessionStorage.getItem('appheight') - 10
},
closedf() {
this.dialogFormVisible = false
this.dialogFormVisible1 = false
this.resetForm()
},
resetForm() {
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
if (this.$refs['form2']) {
this.editData = {}
this.$refs['form2'].resetFields()
}
},
handNodeClick1(data, node) {
//console.log(data,node,'++++++++++++++++++++++++++++++++++=')
this.menuPathId = data.id
this.form.title = data.title
this.form.id = data.id
this.formData.functionId = data.id
this.formData.path = data.routePath
this.$refs.selectTree1.blur()
},
handNodeClick2(data, node) {
//console.log(data,node,'++++++++++++++++++++++++++++++++++=')
//this.menuPathId = data.id;
this.editData.title = data.title
this.form.id = data.id
this.editData.functionId = data.id
this.formData.path = data.routePath
this.editData.path = data.routePath
this.$refs.selectTree.blur()
},
gName(row, column) {
if (row.functionGroup !== null) {
var gNamelist = []
for (var i = 0; i < row.functionGroup.length; i++) {
gNamelist.push(row.functionGroup[i])
}
return gNamelist.join(',')
} else {
gNamelist = []
return gNamelist
}
},
//获取组件列表
queryData() {
componentlists().then(response => {
if (response.code == 'A0000') {
response.data.forEach(m => {
m.state = 0
m.code = ''
m.functionGroup = []
m.functionId = '23'
m.path = ''
m.pid = 0
m.sort = ''
m.systemType = 0
m.children.forEach(n => {
n.state = 0
n.children.forEach(d => {
d.state = 1
})
})
})
this.tableData = response.data
}
})
},
getchild() {
this.getbaseData()
},
getchilde() {
this.getbaseData1()
},
//获取功能分类
getbaseData() {
let data = {
systemType: this.formData.systemType
}
baseData(data).then(response => {
if (response.code == 'A0000') {
this.pidOption = response.data
}
})
},
//获取功能分类
getbaseData1() {
let data = {
systemType: this.editData.systemType
}
baseData(data).then(response => {
if (response.code == 'A0000') {
this.pidOption = response.data
}
})
},
//获取树菜单
getTreeData() {
list().then(response => {
if (response.code == 'A0000') {
var data = response.data
data.forEach(m => {
m.children.forEach(n => {
n.children.forEach(d => {
delete d.children
})
})
})
this.switchDataVersonName(data)
this.pathOptions = data
}
})
},
// 递归过滤
switchDataVersonName(data) {
// column 是表格数据, text是判断是否是含税// 先过滤第一层
let arr = data.filter(item => !item.type == 1) // 得到新的数组,但只是第一层的过滤,需要再次循环然后 判断有children的时候 在调用一次本函数 传入 x.children还有判断条件
arr.forEach(x => x.children && (x.children = this.switchDataVersonName(x.children))) // 最后把新数组 return 出去
return arr
},
changePageNum(data) {
this.pageData.pageNum = data
// alert("父组件当前页" + this.pageData.pageNum);
},
changePageSize(data) {
this.pageData.pageSize = data
// alert("父组件当前条数" + this.pageData.pageSize);
},
//新增
AddClick(row) {
this.getTreeData()
this.form.title = ''
this.RowName = row.name + '组件新增'
this.dialogFormVisible = true
this.t = 'add'
this.formData.functionId = this.form.id
// this.formData.pid=row.id
},
//修改
EditClick(row) {
this.dialogFormVisible1 = true
this.t = 'edit'
this.RowName = row.name + '组件修改'
this.menuPathId = row.functionId
this.editData = {
systemType: row.systemType,
pid: row.pid,
name: row.name,
code: row.code,
path: row.path,
id: row.id,
sort: row.sort,
functionId: row.functionId,
functionGroup: row.functionGroup
}
this.sysbase(row.systemType)
this.seachTreeDta(this.pathOptions, row)
},
seachTreeDta(data, row) {
//console.log("++++++++++++++++++++++=",data,row.path)
if (data.length) {
data.forEach(item => {
// console.log("++++++++++++++++++++++=",item.routePath,row.path)
if (item.routePath === row.path) {
this.editData.title = item.title
}
if (item.children) {
this.seachTreeDta(item.children, row)
}
})
}
},
//删除
DeleteClick(row) {
this.$confirm('请确认删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
var data = {
id: row.id
}
componentDel(data).then(response => {
if (response.code == 'A0000') {
this.$message.success('删除成功')
this.queryData()
}
})
})
.catch(() => {})
//alert('删除'+row.id)
},
//提交
submitEvent() {
if (this.t == 'add') {
// this.formData.functionGroup=this.group
componentAdd(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('新增成功')
this.dialogFormVisible = false
this.queryData()
}
})
}
if (this.t == 'edit') {
componentEdit(this.editData).then(response => {
if (response.code == 'A0000') {
this.$message.success('修改成功')
this.dialogFormVisible1 = false
this.queryData()
}
})
}
},
//字典获取数据干扰源类型
getSystemType() {
//debugger
var code = 'System_Type'
this.SystemTypeoption = dicData(code, [])
this.formData.systemType = this.SystemTypeoption
},
sysbase(systemType) {
let data = {
systemType: systemType
}
baseData(data).then(response => {
if (response.code == 'A0000') {
this.pidOption = response.data
}
})
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
::v-deep .el-table__body-wrapper::-webkit-scrollbar-track {
background-color: #79878769;
}
.el-form-item--small.el-form-item {
margin-bottom: 20px;
}
</style>

View File

@@ -0,0 +1,488 @@
<template>
<div class="pd10" v-loading="loading" element-loading-text="数据加载中">
<el-form :inline="true" :model="form" label-width="90px">
<el-form-item label="筛选数据:">
<el-input
style="width: 100%"
v-model="form.searchValue"
clearable
placeholder="请输入筛选数据"
></el-input>
</el-form-item>
<el-form-item label="资源类型:">
<el-select v-model="form.type" placeholder="请选择资源类型" style="width: 100%">
<el-option
v-for="item in typeList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="资源状态:">
<el-select v-model="form.state" placeholder="请选择资源状态" style="width: 100%">
<el-option
v-for="item in stateList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="onSubmit">查询</el-button>
<el-button type="primary" icon="el-icon-plus" @click="add">新增</el-button>
</el-form-item>
</el-form>
<el-table
stripe
:data="tableData"
highlight-current-row
border
header-cell-class-name="table_header"
style="width: 100%"
>
<el-table-column
show-overflow-tooltip
prop="resourceName"
align="center"
label="资源名称"
width="180"
></el-table-column>
<el-table-column show-overflow-tooltip prop="uploadTime" align="center" label="上传时间"></el-table-column>
<el-table-column show-overflow-tooltip prop="updateTime" align="center" label="修改时间"></el-table-column>
<el-table-column show-overflow-tooltip prop="type" align="center" label="资源类型">
<template slot-scope="scope">
<span>{{ scope.row.type == 0 ? 'PDF' : '视屏' }}</span>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="state" align="center" label="资源状态">
<template slot-scope="scope">
<span>{{ scope.row.state == 0 ? '展示' : '不展示' }}</span>
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="picUrl" align="center" label="封面">
<template slot-scope="scope">
<img class="imgs" style="height: 22px" :src="scope.row.picUrl" />
</template>
</el-table-column>
<el-table-column show-overflow-tooltip prop="name" align="center" label="操作" width="360px">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-view" @click="look(scope.row)">查看</el-button>
<el-button type="primary" size="mini" icon="el-icon-edit" @click="modify(scope.row)">
修改
</el-button>
<el-button type="primary" size="mini" icon="el-icon-download" @click="download(scope.row)">
下载
</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="deleteF(scope.row.id)">
删除
</el-button>
</template>
</el-table-column>
<!-- <el-table-column show-overflow-tooltip prop="name" label="文件" width="180"> </el-table-column> -->
</el-table>
<el-dialog
:close-on-click-modal="false"
:title="title"
:visible.sync="dialogVisible"
:before-close="handleClose"
width="30%"
style="margin-top: 15vh !important"
>
<el-form :model="formInline" ref="form" :rules="rules" class="formDialog" label-width="110px">
<el-form-item label="资源名称:" prop="name">
<el-input v-model="formInline.name" placeholder="资源名称"></el-input>
</el-form-item>
<el-form-item label="资源类型:" class="top" prop="type">
<el-select v-model="formInline.type" placeholder="资源类型" @change="changeType">
<el-option label="PDF" value="0"></el-option>
<el-option label="视频" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="资源状态:" class="top" prop="state">
<el-select v-model="formInline.state" placeholder="资源类型">
<el-option label="展示" value="0"></el-option>
<el-option label="不展示" value="1"></el-option>
</el-select>
</el-form-item>
<el-form-item label="资源封面:" class="top" prop="fileListImg">
<el-upload
class="upload-demo"
action="#"
:on-remove="beforeRemoveImg"
:http-request="uploadImg"
multiple
:limit="1"
:before-upload="handleBeforeUploadImg"
:on-exceed="handleExceedImg"
:file-list="fileListImg"
accept="[image/jpeg, image/png, image/jpg]"
>
<el-button size="small" type="primary">上传封面</el-button>
</el-upload>
</el-form-item>
<el-form-item label="资源文件:" class="top" prop="fileListImg">
<el-upload
class="upload-demo"
action="#"
:on-remove="beforeRemove"
:http-request="upload"
multiple
:limit="1"
:before-upload="handleBeforeUpload"
:on-exceed="handleExceed"
:file-list="fileList"
:accept="accept"
>
<el-button size="small" type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="determine"> </el-button>
</span>
</el-dialog>
<el-dialog
:close-on-click-modal="false"
:title="titleVideo"
:visible.sync="showvideo"
v-if="showvideo"
width="90%"
:append-to-body="true"
>
<!-- v-if="showvideo" -->
<video style="height: 85vh" controls="controls" autoplay :src="src" />
</el-dialog>
</div>
</template>
<script>
import { dicData } from '@/assets/commjs/dictypeData'
import { queryData, play, uploadFile, updateFile, deleteFile } from '@/api/center/DropEvent.js'
export default {
name: 'resourceDocument',
components: {},
data() {
return {
rules: {
name: [{ required: true, message: '名称不能为空', trigger: 'blur' }],
type: [{ required: true, message: '资源类型不能为空', trigger: 'blur' }],
state: [{ required: true, message: '资源状态不能为空', trigger: 'blur' }],
fileListImg: [{ required: true, message: '请选择文件', trigger: 'blur' }]
},
accept: '.pdf',
tableData: [],
formInline: {
type: '0',
name: '',
state: '1'
},
fileList: [],
fileListImg: [],
dialogVisible: false,
showvideo: false,
title: '',
loading: false,
form: {
state: '',
type: '',
searchValue: ''
},
src: '',
titleVideo: '',
stateList: [
{
value: '',
label: '全部'
},
{
value: '0',
label: '展示'
},
{
value: '1',
label: '不展示'
}
],
typeList: [
{
value: '',
label: '全部'
},
{
value: '0',
label: 'PDF'
},
{
value: '1',
label: '视频'
}
],
fileType: ['pdf']
}
},
created() {},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.onSubmit()
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 250 + 'px'
},
// 表单重置
resetForm() {
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
// 查询
onSubmit() {
this.loading = true
queryData(this.form).then(res => {
this.tableData = res.data
this.loading = false
})
},
// 新增数据
determine() {
if (this.formInline.name == '') {
return this.$message({
message: '请输入名称',
type: 'warning'
})
}
if (this.fileList.length == 0) {
return this.$message({
message: '请上传文件',
type: 'warning'
})
}
let form = new FormData()
form.append('name', this.formInline.name)
form.append('type', this.formInline.type)
form.append('state', this.formInline.state)
// form.append("picture",'');
if (this.fileList.length == 0 || this.fileList[0].url == '') {
form.append('multipartFile', '')
} else {
this.fileList.forEach(item => {
form.append('multipartFile', item)
})
}
if (this.fileListImg.length == 0 || this.fileListImg[0].url == '') {
form.append('picture', '')
} else {
this.fileListImg.forEach(item => {
form.append('picture', item)
})
}
if (this.title == '新增') {
uploadFile(form).then(res => {
if (res.code == 'A0000') {
this.$message({
message: res.message,
type: 'success'
})
this.onSubmit()
this.handleClose()
}
})
}
if (this.title == '修改') {
form.append('id', this.formInline.id)
updateFile(form).then(res => {
if (res.code == 'A0000') {
this.$message({
message: res.message,
type: 'success'
})
this.onSubmit()
this.handleClose()
}
})
}
},
// \取消
handleClose() {
;(this.formInline = {
type: '0',
name: '',
state: '1'
}),
(this.fileList = []),
(this.fileListImg = []),
(this.dialogVisible = false)
this.resetForm()
},
changeType(e) {
if (e == 0) {
this.accept = '.pdf'
this.fileType = ['pdf']
} else if (e == 1) {
this.accept = '.mp4'
this.fileType = ['mp4']
}
},
// 新增
add() {
this.formInline = {}
this.title = '新增'
this.dialogVisible = true
},
// 修改
modify(row) {
// this.formInline = row;
// this.formInline.name=row.resourceName
this.title = '修改'
this.dialogVisible = true
;(this.formInline = {
type: row.type + '',
name: row.resourceName,
state: row.state + '',
id: row.id
}),
this.changeType(row.type)((this.fileList = [{ name: row.fileName, url: '' }]))
this.fileListImg = [{ name: row.imgName, url: '' }]
},
// 删除
deleteF(e) {
deleteFile({ id: e }).then(res => {
if (res.code == 'A0000') {
this.$message({
message: res.message,
type: 'success'
})
this.onSubmit()
}
})
},
look(row) {
if (row.type == 0) {
window.open(row.resUrl)
} else if (row.type == 1) {
this.titleVideo = row.resourceName
play({
id: row.id
}).then(res => {
this.src = window.URL.createObjectURL(res)
this.showvideo = true
})
}
},
// 下载
download(row) {
play({
id: row.id
}).then(res => {
let blob = new Blob([res], {
type: row.type == 1 ? 'video/mp4' : 'application/pdf;chartset=UTF-8'
})
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url // link.download = "电压暂降事件分析报告"; // 设置下载的文件名
link.download = row.fileName // 设置下载的文件名
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link)
})
},
beforeRemove(file, fileList) {
this.fileList = []
},
beforeRemoveImg(file, fileList) {
this.fileListImg = []
},
upload(params) {
this.fileList.push(params.file)
},
uploadImg(params) {
this.fileListImg.push(params.file)
},
handleExceed(files, fileList) {
this.$message.warning(`只能上传1个文件`)
},
handleExceedImg(files, fileList) {
this.$message.warning(`只能上传1张封面`)
},
// 上传前校检格式和大小
handleBeforeUpload(file) {
// 校检文件类型
if (this.fileType) {
let fileExtension = ''
if (file.name.lastIndexOf('.') > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1)
}
const isTypeOk = this.fileType.some(type => {
if (file.type.indexOf(type) > -1) return true
return !!(fileExtension && fileExtension.indexOf(type) > -1)
})
if (!isTypeOk) {
this.$message.error(`文件格式不正确, 请上传${this.fileType.join('/')}格式文件!`)
return false
}
}
this.$message('正在上传文件,请稍候...')
return true
},
// 上传前校检格式和大小
handleBeforeUploadImg(file) {
// 校检文件类型
let fileType = ['image/jpeg', 'image/png', 'image/jpg']
if (fileType) {
let fileExtension = ''
if (file.name.lastIndexOf('.') > -1) {
fileExtension = file.name.slice(file.name.lastIndexOf('.') + 1)
}
const isTypeOk = fileType.some(type => {
if (file.type.indexOf(type) > -1) return true
return !!(fileExtension && fileExtension.indexOf(type) > -1)
})
if (!isTypeOk) {
this.$message.error(`文件格式不正确, 请上传${fileType.join('/')}格式文件!`)
return false
}
}
this.$message('正在上传文件,请稍候...')
return true
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
::v-deep .el-select {
width: 100%;
}
::v-deep .formDialog {
.el-form-item--mini.el-form-item,
.el-form-item--small.el-form-item {
height: auto !important;
}
}
::v-deep .el-dialog {
margin-top: 2% !important;
}
::v-deep .el-dialog__body {
padding: 10px;
max-height: none !important;
}
</style>

View File

@@ -0,0 +1,729 @@
<template>
<!-- <el-card class="box-card"
title="页面设置"
:visible.sync="$store.state.app.showSettings"
direction="rtl"
append-to-body
custom-class="settings-drawer"
> -->
<div class="drawer-container">
<div class="drawer-item">
<span class="item-deder">设置框架布局类型:</span>
<ul class="layout">
<li @click="changeSetting({ layout: 'layout1' })">
<img src="../../../../assets/layout/layout1.svg" alt="layout1" />
<i v-show="settings.layout === 'layout1'" class="el-icon-check" />
</li>
<li @click="changeSetting({ layout: 'layout2' })">
<img src="../../../../assets/layout/layout2.svg" alt="layout2" />
<i v-show="settings.layout === 'layout2'" class="el-icon-check" />
</li>
<li @click="changeSetting({ layout: 'layout3' })">
<img src="../../../../assets/layout/layout3.svg" alt="layout3" />
<i v-show="settings.layout === 'layout3'" class="el-icon-check" />
</li>
<li @click="changeSetting({ layout: 'layout4' })">
<img src="../../../../assets/layout/layout4.svg" alt="layout4" />
<i v-show="settings.layout === 'layout4'" class="el-icon-check" />
</li>
</ul>
</div>
<el-button @click="AddClick" type="primary" icon="el-icon-plus">新增</el-button>
<el-table style="margin-top: 10px" stripe :data="tableData" border highlight-current-row :height="vh + 'px'"
header-cell-class-name="table_header">
<el-table-column align="center" prop="name" label="主题名称" min-width="220"></el-table-column>
<!-- <el-table-column align="center" prop="code" label="主题编号"></el-table-column> -->
<el-table-column min-width="220" align="center" prop="remark" label="描述"></el-table-column>
<el-table-column align="center" min-width="80" label="主题logo" prop="logoUrl">
<template slot-scope="scope">
<img :src="scope.row.logoUrl" class="sidebar-logo" style="width: 22px; height: 22px" />
<!-- <img v-if="scope.row.logo==='njcn.png'" :src="njcn" class="sidebar-logo" style="width:35px;height:35px"> -->
</template>
</el-table-column>
<el-table-column align="center" min-width="80" label="网页ico" prop="faviconUrl">
<template slot-scope="scope">
<img :src="scope.row.faviconUrl" class="sidebar-logo" style="width: 22px; height: 22px" />
<!-- <img v-if="scope.row.ico==='njcn.ico'" src="" class="sidebar-logo" style="width:35px;height:35px"> -->
</template>
</el-table-column>
<!-- <el-table-column
align="center"
prop="color"
label="主题色值"
>
</el-table-column> -->
<el-table-column align="center" prop="color" label="主题颜色">
<template slot-scope="scope">
<span :style="'border-radius:50% 50%;width:30px;background:' +
scope.row.color +
';color:' +
scope.row.color
">
OO
</span>
<span :style="'line-height:30px;color:' + scope.row.color" type="primary" size="small">
{{ scope.row.color }}
</span>
</template>
</el-table-column>
<!-- <el-table-column
align="center"
prop="color"
label="主题"
>
<template slot-scope="scope">
<span v-if="scope.row.color === '#006565'" type="primary" size="small"
>网公司绿</span
>
<span v-if="scope.row.color === '#003078'" type="primary" size="small"
>灿能蓝</span
>
<span v-if="scope.row.color === '#000'" type="primary" size="small"
>历史大事</span
>
<span v-if="scope.row.color === '#08576e'" type="primary" size="small"
>默认</span
>
</template>
</el-table-column> -->
<el-table-column align="center" prop="active" label="激活状态">
<template slot-scope="scope">
<span v-if="scope.row.active === 0" type="primary" size="small">未激活</span>
<span v-if="scope.row.active === 1" type="primary" size="small">激活</span>
</template>
</el-table-column>
<!-- <el-table-column align="center" prop="state" label="状态">
<template slot-scope="scope">
<span v-if="scope.row.state === 0" type="primary" size="small"
>删除</span
>
<span v-if="scope.row.state === 1" type="primary" size="small"
>正常</span
>
</template>
</el-table-column> -->
<el-table-column align="center" label="操作" min-width="180">
<template slot-scope="scope">
<el-button v-if="scope.row.active === 0" @click="activateClick(scope.row)" type="primary"
size="mini" icon="el-icon-finished">
激活
</el-button>
<el-button @click="EditClick(scope.row)" type="primary" size="mini" icon="el-icon-edit">
修改
</el-button>
<!-- <el-button v-if="scope.row.active===1" type="primary" size="mini" icon="el-icon-success">激活</el-button> -->
<el-button @click="DeleteClick(scope.row)" type="danger" size="mini" icon="el-icon-delete">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!--新增与修改-->
<el-dialog class="update" :close-on-click-modal="false" :title="rowName" :visible.sync="dialogFormVisible"
width="30%">
<!-- <el-dialog :close-on-click-modal="false" :title="rowName" :visible.sync="dialogFormVisible" width="30%" center> -->
<el-form :model="formData" label-width="110px">
<el-form-item label="系统名称:">
<el-input v-model="formData.name"></el-input>
</el-form-item>
<el-form-item label="主题颜色:" class="top">
<el-select v-model="formData.color" placeholder="请选择主题" style="width: 100%">
<el-option v-for="item in options" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select>
</el-form-item>
<el-form-item class="top" label="颜色选择:">
<el-color-picker :value="settings.themeColor || '#4451B2'" :predefine="[
'#4451B2',
'#12B1B1',
'#409EFF',
'#E84B16',
'#fa541c',
'#EBA313',
'#4CB418',
'#2f54eb',
'#722ed1'
]" popper-class="theme-picker-dropdown" style="position: absolute; height: 26px"
class="theme-picker" @change="themeColorChange" />
</el-form-item>
<el-form-item label="主题描述:" class="top">
<el-input v-model="formData.remark" type="textarea" :rows="2"></el-input>
</el-form-item>
<el-row>
<el-col :span="24" style="height: 175px;">
<el-form-item label="主题logo:" class="top boder">
<el-upload ref="upload" class="upload-demo" action="" :headers="headers" accept="image/**"
name="file" :on-preview="handlePreview" :on-remove="handleRemove" :file-list="fileList"
:before-upload="beforeAvatarUpload1" :auto-upload="false" :limit="1" :multiple="false"
list-type="picture">
<el-button size="small" type="primary">log上传</el-button>
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div> -->
</el-upload>
<!-- <el-upload
ref="upload"
action="#"
accept="image/**"
:on-preview="handlePreview"
:on-remove="handleRemove"
:file-list="fileList"
:auto-upload="false"
:before-upload="beforeAvatarUpload1"
:limit="1"
:multiple="false"
list-type="picture-card"
>
<el-button slot="trigger" size="small" type="primary"
>上传logo图片</el-button
>
<el-button v-if="false" style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
<div slot="tip" class="">只能上传jpg/png文件且不超过500kb</div>
</el-upload> -->
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<el-form-item label="主题ico:" class="boder">
<!-- <el-upload
ref="upload2"
action="#"
accept="image/**"
:on-preview="handlePreview1"
:on-remove="handleRemove1"
:file-list="fileList1"
:auto-upload="false"
:before-upload="beforeAvatarUpload"
:limit="1"
:multiple="false"
list-type="picture-card"
>
<el-button slot="trigger" size="small" type="primary"
>上传ico图片</el-button
>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
<div slot="tip" class="">只能上传ico文件且不超过500kb</div>
</el-upload> -->
<el-upload ref="upload2" class="upload-demo" action="#" :headers="headers" accept="image/**"
name="file" :on-preview="handlePreview1" :on-remove="handleRemove1"
:file-list="fileList1" :auto-upload="false" :before-upload="beforeAvatarUpload"
:limit="1" :multiple="false" list-type="picture">
<el-button size="small" type="primary">ico上传</el-button>
<!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件且不超过500kb</div> -->
</el-upload>
</el-form-item>
</el-col>
</el-row>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible2 = false"> </el-button>
<el-button type="primary" @click="submitEvent"> </el-button>
</span>
</el-dialog>
<div class="drawer-item">
<span class="item-deder">主题色预览:</span>
<el-select v-model="value" placeholder="请选择主题" @change="changeColor" style="width: 230px">
<el-option v-for="item in options" :key="item.value" :label="item.label"
:value="item.value"></el-option>
</el-select>
<el-color-picker :value="settings.themeColor || '#4451B2'" :predefine="[
'#4451B2',
'#12B1B1',
'#409EFF',
'#E84B16',
'#fa541c',
'#EBA313',
'#4CB418',
'#2f54eb',
'#722ed1'
]" popper-class="theme-picker-dropdown" style="position: absolute; height: 26px; margin-top: 3px"
class="theme-picker" @change="themeColor => changeSetting({ themeColor })" />
</div>
<!-- <div class="drawer-item">
<span class="item-deder">布局大小</span>
<el-select style="width:120px"
size="mini"
class="drawer-select"
:value="settings.size"
@change="sizeChange"
>
<el-option label="小" value="mini" />
<el-option label="中" value="small" />
<el-option label="大" value="medium" />
</el-select>
</div> -->
<!-- <div class="drawer-item">
<span>开启页签</span>
<el-switch
:value="settings.tagsView"
class="drawer-switch"
@input="tagsView=>changeSetting({tagsView})"
/>
</div>
<div class="drawer-item">
<span>固定头部</span>
<el-switch
:value="settings.layout !== 'layout2' && settings.layout !== 'layout1' ? true : settings.fixedHeader"
class="drawer-switch"
:disabled="settings.layout !== 'layout2' && settings.layout !== 'layout1' "
@input="fixedHeader=>changeSetting({fixedHeader})"
/>
</div> -->
</div>
<!-- </el-card> -->
</template>
<script>
import { mapActions } from 'vuex'
import { addClass } from '@/utils/className.js'
import { removeClass } from '@/utils/className'
import { addTheme, getAllThemes, deleteTheme, activateTheme, updateTheme } from '@/api/admin/user'
export default {
name: 'themeanagement',
data() {
return {
headers: {
Authorization: window.sessionStorage.getItem('cntoken')
},
vh: null,
dialogFormVisible: false,
formLabelWidth: '80px',
rowName: '',
fileList: [],
fileList1: [],
logo: require('../../../../assets/login/logo1.png'),
njcn: require('../../../../assets/login/njcn.png'),
formData: {
id: undefined,
name: '',
color: '#08576e',
remark: ''
},
StateOption: [
{ value: 0, label: '删除' },
{ value: 1, label: '正常' }
],
activeOption: [
{ value: 0, label: '未激活' },
{ value: 1, label: '激活' }
],
tableData: [],
// tableData:[{
// id:'00k-100-12',
// name:'网公司',
// code:'001',
// logo:'gw.png',
// ico:'gw.ico',
// color:'#006565',
// active:1,
// remark:'国家电网',
// state:0
// },{
// id:'00k-100-13',
// name:'南京灿能',
// code:'002',
// logo:'njcn.png',
// ico:'njcn.ico',
// color:'#003078',
// active:0,
// remark:'灿能电力',
// state:0
// }],
options: [
{
value: '#006565',
label: '墨绿色'
},
{
value: '#003078',
label: '灿能蓝'
},
{
value: '#08576e',
label: '默认颜色'
},
{
value: '#000',
label: '历史大事'
}
],
value: '',
input: '',
optionstitle: [
{
value: '电能质量监测系统',
label: '电能质量监测系统'
},
{
value: '灿能电能质量监测系统',
label: '灿能电能质量监测系统'
}
],
value2: '',
optionslogo: [
{
value: '电能质量监测系统',
label: '电能质量监测系统'
},
{
value: '灿能电能质量监测系统',
label: '灿能电能质量监测系统'
}
],
value1: '',
device: 1,
logoFile: undefined,
icoFile: undefined,
logoFile2: undefined,
icoFile2: undefined,
t: undefined,
row: null
}
},
computed: {
settings() {
return this.$store.state.settings
}
},
created() {
// this.device=window.devicePixelRatio
this.queryData()
},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
...mapActions({
changeSetting: 'settings/changeSetting'
}),
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 260
},
themeColorChange(val) {
// console.log(val);
this.formData.color = val
},
changeColor(val) {
this.changeSetting({ themeColor: val })
},
changeTitle(val) {
this.changeSetting({ title: val })
},
sizeChange(size) {
this.$ELEMENT.size = size
// console.log(`PAGE_SIZE-${this.settings.size}`);
removeClass(document.body, `PAGE-SIZE-${this.settings.size}`)
addClass(document.body, `PAGE-SIZE-${size}`)
this.changeSetting({ size })
this.refreshView()
this.$message({
message: '切换布局大小成功',
type: 'success'
})
},
refreshView() {
// In order to make the cached page re-rendered
this.$store.dispatch('tagsView/delAllTags')
const { fullPath } = this.$route
this.$nextTick(() => {
this.$router.replace({
path: '/redirect' + fullPath
})
})
},
AddClick() {
this.fileList = []
this.fileList1 = []
this.logoFile = null
this.icoFile = null
this.formData = {}
this.dialogFormVisible = true
this.rowName = '主题新增'
this.t = 'add'
},
EditClick(row) {
this.row = row
this.fileList = []
this.fileList1 = []
this.rowName = row.name + '主题修改'
let p = {
name: 'logo.png',
url: row.logoUrl
}
let d = {
name: 'logo.ico',
url: row.faviconUrl
}
this.fileList.push(p)
this.fileList1.push(d)
// this.fileList.push(this.base64ImgtoFile(row.logoUrl))
// console.log("imgFile", this.fileList);
this.t = 'edit'
this.formData = {
id: row.id,
color: row.color,
name: row.name,
remark: row.remark
}
setTimeout(() => {
this.dialogFormVisible = true
}, 300)
},
DeleteClick(row) {
let id = row.id
if (row.active == 0) {
this.$confirm('当前主题处于未激活状态', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
deleteTheme(id).then(response => {
if (response.code == 'A0000') {
this.$message.success('删除成功')
this.queryData()
}
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
if (row.active == 1) {
this.$confirm('当前主题处于已经激活状态,删除会导致主题失效', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
deleteTheme(id).then(response => {
if (response.code == 'A0000') {
this.$message.success('删除成功')
this.queryData()
}
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
// alert('根据id删除主题'+id)
},
activateClick(row) {
let id = row.id
activateTheme(id).then(response => {
if (response.code == 'A0000') {
this.$message.success('激活成功')
this.queryData()
}
})
},
submitEvent() {
this.$refs.upload.submit()
this.$refs.upload2.submit()
if (this.t === 'add') {
const theme = new FormData()
theme.append('logoFile', this.logoFile)
theme.append('faviconFile', this.icoFile)
theme.append('color', this.formData.color)
theme.append('name', this.formData.name)
theme.append('remark', this.formData.remark)
// var arr = [this.logoFile,this.logoFile]
// console.log(theme);
var p = this.formData
addTheme(theme).then(response => {
if (response.code == 'A0000') {
this.$message.success('新增成功')
this.queryData()
}
})
}
if (this.t == 'edit') {
if (this.logoFile2 == undefined && this.icoFile2 == undefined) {
this.logoFile2 = this.base64ImgtoFile(this.row.logoUrl)
this.icoFile2 = this.base64ImgtoFile(this.row.faviconUrl)
} else {
this.logoFile2 = this.logoFile
this.icoFile2 = this.icoFile
}
const theme2 = new FormData()
theme2.append('id', this.formData.id)
theme2.append('logoFile', this.logoFile2)
theme2.append('faviconFile', this.icoFile2)
theme2.append('color', this.formData.color)
theme2.append('name', this.formData.name)
theme2.append('remark', this.formData.remark)
updateTheme(theme2).then(response => {
if (response.code == 'A0000') {
this.$message.success('修改成功')
this.queryData()
}
})
}
this.dialogFormVisible = false
},
queryData() {
getAllThemes().then(response => {
if (response.code == 'A0000') {
this.tableData = response.data
}
})
},
handleRemove(file, fileList) {
this.fileList = []
this.logoFile = null
},
handlePreview(file) { },
handleRemove1(file, fileList) {
this.fileList1 = []
this.icoFile = null
},
handlePreview1(file) { },
beforeAvatarUpload(file) {
this.icoFile = file
//this.icoFile2 = this.icoFile;
},
beforeAvatarUpload1(file) {
this.logoFile = file
//this.logoFile2 = this.logoFile;
},
//转换图片文件
base64ImgtoFile(dataurl, filename = 'file') {
let arr = dataurl.split(',')
let mime = arr[0].match(/:(.*?);/)[1]
let suffix = mime.split('/')[1]
let bstr = atob(arr[1])
let n = bstr.length
let u8arr = new Uint8Array(n)
while (n--) {
u8arr[n] = bstr.charCodeAt(n)
}
return new File([u8arr], `${filename}.${suffix}`, {
type: mime
})
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
</style>
<style lang="scss" scoped>
.drawer-container {
padding: 10px 10px 10px 10px;
font-size: 14px;
line-height: 1.5;
word-wrap: break-word;
.drawer-item {
padding: 12px 0;
font-size: 14px;
color: rgba(0, 0, 0, 0.65);
.layout {
margin-top: 16px;
&>li {
position: relative;
display: inline-block;
width: 52px;
height: 45px;
margin-right: 10px;
img {
width: 100%;
height: 100%;
}
i {
position: absolute;
top: 50%;
left: 50%;
font-size: 22px;
font-weight: bold;
color: #409eff;
transform: translate(-50%, -50%);
}
}
}
}
.drawer-switch {
float: right;
}
.drawer-select {
float: right;
width: 60px;
}
}
.theme-picker ::v-deep .el-color-picker__trigger {
width: 26px !important;
height: 26px !important;
padding: 2px;
}
</style>
<style lang="scss" scoped>
.theme-picker-dropdown {
z-index: 99999 !important;
zoom: 1;
}
.theme-picker-dropdown2 {
z-index: 99999 !important;
zoom: 1.25;
margin-top: -3%;
}
.settings-drawer {
width: 250px !important;
}
.box-card {
height: 90vh;
}
.item-deder {
color: $themeColor;
font-weight: bold;
}
::v-deep .update .el-dialog .el-dialog__body {
// height: 65vh !important;
padding: 20px 110px 20px 65px !important;
// overflow-y: auto;
}
::v-deep .boder {
border: 1px dotted #ccc !important;
height: 160px !important;
padding: 10px !important;
border-radius: 5px 5px !important;
}
</style>

View File

@@ -0,0 +1,462 @@
<template>
<div class="pd10">
<el-button type="primary" icon="el-icon-top" @click="newlyAdded">上传资源</el-button>
<el-button type="primary" icon="el-icon-bottom" @click="exportEvent">导出</el-button>
<el-collapse v-model="activeName" accordion>
<el-collapse-item title="基本资源(推荐)" name="1">
<vxe-table
align="center"
size="mini"
:height="vh"
ref="Monitoringpoint"
border
:data="BasicResource"
header-cell-class-name="table_header"
:row-config="{ isCurrent: true, isHover: true }"
>
<vxe-table-column
min-width="200px"
field="description"
title="资源类目"
:formatter="formFilter"
></vxe-table-column>
<vxe-table-column min-width="200px" field="name" title="资源名称"></vxe-table-column>
<vxe-table-column min-width="200px" field="description" title="资源描述"></vxe-table-column>
<vxe-table-column min-width="250px" title="资源下载">
<template v-slot="{ row }">
<el-button size="mini" type="primary" icon="el-icon-bottom" @click="DownloadFiles(row)">
下载文件
</el-button>
<el-button size="mini" type="primary" icon="el-icon-edit" @click="modify(row)">
修改
</el-button>
<el-button size="mini" type="danger" icon="el-icon-delete" @click="deleteFile(row)">
删除
</el-button>
</template>
</vxe-table-column>
</vxe-table>
</el-collapse-item>
<el-collapse-item title="报告发布" name="2">
<vxe-table
align="center"
size="mini"
:height="vh"
border
:data="ReportIssue"
header-cell-class-name="table_header"
:row-config="{ isCurrent: true, isHover: true }"
>
<vxe-table-column
min-width="200px"
field="type"
title="资源类目"
:formatter="formFilter"
></vxe-table-column>
<vxe-table-column min-width="200px" field="name" title="资源名称"></vxe-table-column>
<vxe-table-column min-width="200px" field="description" title="资源描述"></vxe-table-column>
<vxe-table-column min-width="250px" title="资源下载">
<template v-slot="{ row }">
<el-button size="mini" type="primary" icon="el-icon-bottom" @click="DownloadFiles(row)">
下载文件
</el-button>
<el-button size="mini" type="primary" icon="el-icon-edit" @click="modify(row)">
修改
</el-button>
<el-button size="mini" type="danger" icon="el-icon-delete" @click="deleteFile(row)">
删除
</el-button>
</template>
</vxe-table-column>
</vxe-table>
</el-collapse-item>
<el-collapse-item title="辅助资源" name="3">
<vxe-table
align="center"
size="mini"
:height="vh"
border
:data="AssistResource"
header-cell-class-name="table_header"
:row-config="{ isCurrent: true, isHover: true }"
>
<vxe-table-column
min-width="200px"
field="type"
title="资源类目"
:formatter="formFilter"
></vxe-table-column>
<vxe-table-column min-width="200px" field="name" title="资源名称"></vxe-table-column>
<vxe-table-column min-width="200px" field="description" title="资源描述"></vxe-table-column>
<vxe-table-column min-width="250px" title="资源下载">
<template v-slot="{ row }">
<el-button size="mini" type="primary" icon="el-icon-bottom" @click="DownloadFiles(row)">
下载文件
</el-button>
<el-button size="mini" type="primary" icon="el-icon-edit" @click="modify(row)">
修改
</el-button>
<el-button size="mini" type="danger" icon="el-icon-delete" @click="deleteFile(row)">
删除
</el-button>
</template>
</vxe-table-column>
</vxe-table>
</el-collapse-item>
</el-collapse>
<el-dialog
:close-on-click-modal="false"
:title="title"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose"
>
<el-form ref="form" :rules="rules" :model="form" label-width="110px">
<el-form-item label="资源名称:" prop="name">
<el-input style="width: 100%" v-model="form.name" placeholder="请输入资源名称" clearable></el-input>
</el-form-item>
<el-form-item label="资源类型:" prop="type" class="top">
<el-select v-model="form.type" placeholder="请选择资源类型" clearable style="width: 100%">
<el-option
v-for="item in Category"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="资源描述:" prop="description" class="top">
<el-input
style="width: 100%"
v-model="form.description"
type="textarea"
placeholder="请输入资源描述"
clearable
></el-input>
</el-form-item>
<el-form-item class="top" label="上传资源:" style="text-overflow: ellipsis" prop="fileList">
<el-upload
class="upload-demo"
action="#"
:on-remove="beforeRemove"
:http-request="upload"
multiple
:limit="1"
:on-preview="preview"
:on-exceed="handleExceed"
:file-list="form.fileList"
accept=".docx,.doc,.xlsx"
>
<el-button size="small" type="primary">选择文件</el-button>
</el-upload>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="onsubmit"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { queryData, uploadFile, deleteFile, downloadFile, updateFile } from '@/api/templateConfiguration'
import { dicData } from '@/assets/commjs/dictypeData'
export default {
name: 'resourcemage',
components: {},
data() {
return {
flag: true,
title: '',
vh: undefined,
activeName: 'first',
device: '',
activeName: '1',
BasicResource: [],
AssistResource: [],
ReportIssue: [],
Category: [],
dialogVisible: false,
form: {
fileList: [],
name: '',
type: '',
multipartFile: '',
description: ''
},
rules: {
name: [{ required: true, message: '请输入资源名', trigger: 'blur' }],
fileList: [{ required: true, message: '请上传文件', trigger: 'blur' }],
description: [{ required: true, message: '请输入资源描述', trigger: 'blur' }],
type: [{ required: true, message: '请选择资源类型', trigger: 'change' }]
}
}
},
created() {},
mounted() {
this.device = window.devicePixelRatio
this.Category = dicData('Resource_Category', [])
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.info()
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 215 + 'px'
},
// 表单重置
resetForm() {
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
info() {
;(this.BasicResource = []),
(this.ReportIssue = []),
(this.AssistResource = []),
queryData({}).then(res => {
this.Category.forEach(val => {
res.data.forEach(item => {
if (val.id == item.type) {
if (val.code == 'base_resource') {
// 基本资源
this.BasicResource.push(item)
} else if (val.code == 'report_fa_resource') {
// 报告发布
this.ReportIssue.push(item)
} else if (val.code == 'help_resource') {
// "辅助资源"
this.AssistResource.push(item)
}
}
})
})
})
},
handleClose() {
this.dialogVisible = false
this.form = {
fileList: [],
name: '',
type: '',
multipartFile: '',
description: ''
}
this.resetForm()
},
//文件上传
upload(params) {
this.form.fileList.push(params.file)
},
handleExceed(files, fileList) {
this.$message.warning(`只能上传1个文件`)
},
beforeRemove(file, fileList) {
this.form.fileList = []
},
// 点击上传文件
async preview(file) {
let res = null
if (this.form.fileList[0].url) {
await downloadFile({ id: this.form.id }).then(val => {
res = val
})
} else {
res = file
}
let blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
})
// createObjectURL(blob); //创建下载的链接
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = this.form.fileList[0].name // 设置下载的文件名
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link)
},
// 上传资源
onsubmit() {
let fileName = this.fileList[0].name
let pos = fileName.lastIndexOf('.')
let includes = fileName.substring(pos, fileName.length)
console.log(includes)
let fileLastArr = [".doc",".docx",".xls",".xlsx"]
if (!fileLastArr.includes(includes)) {
this.$message.error('当前不支持该格式文件')
return false;
}
this.$refs['form'].validate(valid => {
if (valid) {
let form = new FormData()
form.append('name', this.form.name)
form.append('type', this.form.type)
form.append('description', this.form.description)
if (this.form.fileList[0].url) {
form.append('multipartFile', '')
} else {
this.form.fileList.forEach(item => {
form.append('multipartFile', item)
})
}
if (this.title == '上传资源') {
uploadFile(form).then(res => {
if (res.code == 'A0000') {
this.$message({
message: res.message,
type: 'success'
})
this.info()
this.handleClose()
}
})
} else if (this.title == '修改资源') {
form.append('id', this.form.id)
updateFile(form).then(res => {
if (res.code == 'A0000') {
this.$message({
message: res.message,
type: 'success'
})
this.info()
this.handleClose()
}
})
}
} else {
// console.log("error submit!!");
return false
}
})
},
// 删除
deleteFile(row) {
deleteFile({
id: row.id
}).then(res => {
if (res.code == 'A0000') {
this.$message({
message: '删除成功!',
type: 'success'
})
this.info()
}
})
},
//上传资源
newlyAdded() {
this.title = '上传资源'
this.dialogVisible = true
},
// 修改
modify(row) {
this.form = JSON.parse(JSON.stringify(row))
this.form.fileList = [
{
url: row.url,
name: row.fileName
}
]
this.title = '修改资源'
this.dialogVisible = true
},
// 导出
exportEvent() {
this.$refs.Monitoringpoint.exportData({
filename: '资源管理', // 文件名字
sheetName: 'Sheet1',
type: 'xlsx', //导出文件类型 xlsx 和 csv
useStyle: true,
// BasicResource: [],
// AssistResource: [],
// ReportIssue: [],
data: [...this.BasicResource, ...this.AssistResource, ...this.ReportIssue], // 数据源 // 过滤那个字段导出
columnFilterMethod: function (column, $columnIndex) {
return !(column.$columnIndex === 3)
}
})
},
// 数据过滤
formFilter(row, column) {
let title = ''
this.Category.forEach(item => {
if (item.id == row.row.type) {
title = item.name
}
})
return title
},
DownloadFiles(row) {
downloadFile({ id: row.id }).then(res => {
let blob = new Blob([res], {
type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document;charset=UTF-8'
})
// createObjectURL(blob); //创建下载的链接
const url = window.URL.createObjectURL(blob)
const link = document.createElement('a') // 创建a标签
link.href = url
link.download = row.fileName // 设置下载的文件名
document.body.appendChild(link)
link.click() //执行下载
document.body.removeChild(link)
})
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
::v-deep .el-table .cell {
text-align: center;
}
::v-deep .el-tabs--border-card > .el-tabs__content {
padding: 10px;
}
.block {
position: absolute;
right: 10px;
bottom: 10px;
}
// ::v-deep .forms {
// display: flex;
// flex-wrap: wrap;
// justify-content: space-between;
// .el-form-item {
// display: flex;
// width: 100%;
// margin-bottom: 15px !important;
// .el-form-item__content {
// flex: 1 !important;
// .el-select {
// width: 100%;
// }
// .el-date-editor {
// width: 100%;
// }
// .el-textarea {
// width: 100%;
// }
// }
// }
//}
::v-deep .el-upload-list__item-name {
width: 324px;
}
::v-deep .el-upload-list__item:first-child {
margin-top: -3px;
}
</style>

View File

@@ -0,0 +1,401 @@
<template>
<div class="pd10">
<el-button
size="small"
icon="el-icon-plus"
type="primary"
style="float: right; margin-bottom: 10px"
@click="addtype"
>
新增类型
</el-button>
<el-table
stripe
class="xshou"
:data="tableData"
row-key="id"
id="rebateSetTable"
border
:height="tableheight + 'px'"
highlight-current-row
v-loading="loading"
element-loading-text="数据加载中"
header-cell-class-name="table_header"
:default-expand-all="false"
>
<el-table-column align="center" prop="deptName" label="部门">
<template slot-scope="scope">
<span v-if="scope.row.deptName == null">/</span>
<span>{{ scope.row.deptName }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="mapType" label="地图类型">
<template slot-scope="scope">
<span v-if="scope.row.mapType == 0">离线地图</span>
<span v-if="scope.row.mapType == 1">在线地图</span>
</template>
</el-table-column>
<el-table-column
align="center"
prop="longitude"
label="中心点经度"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column align="center" prop="latitude" label="中心点纬度"></el-table-column>
<el-table-column align="center" prop="minValue" label="最小缩放层级"></el-table-column>
<el-table-column align="center" prop="maxValue" label="最大缩放层级"></el-table-column>
<el-table-column align="center" prop="beValue" label="当前缩放层级"></el-table-column>
<el-table-column align="center" prop="mapUrl" label="当前访问地址"></el-table-column>
<el-table-column align="center" label="操作" min-width="180">
<template slot-scope="scope">
<el-button type="primary" size="mini" icon="el-icon-edit" @click="edit(scope.row)">修改</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="deletedata(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
:close-on-click-modal="false"
title="地图类型"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose"
>
<el-row :gutter="10">
<el-col :span="24">
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
<el-form-item label="部门配置:">
<el-select
ref="selectTree1"
:value="form.value"
v-model="form.valueTitle"
clearable
style="width: 100%"
>
<el-option :value="form.valueTitle" :label="form.valueTitle" class="options">
<el-tree
id="tree-option"
ref="selectTree"
:accordion="form.accordion"
:data="form.options"
:props="form.props"
:node-key="form.props.value"
:default-expanded-keys="form.defaultExpandedKey"
@node-click="handleNodeClick"
>
<span slot-scope="{ node, data }">
<i
:class="[data.color != null ? 'ification_col' : '']"
:style="{ 'background-color': data.color }"
></i>
&nbsp;&nbsp;{{ data.name }}
</span>
</el-tree>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="地图名称:" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="地图类型:" prop="maytype">
<el-select v-model="ruleForm.maytype" placeholder="请选择地图类型" style="width: 100%">
<el-option
v-for="item in typeoption"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="中心点经度:" prop="centerlng">
<el-input v-model="ruleForm.centerlng"></el-input>
</el-form-item>
<el-form-item label="中心点纬度:" prop="centerlng">
<el-input v-model="ruleForm.centerlat"></el-input>
</el-form-item>
<el-form-item label="最小缩放层级:" prop="minindex">
<el-input v-model="ruleForm.minindex"></el-input>
</el-form-item>
<el-form-item label="最大缩放层级:" prop="minindex">
<el-input v-model="ruleForm.maxindex"></el-input>
</el-form-item>
<el-form-item label="当前缩放层级:" prop="minindex">
<el-input v-model="ruleForm.nowindex"></el-input>
</el-form-item>
<el-form-item label="瓦片访问地址:" prop="nowurl">
<el-input v-model="ruleForm.nowurl"></el-input>
</el-form-item>
</el-form>
</el-col>
</el-row>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="dialogVisible = false"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getheight } from '@/assets/commjs/common'
import { deptTree, getDeptMapConfig } from '@/api/admin/dept'
export default {
name: 'mapmanagement',
data() {
return {
form: {
value: '',
props: '',
valueTitle: '',
accordion: false,
defaultExpandedKey: [],
//区域
options: [],
default: {
value: 'id',
children: 'children',
label: 'name'
}
},
tableheight: undefined,
dialogVisible: false,
loading: false,
tableData: [],
ruleForm: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
maytype: [0],
resource: '',
desc: ''
},
rules: {
name: [
{ required: true, message: '请输入活动名称', trigger: 'blur' },
{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
],
maytype: [{ required: true, message: '请选择地图类型', trigger: 'change' }],
centerlng: [
{
type: 'date',
required: true,
message: '请输入中心点经度',
trigger: 'change'
}
],
centerlat: [
{
type: 'date',
required: true,
message: '请输入中心点纬度',
trigger: 'change'
}
],
minindex: [
{
type: 'array',
required: true,
message: '请填写当前最小缩放层级',
trigger: 'change'
}
],
maxindex: [
{
required: true,
message: '请填写当前最大缩放层级',
trigger: 'change'
}
],
nowurl: [{ required: true, message: '请填写瓦片访问地址', trigger: 'change' }],
nowindex: [{ required: true, message: '请填写当前缩放层级', trigger: 'blur' }]
},
dataForm: {
name: '',
unitId: '',
teamCode: '',
guid: '',
scaleName: '',
totalCapacity: ''
},
unitId: [],
typeoption: [
{
id: 0,
name: '离线地图'
},
{
id: 1,
name: '在线地图'
}
]
}
},
created() {},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.queryData()
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.tableheight = window.sessionStorage.getItem('appheight') - 55
},
queryData() {
getDeptMapConfig().then(res => {
// console.log(res.data);
if (res.code == 'A0000') {
this.tableData = res.data
}
})
},
//新增地图类型
addtype() {
this.ruleForm = {}
this.dialogVisible = true
deptTree().then(res => {
if (res.code == 'A0000') {
this.form.options = res.data
}
})
},
handleClose() {
this.dialogVisible = false
},
submitForm(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
alert('submit!')
} else {
// console.log("error submit!!");
return false
}
})
},
resetForm(formName) {
this.$refs[formName].resetFields()
},
// 切换选项
handleNodeClick(node) {
this.unitId = []
// console.log(node);
this.$refs.selectTree1.blur()
this.form.valueTitle = node.areaName
this.form.defaultExpandedKey = []
this.unitId.push(node.id)
},
edit(row) {
this.dialogVisible = true
this.ruleForm.name = row.name
this.ruleForm.maptype = row.maptype
this.ruleForm.centerlng = row.centerlng
this.ruleForm.centerlat = row.centerlat
this.ruleForm.minindex = row.minindex
this.ruleForm.maxindex = row.maxindex
this.ruleForm.nowindex = row.nowindex
this.ruleForm.nowurl = row.nowurl
},
deletedata(row) {
this.$confirm('此操作将永久删除该配置, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
this.$message({
type: 'success',
message: '删除成功!'
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
::v-deep .el-table .cell {
text-align: center;
}
::v-deep .el-tabs--border-card > .el-tabs__content {
padding: 10px;
}
::v-deep.el-form-item--mini.el-form-item,
.el-form-item--small.el-form-item {
height: 36px !important;
padding: 0 !important;
margin-bottom: 18px !important;
}
::v-deep .form {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.el-form-item {
display: flex;
width: 48%;
.el-form-item__content {
flex: 1 !important;
.el-select {
width: 100%;
}
.el-input__inner {
width: 100% !important;
}
.el-date-editor {
width: 100%;
}
}
}
}
.obtain {
margin-left: 1220px;
}
.el-scrollbar .el-scrollbar__view .el-select-dropdown__item {
height: auto;
max-height: 274px;
padding: 0;
overflow: hidden;
overflow-y: auto;
}
.el-select-dropdown__item.selected {
font-weight: normal;
}
ul li > .el-tree .el-tree-node__content {
height: auto;
padding: 0 20px;
}
.el-tree-node__label {
font-weight: normal;
}
.el-tree > .is-current .el-tree-node__label {
color: #409eff;
font-weight: 700;
}
.el-tree > .is-current .el-tree-node__children .el-tree-node__label {
color: #606266;
font-weight: normal;
}
.el-popper {
z-index: 9999;
}
.ification_col {
width: 20px;
height: 10px;
display: inline-block;
}
</style>

View File

@@ -0,0 +1,420 @@
<template>
<div class="pd10">
<el-button
size="small"
icon="el-icon-plus"
type="primary"
style="float: right; margin-bottom: 10px"
@click="addtype"
>
新增类型
</el-button>
<el-table
stripe
class="xshou"
:data="tableData"
row-key="id"
id="rebateSetTable"
border
:height="tableheight + 'px'"
header-cell-class-name="table_header"
highlight-current-row
v-loading="loading"
element-loading-text="数据加载中"
:default-expand-all="false"
>
<el-table-column align="center" prop="type" label="系统类型">
<template slot-scope="scope">
<span v-if="scope.row.type == 0">省级系统</span>
<span v-if="scope.row.type == 1">企业系统</span>
<span v-if="scope.row.type == 2">数据中心</span>
</template>
</el-table-column>
<el-table-column align="center" prop="dataReport" label="数据上报"></el-table-column>
<el-table-column
align="center"
prop="logSize"
min-width="140"
label="审计日志大小(M)"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column
align="center"
prop="logTime"
label="审计日志存储时间(月)"
min-width="120"
></el-table-column>
<el-table-column align="center" prop="state" label="状态">
<template slot-scope="scope">
<el-tag v-if="scope.row.state == 1">已激活</el-tag>
<el-tag v-if="scope.row.state == 0">未激活</el-tag>
</template>
</el-table-column>
<el-table-column align="center" prop="createBy" label="创建用户" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.createBy == null">/</span>
<span v-if="scope.row.createBy !== null">{{ scope.row.createBy }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="createTime" label="创建时间" min-width="120"></el-table-column>
<el-table-column align="center" prop="updateBy" label="更新用户" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.updateBy == null">/</span>
<span v-if="scope.row.updateBy !== null">{{ scope.row.updateBy }}</span>
</template>
</el-table-column>
<el-table-column
align="center"
prop="updateTime"
label="更新时间"
:show-overflow-tooltip="true"
></el-table-column>
<el-table-column align="center" label="操作" min-width="180">
<template slot-scope="scope">
<el-button
v-if="scope.row.state == 0"
type="primary"
size="mini"
icon="el-icon-share"
@click="active(scope.row)"
>
激活
</el-button>
<el-button type="primary" size="mini" icon="el-icon-edit" @click="edit(scope.row)">修改</el-button>
<el-button type="danger" size="mini" icon="el-icon-delete" @click="deletedata(scope.row)">
删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-dialog
:close-on-click-modal="false"
:title="t"
:visible.sync="dialogVisible"
width="30%"
:before-close="handleClose"
>
<el-form ref="form" :model="form" :rules="rules2" label-width="140px">
<el-form-item label="系统类型:" prop="type">
<el-select v-model="form.type" placeholder="请选择系统类型" style="width: 100%">
<el-option
v-for="item in typeoption"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="数据上报:" prop="dataReport" class="top">
<el-input style="width: 100%" v-model="form.dataReport" placeholder="请输入数据上报"></el-input>
</el-form-item>
<el-form-item label="审计日志大小(M):" prop="logSize" class="top">
<el-input-number
style="width: 100%"
type="number"
v-model="form.logSize"
:min="1024"
:max="20480"
placeholder="请输入审计日志大小"
></el-input-number>
</el-form-item>
<el-form-item label="日志储存时间(月):" prop="logTime" class="top">
<el-input-number
style="width: 100%"
type="number"
v-model="form.logTime"
:min="1"
:max="6"
placeholder="请输入日志储存时间不能大于6个月"
></el-input-number>
</el-form-item>
<el-form-item label="激活状态:" class="top" prop="state">
<el-select
v-model="form.state"
:disabled="flagtyoe == 'add' ? false : true"
placeholder="请选择"
style="width: 100%"
>
<el-option
v-for="item in stateoptions"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="handleClose"> </el-button>
<el-button type="primary" @click="submitForm"> </el-button>
</span>
</el-dialog>
</div>
</template>
<script>
import { getheight } from '@/assets/commjs/common'
import api from '@/api/admin/sysconfig'
export default {
name: 'sysmanage',
data() {
return {
rules2: {
type: [{ required: true, message: '系统类型不能为空', trigger: 'blur' }],
dataReport: [{ required: true, message: '数据上报不能为空', trigger: 'blur' }],
logSize: [{ required: true, message: '审计日志大小不能为空', trigger: 'blur' }],
logTime: [{ required: true, message: '日志储存时间不能为空', trigger: 'blur' }]
// state:[{ required: true, message: "状态不能为空", trigger: "blur" }],
},
form: {
type: 0,
logSize: 0,
logTime: 0,
dataReport: '',
state: 0
},
t: '',
tableheight: undefined,
dialogVisible: false,
loading: false,
tableData: [],
stateoptions: [
{
value: 0,
label: '未激活'
},
{
value: 1,
label: '已激活'
}
],
ruleForm: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: ''
},
rules: {
name: [
{ required: true, message: '请输入活动名称', trigger: 'blur' },
{ min: 3, max: 5, message: '长度在 3 到 5 个字符', trigger: 'blur' }
],
maytype: [{ required: true, message: '请选择地图类型', trigger: 'change' }],
centerlng: [
{
type: 'date',
required: true,
message: '请输入中心点经度',
trigger: 'change'
}
],
centerlat: [
{
type: 'date',
required: true,
message: '请输入中心点纬度',
trigger: 'change'
}
],
minindex: [
{
type: 'array',
required: true,
message: '请填写当前最小缩放层级',
trigger: 'change'
}
],
maxindex: [
{
required: true,
message: '请填写当前最大缩放层级',
trigger: 'change'
}
],
nowurl: [{ required: true, message: '请填写瓦片访问地址', trigger: 'change' }],
nowindex: [{ required: true, message: '请填写当前缩放层级', trigger: 'blur' }]
},
dataForm: {
name: '',
unitId: '',
teamCode: '',
guid: '',
scaleName: '',
totalCapacity: ''
},
typeoption: [
{
label: '省级系统',
value: 0
},
{
label: '企业系统',
value: 1
},
{
label: '数据中心',
value: 2
}
],
unitId: [],
flagtyoe: ''
}
},
created() {},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.queryData()
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.tableheight = window.sessionStorage.getItem('appheight') - 55
},
//获取系统类型列表
queryData() {
this.loading = true
api.getSysconfig().then(res => {
if (res.code == 'A0000') {
this.tableData = res.data
this.loading = false
} else if ((res.data = null)) {
this.loading = false
}
})
},
//新增
addtype() {
this.form = {}
this.dialogVisible = true
this.flagtyoe = 'add'
// this.form.type = this.type
// this.form.state = this.state
this.t = '新增系统类型'
},
handleClose() {
this.dialogVisible = false
this.resetForm()
},
// 表单重置
resetForm() {
this.form = {}
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
submitForm() {
this.$refs['form'].validate((valid) => {
if (valid) {
if (this.flagtyoe == 'add') {
api.getaddSysconfig(this.form).then(res => {
if (res.code == 'A0000') {
this.$message({
message: '新增系统类型成功',
type: 'success'
})
this.dialogVisible = false
this.queryData()
}
})
} else if (this.flagtyoe == 'edit') {
api.getupSysconfig(this.form).then(res => {
if (res.code == 'A0000') {
this.$message({
message: '修改系统类型成功',
type: 'success'
})
this.dialogVisible = false
this.queryData()
}
})
}
}
})
},
// resetForm(formName) {
// this.$refs[formName].resetFields();
// },
// 切换选项
handleNodeClick(node) {
this.unitId = []
// console.log(node);
this.$refs.selectTree1.blur()
this.form.valueTitle = node.areaName
this.form.defaultExpandedKey = []
this.unitId.push(node.id)
},
//修改
edit(row) {
this.flagtyoe = 'edit'
this.t = '修改系统类型'
this.dialogVisible = true
this.form.id = row.id
this.form.type = row.type
this.form.logSize = row.logSize
this.form.logTime = row.logTime
this.form.dataReport = row.dataReport
this.form.state = row.state
},
//删除
deletedata(row) {
let data = {
id: row.id
}
this.$confirm('此操作将永久删除该配置, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
api.getdelSysconfig(data).then(res => {
if (res.code == 'A0000') {
this.$message({
message: '删除系统类型成功',
type: 'success'
})
this.dialogVisible = false
this.queryData()
}
})
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
},
//激活
active(row) {
let data = {
id: row.id,
type: row.type,
logSize: row.logSize,
logTime: row.logTime,
dataReport: row.dataReport,
state: 1
}
api.getupSysconfig(data).then(res => {
if (res.code == 'A0000') {
this.$message({
message: '激活成功',
type: 'success'
})
//this.dialogVisible = false;
this.queryData()
}
})
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
</style>

View File

@@ -0,0 +1,39 @@
<template>
<div>
<div class="particles">
<vue-particles
color="#006565"
shapeType="star"
linesColor="#dedede"
hoverMode="grab"
clickMode="push"
style="height: 100%"
></vue-particles>
<video controls autoplay src="http://192.168.1.111:10202/resource/previewFile?id=c4e4616e3aa630e5c3883807985a6cb8"/>
</div>
</div>
</template>
<script>
import VueParticles from 'vue-particles'
export default {
data(){
return {
}
},
// components: {VueParticles},
}
</script>
<style>
.particles {
position: absolute;
top: 0;
left: 0;
height: 100vh;
width: 100%;
z-index: 0;
background: radial-gradient(ellipse at top left, rgba(105, 155, 200, 1) 0%,rgba(181, 197, 216, 1) 57%);
background: radial-gradient(ellipse at top left, #006565b5 0%,#ffffff93 57%);
}
</style>

View File

@@ -0,0 +1,148 @@
<template>
<div style="padding:10px">
<el-popover
:width="popoverWidth"
trigger="click">
<el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">
全选
</el-checkbox>
<div style="margin: 15px 0;"></div>
<el-checkbox-group v-model="selectCheckboxGroupValue" @change="handleCheckedChange">
<el-checkbox v-for="item in list" :label="item.value" :key="item.value" :style="`width: ${checkboxWidth}px`">
{{item.label.legth>5?q:item.label}}
</el-checkbox>
</el-checkbox-group>
<el-select
slot="reference"
v-model="selectCheckboxGroupValue"
multiple
collapse-tags
placeholder="请选择">
<el-option
class="el-option"
v-for="item in list"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-popover>
</div>
</template>
<script>
export default {
name: 'select_checkbox_group',
props: {
value: {
type: Array,
default () {
return []
}
},
list: {
type: Array,
default () {
return [
{
value:0,
label:'数据0'
}, {
value:1,
label:'数据1'
}, {
value:2,
label:'数据2测试你喀什地方都是老师身上发生发射点发射点'
}, {
value:3,
label:'数据3'
}, {
value:4,
label:'数据4'
}, {
value:5,
label:'数据5'
}, {
value:6,
label:'数据6'
}, {
value:7,
label:'数据7'
}, {
value:8,
label:'数据8'
}, {
value:9,
label:'数据9'
}, {
value:10,
label:'数据10'
}, {
value:11,
label:'数据11'
}
]
}
},
popoverWidth: {
type: Number,
default: 570
},
checkboxWidth: {
type: Number,
default: 150
},
},
computed: {
q() {
return "值"
}
},
data () {
return {
selectCheckboxGroupValue: this.value,
checkAll: this.value.length === this.list.length,
isIndeterminate: this.value.length > 0 && this.value.length < this.list.length,
}
},
watch: {
selectCheckboxGroupValue: {
handler: function (n, o) {
this.$emit('input', n);
}
}
},
methods: {
//全选
handleCheckAllChange (val) {
if (val) {
let arr = []
this.list.forEach(item => {
arr.push(item.value)
})
this.selectCheckboxGroupValue = arr
// console.log(this.selectCheckboxGroupValue )
} else {
this.selectCheckboxGroupValue = []
}
this.isIndeterminate = false;
},
// 一个个选
handleCheckedChange (value) {
let checkedCount = value.length;
this.checkAll = checkedCount === this.list.length;
this.isIndeterminate = checkedCount > 0 && checkedCount < this.list.length;
// console.log(value)
},
},
}
</script>
<style lang="less" scoped>
.el-option {
display: none
}
</style>

View File

@@ -0,0 +1,377 @@
<template>
<div class="pd10">
<div v-if="flag">
<el-form :inline="true" class="demo-form-inline">
<el-form-item>
<el-button @click="AddClick()" type="primary" icon="el-icon-plus">新增</el-button>
</el-form-item>
</el-form>
<el-table
stripe
:data="totalData.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
:height="height"
border
v-loading="isLoading"
style="width: 100%"
header-cell-class-name="table_header"
highlight-current-row
>
<template v-for="(item, index) in tableHeaderTotal">
<el-table-column :prop="item.prop" :label="item.label" :key="index">
<template v-for="(item, index) in item.children">
<el-table-column :prop="item.prop" :label="item.label" :key="index"></el-table-column>
</template>
</el-table-column>
</template>
<el-table-column min-width="200" label="操作">
<template slot-scope="scope">
<el-button @click="QueryClick(scope.row)" type="primary" size="mini" icon="el-icon-view">
模板内容查看
</el-button>
<el-button @click="EditClick(scope.row)" type="primary" size="mini" icon="el-icon-edit">
模板修改
</el-button>
<!-- @click="DeleteClick(scope.row)" -->
<el-button @click="departmentFlag(scope.row)" type="warning" size="mini" icon="el-icon-share">
模板绑定
</el-button>
<el-button @click="DeleteClick(scope.row)" type="danger" size="mini" icon="el-icon-delete">
模板删除
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
align="right"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="currentPage"
:page-sizes="[20, 30, 40, 50, 100]"
:page-size="pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="totalData.length"
class="mt10"
></el-pagination>
</div>
<templateFile
@close="close"
:id="id"
:title="RowName"
:name="formdata.templateName"
:deptId="formdata.deptId"
:reportType="formdata.reportType"
:valList="valList"
v-else
/>
<department
class="mbbd"
:valList="valList"
v-if="dialogVisible"
@handleClose="dialogVisible = false"
@binding="
dialogVisible = false
steady()
"
:dialogVisible="dialogVisible"
/>
</div>
</template>
<script>
import templateFile from '@/views/components/templateFile.vue'
import department from '@/views/components/department.vue'
// import { pvTree } from "@/api/AccountOperation";
import { dicData } from '@/assets/commjs/dictypeData'
import { updateTemplateActive, getTemplateList, delTemplate } from '@/api/templateConfiguration'
export default {
name: 'reportingmanagerdd',
components: { templateFile, department },
data() {
return {
dialogVisible: false,
id: '',
title: '',
flag: true,
vh: '',
form: {},
valList: {},
currentPage: 1,
pageSize: 20,
RowName: '',
classificationData: [],
formdata: {
value: '',
props: '',
valueTitle: '',
accordion: false,
defaultExpandedKey: [],
reportType: '',
//区域
options: [],
default: {
value: 'id',
children: 'children',
label: 'name'
},
templateName: ''
},
height: null,
isLoading: false,
//稳态指标超标统计
tableHeaderTotal: [
{ prop: 'name', label: '模板名称' },
{ prop: 'createBy', label: '创建用户' },
{ prop: 'updateBy', label: '更新用户' },
{ prop: 'createTime', label: '创建时间' },
{ prop: 'updateTime', label: '更新时间' }
],
totalData: [],
device: ''
}
},
created() {
this.getclassificationData()
this.steady()
// this.area();
// this.dictionaries()
},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.device = window.devicePixelRatio
this.height = window.sessionStorage.getItem('appheight') - 98 + 'px'
},
isjh(e) {
updateTemplateActive({ tempId: e.id, deptId: e.deptId }).then(res => {
if (res.message == '修改激活状态,成功') {
this.$message({
message: res.message,
type: 'success'
})
this.steady()
}
})
},
//获取统计类型
getclassificationData() {
var code = 'Report_Type'
this.classificationData = dicData(code, ['Load_Type'])
//console.log(`123`, this.classificationData);
},
area() {
pvTree().then(res => {
// console.log(res);
if (res.code == 'A0000') {
this.formdata.options = res.data
}
})
},
// 切换选项
handleNodeClick(data) {
this.formdata.deptId = data.id
this.$refs.selectTree1.blur()
this.formdata.valueTitle = data.name
this.formdata.defaultExpandedKey = []
},
close() {
this.flag = true
this.steady()
},
QueryClick(val) {
this.id = val.id
this.RowName = '模板内容'
this.flag = false
// this.$router.push({
// name: "CustomReport",
// params: {
// currentYearProportion: val.currentYearProportion
// }
// });
},
EditClick(val) {
this.id = val.id
// this.area();
//console.log(val, "editval");
this.RowName = '修改报表模板'
this.flag = false
this.valList = val
// this.dialogFormVisible = true;
// // console.log(val,'valll');
// this.formdata.valueTitle = val.deptName;
// this.formdata.templateName = val.name;
// this.formdata.createby = val.id;
// this.formdata.deptId = val.deptId;
},
submit(formName) {
this.$refs[formName].validate(valid => {
if (valid) {
this.title = '新增'
this.flag = false
// this.$router.push({
// name: "CustomReport",
// params: { currentYearProportion: this.formdata ,
// RowName: this.RowName},
// });
} else {
//console.log("error submit!!");
return false
}
})
// console.log(this.formdata, "formdata");
},
acceptTree(val) {
// console.log(val, "val");
},
AddClick() {
// this.area();
this.title = '新增'
this.flag = false
this.RowName = '新增报表模板'
},
//方法调用获取稳态指标超标统计数据接口
steady() {
this.isLoading = true
//获取报表模板信息
getTemplateList({}).then(res => {
this.isLoading = false
this.totalData = res.data
this.totalData.forEach(i => {
if (i.activation == 0) {
i.activation = '未激活'
i['isjihuo'] = false
// console.log(i, "iiii");
} else {
i.activation = '激活'
i['isjihuo'] = true
}
})
//console.log(this.totalData, "sdsdsdsdsd");
})
},
handleSizeChange(val) {
// console.log(`每页 ${val} 条`);
this.currentPage = 1
this.pageSize = val
},
//当前页改变时触发 跳转其他页
handleCurrentChange(val) {
//console.log(`当前页: ${val}`);
this.currentPage = val
},
// 刪除
DeleteClick(e) {
this.$confirm('是否删除模板?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
delTemplate({ tempId: e.id, deptId: e.deptId }).then(res => {
this.$message({
type: 'success',
message: '删除成功!'
})
this.steady()
})
})
},
//绑定部门开关
departmentFlag(e) {
this.valList = e
this.dialogVisible = true
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
::v-deep .el-table .cell {
text-align: center;
}
::v-deep .el-tabs--border-card > .el-tabs__content {
padding: 10px;
}
.el-scrollbar .el-scrollbar__view .el-select-dropdown__item {
height: auto;
max-height: 1000px;
padding: 0;
overflow: hidden;
overflow-y: hidden;
}
.el-select-dropdown__item.selected {
font-weight: normal;
}
ul li > .el-tree .el-tree-node__content {
height: auto;
padding: 0 20px;
}
.el-tree-node__label {
font-weight: normal;
}
.el-tree > .is-current .el-tree-node__label {
font-weight: 700;
color: #409eff;
}
.el-tree > .is-current .el-tree-node__children .el-tree-node__label {
font-weight: normal;
color: #606266;
}
.el-popper {
z-index: 9999;
}
.ification_col {
display: inline-block;
width: 20px;
height: 10px;
}
::v-deep .form {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
.el-form-item {
display: flex;
width: 48%;
.el-form-item__content {
flex: 1 !important;
.el-select {
width: 100%;
}
.el-input__inner {
width: 100% !important;
}
.el-date-editor {
width: 100%;
}
}
}
}
::v-deep.mbbd.el-dialog .el-dialog__body {
max-height: 70vh;
padding: 20px 10px 10px 10px !important;
//overflow-y: auto;
}
</style>

View File

@@ -0,0 +1,296 @@
<template>
<div>
<el-card shadow="always" :style="'height:' + vh + 'px'">
<div class="clearfix" slot="header">
<b>
<b>
<!-- <svg-icon icon-class="menu"/> -->
{{ role && role.name ? '【' + role.name + '】' : '' }}资源分配
</b>
</b>
</div>
<el-row>
<el-col :span="12">
<el-tag v-if="role && role.name" size="medium" type="success">{{ role.name }}</el-tag>
<el-tag v-else type="info" size="medium">
<i class="el-icon-info"></i>
请选择角色
</el-tag>
</el-col>
<el-col :span="12" style="text-align: right">
<!-- <el-button :disabled="isRoot" type="primary" icon="el-icon-check" size="mini" @click="handleSubmit">
提交
</el-button> -->
<el-button type="primary" icon="el-icon-check" @click="handleSubmit">提交</el-button>
</el-col>
</el-row>
<el-input placeholder="输入关键字检索" v-model="filterText" clearable>
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<div class="overview_scroll" :style="'margin-top:10px;overflow-y:auto;height:' + vh + 'px'">
<el-select
v-show="false"
v-model="ExpandedNum"
@change="handleExpandNumChange"
placeholder="选择展开级别"
size="mini"
style="width: 100px; left: 0px"
>
<el-option label="不展开" :value="0"></el-option>
<el-option label="展开1" :value="1"></el-option>
<el-option label="展开2" :value="2"></el-option>
<el-option label="展开3" :value="3"></el-option>
</el-select>
<el-tree
:style="'height:' + vhh + 'px'"
ref="menu"
node-key="id"
:default-expanded-keys="expandedKeys"
:data="menuOptions"
:props="defaultProps"
:expand-on-click-node="true"
:highlight-current="true"
:filter-node-method="filterNode"
show-checkbox
accordion
:check-strictly="checkStrictly"
/>
</div>
</el-card>
</div>
</template>
<script>
import { list as listMenu } from '@/api/admin/menu'
import { listRoleMenu, updateRoleMenu } from '@/api/admin/role'
import { gongkey, userfunction } from '@/api/user'
import { passwordConfirm } from '@/api/admin/user'
import { sm3Digest } from '@/assets/commjs/sm3'
import { sm2, encrypt } from '@/assets/commjs/sm2.js'
export default {
name: 'Menu',
watch: {
filterText(val) {
this.$refs.menu.filter(val)
}
},
data() {
return {
vh: null,
vhh: null,
ExpandedNum: 2,
filterText: '',
menuOptions: [],
expandedKeys: [],
role: {},
initialCheckedMenuIds: [], //初始选中值
buttonlist: [],
checkedMenuIds: [],
isRoot: false, // 是否是超级管理员账户
checkStrictly: false,
defaultProps: {
children: 'children',
label: 'title'
}
}
},
created() {
this.loadMenus()
this.vh = window.sessionStorage.getItem('appheight') - 130
},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.loadMenus()
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 10
this.vhh = window.sessionStorage.getItem('appheight') - 170
},
//判断需要展开层级
handleExpandNumChange(menuOptions) {
if (this.ExpandedNum > 0) {
this.setExpandKeys(menuOptions)
}
},
//层级展开递归方法
setExpandKeys(dataList, n) {
if (!n) n = 1
for (let i = 0; i < dataList.length; i++) {
if (n <= this.ExpandedNum) {
//this.expandID=[]
this.expandedKeys.push(`${dataList[i].id}`)
if (dataList[i].hasOwnProperty('children')) {
const children = dataList[i].children
this.setExpandKeys(children, n + 1)
}
}
}
},
//过滤
filterNode(value, data, node) {
if (!value) {
return true
}
let _array = [] //这里使用数组存储 只是为了存储值。
this.getReturnNode(node, _array, value)
let result = false
_array.forEach(item => {
result = result || item
})
return result
},
getReturnNode(node, _array, value) {
let isPass = node.data && node.data.title && node.data.title.indexOf(value) !== -1
isPass ? _array.push(isPass) : ''
this.index++
if (!isPass && node.title != 1 && node.parent) {
this.getReturnNode(node.parent, _array, value)
}
},
loadMenus() {
var arrlist = []
// var arrchildren=[]
var butlist = []
listMenu().then(response => {
this.menuOptions = response.data
this.menuOptions.forEach(m => {
m.children.forEach(n => {
// n.children.forEach(d=>{
this.expandedKeys.push(n.id)
this.handleExpandNumChange(this.menuOptions)
// })
})
})
// this.expandedKeys = this.menuOptions.map(node => node.id) //展开所有节点
})
},
handleSubmit() {
this.$prompt('', '密码二次校验', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^.{6,16}$/,
inputType: 'password',
closeOnClickModal: false,
inputErrorMessage: '长度在 6 到 16 个字符',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
gongkey({ loginName: window.sessionStorage.cnloginname }).then(response => {
if (response.code === 'A0000') {
var publicKey = response.data
// console.log("获取公钥后赋值" + publicKey);
var sm3Pwd = sm3Digest(instance.inputValue) //SM3加密
var jiamipassword = ''
jiamipassword = sm2(sm3Pwd + '|' + instance.inputValue, publicKey, 0) //SM2公钥加密
passwordConfirm(jiamipassword).then(response => {
if (response.code === 'A0000') {
done()
//let data={}
const checkedMenuIds = this.$refs.menu
.getCheckedNodes(false, true)
.map(node => node.id)
// 判断选中菜单ID是否变动
if (
this.initialCheckedMenuIds.length == checkedMenuIds.length &&
this.initialCheckedMenuIds.sort().every(function (v, i) {
return v == checkedMenuIds[i]
})
) {
this.$message.warning('数据未变动')
return
} else {
// console.log(this.role)
// var roleIndex=this.role.roleIndex
// var functionIndexList=checkedMenuIds
var data = {
id: this.role.id,
idList: checkedMenuIds
}
updateRoleMenu(data).then(response => {
// console.log(response.data)
this.$message.success('角色分配资源成功')
})
}
}
})
}
})
} else {
done()
}
}
})
.then(({ value }) => {
})
.catch(() => {})
},
roleClick(role) {
this.role = role
this.$refs.menu.setCurrentKey(null) // 取消菜单高亮
if (role.code == 'root') {
// 如果是超级管理员默认勾选全部且不可编辑
//debugger
this.isRoot = true
this.$refs.menu.setCheckedNodes(this.menuOptions)
// this.$refs.menu.menuClicks(this.menuOptions);
} else {
this.isRoot = false
this.checkStrictly = true
this.initialCheckedMenuIds = []
let p = {
id: role.id
}
listRoleMenu(p).then(response => {
let ids = []
response.data.forEach(item => {
ids.push(item.id)
})
this.initialCheckedMenuIds = ids
// alert(this.initialCheckedMenuIds)
//console.log(this.initialCheckedMenuIds)
this.$refs.menu.setCheckedKeys(this.initialCheckedMenuIds)
this.checkStrictly = false
})
}
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-card__body,
.el-main {
padding: 10px;
// background: #e9ebeb;
}
::v-deep .el-tag:not(.el-tag--dark) {
background-color: #edf8f6;
border-color: #dbf0ed;
color: #4ab5a5;
height: 36px;
line-height: 36px;
}
::v-deep .el-tree {
position: relative;
cursor: default;
/* background: #FFF; */
// color: #323131;
overflow-y: auto;
}
::-webkit-scrollbar {
width: 8px !important;
height: 14px;
}
</style>

View File

@@ -0,0 +1,236 @@
<template>
<div>
<el-card shadow="always" :style="'height:' + vh + 'px'">
<div class="clearfix" slot="header">
<b>
<!-- <svg-icon icon-class="menu"/> -->
{{ role && role.name ? '【' + role.name + '】' : '' }}组件功能分配
</b>
</div>
<el-row>
<el-col :span="18">
<el-tag v-if="role" type="primary" size="medium">{{ role.name }}</el-tag>
<el-tag v-if="menu" type="success" size="medium" style="margin-left: 5px">{{ menu.name }}</el-tag>
<el-tag v-if="!role" type="info" size="medium" style="margin-left: 5px">
<i class="el-icon-info"></i>
请选择角色
</el-tag>
</el-col>
<el-col :span="6" style="text-align: right">
<!-- <el-button type="primary" :disabled="isRoot" icon="el-icon-check" size="mini" @click="submit">提交
</el-button> -->
<el-button type="primary" icon="el-icon-check" @click="submit">提交</el-button>
</el-col>
</el-row>
<el-input placeholder="输入关键字检索" v-model="filterText" clearable>
<i slot="prefix" class="el-input__icon el-icon-search"></i>
</el-input>
<div class="overview_scroll" :style="'margin-top:10px;overflow-y:auto;height:' + vh + 'px'">
<el-tree
:style="'height:' + vhh + 'px'"
ref="per"
:default-expanded-keys="expandedKeys"
:data="menuOptions"
:props="defaultProps"
:filter-node-method="filterNode"
show-checkbox
accordion
node-key="id"
:check-strictly="checkStrictly"
highlight-current
/>
</div>
</el-card>
</div>
</template>
<script>
import { list as listPermission, rolelist } from '@/api/admin/permission'
import { listRolePermission, updateRolePermission } from '@/api/admin/role'
import { gongkey, userfunction } from '@/api/user'
import { sm3Digest } from '@/assets/commjs/sm3'
import { sm2, encrypt } from '@/assets/commjs/sm2.js'
import { componentlists, updatedcomponent, getComponent, passwordConfirm } from '@/api/admin/user'
//onst cityOptions = ['上海', '北京', '广州', '深圳'];
export default {
name: 'Permission',
props: ['type'],
watch: {
filterText(val) {
this.$refs.per.filter(val)
}
},
data() {
return {
vh: null,
vhh: null,
filterText: '',
menuOptions: [],
expandedKeys: [],
menu: undefined,
initialCheckedMenuIds: [], //初始选中值
buttonlist: [],
checkedMenuIds: [],
isRoot: false, // 是否是超级管理员账户
checkStrictly: false,
defaultProps: {
children: 'children',
label: 'name'
},
loading: false,
role: undefined,
}
},
created() {
this.vh = window.sessionStorage.getItem('appheight') - 10
},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
this.handleConpent()
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 10
this.vhh = window.sessionStorage.getItem('appheight') - 170
},
//过滤
filterNode(value, data, node) {
if (!value) {
return true
}
let _array = [] //这里使用数组存储 只是为了存储值。
this.getReturnNode(node, _array, value)
let result = false
_array.forEach(item => {
result = result || item
})
return result
},
getReturnNode(node, _array, value) {
let isPass = node.data && node.data.name && node.data.name.indexOf(value) !== -1
isPass ? _array.push(isPass) : ''
this.index++
if (!isPass && node.name != 1 && node.parent) {
this.getReturnNode(node.parent, _array, value)
}
},
roleClick(role) {
this.role = role
this.$refs.per.setCurrentKey(null) // 取消菜单高亮
if (role.code == 'root') {
// 如果是超级管理员默认勾选全部且不可编辑
this.isRoot = true
this.$refs.per.setCheckedNodes(this.menuOptions)
// this.$refs.menu.menuClicks(this.menuOptions);
} else {
this.isRoot = false
this.checkStrictly = true
this.initialCheckedMenuIds = []
let arr = []
arr.push(role.id)
getComponent(arr).then(response => {
this.initialCheckedMenuIds = response.data
// alert(this.initialCheckedMenuIds)
// console.log(this.initialCheckedMenuIds)
this.$refs.per.setCheckedKeys(this.initialCheckedMenuIds)
this.checkStrictly = false
})
}
},
submit() {
this.$prompt('', '密码二次校验', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^.{6,16}$/,
inputType: 'password',
closeOnClickModal: false,
inputErrorMessage: '长度在 6 到 16 个字符',
beforeClose: (action, instance, done) => {
if (action === 'confirm') {
gongkey({ loginName: window.sessionStorage.cnloginname }).then(response => {
if (response.code === 'A0000') {
var publicKey = response.data
// console.log("获取公钥后赋值" + publicKey);
var sm3Pwd = sm3Digest(instance.inputValue) //SM3加密
var jiamipassword = ''
jiamipassword = sm2(sm3Pwd + '|' + instance.inputValue, publicKey, 0) //SM2公钥加密
passwordConfirm(jiamipassword).then(response => {
if (response.code === 'A0000') {
done()
const checkedMenuIds = this.$refs.per
.getCheckedNodes(false, true)
.map(node => node.id)
// 判断选中菜单ID是否变动
if (
this.initialCheckedMenuIds.length == checkedMenuIds.length &&
this.initialCheckedMenuIds.sort().every(function (v, i) {
return v == checkedMenuIds[i]
})
) {
this.$message.warning('数据未变动')
return
} else {
// console.log(checkedMenuIds)
// var id=this.role.id
//var idList=checkedMenuIds
var data = {
id: this.role.id,
idList: checkedMenuIds
}
updatedcomponent(data).then(response => {
this.$message.success('角色分配组件成功')
})
}
}
})
}
})
} else {
done()
}
}
})
},
handleConpent() {
componentlists().then(response => {
this.menuOptions = response.data
this.expandedKeys = this.menuOptions.map(node => node.id) //展开所有节点
})
}
}
}
</script>
<style lang="scss" scoped>
::v-deep .el-card__body,
.el-main {
padding: 10px;
// background: #abacac;
}
::v-deep .el-tag:not(.el-tag--dark) {
background-color: #edf8f6;
border-color: #dbf0ed;
color: #4ab5a5;
height: 36px;
line-height: 36px;
}
::v-deep .el-tree {
position: relative;
cursor: default;
/* background: #FFF; */
// color: #323131;
overflow-y: auto;
}
::-webkit-scrollbar {
width: 8px !important;
height: 14px;
}
</style>

View File

@@ -0,0 +1,398 @@
<template>
<div>
<el-card shadow="always" :style="'height:' + vh + 'px'">
<div class="clearfix" slot="header">
<b>
<!-- <svg-icon icon-class="" style="color:#fff"/> -->
角色列表
</b>
</div>
<el-form ref="queryForm" :model="queryParams" class="demo-form-inline" :inline="true">
<el-form-item>
<el-button type="primary" size="small" icon="el-icon-plus" @click="roleAdd">新增</el-button>
</el-form-item>
<el-form-item label="筛选数据">
<el-input
size="small"
v-model="search"
placeholder="请输入匹配数据"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item>
<el-button type="primary" plain icon="el-icon-search" @click="handleQuery">搜索
</el-button>
</el-form-item> -->
</el-form>
<el-table
stripe
ref="roleTable"
v-loading="loading"
:data="tables"
header-cell-class-name="table_header"
@selection-change="handleSelectionChange"
@row-click="handleRowClick"
border
:height="vhh"
highlight-current-row
>
<!-- <el-table-column align="center" type="selection" width="55"></el-table-column> -->
<el-table-column align="center" label="角色名称" prop="name" min-width="140" />
<el-table-column align="center" label="角色编码" prop="code" min-width="100" />
<el-table-column align="center" label="角色描述" prop="remark" min-width="100" />
<!-- <el-table-column align="center" label="更新时间" prop="updateTime">
<template slot-scope="scope">{{ scope.row.updateTime | formatDate }}</template>
</el-table-column> -->
<el-table-column align="center" label="角色状态" prop="state" min-width="80">
<template slot-scope="scope">
<sapn type="danger" size="mini" v-if="scope.row.state === 0">注销</sapn>
<sapn type="success" size="mini" v-if="scope.row.state === 1">正常</sapn>
</template>
</el-table-column>
<el-table-column label="操作" align="center" width="200">
<template slot-scope="scope">
<el-button
type="primary"
size="mini"
icon="el-icon-edit"
@click.stop="handleEdit(scope.row)"
v-if="scope.row.state === 1"
>
修改
</el-button>
<el-button
type="danger"
size="mini"
icon="el-icon-delete"
v-if="scope.row.state === 1"
@click.stop="handleDelete(scope.row)"
>
删除
</el-button>
</template>
</el-table-column>
</el-table>
<!-- <el-pagination
style="float: right;margin-top:10px"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pagination.current"
:page-sizes="[5, 10, 15]"
:page-size="pagination.size"
layout="total, sizes, prev, pager, next, jumper"
:total="pagination.total">
</el-pagination> -->
<!-- 角色弹窗 -->
<el-dialog
:close-on-click-modal="false"
:title="rowName"
:visible.sync="dialogVisible"
width="30%"
:before-close="closeDialog"
>
<el-form ref="form" :model="formData" :rules="rules" label-width="90px">
<el-form-item label="角色名称:" prop="name">
<el-input v-model="formData.name" placeholder="请输入角色名称" />
</el-form-item>
<el-form-item label="角色编码:" class="top" prop="code">
<el-input v-model="formData.code" placeholder="请输入角色编码" />
</el-form-item>
<el-form-item label="角色描述:" class="top" prop="roleDescription">
<el-input
@focus="checkStart"
@blur="checkEnd"
type="textarea"
v-model="formData.remark"
placeholder="请输入中文描述"
/>
</el-form-item>
<!-- <el-form-item label="状态">
<el-radio-group v-model="formData.state">
<el-radio :label="1">正常</el-radio>
<el-radio :label="0">停用</el-radio>
</el-radio-group>
</el-form-item> -->
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="closeDialog"> </el-button>
<el-button type="primary" @click="handleSubmit"> </el-button>
</div>
</el-dialog>
</el-card>
</div>
</template>
<script>
import { list, update, add, deleteRole, getByIdroel, panduan, del, selecRoleDetail } from '@/api/admin/role'
export default {
name: 'Role',
computed: {
// 实时监听表格
tables: function () {
const search = this.search
if (search) {
return this.pageList.filter(dataNews => {
return Object.keys(dataNews).some(key => {
return String(dataNews[key]).toLowerCase().indexOf(search) > -1
})
})
}
return this.pageList
}
},
filters: {
formatDate: function (value) {
//这里的 value 就是需要过滤的数据
var date = new Date(value)
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var hours = date.getHours()
var minutes = date.getMinutes()
var seconds = date.getSeconds()
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
}
},
data() {
return {
search: '',
vh: null,
vhh: null,
dialogVisible: false,
rowName: '新增角色',
t: undefined,
checkedRoleId: undefined,
forbidden: true,
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
queryParams: {
queryMode: 'page',
name: undefined
},
pagination: {
current: 1,
size: 15,
total: 0
},
pageList: [],
dialog: {
title: undefined,
visible: false
},
// 表单参数
formData: {
code: '',
name: '',
remark: '',
type: undefined
},
checkInterval: '',
// 表单校验
rules: {
name: [{ required: true, message: '角色名称不能为空', trigger: 'blur' }],
code: [{ required: true, message: '角色编码不能为空', trigger: 'blur' }]
}
}
},
created() {
this.handleQuery2()
},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 10
this.vhh = window.sessionStorage.getItem('appheight') - 132
},
checkChinese() {
this.form.roleDescription = this.form.roleDescription.replace(/[^\u4E00-\u9FA5]/g, '')
},
checkStart() {
this.checkInterval = setInterval(this.checkChinese, 100)
},
checkEnd() {
clearInterval(this.checkInterval)
},
handleSizeChange(val) {
this.pagination.size = val
this.handleQuery()
},
handleCurrentChange(val) {
//console.log(`当前页: ${val}`);
this.pagination.current = val
this.handleQuery()
},
//查询
handleQuery() {
this.queryParams.page = this.pagination.current
this.queryParams.limit = this.pagination.size
var p = {
orderBy: '',
pageNum: 0,
pageSize: 0,
searchBeginTime: '',
searchEndTime: '',
searchState: 0,
searchValue: '',
sortBy: ''
}
list(p).then(response => {
this.pageList = response.data.records
//this.pagination.total = response.total
this.loading = false
})
},
handleQuery2() {
var data = {
id: window.sessionStorage.getItem('type')
}
selecRoleDetail(data).then(response => {
this.pageList = response.data
//this.pagination.total = response.total
this.loading = false
})
},
//新增
roleAdd() {
this.t = 'add'
this.dialogVisible = true
this.formData = {
code: '',
name: '',
remark: '',
type: undefined
}
var usertype = window.sessionStorage.getItem('type')
if (usertype == '0') {
this.formData.type = 1
}
if (usertype == '1') {
this.formData.type = 2
}
},
handleSelectionChange(selection) {
this.ids = selection.map(item => item.functionIindex)
this.single = selection.length != 1
this.multiple = !selection.length
},
handleAdd() {
this.resetForm()
this.dialog = {
title: '新增角色',
visible: true
}
},
handleEdit(row) {
this.t = 'edit'
this.rowName = '修改角色'
this.dialogVisible = true
this.formData = {
id: row.id,
code: row.code,
name: row.name,
remark: row.remark
}
},
handleDelete(row) {
var arr = []
var id = row.id
arr.push(id)
panduan(arr).then(response => {
this.$confirm('确认删除该角色吗?', '警告', {
confirmButtonText: '删除',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
del(arr).then(response => {
if (response.code == 'A0000') {
this.$message.success('删除成功')
this.handleQuery2()
this.checkedRoleId = row.id // 勾选行
const currentRow = JSON.parse(JSON.stringify(row))
this.$emit('roleClick', currentRow)
}
})
})
.catch(() => this.$message.info('已取消删除'))
})
},
handleSubmit() {
if (this.t == 'add') {
add(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('新增成功')
this.handleQuery2()
this.dialogVisible = false
}
})
}
if (this.t == 'edit') {
update(this.formData).then(response => {
if (response.code == 'A0000') {
this.$message.success('修改成功')
this.handleQuery2()
this.dialogVisible = false
}
})
}
},
resetForm() {
this.form = {
sort: 1,
status: 1
}
if (this.$refs['form']) {
this.$refs['form'].resetFields()
}
},
closeDialog() {
this.resetForm()
this.dialogVisible = false
},
handleRowClick(row) {
this.checkedRoleId = row.id // 勾选行
const currentRow = JSON.parse(JSON.stringify(row))
this.$emit('roleClick', currentRow)
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../../styles/comStyle.less');
</style>
<style lang="scss" scoped>
::v-deep .el-card__body,
.el-main {
padding: 10px;
// background: #e9ebeb;
}
::v-deep .el-tag:not(.el-tag--dark) {
background-color: #edf8f6;
border-color: #dbf0ed;
color: #4ab5a5;
height: 36px;
line-height: 36px;
}
::-webkit-scrollbar {
width: 8px !important;
height: 14px;
}
</style>

View File

@@ -0,0 +1,60 @@
<template>
<div class="pd10">
<el-row :gutter="10">
<el-col :span="12" :xs="24">
<role ref="role" @roleClick="roleClick"></role>
</el-col>
<el-col :span="6" :xs="24">
<menus ref="menu" v-loading="loading" @menuClick="menuClick"></menus>
</el-col>
<el-col :span="6" :xs="24">
<permission v-loading="loading" ref="per"></permission>
</el-col>
</el-row>
</div>
</template>
<script>
import Role from "./components/Role";
import Menus from "./components/Menu";
import Permission from "./components/Permission";
export default {
name: "rolesmanagement",
components: { Role, Menus, Permission },
data() {
return {
role: undefined,
menu: undefined,
loading: false,
checkedMenuIds: [],
};
},
methods: {
roleClick(role) {
this.loading = true;
this.role = role;
this.menu = undefined;
this.$refs.menu.roleClick(role);
this.$refs.per.roleClick(role);
setTimeout(() => {
this.loading = false;
}, 1000);
// this.$refs.permission.resClick(this.menu, this.role)
},
menuClick(menu, checkedMenuIds) {
if (!this.role) {
this.$message.warning("请选择角色");
return;
}
this.menu = menu;
this.$refs.permission.menuClick(this.menu, this.role, checkedMenuIds);
},
},
};
</script>
<style lang="less" scoped>
@import url("../../../../styles/comStyle.less");
</style>

View File

@@ -0,0 +1,224 @@
<template>
<div class="app-container pd10">
<el-row :gutter="40">
<el-col :span="24" :xs="24">
<el-form ref="queryForm" :inline="true" :model="queryParams" label-width="68px" size="small">
<el-form-item>
<el-button icon="el-icon-check" type="primary" @click="handleAuditSubmit">审核用户</el-button>
</el-form-item>
</el-form>
<el-table
stripe
highlight-current-row
element-loading-text="数据载入中"
tooltip-effect="dark"
@selection-change="handleSelectionChange"
header-cell-class-name="table_header"
:height="vh + 'px'"
border
:data="tables"
>
<el-table-column align="center" type="selection" width="65" prop="userIndex"></el-table-column>
<el-table-column align="center" label="名称" prop="name" />
<el-table-column align="center" label="登录名" prop="loginName" />
<el-table-column align="center" label="角色" :formatter="gName" prop="role" />
<el-table-column align="center" label="部门" prop="deptId" />
<el-table-column align="center" label="电话" prop="phone" />
<el-table-column align="center" label="注册时间" :show-overflow-tooltip="true" prop="registerTime">
<template slot-scope="scope">{{ scope.row.registerTime | formatDate }}</template>
</el-table-column>
<el-table-column align="center" label="类型" prop="casualUser" width="100">
<template slot-scope="scope">
<span v-if="scope.row.casualUser === 0" type="primary" size="small">临时用户</span>
<span v-if="scope.row.casualUser === 1" type="success" size="small">长期用户</span>
</template>
</el-table-column>
<el-table-column align="center" label="状态" prop="state" width="150">
<template>
<span type="warning" size="small">待审核</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="260">
<template slot-scope="scope">
<el-button
type="primary"
icon="el-icon-check"
size="mini"
@click.stop="handleAudit(scope.row)"
>
审核通过
</el-button>
<el-button type="primary" size="mini" @click.stop="handleDelete(scope.row)">
审核不通过
</el-button>
</template>
</el-table-column>
</el-table>
<el-pagination
background
class="mt10"
align="right"
v-show="page.total > 0"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="page.current"
:page-sizes="[5, 10, 15]"
:page-size="page.size"
layout="total, sizes, prev, pager, next, jumper"
:total="page.total"
></el-pagination>
</el-col>
</el-row>
</div>
</template>
<script>
import { listsh, checkUser } from '@/api/admin/user'
import { gongkey } from '@/api/user'
import { sm3Digest } from '@/assets/commjs/sm3'
import { sm2, encrypt } from '@/assets/commjs/sm2.js'
export default {
computed: {
// 实时监听表格
tables: function () {
const search = this.search
if (search) {
return this.pageList.filter(dataNews => {
return Object.keys(dataNews).some(key => {
return String(dataNews[key]).toLowerCase().indexOf(search) > -1
})
})
}
return this.pageList
}
},
filters: {
formatDate: function (value) {
//这里的 value 就是需要过滤的数据
var date = new Date(value)
var year = date.getFullYear()
var month = date.getMonth() + 1
var day = date.getDate()
var hours = date.getHours()
var minutes = date.getMinutes()
var seconds = date.getSeconds()
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds
}
},
data() {
return {
// 遮罩层
vh: null,
loading: true,
queryParams: {
casualUser: 0,
orderBy: '',
searchBeginTime: '',
searchEndTime: '',
searchState: 0,
searchValue: '',
sortBy: ''
},
page: {
current: 1,
size: 15,
total: 0
},
pageList: [],
multipleSelection: []
}
},
created() {
this.loadData()
},
mounted() {
this.setHeight()
window.addEventListener('resize', this.setHeight)
},
beforeDestroy() {
window.removeEventListener('resize', this.setHeight)
},
methods: {
setHeight() {
this.vh = window.sessionStorage.getItem('appheight') - 106
},
gName(row, column) {
var gNamelist = []
for (var i = 0; i < row.role.length; i++) {
gNamelist.push(row.role[i])
}
return gNamelist.join()
},
loadData() {
this.handleQuery()
},
handleQuery() {
this.queryParams.pageNum = this.page.current
this.queryParams.pageSize = this.page.size
listsh(this.queryParams).then(response => {
if (response.code === 'A0000') {
const { data } = response
this.pageList = data.records
this.page.total = data.total
this.page.size = data.pageSize
this.loading = false
}
if (response.code === 'A0110') {
this.$message.success('暂无用户')
const { data, total } = response
this.pageList = []
this.loading = false
}
})
},
handleSizeChange(val) {
this.page.size = val
this.handleQuery()
},
handleCurrentChange(val) {
this.page.current = val
this.handleQuery()
},
handleUnlock(row) {},
handleReset() {},
submint() {},
handleSelectionChange(val) {
this.multipleSelection = val
// alert(val)
console.log(val)
},
handleAudit(row) {
// alert('审核')
let arr = []
let id = row.id
arr.push(id)
checkUser(arr).then(response => {
if (response.code === 'A0000') {
this.$message({ message: response.message, type: 'success' })
}
this.handleQuery()
})
},
handleDelete() {
// alert('删除')
},
handleAuditSubmit() {
// alert('批量提交')
var arr = []
for (var i = 0; i < this.multipleSelection.length; i++) {
arr.push(this.multipleSelection[i].id)
}
checkUser(arr).then(response => {
if (response.code === 'A0000') {
this.$message({ message: response.message, type: 'success' })
}
this.handleQuery()
})
}
}
}
</script>
<style lang="less" scoped>
@import url('../../../../styles/comStyle.less');
</style>

File diff suppressed because it is too large Load Diff