Commit f4c1999d authored by daywrite's avatar daywrite

caseView

parent 5536d52e
<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.name }}</h2>
</el-col>
</el-row>
</div>
<div class="page-body-content">
<client-nav :trigger="addSch" 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="viewEvent()"
:disabled="!item.can_suspend">
<i class="fa fa-fw fa-eye"></i>详情
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="suspendEvent(item)"
:disabled="!item.can_suspend">
<i class="fa fa-fw fa-ban text-danger"></i>中止
</el-button>
<el-button
type="primary"
size="mini"
@click.prevent.stop="closeEvent()"
:disabled="!item.can_close">
<i class="fa fa-fw fa-archive"></i>关闭Case
</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>
</span>
</Item>
<Pagenation
@update:pager="pager => {updatePage(pager)}"
:total="result.pagenation.totalcount">
</Pagenation>
<leave-message
v-click-outside="lmClose"
ref="leaveMessage"
:lmTemplate="lmTemplate"
:type="18">
</leave-message>
</div>
</div>
<FormModal ref="formModal"></FormModal>
</section>
</template>
<script>
import Item from './caseItem'
import FormModal from '../case/caseModal'
import LeaveMessage from '../common/leaveMessage'
import Pagenation from './casePagenation'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'caseHome',
components: {
Item,
FormModal,
LeaveMessage,
Pagenation
},
data () {
return {
lmTemplate: [
{
name: '客户名称',
value: 'client.name',
default: '未设置'
},
{
name: 'Case类型',
value: 'case_type_display'
},
{
name: 'Case状态',
value: 'case_status_display'
},
{
name: '服务目录',
value: 'services.name'
},
{
name: '工分',
value: 'points'
},
{
name: '开始时间',
value: 'start_at'
},
{
name: '关单时间',
value: 'start_at'
},
{
name: '录入人',
value: 'createdBy.name'
},
{
name: '创建时间',
value: 'created_at'
}
],
filter: [],
form: {
'ClientSearch[keyword]': ''
},
pagenation: {
thispage: 1,
pagesize: 10
},
type: 'all',
navArray: [],
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.getCaseList, 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)
},
// 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.操作
// 详情
viewEvent () {},
// 中止
suspendEvent (id) {
let closeTip = '中止Case'
this.$confirm(`${closeTip}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.suspendCase, { id })
.then((res) => {
this.$message.success(`${closeTip}成功`)
this._reload()
})
}).catch(() => {
this.$message.info(`取消${closeTip}`)
})
},
// 关闭Case
closeEvent () {},
// 删除
deleteSch (id) {
let deleteTip = '删除Case'
this.$confirm(`${deleteTip}?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.deleteCase, { id })
.then((res) => {
this.$message.success(`${deleteTip}成功`)
this._reload()
})
}).catch(() => {
this.$message.info(`取消${deleteTip}`)
})
},
// 8.留言
leaveMessageSch (item) {
this.$refs.leaveMessage.isShow(item)
},
lmClose () {
this.$refs.leaveMessage &&
this.$refs.leaveMessage.isClose()
},
addSchedule () {
this.$refs.scheduleModal.show()
}
}
}
</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 CaseHome from '../components/case_list/caseHome' import CaseHome from '../components/case_list/caseHome'
import CaseView from '../components/case_list/caseView'
const routes = [{ const routes = [{
path: '/case', path: '/case',
name: 'caseHome', name: 'caseHome',
component: CaseHome component: CaseHome
}, {
path: '/ofClient/:id',
name: 'ofClient',
component: CaseView
}] }]
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