<template>
    <div>
        <add-table>
            <table-row>
                <table-col>
                    <van-field readonly
                               label-class="cus-field-class"
                               label-width="50%"
                               label-align="center"
                               v-model="formObj.samplingNum"
                               label="抽样单编号"
                               :rules="[{ required: true, message: '请填写抽样单编号' }]"
                    ></van-field>
                </table-col>
                <table-col>
                    <van-field readonly
                               label-class="cus-field-class"
                               label-width="50%"
                               label-align="center"
                               v-model="formObj.taskNum"
                               label="No."
                    ></van-field>
                </table-col>
            </table-row>
            <table-row>
                <table-col>
                    <van-field readonly
                               label-class="cus-field-class"
                               label-width="50%"
                               label-align="center"
                               v-model="formObj.source"
                               label="任务来源"
                    ></van-field>
                </table-col>
                <table-col>
                    <van-field readonly
                               label-class="cus-field-class"
                               label-width="50%"
                               label-align="center"
                               label="任务类别">
                        <template #input>
                            <van-radio-group disabled v-model="formObj.taskType" direction="horizontal">
                                <van-radio :name="item" :key="item" shape="square" v-for="item in taskTypeList">
                                    {{item}}
                                </van-radio>
                            </van-radio-group>
                        </template>
                    </van-field>
                </table-col>
            </table-row>
            <table-row flex-none>
                <table-col>
                    网络食品交易第三方平台提供者信息
                </table-col>
                <table-col flex-none>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.plantformName"
                                       label="平台名称"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.plantformLicense"
                                       label="营业执照号/社会信用代码"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.plantformSite"
                                       label="平台网址"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.plantformPermit"
                                       label="电信业务经营许可证"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.plantformAddress"
                                       label="平台地址"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.legalPerson"
                                       label="法人代表"
                            ></van-field>
                        </table-col>
                    </table-row>
                </table-col>
            </table-row>
            <table-row flex-none>
                <table-col>
                    被抽样单位信息（入网经营者信息）
                </table-col>
                <table-col flex-none>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="netTested.name"
                                       label="单位名称"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="areaObj"
                                       label="省市区"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="netTested.address"
                                       label="单位地址"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="netTested.estore"
                                       label="网店商铺名称"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="netTested.sampleSite"
                                       label="样品网址"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-radio-group disabled v-model="netTested.permitType" direction="horizontal">
                                <van-radio v-for="item in permitTypeList" :key="item" :name="item" shape="square">
                                    {{item}}
                                </van-radio>
                            </van-radio-group>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.permitNum"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.linkman"
                                       label="联系人"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.license"
                                       label="营业执照号/社会信用代码"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="netTested.tel"
                                       label="联系电话"
                            ></van-field>
                        </table-col>
                    </table-row>
                </table-col>
            </table-row>
            <table-row flex-none>
                <table-col>
                    抽样地点
                </table-col>
                <table-col>
                    <van-radio-group disabled v-model="place" direction="horizontal">
                        <van-radio :name="1+',网购'" shape="square">流通环节：网购</van-radio>
                        <van-radio :name="2+',外卖餐饮'" shape="square">餐饮环节：外卖餐饮</van-radio>
                    </van-radio-group>
                </table-col>
            </table-row>
            <table-row>
                <table-col>
                    <van-field readonly
                            label-class="cus-field-class"
                            label-width="50%"
                            label-align="center"
                            v-model="formObj.samplingDate"
                            label="抽样日期"
                    ></van-field>
                </table-col>
                <table-col>
                    <van-field readonly
                            label-class="cus-field-class"
                            label-width="50%"
                            label-align="center"
                            v-model="formObj.testMembers"
                            label="抽样人员"
                    ></van-field>
                </table-col>
            </table-row>
            <table-row flex-none>
                <table-col>
                    样品信息
                </table-col>
                <table-col flex-none>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.name"
                                       label="样品名称"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.trademark"
                                       label="商标"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.num"
                                       label="订单编号"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="sample.firstClass"
                                       label="大类"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="sample.secondClass"
                                       label="亚类"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="sample.thirdClass"
                                       label="次亚类"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="sample.fourthClass"
                                       label="细类"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <van-field readonly
                                   label-class="cus-field-class"
                                   label-width="25%"
                                   label-align="center"
                                   label="样品类型">
                            <template #input>
                                <van-radio-group disabled v-model="sample.type" direction="horizontal">
                                    <van-radio :name="item" :key="item" shape="square" v-for="item in sampleTypeList">
                                        {{item}}
                                    </van-radio>
                                </van-radio-group>
                                <div style="border-bottom: 1px solid #000">
                                    <van-field readonly
                                               label-class="cus-field-class"
                                               label-width="50%"
                                               label-align="center"
                                               v-model="sample.typeRemak"
                                    ></van-field>
                                </div>
                            </template>
                        </van-field>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       label="样品来源">
                                <template #input>
                                    <van-radio-group disabled v-model="sample.source" direction="horizontal">
                                        <van-radio :name="item" :key="item" shape="square" v-for="item in sourceList">
                                            {{item}}
                                        </van-radio>
                                    </van-radio-group>
                                    <div style="border-bottom: 1px solid #000">
                                        <van-field readonly
                                                   label-class="cus-field-class"
                                                   label-width="50%"
                                                   label-align="center"
                                                   v-model="sample.sourceRemark"
                                        ></van-field>
                                    </div>
                                </template>
                            </van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       label="样品属性">
                                <template #input>
                                    <van-radio-group disabled v-model="sample.properties" direction="horizontal">
                                        <van-radio :name="item" :key="item" shape="square"
                                                   v-for="item in propertiesList">{{item}}
                                        </van-radio>
                                    </van-radio-group>
                                    <div style="border-bottom: 1px solid #000">
                                        <van-field readonly
                                                   label-class="cus-field-class"
                                                   label-width="50%"
                                                   label-align="center"
                                                   v-model="sample.propertiesRemark"
                                        ></van-field>
                                    </div>
                                </template>
                            </van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-radio-group disabled v-model="sample.dateType" direction="horizontal">
                                <van-radio name="生产日期" shape="square">生产日期</van-radio>
                                <van-radio name="加工日期" shape="square">加工日期</van-radio>
                            </van-radio-group>
                        </table-col>
                        <table-col>
                            <van-field
                                    readonly
                                    label-class="cus-field-class"
                                    label-width="50%"
                                    label-align="center"
                                    v-model="sample.sampleDate"
                                    label=""
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.shelfLife"
                                       label="保质期"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.batchNo"
                                       label="生产批号"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.standard"
                                       label="执行标准/技术文件"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.qualityGrade"
                                       label="质量等级"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.specification"
                                       label="规格型号"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.quantity"
                                       label="抽样数量"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.unit"
                                       label="抽样数量单位"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.backupQuanity"
                                       label="备样数量"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       label="抽样方式">
                                <template #input>
                                    <van-radio-group disabled v-model="sample.samplingMethod" direction="horizontal">
                                        <van-radio :name="item" v-for="item in samplingMethodList" :key="item"
                                                   shape="square">{{item}}
                                        </van-radio>
                                    </van-radio-group>
                                </template>
                            </van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.qrcode"
                                       label="条形码"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.price"
                                       label="单价"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       label="是否进口">
                                <template #input>
                                    <van-radio-group disabled v-model="sample.inward" direction="horizontal">
                                        <van-radio v-for="item in trueOrFalseList" :key="item.value" :name="item.value"
                                                   shape="square">{{item.label}}
                                        </van-radio>
                                    </van-radio-group>
                                </template>
                            </van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="sample.originPlace"
                                       label="原产地"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       label="包装分类">
                                <template #input>
                                    <van-radio-group disabled v-model="sample.packClass" direction="horizontal">
                                        <van-radio v-for="item in packClassList" :name="item" :key="item"
                                                   shape="square">{{item}}
                                        </van-radio>
                                    </van-radio-group>
                                </template>
                            </van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       label="储存条件">
                                <template #input>
                                    <van-checkbox-group  disabled v-model="storageCondition" direction="horizontal">
                                        <van-checkbox v-for="item in storageConditionList" :name="item" :key="item"
                                                      shape="square">{{item}}
                                        </van-checkbox>
                                    </van-checkbox-group>
                                    <div style="border-bottom: 1px solid #000">
                                        <van-field readonly
                                                   label-class="cus-field-class"
                                                   label-width="50%"
                                                   label-align="center"
                                                   v-model="sample.storageConditionRemark"
                                        ></van-field>
                                    </div>
                                </template>
                            </van-field>
                        </table-col>
                    </table-row>
                </table-col>
            </table-row>
            <table-row flex-none>
                <table-col>（标称）生产者信息</table-col>
                <table-col flex-none>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="formObj.proName"
                                       label="生产者名称"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="formObj.proAddress"
                                       label="生产者地址"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="formObj.proLicense"
                                       label="生产许可证号"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="formObj.proTel"
                                       label="联系电话"
                            ></van-field>
                        </table-col>
                    </table-row>
                </table-col>
            </table-row>
            <table-row flex-none>
                <table-col>（标称）第三方企业信息</table-col>
                <table-col flex-none>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="formObj.thirdPartyName"
                                       label="企业名称"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="formObj.thirdPartyAddress"
                                       label="企业地址"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       label="企业性质">
                                <template #input>
                                    <van-radio-group disabled v-model="formObj.thirdPartyNature" direction="horizontal">
                                        <van-radio v-for="item in thirdPartyNatureList" :key="item" :name="item"
                                                   shape="square">{{item}}
                                        </van-radio>
                                    </van-radio-group>
                                    <div style="border-bottom: 1px solid #000">
                                        <van-field readonly
                                                   label-class="cus-field-class"
                                                   label-width="50%"
                                                   label-align="center"
                                                   v-model="formObj.thirdPartyNatureRemark"
                                        ></van-field>
                                    </div>
                                </template>
                            </van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="formObj.thirdPartyLicense"
                                       label="企业许可证号"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="25%"
                                       label-align="center"
                                       v-model="formObj.thirdPartyTel"
                                       label="联系电话"
                            ></van-field>
                        </table-col>
                    </table-row>
                </table-col>
            </table-row>
            <table-row flex-none>
                <table-col>抽样单位信息</table-col>
                <table-col flex-none>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="formObj.testName"
                                       label="单位名称"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="formObj.testAddress"
                                       label="地址"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="formObj.testLinkman"
                                       label="联系人"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field readonly
                                       label-class="cus-field-class"
                                       label-width="50%"
                                       label-align="center"
                                       v-model="formObj.testTel"
                                       label="电话"
                            ></van-field>
                        </table-col>
                    </table-row>
                    <table-row>
                        <table-col>
                            <van-field
                                    readonly
                                    label-class="cus-field-class"
                                    label-width="50%"
                                    label-align="center"
                                    v-model="formObj.testEmail"
                                    label="邮箱"
                            ></van-field>
                        </table-col>
                        <table-col>
                            <van-field
                                    readonly
                                    label-class="cus-field-class"
                                    label-width="50%"
                                    label-align="center"
                                    v-model="formObj.testFax"
                                    label="传真"
                            ></van-field>
                        </table-col>
                    </table-row>
                </table-col>
            </table-row>
            <table-row>
                <table-col>
                    <van-field readonly
                               label-class="cus-field-class"
                               label-width="100px"
                               label-align="center"
                               v-model="formObj.remark"
                               label="备注"
                    ></van-field>
                </table-col>
            </table-row>
        </add-table>
        <div class="bottom-btn">
            <van-button block type="info" @click="_goto">返回</van-button>
        </div>
    </div>
