档案目录

master
wanglei 2 years ago
parent f455fa231a
commit 298607bdf3

@ -195,7 +195,7 @@
}
</style>
</head>
<body>
<body style="overflow-x: hidden">
<div id="app">
<div id="loader-wrapper">
<div id="loader"></div>

@ -10,7 +10,8 @@
</template>
<script>
import iframeToggle from "./IframeToggle/index"
import iframeToggle from "./IframeToggle/index";
import watermark from "@/utils/watermark.js"
export default {
name: 'AppMain',
@ -22,6 +23,10 @@ export default {
key() {
return this.$route.path
}
},
mounted() {
console.log(this.$store.state.user, this.$store.state.user.name);
watermark.set( this.parseTime(new Date()) , this.$store.state.user.name)
}
}
</script>

@ -0,0 +1,63 @@
let watermark = {}
let setWatermark = (str,date) => {
let id = '1.23452384164.123412416'
if (document.getElementById(id) !== null) {
document.body.removeChild(document.getElementById(id))
}
//创建一个画布
let can = document.createElement('canvas')
//设置画布的长宽
can.width = 200
can.height = 150
let cans = can.getContext('2d')
//旋转角度
cans.rotate(-15 * Math.PI / 180)
cans.font = '14px Vedana'
//设置填充绘画的颜色、渐变或者模式
cans.fillStyle = 'rgba(200, 200, 200, 0.40)'
//设置文本内容的当前对齐方式
cans.textAlign = 'left'
//设置在绘制文本时使用的当前文本基线
cans.textBaseline = 'Middle'
//在画布上绘制填色的文本输出的文本开始绘制文本的X坐标位置开始绘制文本的Y坐标位置
cans.fillText(str, can.width / 4, can.height / 2)
cans.fillText(date,can.width / 4, can.height / 3)
let div = document.createElement('div')
div.id = id
div.style.pointerEvents = 'none'
div.style.top = '30px'
div.style.left = '0px'
div.style.position = 'absolute'
div.style.zIndex = '100'
div.style.width = document.documentElement.clientWidth + 'px'
div.style.height = document.documentElement.clientHeight + 'px'
div.style.background = 'url(' + can.toDataURL('image/png') + ') left top repeat'
// document.body.appendChild(div)
div.style.opacity = '0.6' // 水印的透明度
document.body.appendChild(div)
return id
}
// 该方法只允许调用一次
watermark.set = (str,date) => {
let id = setWatermark(str,date) // str,date代表的是两行水印。如果需好几个的话再追加。
setInterval(() => {
if (document.getElementById(id) === null) {
id = setWatermark(str,date)
}
}, 500);
window.onresize = () => {
setWatermark(str,date)
};
}
watermark.remove = () => {
let id = '1.23452384164.123412416'
if (document.getElementById(id) !== null) {
document.body.removeChild(document.getElementById(id))
}
}
export default watermark

