<template>
        <div class="testdiv">
            <div class="divborder" style="margin:0px;">
                <div>
                        <div class="filter">
                                <label >{{$t(600570)}}:</label>
                                <input class="publicinput" type="text"  v-model="chinaname">
                        </div>
                </div>
                <div>
                        <div class="filter">
                                <label >{{$t(600575)}}:</label>
                                <Select v-model="Industrycategory" label-in-value @on-change="Industrychange" clearable style="width:160px;" >
                                        <Option v-for="item in Industrylist" :value="item.id" :key="item.id">{{ item.name }}</Option>
                                </Select>
                                <Select v-model="Industrycategoryson" label-in-value  clearable style="width:160px;margin-left:10px;" >
                                        <Option v-for="item in Industrysonlist" :value="item.id" :key="item.id">{{ item.name }}</Option>
                                </Select>
                        </div>
                </div>
                <div>
                        <div class="filter">
                                <label >{{$t(500033)}}:</label>
                                <Select v-model="province" label-in-value @on-change="provincechange" clearable style="width:160px;" >
                                        <Option v-for="item in provincelist" :value="item.code"  :key="item.id">{{ item.name }}</Option>
                                </Select>
                                <Select v-model="city" label-in-value @on-change="citychange"  clearable style="width:160px;margin-left:10px;" >
                                        <Option v-for="item in citylist" :value="item.code" :key="item.id">{{ item.name }}</Option>
                                </Select>
                                <Select v-model="county" label-in-value  clearable style="width:160px;margin-left:10px;" >
                                        <Option v-for="item in countylist" :value="item.code" :key="item.id">{{ item.name }}</Option>
                                </Select>
                        </div>
                </div>
                <div class="buttonall">
                        <Button type="primary" @click="search(1,10)">查询</Button>
                        <Button type="primary" @click="add()">添加</Button>
                        <Button type="primary" @click="edit()">修改</Button>
                        <Button type="primary" @click="dele()">删除</Button>
                </div>
            </div>
        </div>
</template>
<script>
import axios from '@/libs/api.request'
export default {
    name: 'Businessmanagement', // 组件不刷新
    data () {
        return {
            chinaname: '',
            Industrycategory: '',
            Industrylist: [],
            Industrycategoryson: '',
            Industrysonlist: [],
            province: '',
            provincelist: [],
            city: '',
            citylist: [],
            county: '',
            countylist: [],
            page: 1,
            pagesize: 10
        }
    },
    created () {
        this.initIndustry()
        this.initprovince()
    },
    methods: {
        initIndustry () {
            axios.request({
                url: 'config/Industry/GetIndustryFirst',
                method: 'get'
            }).then(res => {
                if (res.data.ret === 1) {
                    this.Industrylist = res.data.data
                } else {
                    this.$Message.error(this.$t(res.data.msg))
                }
            })
        },
        Industrychange () {
            var params = { firstid: this.Industrycategory }
            axios.request({
                url: 'config/Industry/GetIndustrySecond',
                params,
                method: 'get'
            }).then(res => {
                if (res.data.ret === 1) {
                    this.Industrysonlist = res.data.data
                } else {
                    this.$Message.error(this.$t(res.data.msg))
                }
            })
        },
        initprovince () {
            var params = {
                type: 1,
                status: 1
            }
            axios.request({
                url: 'config/Location/GetLocation',
                params,
                method: 'get'
            }).then(res => {
                if (res.data.ret === 1) {
                    this.provincelist = res.data.data
                } else {
                    this.$Message.error(this.$t(res.data.msg))
                }
            })
        },
        provincechange () {
            var params = {
                type: 2,
                status: 1,
                province_code: this.province
            }
            axios.request({
                url: 'config/Location/GetLocation',
                params,
                method: 'get'
            }).then(res => {
                if (res.data.ret === 1) {
                    this.citylist = res.data.data
                } else {
                    this.$Message.error(this.$t(res.data.msg))
                }
            })
        },
        citychange () {
            var params = {
                type: 3,
                status: 1,
                city_code: this.city
            }
            axios.request({
                url: 'config/Location/GetLocation',
                params,
                method: 'get'
            }).then(res => {
                if (res.data.ret === 1) {
                    this.countylist = res.data.data
                } else {
                    this.$Message.error(this.$t(res.data.msg))
                }
            })
        },
        search (page, pagesize) {
            // var params = {
            //   page: page,
            //   pagesize: pagesize,
            //   chinesename: this.chinaname,
            //   industry_first: this.Industrycategory,
            //   industry_second: this.Industrycategoryson
            // }
        },
        add () {},
        delete () {},
        edit () {}

    }
}
</script>
<style lang="less" scoped>
label{
  width: 100px;
  display: inline-block;
  text-align: right;
}
</style>
