<template>
    <div class="view-product" v-cloak>
        <div class="animated fadeInRight">
            <div class="ibox-content">
                <layui-form>
	                <layui-fieldset label="数据信息管理审批">
	                	<template slot="main">
<!--		                								<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="国家ID" -->
<!--		                            placeholder="请输入国家ID"-->
<!--		                            v-model="geiAppDataWbTemp.countryId"></layui-inline-input>-->
<!--		                    </layui-item>-->
							<layui-item>
		                        <layui-inline-input
		                            label="国家名称(中文)"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.countryCnName"></layui-inline-input>
		                        <layui-inline-input
                                :readonly=true
                                :width="365"
		                            label="国家名称(英文)"
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.countryEnName"></layui-inline-input>
		                    </layui-item>
							<layui-item>
<!--		                        <layui-inline-input-->
<!--                                :readonly=true-->
<!--                                :cssStyle="{width: '537px', display: 'inline-block'}"-->
<!--		                            label="国家类型"-->
<!--		                            v-model="geiAppDataWbTemp.countryType"></layui-inline-input>-->

<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="指标ID" -->
<!--		                            placeholder="请输入指标ID"-->
<!--		                            v-model="geiAppDataWbTemp.indexId"></layui-inline-input>-->
<!--		                    </layui-item>-->

		                        <layui-inline-input
		                            label="指标名称(中文)"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.indexCnName"></layui-inline-input>

		                        <layui-inline-input
		                            label="指标名称(英文)"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.indexEnName"></layui-inline-input>
		                    </layui-item>
<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="指标编号" -->
<!--		                            placeholder="请输入指标编号"-->
<!--		                            v-model="geiAppDataWbTemp.indexCode"></layui-inline-input>-->
<!--		                    </layui-item>-->
							<layui-item>
		                        <layui-inline-input
		                            label="年份"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.dataYear"></layui-inline-input>

		                        <layui-inline-input
		                            label="季度"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.dataQuarter"></layui-inline-input>
		                    </layui-item>
							<layui-item>
		                        <layui-inline-input
		                            label="月份"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.dataMonth"></layui-inline-input>
		                   <layui-inline-input
		                            label="星期"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.dataWeek"></layui-inline-input>
		                    </layui-item>
							<layui-item>
		                        <layui-inline-input
		                            label="值"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.dataValue"></layui-inline-input>

		                        <layui-inline-input
		                            label="原始值"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.dataFormattedValue"></layui-inline-input>
		                    </layui-item>
<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="单位ID"-->
<!--                                :readonly=true-->
<!--                                :cssStyle="{width: '537px', display: 'inline-block'}"-->
<!--		                            v-model="geiAppDataWbTemp.unitId"></layui-inline-input>-->
<!--		                    </layui-item>-->
							<layui-item>
		                        <layui-inline-input
		                            label="单位名称(中文)"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.unitCnName"></layui-inline-input>

		                        <layui-inline-input
		                            label="单位名称(英文)"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.unitEnName"></layui-inline-input>
		                    </layui-item>
<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="数据来源ID" -->
<!--		                            placeholder="请输入数据来源ID"-->
<!--		                            v-model="geiAppDataWbTemp.sourceId"></layui-inline-input>-->
<!--		                    </layui-item>-->

							<layui-item>
		                        <layui-inline-input
		                            label="所属区域"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.areaName"></layui-inline-input>

		                        <layui-inline-input
		                            label="所属洲"
                                :readonly=true
                                :cssStyle="{width: '537px', display: 'inline-block'}"
		                            v-model="geiAppDataWbTemp.continentName"></layui-inline-input>
		                    </layui-item>
                      <layui-item>
                        <layui-inline-input
                            label="数据来源名称"
                            :readonly=true
                            :cssStyle="{width: '537px', display: 'inline-block'}"
                            v-model="geiAppDataWbTemp.sourceName"></layui-inline-input>
                      </layui-item>
<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="备注"-->
<!--                                :readonly=true-->
<!--		                            placeholder="请输入备注"-->
<!--		                            v-model="geiAppDataWbTemp.remark"></layui-inline-input>-->
<!--		                    </layui-item>-->
<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="创建人"-->
<!--                                :readonly=true-->
<!--                                :cssStyle="{width: '537px', display: 'inline-block'}"-->
<!--		                            v-model="geiAppDataWbTemp.createBy"></layui-inline-input>-->
<!--		                    </layui-item>-->
<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="创建时间"-->
<!--                                :readonly=true-->
<!--                                :cssStyle="{width: '537px', display: 'inline-block'}"-->
<!--		                            v-model="geiAppDataWbTemp.createDate"></layui-inline-input>-->
<!--		                    </layui-item>-->
<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="修改人"-->
<!--                                :readonly=true-->
<!--                                :cssStyle="{width: '537px', display: 'inline-block'}"-->
<!--		                            v-model="geiAppDataWbTemp.updateBy"></layui-inline-input>-->
<!--		                    </layui-item>-->
<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="修改时间"-->
<!--                                :readonly=true-->
<!--                                :cssStyle="{width: '537px', display: 'inline-block'}"-->
<!--		                            v-model="geiAppDataWbTemp.updateDate"></layui-inline-input>-->
<!--		                    </layui-item>-->
<!--							<layui-item>-->
<!--		                        <layui-inline-input-->
<!--		                            label="是否删除"-->
<!--                                :readonly=true-->
<!--		                            placeholder="请输入是否删除"-->
<!--		                            v-model="geiAppDataWbTemp.isDelete"></layui-inline-input>-->
<!--		                    </layui-item>-->
						</template>
					</layui-fieldset>
					<layui-inline class="btn-group-center">
                        <button v-if="canEdit != true" class="layui-btn layui-btn-lg layui-btn-blue" lay-submit lay-filter="saveGeiAppDataWbTemp"><i class="fa fa-save"></i> 审批通过</button>
                        <button v-if="canEdit != true" class="layui-btn layui-btn-lg layui-btn-blue" lay-submit lay-filter="reject"><i class="fa fa-arrow-left"></i> 驳回</button>
                        <button @click="close" class="layui-btn layui-btn-lg layui-btn-red"><i class="fa fa-times"></i> 关闭</button>
                    </layui-inline>
                </layui-form>
            </div>
        </div>
	</div>
</template>

<script>
import { getDicts } from '@/api/dict'
import { saveOrUpdate, get } from '@/api/operation/gei/geiAppDataWbTemp'
import Base from "@/views/base/Base"

export default {
	name: 'GeiAppDataWbTempForm',
	extends: Base,
    data () {
        return {
          canEdit: this.$route.params.canEdit,
            geiAppDataWbTemp: {
                id: this.$route.params.id,
				countryId: '',
				countryCnName: '',
				countryEnName: '',
				countryType: '',
				indexId: '',
				indexCnName: '',
				indexEnName: '',
				indexCode: '',
				dataYear: '',
				dataQuarter: '',
				dataMonth: '',
				dataWeek: '',
				dataValue: '',
				dataFormattedValue: '',
				unitId: '',
				unitCnName: '',
				unitEnName: '',
				sourceId: '',
				sourceName: '',
				areaName: '',
				continentName: '',
				remark: '',
				createBy: '',
				createDate: '',
				updateBy: '',
				updateDate: '',
				isDelete: '',
            },
        }
    },
    computed: {
       	
	},
	watch: {
        
    },
    mounted () {
        this.initData();
		this.$nextTick(() => {
			this.layuiInit();
		});
    },
    methods: {
    	save: function(){
    		this.submitHandler((token) => {
    		  this.geiAppDataWbTemp.isDelete= "1"
	            saveOrUpdate(JSON.stringify(this.geiAppDataWbTemp), token).then(result => {
	                alert(result.msg);
	                this.backListView(this.geiAppDataWbTemp.id == null);
	            }).catch((error) => {
	                // 此处你的业务代码
	                this.resetToken();
	            });
    		});
    	},
      //审批通过
      approval: function(){
        this.submitHandler((token) => {
          this.geiAppDataWbTemp.isDelete= "2"
          saveOrUpdate(JSON.stringify(this.geiAppDataWbTemp), token).then(result => {
            alert(result.msg);
            this.backListView(this.geiAppDataWbTemp.id == null);
          }).catch((error) => {
            // 此处你的业务代码
            this.resetToken();
          });
        });
      },
        initData: function(){
            if(this.geiAppDataWbTemp.id){
                get(this.geiAppDataWbTemp.id).then(result => {
                    var data = result.data;
                    if(data) {
                        this.geiAppDataWbTemp =  data.geiAppDataWbTemp || this.geiAppDataWbTemp;
                    }
                });
            }
            
        	getDicts('').then(result => {
                var data = result.data;
                if(data){
                }
            });
        },
        layuiInit: function(){
            var _this = this;
        	layui.use(['element', 'form'], function(){
        		var element = element
        		,form = layui.form;

				//自定义验证规则
				form.verify({
					title: function(value){
					    if(value.length < 10){
					    	return '标题至少得10个字符哟';
					    }
					}
					,content: function(value){
					    layedit.sync(editIndex);
					}
				});

				form.on('submit(saveGeiAppDataWbTemp)', function(){
					_this.save();
					return false;
				});
            form.on('submit(reject)', function(){
              _this.approval();
              return false;
            });
        	});
        }
    }
}
</script>

<style scoped>

</style>