{
    template: '${tmpl}',
    data: function () {
        var validMethod = (rule, value, callback) => {
            return this.validfileds(rule, value, callback);
        };

        return {
            showDetail:false,
            applyStatusList:[],
            identityTypeList:[],
            eduTypeList:[],
            search: {
                list: [],
                currentPage: 1,
                pageSize: 20,
                total : 0,
                userName: '',
                mobile: '',
                identityType: '',
                sex:'',
                edu: '',
                age: '',
            },
            applyDetail: {
                id: '',
                eaccount: {},
            }
        }
    },
    mounted: function () {
        this.getApplyStatusList();
        this.getIdentityTypeList();
        this.getEduTypeList();
        this.resetSearch();
    },
    created: function () {
    },
    methods: {
        getApplyStatusList() {
            var self = this;
            this.$root.getReq("/web/metaCtl/getDicConfig",{"dicKey": "applyStatus"}).then(cfg=>{
                self.applyStatusList = [];
                Object.keys(cfg.data).forEach(key=>{
                    self.applyStatusList.push({"label":cfg.data[key],"value":key});
                });
            });
        },
        getIdentityTypeList() {
            var self = this;
            this.$root.getReq("/web/metaCtl/getDicConfig",{"dicKey": "identityType"}).then(cfg=>{
                self.identityTypeList = [];
                Object.keys(cfg.data).forEach(key=>{
                    self.identityTypeList.push({"label":cfg.data[key],"value":key});
                });
            });
        },
        getEduTypeList() {
            var self = this;
            this.$root.getReq("/web/metaCtl/getDicConfig",{"dicKey": "eduType"}).then(cfg=>{
                self.eduTypeList = [];
                Object.keys(cfg.data).forEach(key=>{
                    self.eduTypeList.push({"label":cfg.data[key],"value":key});
                });
            });
        },
        getEmptySearch() {
            return {
                list: [],
                currentPage: 1,
                pageSize: 20,
                total : 0,
                userName: '',
                mobile: '',
                identityType: '',
                sex:'',
                edu: '',
                age: '',
            }
        },
        resetSearch() {
            this.search = this.getEmptySearch();
            this.getList();
        },
        tableHeaderColor({ row, column, rowIndex, columnIndex }) {
            if (rowIndex === 0) {
                return 'background-color: #F5F5F5;color: #2F2F2F;font-size: 14px;font-weight:400;'
            }
        },
        opSearch() {
            this.getList();
        },
        getList() {
            var self = this;
            this.$root.postReq("/web/ejobapplyCtl/companyApplys", {
                search: this.getParams()
            }).then(function (d) {
                if (d.status == 0) {
                    self.search.list = d.data.rows || [];
                    self.search.total = d.data.count || 0;
                } else {
                }
            });
        },
        getParams() {
            var params = {};
            for(var f in this.search) {
                if(f == "list") {
                    continue;
                }
                params[f] = this.search[f];
            }
            return params;
        },
        onColFormater(row, column, cellValue, index) {
            return cellValue || "---";
        },

        handleSizeChange(val) {
            this.search.pageSize = val;
            this.resetSearch();
        },
        handleCurrentChange(val) {
            this.search.currentPage = val;
            this.getList();
        },
        validfileds(rule, value, callback) {
            return callback();
        },
        changeStatus() {
            this.curStatus = this.search.applyStatus;
            this.search.currentPage = 1;
            this.search.pageSize = 20;
            this.search.total = 0;
            this.getList();
        },
        openDetail(item) {
            this.applyDetail = item;
            this.showDetail = true;
        },
    },
    vname: "gsb-ejobapplys"
}