Commit 5c58dbb1 authored by 15008242619's avatar 15008242619 Committed by jingnan

领用出库新增紧急领用

parent 1e7a792f
...@@ -45,179 +45,179 @@ ...@@ -45,179 +45,179 @@
import { post } from '@/utils/http' import { post } from '@/utils/http'
export default { export default {
name: 'OutStorageUseApply', name: 'OutStorageUseApply',
components: {}, components: {},
props: { props: {
selectData: { selectData: {
type: Object, type: Object,
default: () => {} default: () => {}
} }
}, },
data() { data() {
return { return {
dialogVisible: false, dialogVisible: false,
setPersonVisible: false, setPersonVisible: false,
selectionRows: [], selectionRows: [],
form: {}, form: {},
formData: [{ formData: [{
split: 1, split: 1,
data: [ data: [
{
title: '设置审批领导',
key: 'userIds',
component: {
clearable: true,
name: 'el-select',
placeholder: '请选择',
multiple: true,
options: []
}
}]
}],
rules: {
userIds: [
{
required: true,
message: '请填写审批领导',
trigger: ['blur', 'change']
}
]
}
}
},
computed: {},
watch: {},
created() {
const httpParams = {
'pageFrom': 1,
'pageSize': 9999,
'searchItems': {
'children': [],
'items': [
{
'fieldName': 'source.name',
'operator': 'IN',
'value': ['项目部审批人员']
}
],
'operator': 'AND'
},
'openProps': [
{
'name': 'source',
'pageFrom': 1,
'pageSize': 9999
},
{ {
'name': 'target', title: '设置审批领导',
'pageFrom': 1, key: 'userIds',
'pageSize': 9999 component: {
} clearable: true,
], name: 'el-select',
'sortItem': [ placeholder: '请选择',
multiple: true,
options: []
}
}]
}],
rules: {
userIds: [
{ {
'fieldName': 'modifyTime', required: true,
'sortOrder': 'desc' message: '请填写审批领导',
trigger: ['blur', 'change']
} }
] ]
} }
post('/DxGroupMemberLink/search', httpParams).then(res => { }
const arr = [] },
const ids = [] computed: {},
res.items.content.forEach(item => { watch: {},
if (ids.indexOf(item.target.id) === -1) { created() {
ids.push(item.target.id) const httpParams = {
arr.push({ 'pageFrom': 1,
value: item.target.id, 'pageSize': 9999,
label: item.target.name + '/' + item.target.number 'searchItems': {
}) 'children': [],
} 'items': [
}) {
this.formData[0].data.forEach(item => { 'fieldName': 'source.name',
if (item.key === 'userIds') { 'operator': 'IN',
item.component.options = arr 'value': ['项目部审批人员']
} }
}) ],
}).catch((err) => { 'operator': 'AND'
console.log(err) },
'openProps': [
{
'name': 'source',
'pageFrom': 1,
'pageSize': 9999
},
{
'name': 'target',
'pageFrom': 1,
'pageSize': 9999
}
],
'sortItem': [
{
'fieldName': 'modifyTime',
'sortOrder': 'desc'
}
]
}
post('/DxGroupMemberLink/search', httpParams).then(res => {
const arr = []
const ids = []
res.items.content.forEach(item => {
if (ids.indexOf(item.target.id) === -1) {
ids.push(item.target.id)
arr.push({
value: item.target.id,
label: item.target.name + '/' + item.target.number
})
}
}) })
}, this.formData[0].data.forEach(item => {
mounted() { if (item.key === 'userIds') {
this.$bus.$on('cancelAndRefresh', (data) => { item.component.options = arr
this.$refs.applyTable && this.$refs.applyTable.$refs.asCom.getData() }
}) })
}).catch((err) => {
console.log(err)
})
},
mounted() {
this.$bus.$on('cancelAndRefresh', (data) => {
this.$refs.applyTable && this.$refs.applyTable.$refs.asCom.getData()
})
},
// 组件方法
methods: {
tableToolHandler(e) {
console.log(e.key.btnValue)
if (e.key.btnValue === 'useApply') {
this.useApply()
}
},
useApply() {
this.dialogVisible = true
}, },
// 组件方法 confirm() {
methods: { let isUrgentUse = 0
tableToolHandler(e) { this.selectionRows.forEach(item => {
console.log(e.key.btnValue) if (item.typeName !== 'UrgentUse') {
if (e.key.btnValue === 'useApply') { isUrgentUse++
this.useApply()
} }
}, })
useApply() { if (isUrgentUse === 0) {
this.dialogVisible = true // 紧急领用选人
}, this.dialogVisible = false
confirm() { this.setPersonVisible = true
let isUrgentUse = 0 } else if (isUrgentUse === this.selectionRows.length) {
this.selectionRows.forEach(item => { post('/DxWorkflowTask/apply/batchPass?applyIds=' + this.selectionRows.map(item => ({ 'taskId': item.processTaskId, 'pboId': item.id }))).then(res => {
if (item.typeName !== 'UrgentUse') { this.$utils.showMessageSuccess('提交成功')
isUrgentUse++ this.$refs.applyTable.$refs.asCom.getData()
} }).catch(() => {
}) this.$utils.showMessageWarning('出现异常,提交失败')
if (isUrgentUse === 0) { }).finally(() => {
// 紧急领用选人
this.dialogVisible = false this.dialogVisible = false
this.setPersonVisible = true })
} else if (isUrgentUse === this.selectionRows.length) { } else {
post('/DxWorkflowTask/apply/batchPass?applyIds=' + this.selectionRows.map(item => ({ 'taskId': item.processTaskId, 'pboId': item.id }))).then(res => { this.dialogVisible = false
this.$utils.showMessageSuccess('提交成功') this.$utils.showMessageWarning('紧急领用不能和其他领用类型一起提交')
}
},
cancle() {
this.dialogVisible = false
},
setPersonConfirm() {
const ids = []
if (this.selectionRows && this.selectionRows.length) {
this.selectionRows.forEach(item => ids.push(item.id))
}
if (this.form.userIds && this.form.userIds.length !== 0) {
post('/OutStorageRequest/creator/batchApply?userIds=' + this.form.userIds, ids).then(res => {
this.$utils.showMessageSuccess('提交成功')
setTimeout(() => {
this.$refs.applyTable.$refs.asCom.getData() this.$refs.applyTable.$refs.asCom.getData()
}).catch(() => { }, 1500)
this.$utils.showMessageWarning('出现异常,提交失败') }).catch(err => {
}).finally(() => { this.$utils.showMessageWarning('出现异常,提交失败')
this.dialogVisible = false console.log(err)
}) }).finally(() => {
} else {
this.dialogVisible = false this.dialogVisible = false
this.$utils.showMessageWarning('紧急领用不能和其他领用类型一起提交') this.setPersonVisible = false
} this.$set(this.form, 'userIds', '')
}, })
cancle() { } else {
this.dialogVisible = false this.$utils.showMessageWarning('请选择审批领导')
},
setPersonConfirm() {
const ids = []
if (this.selectionRows && this.selectionRows.length) {
this.selectionRows.forEach(item => ids.push(item.id))
}
if (this.form.userIds && this.form.userIds.length !== 0) {
post('/OutStorageRequest/creator/batchApply?userIds=' + this.form.userIds, ids).then(res => {
this.$utils.showMessageSuccess('提交成功')
setTimeout(() => {
this.$refs.applyTable.$refs.asCom.getData()
}, 1500)
}).catch(err => {
this.$utils.showMessageWarning('出现异常,提交失败')
console.log(err)
}).finally(() => {
this.dialogVisible = false
this.setPersonVisible = false
this.$set(this.form, 'userIds', '')
})
} else {
this.$utils.showMessageWarning('请选择审批领导')
}
},
setPersonCancle() {
this.setPersonVisible = false
this.$set(this.form, 'userIds', '')
},
selectionChange(val) {
this.selectionRows = val
} }
},
setPersonCancle() {
this.setPersonVisible = false
this.$set(this.form, 'userIds', '')
},
selectionChange(val) {
this.selectionRows = val
} }
} }
}
</script> </script>
<style lang='scss'> <style lang='scss'>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment