|
@@ -31,11 +31,11 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { queryAdjustment, removeAdjustment, saveAdjustment, getAdjustmentDetail, saveAdjustmentDetail } from '@/api/business/schedule'
|
|
|
|
|
|
|
+import { queryAdjustment, removeAdjustment, saveAdjustment, sendMessage, getAdjustmentDetail, saveAdjustmentDetail } from '@/api/business/schedule'
|
|
|
import { stateType } from '@/views/constants/schedule'
|
|
import { stateType } from '@/views/constants/schedule'
|
|
|
import ActionUtils from '@/utils/action'
|
|
import ActionUtils from '@/utils/action'
|
|
|
import FixHeight from '@/mixins/height'
|
|
import FixHeight from '@/mixins/height'
|
|
|
-import { status } from '@/api/platform/job/scheduler';
|
|
|
|
|
|
|
+import { status } from '@/api/platform/job/scheduler'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
components: {
|
|
components: {
|
|
@@ -75,7 +75,7 @@ export default {
|
|
|
itemWidth: 180,
|
|
itemWidth: 180,
|
|
|
forms: [
|
|
forms: [
|
|
|
{ prop: 'Q^reason_^SL', label: '调班原因' },
|
|
{ prop: 'Q^reason_^SL', label: '调班原因' },
|
|
|
- { prop: 'Q^status^S', label: '状态', fieldType: 'select', options: stateType.filter(item => item.value !== '已暂存') },
|
|
|
|
|
|
|
+ { prop: 'Q^status^S', label: '状态', fieldType: 'select', options: stateType.filter(item => item.value !== '已暂存' && item.value !== '已取消') },
|
|
|
{ prop: ['Q^create_time_^DL', 'Q^create_time_^DG'], label: '申请时间', fieldType: 'daterange', itemWidth: 200 }
|
|
{ prop: ['Q^create_time_^DL', 'Q^create_time_^DG'], label: '申请时间', fieldType: 'daterange', itemWidth: 200 }
|
|
|
]
|
|
]
|
|
|
},
|
|
},
|
|
@@ -138,8 +138,43 @@ export default {
|
|
|
* 获取格式化参数
|
|
* 获取格式化参数
|
|
|
*/
|
|
*/
|
|
|
getSearchFormData () {
|
|
getSearchFormData () {
|
|
|
- let paramjson = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
|
|
|
|
|
- paramjson['Q^status^NE'] = '已暂存'
|
|
|
|
|
|
|
+ const parameters = [{
|
|
|
|
|
+ relation: 'AND',
|
|
|
|
|
+ parameters: [
|
|
|
|
|
+ {
|
|
|
|
|
+ 'key': 'Q^status^NE',
|
|
|
|
|
+ 'value': '已取消',
|
|
|
|
|
+ 'param': 'status'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ 'key': 'Q^status^NE',
|
|
|
|
|
+ 'value': '已暂存',
|
|
|
|
|
+ 'param': 'status1'
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }]
|
|
|
|
|
+ // 加入搜索栏参数
|
|
|
|
|
+ const searchParam = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
|
|
|
|
|
+ if (Object.keys(searchParam).length) { // 查询条件不为空,则加入parameters
|
|
|
|
|
+ const statusArr = Object.keys(searchParam).filter(key => key.includes('status'))
|
|
|
|
|
+ const notstatusArr = Object.keys(searchParam).filter(key => key.includes('status') === false)
|
|
|
|
|
+ if (statusArr.length > 0) { // 加入状态查询
|
|
|
|
|
+ parameters[0].parameters.push({
|
|
|
|
|
+ 'key': statusArr[0],
|
|
|
|
|
+ 'value': searchParam[statusArr[0]],
|
|
|
|
|
+ 'param': 'status2'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ if (notstatusArr.length > 0) { // 加入其他查询
|
|
|
|
|
+ notstatusArr.forEach((el) => {
|
|
|
|
|
+ parameters[0].parameters.push({
|
|
|
|
|
+ 'key': el,
|
|
|
|
|
+ 'value': searchParam[el]
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (this.isRoleFilter()) { // 超级管理员和高权限角色不做审批人过滤
|
|
if (this.isRoleFilter()) { // 超级管理员和高权限角色不做审批人过滤
|
|
|
} else {
|
|
} else {
|
|
|
/* 审批人过滤
|
|
/* 审批人过滤
|
|
@@ -149,12 +184,11 @@ export default {
|
|
|
}
|
|
}
|
|
|
*/
|
|
*/
|
|
|
}
|
|
}
|
|
|
- return ActionUtils.formatParams(
|
|
|
|
|
- // this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {},
|
|
|
|
|
- paramjson,
|
|
|
|
|
- this.pagination,
|
|
|
|
|
- this.sorts
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ const param = {
|
|
|
|
|
+ parameters: parameters,
|
|
|
|
|
+ ...ActionUtils.formatParams(null, this.pagination, this.sorts)
|
|
|
|
|
+ }
|
|
|
|
|
+ return param
|
|
|
},
|
|
},
|
|
|
/**
|
|
/**
|
|
|
* 处理分页事件
|
|
* 处理分页事件
|
|
@@ -228,14 +262,72 @@ export default {
|
|
|
this.readonly = key === 'detail'
|
|
this.readonly = key === 'detail'
|
|
|
this.showAdjustEdit = true
|
|
this.showAdjustEdit = true
|
|
|
},
|
|
},
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 状态变更发送系统消息
|
|
|
|
|
+ */
|
|
|
|
|
+ sendMsg (data) {
|
|
|
|
|
+ switch (data.status) {
|
|
|
|
|
+ case '待审批':
|
|
|
|
|
+ sendMessage(data, data.executor || '')
|
|
|
|
|
+ break
|
|
|
|
|
+ case '已拒绝':
|
|
|
|
|
+ { // 已拒绝时视情况发送给审核人申请人(审核时拒绝消息对象需排除自己)
|
|
|
|
|
+ const parties = data.adjustmentDetailPoList.map(obj => obj.party)
|
|
|
|
|
+ if (parties.length > 0) { // 发给审核人
|
|
|
|
|
+ const { userId = '' } = this.$store.getters
|
|
|
|
|
+ const filteredParties = parties.filter(party => party !== userId)
|
|
|
|
|
+ filteredParties.forEach((el) => {
|
|
|
|
|
+ sendMessage(data, el)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ sendMessage(data, data.createBy) // 发给申请人
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ case '已通过':
|
|
|
|
|
+ { // 已通过时发送给申请人审核人
|
|
|
|
|
+ const parties = data.adjustmentDetailPoList.map(obj => obj.party)
|
|
|
|
|
+ if (parties.length > 0) { // 发给审核人
|
|
|
|
|
+ parties.forEach((el) => {
|
|
|
|
|
+ sendMessage(data, el)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ sendMessage(data, data.createBy) // 发给申请人
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ default:
|
|
|
|
|
+ // 如果data.status的值不在上述列举的情况中,可以在这里添加默认处理逻辑
|
|
|
|
|
+ break
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 判断是否由审核进入审批状态
|
|
|
|
|
+ */
|
|
|
|
|
+ isNextStep (data) {
|
|
|
|
|
+ if (data.status === '待审核') {
|
|
|
|
|
+ if (data.adjustmentDetailPoList.length > 0) { // 审核人数是否>0
|
|
|
|
|
+ data.adjustmentDetailPoList.forEach((el) => {
|
|
|
|
|
+ if (el.party) { // 判断多个审核人状态
|
|
|
|
|
+ return '审核中'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return '待审批'
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return '待审批'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // '待审批' 状态则直接通过
|
|
|
|
|
+ return '已通过'
|
|
|
|
|
+ },
|
|
|
/**
|
|
/**
|
|
|
* 处理单条同意/不同意
|
|
* 处理单条同意/不同意
|
|
|
*/
|
|
*/
|
|
|
async handleAgree (key, data) {
|
|
async handleAgree (key, data) {
|
|
|
// console.log(data)
|
|
// console.log(data)
|
|
|
- data.status = (key === 'agree' ? (data.status === '待审核' ? '待审批' : '已通过') : '已拒绝')
|
|
|
|
|
|
|
+ data.status = (key === 'agree' ? this.isNextStep(data) : '已拒绝')
|
|
|
saveAdjustment(data).then(() => {
|
|
saveAdjustment(data).then(() => {
|
|
|
ActionUtils.successMessage()
|
|
ActionUtils.successMessage()
|
|
|
|
|
+ this.sendMsg(data) // 发送系统通知
|
|
|
this.search()
|
|
this.search()
|
|
|
}).catch((e) => { console.error(e) })
|
|
}).catch((e) => { console.error(e) })
|
|
|
},
|
|
},
|
|
@@ -256,7 +348,7 @@ export default {
|
|
|
id_: el.id
|
|
id_: el.id
|
|
|
},
|
|
},
|
|
|
param: {
|
|
param: {
|
|
|
- status: key === 'massAgree' ? (el.status === '待审核' ? '待审批' : '已通过') : '已拒绝'
|
|
|
|
|
|
|
+ status: key === 'massAgree' ? this.isNextStep(el) : '已拒绝'
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
@@ -266,6 +358,9 @@ export default {
|
|
|
}
|
|
}
|
|
|
this.$common.request('update', updateParams).then(() => {
|
|
this.$common.request('update', updateParams).then(() => {
|
|
|
ActionUtils.successMessage()
|
|
ActionUtils.successMessage()
|
|
|
|
|
+ data.forEach((el) => { // 给每个申请单发通知
|
|
|
|
|
+ this.sendMsg(el)
|
|
|
|
|
+ })
|
|
|
this.search()
|
|
this.search()
|
|
|
}).catch((e) => { console.error(e) })
|
|
}).catch((e) => { console.error(e) })
|
|
|
},
|
|
},
|