Commit 5e3f6d21 by keith

update code

parent b6252c89
...@@ -59,8 +59,8 @@ func (c *HomeController) Statistical() { ...@@ -59,8 +59,8 @@ func (c *HomeController) Statistical() {
} }
// TodayActionStatistical today Statistical // GetFlowStatistical flow Statistical
func (c *HomeController) TodayActionStatistical() { func (c *HomeController) GetFlowStatistical() {
// request body // request body
statisticalRequest := StatisticalRequest{} statisticalRequest := StatisticalRequest{}
...@@ -78,7 +78,7 @@ func (c *HomeController) TodayActionStatistical() { ...@@ -78,7 +78,7 @@ func (c *HomeController) TodayActionStatistical() {
} }
} }
statisticalData, err := c.StatisticalRepository.GetTodayActionStatistical(statisticalRequest.DateStart, statisticalRequest.DateEnd) statisticalData, err := c.StatisticalRepository.GetFlowStatistical(statisticalRequest.DateStart, statisticalRequest.DateEnd)
if err != nil { if err != nil {
c.JSON(configs.ResponseFail, err.Error(), err.Error()) c.JSON(configs.ResponseFail, err.Error(), err.Error())
} }
......
...@@ -771,7 +771,6 @@ func (c *PublicController) GetWorkOrder() { ...@@ -771,7 +771,6 @@ func (c *PublicController) GetWorkOrder() {
// get user // get user
user := c.GetUserInfo() user := c.GetUserInfo()
print(&user)
if user == nil { if user == nil {
// GetAdminAuthInfo // GetAdminAuthInfo
auth := c.GetAdminAuthInfo() auth := c.GetAdminAuthInfo()
...@@ -806,6 +805,10 @@ func (c *PublicController) DeleteWorkOrder() { ...@@ -806,6 +805,10 @@ func (c *PublicController) DeleteWorkOrder() {
if auth == nil { if auth == nil {
c.JSON(configs.ResponseFail, "fail!", nil) c.JSON(configs.ResponseFail, "fail!", nil)
} }
admin := services.GetAdminRepositoryInstance().GetAdmin(auth.UID)
if admin.Root == 0 {
c.JSON(configs.ResponseFail, "无权限删除!", nil)
}
} }
// wid // wid
......
...@@ -136,7 +136,7 @@ func (c *WorkOrderController) GetWorkType() { ...@@ -136,7 +136,7 @@ func (c *WorkOrderController) GetWorkType() {
// GetWorkTypes get work order types // GetWorkTypes get work order types
func (c *WorkOrderController) GetWorkTypes() { func (c *WorkOrderController) GetWorkTypes() {
workOrderTypes := c.WorkOrderTypeRepository.GetWorkOrderTypes() workOrderTypes := c.WorkOrderTypeRepository.GetWorkOrderTypesAndCountWorkorder()
c.JSON(configs.ResponseSucess, "查询成功!", workOrderTypes) c.JSON(configs.ResponseSucess, "查询成功!", workOrderTypes)
} }
......
package models
// WorkOrderTypeDto model
type WorkOrderTypeDto struct {
ID int64 `orm:"auto;pk;type(bigint);column(id)" json:"id"` // ID
Title string `orm:"unique;type(varchar);null;column(title)" json:"title"` // 类型名称
Count int64 `orm:"type(bigint);column(count)" json:"count"` // 类型名称
CreateAt int64 `orm:"type(bigint);column(create_at)" json:"create_at"` // 提交时间
}
...@@ -61,7 +61,7 @@ func routers(prefix string) *beego.Namespace { ...@@ -61,7 +61,7 @@ func routers(prefix string) *beego.Namespace {
beego.NSNamespace("/home", beego.NSNamespace("/home",
beego.NSBefore(filters.FilterToken), beego.NSBefore(filters.FilterToken),
beego.NSRouter("/statistical", &controllers.HomeController{}, "post:Statistical"), beego.NSRouter("/statistical", &controllers.HomeController{}, "post:Statistical"),
beego.NSRouter("/today_statistical", &controllers.HomeController{}, "post:TodayActionStatistical"), beego.NSRouter("/flow_statistical", &controllers.HomeController{}, "post:GetFlowStatistical"),
), ),
// message // message
......
...@@ -176,7 +176,7 @@ func (r *KnowledgeBaseRepository) Delete(id int64) (int64, error) { ...@@ -176,7 +176,7 @@ func (r *KnowledgeBaseRepository) Delete(id int64) (int64, error) {
// GetKnowledgeBasePlatformsTotal get Group count // GetKnowledgeBasePlatformsTotal get Group count
func (r *KnowledgeBaseRepository) GetKnowledgeBasePlatformsTotal() []orm.Params { func (r *KnowledgeBaseRepository) GetKnowledgeBasePlatformsTotal() []orm.Params {
var maps []orm.Params var maps []orm.Params
_, err := r.o.Raw("select P.id,p.title,IFNULL(k.count,0) as count FROM platform p LEFT JOIN (SELECT platform,COUNT(*) AS count FROM `knowledge_base` GROUP BY platform) k ON k.platform = p.id").Values(&maps) _, err := r.o.Raw("SELECT P.id,p.title,IFNULL(k.count,0) as count FROM platform p LEFT JOIN (SELECT platform,COUNT(*) AS count FROM `knowledge_base` GROUP BY platform) k ON k.platform = p.id").Values(&maps)
if err != nil { if err != nil {
logs.Warn("GetKnowledgeBasePlatformsTotal get Group count------------", err) logs.Warn("GetKnowledgeBasePlatformsTotal get Group count------------", err)
return []orm.Params{} return []orm.Params{}
......
...@@ -14,7 +14,7 @@ import ( ...@@ -14,7 +14,7 @@ import (
type StatisticalRepositoryInterface interface { type StatisticalRepositoryInterface interface {
Add(servicesStatistical *models.ServicesStatistical) (int64, error) Add(servicesStatistical *models.ServicesStatistical) (int64, error)
GetStatisticals(startDate string, endDate string) (map[string]interface{}, error) GetStatisticals(startDate string, endDate string) (map[string]interface{}, error)
GetTodayActionStatistical(startDate string, endDate string) ([]orm.Params, error) GetFlowStatistical(startDate string, endDate string) ([]orm.Params, error)
GetCustomerServiceList(request models.ServicesStatisticalPaginationDto) models.ServicesStatisticalPaginationDto GetCustomerServiceList(request models.ServicesStatisticalPaginationDto) models.ServicesStatisticalPaginationDto
CheckIsReplyAndSetReply(uid int64, aid int64, platform int64) CheckIsReplyAndSetReply(uid int64, aid int64, platform int64)
} }
...@@ -70,7 +70,7 @@ func (r *StatisticalRepository) GetCustomerServiceList(request models.ServicesSt ...@@ -70,7 +70,7 @@ func (r *StatisticalRepository) GetCustomerServiceList(request models.ServicesSt
addSQL1 = " GROUP BY `user_account` " addSQL1 = " GROUP BY `user_account` "
} }
if counter, err := r.o.Raw("SELECT s.id, s.user_account, s.service_account,s.create_at,s.is_reception, s.transfer_account,s.platform,u.nickname FROM services_statistical AS s INNER JOIN (SELECT * FROM `user` ) AS u ON s.user_account = u.id AND s.service_account = ? AND s.create_at > ? AND s.create_at < ? AND is_reception IN("+ INReception +") "+addSQL1+" ORDER BY s.create_at DESC LIMIT ?,?", request.Cid, startDate.Unix(), endDate.Unix(), (request.PageOn-1)*request.PageSize, request.PageSize).Values(&params); counter <= 0 { if counter, err := r.o.Raw("SELECT s.id, s.user_account, s.service_account,s.create_at,s.is_reception, s.transfer_account,s.platform,u.nickname FROM services_statistical AS s INNER JOIN (SELECT * FROM `user` ) AS u ON s.user_account = u.id AND s.service_account = ? AND s.create_at > ? AND s.create_at < ? AND is_reception IN("+INReception+") "+addSQL1+" ORDER BY s.create_at DESC LIMIT ?,?", request.Cid, startDate.Unix(), endDate.Unix(), (request.PageOn-1)*request.PageSize, request.PageSize).Values(&params); counter <= 0 {
logs.Warn("GetCustomerServiceList get Customer Service List2------------", err) logs.Warn("GetCustomerServiceList get Customer Service List2------------", err)
request.List = []string{} request.List = []string{}
return request return request
...@@ -144,8 +144,8 @@ func (r *StatisticalRepository) GetStatisticals(startDate string, endDate string ...@@ -144,8 +144,8 @@ func (r *StatisticalRepository) GetStatisticals(startDate string, endDate string
return countsArr, nil return countsArr, nil
} }
// GetTodayActionStatistical get Today Action Statistical // GetFlowStatistical get Today Action Statistical
func (r *StatisticalRepository) GetTodayActionStatistical(startDate string, endDate string) ([]orm.Params, error) { func (r *StatisticalRepository) GetFlowStatistical(startDate string, endDate string) ([]orm.Params, error) {
// transform date // transform date
layoutDate := "2006-01-02 15:04:05" layoutDate := "2006-01-02 15:04:05"
loc, _ := time.LoadLocation("Local") loc, _ := time.LoadLocation("Local")
...@@ -157,7 +157,7 @@ func (r *StatisticalRepository) GetTodayActionStatistical(startDate string, endD ...@@ -157,7 +157,7 @@ func (r *StatisticalRepository) GetTodayActionStatistical(startDate string, endD
var statisticalData []orm.Params var statisticalData []orm.Params
_, err := r.o.Raw("SELECT p.id platform,p.title, IFNULL(u.count,0) AS `count` FROM platform as p LEFT JOIN (SELECT platform,COUNT(*) AS count FROM `user` WHERE last_activity BETWEEN ? AND ? GROUP BY platform) u ON p.id = u.platform", dateStart.Unix(), dateEnd.Unix()).Values(&statisticalData) _, err := r.o.Raw("SELECT p.id platform,p.title, IFNULL(u.count,0) AS `count` FROM platform as p LEFT JOIN (SELECT platform,COUNT(*) AS count FROM `user` WHERE last_activity BETWEEN ? AND ? GROUP BY platform) u ON p.id = u.platform", dateStart.Unix(), dateEnd.Unix()).Values(&statisticalData)
if err != nil { if err != nil {
logs.Warn("GetTodayActionStatistical get Today Action Statistical------------", err) logs.Warn("GetFlowStatistical get Today Action Statistical------------", err)
return nil, err return nil, err
} }
return statisticalData, nil return statisticalData, nil
......
...@@ -80,7 +80,7 @@ func (r *WorkOrderRepository) GetWorkOrders(request models.WorkOrderPaginationDt ...@@ -80,7 +80,7 @@ func (r *WorkOrderRepository) GetWorkOrders(request models.WorkOrderPaginationDt
} }
tidSQL := "" tidSQL := ""
if request.Tid != 0 { if request.Tid != 0 {
tidSQL = " ADN `t_i_d` = " + strconv.FormatInt(request.Tid, 10) + " " tidSQL = " AND `t_i_d` = " + strconv.FormatInt(request.Tid, 10) + " "
} }
if request.PageSize == 0 { if request.PageSize == 0 {
request.PageSize = 10 request.PageSize = 10
......
...@@ -13,6 +13,7 @@ import ( ...@@ -13,6 +13,7 @@ import (
type WorkOrderTypeRepositoryInterface interface { type WorkOrderTypeRepositoryInterface interface {
GetWorkOrderType(id int64) (models.WorkOrderType, error) GetWorkOrderType(id int64) (models.WorkOrderType, error)
GetWorkOrderTypes() []models.WorkOrderType GetWorkOrderTypes() []models.WorkOrderType
GetWorkOrderTypesAndCountWorkorder() []models.WorkOrderTypeDto
Update(id int64, params orm.Params) (int64, error) Update(id int64, params orm.Params) (int64, error)
Delete(id int64) (int64, error) Delete(id int64) (int64, error)
Add(data models.WorkOrderType) (bool, int64, error) Add(data models.WorkOrderType) (bool, int64, error)
...@@ -71,6 +72,17 @@ func (r *WorkOrderTypeRepository) GetWorkOrderTypes() []models.WorkOrderType { ...@@ -71,6 +72,17 @@ func (r *WorkOrderTypeRepository) GetWorkOrderTypes() []models.WorkOrderType {
return workOrderTypes return workOrderTypes
} }
// GetWorkOrderTypesAndCountWorkorder get all
func (r *WorkOrderTypeRepository) GetWorkOrderTypesAndCountWorkorder() []models.WorkOrderTypeDto {
var workOrderTypes []models.WorkOrderTypeDto
_, err := r.o.Raw("SELECT t.*,IFNULL(w.count,0) as `count` FROM work_order_type t LEFT JOIN (SELECT t_i_d,COUNT(*) AS `count` FROM `work_order` WHERE `delete` = 0 GROUP BY `t_i_d`) w ON t.id = w.t_i_d").QueryRows(&workOrderTypes)
if err != nil {
logs.Warn("GetWorkOrderTypes get all------------", err)
return []models.WorkOrderTypeDto{}
}
return workOrderTypes
}
// Update WorkOrderType Info // Update WorkOrderType Info
func (r *WorkOrderTypeRepository) Update(id int64, params orm.Params) (int64, error) { func (r *WorkOrderTypeRepository) Update(id int64, params orm.Params) (int64, error) {
var res models.WorkOrderType var res models.WorkOrderType
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
</el-col> </el-col>
</el-row> </el-row>
<div> <div>
<div class="mini-im-home-title" style="padding-bottom: 10px;">各渠道<span style="color: #f44336;">当天独立用户</span>访问量</div> <div class="mini-im-home-title" style="padding-bottom: 10px; text-align: left;">各渠道<span style="color: #f44336">{{optionsDate[selectDateValue].label}}独立用户</span>访问量</div>
<el-table <el-table
:data="todayStatisticalTableData" :data="todayStatisticalTableData"
style="width: 100%"> style="width: 100%">
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
prop="count" prop="count"
align="center" align="center"
width="180" width="180"
label="当天访问人次"> label="访问人次">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label=""> label="">
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
created(){ created(){
this.selectDate = this.getDate(2) this.selectDate = this.getDate(2)
this.getStatistical() this.getStatistical()
this.getTodayStatistical() this.getFlowStatistical()
this.getOnlines() this.getOnlines()
}, },
computed:{ computed:{
...@@ -186,11 +186,11 @@ export default { ...@@ -186,11 +186,11 @@ export default {
this.$message.error(error.response.data.message) this.$message.error(error.response.data.message)
}); });
}, },
// 获取今天访问数据 // 获取访问数据
getTodayStatistical(){ getFlowStatistical(){
axios.post('/home/today_statistical', { axios.post('/home/flow_statistical', {
"date_start": moment(new Date()).format("YYYY-MM-DD"), "date_start": moment(this.selectDate[0]).format("YYYY-MM-DD"),
"date_end": moment(new Date()).format("YYYY-MM-DD") "date_end": moment(this.selectDate[1]).format("YYYY-MM-DD")
}) })
.then(response => { .then(response => {
this.todayStatisticalTableData = response.data.data this.todayStatisticalTableData = response.data.data
...@@ -239,6 +239,7 @@ export default { ...@@ -239,6 +239,7 @@ export default {
// 时间变更 // 时间变更
changeDate(){ changeDate(){
this.getStatistical() this.getStatistical()
this.getFlowStatistical()
}, },
// 获取在线用户数 // 获取在线用户数
getOnlines(){ getOnlines(){
......
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
:class="{'el-button--primary': item.id + '' == tableData.platform + ''}" :class="{'el-button--primary': item.id + '' == tableData.platform + ''}"
@click="onTogglePlatform(item.id)" @click="onTogglePlatform(item.id)"
:key="item.id" :key="item.id"
size="mini" size="small"
>{{item.title}} ({{item.count}})</el-button> >{{item.title}} ( {{item.count}} )</el-button>
</template> </template>
</el-button-group> </el-button-group>
<el-col :span="5"> <el-col :span="5">
......
...@@ -5,49 +5,76 @@ ...@@ -5,49 +5,76 @@
<span> <span>
<i class="el-icon-tickets"></i> <i class="el-icon-tickets"></i>
<span slot="title">工单管理</span> <span slot="title">工单管理</span>
<span style="font-size:15px;margin-left: 30px;color:#e7a646">当前有
<strong style="color: #f56c6c">5</strong>
条待处理, 和<strong style="color: #f56c6c"> 8</strong>
条待回复工单</span>
</span> </span>
<el-button size="mini">设置</el-button> <div>
<el-button-group>
<el-radio size="small" v-model="workStatus" label="-1" border>全部</el-radio>
<el-radio size="small" v-model="workStatus" label="0" border>待处理</el-radio>
<el-radio size="small" v-model="workStatus" label="2" border>待回复</el-radio>
<el-radio size="small" v-model="workStatus" label="1" border>已回复</el-radio>
<el-radio size="small" v-model="workStatus" label="3" border>已关闭</el-radio>
</el-button-group>
</div>
<div>
<el-button size="mini">回收站 ( 52654 )</el-button>
<el-button size="mini">分类设置</el-button>
</div>
</div> </div>
<el-divider /> <el-divider />
<el-table :data="tableData.list" style="width: 100%" v-loading="loading"> <div class="container-box">
<el-table-column type="index" :index="indexMethod" width="60" label="#序号"></el-table-column> <div class="menu">
<el-table-column prop="title" label="工单标题"></el-table-column> <el-tabs @tab-click="tabsChange" tab-position="left" style="width:200px;height: 80vh;">
<el-table-column prop="status" label="当前状态"> <template size="small" v-for="item in workorderTypes" border>
<template slot-scope="scope"> <el-tab-pane :key="item.id" :label="item.title + '('+item.count+')'"></el-tab-pane>
<el-tag type="warning" v-if="scope.row.status == 0">待处理</el-tag> </template>
<el-tag type="warning" v-if="scope.row.status == 1">待回复</el-tag> </el-tabs>
<el-tag type="success" v-if="scope.row.status == 2">已回复</el-tag> </div>
<el-tag type="info" v-if="scope.row.status == 3">已结束</el-tag> <div class="table-content">
</template> <el-table :data="tableData.list" style="width: 100%" v-loading="loading">
</el-table-column> <el-table-column type="index" :index="indexMethod" width="60" label="#序号"></el-table-column>
<el-table-column prop="u_nickname" label="用户(发布者)"></el-table-column> <el-table-column prop="title" label="工单标题"></el-table-column>
<el-table-column prop="a_nickname" label="最后回复者(客服)"> <el-table-column prop="status" label="当前状态">
<template slot-scope="scope"> <template slot-scope="scope">
{{scope.row.a_nickname || '-----'}} <el-tag type="warning" v-if="scope.row.status == 0">等待客服处理</el-tag>
</template> <el-tag type="warning" v-if="scope.row.status == 2">等待客服回复</el-tag>
</el-table-column> <el-tag type="success" v-if="scope.row.status == 1">已有客服回复</el-tag>
<el-table-column prop="create_at" label="创建时间"> <el-tag type="info" v-if="scope.row.status == 3"> 工单已结束 </el-tag>
<template slot-scope="scope">{{$formatUnixDate(scope.row.create_at, "YYYY/MM/DD")}}</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="operating" align="center" width="150" label="操作"> <el-table-column prop="u_nickname" label="用户(发布者)"></el-table-column>
<template slot-scope="scope"> <el-table-column prop="a_nickname" label="最后回复者(客服)">
<el-button @click="onShow(scope.row)" size="mini">查 看</el-button> <template slot-scope="scope">
</template> {{scope.row.a_nickname || '-----'}}
</el-table-column> </template>
</el-table> </el-table-column>
<el-row type="flex" style="margin-top: 20px;" justify="space-between"> <el-table-column prop="create_at" label="创建时间">
<span style="color:#666;font-size: 14px;">共找到{{tableData.total}}条数据</span> <template slot-scope="scope">{{$formatUnixDate(scope.row.create_at, "YYYY/MM/DD")}}</template>
<el-pagination </el-table-column>
background <el-table-column prop="operating" align="center" width="150" label="操作">
@size-change="handleSizeChange" <template slot-scope="scope">
@current-change="handleCurrentChange" <el-button @click="onShow(scope.row)" size="mini">查 看</el-button>
layout="sizes, prev, pager, next" </template>
:current-page="tableData.page_on" </el-table-column>
:page-sizes="[5, 10, 15, 20]" </el-table>
:total="tableData.total" <el-row type="flex" style="margin-top: 20px;" justify="space-between">
></el-pagination> <span style="color:#666;font-size: 14px;">共找到{{tableData.total}}条数据</span>
</el-row> <el-pagination
<WorkOrderView :prop="showWorkOrder" v-model="isShowWorkOrderView" /> background
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
layout="sizes, prev, pager, next"
:current-page="tableData.page_on"
:page-sizes="[5, 10, 15, 20]"
:total="tableData.total"
></el-pagination>
</el-row>
</div>
</div>
<WorkOrderView :prop="showWorkOrder" v-model="isShowWorkOrderView" />
</div> </div>
</template> </template>
<script> <script>
...@@ -63,6 +90,7 @@ export default { ...@@ -63,6 +90,7 @@ export default {
loading: true, loading: true,
isShowWorkOrderView: false, isShowWorkOrderView: false,
showWorkOrder: {}, showWorkOrder: {},
workStatus: "-1",
tableData: { tableData: {
list: [], list: [],
page_on: 1, page_on: 1,
...@@ -70,25 +98,38 @@ export default { ...@@ -70,25 +98,38 @@ export default {
total: 0, total: 0,
status: -1, status: -1,
tid: 0 tid: 0
} },
workorderTypes:[
{
"id": 0,
"count": 0,
"title": "全部工单"
}
],
}; };
}, },
created() { created() {
setTimeout(() => { this.getWorkorderList();
this.getWorkorderList(); this.getWorkorderTypes()
}, 500);
}, },
methods: { methods: {
onShow(item){ onShow(item){
this.showWorkOrder = item this.showWorkOrder = item
this.isShowWorkOrderView = true this.isShowWorkOrderView = true
}, },
tabsChange(tab){
this.changeType(this.workorderTypes[parseInt(tab.index)].id)
},
// 行号 // 行号
indexMethod(index) { indexMethod(index) {
return ( return (
(this.tableData.page_on - 1) * this.tableData.page_size + index + 1 (this.tableData.page_on - 1) * this.tableData.page_size + index + 1
); );
}, },
changeType(tid){
this.tableData.tid = tid;
this.getWorkorderList(1);
},
// 获取数据 // 获取数据
getWorkorderList(index) { getWorkorderList(index) {
if (index) this.tableData.page_on = index; if (index) this.tableData.page_on = index;
...@@ -104,6 +145,20 @@ export default { ...@@ -104,6 +145,20 @@ export default {
this.$message.error(error.response.data.message); this.$message.error(error.response.data.message);
}); });
}, },
// 获取类型数据
getWorkorderTypes() {
axios
.get("/workorder/types")
.then(response => {
this.workorderTypes = this.workorderTypes.concat(response.data.data);
for(var i=0; i<response.data.data.length; i++){
this.workorderTypes[0].count += response.data.data[i].count
}
})
.catch(error => {
this.$message.error(error.response.data.message);
});
},
// 改变每页条数 // 改变每页条数
handleSizeChange(val) { handleSizeChange(val) {
this.tableData.page_size = val; this.tableData.page_size = val;
...@@ -114,6 +169,17 @@ export default { ...@@ -114,6 +169,17 @@ export default {
this.tableData.page_on = val; this.tableData.page_on = val;
this.getWorkorderList(); this.getWorkorderList();
} }
},
watch: {
isShowWorkOrderView(show){
if(!show){
this.getWorkorderList();
}
},
workStatus(status){
this.tableData.status = parseInt(status)
this.getWorkorderList();
}
} }
}; };
</script> </script>
...@@ -130,5 +196,15 @@ export default { ...@@ -130,5 +196,15 @@ export default {
margin-right: 5px; margin-right: 5px;
} }
} }
.container-box{
display flex
.menu{
flex-shrink: 0;
width 180px;
}
.table-content{
flex-grow 1
}
}
</style> </style>
...@@ -3,10 +3,24 @@ ...@@ -3,10 +3,24 @@
<div class="workorder-view" :class="{'is-show-aside': !isShowAside}" v-show="value"> <div class="workorder-view" :class="{'is-show-aside': !isShowAside}" v-show="value">
<div class="mask" @dblclick="close"></div> <div class="mask" @dblclick="close"></div>
<transition name="el-zoom-in-bottom"> <transition name="el-zoom-in-bottom">
<div class="content-box" v-show="value"> <div class="content-box" :class="{'padding-bottom30': showData.status == 3}" v-show="value">
<div class="title"> <div class="title">
<i class="el-icon-tickets"></i> 工单详细 <i class="el-icon-tickets"></i> 工单详细
</div> </div>
<div class="buttons">
<el-button
size="mini"
@click="closeWorkorder"
v-if="showData.status == 1 || showData.status == 2"
type="warning"
>关闭工单</el-button>
<el-button
size="mini"
@click="delWorkorder"
v-if="showData.status == 3 && adminInfo.root == 1"
type="danger"
>删除工单</el-button>
</div>
<span class="close" @click="close"> <span class="close" @click="close">
<i class="el-icon-close"></i> <i class="el-icon-close"></i>
</span> </span>
...@@ -31,10 +45,10 @@ ...@@ -31,10 +45,10 @@
<div class="form-line"> <div class="form-line">
<span class="lable">状态:</span> <span class="lable">状态:</span>
<div class="con"> <div class="con">
<span style="color:#e6a23c;" v-if="showData.status == 0">处理</span> <span style="color:#e6a23c;" v-if="showData.status == 0">等待客服处理</span>
<span style="color:#e6a23c;" v-if="showData.status == 1">回复</span> <span style="color:#e6a23c;" v-if="showData.status == 2">等待客服回复</span>
<span style="color:#67c23a;" v-if="showData.status == 2">回复</span> <span style="color:#67c23a;" v-if="showData.status == 1">已有客服回复</span>
<span style="color:#909399;" v-if="showData.status == 3">已结束</span> <span style="color:#909399;" v-if="showData.status == 3">工单已结束</span>
</div> </div>
</div> </div>
<div class="form-line"> <div class="form-line">
...@@ -46,7 +60,7 @@ ...@@ -46,7 +60,7 @@
<div class="no-data" v-if="comments.length <= 0 && !isShowGetCommentsLoading">暂无回复内容~</div> <div class="no-data" v-if="comments.length <= 0 && !isShowGetCommentsLoading">暂无回复内容~</div>
<div class="comments-loading" v-if="isShowGetCommentsLoading"> <div class="comments-loading" v-if="isShowGetCommentsLoading">
<i class="el-icon-loading"></i> <i class="el-icon-loading"></i>
<span> 正在努力加载中~</span> <span>正在努力加载中~</span>
</div> </div>
<template v-else v-for="(item,index) in comments"> <template v-else v-for="(item,index) in comments">
<div :key="index" class="item"> <div :key="index" class="item">
...@@ -74,7 +88,7 @@ ...@@ -74,7 +88,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="file-view" v-if="request.source != '' || isShowUploadLoading"> <div class="file-view" v-if="request.source != '' || isShowUploadLoading">
<span v-if="isShowUploadLoading"> <span v-if="isShowUploadLoading">
<i class="el-icon-loading"></i> <i class="el-icon-loading"></i>
<i>上传中~</i> <i>上传中~</i>
...@@ -85,12 +99,12 @@ ...@@ -85,12 +99,12 @@
</span> </span>
</div> </div>
<div class="input-form" v-if="showData.status != 3"> <div class="input-form" v-if="showData.status != 3">
<textarea v-model="request.content" @blur="inputBlur()" placeholder="请输入内容~"></textarea> <textarea v-model="request.content" @blur="inputBlur()" placeholder="请输入内容~"></textarea>
<span class="icon-btn"> <span class="icon-btn">
<input title="添加附件" type="file" @change="uploadFile" onclick="this.value = null" /> <input title="添加附件" type="file" @change="uploadFile" onclick="this.value = null" />
</span> </span>
<el-button type="primary" @click="reply()">提交</el-button> <el-button type="primary" @click="reply()">提交</el-button>
</div> </div>
</div> </div>
</transition> </transition>
</div> </div>
...@@ -98,7 +112,7 @@ ...@@ -98,7 +112,7 @@
<script> <script>
import axios from "axios"; import axios from "axios";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import upload from '../../common/upload' import upload from "../../common/upload";
export default { export default {
name: "workorder-view", name: "workorder-view",
data() { data() {
...@@ -123,7 +137,7 @@ export default { ...@@ -123,7 +137,7 @@ export default {
prop: Object prop: Object
}, },
created() { created() {
this.comments = [] this.comments = [];
}, },
computed: { computed: {
showData() { showData() {
...@@ -141,53 +155,109 @@ export default { ...@@ -141,53 +155,109 @@ export default {
}, },
getWorkOrder() { getWorkOrder() {
axios.get("/public/workorder/" + this.prop.id).then(response => { axios.get("/public/workorder/" + this.prop.id).then(response => {
if(response.data.data != null)this.workorder = response.data.data; if (response.data.data != null) this.workorder = response.data.data;
setTimeout(() => this.$previewRefresh(), 500); setTimeout(() => this.$previewRefresh(), 500);
}); });
}, },
getComments() { getComments() {
this.isShowGetCommentsLoading = true this.isShowGetCommentsLoading = true;
axios.get("/public/workorder/comments/" + this.prop.id).then(response => { axios
if(response.data.data != null)this.comments = response.data.data; .get("/public/workorder/comments/" + this.prop.id)
setTimeout(() => this.$previewRefresh(), 500); .then(response => {
this.isShowGetCommentsLoading = false if (response.data.data != null) this.comments = response.data.data;
}).catch(error => { setTimeout(() => this.$previewRefresh(), 500);
this.isShowGetCommentsLoading = false;
})
.catch(error => {
console.log(error); console.log(error);
this.isShowGetCommentsLoading = false this.isShowGetCommentsLoading = false;
this.$message.error('加载失败,请刷新尝试~'); this.$message.error("加载失败,请刷新尝试~");
}); });
}, },
closeWorkorder() {
this.$prompt("请输入关闭原因!", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
inputPattern: /\S/,
inputErrorMessage: "关闭工单原因不能为空~"
}).then(({ value }) => {
const wid = this.showData.id;
let remark = value
axios
.post("/workorder/close", { wid, remark })
.then(response => {
this.getWorkOrder()
this.$notify({
title: "温馨提示!",
message: "工单已关闭~",
showClose: false,
type: "success"
});
})
.catch(error => {
this.$message.error("工单关闭失败~");
});
});
},
delWorkorder() {
this.$confirm('您确定删除该工单吗?', '温馨提示!', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
const wid = this.showData.id;
axios
.delete("/public/workorder/" +wid)
.then(response => {
this.$notify({
title: "温馨提示!",
message: "工单已删除~",
showClose: false,
type: "success"
});
this.close()
})
.catch(error => {
this.$message.error("工单删除失败~");
});
});
},
reply() { reply() {
const content = this.request.content + this.request.source; const content = this.request.content + this.request.source;
if (content.trim() == "") { if (content.trim() == "") {
this.$message.error('请输入内容~'); this.$message.error("请输入内容~");
return; return;
} }
if (this.isSubmit) return; if (this.isSubmit) return;
this.isSubmit = true; this.isSubmit = true;
console.log(this.showData)
const wid = this.showData.id; const wid = this.showData.id;
axios axios
.post("/public/workorder/reply", { wid, content }) .post("/public/workorder/reply", { wid, content })
.then(response => { .then(response => {
this.isSubmit = false this.isSubmit = false;
console.log(response); console.log(response);
this.getComments(); this.getComments();
this.request = { this.request = {
source: "", source: "",
content: "" content: ""
}; };
this.$message.success('回复成功~'); this.$notify({
setTimeout(()=>{ title: "温馨提示!",
var sBoxHeight = document.querySelector(".content").clientHeight message: "回复成功~",
var sHeight = document.querySelector(".scroll").clientHeight showClose: false,
document.querySelector(".content").scrollTop = sHeight - sBoxHeight + 20 type: "success"
}, 500) });
setTimeout(() => {
var sBoxHeight = document.querySelector(".content").clientHeight;
var sHeight = document.querySelector(".scroll").clientHeight;
document.querySelector(".content").scrollTop =
sHeight - sBoxHeight + 20;
}, 500);
}) })
.catch(error => { .catch(error => {
this.isSubmit = false this.isSubmit = false;
console.log(error); console.log(error);
this.$message.error('提交失败~'); this.$message.error("提交失败~");
}); });
}, },
inputBlur() { inputBlur() {
...@@ -207,17 +277,29 @@ export default { ...@@ -207,17 +277,29 @@ export default {
progress() {}, progress() {},
success(src) { success(src) {
self.isShowUploadLoading = false; self.isShowUploadLoading = false;
var html var html;
var fullPath = self.uploadToken.host + "/" + src; var fullPath = self.uploadToken.host + "/" + src;
var fileType = src.substr(src.lastIndexOf(".") + 1); var fileType = src.substr(src.lastIndexOf(".") + 1);
if ("jpg,jpeg,png,JPG,JPEG,PNG".indexOf(fileType) != -1) { if ("jpg,jpeg,png,JPG,JPEG,PNG".indexOf(fileType) != -1) {
html = "<br><img style='max-width:45%' preview='1' src='" + fullPath + "' />" html =
}else{ "<br><img style='max-width:45%' preview='1' src='" +
html = "<br><img style='width:20px;height:20px;top:3px; right:3px;position: relative;' preview='1' src='http://qiniu.cmp520.com/fj.png' />" fullPath +
html += "<a target='_blank' style='color: #2e9dfc;' href='"+fullPath+"'>下载附件</a>" "' />";
} else {
html =
"<br><img style='width:20px;height:20px;top:3px; right:3px;position: relative;' preview='1' src='http://qiniu.cmp520.com/fj.png' />";
html +=
"<a target='_blank' style='color: #2e9dfc;' href='" +
fullPath +
"'>下载附件</a>";
} }
self.request.source = html self.request.source = html;
self.$message.success('上传成功~'); self.$notify({
title: "温馨提示!",
message: "上传成功~",
showClose: false,
type: "success"
});
}, },
error(e) { error(e) {
self.isShowUploadLoading = false; self.isShowUploadLoading = false;
...@@ -227,7 +309,7 @@ export default { ...@@ -227,7 +309,7 @@ export default {
} }
} }
}); });
}, }
}, },
watch: { watch: {
prop() { prop() {
...@@ -261,7 +343,7 @@ export default { ...@@ -261,7 +343,7 @@ export default {
font-size: 14px; font-size: 14px;
} }
.workorder-close ,.comments-loading{ .workorder-close, .comments-loading {
text-align: center; text-align: center;
color: #666; color: #666;
font-size: 14px; font-size: 14px;
...@@ -317,6 +399,7 @@ export default { ...@@ -317,6 +399,7 @@ export default {
} }
} }
} }
.content-box { .content-box {
width: 600px; width: 600px;
height: 100%; height: 100%;
...@@ -329,19 +412,24 @@ export default { ...@@ -329,19 +412,24 @@ export default {
overflow: hidden; overflow: hidden;
border-radius: 5px 5px 0 0; border-radius: 5px 5px 0 0;
padding-top: 40px; padding-top: 40px;
padding-bottom 135px padding-bottom: 135px;
box-sizing: border-box; box-sizing: border-box;
.content{ &.padding-bottom30{
padding-bottom: 30px;
}
.content {
box-sizing: border-box; box-sizing: border-box;
width 100% width: 100%;
padding: 0 10px; padding: 0 10px;
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
overflow-y: auto; overflow-y: auto;
padding-top: 10px; padding-top: 10px;
position relative position: relative;
padding-bottom 20px padding-bottom: 20px;
} }
.file-view { .file-view {
position: absolute; position: absolute;
bottom: 135px; bottom: 135px;
...@@ -351,6 +439,7 @@ export default { ...@@ -351,6 +439,7 @@ export default {
margin: 0 auto; margin: 0 auto;
font-size: 13px; font-size: 13px;
color: #8bc34a; color: #8bc34a;
span { span {
display: flex; display: flex;
align-content: center; align-content: center;
...@@ -367,6 +456,7 @@ export default { ...@@ -367,6 +456,7 @@ export default {
} }
} }
} }
.input-form { .input-form {
position: absolute; position: absolute;
bottom: 35px; bottom: 35px;
...@@ -410,6 +500,7 @@ export default { ...@@ -410,6 +500,7 @@ export default {
} }
} }
} }
.title { .title {
width: 100%; width: 100%;
height: 40px; height: 40px;
...@@ -422,6 +513,12 @@ export default { ...@@ -422,6 +513,12 @@ export default {
box-sizing: border-box; box-sizing: border-box;
} }
.buttons {
position: absolute;
top: 5px;
right: 50px;
}
.close { .close {
position: absolute; position: absolute;
top: 5px; top: 5px;
......
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 sign in to comment