<template>
<el-dialog title="详情"
           :close-on-click-modal="false" append-to-body
           :visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
           width="1000px">
<el-row :gutter="15" class="">
<el-form ref="formRef" :model="dataForm" size="small" label-width="100px" label-position="right" >
    <template v-if="!loading">
            <el-col :span="12"  >
                <jnpf-form-tip-item  label="编号"
 prop="schemeNo"  >
                        <p>{{dataForm.schemeNo}}</p>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="12"  >
                <jnpf-form-tip-item  label="名称"
 prop="schemeName"  >
                        <p>{{dataForm.schemeName}}</p>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="12"  >
                <jnpf-form-tip-item  label="适用类型"
 prop="schemeType"  >
                        <p>{{dataForm.schemeType==1?"原材料":dataForm.schemeType==2?"半成品":"成品"}}</p>
                </jnpf-form-tip-item>
            </el-col>
      <el-col :span="12"  >
        <jnpf-form-tip-item  label="产品大类"
                             prop="tiemClass"  >
          <p>{{dataForm.tiemClass}}</p>
        </jnpf-form-tip-item>
      </el-col>
      <el-col :span="12"  >
        <jnpf-form-tip-item  label="表单编号"
                             prop="formCode"  >
          <p>{{dataForm.formCode}}</p>
        </jnpf-form-tip-item>
      </el-col>
      <el-col :span="12"  >
        <jnpf-form-tip-item  label="执行标准"
                             prop="execStandard"  >
          <p>{{dataForm.execStandard}}</p>
        </jnpf-form-tip-item>
      </el-col>
      <el-col :span="12"  >
        <jnpf-form-tip-item  label="属性检测"
                             prop="isAttDet"  >
          <p>{{dataForm.isAttDet=='Y'?"是":"否"}}</p>
        </jnpf-form-tip-item>
      </el-col>
            <el-col :span="12"  >
                <jnpf-form-tip-item  label="描述"
 prop="remark"  >
                        <p>{{dataForm.remark}}</p>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="12"  >
                <jnpf-form-tip-item  label="创建人"
 prop="creatorUserId"  >
                        <p>{{dataForm.creatorUserId}}</p>
                </jnpf-form-tip-item>
            </el-col>
            <el-col :span="12"  >
                <jnpf-form-tip-item  label="创建时间"
 prop="creatorTime"  >
                        <p>{{dataForm.creatorTime}}</p>
                </jnpf-form-tip-item>
            </el-col>
    <el-col :span="24"  >
    <jnpf-form-tip-item label-width="0">
            <div class="JNPF-common-title">
              <h2>设计子表</h2>
            </div>
    <el-table :data="dataForm.tableField114" size='mini'   >
        <el-table-column type="index" width="50" label="序号" align="center" />
            <el-table-column prop="itemId" label="检验项目" >
            <template slot-scope="scope">
                            <el-link :underline="false" type="primary"
                                     @click.native="toDetail(scope.row.itemId_id,'608540150753923141')">
                                {{scope.row.itemId}}</el-link>
        </template>
        </el-table-column>
            <el-table-column prop="unit" label="单位" >
            <template slot-scope="scope">
                            <p>{{scope.row.unit}}</p>
        </template>
        </el-table-column>
            <el-table-column prop="standardValue" label="标准值" >
            <template slot-scope="scope">
                            <p>{{scope.row.standardValue}}</p>
        </template>
        </el-table-column>
            <el-table-column prop="upperLimit" label="上限值" >
            <template slot-scope="scope">
                            <p>{{scope.row.upperLimit}}</p>
        </template>
        </el-table-column>
            <el-table-column prop="lowerLimit" label="下限值" >
            <template slot-scope="scope">
                            <p>{{scope.row.lowerLimit}}</p>
        </template>
        </el-table-column>
            <el-table-column prop="remark" label="备注" >
            <template slot-scope="scope">
                            <p>{{scope.row.remark}}</p>
        </template>
        </el-table-column>
      <el-table-column prop="seqNo" label="展示顺序" >
        <template slot-scope="scope">
          <p>{{scope.row.seqNo}}</p>
        </template>
      </el-table-column>
    </el-table>
    </jnpf-form-tip-item>
    </el-col>
    </template>
</el-form>
    </el-row>
    <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false"> 取 消</el-button>
    </span>
    <Detail v-if="detailVisible" ref="Detail" @close="detailVisible = false" />
    </el-dialog>
</template>
<script>
    import request from '@/utils/request'

    import { getConfigData } from '@/api/onlineDev/visualDev'
    import jnpf from '@/utils/jnpf'
    import Detail from '@/views/basic/dynamicModel/list/detail'
    import { thousandsFormat } from "@/components/Generator/utils/index"
    export default {
        components: { Detail},
        props: [],
        data() {
            return {
                visible: false,
                detailVisible: false,
                loading: false,

            dataForm: {
                id :'',
                            schemeNo : '',
                            schemeName : '',
                            schemeType : '',
                            remark : '',
                            creatorUserId : "",
                            creatorTime : "",
                        qa_scheme_base_twList:[],
            },

        }
        },
        computed: {},
        watch: {},
        created() {

        },
        mounted() {},
        methods: {
            toDetail(defaultValue, modelId) {
                if (!defaultValue) return
                getConfigData(modelId).then(res => {
                    if (!res.data || !res.data.formData) return
                    let formData = JSON.parse(res.data.formData)
                    formData.popupType = 'general'
                    this.detailVisible = true
                    this.$nextTick(() => {
                        this.$refs.Detail.init(formData, modelId, defaultValue)
                    })
                })
            },
            dataInfo(dataAll){
                let _dataAll =dataAll
                this.dataForm = _dataAll
            },

            init(id) {
                this.dataForm.id = id || 0;
                this.visible = true;
                this.$nextTick(() => {
                    if(this.dataForm.id){
                        this.loading = true
                        request({
                            url: '/api/example/Qa_scheme_base/detail/'+this.dataForm.id,
                            method: 'get'
                        }).then(res => {
                            this.dataInfo(res.data)
                            this.loading = false
                        })
                    }

                })
            },
        },
    }

</script>
