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