|
@@ -19,7 +19,7 @@
|
|
|
default-expand-all highlight-current @node-click="handleNodeClick" />
|
|
|
</div>
|
|
|
</el-col>
|
|
|
- <!--用户数据-->
|
|
|
+ <!--文件数据-->
|
|
|
<el-col :span="20" :xs="24" class="main-right">
|
|
|
<p>个人文档</p>
|
|
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
|
|
@@ -66,7 +66,7 @@
|
|
|
<el-table-column label="文件名称" align="center" prop="docName" />
|
|
|
<el-table-column label="文件大小" align="center" prop="docSize" :formatter="fileSizeData" />
|
|
|
<el-table-column label="修改时间" align="center" prop="updateTime" />
|
|
|
- <el-table-column label="文件级别" align="center" prop="docLevel" />
|
|
|
+ <el-table-column label="文件级别" align="center" prop="docLevel" :formatter="fileLevelData"/>
|
|
|
<el-table-column label="文件年份" align="center" prop="createYear" />
|
|
|
<el-table-column label="标签" align="center" prop="tagName" />
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
@@ -110,8 +110,8 @@
|
|
|
:value="item.levelId"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="文件标签" prop="docLevel">
|
|
|
- <el-input v-model="form.docLevel" type="textarea" placeholder="请输入文件标签,多个标签以空格分隔,每个标签最好不超过四个字!" />
|
|
|
+ <el-form-item label="文件标签" prop="docLevel">
|
|
|
+ <el-input v-model="form.docTag" type="textarea" placeholder="请输入文件标签,多个标签以空格分隔,每个标签最好不超过四个字!" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -129,282 +129,294 @@
|
|
|
import "@/styles1/element-ui1.scss";
|
|
|
|
|
|
import {
|
|
|
- listInfo,
|
|
|
- getInfo,
|
|
|
- delInfo,
|
|
|
- addInfo,
|
|
|
- updateInfo
|
|
|
-} from "@/api/doc/info";
|
|
|
-import {
|
|
|
- listDir,
|
|
|
- getDir,
|
|
|
- delDir,
|
|
|
- addDir,
|
|
|
- updateDir,
|
|
|
- personalList
|
|
|
-} from "@/api/doc/dir";
|
|
|
-import {
|
|
|
- listLevel
|
|
|
-} from "@/api/doc/level";
|
|
|
+ listInfo,
|
|
|
+ getInfo,
|
|
|
+ delInfo,
|
|
|
+ addInfo,
|
|
|
+ updateInfo
|
|
|
+ } from "@/api/doc/info";
|
|
|
+ import {
|
|
|
+ listDir,
|
|
|
+ getDir,
|
|
|
+ delDir,
|
|
|
+ addDir,
|
|
|
+ updateDir,
|
|
|
+ personalList
|
|
|
+ } from "@/api/doc/dir";
|
|
|
+ import {
|
|
|
+ listLevel
|
|
|
+ } from "@/api/doc/level";
|
|
|
|
|
|
-import Treeselect from "@riophae/vue-treeselect";
|
|
|
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
+ import Treeselect from "@riophae/vue-treeselect";
|
|
|
+ import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
|
|
|
-export default {
|
|
|
- name: "Info",
|
|
|
- components: {
|
|
|
- Treeselect
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 遮罩层
|
|
|
- loading: true,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- // 非单个禁用
|
|
|
- single: true,
|
|
|
- // 非多个禁用
|
|
|
- multiple: true,
|
|
|
- // 显示搜索条件
|
|
|
- showSearch: true,
|
|
|
- // 总条数
|
|
|
- total: 0,
|
|
|
- // 文件基本信息表格数据
|
|
|
- infoList: [],
|
|
|
- //目录ID
|
|
|
- dirId: undefined,
|
|
|
- //目录数据
|
|
|
- dirList: undefined,
|
|
|
- //文件等级数据
|
|
|
- levelOptions: undefined,
|
|
|
- // 弹出层标题
|
|
|
- title: "",
|
|
|
- // 是否显示弹出层
|
|
|
- open: false,
|
|
|
- // 查询参数
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- docName: null,
|
|
|
- docLevel: null,
|
|
|
- createYear: null,
|
|
|
- },
|
|
|
- // 表单参数
|
|
|
- form: {},
|
|
|
- defaultProps: {
|
|
|
- children: "children",
|
|
|
- label: "dirName",
|
|
|
- id: "dirId"
|
|
|
- },
|
|
|
- // 表单校验
|
|
|
- rules: {
|
|
|
- docName: [{
|
|
|
- required: true,
|
|
|
- message: "文件名称不能为空",
|
|
|
- trigger: "blur"
|
|
|
- }],
|
|
|
- createYear: [{
|
|
|
- required: true,
|
|
|
- message: "文件创建年份;文件创建年份,分表用不能为空",
|
|
|
- trigger: "blur"
|
|
|
- }],
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.dirTree();
|
|
|
- },
|
|
|
- watch: {
|
|
|
- "form.docPath": function(path, old) {
|
|
|
- if (path && path.lastIndexOf("/") > -1) {
|
|
|
- let name = path.slice(path.lastIndexOf("/") + 1);
|
|
|
- this.form.docName = name.split("_")[0];
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- methods: {
|
|
|
- /** 转换目录信息数据结构 */
|
|
|
- normalizer(node) {
|
|
|
- if (node.children && !node.children.length) {
|
|
|
- delete node.children;
|
|
|
- }
|
|
|
- return {
|
|
|
- id: node.dirId,
|
|
|
- label: node.dirName,
|
|
|
- children: node.children
|
|
|
- };
|
|
|
- },
|
|
|
- // 节点单击事件
|
|
|
- handleNodeClick(data) {
|
|
|
- this.dirId = data.dirId;
|
|
|
- this.queryParams.dirId = this.dirId;
|
|
|
- this.queryParams.searchValue = this.spaceId;
|
|
|
- this.handleQuery();
|
|
|
- },
|
|
|
- //分享
|
|
|
- handleShare(row) {
|
|
|
- row.isEdit = false;
|
|
|
- this.$tab.openPage("文件[" + row.docName + "]预览", '/doc/oo-edit/index/' + row.docId, row);
|
|
|
+ export default {
|
|
|
+ name: "Info",
|
|
|
+ components: {
|
|
|
+ Treeselect
|
|
|
},
|
|
|
- //下载
|
|
|
- handleDownload(row) {
|
|
|
- this.download(row.docPath, null, row.docName + "." + row.docType);
|
|
|
- row.isEdit = false;
|
|
|
- this.$tab.openPage("文件[" + row.docName + "]预览", '/doc/oo-edit/index/' + row.docId, row);
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 文件基本信息表格数据
|
|
|
+ infoList: [],
|
|
|
+ //目录ID
|
|
|
+ dirId: undefined,
|
|
|
+ //目录数据
|
|
|
+ dirList: undefined,
|
|
|
+ //文件等级数据
|
|
|
+ levelOptions: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ docName: null,
|
|
|
+ docLevel: null,
|
|
|
+ createYear: null,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ defaultProps: {
|
|
|
+ children: "children",
|
|
|
+ label: "dirName",
|
|
|
+ id: "dirId"
|
|
|
+ },
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ docName: [{
|
|
|
+ required: true,
|
|
|
+ message: "文件名称不能为空",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ dirId: [{
|
|
|
+ required: true,
|
|
|
+ message: "文件目录不能为空",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ docLevel: [{
|
|
|
+ required: true,
|
|
|
+ message: "文件级别不能为空",
|
|
|
+ trigger: "blur"
|
|
|
+ }],
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- //预览
|
|
|
- handlePreview(row) {
|
|
|
- row.isEdit = false;
|
|
|
- this.$tab.openPage("文件[" + row.docName + "]预览", '/doc/oo-edit/index/' + row.docId, row);
|
|
|
+ created() {
|
|
|
+ this.dirTree();
|
|
|
},
|
|
|
- //在线编辑
|
|
|
- handleEdit(row) {
|
|
|
- row.isEdit = true;
|
|
|
- this.$tab.openPage("文件[" + row.docName + "]在线编辑", '/doc/oo-edit/index/' + row.docId, row);
|
|
|
+ watch: {
|
|
|
+ "form.docPath": function(path, old) {
|
|
|
+ if (path && path.lastIndexOf("/") > -1) {
|
|
|
+ let name = path.slice(path.lastIndexOf("/") + 1);
|
|
|
+ this.form.docName = name.split("_")[0];
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
- //先获取左边目录树,拿到目录ID和spaceId才能查询
|
|
|
- dirTree() {
|
|
|
- this.loading = true;
|
|
|
- personalList().then(response => {
|
|
|
- this.dirId = response.data[0].dirId;
|
|
|
- this.spaceId = response.data[0].spaceId;
|
|
|
- this.dirList = this.handleTree(response.data, "dirId");
|
|
|
-
|
|
|
+ methods: {
|
|
|
+ /** 转换目录信息数据结构 */
|
|
|
+ normalizer(node) {
|
|
|
+ if (node.children && !node.children.length) {
|
|
|
+ delete node.children;
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ id: node.dirId,
|
|
|
+ label: node.dirName,
|
|
|
+ children: node.children
|
|
|
+ };
|
|
|
+ },
|
|
|
+ // 节点单击事件
|
|
|
+ handleNodeClick(data) {
|
|
|
+ this.dirId = data.dirId;
|
|
|
this.queryParams.dirId = this.dirId;
|
|
|
this.queryParams.searchValue = this.spaceId;
|
|
|
- this.getList();
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ //分享
|
|
|
+ handleShare(row) {
|
|
|
+ row.isEdit = false;
|
|
|
+ this.$tab.openPage("文件[" + row.docName + "]预览", '/doc/oo-edit/index/' + row.docId, row);
|
|
|
+ },
|
|
|
+ /**下载按钮操作*/
|
|
|
+ handleDownload(row) {
|
|
|
+ location.href = row.docPath;
|
|
|
+ },
|
|
|
+ //预览
|
|
|
+ handlePreview(row) {
|
|
|
+ row.isEdit = false;
|
|
|
+ this.$tab.openPage("文件[" + row.docName + "]预览", '/doc/oo-edit/index/' + row.docId, row);
|
|
|
+ },
|
|
|
+ //在线编辑
|
|
|
+ handleEdit(row) {
|
|
|
+ row.isEdit = true;
|
|
|
+ this.$tab.openPage("文件[" + row.docName + "]在线编辑", '/doc/oo-edit/index/' + row.docId, row);
|
|
|
+ },
|
|
|
+ //先获取左边目录树,拿到目录ID和spaceId才能查询
|
|
|
+ dirTree() {
|
|
|
+ this.loading = true;
|
|
|
+ personalList().then(response => {
|
|
|
+ this.dirId = response.data[0].dirId;
|
|
|
+ this.spaceId = response.data[0].spaceId;
|
|
|
+ this.dirList = this.handleTree(response.data, "dirId");
|
|
|
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
- /** 查询文件基本信息列表 */
|
|
|
- getList() {
|
|
|
- this.loading = true;
|
|
|
- listInfo(this.queryParams).then(response => {
|
|
|
- this.infoList = response.rows;
|
|
|
- this.total = response.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
- },
|
|
|
- // 取消按钮
|
|
|
- cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
- },
|
|
|
- // 表单重置
|
|
|
- reset() {
|
|
|
- this.form = {
|
|
|
- docId: null,
|
|
|
- dirId: this.dirId,
|
|
|
- docName: null,
|
|
|
- docType: null,
|
|
|
- docSize: null,
|
|
|
- classifyId: null,
|
|
|
- docDesc: null,
|
|
|
- docPath: null,
|
|
|
- docLevel: null,
|
|
|
- allowEdit: null,
|
|
|
- docOf: null,
|
|
|
- owner: null,
|
|
|
- createYear: null,
|
|
|
- createBy: null,
|
|
|
- createTime: null,
|
|
|
- updateBy: null,
|
|
|
- updateTime: null,
|
|
|
- remark: null,
|
|
|
- isDel: null,
|
|
|
- searchValue: this.spaceId
|
|
|
- };
|
|
|
- this.resetForm("form");
|
|
|
- },
|
|
|
- /** 搜索按钮操作 */
|
|
|
- handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
- this.getList();
|
|
|
- },
|
|
|
- /** 重置按钮操作 */
|
|
|
- resetQuery() {
|
|
|
- this.resetForm("queryForm");
|
|
|
- this.queryParams.dirId = this.dirId;
|
|
|
- this.queryParams.searchValue = this.spaceId;
|
|
|
- this.handleQuery();
|
|
|
- },
|
|
|
- // 多选框选中数据
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.docId)
|
|
|
- this.single = selection.length !== 1
|
|
|
- this.multiple = !selection.length
|
|
|
- },
|
|
|
- /** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
- this.reset();
|
|
|
- listLevel().then(response => {
|
|
|
- this.levelOptions = response.rows;
|
|
|
+ this.queryParams.dirId = this.dirId;
|
|
|
+ this.queryParams.searchValue = this.spaceId;
|
|
|
+ this.getList();
|
|
|
+ //获取文件级别数据
|
|
|
+ listLevel().then(response => {
|
|
|
+ this.levelOptions = response.rows;
|
|
|
+ });
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /**处理文档级别数据*/
|
|
|
+ fileLevelData(row, col, value) {
|
|
|
+ const obj=this.levelOptions.find(item => item.levelId == value);
|
|
|
+ // console.log(obj);
|
|
|
+ // console.log(obj.levelName);
|
|
|
+ return obj.levelName;
|
|
|
+ },
|
|
|
+
|
|
|
+ /** 查询文件基本信息列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listInfo(this.queryParams).then(response => {
|
|
|
+ this.infoList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ docId: null,
|
|
|
+ dirId: this.dirId,
|
|
|
+ docName: null,
|
|
|
+ docType: null,
|
|
|
+ docSize: null,
|
|
|
+ classifyId: null,
|
|
|
+ docDesc: null,
|
|
|
+ docPath: null,
|
|
|
+ docLevel: null,
|
|
|
+ allowEdit: null,
|
|
|
+ docOf: null,
|
|
|
+ owner: null,
|
|
|
+ createYear: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null,
|
|
|
+ remark: null,
|
|
|
+ isDel: null,
|
|
|
+ searchValue: this.spaceId
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.queryParams.dirId = this.dirId;
|
|
|
+ this.queryParams.searchValue = this.spaceId;
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.docId)
|
|
|
+ this.single = selection.length !== 1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
this.open = true;
|
|
|
this.title = "添加文件基本信息";
|
|
|
- });
|
|
|
- },
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- const docId = row.docId || this.ids
|
|
|
- getInfo(docId, row.createYear).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- this.open = true;
|
|
|
- this.title = "修改文件基本信息";
|
|
|
- });
|
|
|
- },
|
|
|
- /** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.docId != null) {
|
|
|
- updateInfo(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- } else {
|
|
|
- addInfo(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const docId = row.docId || this.ids
|
|
|
+ getInfo(docId, row.createYear).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改文件基本信息";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.docId != null) {
|
|
|
+ updateInfo(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addInfo(this.form).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const docIds = row.docId || this.ids;
|
|
|
+ this.$modal.confirm('是否确认删除文件基本信息编号为"' + docIds + '"的数据项?').then(function() {
|
|
|
+ return delInfo(docIds);
|
|
|
+ }).then(() => {
|
|
|
+ this.getList();
|
|
|
+ this.$modal.msgSuccess("删除成功");
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ this.download('doc/info/export', {
|
|
|
+ ...this.queryParams
|
|
|
+ }, `info_${new Date().getTime()}.xlsx`)
|
|
|
+ },
|
|
|
+ /**格式化文件大小数据*/
|
|
|
+ fileSizeData(row, col, value) {
|
|
|
+ const KB = 1;
|
|
|
+ const MB = KB * 1024;
|
|
|
+ const GB = MB * 1024;
|
|
|
+ if (value < MB) {
|
|
|
+ return `${(value / KB).toFixed(2)} KB`;
|
|
|
+ } else if (value < GB) {
|
|
|
+ return `${(value / MB).toFixed(2)} MB`;
|
|
|
+ } else {
|
|
|
+ return `${(value / GB).toFixed(2)} GB`;
|
|
|
}
|
|
|
- });
|
|
|
- },
|
|
|
- /** 删除按钮操作 */
|
|
|
- handleDelete(row) {
|
|
|
- const docIds = row.docId || this.ids;
|
|
|
- this.$modal.confirm('是否确认删除文件基本信息编号为"' + docIds + '"的数据项?').then(function() {
|
|
|
- return delInfo(docIds);
|
|
|
- }).then(() => {
|
|
|
- this.getList();
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
- }).catch(() => {});
|
|
|
- },
|
|
|
- /** 导出按钮操作 */
|
|
|
- handleExport() {
|
|
|
- this.download('doc/info/export', {
|
|
|
- ...this.queryParams
|
|
|
- }, `info_${new Date().getTime()}.xlsx`)
|
|
|
- },
|
|
|
- /**格式化文件大小数据*/
|
|
|
- fileSizeData(row, col, value) {
|
|
|
- const KB = 1;
|
|
|
- const MB = KB * 1024;
|
|
|
- const GB = MB * 1024;
|
|
|
- if (value < MB) {
|
|
|
- return `${(value / KB).toFixed(2)} KB`;
|
|
|
- } else if (value < GB) {
|
|
|
- return `${(value / MB).toFixed(2)} MB`;
|
|
|
- } else {
|
|
|
- return `${(value / GB).toFixed(2)} GB`;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang='scss'>
|