Commit debf18c1 authored by 高宇's avatar 高宇

完成工作日志列表;

parent e6a2a88e
...@@ -7,5 +7,24 @@ export default { ...@@ -7,5 +7,24 @@ export default {
// 获取列表 // 获取列表
getWorkLogList: { getWorkLogList: {
url: '/vue/work-log/list' url: '/vue/work-log/list'
},
// 删除日志
delWorkLog: {
url: '/vue/work-log/delete'
},
// 留言
getCommentList: {
url: '/vue/comment/list'
},
// 留言新建
saveNewComment: {
url: '/vue/comment/save-new'
},
// 留言删除
deleteComment: {
url: '/vue/comment/delete'
} }
} }
This diff is collapsed.
<template>
<section>
<el-pagination v-if="total > 0" class="mb20 mt20"
background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="pager.thispage"
:page-sizes="[2, 10, 20, 40, 60, 80, 100]"
:page-size="pager.pagesize"
layout="total, sizes, 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: 10,
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)
this.$parent.init()
},
handleCurrentChange (val) {
this.pager.page = val
this.pager.totalcount = this.total
this.$emit('update:pager', this.pager)
this.$parent.init()
}
}
}
</script>
<style scoped>
</style>
...@@ -22,6 +22,9 @@ ...@@ -22,6 +22,9 @@
</el-row> </el-row>
</el-col> </el-col>
<el-col :span="20" :xs="24" class="client-schedule-right"> <el-col :span="20" :xs="24" class="client-schedule-right">
<div class="draft" style="position: absolute;right:5%;top:5%;width:100px;" v-if="item.is_draft">
<img src="https://beta.jinchangxiao.com/img/img_draft.png" width="100%">
</div>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="6" :xs="24"> <el-col :span="6" :xs="24">
开始时间: {{item.start_at !== '' ? item.start_at : noneText}} 开始时间: {{item.start_at !== '' ? item.start_at : noneText}}
...@@ -34,11 +37,18 @@ ...@@ -34,11 +37,18 @@
</el-col> </el-col>
<el-col :span="6" :xs="24"> <el-col :span="6" :xs="24">
签到: 签到:
<el-tooltip class="item" effect="dark" placement="top" v-if="Object.keys(item.location).length > 0"> <el-tooltip class="item"
effect="dark"
placement="top"
v-if="Object.keys(item.location).length > 0">
<i class="fa fa-fw fa-location-arrow"></i> <i class="fa fa-fw fa-location-arrow"></i>
<template slot="content"><p>地址: {{item.location.address}}</p> <template slot="content">
<p>距离: {{item.distance !== '' ? item.distance : noneText}}</p> <div style="width: 150px; font-size: 12px; line-height: 18px;">
<p>时间: </p></template> 地址: {{item.location.address}}<br>
距离: {{item.distance !== '' ? item.distance : noneText}}<br>
时间: {{item.location.time !== '' ? item.location.time : noneText}}
</div>
</template>
</el-tooltip> </el-tooltip>
<span v-else>(未设置)</span> <span v-else>(未设置)</span>
</el-col> </el-col>
...@@ -65,7 +75,7 @@ ...@@ -65,7 +75,7 @@
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="12" :xs="24"> <el-col :span="12" :xs="24">
<span class="border border-danger text-danger rounded px-1">备注</span> : <span class="border border-danger text-danger rounded px-1">备注</span> :
{{item.description !== '' ? item.description : noneText}} <span v-html="setBr(item)"></span>
</el-col> </el-col>
<el-col :span="12" :xs="24"> <el-col :span="12" :xs="24">
<slot name="opearate"> <slot name="opearate">
...@@ -90,6 +100,13 @@ ...@@ -90,6 +100,13 @@
} }
}, },
methods: { methods: {
setBr (item) {
if (item.description === '') {
return this.noneText
} else {
return item.description.replace(/\n/g, '<br />')
}
},
toView (item) { toView (item) {
let obj = { let obj = {
name: 'viewClient', name: 'viewClient',
...@@ -247,6 +264,7 @@ ...@@ -247,6 +264,7 @@
vertical-align: baseline; vertical-align: baseline;
display: inline; display: inline;
padding: 2px 6px; padding: 2px 6px;
text-align: center;
} }
span.badge-unread { span.badge-unread {
&:hover { &:hover {
...@@ -277,3 +295,4 @@ ...@@ -277,3 +295,4 @@
} }
} }
</style> </style>
<template>
<div>
</div>
</template>
<script>
export default {
name: '',
data () {
return {}
},
methods: {},
created () {
}
}
</script>
<style scoped>
</style>
<template>
<div>
</div>
</template>
<script>
export default {
name: '',
data () {
return {}
},
methods: {},
created () {
}
}
</script>
<style scoped>
</style>
...@@ -20,16 +20,28 @@ ...@@ -20,16 +20,28 @@
:key="key" :key="key"
@update:image="imgs => {setImage(imgs)}"> @update:image="imgs => {setImage(imgs)}">
<span slot="opearate"> <span slot="opearate">
<el-button class="pull-right" type="primary" size="mini" :disabled="!item.can_give_up" <el-button class="pull-right"
@click="giveUp(item.id)"> type="primary"
size="mini"
:disabled="!item.can_delete"
@click="delLog(item.id)">
<i class="fa fa-trash-o faa-shake"></i> 删除 <i class="fa fa-trash-o faa-shake"></i> 删除
</el-button> </el-button>
<el-button class="pull-right" type="primary" size="mini" :disabled="!item.can_update" <el-button class="pull-right"
type="primary"
size="mini"
:disabled="!item.can_update"
@click="edit(item.id)"> @click="edit(item.id)">
<i class="fa fa-edit"></i> 编辑 <i class="fa fa-edit"></i> 编辑
</el-button> </el-button>
<el-button class="pull-right" type="primary" size="mini" @click="addMessage(item.id)"> <el-button class="pull-right"
<span :class="['badge', {'badge-unread': item.unread > 0}]" v-if="item.commentCount">{{item.commentCount.comment}}</span> type="primary"
size="mini"
@click.prevent.stop="leaveMessageSch(item)">
<span :class="['badge', {'badge-unread': item.unread > 0}]"
v-if="item.commentCount">
{{item.commentCount.comment}}
</span>
<i class="fa fa-commenting"></i> 留言 <i class="fa fa-commenting"></i> 留言
</el-button> </el-button>
</span> </span>
...@@ -51,6 +63,12 @@ ...@@ -51,6 +63,12 @@
<div class="images clearfix" style="display: none;"> <div class="images clearfix" style="display: none;">
<img v-for="(source, index) in images" :key="index" :src="source" class="image"> <img v-for="(source, index) in images" :key="index" :src="source" class="image">
</div> </div>
<leave-message
v-click-outside="lmClose"
ref="leaveMessage"
:lmTemplate="lmTemplate"
:type="2">
</leave-message>
</section> </section>
</template> </template>
...@@ -58,7 +76,9 @@ ...@@ -58,7 +76,9 @@
import ScheduleItem from '../common/scheduleItem' import ScheduleItem from '../common/scheduleItem'
import Pagenation from './schedulePagenation' import Pagenation from './schedulePagenation'
import clientHeader from '../common/clientHeader' import clientHeader from '../common/clientHeader'
import LeaveMessage from '../common/leaveMessage'
import clientForm from './workLogListForm' import clientForm from './workLogListForm'
import clickOutside from '@/lib/bind'
import { import {
requestAPI, requestAPI,
api api
...@@ -71,10 +91,53 @@ ...@@ -71,10 +91,53 @@
clientHeader, clientHeader,
clientForm, clientForm,
ScheduleItem, ScheduleItem,
Pagenation Pagenation,
LeaveMessage
},
directives: {
clickOutside
}, },
data () { data () {
return { 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: 'repeatSchedule'
},
{
name: '负责人',
value: 'repeatSchedule'
},
{
name: '创建时间',
value: 'created_at'
}
],
options: { options: {
toolbar: true, toolbar: true,
url: 'data-source' url: 'data-source'
...@@ -95,6 +158,13 @@ ...@@ -95,6 +158,13 @@
} }
}, },
methods: { methods: {
leaveMessageSch (item) {
this.$refs.leaveMessage.isShow(item)
},
lmClose () {
this.$refs.leaveMessage &&
this.$refs.leaveMessage.isClose()
},
setImage (imgs) { setImage (imgs) {
this.images = imgs this.images = imgs
const viewer = new Viewer(this.$el.querySelector('.images'), { const viewer = new Viewer(this.$el.querySelector('.images'), {
...@@ -107,12 +177,39 @@ ...@@ -107,12 +177,39 @@
viewer.update() viewer.update()
}) })
}, },
edit () {},
delLog (id) {
this.$confirm('确认删除吗?', '提示').then(() => {
requestAPI(api.delWorkLog, {
data: {
id
}
}).then(() => {
this.$message('删除成功!')
this.getList()
}, error => {
if (Array.isArray(error.msg)) {
error.msg.forEach(item => {
this.$notify.error({
title: '错误',
message: item.error
})
})
}
})
}).catch(_ => {
})
},
addNewUser () { addNewUser () {
this.$refs.leaveModule.isShow('新建客户', 'clientAdd') this.$refs.leaveModule.isShow('新建客户', 'clientAdd')
}, },
searchKeyword (search) { searchKeyword (search) {
this.updateForm(search) this.updateForm(search)
}, },
updatePage (pager) {
Object.assign(this.pagenation, pager)
this.getList()
},
updateForm (form) { updateForm (form) {
console.log(form) console.log(form)
Object.assign(this.form, form) Object.assign(this.form, form)
...@@ -133,6 +230,7 @@ ...@@ -133,6 +230,7 @@
// this.pagenation.page = res.pagenation.thispage // this.pagenation.page = res.pagenation.thispage
this.totalcount = res.pagenation.totalcount this.totalcount = res.pagenation.totalcount
// this.totalcount = 8 // this.totalcount = 8
this.$el.querySelector('.page-body-content').scrollTo(0, 0)
}).finally(_ => { }).finally(_ => {
this.loading = false this.loading = false
}) })
......
<template>
<div>
</div>
</template>
<script>
export default {
name: '',
data () {
return {}
},
methods: {},
created () {
}
}
</script>
<style scoped>
</style>
export default {
bind: function (el, binding, vNode) {
el.__vueClickOutside__ = event => {
if (!el.contains(event.target)) {
// call method provided in v-click-outside value
vNode.context[binding.expression](event)
event.stopPropagation()
}
}
document.body.addEventListener('click', el.__vueClickOutside__)
},
unbind: function (el, binding, vNode) {
// Remove Event Listeners
document.removeEventListener('click', el.__vueClickOutside__)
el.__vueClickOutside__ = null
}
}
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