|
|
|
|
@ -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`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|