mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-14 21:02:49 +00:00
feat:审批优化
This commit is contained in:
parent
769e2b0223
commit
5b09a111cd
@ -34,7 +34,7 @@
|
||||
<Badge class="tabbar-badge" :overflow-count="999" :count="reportUnreadNumber + approveUnreadNumber"/>
|
||||
</template>
|
||||
<template v-else-if="item.name === 'more'">
|
||||
<Badge class="tabbar-badge" :overflow-count="999" :count="reportUnreadNumber"/>
|
||||
<Badge class="tabbar-badge" :overflow-count="999" :count="reportUnreadNumber + approveUnreadNumber"/>
|
||||
</template>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@ -289,9 +289,12 @@ export default {
|
||||
} else if (timeDiff < 3600 * 24) {
|
||||
const hours = Math.floor(timeDiff / 3600);
|
||||
return type == 2 ? `${hours}${this.$L('小时')}` : `${hours} ${this.$L('小时前')}`;
|
||||
} else {
|
||||
} else if (timeDiff < 3600 * 24 * 30) {
|
||||
const days = Math.floor(timeDiff / 3600 / 24);
|
||||
return type == 2 ? `${days + 1}${this.$L('天')}` : `${days + 1} ${this.$L('天前')}`;
|
||||
} else {
|
||||
const days = Math.floor(timeDiff / 3600 / 720);
|
||||
return type == 2 ? `${days + 1}${this.$L('月')}` : `${days + 1} ${this.$L('月前')}`;
|
||||
}
|
||||
},
|
||||
// 时间转为周几
|
||||
@ -334,10 +337,8 @@ export default {
|
||||
}
|
||||
return item;
|
||||
})
|
||||
this.$nextTick(() => {
|
||||
this.datas = data
|
||||
isScrollToBottom && this.scrollToBottom();
|
||||
})
|
||||
this.datas = data
|
||||
isScrollToBottom && this.scrollToBottom();
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
}).finally(_ => {
|
||||
@ -431,14 +432,7 @@ export default {
|
||||
}
|
||||
}).then(({msg}) => {
|
||||
$A.messageSuccess("添加成功");
|
||||
if (this.$route.name == 'manage-approve-details' || this.$route.name == 'manage-messenger') {
|
||||
this.getInfo(true)
|
||||
} else {
|
||||
this.$emit('approve')
|
||||
setTimeout(() => {
|
||||
this.scrollToBottom()
|
||||
}, 500);
|
||||
}
|
||||
this.getInfo(true)
|
||||
this.commentShow = false;
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
@ -448,11 +442,13 @@ export default {
|
||||
},
|
||||
// 滚动到容器底部
|
||||
scrollToBottom() {
|
||||
const container = this.$refs.approveDetailsBox
|
||||
container.scrollTo({
|
||||
top: container.scrollHeight + 1000,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
this.$nextTick(() => {
|
||||
const container = this.$refs.approveDetailsBox
|
||||
container.scrollTo({
|
||||
top: container.scrollHeight + 1000,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
})
|
||||
},
|
||||
// 获取内容
|
||||
getContent(content) {
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<h1>{{$L('审批中心')}}</h1>
|
||||
</div>
|
||||
|
||||
<Button v-show="showType == 1 && userIsAdmin && isShowIcon" @click="addApply" :loading="addLoadIng" type="primary" shape="circle" icon="md-add" class="ivu-btn-icon-only"></Button>
|
||||
<Button v-show="showType == 1 && isShowIcon" @click="addApply" :loading="addLoadIng" type="primary" shape="circle" icon="md-add" class="ivu-btn-icon-only"></Button>
|
||||
<Button v-if="showType == 1 && !isShowIcon" :loading="addLoadIng" type="primary" @click="addApply">
|
||||
<span> {{$L("添加申请")}} </span>
|
||||
</Button>
|
||||
@ -269,8 +269,6 @@ export default {
|
||||
approvalType: "all",
|
||||
approvalList: [
|
||||
{ value: "all", label: this.$L("全部审批") },
|
||||
{ value: "请假", label: this.$L("请假") },
|
||||
{ value: "加班申请", label: this.$L("加班申请") },
|
||||
],
|
||||
searchState: "all",
|
||||
searchStateList: [
|
||||
@ -349,16 +347,22 @@ export default {
|
||||
watch: {
|
||||
'$route' (to) {
|
||||
if(to.name == 'manage-approve'){
|
||||
this.tabsClick()
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
wsMsg: {
|
||||
handler(info) {
|
||||
const {type, action} = info;
|
||||
const {type, action, mode, data} = info;
|
||||
switch (type) {
|
||||
case 'approve':
|
||||
if (action == 'unread') {
|
||||
this.tabsClick()
|
||||
this.tabsClick();
|
||||
}
|
||||
break;
|
||||
case 'dialog':
|
||||
if (mode == 'add' && data?.msg?.text?.indexOf('open-approve-details') != -1) {
|
||||
console.log(22);
|
||||
this.tabsClick();
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -372,7 +376,7 @@ export default {
|
||||
},
|
||||
showType(val){
|
||||
if(val == 1){
|
||||
this.tabsClick()
|
||||
this.init()
|
||||
}
|
||||
},
|
||||
windowWidth(val){
|
||||
@ -381,13 +385,41 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.tabsValue = "unread"
|
||||
this.tabsClick()
|
||||
this.getUnreadList()
|
||||
this.addData.department_id = this.userInfo.department[0] || 0;
|
||||
this.addData.startTime = this.addData.endTime = this.getCurrentDate();
|
||||
this.isShowIcon = this.windowWidth < 515
|
||||
this.init()
|
||||
},
|
||||
methods:{
|
||||
|
||||
init() {
|
||||
this.tabsClick()
|
||||
this.getProcdefList()
|
||||
if(this.tabsValue != 'unread'){
|
||||
this.getUnreadList();
|
||||
}
|
||||
this.addData.department_id = this.userInfo.department[0] || 0;
|
||||
this.addData.startTime = this.addData.endTime = this.getCurrentDate();
|
||||
this.isShowIcon = this.windowWidth < 515
|
||||
},
|
||||
|
||||
// 获取流程列表
|
||||
getProcdefList() {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.$store.dispatch("call", {
|
||||
url: 'approve/procdef/all',
|
||||
method: 'post',
|
||||
}).then(({data}) => {
|
||||
this.procdefList = data.rows || [];
|
||||
this.approvalList = this.procdefList.map(h=>{
|
||||
return { value: h.name, label: h.name }
|
||||
})
|
||||
this.approvalList.unshift({ value: "all", label: this.$L("全部审批") })
|
||||
resolve()
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
reject()
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// 获取当前时间
|
||||
getCurrentDate() {
|
||||
const today = new Date();
|
||||
@ -410,6 +442,9 @@ export default {
|
||||
if(val){
|
||||
this.approvalType = this.searchState = "all"
|
||||
}
|
||||
//
|
||||
this.detailsShow = false;
|
||||
//
|
||||
if(this.tabsValue == 'unread'){
|
||||
if(val === false){
|
||||
this.unreadPage = 1;
|
||||
@ -438,6 +473,7 @@ export default {
|
||||
}
|
||||
this.getInitiatedList();
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
// 列表点击事件
|
||||
@ -663,16 +699,11 @@ export default {
|
||||
skipAuthError: true
|
||||
}).then(({data}) => {
|
||||
this.addData.department_id = data[0]?.department[0] || 0;
|
||||
this.$store.dispatch("call", {
|
||||
url: 'approve/procdef/all',
|
||||
method: 'post',
|
||||
}).then(({data}) => {
|
||||
this.procdefList = data.rows || [];
|
||||
this.getProcdefList().then(_ => {
|
||||
this.addTitle = this.$L("添加申请");
|
||||
this.addShow = true;
|
||||
}).catch(({msg}) => {
|
||||
$A.modalError(msg);
|
||||
}).finally(_ => {
|
||||
this.addLoadIng = false;
|
||||
}).catch(_ => {
|
||||
this.addLoadIng = false;
|
||||
});
|
||||
}).catch(({msg}) => {
|
||||
@ -710,6 +741,7 @@ export default {
|
||||
this.addShow = false;
|
||||
this.$refs.initiateRef.resetFields();
|
||||
this.tabsValue = 'initiated';
|
||||
this.initiatedList.map(h=>{ h._active = false; })
|
||||
this.$nextTick(()=>{
|
||||
this.tabsClick();
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user