Commit a678a008 authored by daywrite's avatar daywrite

文档管理列表

parent 7b076dd9
......@@ -37,6 +37,12 @@
"title": "项目管理",
"appName": 'task',
"url": "/task"
}, {
"icon": "fa-home",
"isRouteShow": 1,
"title": "文档管理",
"appName": 'document',
"url": "/document"
}],
homePage: {
appName: 'reimbursement',
......
import ScheduleApi from './apis/schedule.js'
import ReimburrsementApi from './apis/reimbursement.js'
import TaskApi from './apis/task.js'
import DocumentApi from './apis/document.js'
const API_HOST = process.env.API_HOST
const API_PORT = process.env.API_PORT
......@@ -28,7 +29,7 @@ let apis = {}
apis = Object.assign(apis, ScheduleApi)
apis = Object.assign(apis, ReimburrsementApi)
apis = Object.assign(apis, TaskApi)
apis = Object.assign(apis, DocumentApi)
export default {
option,
...apis
......
export default {
getDocFilter: {
url: '/vue/document/get-filter'
},
getDocList: {
url: '/vue/document/list'
},
getDocNew: {
url: '/vue/ducument/get-new'
},
saveDocNew: {
url: '/vue/ducument/save-new'
},
getDocEdit: {
url: '/vue/ducument/get-edit'
},
saveDocEdit: {
url: '/vue/ducument/save-edit'
},
deleteDoc: {
url: '/vue/ducument/delete'
}
}
@import './schedule-app.scss';
@import './reim-app.scss';
@import './task-app.scss'
@import './task-app.scss';
@import './document-app.scss';
<template>
<section>
<div class="content">
<search-header
ref="searchHeader"
:title="'文档管理'"
:search-key="'ClientSearch'"
:add-title="'新建文档'"
@update:headerSearch="search => searchKeyword(search)"
@update:headerAdd="() => addSch()"
@update:headerClear="() => searchClear()">
</search-header>
<search-form
ref="clientForm"
:filter="filter"
@update:clientList="form =>{ updateForm(form) }">
</search-form>
<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="deleteSch(item.id)"
: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
v-click-outside="lmClose"
ref="leaveMessage"
:lmTemplate="lmTemplate"
:type="9">
</leave-message>
</div>
</div>
<FormModal ref="fromModal"></FormModal>
</section>
</template>
<script>
import SearchHeader from '../common/searchHeader'
import SearchForm from '../common/SearchForm'
import Item from './documentItem'
import FormModal from '../document/documentModal'
import LeaveMessage from '../common/leaveMessage'
import Pagenation from './documentPagenation'
import clickOutside from '@/lib/bind'
import SetParams from '../common/setParams'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'documentHome',
mixins: [SetParams],
components: {
SearchHeader,
SearchForm,
Item,
FormModal,
LeaveMessage,
Pagenation
},
directives: {
clickOutside
},
data () {
return {
lmTemplate: [
{
name: '客户名称',
value: 'client.name',
default: '未设置'
},
{
name: '内容',
value: 'description'
},
{
name: '待办时间',
value: 'schedule_week_display'
},
{
name: '状态',
value: 'schedule_status_display'
},
{
name: '开始时间',
value: 'start_at'
},
{
name: '结束时间',
value: 'end_at'
},
{
name: '重复',
value: 'repeat_type_display'
},
{
name: '负责人',
value: 'scheduleCreator.name'
},
{
name: '创建时间',
value: 'created_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()
this.getList({})
},
methods: {
init () {
this.getFilter()
},
// 1.查询条件
getFilter () {
requestAPI(api.getDocFilter).then(res => {
this.filter = res
})
},
// 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
})
},
// 3.1关键字搜索
searchKeyword (search) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, search)
this.getList(ret)
},
// 3.2关键字后面的重置
searchClear () {
this.init()
this._reload()
},
// 4.重新加载
_reload () {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {})
this.getList(ret)
},
// 5.1查询条件
updateForm (search) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, search)
this.getList(ret)
},
// 5.2分页查询
updatePage (pager) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {page: pager.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('取消删除')
})
},
// 8.留言
leaveMessageSch (item) {
this.$refs.leaveMessage.isShow(item)
},
lmClose () {
this.$refs.leaveMessage &&
this.$refs.leaveMessage.isClose()
}
}
}
</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>
<template>
<section class="obear-schedule-item">
<el-row class="obear-schedule-row">
<el-col :span="4" :xs="24" class="obear-schedule-left" :style="{background: item.bgcolor}">
<el-row :gutter="10">
<el-col :span="24">
<a>
<i class="fa fa-star" aria-hidden="true"></i>{{ isNullTitle ? '(未设置)' : item.title }}
</a>
</el-col>
<el-col :span="24" style="padding-left: 3px;">
<span>
<img class="user-avatar rounded-circle" :src="item.createdBy.avatar.name">{{ item.createdBy.name }}
</span>
</el-col>
<el-col :span="24" style="padding-left: 5px;">
<span>
<i class="fa fa-sitemap" aria-hidden="true"></i>{{ item.department.name }}
</span>
</el-col>
</el-row>
</el-col>
<el-col :span="20" :xs="24" class="obear-schedule-right">
<el-row :gutter="10">
<el-col :span="6" :xs="24">
<span>文档类型:</span><span class="obear-schedule-right__content">{{ item.documentTypeTag.name }}</span>
</el-col>
<el-col :span="6" :xs="24">
<span>是否为模板:</span><span class="obear-schedule-right__content">{{ item.is_template_display }}</span>
</el-col>
<el-col :span="6" :xs="24">
<span>文档:</span>
</el-col>
<el-col :span="6" :xs="24">
<span>文档类型:{{ item.attachment.extension }}</span>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="6" :xs="24">
<span>文档分类:</span><span class="obear-schedule-right__content">{{ item.documentType }}</span>
</el-col>
<el-col :span="6" :xs="24">
<span>创建时间:</span><span>{{ item.created_at }}</span>
</el-col>
<el-col :span="6" :xs="24">
<span>更新时间:</span><span>{{ item.updated_at }}</span>
</el-col>
<el-col :span="6" :xs="24">
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="6" :xs="24">
<span class="obear-schedule-right__content">备注</span><span>{{ item.description }}</span>
</el-col>
<el-col :span="6" :xs="24">
</el-col>
<el-col :span="6" :xs="24">
</el-col>
<el-col :span="6" :xs="24">
<slot name="opearate">
</slot>
</el-col>
</el-row>
</el-col>
</el-row>
</section>
</template>
<script>
export default {
name: 'documentItem',
props: {
item: Object
},
data () {
return {
}
},
computed: {
isNullTitle () {
return !!this.item.title
}
},
mounted () {
},
methods: {
}
}
</script>
<style scoped lang="scss">
$lightBlue: #20a0ff;
$lightRed: #dc3545;
.colRed {
color: red;
border: 1px solid red;
}
.colGreen {
color: green;
border: 1px solid green;
}
.colWhite {
color: white;
}
.collightBlue {
color: #649FD7;
}
.colBlue {
color: #0056b3;
}
.rounded-circle {
border-radius: 50% !important;
}
.user-avatar {
width: 16px;
max-width: 16px;
height: 16px;
max-height: 16px;
}
@include c('schedule-item') {
margin-bottom: 10px;
font-size: 12px;
}
@include c('schedule-item:first-child') {
.obear-schedule-left {
border-radius: 5px 0 0 0;
}
}
@include c('schedule-row') {
// min-height:100px;
background-color:white;
display: flex;
flex-wrap: wrap;
}
@include c('schedule-left') {
background-color: #EB7567;
color: white;
min-height: 100%;
padding: 10px 15px 6px;
> .el-row {
> .el-col {
margin-bottom: 4px;
}
}
.el-row div:first-child, .el-row div:first-child a{
color: white;
}
@include e('checkbox') {
display:block;
font-size: 12px;
background:white;
border-radius:2px;
color: $lightBlue;
padding: 0 2px 0 2px;
}
.el-checkbox {
margin-right: 10px;
}
span {
// display: inline-block;
// padding-left: 5px;
}
i {
display:inline-block;
padding-right:5px;
}
img {
display:inline-block;
margin-right:3px;
}
@include e('private') {
display: inline-block;
padding-left: 5px;
border-radius:5px;
border: 1px solid white;
width:35px;
height:17px;
}
}
@include c('schedule-right') {
height:100%;
padding: 10px 15px 6px;
> .el-row {
> .el-col {
margin-bottom: 4px;
.el-button {
margin: 0 2px;
padding: 7px;
}
.date-time {
color: #649FD7;
}
}
}
.badge {
border-radius: 2px;
color: #333744;
background: #ffffff;
vertical-align: baseline;
display: inline;
padding: 2px 6px;
}
span.badge-unread {
&:hover {
border-color: #de321d
}
color: #fff;
background-color: #e54c3a;
border-color: #a32516
}y: flex;
@include e('item') {
display: flex;
flex-direction: column;
justify-content: space-around;
padding: 5px 0 5px 5px;
flex:1;
}
@include e('status') {
color: red;
}
@include e('content') {
display: inline-block;
border: 1px solid $lightRed;
border-radius:2px;
// height:20px;
padding: 0 2px 0 2px;
color: $lightRed;
}
}
</style>
<template>
<section class="pull-right">
<el-pagination v-if="total > 0" class="mb20 mt20"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pager.thispage"
:page-sizes="[10, 20, 40, 60, 80, 100]"
:page-size="pager.pagesize"
layout="total, prev, pager, next, jumper"
:total="total">
</el-pagination>
</section>
</template>
<script>
export default {
props: {
total: {
type: Number,
default: 0
}
},
data () {
return {
pager: {
thispage: 1,
pagesize: 20,
totalcount: 0
}
}
},
created () {
// this.$emit('update:pager', this.pager)
},
methods: {
handleSizeChange (val) {
this.pager.thispage = 1
this.pager.pagesize = val
this.pager.totalcount = this.total
this.$emit('update:pager', this.pager)
},
handleCurrentChange (val) {
this.pager.thispage = val
this.pager.totalcount = this.total
this.$emit('update:pager', this.pager)
}
}
}
</script>
<style scoped>
</style>
......@@ -3,16 +3,19 @@ import portal from 'vis-portal'
import ScheduleRoute from './routes/schedule'
import ReimbursementRoute from './routes/reimbursement'
import TaskRoute from './routes/task'
import DocumentRoute from './routes/document'
let routes = []
let reimRoutes = []
let taskRoutes = []
let documentRoutes = []
const appName = 'schedule'
routes = [].concat(ScheduleRoute)
reimRoutes = [].concat(ReimbursementRoute)
taskRoutes = [].concat(TaskRoute)
documentRoutes = [].concat(DocumentRoute)
let RouterInit = () => {
portal.createApp(appName, {}, app => {
......@@ -24,6 +27,9 @@ let RouterInit = () => {
portal.createApp('task', {}, app => {
app.mapRoute(taskRoutes)
})
portal.createApp('document', {}, app => {
app.mapRoute(documentRoutes)
})
// portal.createApp('client', {}, app => {
// app.mapRoute([
// {
......
import DocumentHome from '../components/document_list/documentHome'
const routes = [{
path: '/document',
name: 'documentHome',
component: DocumentHome
}]
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