Commit 56ac0bca authored by daywrite's avatar daywrite

文档管理列表

parent cec12ca5
<template>
<section>
<div class="content">
<div>
<el-row :gutter="10" class="header-title">
<el-col :span="12">
<h2>客户名称:{{ (result.list[0] && result.list[0].client && result.list[0].client.name) || '未知' }}</h2>
</el-col>
</el-row>
</div>
<div class="page-body-content leaveMessage">
<Item
v-for="item in result.list"
:item="item"
:key="item.id">
<span slot="opearate" class="obear-opearate-button">
<el-button
type="primary"
size="mini"
@click.prevent.stop="leaveMessageSch(item)">
<span class="badge" v-if="item.commentCount.comment">
{{ item.commentCount.comment ? item.commentCount.comment : '' }}
</span>
<i class="fa fa-commenting"></i>留言
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="editSch(item)"
:disabled="item.can_update">
<i class="fa fa-edit animated"></i>编辑
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="deleteSch(item.id)"
:disabled="item.can_delete">
<i class="fa fa-trash-o animated-hove"></i>删除
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="downloadSch(item)"
:disabled="item.can_delete">
<i class="fa fa-fw fa-download"></i>下载
</el-button>
</span>
</Item>
<Pagenation
@update:pager="pager => {updatePage(pager)}"
:total="result.pagenation.totalcount">
</Pagenation>
<leave-message
ref="leaveMessage"
:lmTemplate="lmTemplate"
:type="11">
</leave-message>
</div>
</div>
<FormModal ref="formModal"></FormModal>
</section>
</template>
<script>
import Item from './documentItem'
import FormModal from '../document/documentModal'
import Pagenation from './documentPagenation'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'documentHome',
components: {
Item,
FormModal,
Pagenation
},
data () {
return {
lmTemplate: [
{
name: '文档名称',
value: 'title'
},
{
name: '文档部门',
value: 'department.name'
},
{
name: '文档类型',
value: 'documentTypeTag.name'
},
{
name: '是否为模版',
value: 'is_template_display'
},
{
name: '录入人',
value: 'createdBy.name'
},
{
name: '创建时间',
value: 'end_at'
}
],
filter: [],
form: {
'ClientSearch[keyword]': ''
},
pagenation: {
thispage: 1,
pagesize: 10
},
result: {
list: [],
pagenation: {
totalcount: 1,
thispage: 1,
pagesize: 10
},
thisUser: {
id: '',
name: '',
sex: ''
}
}
}
},
mounted () {
this.init()
},
methods: {
init () {
let id = this.id = this.$route.params.id
this.getList({
id,
page: this.pagenation.thispage
})
},
// 2.列表数据
getList (ret) {
requestAPI(api.getDocList, ret).then((res) => {
const {
list = [],
pagenation = {},
thisUser = {}
} = res
this.result.list = list
this.result.pagenation = pagenation
this.result.thisUser = thisUser
})
},
// 4.重新加载
_reload () {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {})
this.getList(ret)
},
// 6.1新增
addSch () {
this.$refs.formModal.show()
},
// 6.2编辑
editSch (item) {
this.$refs.formModal.show(item)
},
// 7.删除
deleteSch (id) {
this.$confirm('删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.deleteDoc, { id })
.then((res) => {
this.$message.success('删除成功')
this._reload()
})
}).catch(() => {
this.$message.info('取消删除')
})
},
downloadSch (item) {
window.open(item.attachment.name, '_self')
},
// 8.留言
leaveMessageSch (item) {
this.$refs.leaveMessage.btnShow(item)
},
lmClose () {
this.$refs.leaveMessage &&
this.$refs.leaveMessage.btnClose()
}
}
}
</script>
<style scoped lang="scss">
@include c('opearate-button') {
> .el-button {
margin-right:0px;
}
& .btn-primary .badge {
color: #333744;
background-color: #fff;
}
& .badge {
position: relative;
top: 0px;
left: -5px;
display: inline-block;
padding: 0px 5px;
font-size: 12px;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25rem;
background:white;
color:#333744;
}
i {
display: inline-block;
padding-right: 3px;
}
}
</style>
import DocumentHome from '../components/document_list/documentHome' import DocumentHome from '../components/document_list/documentHome'
import DocumentView from '../components/document_list/documentView'
const routes = [{ const routes = [{
path: '/document', path: '/document',
name: 'documentHome', name: 'documentHome',
component: DocumentHome component: DocumentHome
}, {
path: '/ofClient/:id',
name: 'documentView',
component: DocumentView
}] }]
export default routes export default routes
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment