|
|
@@ -3,32 +3,7 @@
|
|
|
<el-row :gutter="20">
|
|
|
<!--机构数据-->
|
|
|
<el-col :span="4" :xs="24">
|
|
|
- <div class="head-container">
|
|
|
- <el-input
|
|
|
- v-model="deptName"
|
|
|
- placeholder="请输入机构名称"
|
|
|
- clearable
|
|
|
- size="small"
|
|
|
- prefix-icon="el-icon-search"
|
|
|
- style="margin-bottom: 20px"
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="tree-container">
|
|
|
- <div style="margin-bottom: 10px;">
|
|
|
- <el-checkbox v-model="queryParams.checkSub" @change="changeCheckBox">是否关联下级机构</el-checkbox>
|
|
|
- </div>
|
|
|
- <el-tree
|
|
|
- :data="deptOptions"
|
|
|
- :props="defaultProps"
|
|
|
- :expand-on-click-node="false"
|
|
|
- :filter-node-method="filterNode"
|
|
|
- ref="tree"
|
|
|
- node-key="id"
|
|
|
- :default-expanded-keys="defaultKeys"
|
|
|
- :default-checked-keys="defaultKeys"
|
|
|
- @node-click="handleNodeClick"
|
|
|
- />
|
|
|
- </div>
|
|
|
+ <org-tree v-model="queryParams.orgId" @defaultKey="getDefaultKey" @checkChange="checkChange" @click="clickTreeNode"></org-tree>
|
|
|
</el-col>
|
|
|
<!--用户数据-->
|
|
|
<el-col :span="20" :xs="24">
|
|
|
@@ -109,23 +84,24 @@
|
|
|
</el-col>
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
-
|
|
|
+ <!-- 表格数据 -->
|
|
|
<el-table v-loading="loading" :data="materialsList" @selection-change="handleSelectionChange">
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="资料标题" align="center" prop="title" />
|
|
|
- <el-table-column label="资料类型" align="center" prop="knowledgeId" />
|
|
|
+ <el-table-column label="资料类型" align="center" prop="knowledgeName" />
|
|
|
<el-table-column label="机构名称" align="center" prop="orgName" />
|
|
|
- <el-table-column label="公开状态" align="center" prop="isOpen" />
|
|
|
+ <el-table-column label="公开状态" align="center" prop="isOpen" >
|
|
|
+ <template slot-scope="r">{{ r.row.isOpen == 0 ? '未公开' : '公开' }}</template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="附件" align="center" prop="file" />
|
|
|
<el-table-column label="备注" align="center" prop="remark" />
|
|
|
<el-table-column label="更新时间" align="center" prop="updateTime" width="180">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
|
|
|
- </template>
|
|
|
+
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
+ v-if="checkCanEditOrDel(scope.row)"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@@ -133,6 +109,7 @@
|
|
|
v-hasPermi="['system:materials:edit']"
|
|
|
>修改</el-button>
|
|
|
<el-button
|
|
|
+ v-if="checkCanEditOrDel(scope.row)"
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
@@ -158,11 +135,15 @@
|
|
|
<el-form-item label="资料标题" prop="title">
|
|
|
<el-input v-model="form.title" placeholder="请输入资料标题" />
|
|
|
</el-form-item>
|
|
|
+
|
|
|
<el-form-item label="资料类型" prop="knowledgeId">
|
|
|
- <el-input v-model="form.knowledgeId" placeholder="请选择资料类型" />
|
|
|
+ <el-select v-model="form.knowledgeId" placeholder="请选择资料类型">
|
|
|
+ <el-option v-for="item in knowledgeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="资料内容" prop="knowledgeId">
|
|
|
- <el-input v-model="form.knowledgeId" placeholder="请选择资料类型" />
|
|
|
+
|
|
|
+ <el-form-item label="资料内容" prop="content">
|
|
|
+ <el-input v-model="form.content" placeholder="请输入资料内容" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
<el-input v-model="form.remark" placeholder="请输入备注" />
|
|
|
@@ -182,11 +163,12 @@
|
|
|
<script>
|
|
|
import { listMaterials, getMaterials, delMaterials, addMaterials, updateMaterials } from "@/api/system/materials";
|
|
|
import { deptTreeSelect } from "@/api/system/public";
|
|
|
-import { getToken } from "@/utils/auth";
|
|
|
-import Treeselect from "@riophae/vue-treeselect";
|
|
|
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
|
|
+import {queryKnowledgeList} from "@/api/system/knowledge";
|
|
|
+import OrgTree from "@/components/orgTree/index.vue";
|
|
|
export default {
|
|
|
name: "Materials",
|
|
|
+ components: { OrgTree },
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
|
@@ -223,21 +205,18 @@ export default {
|
|
|
pageSize: 10,
|
|
|
title: null,
|
|
|
knowledgeId: null,
|
|
|
+ content:null,
|
|
|
orgId: null,
|
|
|
- orgName: null,
|
|
|
- orgPath: null,
|
|
|
isOpen: null,
|
|
|
- file: null,
|
|
|
- deleted: null,
|
|
|
- updateTime: null
|
|
|
+ file: null
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
- rules: {
|
|
|
- },
|
|
|
+ rules: {},
|
|
|
//默认选中节点
|
|
|
- defaultKeys:[]
|
|
|
+ defaultKeys:[],
|
|
|
+ knowledgeList: [],
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -251,7 +230,6 @@ export default {
|
|
|
this.getConfigKey("sys.user.initPassword").then(response => {
|
|
|
this.initPassword = response.msg;
|
|
|
});
|
|
|
- this.getList();
|
|
|
},
|
|
|
methods: {
|
|
|
/** 查询学习资料列表 */
|
|
|
@@ -259,10 +237,27 @@ export default {
|
|
|
this.loading = true;
|
|
|
listMaterials(this.queryParams).then(response => {
|
|
|
this.materialsList = response.rows;
|
|
|
+ console.log("this.materialsList",this.materialsList);
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
|
});
|
|
|
},
|
|
|
+ getDeptTree() {
|
|
|
+ deptTreeSelect().then(response => {
|
|
|
+ this.deptOptions = response.data;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ checkCanEditOrDel(row){
|
|
|
+ return row.createBy === this.$store.getters.userId;
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ // 节点单击事件
|
|
|
+ clickTreeNode(data) {
|
|
|
+ this.queryParams.orgId = data.id;
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
/** 下穿状态改变*/
|
|
|
changeCheckBox(){
|
|
|
this.getList();
|
|
|
@@ -278,30 +273,32 @@ export default {
|
|
|
id: null,
|
|
|
title: null,
|
|
|
knowledgeId: null,
|
|
|
- orgId: null,
|
|
|
- orgName: null,
|
|
|
- orgPath: null,
|
|
|
+ content: null,
|
|
|
+ orgId: this.queryParams.orgId,
|
|
|
+ orgName: this.queryParams.orgName,
|
|
|
+ orgPath: this.queryParams.orgPath,
|
|
|
isOpen: null,
|
|
|
file: null,
|
|
|
remark: null,
|
|
|
- deleted: null,
|
|
|
- createBy: null,
|
|
|
- createTime: null,
|
|
|
- updateBy: null,
|
|
|
- updateTime: null
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
+ this.initKnowledgeList();
|
|
|
},
|
|
|
- /** 查询机构下拉树结构 */
|
|
|
- getDeptTree() {
|
|
|
- deptTreeSelect().then(response => {
|
|
|
- this.deptOptions = response.data;
|
|
|
- console.log( this.deptOptions,' this.deptOptions')
|
|
|
- this.defaultKeys.push(response.data[0].id);
|
|
|
- this.queryParams.orgId = response.data[0].id;
|
|
|
- this.handleQuery();
|
|
|
- });
|
|
|
+ getDefaultKey(key){
|
|
|
+ this.queryParams.orgId = key;
|
|
|
+ this.getList();
|
|
|
},
|
|
|
+ //单选框状态改变
|
|
|
+ checkChange(state){
|
|
|
+ this.queryParams.checkSub = state;
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ initKnowledgeList() {
|
|
|
+ queryKnowledgeList().then(response => {
|
|
|
+ this.knowledgeList = response;
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
// 筛选节点
|
|
|
filterNode(value, data) {
|
|
|
if (!value) return true;
|
|
|
@@ -367,7 +364,7 @@ export default {
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids;
|
|
|
- this.$modal.confirm('是否确认删除学习资料编号为"' + ids + '"的数据项?').then(function() {
|
|
|
+ this.$modal.confirm('是否确认删除?').then(function() {
|
|
|
return delMaterials(ids);
|
|
|
}).then(() => {
|
|
|
this.getList();
|