@ -9,14 +9,6 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="父目录ID" prop="pid">
<el-input
v-model="queryParams.pid"
placeholder="请输入父目录ID"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="祖级列表" prop="ancestors">
<el-input
v-model="queryParams.ancestors"
@ -52,48 +44,35 @@
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['dangan:catalog:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
type="info"
plain
icon="el-icon-delete"
icon="el-icon-sort"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['dangan:catalog:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['dangan:catalog:export']"
>导出</el-button>
@click="toggleExpandAll"
>展开/折叠</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="catalogList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table v-if="refreshTable"
v-loading="loading"
:data="list"
row-key="id"
:default-expand-all="isExpandAll"
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column label="ID" align="center" prop="id" width="120"/>
<el-table-column label="目录名称" align="center" prop="muName" />
<el-table-column label="父目录ID" align="center" prop="pid" />
<el-table-column label="祖级列表" align="center" prop="ancestors" />
<el-table-column label="显示顺序" align="center" prop="orderNum" />
<el-table-column label="业务类型(字典)" align="center" prop="ywType" />
<el-table-column label="菜单状态" align="center" prop="status" />
<el-table-column label="状态" align="center" prop="status" >
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
@ -104,6 +83,13 @@
@click="handleUpdate(scope.row)"
v-hasPermi="['dangan:catalog:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-plus"
@click="handleAdd(scope.row)"
v-hasPermi="['dangan:catalog:add']"
>新增</el-button>
<el-button
size="mini"
type="text"
@ -111,29 +97,44 @@
@click="handleDelete(scope.row)"
v-hasPermi="['dangan:catalog:remove']"
>删除</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['dangan:catalog:edit']"
>档案采集</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改档案目录对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="上级目录" prop="pid">
<treeselect
v-model="form.pid"
:options="muOptions"
:normalizer="normalizer"
:show-count="true"
placeholder="选择上级目录"
/>
</el-form-item>
<el-form-item label="目录名称" prop="muName">
<el-input v-model="form.muName" placeholder="请输入目录名称" />
</el-form-item>
<el-form-item label="父目录ID" prop="pid">
<el-input v-model="form.pid" placeholder="请输入父目录ID" />
</el-form-item>
<el-form-item label="显示顺序" prop="orderNum">
<el-input v-model="form.orderNum" placeholder="请输入显示顺序" />
<el-input-number v-model="form.orderNum" controls-position="right" :min="0" />
</el-form-item>
<el-form-item label="菜单状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio
v-for="dict in dict.type.sys_normal_disable"
:key="dict.value"
:label="dict.value"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
@ -149,33 +150,33 @@
<script>
import { listCatalog, getCatalog, delCatalog, addCatalog, updateCatalog } from "@/api/dangan/catalog";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
name: "Catalog",
components: { Treeselect },
dicts: ['sys_show_hide', 'sys_normal_disable'],
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
catalogList: [],
//
list: [],
//
muOptions: [],
//
title: "",
//
open: false,
//
isExpandAll: false,
//
refreshTable: true,
//
queryParams: {
pageNum: 1,
pageSize: 10,
muName: null,
pid: null,
ancestors: null,
@ -190,6 +191,9 @@ export default {
muName: [
{ required: true, message: "目录名称不能为空", trigger: "blur" }
],
orderNum: [
{ required: true, message: "目录顺序不能为空", trigger: "blur" }
],
}
};
},
@ -197,13 +201,34 @@ export default {
this.getList();
},
methods: {
/** 查询档案目录列表 */
/** 查询目录列表 */
getList() {
this.loading = true;
listCatalog(this.queryParams).then(response => {
this.catalogList = response.rows;
this.total = response.total;
this.list = this.handleTree(response.data, "id","pid");
this.loading = false;
console.log(this.list);
});
},
/** 转换目录数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.muName,
children: node.children
};
},
/** 查询目录下拉树结构 */
getTreeselect() {
listCatalog().then(response => {
this.muOptions = [];
const menu = { id: 0, muName: '主类目', children: [] };
menu.children = this.handleTree(response.data, "id", "pid");
this.muOptions.push(menu);
});
},
//
@ -231,7 +256,6 @@ export default {
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
@ -239,33 +263,41 @@ export default {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
handleAdd(row) {
this.reset();
this.getTreeselect();
if (row != null && row.id) {
this.form.pid = row.id;
} else {
this.form.pid = 0;
}
this.open = true;
this.title = "添加档案目录";
this.title = "添加目录";
},
/** 展开/折叠操作 */
toggleExpandAll() {
this.refreshTable = false;
this.isExpandAll = !this.isExpandAll;
this.$nextTick(() => {
this.refreshTable = true;
});
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCatalog(id).then(response => {
this.getTreeselect();
getCatalog(row.id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改档案目录";
this.title = "修改目录";
});
},
/** 提交按钮 */
submitForm() {
submitForm: function() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
if (this.form.id != undefined) {
updateCatalog(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
@ -283,19 +315,12 @@ export default {
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除档案目录编号为"' + ids + '"的数据项?').then(function() {
return delCatalog(ids);
this.$modal.confirm('是否确认删除名称为"' + row.muName + '"的数据项?').then(function() {
return delCatalog(row.id);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
this.download('dangan/catalog/export', {
...this.queryParams
}, `catalog_${new Date().getTime()}.xlsx`)
}
}
};

Loading…
Cancel
Save