Commit 75a031ef by chenxianqi

update code

parent 5e3f6d21
......@@ -201,9 +201,21 @@ func (c *WorkOrderController) GetWorkOrders() {
res, err := c.WorkOrderRepository.GetWorkOrders(request)
if err != nil {
c.JSON(configs.ResponseFail, "查询失败!", &res)
c.JSON(configs.ResponseFail, "查询失败!", err.Error())
}
c.JSON(configs.ResponseSucess, "查询成功", &res)
}
// GetWorkOrderCounts get workorders counts
func (c *WorkOrderController) GetWorkOrderCounts() {
counts, err := c.WorkOrderRepository.GetCounts()
if err != nil {
c.JSON(configs.ResponseFail, "查询失败!", err.Error())
}
c.JSON(configs.ResponseSucess, "查询成功", &counts)
}
package models
// WorkOrderCountDto model
type WorkOrderCountDto struct {
Status0 int64 `json:"status0"`
Status2 int64 `json:"status2"`
Status3 int64 `json:"status3"`
DeleteCount int64 `json:"delete_count"`
}
......@@ -6,6 +6,7 @@ type WorkOrderPaginationDto struct {
PageOn int `json:"page_on"`
Total int64 `json:"total"`
Tid int64 `json:"tid"`
Status int `json:"status"`
Del int `json:"del"`
Status string `json:"status"`
List interface{} `json:"list"`
}
.container[data-v-1f126a3f]{height:100vh;overflow:hidden;overflow-y:auto}.content[data-v-1f126a3f]{padding-top:50px;padding-bottom:90px}.content .no-data[data-v-1f126a3f]{color:#666;font-size:14px}.content .workorder-close[data-v-1f126a3f]{text-align:center;color:#666;font-size:14px;padding:10px}.content.hide-header[data-v-1f126a3f]{padding-top:0}.content .head[data-v-1f126a3f]{margin:0 10px;padding:10px 0;border-bottom:1px solid hsla(0,0%,62%,.13)}.content .head .con[data-v-1f126a3f]{font-size:15px;color:#333;display:-ms-flexbox;display:flex;margin-bottom:8px}.content .head .con span[data-v-1f126a3f]{-ms-flex-flow:1;flex-flow:1}.content .head .con span[data-v-1f126a3f]:first-child{-ms-flex-flow:0;flex-flow:0;-ms-flex-negative:0;flex-shrink:0;width:45px}.content .head .con i[data-v-1f126a3f]{font-style:normal}.content .comments[data-v-1f126a3f]{padding:10px}.content .comments .item[data-v-1f126a3f]{display:-ms-flexbox;display:flex}.content .comments .item .avatar[data-v-1f126a3f]{padding-top:10px;border-bottom:1px solid hsla(0,0%,62%,.13)}.content .comments .item .avatar img[data-v-1f126a3f]{width:30px;height:30px;border-radius:100px;display:block}.content .comments .item .right[data-v-1f126a3f]{padding:10px 5px;-ms-flex-positive:1;flex-grow:1;border-bottom:1px solid hsla(0,0%,62%,.13)}.content .comments .item .right .nickname[data-v-1f126a3f]{font-size:15px;color:#333}.content .comments .item .right .detail[data-v-1f126a3f]{font-size:15px;color:#333;margin-top:5px}.content .comments .item .right .date[data-v-1f126a3f]{color:#999;font-size:14px;margin-top:5px}.content .comments .item:last-child .avatar[data-v-1f126a3f],.content .comments .item:last-child .right[data-v-1f126a3f]{border-bottom:0}.content .file-view[data-v-1f126a3f]{position:fixed;bottom:80px;left:0;right:0;padding:5px 10px;margin:0 auto;font-size:13px;color:#8bc34a}.content .file-view span[data-v-1f126a3f]{display:-ms-flexbox;display:flex;-ms-flex-line-pack:center;align-content:center;-ms-flex-align:center;align-items:center}.content .file-view span img[data-v-1f126a3f]{width:20px;height:20px}.content .file-view span i[data-v-1f126a3f]{font-style:normal;margin-left:5px}.content .input-form[data-v-1f126a3f]{position:fixed;bottom:0;left:0;right:0;margin:0 auto;width:100%;height:80px;background-color:#fff;border-top:1px solid hsla(0,0%,62%,.13);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:0 10px;box-sizing:border-box;-ms-flex-line-pack:center;align-content:center;-ms-flex-align:center;align-items:center}.content .input-form textarea[data-v-1f126a3f]{height:45px;-ms-flex-positive:1;flex-grow:1;border-radius:0;border:0;color:#333;font-size:14px;resize:none}.content .input-form .icon-btn[data-v-1f126a3f]{background:url(../img/upload.76668586.png) 50% no-repeat;background-size:30px;width:55px;height:55px;overflow:hidden}.content .input-form .icon-btn input[data-v-1f126a3f]{display:block;width:100%;height:100%;font-size:100px;opacity:0}.content .input-form .sub-btn[data-v-1f126a3f]{display:block;width:55px;height:30px;color:#fff;line-height:30px;text-align:center;border-radius:3px;border:none;font-size:14px;background:linear-gradient(90deg,#26a2ff,#736cde);-ms-flex-negative:0;flex-shrink:0}.content .input-form .sub-btn[data-v-1f126a3f]:active{opacity:.8}
\ No newline at end of file
.container[data-v-ac0a42f8]{height:100vh;overflow:hidden;overflow-y:auto}.content[data-v-ac0a42f8]{padding-top:50px;padding-bottom:90px}.content .no-data[data-v-ac0a42f8]{color:#666;font-size:14px}.content .workorder-close[data-v-ac0a42f8]{text-align:center;color:#666;font-size:14px;padding:10px}.content.hide-header[data-v-ac0a42f8]{padding-top:0}.content .head[data-v-ac0a42f8]{margin:0 10px;padding:10px 0;border-bottom:1px solid hsla(0,0%,62%,.13)}.content .head .con[data-v-ac0a42f8]{font-size:15px;color:#333;display:-ms-flexbox;display:flex;margin-bottom:8px}.content .head .con span[data-v-ac0a42f8]{-ms-flex-flow:1;flex-flow:1}.content .head .con span[data-v-ac0a42f8]:first-child{-ms-flex-flow:0;flex-flow:0;-ms-flex-negative:0;flex-shrink:0;width:45px}.content .head .con i[data-v-ac0a42f8]{font-style:normal}.content .comments[data-v-ac0a42f8]{padding:10px}.content .comments .item[data-v-ac0a42f8]{display:-ms-flexbox;display:flex}.content .comments .item .avatar[data-v-ac0a42f8]{padding-top:10px;border-bottom:1px solid hsla(0,0%,62%,.13)}.content .comments .item .avatar img[data-v-ac0a42f8]{width:30px;height:30px;border-radius:100px;display:block}.content .comments .item .right[data-v-ac0a42f8]{padding:10px 5px;-ms-flex-positive:1;flex-grow:1;border-bottom:1px solid hsla(0,0%,62%,.13)}.content .comments .item .right .nickname[data-v-ac0a42f8]{font-size:15px;color:#333}.content .comments .item .right .detail[data-v-ac0a42f8]{font-size:15px;color:#333;margin-top:5px}.content .comments .item .right .date[data-v-ac0a42f8]{color:#999;font-size:14px;margin-top:5px}.content .comments .item:last-child .avatar[data-v-ac0a42f8],.content .comments .item:last-child .right[data-v-ac0a42f8]{border-bottom:0}.content .file-view[data-v-ac0a42f8]{position:fixed;bottom:80px;left:0;right:0;padding:5px 10px;margin:0 auto;font-size:13px;color:#8bc34a}.content .file-view span[data-v-ac0a42f8]{display:-ms-flexbox;display:flex;-ms-flex-line-pack:center;align-content:center;-ms-flex-align:center;align-items:center}.content .file-view span img[data-v-ac0a42f8]{width:20px;height:20px}.content .file-view span i[data-v-ac0a42f8]{font-style:normal;margin-left:5px}.content .input-form[data-v-ac0a42f8]{position:fixed;bottom:0;left:0;right:0;margin:0 auto;width:100%;height:80px;background-color:#fff;border-top:1px solid hsla(0,0%,62%,.13);display:-ms-flexbox;display:flex;-ms-flex-pack:justify;justify-content:space-between;padding:0 10px;box-sizing:border-box;-ms-flex-line-pack:center;align-content:center;-ms-flex-align:center;align-items:center}.content .input-form textarea[data-v-ac0a42f8]{height:45px;-ms-flex-positive:1;flex-grow:1;border-radius:0;border:0;color:#333;font-size:14px;resize:none}.content .input-form .icon-btn[data-v-ac0a42f8]{background:url(../img/upload.76668586.png) 50% no-repeat;background-size:30px;width:55px;height:55px;overflow:hidden}.content .input-form .icon-btn input[data-v-ac0a42f8]{display:block;width:100%;height:100%;font-size:100px;opacity:0}.content .input-form .sub-btn[data-v-ac0a42f8]{display:block;width:55px;height:30px;color:#fff;line-height:30px;text-align:center;border-radius:3px;border:none;font-size:14px;background:linear-gradient(90deg,#26a2ff,#736cde);-ms-flex-negative:0;flex-shrink:0}.content .input-form .sub-btn[data-v-ac0a42f8]:active{opacity:.8}
\ No newline at end of file
......@@ -43,4 +43,4 @@
top:0 !important;
min-height: inherit!important;
left:0 !important; right:0 !important; bottom:0 !important; margin: auto !important;
}</style><link href=css/chunk-233fded2.68e29c95.css rel=prefetch><link href=css/chunk-2c568771.92feb802.css rel=prefetch><link href=css/chunk-5e6009ff.86cb9867.css rel=prefetch><link href=css/chunk-612d9b40.3daa63d4.css rel=prefetch><link href=js/chunk-233fded2.64fa5b81.js rel=prefetch><link href=js/chunk-2c568771.a81203d3.js rel=prefetch><link href=js/chunk-5e6009ff.d7088d94.js rel=prefetch><link href=js/chunk-612d9b40.13a3a9bb.js rel=prefetch><link href=css/app.19de1655.css rel=preload as=style><link href=css/chunk-vendors.5cea36ab.css rel=preload as=style><link href=js/app.cd5008bc.js rel=preload as=script><link href=js/chunk-vendors.a823ad66.js rel=preload as=script><link href=css/chunk-vendors.5cea36ab.css rel=stylesheet><link href=css/app.19de1655.css rel=stylesheet></head><body><noscript><strong>We're sorry but m doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.a823ad66.js></script><script src=js/app.cd5008bc.js></script></body></html>
\ No newline at end of file
}</style><link href=css/chunk-2c568771.92feb802.css rel=prefetch><link href=css/chunk-5e6009ff.86cb9867.css rel=prefetch><link href=css/chunk-612d9b40.3daa63d4.css rel=prefetch><link href=css/chunk-9ec58ea8.5743221d.css rel=prefetch><link href=js/chunk-2c568771.a81203d3.js rel=prefetch><link href=js/chunk-5e6009ff.d7088d94.js rel=prefetch><link href=js/chunk-612d9b40.13a3a9bb.js rel=prefetch><link href=js/chunk-9ec58ea8.59b56ff9.js rel=prefetch><link href=css/app.19de1655.css rel=preload as=style><link href=css/chunk-vendors.5cea36ab.css rel=preload as=style><link href=js/app.a65684bc.js rel=preload as=script><link href=js/chunk-vendors.a823ad66.js rel=preload as=script><link href=css/chunk-vendors.5cea36ab.css rel=stylesheet><link href=css/app.19de1655.css rel=stylesheet></head><body><noscript><strong>We're sorry but m doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.a823ad66.js></script><script src=js/app.a65684bc.js></script></body></html>
\ No newline at end of file
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-233fded2"],{"0b3a":function(t,e,o){},"269c":function(t,e,o){t.exports=o.p+"img/fujian1.083cd8b7.png"},"3fb2":function(t,e,o){"use strict";var s=o("0b3a"),r=o.n(s);r.a},4033:function(t,e,o){"use strict";o.r(e);var s=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"container"},[t.isShowHeader?s("mt-header",{attrs:{fixed:"",title:"工单详细"}},[s("div",{attrs:{slot:"left"},slot:"left"},[s("mt-button",{attrs:{icon:"back"},on:{click:function(e){return t.$router.go(-1)}}})],1),3!=t.workorder.status?s("mt-button",{attrs:{slot:"right"},on:{click:function(e){return t.close()}},slot:"right"},[s("span",[t._v("关闭工单")])]):s("mt-button",{attrs:{slot:"right"},on:{click:function(e){return t.del()}},slot:"right"},[s("span",[t._v("删除")])])],1):t._e(),s("div",{staticClass:"content",class:{"hide-header":!t.isShowHeader}},[s("div",{staticClass:"head"},[s("div",{staticClass:"con"},[s("span",[t._v("标题:")]),s("span",[t._v(t._s(t.workorder.title))])]),s("div",{staticClass:"con"},[s("span",[t._v("内容:")]),s("span",{domProps:{innerHTML:t._s(t.workorder.content)}})]),s("div",{staticClass:"con"},[s("span",[t._v("电话:")]),s("span",[t._v(t._s(t.workorder.phone||"未预留电话号码"))])]),s("div",{staticClass:"con"},[s("span",[t._v("邮箱:")]),s("span",[t._v(t._s(t.workorder.email||"未预留邮箱"))])]),s("div",{staticClass:"con"},[s("span",[t._v("时间:")]),s("span",[t._v(t._s(t.$formatDate(t.workorder.create_at)))])]),s("div",{staticClass:"con"},[s("span",[t._v("状态:")]),s("span",[1==t.workorder.status?s("i",{staticStyle:{color:"#8bc34a"}},[t._v("已回复")]):t._e(),3==t.workorder.status?s("i",{staticStyle:{color:"#ccc"}},[t._v("已结束")]):t._e(),0==t.workorder.status?s("i",{staticStyle:{color:"#FF9800"}},[t._v("待处理")]):t._e(),2==t.workorder.status?s("i",{staticStyle:{color:"#FF9800"}},[t._v("待回复")]):t._e()])])]),s("div",{staticClass:"comments"},[t.comments.length<=0?s("div",{staticClass:"no-data"},[t._v("暂无回复内容,请您耐心等待~")]):t._l(t.comments,(function(e,o){return[s("div",{key:o,staticClass:"item"},[s("div",{staticClass:"avatar"},[0==e.aid?s("img",{attrs:{src:t.userInfo.avatar||"http://qiniu.cmp520.com/avatar_degault_3.png",alt:""}}):s("img",{attrs:{src:e.a_avatar||"http://qiniu.cmp520.com/avatar_degault_3.png",alt:""}})]),s("div",{staticClass:"right"},[0==e.aid?s("div",{staticClass:"nickname"},[t._v("我")]):s("div",{staticClass:"nickname"},[t._v(t._s(e.a_nickname))]),s("div",{staticClass:"detail",domProps:{innerHTML:t._s(e.content)}}),s("div",{staticClass:"date"},[t._v(t._s(t.$formatDate(e.create_at)))])])])]})),3==t.workorder.status?s("div",{staticClass:"workorder-close"},[t._v("工单已结束~")]):t._e()],2),""!=t.request.source||t.isShowUploadLoading?s("div",{staticClass:"file-view"},[t.isShowUploadLoading?s("span",[s("img",{attrs:{src:o("cf1c"),alt:""}}),s("i",[t._v("上传中~")])]):s("span",[s("img",{attrs:{src:o("269c"),alt:""}}),s("i",[t._v("你已成功添加附件,重新上传可替换~")])])]):t._e(),3!=t.workorder.status?s("div",{staticClass:"input-form"},[s("textarea",{directives:[{name:"model",rawName:"v-model",value:t.request.content,expression:"request.content"}],attrs:{placeholder:"请输入内容~"},domProps:{value:t.request.content},on:{blur:function(e){return t.inputBlur()},input:function(e){e.target.composing||t.$set(t.request,"content",e.target.value)}}}),s("span",{staticClass:"icon-btn"},[s("input",{attrs:{title:"添加附件",type:"file",onclick:"this.value = null"},on:{change:t.uploadFile}})]),s("span",{staticClass:"sub-btn",on:{click:function(e){return t.reply()}}},[t._v("提交")])]):t._e()])],1)},r=[],n=(o("8e6e"),o("ac6a"),o("456d"),o("bd86")),a=o("2f62"),i=o("76a0"),c=o("bc3a"),l=o.n(c);function u(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,s)}return o}function d(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?u(Object(o),!0).forEach((function(e){Object(n["a"])(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var A={name:"workorder_detail",components:{},data:function(){return{isShowUploadLoading:!1,isSubmit:!1,workorder:{},comments:[],fileType:"",request:{source:"",content:""}}},computed:d({},Object(a["b"])(["isShowHeader","workorders","userInfo","workorderTypes","uploadToken"])),created:function(){var t=this;document.title="工单详细";var e=this.$route.params.id;this.$store.commit("updateState",{isShowPageLoading:!0}),l.a.all([this.getWorkOrder(e),this.getComments(e)]).then(l.a.spread((function(){t.$store.commit("updateState",{isShowPageLoading:!1})})))},methods:{getWorkOrder:function(t){var e=this;return l.a.get("/public/workorder/"+t).then((function(t){e.workorder=t.data.data,setTimeout((function(){return e.$previewRefresh()}),200)})).catch((function(t){console.log(t)}))},getComments:function(t){var e=this;return l.a.get("/public/workorder/comments/"+t).then((function(t){null!=t.data.data&&(e.comments=t.data.data,setTimeout((function(){return e.$previewRefresh()}),200))})).catch((function(t){console.log(t)}))},reply:function(){var t=this,e=this.request.content+this.request.source;if(""!=e.trim()){if(!this.isSubmit){this.isSubmit=!0;var o=this.workorder.id;l.a.post("/public/workorder/reply",{wid:o,content:e}).then((function(e){t.isSubmit=!1,console.log(e),t.getComments(o),t.request={source:"",content:""},setTimeout((function(){var t=document.querySelector(".container").clientHeight,e=document.querySelector(".content").clientHeight;document.querySelector(".container").scrollTop=e-t+20}),500)})).catch((function(e){t.isSubmit=!1,console.log(e),Object(i["Toast"])({message:"提交失败~"})}))}}else Object(i["Toast"])({message:"请输入内容~"})},inputBlur:function(){setTimeout((function(){document.body.scrollTo=0,window.scrollTo(0,0)}),100)},uploadFile:function(t){var e=t.target,o=e.files[0];this.isShowUploadLoading=!0;var s=this;this.$uploadFile({file:o,mode:this.uploadToken.mode,percent:function(){},success:function(t){var e;s.isShowUploadLoading=!1;var o=s.uploadToken.host+"/"+t,r=t.substr(t.lastIndexOf(".")+1);-1!="jpg,jpeg,png,JPG,JPEG,PNG".indexOf(r)?e="<br><img style='max-width:45%' preview='1' src='"+o+"' />":(e="<br><img style='width:20px;height:20px;top:3px; right:3px;position: relative;' preview='1' src='http://qiniu.cmp520.com/fj.png' />",e+="<a target='_blank' style='color: #2e9dfc;' href='"+o+"'>下载附件</a>"),s.request.source=e,Object(i["Toast"])({message:"上传成功~"})},fail:function(t){s.isShowUploadLoading=!1,t.response&&t.response.data&&Object(i["Toast"])({message:t.response.data.message})}})},close:function(){var t=this,e=this.workorder.id;i["MessageBox"].confirm("您确定关闭该工单吗?").then((function(){l.a.put("/public/workorder/close/"+e).then((function(o){console.log(o),Object(i["Toast"])({message:"工单已关闭~"}),t.getWorkOrder(e)})).catch((function(t){Object(i["Toast"])({message:"工单关闭失败~"}),console.log(t)}))}))},del:function(){var t=this,e=this.workorder.id;i["MessageBox"].confirm("您确定删除该工单吗?").then((function(){l.a.delete("/public/workorder/"+e).then((function(e){console.log(e),Object(i["Toast"])({message:"工单已删除~"}),setTimeout((function(){return t.$router.go(-1)}))})).catch((function(t){Object(i["Toast"])({message:"工单关闭失败~"}),console.log(t)}))}))}}},p=A,g=(o("3fb2"),o("2877")),m=Object(g["a"])(p,s,r,!1,null,"1f126a3f",null);e["default"]=m.exports},cf1c:function(t,e){t.exports="data:image/gif;base64,R0lGODlhEAAQAKIGAMLY8YSx5HOm4Mjc88/g9Ofw+v///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgAGACwAAAAAEAAQAAADMGi6RbUwGjKIXCAA016PgRBElAVlG/RdLOO0X9nK61W39qvqiwz5Ls/rRqrggsdkAgAh+QQFCgAGACwCAAAABwAFAAADD2hqELAmiFBIYY4MAutdCQAh+QQFCgAGACwGAAAABwAFAAADD1hU1kaDOKMYCGAGEeYFCQAh+QQFCgAGACwKAAIABQAHAAADEFhUZjSkKdZqBQG0IELDQAIAIfkEBQoABgAsCgAGAAUABwAAAxBoVlRKgyjmlAIBqCDCzUoCACH5BAUKAAYALAYACgAHAAUAAAMPaGpFtYYMAgJgLogA610JACH5BAUKAAYALAIACgAHAAUAAAMPCAHWFiI4o1ghZZJB5i0JACH5BAUKAAYALAAABgAFAAcAAAMQCAFmIaEp1motpDQySMNFAgA7"}}]);
//# sourceMappingURL=chunk-233fded2.64fa5b81.js.map
\ No newline at end of file
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-9ec58ea8"],{"0c51":function(t,e,o){},"269c":function(t,e,o){t.exports=o.p+"img/fujian1.083cd8b7.png"},4033:function(t,e,o){"use strict";o.r(e);var s=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"container"},[t.isShowHeader?s("mt-header",{attrs:{fixed:"",title:"工单详细"}},[s("div",{attrs:{slot:"left"},slot:"left"},[s("mt-button",{attrs:{icon:"back"},on:{click:function(e){return t.$router.go(-1)}}})],1),3!=t.workorder.status?s("mt-button",{attrs:{slot:"right"},on:{click:function(e){return t.close()}},slot:"right"},[s("span",[t._v("关闭工单")])]):s("mt-button",{attrs:{slot:"right"},on:{click:function(e){return t.del()}},slot:"right"},[s("span",[t._v("删除")])])],1):t._e(),s("div",{staticClass:"content",class:{"hide-header":!t.isShowHeader}},[s("div",{staticClass:"head"},[s("div",{staticClass:"con"},[s("span",[t._v("标题:")]),s("span",[t._v(t._s(t.workorder.title))])]),s("div",{staticClass:"con"},[s("span",[t._v("内容:")]),s("span",{domProps:{innerHTML:t._s(t.workorder.content)}})]),s("div",{staticClass:"con"},[s("span",[t._v("电话:")]),s("span",[t._v(t._s(t.workorder.phone||"未预留电话号码"))])]),s("div",{staticClass:"con"},[s("span",[t._v("邮箱:")]),s("span",[t._v(t._s(t.workorder.email||"未预留邮箱"))])]),s("div",{staticClass:"con"},[s("span",[t._v("时间:")]),s("span",[t._v(t._s(t.$formatDate(t.workorder.create_at)))])]),s("div",{staticClass:"con"},[s("span",[t._v("类型:")]),s("span",[t._v(t._s(t.typeName||"---"))])]),s("div",{staticClass:"con"},[s("span",[t._v("状态:")]),s("span",[1==t.workorder.status?s("i",{staticStyle:{color:"#8bc34a"}},[t._v("已回复")]):t._e(),3==t.workorder.status?s("i",{staticStyle:{color:"#ccc"}},[t._v("已结束")]):t._e(),0==t.workorder.status?s("i",{staticStyle:{color:"#FF9800"}},[t._v("待处理")]):t._e(),2==t.workorder.status?s("i",{staticStyle:{color:"#FF9800"}},[t._v("待回复")]):t._e()])])]),s("div",{staticClass:"comments"},[t.comments.length<=0?s("div",{staticClass:"no-data"},[t._v("暂无回复内容,请您耐心等待~")]):t._l(t.comments,(function(e,o){return[s("div",{key:o,staticClass:"item"},[s("div",{staticClass:"avatar"},[0==e.aid?s("img",{attrs:{src:t.userInfo.avatar||"http://qiniu.cmp520.com/avatar_degault_3.png",alt:""}}):s("img",{attrs:{src:e.a_avatar||"http://qiniu.cmp520.com/avatar_degault_3.png",alt:""}})]),s("div",{staticClass:"right"},[0==e.aid?s("div",{staticClass:"nickname"},[t._v("我")]):s("div",{staticClass:"nickname"},[t._v(t._s(e.a_nickname))]),s("div",{staticClass:"detail",domProps:{innerHTML:t._s(e.content)}}),s("div",{staticClass:"date"},[t._v(t._s(t.$formatDate(e.create_at)))])])])]})),3==t.workorder.status?s("div",{staticClass:"workorder-close"},[t._v("工单已结束~")]):t._e()],2),""!=t.request.source||t.isShowUploadLoading?s("div",{staticClass:"file-view"},[t.isShowUploadLoading?s("span",[s("img",{attrs:{src:o("cf1c"),alt:""}}),s("i",[t._v("上传中~")])]):s("span",[s("img",{attrs:{src:o("269c"),alt:""}}),s("i",[t._v("你已成功添加附件,重新上传可替换~")])])]):t._e(),3!=t.workorder.status?s("div",{staticClass:"input-form"},[s("textarea",{directives:[{name:"model",rawName:"v-model",value:t.request.content,expression:"request.content"}],attrs:{placeholder:"请输入内容~"},domProps:{value:t.request.content},on:{blur:function(e){return t.inputBlur()},input:function(e){e.target.composing||t.$set(t.request,"content",e.target.value)}}}),s("span",{staticClass:"icon-btn"},[s("input",{attrs:{title:"添加附件",type:"file",onclick:"this.value = null"},on:{change:t.uploadFile}})]),s("span",{staticClass:"sub-btn",on:{click:function(e){return t.reply()}}},[t._v("提交")])]):t._e()])],1)},r=[],n=(o("8e6e"),o("ac6a"),o("456d"),o("bd86")),a=o("2f62"),i=o("76a0"),c=o("bc3a"),l=o.n(c);function u(t,e){var o=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),o.push.apply(o,s)}return o}function d(t){for(var e=1;e<arguments.length;e++){var o=null!=arguments[e]?arguments[e]:{};e%2?u(Object(o),!0).forEach((function(e){Object(n["a"])(t,e,o[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):u(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}var p={name:"workorder_detail",components:{},data:function(){return{isShowUploadLoading:!1,isSubmit:!1,workorder:{},comments:[],fileType:"",request:{source:"",content:""}}},computed:d({},Object(a["b"])(["isShowHeader","workorders","userInfo","workorderTypes","uploadToken"]),{typeName:function(){var t=this;try{return this.workorderTypes.filter((function(e){return e.id==t.workorder.tid}))[0].title}catch(e){return console.log(e),""}}}),created:function(){var t=this;document.title="工单详细";var e=this.$route.params.id;this.$store.commit("updateState",{isShowPageLoading:!0}),l.a.all([this.getWorkOrder(e),this.getComments(e)]).then(l.a.spread((function(){t.$store.commit("updateState",{isShowPageLoading:!1})})))},methods:{getWorkOrder:function(t){var e=this;return l.a.get("/public/workorder/"+t).then((function(t){e.workorder=t.data.data,setTimeout((function(){return e.$previewRefresh()}),200)})).catch((function(t){console.log(t)}))},getComments:function(t){var e=this;return l.a.get("/public/workorder/comments/"+t).then((function(t){null!=t.data.data&&(e.comments=t.data.data,setTimeout((function(){return e.$previewRefresh()}),200))})).catch((function(t){console.log(t)}))},reply:function(){var t=this,e=this.request.content+this.request.source;if(""!=e.trim()){if(!this.isSubmit){this.isSubmit=!0;var o=this.workorder.id;l.a.post("/public/workorder/reply",{wid:o,content:e}).then((function(e){t.isSubmit=!1,console.log(e),t.getComments(o),t.request={source:"",content:""},setTimeout((function(){var t=document.querySelector(".container").clientHeight,e=document.querySelector(".content").clientHeight;document.querySelector(".container").scrollTop=e-t+20}),500)})).catch((function(e){t.isSubmit=!1,console.log(e),Object(i["Toast"])({message:"提交失败~"})}))}}else Object(i["Toast"])({message:"请输入内容~"})},inputBlur:function(){setTimeout((function(){document.body.scrollTo=0,window.scrollTo(0,0)}),100)},uploadFile:function(t){var e=t.target,o=e.files[0];this.isShowUploadLoading=!0;var s=this;this.$uploadFile({file:o,mode:this.uploadToken.mode,percent:function(){},success:function(t){var e;s.isShowUploadLoading=!1;var o=s.uploadToken.host+"/"+t,r=t.substr(t.lastIndexOf(".")+1);-1!="jpg,jpeg,png,JPG,JPEG,PNG".indexOf(r)?e="<br><img style='max-width:45%' preview='1' src='"+o+"' />":(e="<br><img style='width:20px;height:20px;top:3px; right:3px;position: relative;' preview='1' src='http://qiniu.cmp520.com/fj.png' />",e+="<a target='_blank' style='color: #2e9dfc;' href='"+o+"'>下载附件</a>"),s.request.source=e,Object(i["Toast"])({message:"上传成功~"})},fail:function(t){s.isShowUploadLoading=!1,t.response&&t.response.data&&Object(i["Toast"])({message:t.response.data.message})}})},close:function(){var t=this,e=this.workorder.id;i["MessageBox"].confirm("您确定关闭该工单吗?").then((function(){l.a.put("/public/workorder/close/"+e).then((function(o){console.log(o),Object(i["Toast"])({message:"工单已关闭~"}),t.getWorkOrder(e)})).catch((function(t){Object(i["Toast"])({message:"工单关闭失败~"}),console.log(t)}))}))},del:function(){var t=this,e=this.workorder.id;i["MessageBox"].confirm("您确定删除该工单吗?").then((function(){l.a.delete("/public/workorder/"+e).then((function(e){console.log(e),Object(i["Toast"])({message:"工单已删除~"}),setTimeout((function(){return t.$router.go(-1)}))})).catch((function(t){Object(i["Toast"])({message:"工单关闭失败~"}),console.log(t)}))}))}}},A=p,m=(o("da20"),o("2877")),g=Object(m["a"])(A,s,r,!1,null,"ac0a42f8",null);e["default"]=g.exports},cf1c:function(t,e){t.exports="data:image/gif;base64,R0lGODlhEAAQAKIGAMLY8YSx5HOm4Mjc88/g9Ofw+v///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgAGACwAAAAAEAAQAAADMGi6RbUwGjKIXCAA016PgRBElAVlG/RdLOO0X9nK61W39qvqiwz5Ls/rRqrggsdkAgAh+QQFCgAGACwCAAAABwAFAAADD2hqELAmiFBIYY4MAutdCQAh+QQFCgAGACwGAAAABwAFAAADD1hU1kaDOKMYCGAGEeYFCQAh+QQFCgAGACwKAAIABQAHAAADEFhUZjSkKdZqBQG0IELDQAIAIfkEBQoABgAsCgAGAAUABwAAAxBoVlRKgyjmlAIBqCDCzUoCACH5BAUKAAYALAYACgAHAAUAAAMPaGpFtYYMAgJgLogA610JACH5BAUKAAYALAIACgAHAAUAAAMPCAHWFiI4o1ghZZJB5i0JACH5BAUKAAYALAAABgAFAAcAAAMQCAFmIaEp1motpDQySMNFAgA7"},da20:function(t,e,o){"use strict";var s=o("0c51"),r=o.n(s);r.a}}]);
//# sourceMappingURL=chunk-9ec58ea8.59b56ff9.js.map
\ No newline at end of file
......@@ -161,6 +161,7 @@ func routers(prefix string) *beego.Namespace {
beego.NSRouter("/types", &controllers.WorkOrderController{}, "get:GetWorkTypes"),
beego.NSRouter("/close", &controllers.WorkOrderController{}, "post:CloseWorkOrder"),
beego.NSRouter("/list", &controllers.WorkOrderController{}, "post:GetWorkOrders"),
beego.NSRouter("/counts", &controllers.WorkOrderController{}, "get:GetWorkOrderCounts"),
),
)
......
......@@ -3,6 +3,7 @@ package services
import (
"kefu_server/models"
"strconv"
"strings"
"time"
"github.com/astaxie/beego/logs"
......@@ -18,6 +19,7 @@ type WorkOrderRepositoryInterface interface {
Add(workOrder models.WorkOrder) (int64, error)
Delete(id int64) (int64, error)
Close(id int64, cid int64, remark string) (int64, error)
GetCounts() (models.WorkOrderCountDto, error)
}
// WorkOrderRepository struct
......@@ -62,10 +64,20 @@ func (r *WorkOrderRepository) GetUserWorkOrders(uid int64) ([]models.WorkOrder,
return workOrders, err
}
// GetCounts get WorkOrder counts
func (r *WorkOrderRepository) GetCounts() (models.WorkOrderCountDto, error) {
var workOrderCouns models.WorkOrderCountDto
err := r.o.Raw("SELECT * FROM ((SELECT count(*) AS status0 FROM work_order WHERE `status` = 0) w1,(SELECT count(*) AS status2 FROM work_order WHERE `status` = 2) w2,(SELECT count(*) AS status3 FROM work_order WHERE `status` = 3) w3,(SELECT count(*) AS delete_count FROM work_order WHERE `delete` = 1) w4)").QueryRow(&workOrderCouns)
if err != nil {
logs.Warn(" GetCounts get WorkOrder count", err)
}
return workOrderCouns, err
}
// GetWorkOrder get WorkOrder
func (r *WorkOrderRepository) GetWorkOrder(id int64) (models.WorkOrderDto, error) {
var workOrder models.WorkOrderDto
err := r.o.Raw("SELECT * FROM (SELECT w.*,w.id AS i_d, w.uid AS u_i_d,u.nickname AS u_nickname FROM work_order w LEFT JOIN (SELECT * FROM `user`) u ON w.uid = u.id) w WHERE w.id = ? AND w.`delete` = 0", id).QueryRow(&workOrder)
err := r.o.Raw("SELECT * FROM (SELECT w.*,w.id AS i_d, w.uid AS u_i_d,u.nickname AS u_nickname FROM work_order w LEFT JOIN (SELECT * FROM `user`) u ON w.uid = u.id) w WHERE w.id = ?", id).QueryRow(&workOrder)
if err != nil {
logs.Warn("GetWorkOrder get WorkOrder------------", err)
}
......@@ -75,11 +87,11 @@ func (r *WorkOrderRepository) GetWorkOrder(id int64) (models.WorkOrderDto, error
// GetWorkOrders get WorkOrders
func (r *WorkOrderRepository) GetWorkOrders(request models.WorkOrderPaginationDto) (models.WorkOrderPaginationDto, error) {
statusSQL := ""
if request.Status >= 0 {
statusSQL = " AND `status` = " + strconv.Itoa(request.Status) + " "
if request.Status != "" {
statusSQL = " AND `status` IN(" + strings.Trim(request.Status, ",") + ") "
}
tidSQL := ""
if request.Tid != 0 {
if request.Tid != 0 && request.Tid != -1 && request.Tid != -2 {
tidSQL = " AND `t_i_d` = " + strconv.FormatInt(request.Tid, 10) + " "
}
if request.PageSize == 0 {
......@@ -88,17 +100,22 @@ func (r *WorkOrderRepository) GetWorkOrders(request models.WorkOrderPaginationDt
if request.PageOn == 0 {
request.PageOn = 1
}
del := strconv.Itoa(request.Del)
var workOrders []models.WorkOrderDto
SQLSUB := "SELECT w.*,u.nickname AS u_nickname,a.nickname AS a_nickname,w.id AS i_d,w.uid AS u_i_d FROM work_order w LEFT JOIN (SELECT id, nickname FROM `user`) u ON w.uid = u.id LEFT JOIN (SELECT id, nickname FROM `admin`) a ON w.last_reply = a.id"
SQL := "SELECT *,t_i_d AS tid,c_i_d AS cid FROM (" + SQLSUB + ") w WHERE `delete` = 0 " + statusSQL + tidSQL + " ORDER BY status ASC, create_at DESC"
SQL := "SELECT *,t_i_d AS tid,c_i_d AS cid FROM (" + SQLSUB + ") w WHERE `delete` = " + del + statusSQL + tidSQL + " ORDER BY status ASC, create_at DESC"
_, err := r.o.Raw(SQL+" LIMIT ? OFFSET ?", request.PageSize, (request.PageOn-1)*request.PageSize).QueryRows(&workOrders)
if err != nil {
logs.Warn("GetWorkOrders get WorkOrders------------", err)
request.List = []int{}
}
if len(workOrders) == 0 {
request.List = []int{}
} else {
request.List = workOrders
}
var _maps []orm.Params
total, _ := r.o.Raw(SQL).Values(&_maps)
request.List = workOrders
request.Total = total
return request, err
}
......
......@@ -75,7 +75,7 @@ func (r *WorkOrderTypeRepository) GetWorkOrderTypes() []models.WorkOrderType {
// 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)
_, 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 AND status != 3 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{}
......
......@@ -11,16 +11,6 @@
条待回复工单</span>
</span>
<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>
......@@ -74,7 +64,7 @@
</el-row>
</div>
</div>
<WorkOrderView :prop="showWorkOrder" v-model="isShowWorkOrderView" />
<WorkOrderView :workorderTypes="workorderTypes" :prop="showWorkOrder" v-model="isShowWorkOrderView" />
</div>
</template>
<script>
......@@ -90,15 +80,17 @@ export default {
loading: true,
isShowWorkOrderView: false,
showWorkOrder: {},
workStatus: "-1",
tableData: {
list: [],
page_on: 1,
page_size: 10,
total: 0,
status: -1,
status: "",
del: 0,
tid: 0
},
tabIndex: 0,
del: 0,
workorderTypes:[
{
"id": 0,
......@@ -108,6 +100,14 @@ export default {
],
};
},
computed: {
workStatus(){
if(this.tabIndex == this.workorderTypes.length-1 && this.workorderTypes.length > 1){
return '0,1,2,3'
}
return "0,1,2"
}
},
created() {
this.getWorkorderList();
this.getWorkorderTypes()
......@@ -118,7 +118,10 @@ export default {
this.isShowWorkOrderView = true
},
tabsChange(tab){
this.changeType(this.workorderTypes[parseInt(tab.index)].id)
this.tabIndex = parseInt(tab.index)
this.del = 0
if(this.tabIndex == this.workorderTypes.length-1) this.del = 1
this.changeType(this.workorderTypes[this.tabIndex].id)
},
// 行号
indexMethod(index) {
......@@ -133,9 +136,11 @@ export default {
// 获取数据
getWorkorderList(index) {
if (index) this.tableData.page_on = index;
const { page_on, page_size, tid, status } = this.tableData;
this.tableData.status = this.workStatus
this.tableData.del = this.del
const { page_on, page_size, tid, status, del } = this.tableData;
axios
.post("/workorder/list", { page_on, page_size, tid, status })
.post("/workorder/list", { page_on, page_size, tid, status, del })
.then(response => {
this.loading = false;
this.tableData = response.data.data;
......@@ -154,6 +159,16 @@ export default {
for(var i=0; i<response.data.data.length; i++){
this.workorderTypes[0].count += response.data.data[i].count
}
this.workorderTypes.push({
"id": -1,
"count": 0,
"title": "已结单"
})
this.workorderTypes.push({
"id": -2,
"count": 0,
"title": "回收站"
})
})
.catch(error => {
this.$message.error(error.response.data.message);
......@@ -175,10 +190,6 @@ export default {
if(!show){
this.getWorkorderList();
}
},
workStatus(status){
this.tableData.status = parseInt(status)
this.getWorkorderList();
}
}
};
......
......@@ -11,15 +11,16 @@
<el-button
size="mini"
@click="closeWorkorder"
v-if="showData.status == 1 || showData.status == 2"
v-if="(showData.status == 1 || showData.status == 2) && showData.delete == 0"
type="warning"
>关闭工单</el-button>
<el-button
size="mini"
@click="delWorkorder"
v-if="showData.status == 3 && adminInfo.root == 1"
v-if="showData.status == 3 && adminInfo.root == 1 && showData.delete == 0"
type="danger"
>删除工单</el-button>
<div v-if="showData.delete == 1" style="font-size:13px;margin-top:5px;color:#f44336">该工单已删除</div>
</div>
<span class="close" @click="close">
<i class="el-icon-close"></i>
......@@ -43,6 +44,10 @@
<div class="con">{{showData.email || '未预留邮箱'}}</div>
</div>
<div class="form-line">
<span class="lable">类型:</span>
<div class="con">{{typeName || '---'}}</div>
</div>
<div class="form-line">
<span class="lable">状态:</span>
<div class="con">
<span style="color:#e6a23c;" v-if="showData.status == 0">等待客服处理</span>
......@@ -134,7 +139,8 @@ export default {
default: false,
type: Boolean
},
prop: Object
prop: Object,
workorderTypes: Array
},
created() {
this.comments = [];
......@@ -146,6 +152,13 @@ export default {
isShowAside() {
return this.$store.state.isShowAside;
},
typeName(){
try{
return this.workorderTypes.filter((i)=>i.id == this.showData.tid)[0].title
}catch(e){
return ""
}
},
...mapGetters(["adminInfo", "uploadToken"])
},
methods: {
......@@ -185,7 +198,7 @@ export default {
let remark = value
axios
.post("/workorder/close", { wid, remark })
.then(response => {
.then(() => {
this.getWorkOrder()
this.$notify({
title: "温馨提示!",
......@@ -194,7 +207,7 @@ export default {
type: "success"
});
})
.catch(error => {
.catch(() => {
this.$message.error("工单关闭失败~");
});
});
......@@ -208,7 +221,7 @@ export default {
const wid = this.showData.id;
axios
.delete("/public/workorder/" +wid)
.then(response => {
.then(() => {
this.$notify({
title: "温馨提示!",
message: "工单已删除~",
......@@ -217,7 +230,7 @@ export default {
});
this.close()
})
.catch(error => {
.catch(() => {
this.$message.error("工单删除失败~");
});
});
......
......@@ -34,6 +34,10 @@
<span>{{$formatDate(workorder.create_at)}}</span>
</div>
<div class="con">
<span>类型:</span>
<span>{{typeName || "---"}}</span>
</div>
<div class="con">
<span>状态:</span>
<span>
<i v-if="workorder.status == 1" style="color:#8bc34a;">已回复</i>
......@@ -112,7 +116,15 @@ export default {
"userInfo",
"workorderTypes",
"uploadToken"
])
]),
typeName(){
try{
return this.workorderTypes.filter((i)=>i.id == this.workorder.tid)[0].title
}catch(e){
console.log(e)
return ""
}
}
},
created() {
document.title = "工单详细";
......
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