Commit 00ddc6aa authored by Kimber's avatar Kimber
parents 99d46dd4 2937edc9
import request from '@/utils/request' import request from '@/utils/request'
export default { export default {
/**
* 用户-文件夹 权限分配
*/
// 获取用户List
getDataList4User: (pageParam) => {
return request({
url: 'api/users',
method: 'get',
params: pageParam
})
},
saveFolderAuth: (data) => {
return request({
url: 'api/document-catalogue',
method: 'post',
data
})
},
/**
* 目录-文件 显示页面
* @param {*} pageParam
* @returns
*/
// 获取所有目录 // 获取所有目录
getDataList: (pageParam) => { getDataList: (pageParam) => {
return request({ return request({
...@@ -26,6 +53,7 @@ export default { ...@@ -26,6 +53,7 @@ export default {
}) })
}, },
// 修改文件夹名称: (iotNormalMachine) => { // 修改文件夹名称: (iotNormalMachine) => {
updateFolder: (data) => { updateFolder: (data) => {
return request({ return request({
url: 'api/document-catalogue', url: 'api/document-catalogue',
......
<template>
<div class="app-container">
<el-row :gutter="15">
<!-- 用户列表 -->
<el-col :span="10">
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<el-input
v-model="query.blurry"
size="small"
clearable
placeholder="用户名/昵称"
style="width: 200px"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/>
<el-button type="primary" size="mini">查询</el-button>
</div>
<el-table
ref="table"
style="width: 100%"
:data="dataList"
@current-change="handleCurrentChange4table"
>
<el-table-column prop="nickName" label="昵称" align="center" />
<el-table-column prop="username" label="用户名" align="center" />
</el-table>
<!--分页组件-->
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 30, 40]"
:page-size="size"
layout="total, sizes, prev, pager, next, jumper"
:total="totalElement"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</el-col>
<!-- 文件夹授权 -->
<el-col :span="12" style="margin-bottom: 10px">
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<el-button
type="primary"
@click="saveFolderAuth"
:loading="menuLoading"
>保存</el-button
>
</div>
<el-tree
ref="menu"
:data="folders"
:props="defaultProps"
check-strictly
accordion
node-key="id"
default-expand-all
:expand-on-click-node="false"
>
<div class="custom-tree-node" slot-scope="{ node, data }">
<span>{{ node.label }}</span>
<el-button
:type="`${data.editWhether ? 'primary' : 'default'}`"
icon="el-icon-edit"
circle
size="mini"
style="margin-left: 40px"
@click="data.editWhether = true"
></el-button>
<el-button
:type="`${data.deleteWhether ? 'primary' : 'default'}`"
icon="el-icon-delete"
circle
size="mini"
@click="data.deleteWhether = true"
></el-button>
<el-button
:type="`${data.uploadWhether ? 'primary' : 'default'}`"
icon="el-icon-upload2"
circle
size="mini"
@click="data.uploadWhether = true"
></el-button>
<el-button
:type="`${data.downloadWhether ? 'primary' : 'default'}`"
icon="el-icon-download"
circle
size="mini"
@click="data.downloadWhether = true"
></el-button>
</div>
</el-tree>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script>
import edocApi from "@/api/kd/edoc";
import DateRangePicker from "@/components/DateRangePicker";
export default {
name: "Folder",
components: {
DateRangePicker,
},
data() {
return {
query: {
blurry: "",
},
dataList: [],
totalElement: 0,
page: 0,
size: 10,
defaultProps: { children: "children", label: "name", isLeaf: "leaf" },
currentUserId: 0,
currentName: "",
menuLoading: false,
showButton: false,
folders: [],
menuIds: [],
};
},
computed: {},
mounted() {
this.getDataList4User(); // 获取所有文件夹
},
created() {},
methods: {
// 触发单选
handleCurrentChange4table(val, oldVal) {
if (val) {
const loading = this.$loading({
fullscreen: false,
text: "加载中...",
background: "transparent",
});
this.currentUserId = val.id
// this.dataList = [];
this.getFolderByUserId();
loading.close();
}
},
// 当前页的条数变化
handleSizeChange(val) {
this.size = val;
this.getDataList4User();
},
// 当前第几页
handleCurrentChange(val) {
this.page = val;
this.getFolderByUserId();
},
getDataList4User() {
edocApi
.getDataList4User({
page: this.page,
size: this.size,
fluzz: this.query.fluzz,
})
.then((res) => {
console.log("res", res);
this.dataList = res.content;
});
},
getFolderByUserId() {
edocApi.getDataList({
userId: this.currentUserId,
}).then((res) => {
this.folders = res.body;
});
// edocApi
// .getFolderByUserId({
// userId: this.currentUserId,
// })
// .then((res) => {
// this.folders = res.body;
// });
},
confirmFolder() {
if (!this.currentFolderId) {
this.$message.warning("请选择文件夹");
return;
}
this.$refs["folderForm"].validate((valid) => {
if (valid) {
edocApi
.addFolder({
...this.folderForm,
pid: this.currentFolderId,
})
.then((res) => {
this.$message.success("操作成功");
this.getDataList4User();
});
}
});
},
// 保存菜单
saveFolderAuth() {
if (!this.currentUserId) {
this.$message.warning("请选择用户");
return;
}
const loading = this.$loading({
fullscreen: false,
text: "处理中...",
background: "transparent",
});
edocApi
.saveFolderAuth({
data: this.folders,
})
.then(() => {
this.$message.success("操作成功");
this.menuLoading = false;
})
.catch((err) => {
this.menuLoading = false;
});
loading.close()
},
},
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
</style>
\ No newline at end of file
<template> <template>
<div class="app-container"> <div class="app-container">
<!--工具栏--> <!-- 新增编辑文件夹窗口 -->
<!-- 表单渲染 --> <el-dialog
<el-dialog append-to-body :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="520px">
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="角色名称" prop="name">
<el-input v-model="form.name" style="width: 380px;" />
</el-form-item>
<el-form-item label="角色级别" prop="level">
<el-input-number v-model.number="form.level" :min="1" controls-position="right" style="width: 145px;" />
</el-form-item>
<el-form-item label="数据范围" prop="dataScope">
<el-select v-model="form.dataScope" style="width: 140px" placeholder="请选择数据范围" @change="changeScope">
<el-option
v-for="item in dateScopes"
:key="item"
:label="item"
:value="item"
/>
</el-select>
</el-form-item>
<el-form-item label="描述信息" prop="description">
<el-input v-model="form.description" style="width: 380px;" rows="5" type="textarea" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
</div>
</el-dialog>
<el-dialog
title="文件夹" title="文件夹"
:visible.sync="folderModal" :visible.sync="folderModal"
:close-on-click-modal="false" :close-on-click-modal="false"
width="500px" width="500px"
> >
<el-form ref="folderForm" label-width="120px" :model="folderForm" :rules="folderRules"> <el-form
ref="folderForm"
label-width="120px"
:model="folderForm"
:rules="folderRules"
>
<el-form-item label="名称" prop="name"> <el-form-item label="名称" prop="name">
<el-input v-model="folderForm.name" size="small" clearable placeholder="请输入名称" style="width: 200px;" class="filter-item" /> <el-input
v-model="folderForm.name"
size="small"
clearable
placeholder="请输入名称"
style="width: 200px"
class="filter-item"
/>
</el-form-item> </el-form-item>
<el-form-item label="顺序" prop="order"> <el-form-item label="顺序" prop="order" v-if="!folderForm.id">
<el-input v-model="folderForm.order" size="small" clearable placeholder="请输入顺序" style="width: 200px;" class="filter-item" /> <el-input
v-model="folderForm.order"
size="small"
clearable
placeholder="请输入顺序"
style="width: 200px"
class="filter-item"
/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="folderModal = false">取消</el-button> <el-button @click="folderModal = false">取消</el-button>
<el-button type="primary" @click="confirmFolder">确定</el-button> <el-button type="primary" @click="confirmFolder" :loading="modalBtnLoad">确定</el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 新增窗口 --> <!-- 上传文件窗口 -->
<el-dialog <el-dialog
title="文件上传" title="文件添加"
:visible.sync="fileUploadModal" :visible.sync="fileUploadModal"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form ref="formInfo" label-width="120px"> <el-form ref="formInfo" label-width="120px">
<el-form-item> <el-form-item>
<el-input v-model="fileType" size="small" clearable placeholder="请输入文件分类" style="width: 200px;" class="filter-item" /> <el-input
v-model="fileType"
size="small"
clearable
placeholder="请输入文件分类"
style="width: 200px"
class="filter-item"
/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<label <label
...@@ -78,230 +76,248 @@ ...@@ -78,230 +76,248 @@
</label> </label>
</el-form-item> </el-form-item>
<el-form-item label=""> <el-form-item label="">
<div v-for="(item, index) in addEnterhdPics" :key="item.name + index"> <div v-for="(item, index) in uploadedFiles" :key="item.name + index">
{{ item.name }} {{ item.name }}
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="fileUploadModal = false">取消</el-button> <el-button @click="fileUploadModal = false">取消</el-button>
<el-button type="primary" @click="confirmUploadFile">确定</el-button> <el-button type="primary" @click="confirmUploadFile">确定</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-row :gutter="15"> <el-row :gutter="15">
<!-- 菜单授权 --> <el-col :span="6" style="margin-bottom: 10px">
<el-col :span="6" style="margin-bottom: 10px"> <el-card class="box-card" shadow="never">
<el-card class="box-card" shadow="never"> <div slot="header" class="clearfix">
<div slot="header" class="clearfix"> <el-button
<el-button size="mini"
icon="el-icon-minus" style="float: right; margin-left: 6px"
size="mini" type="danger"
style="float: right; margin-left:6px;" @click="delFolder"
type="danger" >
@click="delFolder"> 删除</el-button
删除</el-button> >
<el-button <el-button
icon="el-icon-plus" size="mini"
size="mini" style="float: right"
style="float: right;" type="primary"
type="primary" @click="updateFolder"
@click="updateFolder"> >
修改</el-button> 修改</el-button
<el-button >
icon="el-icon-plus" <el-button
size="mini" size="mini"
style="float: right;" style="float: right"
type="primary" type="primary"
@click="addFolder"> @click="addFolder"
添加</el-button> >
添加</el-button
</div> >
<el-tree </div>
ref="menu" <el-tree
:data="menus" ref="menu"
:props="defaultProps" :data="menus"
check-strictly :props="defaultProps"
accordion check-strictly
show-checkbox accordion
node-key="id" show-checkbox
@check="menuChange" node-key="id"
@node-click="menuClick" @check="menuChange"
@node-click="menuClick"
/>
</el-card>
</el-col>
<!--角色管理-->
<el-col :span="16">
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<el-button
type="primary"
size="mini"
@click="fileUploadModal = true"
>上传文件</el-button
>
<el-input
v-model="query.type"
size="small"
clearable
placeholder="查询文件分类"
style="width: 200px"
class="filter-item"
@keyup.enter.native="crud.toQuery"
/> />
<!-- <el-tree <date-range-picker v-model="query.createTime" class="date-item" />
ref="menu" <el-input
lazy v-model="query.name"
:data="menus" size="small"
:default-checked-keys="menuIds" clearable
:load="getMenuDatas" placeholder="查询文件名称"
:props="defaultProps" style="width: 200px"
check-strictly class="filter-item"
accordion />
show-checkbox <el-button type="primary" size="mini" @click="search">查询</el-button>
node-key="id" </div>
@check="menuChange" <el-table ref="table" style="width: 100%" :data="fileDataList">
@node-click="menuClick" <el-table-column type="" width="55" />
/> --> <el-table-column prop="originallyName" label="文件名称" />
</el-card> <el-table-column
</el-col> label="文件分类"
prop="classification"
<!--角色管理--> width="100"
<el-col :span="16">
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<el-button type="primary" size="mini" @click="fileUploadModal=true">上传文件</el-button>
<el-input v-model="query.blurry" size="small" clearable placeholder="查询文件分类" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<date-range-picker v-model="query.createTime" class="date-item" />
<el-input v-model="query.blurry" size="small" clearable placeholder="查询文件名称" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<el-button type="primary" size="mini">查询</el-button>
</div>
<el-table ref="table" style="width: 100%;" :data="fileDataList">
<el-table-column type="" width="55" />
<el-table-column prop="originallyName" label="文件名称"/>
<el-table-column label="文件分类" prop="classification" width="100" />
<el-table-column width="200px" prop="createTime" label="录入时间" />
<el-table-column label="操作" width="230px" align="center">
<template slot-scope="scope">
<el-button type="success" size="mini" @click="downFileById(scope.row)">下载</el-button>
<el-button type="danger" size="mini" @click="delFileById(scope.row)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:current-page="currentPage"
:page-sizes="[10, 20, 30, 40]"
:page-size="currenetPageDegree"
layout="total, sizes, prev, pager, next, jumper"
:total="totalElement"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/> />
</el-card> <el-table-column width="200px" prop="createTime" label="录入时间" />
</el-col> <el-table-column label="操作" width="230px" align="center">
</el-row> <template slot-scope="scope">
</div> <el-button
</template> type="success"
size="mini"
@click="downFileById(scope.row)"
>下载</el-button
>
<el-button
type="danger"
size="mini"
@click="delFileById(scope.row)"
>删除</el-button
>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 30, 40]"
:page-size="size"
layout="total, sizes, prev, pager, next, jumper"
:total="totalElement"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</el-card>
</el-col>
</el-row>
</div>
</template>
<script> <script>
import crudRoles from '@/api/system/role' import edocApi from "@/api/kd/edoc";
// import edoc{ getfileByFolderId, getFolderList, addFileByFolderId, delfileById } from '@/api/kd/edoc' import DateRangePicker from "@/components/DateRangePicker";
import edocApi from '@/api/kd/edoc' import { getToken } from "@/utils/auth";
import axios from 'axios'
import { getMenusTree, getChild } from '@/api/system/menu' export default {
import CRUD, { presenter, header, form, crud } from '@crud/crud' name: "Folder",
import rrOperation from '@crud/RR.operation' components: {
import crudOperation from '@crud/CRUD.operation' DateRangePicker,
import udOperation from '@crud/UD.operation' },
import pagination from '@crud/Pagination' data() {
import Treeselect from '@riophae/vue-treeselect' return {
import '@riophae/vue-treeselect/dist/vue-treeselect.css' modalBtnLoad: false,
import { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect' query:{
import DateRangePicker from '@/components/DateRangePicker' name: '',
import { mapGetters } from 'vuex' type:'',
import { getToken } from '@/utils/auth' createTime: ''
},
const defaultForm = { id: null, name: null, depts: [], description: null, dataScope: '全部', level: 3 } folderModal: false,
export default { folderForm: {
name: 'Folder', name: "",
components: { Treeselect, pagination, crudOperation, rrOperation, udOperation, DateRangePicker }, order: 0,
cruds() { },
return CRUD({ title: '角色', url: 'api/roles', sort: 'level,asc', crudMethod: { ...crudRoles }}) fileType: "",
}, fileUploadModal: false,
mixins: [presenter(), header(), form(defaultForm), crud()], uploadedFiles: [],
data() { currentFolderId: "",
return { currentCheckedFolderId: "",
folderModal: false, currentCheckedFolderInfo: {},
folderForm: { fileDataList: [],
name: '', totalElement: 0,
order: 0, page: 0,
}, size: 10,
fileType: '', defaultProps: { children: "children", label: "name", isLeaf: "leaf" },
fileUploadModal: false, level: 3,
addEnterhdPics: [], currentId: 0,
currentFolderId: '', currentName: "",
currentCheckedFolderId: '', menuLoading: false,
fileDataList: [], showButton: false,
totalElement: 0, menus: [],
currentPage: 0, menuIds: [],
currenetPageDegree: 10, folderRules: {
dateScopes: ["全部", "本级及以下", "自定义",], order: [{ required: true, message: "请输入顺序", trigger: "blur" }],
defaultProps: { children: 'children', label: 'name', isLeaf: 'leaf' }, name: [{ required: true, message: "请输入名称", trigger: "blur" }],
level: 3, },
currentId: 0, currentName: '', menuLoading: false, showButton: false, };
menus: [], menuIds: [], depts: [], deptDatas: [], // 多选时使用 },
permission: { computed: {},
add: ['admin', 'roles:add'], mounted() {
edit: ['admin', 'roles:edit'], this.getDataList(); // 获取所有文件夹
del: ['admin', 'roles:del'] },
}, created() {
folderRules: {
order: [ },
{ required: true, message: '请输入顺序', trigger: 'blur' } methods: {
], // 当前页的条数变化
name: [
{ required: true, message: '请输入名称', trigger: 'blur' }
]
}
}
},
computed: {
},
mounted(){
this.getDataList() // 获取所有文件夹
},
created() {
// crudRoles.getLevel().then(data => {
// this.level = data.level
// })
},
methods: {
// 当前页的条数变化
handleSizeChange(val) { handleSizeChange(val) {
this.currenetPageDegree = val; this.size = val;
this.getfileByFolderId(); this.getfileByFolderId();
}, },
// 当前第几页 // 当前第几页
handleCurrentChange(val) { handleCurrentChange(val) {
this.currentPage = val; this.page = val;
this.getfileByFolderId(); this.getfileByFolderId();
}, },
getDataList(){ getDataList() {
edocApi.getDataList({ edocApi.getDataList({}).then((res) => {
}).then((res)=>{ this.menus = res.body;
this.menus = res.body });
})
}, },
confirmFolder(){ confirmFolder() {
if(!this.currentFolderId){ this.$refs["folderForm"].validate((valid) => {
this.$message.warning('请选择文件夹')
return
}
this.$refs['folderForm'].validate(valid => {
if (valid) { if (valid) {
if(this.modalBtnLoad){
edocApi.addFolder({ return
...this.folderForm, }
pid: this.currentFolderId, this.modalBtnLoad = true
}).then((res)=>{ if(this.folderForm.id){ // 修改
this.$message.success('操作成功') edocApi
this.getDataList() .updateFolder({
}) ...this.folderForm,
})
.then((res) => {
this.folderModal = false
this.$message.success("操作成功");
this.getDataList();
});
}else{// 新增
edocApi
.addFolder({
...this.folderForm,
pid: this.currentCheckedFolderId,
})
.then((res) => {
this.folderModal = false
this.$message.success("操作成功");
this.getDataList();
});
}
this.modalBtnLoad = false
} }
}) });
}, },
addFolder(){ addFolder() {
this.folderModal = true if (!this.currentCheckedFolderId) {
this.folderForm = {name:'', order:''} this.$message.warning("请勾选文件夹");
return;
}
this.folderModal = true;
this.folderForm = { name: "", order: "" };
}, },
delFolder(){ delFolder() {
if(!this.currentCheckedFolderId){ if (!this.currentCheckedFolderId) {
this.$message.warning('请勾选要操作的文件夹') this.$message.warning("请勾选要操作的文件夹");
return return;
} }
this.$confirm("确定要删除吗?", "提示", { this.$confirm("确定要删除吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
...@@ -309,10 +325,10 @@ ...@@ -309,10 +325,10 @@
type: "warning", type: "warning",
}).then( }).then(
() => { () => {
edocApi.delFolder([this.currentCheckedFolderId]).then((res)=>{ edocApi.delFolder([this.currentCheckedFolderId]).then((res) => {
this.$message.success('操作成功') this.$message.success("操作成功");
this.getDataList() this.getDataList();
}) });
}, },
() => { () => {
this.$message({ this.$message({
...@@ -323,20 +339,33 @@ ...@@ -323,20 +339,33 @@
); );
}, },
downFileById(row) { downFileById(row) {
if(this.isExportLoading){
return
}
this.isExportLoading = true; this.isExportLoading = true;
// 导出信息 // 导出信息
axios.defaults.headers.common["Authorization"] = getToken(); axios.defaults.headers.common["Authorization"] = getToken();
const apiUrl = (process.env.VUE_APP_LOCAL_API + "/api/document/download").replaceAll("'", "")
axios.interceptors.response.use(function (response) {
// 对响应数据做点什么
console.log("响应头",response);
return response;
}, function (error) {
// 对响应错误做点什么
return Promise.reject(error);
});
axios({ axios({
url: process.env.VUE_APP_BASE_API + "/api/thCompany/export", url: apiUrl,
responseType: "blob", responseType: "blob",
method: "get", method: "get",
params: { county: localStorage.getItem("county") }, params: { id: row.id},
}).then((res) => { }).then((res) => {
console.log(res, "export"); console.log("export",res.headers["content-disposition"]);
let data = res.data; let data = res.data;
let dis = res.headers["content-disposition"];
let url = URL.createObjectURL(data); let url = URL.createObjectURL(data);
let fileName = dis.split("attachment;filename*=utf-8''")[1]; let dis = res.headers["content-disposition"];
let fileName = dis.split("filename=")[1];
this.down(url, fileName); this.down(url, fileName);
this.isExportLoading = false; this.isExportLoading = false;
}); });
...@@ -351,17 +380,17 @@ ...@@ -351,17 +380,17 @@
a.click(); a.click();
document.body.removeChild(a); document.body.removeChild(a);
}, },
delFileById(row){ delFileById(row) {
this.$confirm("确定要删除吗?", "提示", { this.$confirm("确定要删除吗?", "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning", type: "warning",
}).then( }).then(
() => { () => {
edocApi.delFileById([row.id]).then((res)=>{ edocApi.delFileById([row.id]).then((res) => {
this.$message.success('操作成功') this.$message.success("操作成功");
this.getfileByFolderId(this.currentFolderId) this.getfileByFolderId(this.currentFolderId);
}) });
}, },
() => { () => {
this.$message({ this.$message({
...@@ -371,231 +400,103 @@ ...@@ -371,231 +400,103 @@
} }
); );
}, },
updateFolder(){ updateFolder() {
if (!this.currentCheckedFolderId) {
this.$message.warning("请勾选文件夹");
return;
}
this.folderModal = true;
this.folderForm.name = this.currentCheckedFolderInfo.name
this.folderForm.order = this.currentCheckedFolderInfo.order
this.folderForm.id = this.currentCheckedFolderInfo.id
}, },
getfileByFolderId(){ search(){
edocApi.getfileByFolderId({ this.getfileByFolderId()
},
getfileByFolderId() {
edocApi
.getfileByFolderId({
catalogueId: this.currentFolderId, catalogueId: this.currentFolderId,
page: this.currentPage, page: this.page,
size: this.currenetPageDegree size: this.size,
}).then((res)=>{ ...this.query,
this.fileDataList = res.body.results createTime: this.query.createTime ? this.query.createTime.join(',') : ''
this.totalElement = res.body.total
}) })
}, .then((res) => {
confirmUploadFile(){ this.fileDataList = res.body.results;
if(!this.currentFolderId){ this.totalElement = res.body.total;
this.$message.warning('请选择文件夹') });
return },
} confirmUploadFile() {
if(!this.addEnterhdPics.length){ if (!this.currentFolderId) {
this.$message.warning('请上传文件') this.$message.warning("请选择文件夹");
return return;
} }
const formData = new FormData(); if (!this.uploadedFiles.length) {
// console.log(this.formInfo.hdstatus1, "haStatus"); this.$message.warning("请上传文件");
formData.append('fileList', this.addEnterhdPics[0]); return;
formData.append('catalogueId', this.currentFolderId); }
formData.append('classification', this.fileType); const formData = new FormData();
// console.log(this.formInfo.hdstatus1, "haStatus");
edocApi.addFileByFolderId(formData).then((res)=>{ formData.append("fileList", this.uploadedFiles[0]);
this.$message.success('操作成功') formData.append("catalogueId", this.currentFolderId);
this.getfileByFolderId() formData.append("classification", this.fileType);
this.fileUploadModal = false
}) edocApi.addFileByFolderId(formData).then((res) => {
}, this.$message.success("操作成功");
addhdPicChange(event) { this.getfileByFolderId();
// event.target 是触发事件的 input 元素 this.fileUploadModal = false;
const files = event.target.files; // 获取用户选择的文件列表 });
},
addhdPicChange(event) {
// event.target 是触发事件的 input 元素
const files = event.target.files; // 获取用户选择的文件列表
// 检查是否有文件选择 // 检查是否有文件选择
if (files.length > 0) { if (files.length > 0) {
const file = files[0]; // 选择第一个文件 const file = files[0]; // 选择第一个文件
console.log(`文件名: ${file.name}`); console.log(`文件名: ${file.name}`);
console.log(`文件大小: ${file.size} bytes`); console.log(`文件大小: ${file.size} bytes`);
console.log(`文件类型: ${file.type}`); console.log(`文件类型: ${file.type}`);
} }
this.addEnterhdPics = [files[0]] this.uploadedFiles = [files[0]];
},
}, menuClick(data, node, target) {
getMenuDatas(node, resolve) { console.log("menuClick", data, node, target);
setTimeout(() => { // 传递文件夹ID,获取对应文件夹下的文件数据
getMenusTree(node.data.id ? node.data.id : 0).then(res => { this.currentFolderId = data.id;
if (this.user && this.user.isAdmin) { this.getfileByFolderId();
res.forEach(menu => { },
menu.label = (menu.enterpriseType === 0 ? '局)' : '企)') + menu.label menuChange(data, node, target) {
}) console.log("menuChange", data, node, target);
} this.currentCheckedFolderInfo = data
resolve(res) const menu = data;
}) this.currentCheckedFolderId = node.checkedKeys.length
}, 100) ? node.checkedKeys[0]
}, : "";
// 触发单选 },
handleCurrentChange(val) { },
if (val) { };
const _this = this </script>
// 清空菜单的选中
this.$refs.menu.setCheckedKeys([])
// 保存当前的角色id
this.currentId = val.id
this.currentName = val.name
// 初始化默认选中的key
this.menuIds = []
val.menus.forEach(function(data) {
_this.menuIds.push(data.id)
})
this.showButton = true
}
},
menuClick(data, node, target){
console.log('menuClick', data, node, target)
// 传递文件夹ID,获取对应文件夹下的文件数据
this.currentFolderId = data.id
this.getfileByFolderId()
},
menuChange(data, node, target) {
console.log('menuChange', data, node, target)
const menu = data
this.currentCheckedFolderId = node.checkedKeys.length ? node.checkedKeys[0] : ''
// // 获取该节点的所有子节点,id 包含自身
// getChild(menu.id).then(childIds => {
// // 判断是否在 menuIds 中,如果存在则删除,否则添加
// if (this.menuIds.indexOf(menu.id) !== -1) {
// for (let i = 0; i < childIds.length; i++) {
// const index = this.menuIds.indexOf(childIds[i])
// if (index !== -1) {
// this.menuIds.splice(index, 1)
// }
// }
// } else {
// for (let i = 0; i < childIds.length; i++) {
// const index = this.menuIds.indexOf(childIds[i])
// if (index === -1) {
// this.menuIds.push(childIds[i])
// }
// }
// }
// this.$refs.menu.setCheckedKeys(this.menuIds)
// /**
// * 1 勾选菜单后
// *
// */
// })
},
// 保存菜单
saveMenu() {
this.menuLoading = true
const role = { id: this.currentId, menus: [] }
// 得到已选中的 key 值
this.menuIds.forEach(function(id) {
const menu = { id: id }
role.menus.push(menu)
})
crudRoles.editMenu(role).then(() => {
this.crud.notify('保存成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.menuLoading = false
this.update()
}).catch(err => {
this.menuLoading = false
console.log(err.response.data.message)
})
},
// 改变数据
update() {
// 无刷新更新 表格数据
crudRoles.get(this.currentId).then(res => {
for (let i = 0; i < this.crud.data.length; i++) {
if (res.id === this.crud.data[i].id) {
this.crud.data[i] = res
break
}
}
})
},
// 获取部门数据
getDepts() {
getDepts({ enabled: true }).then(res => {
this.depts = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
getSupDepts(depts) {
const ids = []
depts.forEach(dept => {
ids.push(dept.id)
})
getDeptSuperior(ids).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
},
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
getDepts({ enabled: true, pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 200)
})
}
},
// 如果数据权限为自定义则获取部门数据
changeScope() {
if (this.form.dataScope === '自定义') {
this.getDepts()
}
},
checkboxT(row) {
return row.level >= this.level
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss"> <style rel="stylesheet/scss" lang="scss">
.role-span { .role-span {
font-weight: bold;color: #303133; font-weight: bold;
font-size: 15px; color: #303133;
} font-size: 15px;
</style> }
</style>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner { ::v-deep .el-input-number .el-input__inner {
text-align: left; text-align: left;
} }
::v-deep .vue-treeselect__multi-value{ ::v-deep .vue-treeselect__multi-value {
margin-bottom: 0; margin-bottom: 0;
} }
::v-deep .vue-treeselect__multi-value-item{ ::v-deep .vue-treeselect__multi-value-item {
border: 0; border: 0;
padding: 0; padding: 0;
} }
</style> </style>
\ No newline at end of file
...@@ -135,28 +135,35 @@ ...@@ -135,28 +135,35 @@
v-model="employee.channel" v-model="employee.channel"
placeholder="通道(如:1.hd.live)" placeholder="通道(如:1.hd.live)"
type="text" type="text"
style="width: 200px" style="width: 150px"
:disabled="editState == 3" :disabled="editState == 3"
/> />
<el-input <el-input
v-model="employee.id" v-model="employee.id"
placeholder="萤石云ID(G67791073)" placeholder="萤石云ID(G67791073)"
type="text" type="text"
style="width: 200px" style="width: 150px"
:disabled="editState == 3" :disabled="editState == 3"
/> />
<el-input <el-input
v-model="employee.name" v-model="employee.name"
placeholder="名称" placeholder="名称"
type="text" type="text"
style="width: 200px" style="width: 150px"
:disabled="editState == 3"
/>
<el-input
v-model="employee.captcha"
placeholder="验证码"
type="text"
style="width: 150px"
:disabled="editState == 3" :disabled="editState == 3"
/> />
<el-input <el-input
v-model="employee.remark" v-model="employee.remark"
placeholder="备注" placeholder="备注"
type="text" type="text"
style="width: 200px" style="width: 150px"
:disabled="editState == 3" :disabled="editState == 3"
/> />
<el-button <el-button
...@@ -291,6 +298,7 @@ export default { ...@@ -291,6 +298,7 @@ export default {
id: "", id: "",
name: "", name: "",
remark: "", remark: "",
captcha: ''
}, },
], ],
}, },
...@@ -308,6 +316,7 @@ export default { ...@@ -308,6 +316,7 @@ export default {
id: "", id: "",
name: "", name: "",
remark: "", remark: "",
captcha: ''
}, },
], ],
}, // 上次正在新增时的内容,下次打开dialog1窗口时记录下来 }, // 上次正在新增时的内容,下次打开dialog1窗口时记录下来
...@@ -363,6 +372,7 @@ export default { ...@@ -363,6 +372,7 @@ export default {
id: "", id: "",
name: "", name: "",
remark: "", remark: "",
captcha: ''
}); });
}, },
deleteEmployee(index, eIndex) { deleteEmployee(index, eIndex) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment