dootask/public/js/build/ProjectLog.b5d11a45.js
2024-10-31 23:29:28 +08:00

2 lines
6.6 KiB
JavaScript
Vendored

import{m as p}from"./vuex.cc7cb26e.js";import{n as u}from"./app.d2655342.js";var h=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"task-priority",style:t.myStyle},[t._t("default")],2)},m=[];const _={name:"TaskPriority",props:{color:{default:"#ffffff"},background:{default:"#7DBEEA"},backgroundColor:{default:"#7DBEEA"}},data(){return{}},computed:{...p(["themeName"]),myStyle(){const{color:t,background:e,backgroundColor:s,themeName:a}=this;return a==="dark"?{color:s||e,borderColor:s||e,backgroundColor:"transparent"}:{color:t,borderColor:s||e,backgroundColor:s||e}}}},l={};var f=u(_,h,m,!1,g,null,null,null);function g(t){for(let e in l)this[e]=l[e]}var P=function(){return f.exports}(),v={name:"ProjectLogDetail",functional:!0,props:{render:Function,item:Object},render:(t,e)=>e.props.render(t,e.props.item)},$=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{class:["project-log",t.taskId==0?"is-drawer":""]},[s("div",{staticClass:"log-title"},[t._v(t._s(t.$L("\u9879\u76EE\u52A8\u6001")))]),s("ul",{staticClass:"logs-activity"},[t._l(t.lists,function(a){return s("li",[s("div",{staticClass:"logs-date"},[t._v(t._s(t.logDate(a)))]),s("div",{staticClass:"logs-section"},[s("Timeline",t._l(a.lists,function(n,o){return s("TimelineItem",{key:o},[s("div",{staticClass:"logs-dot",attrs:{slot:"dot"},slot:"dot"},[n.userid?s("UserAvatar",{attrs:{userid:n.userid,size:18,showName:""}}):s("div",{staticClass:"avatar-wrapper common-avatar"},[s("EAvatar",{attrs:{size:18}},[t._v("A")]),s("div",{staticClass:"avatar-name auto"},[t._v(t._s(t.$L("\u7CFB\u7EDF")))])],1)],1),t._l(n.lists,function(i){return[s("div",{staticClass:"log-summary"},[s("ProjectLogDetail",{attrs:{render:t.logDetail,item:i}}),t.operationList(i).length>0?s("span",{staticClass:"log-operation"},t._l(t.operationList(i),function(r,d){return s("Button",{key:d,attrs:{size:"small"},on:{click:function(C){return t.onOperation(r)}}},[t._v(t._s(r.button))])}),1):t._e(),s("span",{staticClass:"log-time"},[t._v(t._s(i.time.ymd)+" "+t._s(i.time.segment)+" "+t._s(i.time.hi))])],1),i.project_task?s("div",{staticClass:"log-task"},[s("em",{on:{click:function(r){return t.openTask(i.project_task)}}},[t._v(t._s(t.$L("\u5173\u8054\u4EFB\u52A1"))+": "+t._s(i.project_task.name))])]):t._e(),t.hasRecordSubtask(i.record)?s("div",{staticClass:"log-task"},[s("em",{on:{click:function(r){return t.posSubTask(i.record.subtask)}}},[t._v(t._s(t.$L("\u5173\u8054\u5B50\u4EFB\u52A1"))+": "+t._s(i.record.subtask.name))])]):t._e(),s("div",{staticClass:"log-bottom"})]})],2)}),1)],1)])}),t.loadIng>0&&t.showLoad?s("li",{staticClass:"logs-loading"},[s("Loading")],1):t.hasMorePages?s("li",{staticClass:"logs-more",on:{click:t.getMore}},[t._v(t._s(t.$L("\u52A0\u8F7D\u66F4\u591A")))]):t.totalNum==0?s("li",{staticClass:"logs-none",on:{click:function(a){return t.getLists(!0)}}},[t._v(t._s(t.$L("\u6CA1\u6709\u4EFB\u4F55\u52A8\u6001")))]):t._e()],2)])},k=[];const L={name:"ProjectLog",components:{ProjectLogDetail:v},props:{projectId:{type:Number,default:0},taskId:{type:Number,default:0},showLoad:{type:Boolean,default:!0}},data(){return{loadIng:0,lists:[],listPage:1,listPageSize:20,hasMorePages:!1,totalNum:-1}},mounted(){this.getLists(!0)},computed:{},watch:{projectId(){this.lists=[],this.getLists(!0)},taskId(){this.lists=[],this.getLists(!0)},loadIng(t){this.$emit("on-load-change",t>0)}},methods:{logDate(t){return $A.daytz().format("MM-DD")==t.ymd?t.ymd+" "+this.$L("\u4ECA\u5929"):t.key},getLists(t){t===!0&&(this.listPage=1),this.loadIng++,this.$store.dispatch("call",{url:"project/log/lists",data:{project_id:this.projectId,task_id:this.taskId,page:Math.max(this.listPage,1),pagesize:Math.max($A.runNum(this.listPageSize),10)}}).then(({data:e})=>{t===!0&&(this.lists=[]),e.data.some(s=>{let a=s.time,n=a.ymd+" "+a.week,o=this.lists.find(({key:i})=>i==n);if(o){let i=o.lists.find(({userid:r})=>r==s.userid);i?i.lists.push(s):o.lists.push({userid:s.userid,lists:[s]})}else this.lists.push({key:n,ymd:s.ymd,lists:[{userid:s.userid,lists:[s]}]})}),this.hasMorePages=e.current_page<e.last_page,this.totalNum=e.total}).catch(()=>{this.lists=[],this.hasMorePages=!1,this.totalNum=0}).finally(e=>{this.loadIng--})},getMore(){!this.hasMorePages||(this.hasMorePages=!1,this.listPage++,this.getLists())},hasRecordSubtask(t){return $A.isJson(t)&&$A.isJson(t.subtask)},logDetail(t,{detail:e,record:s}){let a=[t("span",e)];if($A.isJson(s)){if($A.isArray(s.change)){let[n,o]=s.change;a.push(t("span",": ")),n&&n!=o?(a.push(t("span",{class:"change-value"},`${n||"-"}`)),a.push(t("span"," => ")),a.push(t("span",{class:"change-value"},`${o||"-"}`))):a.push(t("span",{class:"change-value"},o||"-"))}if($A.isJson(s.link)){const{title:n,url:o}=s.link;a.push(t("span",": ")),a.push(t("a",{attrs:{href:o,target:"_blank"},on:{click:i=>{i.preventDefault();const r=`/${o}`;this.$Electron?this.$store.dispatch("openChildWindow",{name:`project-log-${s.id}`,path:r,force:!1,config:{title:this.$L(n),parent:null,width:Math.min(window.screen.availWidth,1440),height:Math.min(window.screen.availHeight,900)}}):this.$isEEUiApp?this.$store.dispatch("openAppChildPage",{pageType:"app",pageTitle:this.$L(n),url:"web.js",params:{allowAccess:!0,url:$A.rightDelete(window.location.href,window.location.hash)+`#${r}`}}):window.open($A.mainUrl(r.substring(1)))}}},this.$L(n)))}if(s.userid){let n=$A.isArray(s.userid)?s.userid:[s.userid],o=[];n.some(i=>{/^\d+$/.test(i)?o.push(t("UserAvatar",{props:{size:18,userid:i}})):o.push(t("span",i))}),o.length>0&&a.push(t("div",{class:"detail-user"},[t("div",{class:"detail-user-wrap"},o)]))}}return t("span",{class:"log-text"},a)},operationList({id:t,record:e}){let s=[];if(!$A.isJson(e))return s;if(this.taskId>0&&$A.isJson(e.flow)){let a=$A.getMiddle(e.flow.flow_item_name,"|");a&&s.push({id:t,button:this.$L("\u91CD\u7F6E"),content:this.$L(`\u786E\u5B9A\u91CD\u7F6E\u4E3A\u3010${a}\u3011\u5417\uFF1F`)})}return s},onOperation(t){$A.modalConfirm({content:t.content,loading:!0,onOk:()=>new Promise((e,s)=>{this.$store.dispatch("call",{url:"project/task/resetfromlog",data:{id:t.id}}).then(({data:a,msg:n})=>{e(n),this.$store.dispatch("saveTask",a),this.getLists(!0)}).catch(({msg:a})=>{s(a)})})})},openTask(t){this.$store.dispatch("openTask",t)},posSubTask(t){const e=this.$parent.$refs[`subTask_${t.id}`];if(e&&e[0]){const s=e[0].$el;if(s.classList.contains("common-shake"))return;$A.scrollIntoViewIfNeeded(s),requestAnimationFrame(a=>{s.classList.add("common-shake"),setTimeout(n=>{s.classList.remove("common-shake")},600)})}else{if(t.parent_id==this.taskId)return;this.$store.dispatch("openTask",t)}}}},c={};var y=u(L,$,k,!1,w,null,null,null);function w(t){for(let e in c)this[e]=c[e]}var j=function(){return y.exports}();export{j as P,P as T};