import { Prop, Provide, Emit, Model } from 'vue-property-decorator';
import { Subject, Subscription } from 'rxjs';
import { Watch, EditFormControlBase } from '@/studio-core';
import HREmployeeService from '@/service/hremployee/hremployee-service';
import MainService from './main-form-service';
import HREmployeeUIService from '@/uiservice/hremployee/hremployee-ui-service';
import { FormButtonModel, FormPageModel, FormItemModel, FormDRUIPartModel, FormPartModel, FormGroupPanelModel, FormIFrameModel, FormRowItemModel, FormTabPageModel, FormTabPanelModel, FormUserControlModel } from '@/model/form-detail';


/**
 * form部件基类
 *
 * @export
 * @class EditFormControlBase
 * @extends {MainEditFormBase}
 */
export class MainEditFormBase extends EditFormControlBase {

    /**
     * 获取部件类型
     *
     * @protected
     * @type {string}
     * @memberof MainEditFormBase
     */
    protected controlType: string = 'FORM';

    /**
     * 建构部件服务对象
     *
     * @type {MainService}
     * @memberof MainEditFormBase
     */
    public service: MainService = new MainService({ $store: this.$store });

    /**
     * 实体服务对象
     *
     * @type {HREmployeeService}
     * @memberof MainEditFormBase
     */
    public appEntityService: HREmployeeService = new HREmployeeService({ $store: this.$store });

    /**
     * 应用实体名称
     *
     * @protected
     * @type {string}
     * @memberof MainEditFormBase
     */
    protected appDeName: string = 'hremployee';

    /**
     * 应用实体中文名称
     *
     * @protected
     * @type {string}
     * @memberof MainEditFormBase
     */
    protected appDeLogicName: string = '员工';
    /**
     * 界面UI服务对象
     *
     * @type {HREmployeeUIService}
     * @memberof MainEditFormBase
     */  
    public appUIService:HREmployeeUIService = new HREmployeeUIService(this.$store);


    /**
     * 表单数据对象
     *
     * @type {*}
     * @memberof MainEditFormBase
     */
    public data: any = {
        srfupdatedate: null,
        srforikey: null,
        srfkey: null,
        srfmajortext: null,
        srftempmode: null,
        srfuf: null,
        srfdeid: null,
        srfsourcekey: null,
        employeename: null,
        employeecode: null,
        empstate: null,
        certtype: null,
        certnum: null,
        sex: null,
        birthday: null,
        age: null,
        nation: null,
        organizationname: null,
        photo: null,
        mobile: null,
        telephone: null,
        email: null,
        postaladdress: null,
        nativetype: null,
        nativeplace: null,
        marriage: null,
        bloodtype: null,
        nativeaddress: null,
        birthaddress: null,
        hobby: null,
        health: null,
        political: null,
        politicaltime: null,
        entrytype: null,
        startworktime: null,
        startorgtime: null,
        organizationid: null,
        employeeid: null,
        hremployee:null,
    };

    /**
     * 属性值规则
     *
     * @type {*}
     * @memberof MainEditFormBase
     */
    public rules: any = {
        employeename: [
            { required: true, type: 'string', message: '员工姓名 值不能为空', trigger: 'change' },
            { required: true, type: 'string', message: '员工姓名 值不能为空', trigger: 'blur' },
        ],
        employeecode: [
            { required: true, type: 'string', message: '员工编号 值不能为空', trigger: 'change' },
            { required: true, type: 'string', message: '员工编号 值不能为空', trigger: 'blur' },
        ],
        empstate: [
            { required: true, type: 'string', message: '员工状态 值不能为空', trigger: 'change' },
            { required: true, type: 'string', message: '员工状态 值不能为空', trigger: 'blur' },
        ],
        certtype: [
            { required: true, type: 'string', message: '证件类型 值不能为空', trigger: 'change' },
            { required: true, type: 'string', message: '证件类型 值不能为空', trigger: 'blur' },
        ],
        certnum: [
            { required: true, type: 'string', message: '证件号码 值不能为空', trigger: 'change' },
            { required: true, type: 'string', message: '证件号码 值不能为空', trigger: 'blur' },
        ],
    }

    /**
     * 属性值规则
     *
     * @type {*}
     * @memberof MainBase
     */
    public deRules:any = {
    };

