Commit 0f53b236 authored by daywrite's avatar daywrite

项目列表

parent 56ac0bca
<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">
<GroupItem
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="checkSch(item)" :disabled="!item.can_complete"><i class="fa fa-fw fa-check"></i>完成</el-button>
<el-button type="primary" size="mini" @click.prevent.stop="banSch(item)" :disabled="!item.can_stop"><i class="fa fa-fw fa-ban"></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>
</span>
</GroupItem>
<Pagenation
@update:pager="pager => {updatePage(pager)}"
:total="result.pagenation.totalcount">
</Pagenation>
<leave-message
v-click-outside="lmClose"
ref="leaveMessage"
:lmTemplate="lmTemplate"
:type="102">
</leave-message>
</div>
</div>
<TaskGroupModal
ref="taskGroupModal">
<!-- v-click-outside="scheduleClose" -->
</TaskGroupModal>
</section>
</template>
<script>
import GroupItem from './groupItem'
import TaskGroupModal from '../task_group/taskGroupModal'
import Pagenation from './groupPagenation'
import clickOutside from '@/lib/bind'
import {
requestAPI,
api
} from '@/lib/commonMixin'
export default {
name: 'taskGroupHome',
components: {
GroupItem,
TaskGroupModal,
Pagenation
},
directives: {
clickOutside
},
data () {
return {
lmTemplate: [
{
name: '项目内容',
value: 'title'
},
{
name: '负责人',
value: 'headOf.name'
},
{
name: '状态',
value: 'status_display'
},
{
name: '截止日期',
value: 'target_completed_at'
},
{
name: '创建时间',
value: 'created_at'
}
],
filter: [],
// groupType: 'all',
groupArray: [{
'key': '',
'name': '全部'
}, {
'key': 'my',
'name': '我参与的'
}, {
'key': 'head',
'name': '我领导的'
}],
taskType: 'group_list',
navArray: [{
'key': 'list',
'name': '项目清单'
}, {
'key': 'group_list',
'name': '项目列表'
}],
form: {
'ClientSearch[keyword]': '',
'TaskGroupSearch[filter]': ''
},
pagenation: {
thispage: 1,
pagesize: 10
},
result: {
list: [],
countArr: [],
navCount: [],
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
})
},
_reload () {
let params = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {})
this.getList(params)
},
updatePage (pager) {
let ret = this.setParams({
...this.form,
page: this.pagenation.thispage
}, {page: pager.thispage})
this.getList(ret)
},
leaveMessageSch (item) {
this.$refs.leaveMessage.btnShow(item)
},
lmClose () {
this.$refs.leaveMessage &&
this.$refs.leaveMessage.btnClose()
},
scheduleClose () {
this.$refs.taskGroupModal &&
this.$refs.taskGroupModal.handleClose()
},
addSch () {
this.$refs.taskGroupModal.show()
},
editSch (item) {
this.$refs.taskGroupModal.show(item)
},
checkSch (id) {
this.$confirm('完成?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.closeTaskGroup, { id })
.then((res) => {
this._reload()
this.$message.success('删除成功')
})
}).catch(() => {
this.$message.info('取消删除')
})
},
banSch (id) {
this.$confirm('中止?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.stopTaskGroup, { id })
.then((res) => {
this._reload()
this.$message.success('删除成功')
})
}).catch(() => {
this.$message.info('取消删除')
})
},
deleteSch (id) {
this.$confirm('删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
requestAPI(api.deleteTaskGroup, { id })
.then((res) => {
this._reload()
this.$message.success('删除成功')
})
}).catch(() => {
this.$message.info('取消删除')
})
},
getList (params) {
requestAPI(api.getTaskGroupList, params).then((res) => {
const {
list = [],
pagenation = {}
} = res
this.result.list = list
this.result.pagenation = pagenation
})
}
}
}
</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: black;
}
i {
display: inline-block;
padding-right: 3px;
}
}
</style>
......@@ -6,7 +6,7 @@ const routes = [{
component: DocumentHome
}, {
path: '/ofClient/:id',
name: 'documentView',
name: 'ofClient',
component: DocumentView
}]
export default routes
......@@ -6,7 +6,7 @@ const routes = [{
component: ReimbursementHome
}, {
path: '/ofClient/:id',
name: 'reimbursementView',
name: 'ofClient',
component: ReimbursementView
}]
export default routes
import TaskHome from '../components/task_list/taskHome'
import GroupHome from '../components/task_group_list/groupHome'
import ScheduleView from '../components/common/scheduleView'
import GroupView from '../components/task_group_list/groupView'
const routes = [{
path: '/task',
name: 'taskHome',
......@@ -12,7 +11,7 @@ const routes = [{
component: GroupHome
}, {
path: '/ofClient/:id',
name: 'scheduleView',
component: ScheduleView
name: 'ofClient',
component: GroupView
}]
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