@@ -383,6 +393,9 @@ export default {
this.isShowIcon = val < 515
}
},
+ activated() {
+ this.showType = 1
+ },
mounted() {
this.tabsValue = "unread"
this.init()
@@ -536,29 +549,8 @@ export default {
username: this.approvalName,
}
}).then(({data}) => {
- let activeId = 0;
- let activeIndex = 0;
- this.unreadTotal = data.total;
- if( this.unreadList.length == 0 || this.unreadList.length == data.rows.length){
- this.unreadList?.map((res)=>{ if(res._active) activeId = res.id })
- }
- let lists = data.rows.map((h,index)=>{
- h._active = activeId > 0 ? h.id == activeId : index == 0;
- if(h._active) activeIndex = index
- if(type == 'scroll' && this.unreadList.map(item=>{return item.id}).indexOf(h.id) == -1 ){
- this.unreadList.push(h)
- }
- return h;
- })
- if(type != 'scroll'){
- this.unreadList = lists;
- }
- if(this.tabsValue == 'unread'){
- this.$nextTick(()=>{
- this.details = this.unreadList[activeIndex] || {}
- })
- }
- }).catch(({msg}) => {
+ this.updateData('unread',data,type)
+ }).catch((msg) => {
$A.modalError(msg);
}).finally(_ => {
this.loadIng = false;
@@ -578,28 +570,7 @@ export default {
username: this.approvalName,
}
}).then(({data}) => {
- let activeId = 0;
- let activeIndex = 0;
- this.doneTotal = data.total;
- if( this.doneList.length == 0 || this.doneList.length == data.total){
- this.doneList?.map((res)=>{ if(res._active) activeId = res.id })
- }
- let lists = data.rows.map((h,index)=>{
- h._active = activeId > 0 ? h.id == activeId : index == 0;
- if(h._active) activeIndex = index
- if(type == 'scroll' && this.doneList.map(item=>{return item.id}).indexOf(h.id) == -1 ){
- this.doneList.push(h)
- }
- return h;
- })
- if(type != 'scroll'){
- this.doneList = lists;
- }
- if(this.tabsValue == 'done'){
- this.$nextTick(()=>{
- this.details = this.doneList[activeIndex] || {}
- })
- }
+ this.updateData('done',data,type)
}).catch(({msg}) => {
$A.modalError(msg);
}).finally(_ => {
@@ -620,28 +591,7 @@ export default {
username: this.approvalName,
}
}).then(({data}) => {
- let activeId = 0;
- let activeIndex = 0;
- this.notifyTotal = data.total;
- if( this.notifyList.length == 0 || this.notifyList.length == data.rows.length){
- this.notifyList?.map((res)=>{ if(res._active) activeId = res.id })
- }
- let lists = data.rows.map((h,index)=>{
- h._active = activeId > 0 ? h.id == activeId : index == 0;
- if(h._active) activeIndex = index
- if(type == 'scroll' && this.notifyList.map(item=>{return item.id}).indexOf(h.id) == -1 ){
- this.notifyList.push(h)
- }
- return h;
- })
- if(type != 'scroll'){
- this.notifyList = lists;
- }
- if(this.tabsValue == 'notify'){
- this.$nextTick(()=>{
- this.details = this.notifyList[activeIndex] || {}
- })
- }
+ this.updateData('notify',data,type)
}).catch(({msg}) => {
$A.modalError(msg);
}).finally(_ => {
@@ -663,28 +613,7 @@ export default {
username: this.approvalName,
}
}).then(({data}) => {
- let activeId = 0;
- let activeIndex = 0;
- this.initiatedTotal = data.total;
- if( this.initiatedList.length == 0 || this.initiatedList.length == data.rows.length){
- this.initiatedList?.map((res)=>{ if(res._active) activeId = res.id })
- }
- let lists = data.rows.map((h,index)=>{
- h._active = activeId > 0 ? h.id == activeId : index == 0;
- if(h._active) activeIndex = index
- if(type == 'scroll' && this.initiatedList.map(item=>{return item.id}).indexOf(h.id) == -1 ){
- this.initiatedList.push(h)
- }
- return h;
- })
- if(type != 'scroll'){
- this.initiatedList = lists;
- }
- if(this.tabsValue == 'initiated'){
- this.$nextTick(()=>{
- this.details = this.initiatedList[activeIndex] || {}
- })
- }
+ this.updateData('initiated',data,type)
}).catch(({msg}) => {
$A.modalError(msg);
}).finally(_ => {
@@ -717,6 +646,26 @@ export default {
});
},
+ // 更新数据
+ updateData(key,data,type) {
+ let listKey = key + 'List'
+ let activeIndex = this[listKey].map((h, index) => h._active ? index : -1).filter(h => h > -1)[0] || 0
+ this[key + 'Total'] = data.total;
+ type != 'scroll' ? (this[listKey] = data.rows) : data.rows.map(h => {
+ if (this[listKey].map(item => { return item.id }).indexOf(h.id) == -1) {
+ this[listKey].push(h)
+ }
+ });
+ if(this[listKey].length > 0){
+ this[listKey][activeIndex]._active = true;
+ if (this.tabsValue == key) {
+ this.$nextTick(() => {
+ this.details = this[listKey][activeIndex] || {}
+ })
+ }
+ }
+ },
+
// 提交发起
onInitiate(){
this.$refs.initiateRef.validate((valid) => {
diff --git a/resources/assets/sass/pages/page-approve.scss b/resources/assets/sass/pages/page-approve.scss
index c6aae5bb9..31bbab87e 100644
--- a/resources/assets/sass/pages/page-approve.scss
+++ b/resources/assets/sass/pages/page-approve.scss
@@ -66,6 +66,11 @@
}
}
+ .approve-load {
+ text-align: center;
+ padding-top: 20px;
+ }
+
.noData {
text-align: center;
line-height: 150px;
@@ -278,13 +283,18 @@
.approve-process-state {
font-size: 12px;
color: #19be6b;
+ height: 21px;
}
.approve-process-left {
margin-left: 10px;
flex: 1;
+ width: 0;
.approve-process-desc{
font-size: 12px;
+ max-width: 100%;
+ overflow: auto;
+ word-break:break-all;
}
}
@@ -386,13 +396,15 @@
.approve-load {
position: absolute;
- top: 0;
- left: 24px;
- right: 0;
- bottom: 0;
+ top: 1px;
+ left: 1px;
+ right: 1px;
+ bottom: 1px;
display: flex;
z-index: 9;
- background: #ffffff;
+ // background: #ffffff;
+ background: #00000005;
+
}
.comment {
@@ -492,8 +504,5 @@ body.window-portrait {
.approve-head {
margin: 24px 16px 6px 16px;
}
- .approve-mains {
- height: calc(100vh - 250px);
- }
}
}
\ No newline at end of file