<template>
    <div>
        <el-form :model="assemblyForm" ref="form" label-width="90px" class="demo-ruleForm" :disabled="disabled">
            <el-row>
                <el-button icon="el-icon-plus" size="small" type="primary" style="margin: 5px;"
                    @click="inHmmEdi">现代EDI</el-button>
            </el-row>
            <el-row>
                <el-col :span="12">
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="ERNNO" prop="ediErnno">
                                <span slot="label">
                                    <span style="color: #1e9fff">ERNNO</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.detail.ediErnno"
                                    size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                    placeholder="请输入ERNNO"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="VAENO" prop="ediVaeno">
                                <span slot="label">
                                    <span style="color: #1e9fff">VAENO</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.detail.ediVaeno"
                                    size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                    placeholder="请输入VAENO"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="TACNO" prop="ediTacno">
                                <span slot="label">
                                    <span style="color: #1e9fff">TACNO</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.detail.ediTacno"
                                    size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                    placeholder="请输入TACNO"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="IEMAL" prop="ediIemail">
                                <span slot="label">
                                    <span style="color: #1e9fff">IEMAL</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.detail.ediIemail"
                                    size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                    placeholder="请输入IEMAL"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="自定义1" prop="userDefine1">
                                <span slot="label">
                                    <span style="color: #1e9fff">自定义1</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.hmmEdi.userDefine1"
                                          size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                          placeholder=""></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="自定义2" prop="userDefine2">
                                <span slot="label">
                                    <span style="color: #1e9fff">自定义2</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.hmmEdi.userDefine2"
                                          size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                          placeholder=""></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <!-- 此处不再重复显示
                    <el-form-item label="订舱备注" prop="bookingRemarks">
                        <span slot="label">
                            <span style="color: #1e9fff">订舱备注</span>
                        </span>
                        <el-input type="textarea" style="width: 100%;" v-model="assemblyForm.bookingRemarks"
                            size="small" autocomplete="off" :disabled="detailData.seeDisabled" rows="3" clearable
                            placeholder="请输入订舱备注"></el-input>
                    </el-form-item>
                    -->
                </el-col>
                <el-col :span="12">
                    <el-row>
                        <!--<el-col :span="12">-->
                        <!--    <el-form-item label="ACINO" prop="ediIegstin" >-->
                        <!--        <el-input type="age" style="width: 100%;" v-model="assemblyForm.ediIegstin"-->
                        <!--                  size="small" autocomplete="off"-->
                        <!--                  :disabled="detailData.seeDisabled"-->
                        <!--                  clearable placeholder="请输入ACINO" ></el-input>-->
                        <!--    </el-form-item>-->
                        <!--</el-col>-->
                        <el-col :span="12">
                            <el-form-item label="IEIEC" prop="ediIeiec">
                                <span slot="label">
                                    <span style="color: #1e9fff">IEIEC</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.detail.ediIeiec"
                                    size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                    placeholder="请输入IEIEC"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="IEGSTIN" prop="ediIegstin">
                                <span slot="label">
                                    <span style="color: #1e9fff">IEGSTIN</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.detail.ediIegstin"
                                    size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                    placeholder="请输入IEGSTIN"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="PIL HBL" prop="pilHbl">
                                <span slot="label">
                                    <span style="color: #1e9fff">PIL HBL</span>
                                </span>
                                <search-query :datalist="pilHblData" :selectValue="assemblyForm.pilHbl"
                                    :clearable="true" :disabled="detailData.seeDisabled" :buttonIf="false"
                                    :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictKey', }"
                                    placeholder="请选择PIL HBL" @corpChange="pilHblChange" @corpFocus="pilHblfun">
                                </search-query>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <el-col :span="12">
                            <el-form-item label="自定义3" prop="userDefine3">
                                <span slot="label">
                                    <span style="color: #1e9fff">自定义3</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.hmmEdi.userDefine3"
                                          size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                          placeholder=""></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="12">
                            <el-form-item label="自定义4" prop="userDefine4">
                                <span slot="label">
                                    <span style="color: #1e9fff">自定义4</span>
                                </span>
                                <el-input type="age" style="width: 100%;" v-model="assemblyForm.hmmEdi.userDefine4"
                                          size="small" autocomplete="off" :disabled="detailData.seeDisabled" clearable
                                          placeholder=""></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <!-- 此处不再重复显示
                    <el-form-item label="SI备注" prop="siRemarks">
                        <span slot="label">
                            <span style="color: #1e9fff">SI备注</span>
                        </span>
                        <el-input type="textarea" style="width: 100%;" v-model="assemblyForm.siRemarks" size="small"
                            autocomplete="off" :disabled="detailData.seeDisabled" rows="3" clearable
                            placeholder="请输入SI备注"></el-input>
                    </el-form-item>
                    -->
                </el-col>
            </el-row>
        </el-form>


    </div>
</template>

<script>
import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
import { getWorkDicts } from "@/api/system/dictbiz";