    /**
     * 详情模型集合
     *
     * @type {*}
     * @memberof MainEditFormBase
     */
    public detailsModel: any = {
        grouppanel1: new FormGroupPanelModel({ caption: '分组面板', detailType: 'GROUPPANEL', name: 'grouppanel1', visible: true, isShowCaption: false, form: this, showMoreMode: 0, uiActionGroup: { caption: '', langbase: 'entities.hremployee.main_form', extractMode: 'ITEM', details: [] } }),

        grouppanel2: new FormGroupPanelModel({ caption: 'first', detailType: 'GROUPPANEL', name: 'grouppanel2', visible: true, isShowCaption: false, form: this, showMoreMode: 0, uiActionGroup: { caption: '', langbase: 'entities.hremployee.main_form', extractMode: 'ITEM', details: [] } }),

        grouppanel4: new FormGroupPanelModel({ caption: '联系信息', detailType: 'GROUPPANEL', name: 'grouppanel4', visible: true, isShowCaption: true, form: this, showMoreMode: 0, uiActionGroup: { caption: '', langbase: 'entities.hremployee.main_form', extractMode: 'ITEM', details: [] } }),

        grouppanel3: new FormGroupPanelModel({ caption: '补充信息', detailType: 'GROUPPANEL', name: 'grouppanel3', visible: true, isShowCaption: true, form: this, showMoreMode: 0, uiActionGroup: { caption: '', langbase: 'entities.hremployee.main_form', extractMode: 'ITEM', details: [] } }),

        grouppanel5: new FormGroupPanelModel({ caption: '工作相关', detailType: 'GROUPPANEL', name: 'grouppanel5', visible: true, isShowCaption: true, form: this, showMoreMode: 0, uiActionGroup: { caption: '', langbase: 'entities.hremployee.main_form', extractMode: 'ITEM', details: [] } }),

        group1: new FormGroupPanelModel({ caption: '基本信息', detailType: 'GROUPPANEL', name: 'group1', visible: true, isShowCaption: true, form: this, showMoreMode: 0, uiActionGroup: { caption: '', langbase: 'entities.hremployee.main_form', extractMode: 'ITEM', details: [] } }),

        formpage1: new FormPageModel({ caption: '基本信息', detailType: 'FORMPAGE', name: 'formpage1', visible: true, isShowCaption: true, form: this, showMoreMode: 0 }),

        srfupdatedate: new FormItemModel({ caption: '更新时间', detailType: 'FORMITEM', name: 'srfupdatedate', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        srforikey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srforikey', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        srfkey: new FormItemModel({ caption: '员工标识', detailType: 'FORMITEM', name: 'srfkey', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        srfmajortext: new FormItemModel({ caption: '员工姓名', detailType: 'FORMITEM', name: 'srfmajortext', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        srftempmode: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srftempmode', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        srfuf: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfuf', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        srfdeid: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfdeid', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        srfsourcekey: new FormItemModel({ caption: '', detailType: 'FORMITEM', name: 'srfsourcekey', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        employeename: new FormItemModel({ caption: '员工姓名', detailType: 'FORMITEM', name: 'employeename', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        employeecode: new FormItemModel({ caption: '员工编号', detailType: 'FORMITEM', name: 'employeecode', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        empstate: new FormItemModel({ caption: '员工状态', detailType: 'FORMITEM', name: 'empstate', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        certtype: new FormItemModel({ caption: '证件类型', detailType: 'FORMITEM', name: 'certtype', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        certnum: new FormItemModel({ caption: '证件号码', detailType: 'FORMITEM', name: 'certnum', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        sex: new FormItemModel({ caption: '性别', detailType: 'FORMITEM', name: 'sex', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        birthday: new FormItemModel({ caption: '出生日期', detailType: 'FORMITEM', name: 'birthday', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        age: new FormItemModel({ caption: '年龄', detailType: 'FORMITEM', name: 'age', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        nation: new FormItemModel({ caption: '民族', detailType: 'FORMITEM', name: 'nation', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        organizationname: new FormItemModel({ caption: '单位', detailType: 'FORMITEM', name: 'organizationname', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        photo: new FormItemModel({ caption: '照片', detailType: 'FORMITEM', name: 'photo', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        mobile: new FormItemModel({ caption: '移动电话', detailType: 'FORMITEM', name: 'mobile', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        telephone: new FormItemModel({ caption: '固定电话', detailType: 'FORMITEM', name: 'telephone', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        email: new FormItemModel({ caption: '电子邮箱', detailType: 'FORMITEM', name: 'email', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        postaladdress: new FormItemModel({ caption: '通讯地址', detailType: 'FORMITEM', name: 'postaladdress', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        nativetype: new FormItemModel({ caption: '户口类型', detailType: 'FORMITEM', name: 'nativetype', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        nativeplace: new FormItemModel({ caption: '籍贯', detailType: 'FORMITEM', name: 'nativeplace', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        marriage: new FormItemModel({ caption: '婚姻状况', detailType: 'FORMITEM', name: 'marriage', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        bloodtype: new FormItemModel({ caption: '血型', detailType: 'FORMITEM', name: 'bloodtype', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        nativeaddress: new FormItemModel({ caption: '户籍地址', detailType: 'FORMITEM', name: 'nativeaddress', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        birthaddress: new FormItemModel({ caption: '出生地', detailType: 'FORMITEM', name: 'birthaddress', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        hobby: new FormItemModel({ caption: '爱好特长', detailType: 'FORMITEM', name: 'hobby', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        health: new FormItemModel({ caption: '健康状况', detailType: 'FORMITEM', name: 'health', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        political: new FormItemModel({ caption: '政治面貌', detailType: 'FORMITEM', name: 'political', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        politicaltime: new FormItemModel({ caption: '入党时间', detailType: 'FORMITEM', name: 'politicaltime', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        entrytype: new FormItemModel({ caption: '入职渠道', detailType: 'FORMITEM', name: 'entrytype', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        startworktime: new FormItemModel({ caption: '参加工作时间', detailType: 'FORMITEM', name: 'startworktime', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        startorgtime: new FormItemModel({ caption: '到本单位时间', detailType: 'FORMITEM', name: 'startorgtime', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        organizationid: new FormItemModel({ caption: '组织ID', detailType: 'FORMITEM', name: 'organizationid', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

        employeeid: new FormItemModel({ caption: '员工标识', detailType: 'FORMITEM', name: 'employeeid', visible: true, isShowCaption: true, form: this, showMoreMode: 0, disabled: false, enableCond: 3 }),

    };
}