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