|
|
|
@ -1,24 +1,39 @@
|
|
|
|
|
<template>
|
|
|
|
|
<a-modal
|
|
|
|
|
title="编辑订舱模板"
|
|
|
|
|
title="编辑收发通模板"
|
|
|
|
|
:width="900"
|
|
|
|
|
:visible="visible"
|
|
|
|
|
:confirmLoading="confirmLoading"
|
|
|
|
|
@ok="handleSubmit"
|
|
|
|
|
@cancel="handleCancel">
|
|
|
|
|
@cancel="handleCancel"
|
|
|
|
|
>
|
|
|
|
|
<a-spin :spinning="confirmLoading">
|
|
|
|
|
<a-form :form="form">
|
|
|
|
|
<a-form-item v-show="false"><a-input v-decorator="['id']" /></a-form-item>
|
|
|
|
|
<a-form-item label="标题" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
|
|
|
|
<a-input placeholder="请输入标题" v-decorator="['title', {rules: [{required: true, message: '请输入标题!'}]}]" />
|
|
|
|
|
<a-form-item v-show="false"><a-input v-decorator="['id']"/></a-form-item>
|
|
|
|
|
<a-form-item label="代码" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
|
|
|
|
<a-input
|
|
|
|
|
placeholder="请输入代码"
|
|
|
|
|
v-decorator="['title', { rules: [{ required: true, message: '请输入代码!' }] }]"
|
|
|
|
|
/>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
<a-form-item label="类型" :labelCol="labelCol" :wrapperCol="wrapperCol">
|
|
|
|
|
<a-select style="width: 100%" placeholder="请选择类型" v-decorator="['type', {rules: [{ required: true, message: '请选择类型!' }]}]">
|
|
|
|
|
<a-select-option v-for="(item,index) in typeData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
|
|
|
|
|
<a-select
|
|
|
|
|
mode="multiple"
|
|
|
|
|
style="width: 100%"
|
|
|
|
|
placeholder="请选择类型"
|
|
|
|
|
v-decorator="['type', { rules: [{ required: true, message: '请选择类型!' }] }]"
|
|
|
|
|
>
|
|
|
|
|
<a-select-option v-for="(item, index) in typeData" :key="index" :value="item.code">
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</a-select-option>
|
|
|
|
|
</a-select>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
<a-form-item label="模板内容" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
|
|
|
|
<a-textarea placeholder="请输入模板内容" v-decorator="['content', {rules: [{required: true, message: '请输入模板内容!'}]}]" />
|
|
|
|
|
<a-textarea
|
|
|
|
|
placeholder="请输入模板内容"
|
|
|
|
|
:auto-size="{ minRows: 3, maxRows: 5 }"
|
|
|
|
|
v-decorator="['content', { rules: [{ required: true, message: '请输入模板内容!' }] }]"
|
|
|
|
|
/>
|
|
|
|
|
</a-form-item>
|
|
|
|
|
<a-form-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" has-feedback>
|
|
|
|
|
<a-input placeholder="请输入备注" v-decorator="['remark']" />
|
|
|
|
@ -29,75 +44,93 @@
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {
|
|
|
|
|
BookingTemplateEdit
|
|
|
|
|
} from '@/api/modular/main/BookingTemplateManage'
|
|
|
|
|
export default {
|
|
|
|
|
data () {
|
|
|
|
|
return {
|
|
|
|
|
labelCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 5 }
|
|
|
|
|
import { BookingTemplateEdit } from '@/api/modular/main/BookingTemplateManage'
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
labelCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 5 }
|
|
|
|
|
},
|
|
|
|
|
wrapperCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 15 }
|
|
|
|
|
},
|
|
|
|
|
typeData: [],
|
|
|
|
|
visible: false,
|
|
|
|
|
confirmLoading: false,
|
|
|
|
|
form: this.$form.createForm(this)
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 初始化方法
|
|
|
|
|
edit(record) {
|
|
|
|
|
this.visible = true
|
|
|
|
|
this.typeData = [
|
|
|
|
|
{
|
|
|
|
|
code: '10',
|
|
|
|
|
name: '收货人'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
code: '20',
|
|
|
|
|
name: '发货人'
|
|
|
|
|
},
|
|
|
|
|
wrapperCol: {
|
|
|
|
|
xs: { span: 24 },
|
|
|
|
|
sm: { span: 15 }
|
|
|
|
|
{
|
|
|
|
|
code: '30',
|
|
|
|
|
name: '通知人'
|
|
|
|
|
},
|
|
|
|
|
typeData: [],
|
|
|
|
|
visible: false,
|
|
|
|
|
confirmLoading: false,
|
|
|
|
|
form: this.$form.createForm(this)
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
code: '40',
|
|
|
|
|
name: '第二通知人'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
// const typeOption = this.$options
|
|
|
|
|
// this.typeData = typeOption.filters['dictData']('edi_type')
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.form.setFieldsValue({
|
|
|
|
|
id: record.id,
|
|
|
|
|
title: record.title,
|
|
|
|
|
type: record.type.toString().split(','),
|
|
|
|
|
content: record.content,
|
|
|
|
|
remark: record.remark
|
|
|
|
|
})
|
|
|
|
|
}, 100)
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 初始化方法
|
|
|
|
|
edit (record) {
|
|
|
|
|
this.visible = true
|
|
|
|
|
const typeOption = this.$options
|
|
|
|
|
this.typeData = typeOption.filters['dictData']('edi_type')
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.form.setFieldsValue(
|
|
|
|
|
{
|
|
|
|
|
id: record.id,
|
|
|
|
|
title: record.title,
|
|
|
|
|
type: record.type,
|
|
|
|
|
content: record.content,
|
|
|
|
|
remark: record.remark
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
}, 100)
|
|
|
|
|
},
|
|
|
|
|
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]===null)) {
|
|
|
|
|
values[key] = JSON.stringify(values[key])
|
|
|
|
|
}
|
|
|
|
|
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] === null)) {
|
|
|
|
|
values[key] = JSON.stringify(values[key])
|
|
|
|
|
}
|
|
|
|
|
BookingTemplateEdit(values).then((res) => {
|
|
|
|
|
}
|
|
|
|
|
BookingTemplateEdit(values)
|
|
|
|
|
.then(res => {
|
|
|
|
|
if (res.success) {
|
|
|
|
|
this.$message.success('编辑成功')
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
this.$emit('ok', values)
|
|
|
|
|
this.handleCancel()
|
|
|
|
|
} else {
|
|
|
|
|
this.$message.error('编辑失败')// + res.message
|
|
|
|
|
this.$message.error('编辑失败') // + res.message
|
|
|
|
|
}
|
|
|
|
|
}).finally((res) => {
|
|
|
|
|
})
|
|
|
|
|
.finally(res => {
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleCancel () {
|
|
|
|
|
this.form.resetFields()
|
|
|
|
|
this.visible = false
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
this.confirmLoading = false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
handleCancel() {
|
|
|
|
|
this.form.resetFields()
|
|
|
|
|
this.visible = false
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|