Merge branch 'gin-vue-admin_v2_dev' of

https://github.com/flipped-aurora/gin-vue-admin into
gin-vue-admin_v2_dev
This commit is contained in:
klausY
2020-05-20 17:44:50 +08:00
63 changed files with 367 additions and 349 deletions
+1 -1
View File
@@ -1039,4 +1039,4 @@ li {
width: 10px;
}
}
}
}
+22 -23
View File
@@ -2,24 +2,24 @@
<div class="hello">
<el-divider content-position="left">大文件上传</el-divider>
<form id="fromCont" method="post" >
<div class="fileUpload">
选择文件<input @change="choseFile" id="file" multiple="multiple" type="file" />
<div class="fileUpload" @click="inputChange">
选择文件
<input v-show="false" @change="choseFile" id="file" multiple="multiple" type="file" ref="Input" />
</div>
</form>
<el-button @click="getFile" :disabled="limitFileSize" type="primary" size="medium" class="uploadBtn">上传文件</el-button>
<div class="el-upload__tip">请上传不超过5MB的文件</div>
<div class="list">
<transition-group name="list" tag="p">
<div class="list-item" v-for="item in uploadList" :key="item.name" >
<transition name="list" tag="p">
<div class="list-item" v-if="file" >
<i class="el-icon-document"></i>
<span>{{ item.name }}</span>
<span v-if="file" class="percentage" >{{percentage}}%</span>
<span>{{ file.name }}</span>
<span class="percentage" >{{percentage}}%</span>
<el-progress :show-text='false' :text-inside="false" :stroke-width="2" :percentage="percentage"></el-progress>
</div>
</transition-group>
</transition>
</div>
<!-- <span
<!-- <span
v-if="this.file"
>{{Math.floor(((this.formDataList.length-this.waitNum)/this.formDataList.length)*100)}}%</span> -->
<div class="tips">此版本为先行体验功能测试版样式美化和性能优化正在进行中上传切片文件和合成的完整文件分别再QMPlusserver目录的breakpointDir文件夹和fileDir文件夹</div>
@@ -45,8 +45,7 @@ export default {
limitFileSize: false,
percentage:0,
percentageFlage: true,
customColor: '#409eff',
uploadList:[]
customColor: '#409eff'
}
},
created(){
@@ -59,6 +58,7 @@ export default {
const file = e.target.files[0] // 获取当前文件
const maxSize = 5*1024*1024
this.file = file // file 丢全局方便后面用 可以改进为func传参形式
this.percentage = 0
if(file.size<maxSize){
fileR.readAsArrayBuffer(file) // 把文件读成ArrayBuffer 主要为了保持跟后端的流一致
fileR.onload = async e => {
@@ -123,9 +123,6 @@ export default {
this.percentageFlage = false
}
this.sliceFile() // 上传切片
if(this.percentage == 100){
this.uploadList.push(this.file)
}
},
sliceFile() {
this.waitUpLoad &&
@@ -164,6 +161,9 @@ export default {
await removeChunk(params)
}
}
},
inputChange(){
this.$refs.Input.dispatchEvent(new MouseEvent('click'))
}
}
}
@@ -198,15 +198,14 @@ a {
border-radius: 4px;
overflow: hidden;
display: inline-block;
input{
position: absolute;
font-size: 100px;
right: 0;
top: 0;
opacity: 0;
cursor: pointer;
}
input{
position: absolute;
font-size: 100px;
right: 0;
top: 0;
opacity: 0;
cursor: pointer;
}
}
.fileName{
display: inline-block;
+1 -1
View File
@@ -22,7 +22,7 @@
<el-table-column label="姓名" prop="customerName" width="120"></el-table-column>
<el-table-column label="电话" prop="customerPhoneData" width="120"></el-table-column>
<el-table-column label="接入人ID" prop="sysUserId" width="120"></el-table-column>
<el-table-column label="按钮组">
<el-table-column label="按钮组" min-width="160">
<template slot-scope="scope">
<el-button @click="updateCustomer(scope.row)" size="small" type="text">变更</el-button>
<el-popover placement="top" width="160" v-model="scope.row.visible">
+4 -4
View File
@@ -16,14 +16,14 @@
</el-table-column>
<el-table-column label="姓名" prop="name" width="120"></el-table-column>
<el-table-column label="年龄" prop="age" width="120"></el-table-column>
<el-table-column label="住址" prop="address" show-overflow-tooltip></el-table-column>
<el-table-column label="是否禁用" prop="switch">
<el-table-column label="住址" prop="address" min-width="200" show-overflow-tooltip></el-table-column>
<el-table-column label="是否禁用" prop="switch" width="180">
<template slot-scope="scope">
<el-switch active-text="开启" inactive-text="禁用" v-model="scope.row.switch"></el-switch>
</template>
</el-table-column>
<el-table-column label="按钮组">
<template slot-scope="scope">
<el-table-column label="按钮组" width="200">
<template slot-scope="scope" >
<el-button type="text" size="small" @click="toggleSelection([scope.row])">按钮1</el-button>
<el-button type="text" size="small" @click="toggleSelection([scope.row])">按钮2</el-button>
<el-button type="text" size="small" @click="toggleSelection([scope.row])">按钮3</el-button>
+2 -2
View File
@@ -35,7 +35,7 @@
prop="name"
width="180"
></el-table-column>
<el-table-column label="链接" prop="url"></el-table-column>
<el-table-column label="链接" prop="url" min-width="300"></el-table-column>
<el-table-column label="标签" prop="tag" width="100">
<template slot-scope="scope">
<el-tag
@@ -45,7 +45,7 @@
>
</template>
</el-table-column>
<el-table-column label="操作" width="100">
<el-table-column label="操作" width="160">
<template slot-scope="scope">
<el-button @click="downloadFile(scope.row)" size="small" type="text"
>下载</el-button
@@ -13,7 +13,7 @@
>
<el-table-column label="角色id" min-width="180" prop="authorityId"></el-table-column>
<el-table-column label="角色名称" min-width="180" prop="authorityName"></el-table-column>
<el-table-column fixed="right" label="操作" min-width="300">
<el-table-column fixed="right" label="操作" width="460">
<template slot-scope="scope">
<el-button @click="opdendrawer(scope.row)" size="small" type="text">设置权限</el-button>
<el-button @click="addAuthority(scope.row.authorityId)" size="small" type="text">新增子角色</el-button>
+121 -97
View File
@@ -8,6 +8,7 @@
<el-table :data="tableData" border row-key="ID" stripe>
<el-table-column label="ID" min-width="100" prop="ID"></el-table-column>
<el-table-column label="路由Name" min-width="160" prop="name"></el-table-column>
<el-table-column label="路由Path" min-width="160" prop="path"></el-table-column>
<el-table-column label="是否隐藏" min-width="100" prop="hidden">
<template slot-scope="scope">
<span>{{scope.row.hidden?"隐藏":"显示"}}</span>
@@ -36,17 +37,36 @@
</el-table-column>
</el-table>
<el-dialog :before-close="handleClose" :visible.sync="dialogFormVisible" :title="dialogTitle">
<el-dialog :before-close="handleClose" :title="dialogTitle" :visible.sync="dialogFormVisible">
<el-form
:inline="true"
:model="form"
:rules="rules"
label-position="top"
label-width="85px"
ref="menuForm"
label-position="top"
>
<el-form-item label="路由name" prop="path" style="width:30%">
<el-input autocomplete="off" placeholder="唯一英文字符串" v-model="form.path"></el-input>
<el-input
@change="changeName"
autocomplete="off"
placeholder="唯一英文字符串"
v-model="form.name"
></el-input>
</el-form-item>
<el-form-item prop="path" style="width:30%">
<div style="display:inline-block" slot="label">
路由path
<el-checkbox style="float:right;margin-left:20px;" v-model="checkFlag">添加参数</el-checkbox>
</div>
<el-input
:disabled="!checkFlag"
autocomplete="off"
placeholder="建议只在后方拼接参数"
v-model="form.path"
></el-input>
</el-form-item>
<el-form-item label="是否隐藏" style="width:30%">
<el-select placeholder="是否在列表隐藏" v-model="form.hidden">
@@ -57,11 +77,11 @@
<el-form-item label="父节点Id" style="width:30%">
<el-cascader
:disabled="!this.isEdit"
v-model="form.parentId"
:options="menuOption"
:show-all-levels="false"
:props="{ checkStrictly: true,label:'title',value:'ID',disabled:'disabled',emitPath:false}"
:show-all-levels="false"
filterable
v-model="form.parentId"
></el-cascader>
</el-form-item>
<el-form-item label="文件路径" prop="component" style="width:30%">
@@ -72,7 +92,7 @@
</el-form-item>
<el-form-item label="图标" prop="meta.icon" style="width:30%">
<icon :meta="form.meta">
<template slot="prepend" >el-icon-</template>
<template slot="prepend">el-icon-</template>
</icon>
</el-form-item>
<el-form-item label="排序标记" prop="sort" style="width:30%">
@@ -103,203 +123,207 @@ import {
addBaseMenu,
deleteBaseMenu,
getBaseMenuById
} from "@/api/menu";
import infoList from "@/components/mixins/infoList";
import icon from '@/view/superAdmin/menu/icon';
} from '@/api/menu'
import infoList from '@/components/mixins/infoList'
import icon from '@/view/superAdmin/menu/icon'
export default {
name: "Menus",
name: 'Menus',
mixins: [infoList],
data() {
return {
checkFlag: false,
listApi: getMenuList,
dialogFormVisible: false,
dialogTitle: "新增菜单",
dialogTitle: '新增菜单',
menuOption: [
{
ID: "0",
title: "根菜单"
ID: '0',
title: '根菜单'
}
],
form: {
ID: 0,
path: "",
name: "",
hidden: "",
parentId: "",
component: "",
path: '',
name: '',
hidden: '',
parentId: '',
component: '',
meta: {
title: "",
icon: "",
title: '',
icon: '',
defaultMenu: false,
keepAlive: false
}
},
rules: {
path: [{ required: true, message: "请输入菜单name", trigger: "blur" }],
path: [{ required: true, message: '请输入菜单name', trigger: 'blur' }],
component: [
{ required: true, message: "请输入文件路径", trigger: "blur" }
{ required: true, message: '请输入文件路径', trigger: 'blur' }
],
"meta.title": [
{ required: true, message: "请输入菜单展示名称", trigger: "blur" }
'meta.title': [
{ required: true, message: '请输入菜单展示名称', trigger: 'blur' }
]
},
isEdit: false,
test:''
};
test: ''
}
},
components:{
components: {
icon
},
methods: {
changeName() {
this.form.path = this.form.name
},
setOptions() {
this.menuOption = [
{
ID: "0",
title: "根目录"
ID: '0',
title: '根目录'
}
];
this.setMenuOptions(this.tableData, this.menuOption, false);
]
this.setMenuOptions(this.tableData, this.menuOption, false)
},
setMenuOptions(menuData, optionsData, disabled) {
menuData &&
menuData.map(item => {
if (item.children&&item.children.length) {
if (item.children && item.children.length) {
const option = {
title: item.meta.title,
ID: String(item.ID),
disabled: disabled || item.ID == this.form.ID,
children: []
};
}
this.setMenuOptions(
item.children,
option.children,
disabled || item.ID == this.form.ID
);
optionsData.push(option);
)
optionsData.push(option)
} else {
const option = {
title: item.meta.title,
ID: String(item.ID),
disabled: disabled || item.ID == this.form.ID
};
optionsData.push(option);
}
optionsData.push(option)
}
});
})
},
handleClose(done) {
this.initForm();
done();
this.initForm()
done()
},
// 懒加载子菜单
load(tree, treeNode, resolve) {
resolve([
{
id: 31,
date: "2016-05-01",
name: "王小虎",
address: "上海市普陀区金沙江路 1519 弄"
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
},
{
id: 32,
date: "2016-05-01",
name: "王小虎",
address: "上海市普陀区金沙江路 1519 弄"
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}
]);
])
},
// 删除菜单
deleteMenu(ID) {
this.$confirm("此操作将永久删除所有角色下该菜单, 是否继续?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
this.$confirm('此操作将永久删除所有角色下该菜单, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(async () => {
const res = await deleteBaseMenu({ ID });
const res = await deleteBaseMenu({ ID })
if (res.code == 0) {
this.$message({
type: "success",
message: "删除成功!"
});
this.getTableData();
type: 'success',
message: '删除成功!'
})
this.getTableData()
}
})
.catch(() => {
this.$message({
type: "info",
message: "已取消删除"
});
});
type: 'info',
message: '已取消删除'
})
})
},
// 初始化弹窗内表格方法
initForm() {
this.$refs.menuForm.resetFields();
this.checkFlag = false
this.$refs.menuForm.resetFields()
this.form = {
ID: 0,
path: "",
name: "",
hidden: "",
parentId: "",
component: "",
path: '',
name: '',
hidden: '',
parentId: '',
component: '',
meta: {
title: "",
icon: "",
title: '',
icon: '',
defaultMenu: false,
keepAlive: ""
keepAlive: ''
}
};
}
},
// 关闭弹窗
closeDialog() {
this.initForm();
this.dialogFormVisible = false;
this.initForm()
this.dialogFormVisible = false
},
// 添加menu
async enterDialog() {
this.$refs.menuForm.validate(async valid => {
if (valid) {
let res;
this.form.name = this.form.path;
let res
if (this.isEdit) {
res = await updateBaseMenu(this.form);
res = await updateBaseMenu(this.form)
} else {
res = await addBaseMenu(this.form);
res = await addBaseMenu(this.form)
}
if (res.code == 0) {
this.$message({
type: "success",
message: this.isEdit ? "编辑成功" : "添加成功!"
});
this.getTableData();
type: 'success',
message: this.isEdit ? '编辑成功' : '添加成功!'
})
this.getTableData()
}
this.initForm();
this.dialogFormVisible = false;
this.initForm()
this.dialogFormVisible = false
}
});
})
},
// 添加菜单方法,id为 0则为添加根菜单
addMenu(id) {
this.dialogTitle = "新增菜单";
this.form.parentId = String(id);
this.isEdit = false;
this.setOptions();
this.dialogFormVisible = true;
this.dialogTitle = '新增菜单'
this.form.parentId = String(id)
this.isEdit = false
this.setOptions()
this.dialogFormVisible = true
},
// 修改菜单方法
async editMenu(id) {
this.dialogTitle = "编辑菜单";
const res = await getBaseMenuById({ id });
this.form = res.data.menu;
this.isEdit = true;
this.setOptions();
this.dialogFormVisible = true;
this.dialogTitle = '编辑菜单'
const res = await getBaseMenuById({ id })
this.form = res.data.menu
this.isEdit = true
this.setOptions()
this.dialogFormVisible = true
}
},
async created() {
this.pageSize = 999;
await this.getTableData();
this.pageSize = 999
await this.getTableData()
}
};
}
</script>
<style scoped lang="scss">
.button-box {