export default {
    components: { SearchQuery },
    props: {
        assemblyForm: {
            type: Object
        },
        detailData: {
            type: Boolean,
        },
        disabled: {
            type: Boolean,
            default: false
        }
    },
    data() {
        return {
            pilHblData: [],
        }
    },
    created() {
        this.pilHblfun();
    },
    methods: {
        pilHblChange(value) {
            this.$set(this.assemblyForm, 'pilHbl', value)
        },
        pilHblfun() {
            if(this.pilHblData.length==0) {
                getWorkDicts('pilhbl_los').then(res => {
                    this.pilHblData = res.data.data
                })
            }
        },
        inHmmEdi() {
            if (!this.assemblyForm.id) {
                return this.$message.error('请先保存数据');
            }
            this.$DialogForm.show({
                title: 'HMM EDI信息',
                width: '70%',
                data: this.assemblyForm.hmmEdi,
                menuPosition: 'right',
                option: {
                    submitText: '确定',
                    emptyText: '取消',
                    labelWidth: 130,
                    column: [
                        {
                            label: "欧线ENS申报标识",
                            span: 8,
                            prop: "emsDeclarationIdentification",
                            type: 'select',
                            dicUrl: "/api/blade-system/dict-biz/dictionary?code=ENS_Identification",
                            props: {
                                label: "dictValue",
                                value: "dictKey"
                            },
                            rules: [{
                                required: true,
                                message: "请输入欧线ENS申报标识",
                                trigger: "blur",
                            }],
                        },
                        {
                            label: "舱单类型",
                            span: 8,
                            prop: "manifestType",
                            type: 'select',
                            dicUrl: "/api/blade-system/dict-biz/dictionary?code=manifest_Type",
                            props: {
                                label: "dictValue",
                                value: "dictKey"
                            },
                        },
                        {
                            label: "",
                            span: 8,
                            prop: "europeanLineSign",
                            type: 'checkbox',
                            dataType: 'string',
                            dicData: [{
                                label: '欧线标识',
                                value: 1
                            }]
                        },
                        {
                            label: "补充申报人",
                            span: 12,
                            prop: "applicant",
                            row: true
                        },
                        {
                            label: "发货人代码",
                            span: 12,
                            prop: "shipperCode",
                        },
                        {
                            label: "实际发货人代码",
                            span: 12,
                            prop: "actualShipperCode",
                        },
                        {
                            label: "发货人邮政信箱",
                            span: 12,
                            prop: "shipperEmail",
                        },
                        {
                            label: "实际发货人名称",
                            span: 12,
                            prop: "actualShipperName",
                        },
                        {
                            label: "发货人街道号码",
                            span: 12,
                            prop: "shipperStreetNo",
                        },
                        {
                            label: "实际发货人地址",
                            span: 12,
                            prop: "actualShipperAddress",
                        },
                        {
                            label: "发货人街道名称",
                            span: 12,
                            prop: "shipperStreetName",
                        },
                        {
                            label: "实际发货人邮政信箱",
                            span: 12,
                            prop: "actualShipperEmail",
                        },
                        {
                            label: "发货人邮政编码",
                            span: 12,
                            prop: "shipperPostalCode",
                        },
                        {
                            label: "实际发货人街道号码",
                            span: 12,
                            prop: "actualShipperStreetNo",
                        },
                        {
                            label: "收货人代码",
                            span: 12,
                            prop: "consigneeCode",
                        },
                        {
                            label: "实际发货人街道名称",
                            span: 12,
                            prop: "actualShipperStreetName",
                        },
                        {
                            label: "收货人邮政信箱",
                            span: 12,
                            prop: "consigneeEmail",
                        },
                        {
                            label: "实际发货人邮政编码",
                            span: 12,
                            prop: "actualShipperPostalCode",
                        },
                        {
                            label: "收货人街道号码",
                            span: 12,
                            prop: "consigneeStreetNo",
                        },
                        {
                            label: "实际收货人代码",
                            span: 12,
                            prop: "actualConsigneeCode",
                        },
                        {
                            label: "收货人街道名称",
                            span: 12,
                            prop: "consigneeStreetName",
                        },
                        {
                            label: "实际收货人名称",
                            span: 12,
                            prop: "actualConsigneeName",
                        },
                        {
                            label: "收货人邮政编码",
                            span: 12,
                            prop: "consigneePostalCode",
                        },
                        {
                            label: "实际收货人地址",
                            span: 12,
                            prop: "actualConsigneeAddress",
                        },
                        {
                            label: "通知人代码",
                            span: 12,
                            prop: "notifierCode",
                        },
                        {
                            label: "实际收货人邮政信箱",
                            span: 12,
                            prop: "actualConsigneeEmail",
                        },
                        {
                            label: "通知人邮政信箱",
                            span: 12,
                            prop: "notifierEmail",
                        },
                        {
                            label: "实际收货人街道号码",
                            span: 12,
                            prop: "actualConsigneeStreetNo",
                        },
                        {
                            label: "通知人街道号码",
                            span: 12,
                            prop: "notifierStreetNo",
                        },
                        {
                            label: "实际收货人街道名称",
                            span: 12,
                            prop: "actualConsigneeStreetName",
                        },
                        {
                            label: "通知人街道名称",
                            span: 12,
                            prop: "notifierStreetName",
                        },
                        {
                            label: "实际收货人邮政编码",
                            span: 12,
                            prop: "actualConsigneePostalCode",
                        },
                        {
                            label: "通知人电话",
                            span: 12,
                            prop: "notifierTel",
                        },
                        {
                            label: "化工品标识",
                            span: 12,
                            prop: "chemicalIdentification",
                            type: 'select',
                            dicUrl: "/api/blade-system/dict-biz/dictionary?code=chemical_Identification",
                            props: {
                                label: "dictValue",
                                value: "dictKey"
                            },
                        },
                        {
                            label: "通知人邮政编码",
                            span: 12,
                            prop: "notifierPostalCode",
                        }
                    ]
                },
                beforeClose: (done) => {
                    done()
                },
                callback: (res) => {
                    res.done()
                    console.log(res.data, 'hmmEdi')
                    this.assemblyForm.hmmEdi = res.data
                    res.close()
                }
            })
        }
    }
}

</script>

<style scoped>
::v-deep.el-form-item {
    margin-bottom: 10px;
}
</style>
