<template>
    <el-dialog
        :title="formTitle"
        width="900px"
        :visible.sync="visible"
        :before-close="_close"
    >
        <el-tabs v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="基础数据" name="first">
                <div>
                    <el-form :model="form" :rules="rules" ref="form" label-width="100px" style="display: flex;flex-wrap: wrap;justify-content: space-between;">
                        <el-form-item label="耗材名称 : " prop="name" style="width:100%">
                            <el-input v-model="form.good_name" placeholder="" maxlength="30"></el-input>
                        </el-form-item>
                        <el-form-item label="拼音 : " prop="name" style="width:50%">
                            <el-input v-model="form.pinyin" placeholder="" maxlength="30"></el-input>
                        </el-form-item>
                        <el-form-item label="五笔 : " prop="name" style="width:50%">
                            <el-input v-model="form.wubi" placeholder="" maxlength="30"></el-input>
                        </el-form-item>
                        <el-form-item label="耗材种类 : " prop="name">
                            <el-select v-model="form.good_kind" style="width:160px;" placeholder="请选择">
                                <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="耗材类型 : " prop="name">
                            <el-select v-model="form.good_type_id" style="width:160px;" placeholder="请选择">
                                <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="医保等级 : " prop="name">
                            <el-select v-model="form.medical_insurance_level" style="width:160px;" placeholder="请选择">
                                <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="规格型号 : " prop="name" style="width:100%">
                            <el-input v-model="form.specification_name" placeholder="" maxlength="30"></el-input>
                        </el-form-item>
                        <el-form-item label="生产厂商 : " prop="name" style="width:100%">
                            <el-select v-model="form.manufacturer" style="width:100%" placeholder="请选择">
                                <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="单位 : " prop="name">
                            <el-select v-model="form.good_unit" style="width:160px;" placeholder="请选择">
                                <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="零价 : " prop="name">
                            <el-input v-model="form.retail_price" style="width:160px;" placeholder="" maxlength="30"></el-input>
                        </el-form-item>
                        <el-form-item label="最新进价 : " prop="name">
                            <el-input v-model="form.buy_price" style="width:160px;" placeholder="" maxlength="30"></el-input>
                        </el-form-item>
                        <el-form-item label="库存警戒 : " prop="name">
                            <el-input v-model="form.stock_warn_count" style="width:160px;" placeholder="" maxlength="30"></el-input>
                        </el-form-item>
                        <el-form-item label="医保编码 : " prop="name">
                            <el-input v-model="form.medical_insurance_number" style="width:160px;" placeholder="" maxlength="30"></el-input>
                        </el-form-item>
                        <el-form-item label="是否特病目录:" prop="name">
                            <el-select v-model="form.is_special_diseases" style="width:160px;" placeholder="请选择">
                                <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="是否备案:" prop="name">
                            <el-select v-model="form.is_record" style="width:160px;" placeholder="请选择">
                                <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="统计分类:" prop="name">
                            <el-select v-model="from.statistics_category" style="width:160px;" placeholder="请选择">
                                <el-option
                                v-for="item in options"
                                :key="item.value"
                                :label="item.label"
                                :value="item.value">
                                </el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item label="代理商 : " prop="name" style="visibility: hidden;">
                            <el-input style="width:160px;" v-model="from.agent" placeholder="" maxlength="30"></el-input>
                        </el-form-item>



                        <el-form-item label="状态 : " prop="name">
                            <el-radio-group v-model="from.good_status">
                                <el-radio :label="1">停用</el-radio>
                                <el-radio :label="2">收费</el-radio>
                            </el-radio-group>
                        </el-form-item>
                        <el-form-item label="备注 : " prop="name" style="width:100%;">
                            <el-input type="textarea" :rows="2" placeholder="请输入内容" v-model="from.remark"></el-input>
                        </el-form-item>
                    </el-form>
                </div>
            </el-tab-pane>
            <el-tab-pane label="扩展数据" name="second">
                <el-form :model="form" :rules="rules" ref="form" label-width="120px" style="display: flex;flex-wrap: wrap;justify-content: space-between;">
                    <!--<el-form-item label="耗材类型 : " prop="name">-->
                        <!--<el-select v-model="value" style="width:160px;" placeholder="请选择">-->
                            <!--<el-option-->
                            <!--v-for="item in options"-->
                            <!--:key="item.value"-->
                            <!--:label="item.label"-->
                            <!--:value="item.value">-->
                            <!--</el-option>-->
                        <!--</el-select>-->
                    <!--</el-form-item>-->
                    <el-form-item label="默认使用数量:" prop="name">
                        <el-input v-model="form.default_count" style="width:160px;" placeholder="" maxlength="30"></el-input>
                    </el-form-item>
                    <el-form-item label="标签:" prop="name">
                        <el-select v-model="from.sign" style="width:160px;" placeholder="请选择">
                            <el-option
                            v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否默认:" prop="name">
                        <el-select v-model="from.is_default" style="width:160px;" placeholder="请选择">
                            <el-option
                            v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否收费常用项:" prop="name">
                        <el-select v-model="from.is_charge_use" style="width:160px;" placeholder="请选择">
                            <el-option
                            v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否收费预估项:" prop="name">
                        <el-select v-model="from.is_charge_predict" style="width:160px;" placeholder="请选择">
                            <el-option
                            v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="是否统计工作量:" prop="name">
                        <el-select v-model="from.is_statistics_work" style="width:160px;" placeholder="请选择">
                            <el-option
                            v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="收费项目排序:" prop="name">
                        <el-input v-model="form.sort" style="width:160px;" placeholder="" maxlength="30"></el-input>
                    </el-form-item>
                    <el-form-item label="是否常用医嘱:" prop="name">
                        <el-select v-model="from.is_use_doctor_advice" style="width:160px;" placeholder="请选择">
                            <el-option
                            v-for="item in options"
                            :key="item.value"
                            :label="item.label"
                            :value="item.value">
                            </el-option>
                        </el-select>
                    </el-form-item>
                    <el-form-item label="代理商:" prop="name">
                        <el-input v-model="form.agent" style="width:160px;" placeholder="" maxlength="30"></el-input>
                    </el-form-item>
                    <!--<el-form-item label="耗材编码:" prop="name">-->
                        <!--<el-input v-model="form.name" style="width:160px;" placeholder="" maxlength="30"></el-input>-->
                    <!--</el-form-item>-->
                    <el-form-item label="耗材编号:" prop="name">
                        <el-input v-model="form.good_number" style="width:160px;" placeholder="" maxlength="30"></el-input>
                    </el-form-item>

                </el-form>
            </el-tab-pane>
        </el-tabs>


        <div slot="footer" class="dialog-footer">
            <el-button @click="hide">取 消</el-button>
            <el-button type="primary"  @click="submitAction()">保 存</el-button>
        </div>
  </el-dialog>
</template>

<script>
export default {
    data(){
        return{
            visible:false,
            formTitle:'',
            activeName:'first',
            form:{
                name:''
            },
            options: [{
            value: '选项1',
            label: '黄金糕'
            }, {
            value: '选项2',
            label: '双皮奶'
            }, {
            value: '选项3',
            label: '蚵仔煎'
            }, {
            value: '选项4',
            label: '龙须面'
            }, {
            value: '选项5',
            label: '北京烤鸭'
            }],
            value: '',
            radio:'1'
        }
    },
    methods:{
        _close: function(done) {
            // this.clear()
            done()
        },
        clear: function() {
            this.form.id = 0;
            this.form.name = "";
            this.form.intro = "";
        },
        show(id) {
            // this.clear()
            this.visible = true
            if(id == 0){
                this.formTitle = '新增'
            }else{
                this.formTitle = '编辑'
            }
        },
        hide() {
            // this.clear()
            this.visible = false
        },
    }
}
</script>