</template>

<script>
    import SamplingListAddTable from './components/SamplingListAddTable'
    import TableRow from './components/TableRow'
    import TableCol from './components/TableCol'

    import {samplingSummary} from '../../api'

    export default {
        name: "SamplingListAddNet",
        components: {
            "add-table": SamplingListAddTable,
            "table-row": TableRow,
            "table-col": TableCol
        },
        data() {
            return {
                formObj: {
                    samplingNum: '',
                    taskNum: '',
                    source: '',
                    taskType: '',

                    proName: '',
                    proAddress: '',
                    proLicense: '',
                    proTel: '',

                    thirdPartyName: '',
                    thirdPartyAddress: '',
                    thirdPartyNature: '',
                    thirdPartyNatureRemark: '',
                    thirdPartyLicense: '',
                    thirdPartyTel: '',

                    testName: '',
                    testAddress: '',
                    testLinkman: '',
                    testTel: '',
                    testFax: '',
                    remark: '',

                    samplingDate:'',
                    testMembers:'',
                    testEmail:'',
                },
                netTested: {
                    plantformName: '',
                    plantformLicense: '',
                    plantformSite: '',
                    plantformPermit: '',
                    plantformAddress: '',
                    legalPerson: '',
                    name: '',
                    testedProvince:'',
                    testedCity:'',
                    testedCountry:'',
                    address: '',
                    estore: '',
                    sampleSite: '',
                    permitType: '',
                    permitNum: '',
                    linkman: '',
                    license: '',
                    tel: '',

                    placeLink: '',//保存时单独赋值 从place字段分离出
                    place: '',  //保存时单独赋值  从place字段分离出
                },
                sample: {
                    name:'',
                    trademark: '',
                    num: '',
                    batchNo:'',
                    firstClass:'',
                    secondClass:'',
                    thirdClass:'',
                    fourthClass:'',
                    type: '',
                    typeRemak: '',
                    source: '',
                    sourceRemark: '',
                    properties: '',
                    propertiesRemark: '',
                    dateType: '',
                    sampleDate:'',
                    shelfLife: '',
                    standard: '',
                    qualityGrade: '',
                    specification: '',
                    quantity: '',
                    unit:'',
                    backupQuanity: '',
                    samplingMethod: '',
                    qrcode: '',
                    price: '',
                    inward: '',
                    originPlace: '',
                    packClass: '',
                    storageCondition: '',
                    storageConditionRemark: '',
                },
                taskTypeList: ['监督抽检', '风险监测', '评价性抽检'],
                permitTypeList: ['经营许可证号', '生产许可证号'],
                sampleTypeList: ['食用农产品', '工业加工食品', '餐饮加工食品', '食品添加剂', '食品相关产品', '其他',],
                sourceList: ['加工/自制', '委托生产', '外购', '其他'],
                propertiesList: ['普通食品', '特殊食品', '节令食品', '重大活动保障食品', '其他',],
                samplingMethodList: ['无菌抽样', '非无菌抽样'],
                trueOrFalseList: [{label: '是', value: 1}, {label: '否', value: 0}],
                packClassList: ['预包装', '非定量包装', '无包装'],
                storageConditionList: ['常温', '冷藏', '冷冻', '避光', '密闭', '阴凉', '通风', '干燥', '其他'],
                thirdPartyNatureList: ['委托', '代理', '经销', '进口', '其他'],

                place: '',
                storageCondition: [],


                id: '',
            }
        },
        computed: {
            areaObj:function(){
                return this.netTested.testedProvince+this.netTested.testedCity+this.netTested.testedCountry
            }
        },
        mounted() {
            this._open()
        },
        methods: {
            _open() {
                this.id = this.$route.query.id
                this._getData()
            },
            _getData: async function () {
                let result = await samplingSummary.getById(this.id)
                if (result) {
                    for (let key in this.formObj) {
                        if (result[key]!=='') {
                            if (key === 'samplingDate') {
                                this.formObj[key] = result[key] ? this.$dateformat(result[key], 'yyyy-mm-dd') : ''
                            } else {
                                this.formObj[key] = result[key]
                            }
                        }
                    }
                    for (let key in this.netTested) {
                        if (result.netTested[key]!=='') {
                            if (key === 'placeLink') {
                                this.place = result.netTested.placeLink + ',' + result.netTested.place
                            } else {
                                this.netTested[key] = result.netTested[key]
                            }
                        }
                    }
                    for (let key in this.sample) {
                        if (result.sample[key]!=='') {
                            if (key === 'sampleDate') {
                                this.sample[key] = result.sample[key] ? this.$dateformat(result.sample[key], 'yyyy-mm-dd') : ''
                            } else if(key==='storageCondition'){
                                this.storageCondition = result.sample[key].split(',')
                                this.sample[key] = result.sample[key]
                            } else {
                                this.sample[key] = result.sample[key]
                            }
                        }
                    }
                    this.testedType = result.testedType
                    this.shelfId = result.shelfId
                }
            },
            _goto() {
                this.$router.go(-1)
            },

        }
    }
</script>

<style lang="less">
    @import "../../styles/sampling-list-add.less";
</style>
