<template>
|
<a-modal
|
title="新增任务管理"
|
:width="900"
|
:visible="visible"
|
:confirmLoading="confirmLoading"
|
@ok="handleSubmit"
|
@cancel="handleCancel">
|
<a-spin :spinning="confirmLoading">
|
<a-form :form="form">
|
</a-form>
|
</a-spin>
|
</a-modal>
|
</template>
|
|
<script>
|
import {
|
WmsTaskAdd
|
} from '@/api/modular/main/WmsTaskManage'
|
export default {
|
data () {
|
return {
|
labelCol: {
|
xs: { span: 24 },
|
sm: { span: 5 }
|
},
|
wrapperCol: {
|
xs: { span: 24 },
|
sm: { span: 15 }
|
},
|
visible: false,
|
confirmLoading: false,
|
form: this.$form.createForm(this)
|
}
|
},
|
methods: {
|
// 初始化方法
|
add (record) {
|
this.visible = true
|
this.$nextTick(() => {
|
|
});
|
const taskmodelOption = this.$options
|
this.taskmodelData = taskmodelOption.filters['dictData']('task_model')
|
const tasktypeOption = this.$options
|
this.tasktypeData = tasktypeOption.filters['dictData']('task_type')
|
const taskstatusOption = this.$options
|
this.taskstatusData = taskstatusOption.filters['dictData']('task_status')
|
const areaNameOption = this.$options
|
this.areaNameData = areaNameOption.filters['dictData']('')
|
const voidOption = this.$options
|
this.voidData = voidOption.filters['dictData']('yes_or_no')
|
const iscurrenttaskOption = this.$options
|
this.iscurrenttaskData = iscurrenttaskOption.filters['dictData']('yes_or_no')
|
const islasttaskOption = this.$options
|
this.islasttaskData = islasttaskOption.filters['dictData']('yes_or_no')
|
const isemptycontainerOption = this.$options
|
this.isemptycontainerData = isemptycontainerOption.filters['dictData']('yes_or_no')
|
},
|
/**
|
* 提交表单
|
*/
|
handleSubmit () {
|
const { form: { validateFields } } = this
|
this.confirmLoading = true
|
validateFields((errors, values) => {
|
if (!errors) {
|
for (const key in values) {
|
if (typeof (values[key]) === 'object') {
|
values[key] = JSON.stringify(values[key])
|
}
|
}
|
WmsTaskAdd(values).then((res) => {
|
if (res.success) {
|
this.$message.success('新增成功')
|
this.confirmLoading = false
|
this.$emit('ok', values)
|
this.handleCancel()
|
} else {
|
this.$message.error('新增失败:' + JSON.stringify(res.message))
|
}
|
}).finally((res) => {
|
this.confirmLoading = false
|
})
|
} else {
|
this.confirmLoading = false
|
}
|
})
|
},
|
handleCancel () {
|
this.form.resetFields()
|
this.visible = false
|
}
|
}
|
}
|
</script>
|