提交 41138649 authored 作者: 龙菲's avatar 龙菲

联调新建文件接口;新建共享管理

上级 4048fa85
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import request from '@/utils/request' import request from '@/utils/request'
const baseUrl = '/v1/api' const baseUrl = '/v1/api'
export const getBookList = params => { export const getBookMarkList = params => {
return request({ return request({
url: baseUrl + '/doc/bookmark/mine', url: baseUrl + '/doc/bookmark/mine',
method: 'get', method: 'get',
......
...@@ -73,9 +73,7 @@ export default { ...@@ -73,9 +73,7 @@ export default {
}, },
watch: { watch: {
$route(value) { $route(value) {
// console.log(123, value);
const { filePath } = value.query; const { filePath } = value.query;
// debugger;
let filePathList = filePath ? filePath.split("/") : []; let filePathList = filePath ? filePath.split("/") : [];
let res = []; // 返回结果数组 let res = []; // 返回结果数组
let _path = []; // 存放祖先路径 let _path = []; // 存放祖先路径
...@@ -103,7 +101,6 @@ export default { ...@@ -103,7 +101,6 @@ export default {
// }); // });
} }
} }
console.log("res", res);
this.breadCrumbList = res; this.breadCrumbList = res;
}, },
}, },
...@@ -153,13 +150,11 @@ export default { ...@@ -153,13 +150,11 @@ export default {
* 点击面包屑导航栏空白处 * 点击面包屑导航栏空白处
*/ */
handleClickBreadCrumbSelf() { handleClickBreadCrumbSelf() {
if (this.fileType === 0) { this.inputFilePath = this.filePath;
this.inputFilePath = this.filePath; this.isShowInput = true;
this.isShowInput = true; this.$nextTick(() => {
this.$nextTick(() => { this.$refs.filePathInputRef.focus();
this.$refs.filePathInputRef.focus(); });
});
}
}, },
/** /**
* 路径输入框失去焦点或用户按下回车时触发 * 路径输入框失去焦点或用户按下回车时触发
...@@ -177,24 +172,28 @@ export default { ...@@ -177,24 +172,28 @@ export default {
}, },
// 获取文件参数 // 获取文件参数
getRouteQuery(item) { getRouteQuery(item) {
let routeName = this.$route.name; // debugger;
if (routeName === "Share") { // let routeName = this.$route.name;
// 当前是查看他人分享列表的页面 // if (routeName === "Share") {
return { query: { filePath: item.path } }; // // 当前是查看他人分享列表的页面
} else if (this.fileType === 8) { // return { query: { filePath: item.path } };
// 当前是我的已分享列表页面 // } else if (this.fileType === 8) {
return { // // 当前是我的已分享列表页面
query: { // return {
fileType: 8, // query: {
filePath: item.path, // fileType: 8,
shareBatchNum: // filePath: item.path,
item.path === "/" ? undefined : this.$route.query.shareBatchNum, // 当查看的是根目录,批次号置空 // shareBatchNum:
}, // item.path === "/" ? undefined : this.$route.query.shareBatchNum, // 当查看的是根目录,批次号置空
}; // },
} else { // };
// 网盘页面 // } else {
return { query: { filePath: item.path, fileType: 0 } }; // // 网盘页面
} // return { query: { filePath: item.path, fileType: item.fileType } };
// }
return {
query: { filePath: item.path, fileType: this.$route.query.fileType },
};
}, },
}, },
}; };
......
...@@ -459,7 +459,7 @@ export default { ...@@ -459,7 +459,7 @@ export default {
font-size: 16px; font-size: 16px;
&:hover { &:hover {
color: $Primary; color: $theme-blue;
} }
} }
} }
...@@ -510,7 +510,7 @@ export default { ...@@ -510,7 +510,7 @@ export default {
cursor: pointer; cursor: pointer;
&:hover { &:hover {
background: $PrimaryHover; background: $PrimaryHover;
color: $Primary; color: $theme-blue;
} }
i { i {
margin-right: 8px; margin-right: 8px;
......
...@@ -145,7 +145,6 @@ export default { ...@@ -145,7 +145,6 @@ export default {
}, },
// 监听搜索文件 // 监听搜索文件
searchFileName() { searchFileName() {
console.log("searchFileName");
this.setPageCount(); this.setPageCount();
this.getTableDataByType(); this.getTableDataByType();
}, },
......
...@@ -618,7 +618,7 @@ export default { ...@@ -618,7 +618,7 @@ export default {
cursor: pointer; cursor: pointer;
&:hover { &:hover {
background: $PrimaryHover; background: $PrimaryHover;
color: $Primary; color: $theme-blue;
} }
i { i {
margin-right: 8px; margin-right: 8px;
......
...@@ -185,6 +185,10 @@ export default { ...@@ -185,6 +185,10 @@ export default {
return store.getters.remainderStorageValue; return store.getters.remainderStorageValue;
}, },
}, },
// created() {
// // debugger;
// console.log(123);
// },
methods: { methods: {
// 隐藏拖拽上传遮罩 // 隐藏拖拽上传遮罩
hideUploadMask(e) { hideUploadMask(e) {
...@@ -200,15 +204,15 @@ export default { ...@@ -200,15 +204,15 @@ export default {
this.$qwConfig.tokenKeyName this.$qwConfig.tokenKeyName
); );
switch (this.uploadWay) { switch (this.uploadWay) {
case 1: { case 0: {
this.$refs.uploadBtn.$el.click(); this.$refs.uploadBtn.$el.click();
break; break;
} }
case 2: { case 1: {
this.$refs.uploadDirBtn.$el.click(); this.$refs.uploadDirBtn.$el.click();
break; break;
} }
case 3: { case 2: {
this.pasteImg.src = ""; this.pasteImg.src = "";
this.pasteImg.name = ""; this.pasteImg.name = "";
this.pasteImgObj = null; this.pasteImgObj = null;
...@@ -456,7 +460,7 @@ export default { ...@@ -456,7 +460,7 @@ export default {
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: $Primary; color: $theme-blue;
} }
} }
......
...@@ -217,7 +217,7 @@ export default { ...@@ -217,7 +217,7 @@ export default {
justify-content: space-between; justify-content: space-between;
&:hover { &:hover {
color: $Primary; color: $theme-blue;
} }
.name { .name {
...@@ -235,7 +235,7 @@ export default { ...@@ -235,7 +235,7 @@ export default {
.video-item.active { .video-item.active {
background: #000; background: #000;
color: $Primary; color: $theme-blue;
} }
} }
} }
......
...@@ -73,12 +73,12 @@ export default { ...@@ -73,12 +73,12 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
padding: 0; padding: 0;
color: $Primary; color: $theme-blue;
// 播放按钮 // 播放按钮
::v-deep .vjs-big-play-button { ::v-deep .vjs-big-play-button {
border-radius: 50%; border-radius: 50%;
border: 6px solid $Primary; border: 6px solid $theme-blue;
left: calc(50% - 1em); left: calc(50% - 1em);
top: calc(50% - 1em); top: calc(50% - 1em);
width: 2.5em; width: 2.5em;
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
::v-deep .vjs-volume-level, ::v-deep .vjs-volume-level,
::v-deep .vjs-play-progress, ::v-deep .vjs-play-progress,
::v-deep .vjs-slider-bar { ::v-deep .vjs-slider-bar {
background: $Primary; background: $theme-blue;
} }
// 控制条按钮的大小 // 控制条按钮的大小
......
...@@ -103,6 +103,7 @@ export default { ...@@ -103,6 +103,7 @@ export default {
watch: { watch: {
// 文件平铺模式 排序-文件夹在前 // 文件平铺模式 排序-文件夹在前
fileList(newValue) { fileList(newValue) {
console.log("fileList-newValue", newValue);
this.fileListSorted = [...newValue] this.fileListSorted = [...newValue]
.sort((pre, next) => { .sort((pre, next) => {
return next.isDir - pre.isDir; return next.isDir - pre.isDir;
...@@ -119,6 +120,13 @@ export default { ...@@ -119,6 +120,13 @@ export default {
this.$store.commit("changeSelectedFiles", newValue); this.$store.commit("changeSelectedFiles", newValue);
this.$store.commit("changeIsBatchOperation", newValue.length !== 0); this.$store.commit("changeIsBatchOperation", newValue.length !== 0);
}, },
fileListSorted: {
handler(value) {
console.log("监听fileListSorted", value);
},
deep: true,
immediate: true,
},
}, },
methods: { methods: {
/** /**
......
...@@ -20,14 +20,14 @@ ...@@ -20,14 +20,14 @@
>上传<i class="el-icon-arrow-down el-icon--right"></i >上传<i class="el-icon-arrow-down el-icon--right"></i
></el-button> ></el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleUploadFileBtnClick(1)" <el-dropdown-item @click.native="handleUploadFileBtnClick(0)"
>上传文件</el-dropdown-item >上传文件</el-dropdown-item
> >
<el-dropdown-item @click.native="handleUploadFileBtnClick(2)" <el-dropdown-item @click.native="handleUploadFileBtnClick(1)"
>上传文件夹</el-dropdown-item >上传文件夹</el-dropdown-item
> >
<el-dropdown-item <el-dropdown-item
@click.native="handleUploadFileBtnClick(3)" @click.native="handleUploadFileBtnClick(2)"
title="截图粘贴或拖拽上传" title="截图粘贴或拖拽上传"
:disabled="screenWidth <= 520" :disabled="screenWidth <= 520"
>拖拽上传</el-dropdown-item >拖拽上传</el-dropdown-item
...@@ -488,11 +488,7 @@ export default { ...@@ -488,11 +488,7 @@ export default {
* @param {string} value 搜索内容 * @param {string} value 搜索内容
*/ */
handleSearchInputChange(value) { handleSearchInputChange(value) {
if (value === "") { this.$emit("getSearchFileList", value);
this.$emit("getTableDataByType");
} else {
this.$emit("getSearchFileList", value);
}
}, },
/** /**
* 网格模式下,批量操作状态切换 * 网格模式下,批量操作状态切换
...@@ -505,6 +501,7 @@ export default { ...@@ -505,6 +501,7 @@ export default {
* @param {number} label 0 列表 1 网格 2 时间线 * @param {number} label 0 列表 1 网格 2 时间线
*/ */
handleFileDisplayModelChange(label) { handleFileDisplayModelChange(label) {
// debugger;
this.fileGroupLable = label; this.fileGroupLable = label;
// 关闭右键菜单事件 // 关闭右键菜单事件
this.$openBox.contextMenu.close(); this.$openBox.contextMenu.close();
...@@ -571,7 +568,7 @@ export default { ...@@ -571,7 +568,7 @@ export default {
font-size: 16px; font-size: 16px;
&:hover { &:hover {
color: $Primary; color: $theme-blue;
} }
} }
} }
...@@ -585,7 +582,7 @@ export default { ...@@ -585,7 +582,7 @@ export default {
} }
.model-icon.active { .model-icon.active {
color: $Primary; color: $theme-blue;
} }
.refresh-icon, .refresh-icon,
...@@ -597,12 +594,12 @@ export default { ...@@ -597,12 +594,12 @@ export default {
color: $SecondaryText; color: $SecondaryText;
&:hover { &:hover {
color: $Primary; color: $theme-blue;
} }
} }
.batch-icon.active { .batch-icon.active {
color: $Primary; color: $theme-blue;
} }
} }
......
...@@ -86,7 +86,7 @@ export default { ...@@ -86,7 +86,7 @@ export default {
padding-top: 8px; padding-top: 8px;
cursor: pointer; cursor: pointer;
&:hover { &:hover {
color: $Primary; color: $theme-blue;
} }
} }
} }
......
...@@ -237,7 +237,7 @@ export default { ...@@ -237,7 +237,7 @@ export default {
} }
.el-tree-node.is-current > .el-tree-node__content { .el-tree-node.is-current > .el-tree-node__content {
color: $Primary; color: $theme-blue;
} }
} }
} }
......
...@@ -267,7 +267,7 @@ export default { ...@@ -267,7 +267,7 @@ export default {
} }
.el-tree-node.is-current > .el-tree-node__content { .el-tree-node.is-current > .el-tree-node__content {
color: $Primary; color: $theme-blue;
} }
} }
} }
......
...@@ -210,7 +210,7 @@ export default { ...@@ -210,7 +210,7 @@ export default {
} }
.el-tree-node.is-current > .el-tree-node__content { .el-tree-node.is-current > .el-tree-node__content {
color: $Primary; color: $theme-blue;
} }
} }
} }
......
...@@ -228,7 +228,7 @@ export default { ...@@ -228,7 +228,7 @@ export default {
} }
.el-tree-node.is-current > .el-tree-node__content { .el-tree-node.is-current > .el-tree-node__content {
color: $Primary; color: $theme-blue;
} }
} }
} }
......
...@@ -20,6 +20,9 @@ const fileFunction = { ...@@ -20,6 +20,9 @@ const fileFunction = {
* @returns {string} 文件大小(带单位) * @returns {string} 文件大小(带单位)
*/ */
calculateFileSize(size, isInteger = false) { calculateFileSize(size, isInteger = false) {
if (size == null)
return 0 + 'KB'
const B = 1024 const B = 1024
const KB = Math.pow(1024, 2) const KB = Math.pow(1024, 2)
const MB = Math.pow(1024, 3) const MB = Math.pow(1024, 3)
...@@ -344,9 +347,9 @@ const fileFunction = { ...@@ -344,9 +347,9 @@ const fileFunction = {
flag = true flag = true
} }
console.log(123, row); console.log(123, row);
const { fileId, identifier } = row const { fileId } = row
const params = { const params = {
fileId: identifier, fileId: fileId,
flag flag
} }
getViewUrlDbPath(params).then(res => { getViewUrlDbPath(params).then(res => {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<svg-icon icon-class="add-border"></svg-icon> <svg-icon icon-class="add-border"></svg-icon>
<div class="right"> <div class="right">
<div class="text">新建文档</div> <div class="text">新建文档</div>
<div class="subtitle">从空文本起草</div> <div class="subtitle">从空文本或模板起草</div>
</div> </div>
</div> </div>
</el-card> </el-card>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<el-card <el-card
shadow="never" shadow="never"
class="cursor-pointer" class="cursor-pointer"
@click.native="handleUploadFile(0)" @click.native="handleUploadFile"
> >
<div class="content"> <div class="content">
<svg-icon icon-class="word-border"></svg-icon> <svg-icon icon-class="word-border"></svg-icon>
...@@ -144,83 +144,32 @@ export default { ...@@ -144,83 +144,32 @@ export default {
let res = await getNearCreation(params); let res = await getNearCreation(params);
this.createList = res.data; this.createList = res.data;
}, },
/** // 上传文件
* 上传文件按钮点击事件 handleUploadFile() {
* @description 通过Bus通信,开启全局上传文件流程 const uploadFileParams = { filePath: "/我的创作", isDir: 0 }; // 上传文件组件参数
* @param {boolean} uploadWay 上传方式 0-文件上传 1-文件夹上传 2-粘贴图片或拖拽上传 // debugger;
*/ this.$openBox.uploadFile({
handleUploadFile(uploadWay) { params: uploadFileParams,
this.$openDialog.authWeChat({}).then((res) => { uploadWay: 0, //0-文件上传 1-文件夹上传 2-粘贴图片或拖拽上传
switch (res) { serviceEl: this,
case "confirm": { callType: 2, // callType 调用此服务的方式:1 - 顶部栏,2 - 右键菜单
this.$common.goAccount("/settings/account");
break;
}
case "go": {
this.$openBox.uploadFile({
params: this.uploadFileParams,
uploadWay,
serviceEl: this,
callType: 1, // callType 调用此服务的方式:1 - 顶部栏,2 - 右键菜单
});
break;
}
}
}); });
}, },
// 创建文件 // 创建文件
handleCreateFile() { handleCreateFile() {
// const _this = this; this.$openDialog
const formData = new FormData(); .addFileByTemplate({
// 目前仅支持创建文档 extendName: "docx",
formData.append("filetype", fileTypes.WORD); })
newfile(formData).then((res) => { .then((res) => {
// instance.confirmButtonLoading = false; // if (res === "confirm") {
// done(); // this.$emit("getTableDataByType");
// _this.$parent.$parent.showDialog = false; // }
const resolve = this.$router.resolve({
path: "/write",
query: {
wpsUrl: res.redirect_url,
},
}); });
window.open(resolve.href);
});
// if (e === undefined) {
// // 目前仅支持创建文档
// formData.append("filetype", fileTypes.WORD);
// newfile(formData).then((res) => {
// // instance.confirmButtonLoading = false;
// // done();
// // _this.$parent.$parent.showDialog = false;
// const resolve = this.$router.resolve({
// path: "/write",
// query: {
// wpsUrl: res.redirect_url,
// },
// });
// window.open(resolve.href);
// });
// } else {
// formData.append("templateId", e);
// newfileTemplate(formData).then((res) => {
// instance.confirmButtonLoading = false;
// done();
// _this.$parent.$parent.showDialog = false;
// let resolve = _this.$router.resolve({
// path: "/write",
// query: {
// wpsUrl: res.redirect_url,
// },
// });
// window.open(resolve.href);
// });
// }
}, },
// 点击表格某一行 // 点击表格某一行
handleClickName(row) { handleClickName(row) {
console.log("row", row); console.log("row", row);
openFile(row, this, localStorage);
}, },
handleToCreate() { handleToCreate() {
this.$router.push("/mine/myCreate"); this.$router.push("/mine/myCreate");
...@@ -232,6 +181,9 @@ export default { ...@@ -232,6 +181,9 @@ export default {
}; };
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.cursor-pointer {
cursor: pointer;
}
::v-deep .el-card__body { ::v-deep .el-card__body {
.el-upload { .el-upload {
width: 100%; width: 100%;
......
//分享类型
export const shareTypeConstant = {
PUBLIC_SHARE: 0, //分享给公共社区
DEPT_SHARE: 1, //分享给部门
PERSONAL_SHARE: 2 //分享给个人
}
// 分享状态
export const shareStatusConstant = {
SHARED: 0, //已分享
EXPIRED: 1,//已失效
REVOKED: 2,//已撤销
}
\ No newline at end of file
<template> <template>
<div>共享管理</div> <div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="文件名称" prop="fileName">
<el-input
v-model="queryParams.fileName"
placeholder="请输入文件名称"
clearable
style="width: 240px"
@keyup.enter.native="handleQuery"
clearable
/>
</el-form-item>
<el-form-item label="分享状态" prop="fileName">
<el-select
v-model="queryParams.shareStatus"
placeholder="请选择分享状态"
clearable
>
<el-option
v-for="item in dict.type.share_status"
: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"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="shareList">
<el-table-column
label="文件名称"
align="center"
prop="fileName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="分享截止时间"
align="center"
prop="endTime"
width="180"
>
</el-table-column>
<el-table-column
label="分享类型"
align="center"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<dict-tag
:options="dict.type.share_type"
:value="scope.row.shareType"
/>
</template>
</el-table-column>
<el-table-column label="分享状态" align="center" prop="status">
<template slot-scope="scope">
<el-tag :type="getShareStatusTagType(scope.row.shareStatus)"
><dict-tag
:options="dict.type.share_status"
:value="scope.row.shareStatus"
/></el-tag>
</template>
</el-table-column>
<el-table-column
label="备注"
align="center"
prop="remark"
:show-overflow-tooltip="true"
/>
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-link type="primary" style="margin-right: 16px">
<svg-icon icon-class="revoke"> </svg-icon>撤销分享
</el-link>
<el-link type="primary" icon="el-icon-view"> 预览 </el-link>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.currentPage"
:limit.sync="queryParams.pageCount"
@pagination="getList"
/>
</div>
</template> </template>
<script> <script>
export default {}; import { getAdminShareList } from "@/api/user/share";
</script> import { shareStatusConstant } from "./constant";
<style></style> export default {
name: "myShare",
dicts: ["share_type", "share_status"],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 表格数据
shareList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 日期范围
dateRange: [],
// 查询参数
queryParams: {
currentPage: 1,
pageCount: 10,
fileName: "", //文件名称
shareStatus: "", //分享状态
},
// 分享状态常量
shareStatusConstant,
};
},
computed: {
getShareStatusTagType(shareStatus) {
return (shareStatus) => {
switch (shareStatus) {
case shareStatusConstant.SHARED: //已分享
return "success";
case shareStatusConstant.EXPIRED: //已失效
return "info";
case shareStatusConstant.REVOKED: //已撤销
return "warning";
}
};
},
},
created() {
this.getList();
},
methods: {
/** 查询字典类型列表 */
getList() {
this.loading = true;
getAdminShareList(this.queryParams).then((res) => {
this.total = res.data.total;
this.loading = false;
this.shareList = res.data.records;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
},
// 表单重置
reset() {
this.resetForm("queryForm");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.currentPage = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 取消分享
handleCancelShare(row) {
console.log(row);
},
},
};
</script>
...@@ -32,11 +32,19 @@ ...@@ -32,11 +32,19 @@
<div :span="19" class="right"> <div :span="19" class="right">
<div class="single-article"> <div class="single-article">
<el-row class="info"> <el-row class="info">
<el-col :span="8" class="center">{{ currentFile.name }}</el-col> <el-col :span="16">
<el-col :span="8" class="center">{{ currentFile.author }}</el-col> <el-row>
<el-col :span="8" class="center" <el-col class="info-title">
><el-button type="text">查看原文</el-button></el-col {{ currentFile.name }}
> </el-col>
<el-col>
<span class="info-author">
作者: {{ currentFile.author }}
</span>
<el-button type="text">查看原文</el-button>
</el-col>
</el-row>
</el-col>
</el-row> </el-row>
<div class="card-group"> <div class="card-group">
...@@ -71,7 +79,7 @@ ...@@ -71,7 +79,7 @@
</div> </div>
</template> </template>
<script> <script>
import { getBookList, getBookMark } from "@/api/doc/bookMark"; import { getBookMarkList, getBookMark } from "@/api/doc/bookMark";
import { mockNote } from "./mockNote"; import { mockNote } from "./mockNote";
export default { export default {
data() { data() {
...@@ -107,10 +115,10 @@ export default { ...@@ -107,10 +115,10 @@ export default {
}, },
methods: { methods: {
async loadBookMarkList() { async loadBookMarkList() {
let res = await getBookList(); let res = await getBookMarkList();
console.log(res); console.log(res);
if (res.result) { if (res.data) {
this.markList = res.result; this.markList = res.data;
} }
}, },
// 点击文章 // 点击文章
...@@ -178,11 +186,14 @@ export default { ...@@ -178,11 +186,14 @@ export default {
//文章基本信息 //文章基本信息
.info { .info {
padding: 16px; padding: 16px;
border-bottom: 1px solid #e7e7e7;
margin-bottom: 8px; margin-bottom: 8px;
.center { .info-title {
display: flex; color: #333;
justify-content: center; font-size: 18px;
font-weight: bold;
}
.info-author {
margin-right: 18px;
} }
} }
.card-group { .card-group {
......
...@@ -48,61 +48,13 @@ ...@@ -48,61 +48,13 @@
</el-form> </el-form>
<el-row :gutter="10" class="mb8"> <el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5"> <el-button
<el-button
type="primary" type="primary"
plain plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:dict:add']"
>新增</el-button
>
</el-col> -->
<!-- <el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:dict:edit']"
>修改</el-button
>
</el-col> -->
<!-- <el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click.native="handleMultiRevoke"
v-hasPermi="['system:dict:remove']" ><svg-icon icon-class="revoke" class="mr5"> </svg-icon>批量撤销分享</el-button
>删除</el-button
>
</el-col> -->
<!-- <el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:dict:export']"
>导出</el-button
>
</el-col> -->
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-refresh"
size="mini"
@click="handleRefreshCache"
v-hasPermi="['system:dict:remove']"
>刷新缓存</el-button
> >
</el-col> </el-col>
<right-toolbar <right-toolbar
...@@ -115,6 +67,7 @@ ...@@ -115,6 +67,7 @@
:data="shareList" :data="shareList"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
> >
<el-table-column type="selection" width="55" align="center" />
<el-table-column <el-table-column
label="文件名称" label="文件名称"
align="center" align="center"
...@@ -180,14 +133,6 @@ ...@@ -180,14 +133,6 @@
</template> </template>
<script> <script>
import {
listType,
getType,
delType,
addType,
updateType,
refreshCache,
} from "@/api/system/dict/type";
import { getMyShareList } from "@/api/user/share"; import { getMyShareList } from "@/api/user/share";
import { shareStatusConstant } from "./constant"; import { shareStatusConstant } from "./constant";
...@@ -245,6 +190,12 @@ export default { ...@@ -245,6 +190,12 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.dictId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getList() { getList() {
this.loading = true; this.loading = true;
...@@ -261,14 +212,7 @@ export default { ...@@ -261,14 +212,7 @@ export default {
}, },
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.resetForm("queryForm");
dictId: undefined,
dictName: undefined,
dictType: undefined,
status: "0",
remark: undefined,
};
this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
...@@ -281,83 +225,15 @@ export default { ...@@ -281,83 +225,15 @@ export default {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加字典类型";
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.dictId);
this.single = selection.length != 1;
this.multiple = !selection.length;
},
// 取消分享 // 取消分享
handleCancelShare(row) { handleCancelShare(row) {
console.log(row); console.log(row);
}, },
/** 修改按钮操作 */ // 批量取消分享
handleUpdate(row) { handleMultiRevoke(){
this.reset(); console.log(this.ids);
const dictId = row.dictId || this.ids;
getType(dictId).then((response) => { }
this.form = response.data;
this.open = true;
this.title = "修改字典类型";
});
},
/** 提交按钮 */
submitForm: function () {
this.$refs["form"].validate((valid) => {
if (valid) {
if (this.form.dictId != undefined) {
updateType(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addType(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const dictIds = row.dictId || this.ids;
this.$modal
.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?')
.then(function () {
return delType(dictIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download(
"system/dict/type/export",
{
...this.queryParams,
},
`type_${new Date().getTime()}.xlsx`
);
},
/** 刷新缓存按钮操作 */
handleRefreshCache() {
refreshCache().then(() => {
this.$modal.msgSuccess("刷新成功");
this.$store.dispatch("dict/cleanDict");
});
},
}, },
}; };
</script> </script>
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form-item label="字典名称" prop="dictName"> <el-form-item label="字典名称" prop="dictName">
<el-input <el-input
v-model="queryParams.dictName" v-model="queryParams.dictName"
...@@ -46,8 +53,16 @@ ...@@ -46,8 +53,16 @@
></el-date-picker> ></el-date-picker>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -60,7 +75,8 @@ ...@@ -60,7 +75,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['system:dict:add']" v-hasPermi="['system:dict:add']"
>新增</el-button> >新增</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
...@@ -71,7 +87,8 @@ ...@@ -71,7 +87,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['system:dict:edit']" v-hasPermi="['system:dict:edit']"
>修改</el-button> >修改</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
...@@ -82,7 +99,8 @@ ...@@ -82,7 +99,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>删除</el-button> >删除</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
...@@ -92,7 +110,8 @@ ...@@ -92,7 +110,8 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['system:dict:export']" v-hasPermi="['system:dict:export']"
>导出</el-button> >导出</el-button
>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
...@@ -102,34 +121,71 @@ ...@@ -102,34 +121,71 @@
size="mini" size="mini"
@click="handleRefreshCache" @click="handleRefreshCache"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>刷新缓存</el-button> >刷新缓存</el-button
>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="typeList" @selection-change="handleSelectionChange"> <el-table
v-loading="loading"
:data="typeList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="字典编号" align="center" prop="dictId" /> <el-table-column label="字典编号" align="center" prop="dictId" />
<el-table-column label="字典名称" align="center" prop="dictName" :show-overflow-tooltip="true" /> <el-table-column
<el-table-column label="字典类型" align="center" :show-overflow-tooltip="true"> label="字典名称"
align="center"
prop="dictName"
:show-overflow-tooltip="true"
/>
<el-table-column
label="字典类型"
align="center"
:show-overflow-tooltip="true"
>
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="'/system/dict-data/index/' + scope.row.dictId" class="link-type"> <router-link
:to="'/system/dict-data/index/' + scope.row.dictId"
class="link-type"
>
<span>{{ scope.row.dictType }}</span> <span>{{ scope.row.dictType }}</span>
</router-link> </router-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="状态" align="center" prop="status"> <el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> <dict-tag
:options="dict.type.sys_normal_disable"
:value="scope.row.status"
/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" /> <el-table-column
<el-table-column label="创建时间" align="center" prop="createTime" width="180"> label="备注"
align="center"
prop="remark"
:show-overflow-tooltip="true"
/>
<el-table-column
label="创建时间"
align="center"
prop="createTime"
width="180"
>
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span> <span>{{ parseTime(scope.row.createTime) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
...@@ -137,20 +193,22 @@ ...@@ -137,20 +193,22 @@
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['system:dict:edit']" v-hasPermi="['system:dict:edit']"
>修改</el-button> >修改</el-button
>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['system:dict:remove']" v-hasPermi="['system:dict:remove']"
>删除</el-button> >删除</el-button
>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
...@@ -172,11 +230,16 @@ ...@@ -172,11 +230,16 @@
v-for="dict in dict.type.sys_normal_disable" v-for="dict in dict.type.sys_normal_disable"
:key="dict.value" :key="dict.value"
:label="dict.value" :label="dict.value"
>{{dict.label}}</el-radio> >{{ dict.label }}</el-radio
>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容"></el-input> <el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
></el-input>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -188,11 +251,18 @@ ...@@ -188,11 +251,18 @@
</template> </template>
<script> <script>
import { listType, getType, delType, addType, updateType, refreshCache } from "@/api/system/dict/type"; import {
listType,
getType,
delType,
addType,
updateType,
refreshCache,
} from "@/api/system/dict/type";
export default { export default {
name: "Dict", name: "Dict",
dicts: ['sys_normal_disable'], dicts: ["sys_normal_disable"],
data() { data() {
return { return {
// 遮罩层 // 遮罩层
...@@ -221,19 +291,19 @@ export default { ...@@ -221,19 +291,19 @@ export default {
pageSize: 10, pageSize: 10,
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: undefined status: undefined,
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
dictName: [ dictName: [
{ required: true, message: "字典名称不能为空", trigger: "blur" } { required: true, message: "字典名称不能为空", trigger: "blur" },
], ],
dictType: [ dictType: [
{ required: true, message: "字典类型不能为空", trigger: "blur" } { required: true, message: "字典类型不能为空", trigger: "blur" },
] ],
} },
}; };
}, },
created() { created() {
...@@ -243,7 +313,8 @@ export default { ...@@ -243,7 +313,8 @@ export default {
/** 查询字典类型列表 */ /** 查询字典类型列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listType(this.addDateRange(this.queryParams, this.dateRange)).then(response => { listType(this.addDateRange(this.queryParams, this.dateRange)).then(
(response) => {
this.typeList = response.rows; this.typeList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
...@@ -262,7 +333,7 @@ export default { ...@@ -262,7 +333,7 @@ export default {
dictName: undefined, dictName: undefined,
dictType: undefined, dictType: undefined,
status: "0", status: "0",
remark: undefined remark: undefined,
}; };
this.resetForm("form"); this.resetForm("form");
}, },
...@@ -285,32 +356,32 @@ export default { ...@@ -285,32 +356,32 @@ export default {
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.dictId) this.ids = selection.map((item) => item.dictId);
this.single = selection.length!=1 this.single = selection.length != 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset(); this.reset();
const dictId = row.dictId || this.ids const dictId = row.dictId || this.ids;
getType(dictId).then(response => { getType(dictId).then((response) => {
this.form = response.data; this.form = response.data;
this.open = true; this.open = true;
this.title = "修改字典类型"; this.title = "修改字典类型";
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function() { submitForm: function () {
this.$refs["form"].validate(valid => { this.$refs["form"].validate((valid) => {
if (valid) { if (valid) {
if (this.form.dictId != undefined) { if (this.form.dictId != undefined) {
updateType(this.form).then(response => { updateType(this.form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
}); });
} else { } else {
addType(this.form).then(response => { addType(this.form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
this.getList(); this.getList();
...@@ -322,26 +393,34 @@ export default { ...@@ -322,26 +393,34 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const dictIds = row.dictId || this.ids; const dictIds = row.dictId || this.ids;
this.$modal.confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?').then(function() { this.$modal
return delType(dictIds); .confirm('是否确认删除字典编号为"' + dictIds + '"的数据项?')
}).then(() => { .then(function () {
this.getList(); return delType(dictIds);
this.$modal.msgSuccess("删除成功"); })
}).catch(() => {}); .then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('system/dict/type/export', { this.download(
...this.queryParams "system/dict/type/export",
}, `type_${new Date().getTime()}.xlsx`) {
...this.queryParams,
},
`type_${new Date().getTime()}.xlsx`
);
}, },
/** 刷新缓存按钮操作 */ /** 刷新缓存按钮操作 */
handleRefreshCache() { handleRefreshCache() {
refreshCache().then(() => { refreshCache().then(() => {
this.$modal.msgSuccess("刷新成功"); this.$modal.msgSuccess("刷新成功");
this.$store.dispatch('dict/cleanDict'); this.$store.dispatch("dict/cleanDict");
}); });
} },
} },
}; };
</script> </script>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论