|
|
@@ -1,20 +1,15 @@
|
|
|
<template>
|
|
|
- <ibps-layout ref="layout">
|
|
|
+ <div class="main-container">
|
|
|
<!-- 外部 -->
|
|
|
<div slot="west">
|
|
|
<div class="box">
|
|
|
- <p class="title">文件类型</p>
|
|
|
- <el-input placeholder="输入关键字进行过滤"
|
|
|
- v-model="filterText">
|
|
|
- </el-input>
|
|
|
- <div class="treeDiv">
|
|
|
- <el-tree ref="tree"
|
|
|
- :width="width"
|
|
|
- :data="paramsTypeData"
|
|
|
- :props="defaultProps"
|
|
|
+ <ibps-tree :width="width"
|
|
|
+ :height="height"
|
|
|
+ :data="treeData"
|
|
|
@node-click="handleNodeClick"
|
|
|
- :filter-node-method="filterNode"></el-tree>
|
|
|
- </div>
|
|
|
+ @expand-collapse="handleExpandCollapse"
|
|
|
+ title="分类管理">
|
|
|
+ </ibps-tree>
|
|
|
</div>
|
|
|
<ibps-container :margin-left="width + 'px'"
|
|
|
class="page">
|
|
|
@@ -39,7 +34,7 @@
|
|
|
@pagination-change="handlePaginationChange">
|
|
|
<template slot="wenjinachayue"
|
|
|
slot-scope="scope">
|
|
|
- <ibps-attachment :value="scope.row.wen_jian_id_"
|
|
|
+ <ibps-attachment :value="scope.row.wen_jian_fu_jian_"
|
|
|
readonly
|
|
|
allow-download
|
|
|
:download="false" />
|
|
|
@@ -49,20 +44,24 @@
|
|
|
</ibps-container>
|
|
|
|
|
|
</div>
|
|
|
- </ibps-layout>
|
|
|
+
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import ActionUtils from '@/utils/action'
|
|
|
import { getFileType, getFileByUserId } from '@/api/permission/file'
|
|
|
import IbpsAttachment from '@/business/platform/file/attachment/selector'
|
|
|
import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
|
|
|
-
|
|
|
+import FixHeight from '@/mixins/height'
|
|
|
+import { findTreeData } from '@/api/platform/cat/type'
|
|
|
export default {
|
|
|
components: {
|
|
|
'ibps-attachment': IbpsAttachment
|
|
|
},
|
|
|
+ mixins: [FixHeight],
|
|
|
data() {
|
|
|
return {
|
|
|
+ treeData: [],
|
|
|
show: '',
|
|
|
rightsArr: ['join', 'delete'],
|
|
|
rowHandle: true,
|
|
|
@@ -70,21 +69,15 @@ export default {
|
|
|
orgId: '',
|
|
|
oldorgId: '',
|
|
|
orgName: '',
|
|
|
+ height: document.clientHeight,
|
|
|
loading: false,
|
|
|
- paramsTypeData: [
|
|
|
- { id: '0', label: '技术类' },
|
|
|
- { id: '1', label: '管理类' },
|
|
|
- { id: '2', label: '参考文献' },
|
|
|
- { id: '3', label: '设备说明资料' },
|
|
|
- { id: '4', label: '伦理审查文件' },
|
|
|
- { id: '5', label: '其它' }
|
|
|
- ],
|
|
|
filterText: '',
|
|
|
defaultProps: {
|
|
|
children: 'children',
|
|
|
label: 'label'
|
|
|
},
|
|
|
pkKey: 'id', // 主键 如果主键不是pk需要传主键
|
|
|
+ loading: false,
|
|
|
listData: [],
|
|
|
selectListData: [],
|
|
|
bianlistData: {
|
|
|
@@ -115,9 +108,9 @@ export default {
|
|
|
// { prop: 'zi_duan_yi_', label: '部门' },
|
|
|
{ prop: 'wen_jian_bian_hao', label: '文件编号', sortable: 'custom', width: 180 },
|
|
|
{ prop: 'wen_jian_ming_che', label: '文件名称', width: 400 },
|
|
|
- { prop: 'ban_ben_hao_', label: '实施时间', width: 120 },
|
|
|
+ { prop: 'ban_ben_', label: '版本', width: 120 },
|
|
|
{ prop: 'fa_bu_ri_qi_', label: '发放日期', width: 100, sortable: 'custom' },
|
|
|
- { prop: 'wen_jian_id_', label: '查阅', slotName: "wenjinachayue", width: 400 }
|
|
|
+ { prop: 'wen_jian_fu_jian_', label: '查阅', slotName: "wenjinachayue", width: 400 }
|
|
|
]
|
|
|
},
|
|
|
listOptions: {
|
|
|
@@ -128,6 +121,7 @@ export default {
|
|
|
limit: 20, page: 1
|
|
|
},
|
|
|
sorts: {},
|
|
|
+ sqlWhere: {}
|
|
|
// testData: [{
|
|
|
// zi_duan_yi_: '1',
|
|
|
// wen_jian_bian_hao: '2',
|
|
|
@@ -138,51 +132,119 @@ export default {
|
|
|
// }]
|
|
|
}
|
|
|
},
|
|
|
+ created() {
|
|
|
+ this.loadTreeData()
|
|
|
+ },
|
|
|
mounted() {
|
|
|
// this.loadNode()
|
|
|
},
|
|
|
methods: {
|
|
|
- filterNode(value, data) {
|
|
|
- if (!value) return true;
|
|
|
- return data.label.indexOf(value) !== -1;
|
|
|
+ // 加载具体分类数据
|
|
|
+ loadTreeData(isEdit) {
|
|
|
+ findTreeData({ 'categoryKey': 'FILE_TYPE' }).then(response => {
|
|
|
+ const data = response.data
|
|
|
+ this.treeData = data
|
|
|
+ this.show = isEdit
|
|
|
+ })
|
|
|
},
|
|
|
+ handleExpandCollapse(isExpand, readonly = false) {
|
|
|
+ this.width = isExpand ? 200 : 50
|
|
|
+ },
|
|
|
+
|
|
|
loadNode() {
|
|
|
this.loading = true
|
|
|
},
|
|
|
- refreshData() {
|
|
|
- console.log('11111111111111')
|
|
|
+ getDatas() {
|
|
|
+ const { fileCode, fileType, fileName, sorts, userId } = this.sqlWhere
|
|
|
+ this.listData = []
|
|
|
+ let wheres = ''
|
|
|
+ if (fileCode) {
|
|
|
+ wheres = wheres + ` and wj.wen_jian_bian_hao like '%${fileCode}%'`
|
|
|
+ }
|
|
|
+ if (fileName) {
|
|
|
+ wheres = wheres + ` and wj.wen_jian_ming_che like '%${fileName}%'`
|
|
|
+ }
|
|
|
+ if (fileType) {
|
|
|
+ wheres = wheres + ` and FIND_IN_SET (wj.xi_lei_id_,'${fileType}')`
|
|
|
+ }
|
|
|
|
|
|
- this.tableData = []
|
|
|
+ if (sorts) {
|
|
|
+ if (JSON.stringify(sorts) !== "{}") {
|
|
|
+ wheres = wheres + ` order by ${Object.keys(sorts)} ${Object.values(sorts)}`
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 重复发放的文件,在权限表会存在重复的文件信息
|
|
|
+ let sql = `select wj.wen_jian_bian_hao,wj.wen_jian_ming_che,wj.ban_ben_,qx.create_time_,wj.wen_jian_fu_jian_,qx.fa_bu_ri_qi_ FROM (SELECT a.id_,a.create_by_,MAX(a.create_time_) create_time_ ,a.yong_hu_id_,a.wen_jian_id_,a.fa_bu_ri_qi_,a.shou_quan_ FROM t_wjcysqb a GROUP BY yong_hu_id_,wen_jian_id_) qx LEFT JOIN t_wjxxb wj ON qx.wen_jian_id_=wj.wen_jian_fu_jian_ WHERE qx.shou_quan_='1' and qx.yong_hu_id_='${userId}' ${wheres}`
|
|
|
+ curdPost('sql', sql).then(res => {
|
|
|
+ let tableDatas = res.variables.data
|
|
|
+ this.selectListData = JSON.parse(JSON.stringify(tableDatas))
|
|
|
+ let filterDatas = []
|
|
|
+ this.bianlistData.pageResult.totalCount = tableDatas.length
|
|
|
+ this.bianlistData.pageResult.totalPages = Math.ceil(tableDatas.length / this.pagination.limit)
|
|
|
+ this.bianlistData.pageResult.limit = this.pagination.limit
|
|
|
+ this.bianlistData.pageResult.page = this.pagination.page
|
|
|
+ if (this.pagination.limit > tableDatas.length) {
|
|
|
+ filterDatas = JSON.parse(JSON.stringify(tableDatas))
|
|
|
+ } else {
|
|
|
+ for (let index = 0; index < 20; index++) {
|
|
|
+ filterDatas.push(tableDatas[index])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ this.bianlistData.dataResult = filterDatas
|
|
|
+ ActionUtils.handleListData(this, this.bianlistData)
|
|
|
+ }).catch(res => {
|
|
|
+ this.loading = false
|
|
|
+ this.listData = []
|
|
|
+ })
|
|
|
+ },
|
|
|
+ refreshData() {
|
|
|
+ this.listData = []
|
|
|
this.getDatas(this.getSearcFormData())
|
|
|
},
|
|
|
-
|
|
|
handleNodeClick(data) {
|
|
|
- this.oldorgId = data
|
|
|
this.show = 'detail'
|
|
|
+ let fileTypes = []
|
|
|
if (this.oldorgId == data.id) {
|
|
|
return
|
|
|
+ }
|
|
|
+ if (data.children == undefined) {
|
|
|
+ fileTypes.push(data.id)
|
|
|
} else {
|
|
|
- this.getDatas({
|
|
|
- fileType: this.paramsTypeData[data.id].label,
|
|
|
- userId: this.$store.getters.userInfo.employee.id,
|
|
|
- sorts: { 'wen_jian_bian_hao': 'desc' }
|
|
|
- })
|
|
|
+ const getTail = item => item.children && item.children.length > 0 ? item.children.map(m => getTail(m)) : [item]
|
|
|
+ const result = _.flattenDeep(data.children.map(m => getTail(m)))
|
|
|
+ for (var i of result) {
|
|
|
+ fileTypes.push(i.id)
|
|
|
+ }
|
|
|
}
|
|
|
+ this.oldorgId = data.id
|
|
|
+ this.sqlWhere = {
|
|
|
+ fileType: fileTypes.join(','),
|
|
|
+ userId: this.$store.getters.userInfo.employee.id,
|
|
|
+ sorts: { 'wen_jian_bian_hao': 'desc' }
|
|
|
+ }
|
|
|
+ this.getDatas()
|
|
|
},
|
|
|
+
|
|
|
/**
|
|
|
- * 获取格式化参数
|
|
|
- */
|
|
|
+ * 获取格式化参数
|
|
|
+ */
|
|
|
getSearcFormData() {
|
|
|
const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
|
|
|
- console.log('params', params)
|
|
|
- params['fileType'] = this.paramsTypeData[this.oldorgId.id].label
|
|
|
- params['userId'] = this.$store.getters.userInfo.employee.id
|
|
|
- params['sorts'] = this.sorts
|
|
|
- return params
|
|
|
+ if (params.fileCode) {
|
|
|
+ this.sqlWhere.fileCode = params.fileCode
|
|
|
+ } else {
|
|
|
+ this.sqlWhere.fileCode = ''
|
|
|
+ }
|
|
|
+ if (params.fileName) {
|
|
|
+ this.sqlWhere.fileName = params.fileName
|
|
|
+ }else{
|
|
|
+ this.sqlWhere.fileName = ''
|
|
|
+ }
|
|
|
+ this.getDatas()
|
|
|
},
|
|
|
/**
|
|
|
- * 处理按钮事件
|
|
|
- */
|
|
|
+ * 处理按钮事件
|
|
|
+ */
|
|
|
handleAction(command, position, selection, data) {
|
|
|
switch (command) {
|
|
|
case 'search':// 查询
|
|
|
@@ -196,8 +258,8 @@ export default {
|
|
|
* 处理排序
|
|
|
*/
|
|
|
handleSortChange(sort) {
|
|
|
- ActionUtils.setSorts(this.sorts, sort)
|
|
|
- this.getDatas(this.getSearcFormData())
|
|
|
+ ActionUtils.setSorts(this.sqlWhere.sorts, sort)
|
|
|
+ this.getDatas()
|
|
|
},
|
|
|
// 处理分页事件
|
|
|
handlePaginationChange(page) {
|
|
|
@@ -218,50 +280,6 @@ export default {
|
|
|
}
|
|
|
ActionUtils.handleListData(this, this.bianlistData)
|
|
|
},
|
|
|
- getDatas(sorts) {
|
|
|
- let wheres = ''
|
|
|
- if (sorts.fileCode) {
|
|
|
- wheres = wheres + ` and wj.wen_jian_bian_hao like '%${sorts.fileCode}%'`
|
|
|
- }
|
|
|
-
|
|
|
- if (sorts.fileType) {
|
|
|
- wheres = wheres + ` and wj.wen_jian_lie_xing = '${sorts.fileType}'`
|
|
|
- }
|
|
|
- if (sorts.fileName) {
|
|
|
- wheres = wheres + ` and wj.wen_jian_ming_che like '%${sorts.fileName}%'`
|
|
|
- }
|
|
|
- if (sorts.sorts) {
|
|
|
- if (JSON.stringify(sorts.sorts) !== "{}") {
|
|
|
- wheres = wheres + ` order by ${Object.keys(sorts.sorts)} ${Object.values(sorts.sorts)}`
|
|
|
- }
|
|
|
- }
|
|
|
- // 重复发放的文件,在权限表会存在重复的文件信息
|
|
|
- let sql = `select wj.wen_jian_bian_hao,wj.wen_jian_ming_che,wj.ban_ben_hao_,qx.create_time_,wj.wen_jian_id_,qx.fa_bu_ri_qi_ FROM (
|
|
|
- SELECT a.id_,a.create_by_,MAX(a.create_time_) create_time_ ,a.yong_hu_id_,a.wen_jian_id_,
|
|
|
- a.fa_bu_ri_qi_,a.shou_quan_ FROM t_wjcysqb a GROUP BY yong_hu_id_,wen_jian_id_
|
|
|
- ) qx LEFT JOIN t_wjgl wj ON qx.wen_jian_id_=wj.wen_jian_id_ WHERE qx.shou_quan_='1' and qx.yong_hu_id_='${sorts.userId}' ${wheres}`
|
|
|
-
|
|
|
- curdPost('sql', sql).then(res => {
|
|
|
- let tableDatas = res.variables.data
|
|
|
- this.selectListData = JSON.parse(JSON.stringify(tableDatas))
|
|
|
- let filterDatas = []
|
|
|
- this.bianlistData.pageResult.totalCount = tableDatas.length
|
|
|
- this.bianlistData.pageResult.totalPages = Math.ceil(tableDatas.length / this.pagination.limit)
|
|
|
- this.bianlistData.pageResult.limit = this.pagination.limit
|
|
|
- this.bianlistData.pageResult.page = this.pagination.page
|
|
|
- if (this.pagination.limit > tableDatas.length) {
|
|
|
- filterDatas = JSON.parse(JSON.stringify(tableDatas))
|
|
|
- } else {
|
|
|
- for (let index = 0; index < 20; index++) {
|
|
|
- filterDatas.push(tableDatas[index])
|
|
|
- }
|
|
|
- }
|
|
|
- this.bianlistData.dataResult = filterDatas
|
|
|
- ActionUtils.handleListData(this, this.bianlistData)
|
|
|
- }).catch(res => {
|
|
|
- this.loading = false
|
|
|
- })
|
|
|
- },
|
|
|
},
|
|
|
watch: {
|
|
|
filterText(val) {
|
|
|
@@ -285,3 +303,4 @@ export default {
|
|
|
display: block;
|
|
|
}
|
|
|
</style>
|
|
|
+
|