From 5b09a111cd1d2299f475826d064aed3876b460a7 Mon Sep 17 00:00:00 2001
From: weifashi <605403358@qq.com>
Date: Thu, 24 Aug 2023 15:43:13 +0800
Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=AE=A1=E6=89=B9=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../assets/js/components/Mobile/Tabbar.vue | 2 +-
.../js/pages/manage/approve/details.vue | 32 ++++-----
.../assets/js/pages/manage/approve/index.vue | 72 +++++++++++++------
3 files changed, 67 insertions(+), 39 deletions(-)
diff --git a/resources/assets/js/components/Mobile/Tabbar.vue b/resources/assets/js/components/Mobile/Tabbar.vue
index c6704d82e..e99af93c1 100644
--- a/resources/assets/js/components/Mobile/Tabbar.vue
+++ b/resources/assets/js/components/Mobile/Tabbar.vue
@@ -34,7 +34,7 @@
-
+
diff --git a/resources/assets/js/pages/manage/approve/details.vue b/resources/assets/js/pages/manage/approve/details.vue
index 75dc0e3d9..ac04c630f 100644
--- a/resources/assets/js/pages/manage/approve/details.vue
+++ b/resources/assets/js/pages/manage/approve/details.vue
@@ -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) {
diff --git a/resources/assets/js/pages/manage/approve/index.vue b/resources/assets/js/pages/manage/approve/index.vue
index 8d1c3352f..fcbaa13b0 100644
--- a/resources/assets/js/pages/manage/approve/index.vue
+++ b/resources/assets/js/pages/manage/approve/index.vue
@@ -8,7 +8,7 @@
{{$L('审批中心')}}
-
+
@@ -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();
})