Merge commit 'cbbd50a2e320ca0427474fb2921f2b93a5ad2c14' into pro

This commit is contained in:
kuaifan 2024-03-19 03:15:46 +09:00
commit 93578f93f4

View File

@ -7,28 +7,28 @@
<div class="common-nav-back" @click="goBack()"><i class="taskfont">&#xe676;</i></div> <div class="common-nav-back" @click="goBack()"><i class="taskfont">&#xe676;</i></div>
<h1>{{$L('审批中心')}}</h1> <h1>{{$L('审批中心')}}</h1>
</div> </div>
<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-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>
<Button v-show="showType == 1 && userIsAdmin && !isShowIcon" @click="exportApproveShow = true"> <Button v-show="showType == 1 && userIsAdmin && !isShowIcon" @click="exportApproveShow = true">
<span> {{$L("导出审批数据")}} </span> <span> {{$L("导出审批数据")}} </span>
</Button> </Button>
<Button v-if="showType == 1 && userIsAdmin && isShowIcon" @click="exportApproveShow = true" shape="circle" class="ivu-btn-icon-only"> <Button v-if="showType == 1 && userIsAdmin && isShowIcon" @click="exportApproveShow = true" shape="circle" class="ivu-btn-icon-only">
<i class="taskfont">&#xe7a8;</i> <i class="taskfont">&#xe7a8;</i>
</Button> </Button>
<Button v-if="userIsAdmin && !isShowIcon" @click="showType = showType == 1 ? 2 : 1"> <Button v-if="userIsAdmin && !isShowIcon" @click="showType = showType == 1 ? 2 : 1">
<span> {{ showType == 1 ? $L("流程设置") : $L("返回") }} </span> <span> {{ showType == 1 ? $L("流程设置") : $L("返回") }} </span>
</Button> </Button>
<Button v-if="userIsAdmin && isShowIcon" @click="showType = showType == 1 ? 2 : 1" shape="circle" class="ivu-btn-icon-only"> <Button v-if="userIsAdmin && isShowIcon" @click="showType = showType == 1 ? 2 : 1" shape="circle" class="ivu-btn-icon-only">
<i v-if="showType == 1" class="taskfont">&#xe67b;</i> <i v-if="showType == 1" class="taskfont">&#xe67b;</i>
<i v-if="showType == 2" class="taskfont">&#xe637;</i> <i v-if="showType == 2" class="taskfont">&#xe637;</i>
</Button> </Button>
</div> </div>
<Tabs class="page-approve-tabs" v-show="showType==1" :value="tabsValue" @on-click="tabsClick" size="small"> <Tabs class="page-approve-tabs" v-show="showType==1" :value="tabsValue" @on-click="tabsClick" size="small">
<TabPane :label="$L('待办') + (unreadTotal > 0 ? ('('+unreadTotal+')') : '')" name="unread" style="height: 100%;"> <TabPane :label="$L('待办') + (unreadTotal > 0 ? ('('+unreadTotal+')') : '')" name="unread" style="height: 100%;">
<div class="approve-main-search"> <div class="approve-main-search">
@ -253,13 +253,13 @@ import ApproveExport from "../components/ApproveExport";
import {mapState} from 'vuex' import {mapState} from 'vuex'
export default { export default {
components:{list,listDetails,DrawerOverlay,ImgUpload,ApproveSetting,ApproveExport}, components: {list, listDetails, DrawerOverlay, ImgUpload, ApproveSetting, ApproveExport},
name: "approve", name: "approve",
data() { data() {
return { return {
showType: 1, showType: 1,
exportApproveShow: false, exportApproveShow: false,
isShowIcon: false, isShowIcon: false,
modalTransferIndex: window.modalTransferIndex, modalTransferIndex: window.modalTransferIndex,
minDate: new Date(2020, 0, 1), minDate: new Date(2020, 0, 1),
@ -279,15 +279,15 @@ export default {
approvalType: "all", approvalType: "all",
approvalName: "", approvalName: "",
approvalList: [ approvalList: [
{ value: "all", label: this.$L("全部审批") }, {value: "all", label: this.$L("全部审批")},
], ],
searchState: "all", searchState: "all",
searchStateList: [ searchStateList: [
{ value: "all", label: this.$L("全部状态") }, {value: "all", label: this.$L("全部状态")},
{ value: 1, label: this.$L("审批中") }, {value: 1, label: this.$L("审批中")},
{ value: 2, label: this.$L("已通过") }, {value: 2, label: this.$L("已通过")},
{ value: 3, label: this.$L("已拒绝") }, {value: 3, label: this.$L("已拒绝")},
{ value: 4, label: this.$L("已撤回") } {value: 4, label: this.$L("已撤回")}
], ],
// //
unreadList: [], unreadList: [],
@ -330,12 +330,12 @@ export default {
other: "" other: ""
}, },
addRule: { addRule: {
department_id: { type: 'number', required: true, message: this.$L('请选择部门!'), trigger: 'change' }, department_id: {type: 'number', required: true, message: this.$L('请选择部门!'), trigger: 'change'},
applyType: { type: 'string', required: true, message: this.$L('请选择申请类型!'), trigger: 'change' }, applyType: {type: 'string', required: true, message: this.$L('请选择申请类型!'), trigger: 'change'},
type: { type: 'string', required: true, message: this.$L('请选择假期类型!'), trigger: 'change' }, type: {type: 'string', required: true, message: this.$L('请选择假期类型!'), trigger: 'change'},
startTime: { type: 'string', required: true, message: this.$L('请选择开始时间!'), trigger: 'change' }, startTime: {type: 'string', required: true, message: this.$L('请选择开始时间!'), trigger: 'change'},
endTime: { type: 'string', required: true, message: this.$L('请选择结束时间!'), trigger: 'change' }, endTime: {type: 'string', required: true, message: this.$L('请选择结束时间!'), trigger: 'change'},
description: { type: 'string', required: true, message: this.$L('请输入事由!'), trigger: 'change' }, description: {type: 'string', required: true, message: this.$L('请输入事由!'), trigger: 'change'},
}, },
selectTypes: ["年假", "事假", "病假", "调休", "产假", "陪产假", "婚假", "丧假", "哺乳假"], selectTypes: ["年假", "事假", "病假", "调休", "产假", "陪产假", "婚假", "丧假", "哺乳假"],
@ -344,20 +344,20 @@ export default {
} }
}, },
computed: { computed: {
...mapState([ 'wsMsg','userInfo','userIsAdmin','windowWidth' ]), ...mapState(['wsMsg', 'userInfo', 'userIsAdmin', 'windowWidth']),
departmentList(){ departmentList() {
let departmentNames = (this.userInfo.department_name || '').split(','); let departmentNames = (this.userInfo.department_name || '').split(',');
return (this.userInfo.department || []).map((h,index)=>{ return (this.userInfo.department || []).map((h, index) => {
return { return {
id:h, id: h,
name:departmentNames[index] name: departmentNames[index]
}; };
}) })
} }
}, },
watch: { watch: {
'$route' (to) { '$route'(to) {
if(to.name == 'manage-approve'){ if (to.name == 'manage-approve') {
this.init() this.init()
} }
}, },
@ -379,17 +379,17 @@ export default {
}, },
deep: true, deep: true,
}, },
addShow(val){ addShow(val) {
if(!val){ if (!val) {
this.addData.other = "" this.addData.other = ""
} }
}, },
showType(val){ showType(val) {
if(val == 1){ if (val == 1) {
this.init() this.init()
} }
}, },
windowWidth(val){ windowWidth(val) {
this.isShowIcon = val < 515 this.isShowIcon = val < 515
} }
}, },
@ -400,12 +400,11 @@ export default {
this.tabsValue = "unread" this.tabsValue = "unread"
this.init() this.init()
}, },
methods:{ methods: {
init() { init() {
this.tabsClick() this.tabsClick()
this.getProcdefList() this.getProcdefList()
if(this.tabsValue != 'unread'){ if (this.tabsValue != 'unread') {
this.getUnreadList(); this.getUnreadList();
} }
this.addData.department_id = this.userInfo.department[0] || 0; this.addData.department_id = this.userInfo.department[0] || 0;
@ -421,10 +420,10 @@ export default {
method: 'post', method: 'post',
}).then(({data}) => { }).then(({data}) => {
this.procdefList = data.rows || []; this.procdefList = data.rows || [];
this.approvalList = this.procdefList.map(h=>{ this.approvalList = this.procdefList.map(h => {
return { value: h.name, label: h.name } return {value: h.name, label: h.name}
}) })
this.approvalList.unshift({ value: "all", label: this.$L("全部审批") }) this.approvalList.unshift({value: "all", label: this.$L("全部审批")})
resolve() resolve()
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
@ -432,7 +431,7 @@ export default {
}); });
}); });
}, },
// //
getCurrentDate() { getCurrentDate() {
const today = new Date(); const today = new Date();
@ -443,62 +442,69 @@ export default {
}, },
// tab // tab
tabsClick(val,time= 1000){ tabsClick(val, time = 1000) {
if(!val && this.__tabsClick && time>0){ if (!val && this.__tabsClick && time > 0) {
return; return;
} }
this.__tabsClick = setTimeout(() => { this.__tabsClick =null; },time) this.__tabsClick = setTimeout(() => {
if(time == 0){ this.__tabsClick = null;
this.loadIng = true; }, time)
}
this.tabsValue = val || this.tabsValue this.tabsValue = val || this.tabsValue
if(val){ if (val) {
this.approvalType = this.searchState = "all" this.approvalType = this.searchState = "all"
this.approvalName = "" this.approvalName = ""
} }
// //
this.detailsShow = false; this.detailsShow = false;
this.loadIng = true;
// //
if(this.tabsValue == 'unread'){ if (this.tabsValue == 'unread') {
if(val === false){ if (val === false) {
this.unreadPage = 1; this.unreadPage = 1;
this.unreadList = []; this.unreadList = [];
} }
this.getUnreadList(); this.getUnreadList();
} }
if(this.tabsValue == 'done'){ if (this.tabsValue == 'done') {
if(val === false){ if (val === false) {
this.donePage = 1; this.donePage = 1;
this.doneList = []; this.doneList = [];
} }
this.getDoneList(); this.getDoneList();
} }
if(this.tabsValue == 'notify'){ if (this.tabsValue == 'notify') {
if(val === false){ if (val === false) {
this.notifyPage = 1; this.notifyPage = 1;
this.notifyList = []; this.notifyList = [];
} }
this.getNotifyList(); this.getNotifyList();
} }
if(this.tabsValue == 'initiated'){ if (this.tabsValue == 'initiated') {
if(val === false){ if (val === false) {
this.initiatedPage = 1; this.initiatedPage = 1;
this.initiatedList = []; this.initiatedList = [];
} }
this.getInitiatedList(); this.getInitiatedList();
} }
}, },
// //
clickList(item){ clickList(item) {
this.unreadList.map(h => { h._active = false; }) this.unreadList.map(h => {
this.doneList.map(h => { h._active = false; }) h._active = false;
this.notifyList.map(h => { h._active = false; }) })
this.initiatedList.map(h => { h._active = false; }) this.doneList.map(h => {
h._active = false;
})
this.notifyList.map(h => {
h._active = false;
})
this.initiatedList.map(h => {
h._active = false;
})
// //
if (window.innerWidth < 426) { if (window.innerWidth < 426) {
this.goForward({ name: 'manage-approve-details', query: { id: item.id } }); this.goForward({name: 'manage-approve-details', query: {id: item.id}});
return; return;
} }
if (window.innerWidth < 1010) { if (window.innerWidth < 1010) {
@ -513,24 +519,24 @@ export default {
}, },
// //
handleScroll(e){ handleScroll(e) {
if (e.target.scrollTop + e.target.clientHeight >= e.target.scrollHeight) { if (e.target.scrollTop + e.target.clientHeight >= e.target.scrollHeight) {
if(this.tabsValue == 'unread' && !this.unreadLoad && this.unreadList.length < this.unreadTotal){ if (this.tabsValue == 'unread' && !this.unreadLoad && this.unreadList.length < this.unreadTotal) {
this.unreadLoad = true; this.unreadLoad = true;
this.unreadPage = this.unreadPage + 1; this.unreadPage = this.unreadPage + 1;
this.getUnreadList('scroll'); this.getUnreadList('scroll');
} }
if(this.tabsValue == 'done' && !this.doneLoad && this.doneList.length < this.doneTotal){ if (this.tabsValue == 'done' && !this.doneLoad && this.doneList.length < this.doneTotal) {
this.doneLoad = true; this.doneLoad = true;
this.donePage = this.donePage + 1; this.donePage = this.donePage + 1;
this.getDoneList('scroll'); this.getDoneList('scroll');
} }
if(this.tabsValue == 'notify' && !this.notifyLoad && this.notifyList.length < this.notifyTotal){ if (this.tabsValue == 'notify' && !this.notifyLoad && this.notifyList.length < this.notifyTotal) {
this.notifyLoad = true; this.notifyLoad = true;
this.notifyPage = this.notifyPage + 1; this.notifyPage = this.notifyPage + 1;
this.getNotifyList('scroll'); this.getNotifyList('scroll');
} }
if(this.tabsValue == 'initiated' && !this.initiatedLoad && this.initiatedList.length < this.initiatedTotal){ if (this.tabsValue == 'initiated' && !this.initiatedLoad && this.initiatedList.length < this.initiatedTotal) {
this.initiatedLoad = true; this.initiatedLoad = true;
this.initiatedPage = this.initiatedPage + 1; this.initiatedPage = this.initiatedPage + 1;
this.getInitiatedList('scroll'); this.getInitiatedList('scroll');
@ -539,7 +545,7 @@ export default {
}, },
// //
getUnreadList(type='init'){ getUnreadList(type = 'init') {
this.$store.dispatch("call", { this.$store.dispatch("call", {
method: 'get', method: 'get',
url: 'approve/process/findTask', url: 'approve/process/findTask',
@ -550,7 +556,7 @@ export default {
username: this.approvalName, username: this.approvalName,
} }
}).then(({data}) => { }).then(({data}) => {
this.updateData('unread',data,type) this.updateData('unread', data, type)
}).catch((msg) => { }).catch((msg) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
@ -560,7 +566,7 @@ export default {
}, },
// //
getDoneList(type='init'){ getDoneList(type = 'init') {
this.$store.dispatch("call", { this.$store.dispatch("call", {
method: 'get', method: 'get',
url: 'approve/procHistory/findTask', url: 'approve/procHistory/findTask',
@ -571,7 +577,7 @@ export default {
username: this.approvalName, username: this.approvalName,
} }
}).then(({data}) => { }).then(({data}) => {
this.updateData('done',data,type) this.updateData('done', data, type)
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
@ -581,7 +587,7 @@ export default {
}, },
// //
getNotifyList(type){ getNotifyList(type) {
this.$store.dispatch("call", { this.$store.dispatch("call", {
method: 'get', method: 'get',
url: 'approve/procHistory/findProcNotify', url: 'approve/procHistory/findProcNotify',
@ -592,7 +598,7 @@ export default {
username: this.approvalName, username: this.approvalName,
} }
}).then(({data}) => { }).then(({data}) => {
this.updateData('notify',data,type) this.updateData('notify', data, type)
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
@ -602,7 +608,7 @@ export default {
}, },
// //
getInitiatedList(type){ getInitiatedList(type) {
this.$store.dispatch("call", { this.$store.dispatch("call", {
method: 'post', method: 'post',
url: 'approve/process/startByMyselfAll', url: 'approve/process/startByMyselfAll',
@ -614,7 +620,7 @@ export default {
username: this.approvalName, username: this.approvalName,
} }
}).then(({data}) => { }).then(({data}) => {
this.updateData('initiated',data,type) this.updateData('initiated', data, type)
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
}).finally(_ => { }).finally(_ => {
@ -624,12 +630,12 @@ export default {
}, },
// //
addApply(){ addApply() {
this.addLoadIng = true; this.addLoadIng = true;
this.$store.dispatch("call", { this.$store.dispatch("call", {
url: 'users/basic', url: 'users/basic',
data: { data: {
userid: [ this.userInfo.userid] userid: [this.userInfo.userid]
}, },
skipAuthError: true skipAuthError: true
}).then(({data}) => { }).then(({data}) => {
@ -648,17 +654,19 @@ export default {
}, },
// //
updateData(key,data,type) { updateData(key, data, type) {
let listKey = key + 'List' let listKey = key + 'List'
this[key + 'Total'] = data.total; this[key + 'Total'] = data.total;
type != 'scroll' ? (this[listKey] = data.rows) : data.rows.map(h => { type != 'scroll' ? (this[listKey] = data.rows) : data.rows.map(h => {
if (this[listKey].map(item => { return item.id }).indexOf(h.id) == -1) { if (this[listKey].map(item => {
return item.id
}).indexOf(h.id) == -1) {
this[listKey].push(h) this[listKey].push(h)
} }
}); });
if (window.innerWidth > 1010){ if (window.innerWidth > 1010) {
let activeIndex = this[listKey].map((h, index) => h._active ? index : -1).filter(h => h > -1)[0] || 0 let activeIndex = this[listKey].map((h, index) => h._active ? index : -1).filter(h => h > -1)[0] || 0
if (this[listKey].length > 0){ if (this[listKey].length > 0) {
this[listKey][activeIndex]._active = true; this[listKey][activeIndex]._active = true;
if (this.tabsValue == key) { if (this.tabsValue == key) {
this.$nextTick(() => { this.$nextTick(() => {
@ -670,17 +678,17 @@ export default {
}, },
// //
onInitiate(){ onInitiate() {
this.$refs.initiateRef.validate((valid) => { this.$refs.initiateRef.validate((valid) => {
if (valid) { if (valid) {
this.loadIng = true; this.loadIng = true;
var obj = JSON.parse(JSON.stringify(this.addData)) var obj = JSON.parse(JSON.stringify(this.addData))
obj.startTime = obj.startTime +" "+ obj.startTimeHour + ":" + obj.startTimeMinute; obj.startTime = obj.startTime + " " + obj.startTimeHour + ":" + obj.startTimeMinute;
obj.endTime = obj.endTime +" "+ obj.endTimeHour + ":" + obj.endTimeMinute; obj.endTime = obj.endTime + " " + obj.endTimeHour + ":" + obj.endTimeMinute;
if(this.addData.other){ if (this.addData.other) {
obj.other = this.addData.other.map((o) =>{ obj.other = this.addData.other.map((o) => {
return o.path return o.path
}).join(',') }).join(',')
} }
@ -698,9 +706,11 @@ 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.initiatedList.map(h => {
this.$nextTick(()=>{ h._active = false;
this.tabsClick(false,0); })
this.$nextTick(() => {
this.tabsClick(false, 0);
}) })
}).catch(({msg}) => { }).catch(({msg}) => {
$A.modalError(msg); $A.modalError(msg);
@ -715,22 +725,25 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.page-approve .approve-details{ .page-approve .approve-details {
border-radius: 8px; border-radius: 8px;
}
.page-approve .ivu-tabs-nav {
display: flex;
width: 350px;
@media (max-width: 1010px) {
width: 100%;
} }
.page-approve .ivu-tabs-nav {
display: flex; .ivu-tabs-tab {
width: 350px; font-size: 15px;
@media (max-width: 1010px) { flex: 1;
width: 100%; text-align: center;
}
.ivu-tabs-tab{
font-size: 15px;
flex:1;
text-align: center;
}
}
.page-approve-initiate .ivu-modal-body{
padding: 16px 22px 2px !important;
} }
}
.page-approve-initiate .ivu-modal-body {
padding: 16px 22px 2px !important;
}
</style> </style>