Commit d26e8782 authored by huai.li's avatar huai.li

新建客户文档

parent 0f53b236
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -29,5 +29,10 @@ export default { ...@@ -29,5 +29,10 @@ export default {
getDocType: { getDocType: {
url: '/vue/document/get-document-type' url: '/vue/document/get-document-type'
},
/* 客户新建文档 */
getListDocument: {
url: '/vue/client/list-document'
} }
} }
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</el-col> </el-col>
<el-col :span="20"> <el-col :span="20">
<el-form ref="form" size="mini"> <el-form ref="form" size="mini">
<el-col :span="6" :xs="24"> <el-col :span="8" :xs="24">
<el-form-item label=" " label-width="42"> <el-form-item label=" " label-width="42">
<el-radio-group v-model="form.period" size="mini" @change="periodChangeEvent"> <el-radio-group v-model="form.period" size="mini" @change="periodChangeEvent">
<el-radio-button label="thisweek">本周</el-radio-button> <el-radio-button label="thisweek">本周</el-radio-button>
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
</el-col> </el-col>
</el-form> </el-form>
<el-form ref="clientTimeRange" size="mini"> <el-form ref="clientTimeRange" size="mini">
<el-col :span="10" :offset="0" :xs="{span: 24, offset: 0}" class="form-content-time-range"> <el-col :span="12" :offset="0" :xs="{span: 24, offset: 0}" class="form-content-time-range">
<el-form-item label-width="0"> <el-form-item label-width="0">
<el-date-picker <el-date-picker
size="mini" size="mini"
......
<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">
<i class="fa fa-star" aria-hidden="true"></i>
<a href="/attachment/view?name=">{{ 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-row>
</el-col>
<el-col :span="20" :xs="24" class="obear-schedule-right">
<el-row :gutter="10">
<el-col :span="8" :xs="24">
<span>文件名:</span><span>{{ item.attachment.orig_name }}</span>
</el-col>
<el-col :span="8" :xs="24">
<span>文件类型:</span><span>{{ item.attachment.extension }}</span>
</el-col>
<el-col :span="8" :xs="24">
<span>文档:<a :href="item.attachment.name" target="_self"><i class="fa fa-fw fa-file-text-o"></i></a></span>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="8" :xs="24">
<span class="obear-schedule-right__content">备注</span><span>{{ item.description }}</span>
</el-col>
<el-col :span="8" :xs="24">
</el-col>
<el-col :span="8" :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: .25rem;
padding: 0 .25rem 0 .25rem;
color: $lightRed;
}
}
</style>
<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">
<client-nav :trigger="addSchedule" trigger-text="新建客户文档"></client-nav>
<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)">
<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="104">
</leave-message>
</div>
</div>
<FormModal ref="formModal"></FormModal>
</section>
</template>
<script>
import Item from './documentItem'
import FormModal from '../document/documentModal'
import Pagenation from '../document_list/documentPagenation'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'documentHome',
components: {
Item,
FormModal,
Pagenation
},
data () {
return {
lmTemplate: [
{
name: '文档名称',
value: 'title'
},
{
name: '录入人',
value: 'createdBy.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()
},
methods: {
init () {
let id = this.id = this.$route.params.id
this.getList({
client_id: id,
page: this.pagenation.thispage
})
},
// 2.列表数据
getList (ret) {
requestAPI(api.getListDocument, 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()
},
addSchedule () {}
}
}
</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' import DocumentView from '../components/document_client/documentView'
const routes = [{ const routes = [{
path: '/document', path: '/document',
name: 'documentHome', name: 'documentHome',
......
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