 <!-- 新增实验室人员信息弹窗 -->
<template>
    <div class="resource">
        <el-dialog
            @close="closeDialog"
            :visible.sync="dialogTableVisible"
            width='70%'
        >
            <div
                slot="title"
                class="titleBox"
            >
                <i
                    :class="formType === 0? 'el-icon-document':'el-icon-edit-outline'"
                    style="font-size: 20px"
                ></i>
                <span style="margin-left:10px;font-size:18px">{{formTypeDsc}}</span>
            </div>
            <!-- 表单 -->
            <el-form
                :model="formData"
                ref="formData"
                label-width="75px"
                size="mini"
                :rules="ruleValidate"
            >
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="职工编号"
                            prop="empNo"
                        >
                            <el-input
                                v-model="formData.empNo"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="职工姓名"
                            prop="empName"
                        >
                            <el-input
                                v-model="formData.empName"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="出生日期"
                            prop="birthday"
                        >
                            <el-date-picker
                                v-model="formData.birthday"
                                style="width:100%"
                                type="date"
                                placeholder="选择日期"
                                format="yyyy-MM-dd"
                                value-format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="性别"
                            prop="sex"
                        >
                            <el-radio-group
                                v-model="formData.sex"
                                style="width:100%"
                            >
                                <el-radio label="1">男</el-radio>
                                <el-radio label="0">女</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="民族"
                            prop="people"
                        >
                            <el-select
                                v-model="formData.people"
                                filterable
                                style="width:100%"
                                clearable
                                placeholder="请选择"
                            >
                                <el-option
                                    v-for="item in peopleList"
                                    :key="item.baseCode"
                                    :label="item.baseName"
                                    :value="item.baseName"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="政治面貌"
                            prop="politics"
                        >
                            <el-select
                                v-model="formData.politics"
                                filterable
                                style="width:100%"
                                clearable
                                placeholder="请选择"
                            >
                                <el-option
                                    v-for="(item,index) in politicsList"
                                    :key="index"
                                    :label="item.politics"
                                    :value="item.politics"
                                >
                                </el-option>
                            </el-select>
                            <!-- <el-input v-model="formData.politics" style="width:100%" placeholder="请输入"></el-input> -->
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="公司名称"
                            prop="companyNo"
                        >
                            <el-select
                                v-model="formData.companyNo"
                                filterable
                                style="width:100%"
                                collapse-tags
                                @change="selectDepartment(formData.companyNo,1)"
                                size="small"
                            >
                                <el-option
                                    v-for="item in companyNameType"
                                    :key="item.orgCode"
                                    :label="item.orgName"
                                    :value="item.orgCode"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            prop="deptNo"
                            label="部门名称"
                        >
                            <el-select
                                v-model="formData.deptNo"
                                filterable
                                clearable
                                style="width:100%"
                                @change="selectClass(formData.deptNo,1)"
                                collapse-tags
                                size="small"
                            >
                                <el-option
                                    v-for="item in sectionNameType"
                                    :key="item.orgCode"
                                    :label="item.orgName"
                                    :value="item.orgCode"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="班组名称">
                            <el-select
                                v-model="formData.sectionNo"
                                clearable
                                style="width:100%"
                                filterable
                                collapse-tags
                                size="small"
                            >
                                <el-option
                                    v-for="item in sectionClass"
                                    :key="item.orgCode"
                                    :label="item.orgName"
                                    :value="item.orgCode"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="岗位"
                            prop="postNo"
                        >
                            <el-select
                                v-model="formData.postNo"
                                filterable
                                style="width:100%"
                                clearable
                                placeholder="请选择"
                            >
                                <el-option
                                    v-for="(item, index) in usePostList"
                                    :key="index"
                                    :label="item.postName"
                                    :value="item.postNo"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="班值"
                            prop="wrkGrpCode"
                        >
                            <el-select
                                v-model="formData.wrkGrpCode"
                                filterable
                                style="width:100%"
                                clearable
                                placeholder="请选择"
                            >
                                <el-option
                                    v-for="(item, index) in wrkGrpNameList"
                                    :key="index"
                                    :label="item.baseName"
                                    :value="item.baseCode"
                                >
                                </el-option>
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="婚姻状况"
                            prop="marriage"
                        >
                            <el-input
                                v-model="formData.marriage"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="籍贯"
                            prop="birthPlace"
                        >
                            <el-input
                                v-model="formData.birthPlace"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="户籍地址"
                            prop="permanentAddr"
                        >
                            <el-input
                                v-model="formData.permanentAddr"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="身份证号"
                            prop="idCard"
                        >
                            <el-input
                                v-model="formData.idCard"
                                style="width:100%"
                                placeholder="请输入身份证号"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="联系电话"
                            prop="contactNumber"
                        >
                            <el-input
                                v-model="formData.contactNumber"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="联系地址"
                            prop="contactAddr"
                        >
                            <el-input
                                v-model="formData.contactAddr"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="紧急联系人"
                            style="white-space:nowrap"
                            prop="emergencyContact"
                        >
                            <el-input
                                v-model="formData.emergencyContact"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="紧急电话"
                            prop="emergencyNumber2"
                        >
                            <el-input
                                v-model="formData.emergencyNumber2"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="电子邮箱"
                            prop="email"
                        >
                            <el-input
                                v-model="formData.email"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="学历"
                            prop="eduDegree"
                        >
                            <el-input
                                v-model="formData.eduDegree"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="毕业院校"
                            prop="unvstGraduated"
                        >
                            <el-input
                                v-model="formData.unvstGraduated"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="专业名称"
                            prop="major"
                        >
                            <el-input
                                v-model="formData.major"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="毕业时间"
                            prop="graduationTime"
                        >
                            <el-date-picker
                                v-model="formData.graduationTime"
                                style="width:100%"
                                type="date"
                                placeholder="选择日期"
                                format="yyyy-MM-dd"
                                value-format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="职称"
                            prop="title"
                        >
                            <el-input
                                v-model="formData.title"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="外语等级"
                            prop="languageLevel"
                        >
                            <el-input
                                v-model="formData.languageLevel"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="计算机等级"
                            style="white-space:nowrap"
                            prop="computerLevel"
                        >
                            <el-input
                                v-model="formData.computerLevel"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="外语语种"
                            prop="foreignLanguage"
                        >
                            <el-input
                                v-model="formData.foreignLanguage"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="入职时间"
                            prop="entryDate"
                        >
                            <el-date-picker
                                v-model="formData.entryDate"
                                style="width:100%"
                                type="date"
                                placeholder="选择日期"
                                format="yyyy-MM-dd"
                                value-format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="转正日期"
                            prop="passedDate"
                        >
                            <el-date-picker
                                v-model="formData.passedDate"
                                style="width:100%"
                                type="date"
                                placeholder="选择日期"
                                format="yyyy-MM-dd"
                                value-format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="离职日期"
                            prop="leaveDate"
                        >
                            <el-date-picker
                                v-model="formData.leaveDate"
                                style="width:100%"
                                type="date"
                                placeholder="选择日期"
                                format="yyyy-MM-dd"
                                value-format="yyyy-MM-dd"
                            ></el-date-picker>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="工号"
                            prop="empno"
                        >
                            <el-input
                                v-model="formData.empno"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item label="员工照片">
                            <el-input
                                v-model="formData.photoDir.oldFileName"
                                size="small"
                                readonly
                                disabled
                                style="width: calc(100% - 50px); float:left; margin-right: 5px"
                            ></el-input>
                            <el-upload
                                class="upload"
                                action=""
                                :multiple="false"
                                :show-file-list="false"
                                accept=""
                                :http-request="httpRequest"
                            >
                                <el-button
                                    type="goon"
                                    size="mini"
                                    icon="el-icon-upload2"
                                ></el-button>
                            </el-upload>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="8">
                        <el-form-item
                            label="离职原因"
                            prop="leaveReason"
                        >
                            <el-input
                                v-model="formData.leaveReason"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="员工状态"
                            prop="empStatus"
                        >
                            <el-input
                                v-model="formData.empStatus"
                                style="width:100%"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item
                            label="备注"
                            prop="memo"
                        >
                            <el-input
                                size="mini"
                                style="width: 100%;"
                                v-model="formData.memo"
                                placeholder="请输入"
                            ></el-input>
                        </el-form-item>
                    </el-col>
                </el-row>
                <!-- <el-col :span="8" >
            <el-form-item label="入职时间" prop="entryDate">
              <el-date-picker v-model="formData.entryDate" type="date"></el-date-picker>
            </el-form-item>
        </el-col> -->
            </el-form>
            <br>
            <span
                slot="footer"
                class="dialog-footer"
            >
                <el-button
                    type="primary"
                    icon="el-icon-check"
                    size="mini"
                    @click="formType === 0 ? addData('formData'):modifyData()"
                >确定</el-button>
                <el-button
                    size="mini"
                    type="primary"
                    icon="el-icon-remove-outline"
                    @click="cancel"
                >取消</el-button>
            </span>
        </el-dialog>
    </div>
</template>
<script>
import { getCookie } from '@/utils/util.js';
import {
    cookieUserId,
    cookieUserName
} from '@/config/config.js';
let userName = getCookie(cookieUserName);
let userId = getCookie(cookieUserId);
export default {
    props: ['showFlag', 'Params'],
    data () {
        return {
            dialogTableVisible: false,
            formTypeDsc: '新增实验室人员信息',
            formType: 0,
            seen: true,
            seenNo: true,
            beInvalid: false,
            uploadFile: {},
            formData: {
                empNo: '',
                empName: '',
                birthday: '',
                sex: '1',
                people: '',
                politics: '群众',
                marriage: '未婚',
                birthPlace: '',
                idCard: '',
                permanentAddr: '',
                contactNumber: '',
                contactAddr: '',
                emergencyContact: '',
                emergencyNumber2: '',
                email: '',
                eduDegree: '',
                unvstGraduated: '',
                major: '',
                graduationTime: '',
                title: '',
                foreignLanguage: '',
                languageLevel: '',
                computerLevel: '',
                empno: '',
                deptNo: '',
                postNo: '',
                postGrade: '',
                entryDate: '',
                passedDate: '',
                leaveDate: '',
                leaveReason: '',
                empStatus: '',
                photoDir: { oldFileName: '', fileName: '' },
                memo: '',
                wrkGrpCode: ''
            },
            peopleList: [],
            sectionClass: [],
            wrkGrpNameList: [], //班组
            companyNameType: [],
            sectionNameType: [],
            usePostList: [],
            politicsList: [
                { politics: '党员' },
                { politics: '共青团员' },
                { politics: '群众' },
                { politics: '其他' },
            ],
            ruleValidate: {
                empNo: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'change'
                }],
                empName: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'change'
                }],
                companyNo: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'change'
                }],
                deptNo: [{
                    required: true,
                    message: '不能为空',
                    trigger: 'change'
                }],
            },
            fileUpload: {},
        }
    },
    created () {
        this.axios.post('pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode', { validFlag: 1, baseCode: 4843 }, { individualType: 'json' }).then(res => {
            this.peopleList = res.data;
            this.formData.people = this.peopleList.length > 0 ? this.peopleList[0].baseName : ''
        })
        this.axios.post('pass/baseManagement/v1/limsbaseinfos/queryBaseInfoByBaseCode', { validFlag: 1, baseCode: 4836 }, { individualType: 'json' }).then((res) => {
            this.wrkGrpNameList = res.data;
        });
        //获取公司
        this.axios.post("pass/baseManagement/v1/sysorgs/querySysOrgCompanyAll", {}, { individualType: 'json' }).then(response => {
            this.companyNameType = response.data
        });
        let obj = {
            'object': { validFlag: 1 },
            'pageIndex': 1,
            'pageSize': 99999
        }
        this.axios.post('pass/baseManagement/v1/limsbaseposts/queryLimsBasePostPage/', obj, { individualType: 'json' }).then(res => {
            this.usePostList = res.data.list;
        })
    },
    methods: {
        getCode (code, arr, codeKey, nameKey) {
            if (!code) {
                return '';
            }
            let targetRow = arr.find(item => {
                return item[codeKey] === code;
            });
            // console.log(targetRow, 'targetRow');
            return targetRow ? targetRow[nameKey] : '';
        },
        cancel () {
            this.formData = {
                empNo: '',
                empName: '',
                birthday: '',
                sex: '1',
                people: '',
                politics: '群众',
                marriage: '未婚',
                birthPlace: '',
                idCard: '',
                permanentAddr: '',
                contactNumber: '',
                contactAddr: '',
                emergencyContact: '',
                emergencyNumber2: '',
                email: '',
                eduDegree: '',
                unvstGraduated: '',
                major: '',
                graduationTime: '',
                title: '',
                foreignLanguage: '',
                languageLevel: '',
                computerLevel: '',
                empno: '',
                deptNo: '',
                postNo: '',
                postGrade: '',
                entryDate: '',
                passedDate: '',
                leaveDate: '',
                leaveReason: '',
                empStatus: '',
                photoDir: { oldFileName: '', fileName: '' },
                memo: '',
                wrkGrpCode: ''
            }
            this.fileUpload = {}
            this.formData.people = this.peopleList.length > 0 ? this.peopleList[0].baseName : ''
            this.dialogTableVisible = false;
        },
        //根据选中的公司，查询部门名称数据
        selectDepartment (val, index) {
            this.sectionNameType = []
            this.companyNameType.find(item => {
                if (val === item.orgCode) {
                    this.sectionNameType = item.sysOrgList || [];
                    if (index === 1) {
                        this.formData.deptNo = this.sectionNameType.length > 0 ? this.sectionNameType[0].orgCode : ''
                        this.selectClass(this.formData.deptNo, 1)
                    }
                }
            })
        },
        //根据选中的部门名称，查询班组名称
        selectClass (val, index) {
            this.sectionClass = []
            this.sectionNameType.find(item => {
                if (val === item.orgCode) {
                    this.sectionClass = item.sysOrgList || [];
                    if (index === 1) {
                        this.formData.sectionNo = this.sectionClass.length > 0 ? this.sectionClass[0].orgCode : ''
                    }
                }
            })
        },
        addData (formName) {
            this.$refs[formName].validate((valid) => {
                if (valid) {
                    this.formData.createMan = userName;
                    this.formData.createNo = userId;
                    //  this.formData[i].people = this.peopleList[this.formData[i].baseName]
                    this.formData.companyName = this.getCode(this.formData.companyNo, this.companyNameType, 'orgCode', 'orgName')
                    this.formData.deptName = this.getCode(this.formData.deptNo, this.sectionNameType, 'orgCode', 'orgName')
                    this.formData.sectionName = this.getCode(this.formData.sectionNo, this.sectionClass, 'orgCode', 'orgName')
                    this.formData.postName = this.getCode(this.formData.postNo, this.usePostList, 'postNo', 'postName')
                    this.formData.wrkGrpName = this.getCode(this.formData.wrkGrpCode,this.wrkGrpNameList,'baseCode','baseName')
                    this.axios.post('pass/baseManagement/v1/limslrcemps/', this.formData, { individualType: 'json' }).then(res => {
                        if (res.succeed) {
                            JSON.stringify(this.uploadFile) == '{}' ? '' : this.modifyFile(res.data)
                            this.dialogTableVisible = false;
                            this.$message.success('添加成功')
                            this.$emit('refresh')
                        } else {
                            this.$message.error(res.message)
                        }
                    }).catch(e => {
                        this.$message.error(e.message)
                    })
                }
            })
        },
        modifyData () {
            this.$refs['formData'].validate((valid) => {
                if (valid) {
                    this.formData.updateMan = userName;
                    this.formData.updateNo = userId;
                    this.formData.companyName = this.getCode(this.formData.companyNo, this.companyNameType, 'orgCode', 'orgName')
                    this.formData.deptName = this.getCode(this.formData.deptNo, this.sectionNameType, 'orgCode', 'orgName')
                    this.formData.sectionName = this.getCode(this.formData.sectionNo, this.sectionClass, 'orgCode', 'orgName')
                    this.formData.postName = this.getCode(this.formData.postNo, this.usePostList, 'postNo', 'postName')
                    this.formData.wrkGrpName = this.getCode(this.formData.wrkGrpCode,this.wrkGrpNameList,'baseCode','baseName')
                    this.axios.put('pass/baseManagement/v1/limslrcemps/', this.formData, { individualType: 'json' }).then(res => {
                        if (res.succeed) {
                            this.modifyFile()
                            this.dialogTableVisible = false;
                            this.$message.success('修改成功')
                            this.$emit('refresh')
                        } else {
                            this.$message.error(res.message)
                        }
                    }).catch(e => {
                        this.$message.error(e.message)
                    })
                }
            })
        },
        modifyFile () {
            let obj = {
                list: [
                    this.uploadFile.filePk
                ],
                object: {
                    objId: this.formData.empNo,
                    objName: "LIMS_LRC_EMP",
                }
            }
            this.axios.post('pass/baseManagement/v1/limslrcfilesaves/updateListLrcFileSave', obj, { individualType: 'json' }).then(res => {
                if (res.succeed) {
                    this.$message.success('上传成功')
                }
            })
        },
        httpRequest: function (e) {
            if (!e.file) {
                return false
            }
            let file = new FormData()
            file.append('file', e.file)
            let config = {
                headers: {
                    'Content-Type': 'multipart/form-data'
                }
            }
            this.axios.post('pass/baseManagement/v1/file/upload', file, config).then(res => {
                if (res.code === '0' || res.code === '200') {
                    this.uploadFile = res.data[0]
                    this.formData.photoDir.oldFileName = res.data[0].oldFileName
                    this.formData.photoDir.fileName = res.data[0].fileName
                } else {
                    this.$message.error(res.message)
                }
            }).catch(e => {
                this.$message.error(e.message)
            })
        },
        closeDialog () {
            this.formData = {
                empNo: '',
                empName: '',
                birthday: '',
                sex: '1',
                people: '',
                politics: '群众',
                marriage: '未婚',
                birthPlace: '',
                idCard: '',
                permanentAddr: '',
                contactNumber: '',
                contactAddr: '',
                emergencyContact: '',
                emergencyNumber2: '',
                email: '',
                eduDegree: '',
                unvstGraduated: '',
                major: '',
                graduationTime: '',
                title: '',
                foreignLanguage: '',
                languageLevel: '',
                computerLevel: '',
                empno: '',
                deptNo: '',
                postNo: '',
                postGrade: '',
                entryDate: '',
                passedDate: '',
                leaveDate: '',
                leaveReason: '',
                empStatus: '',
                photoDir: { oldFileName: '', fileName: '' },
                memo: '',
                wrkGrpCode: ''
            };
            this.fileUpload = {}
            this.formData.people = this.peopleList.length > 0 ? this.peopleList[0].baseName : ''
            this.dialogTableVisible = false;
        },
    },
    watch: {
        showFlag (arg) {
            if (this.Params !== null) {
                this.formData = Object.assign({}, this.Params);
                this.formData.photoDir = this.formData.photoDir || { oldFileName: '', fileName: '' };
                this.selectDepartment(this.formData.companyNo, 0)
                this.selectClass(this.formData.deptNo, 0)
                this.formType = 1;
                this.formTypeDsc = '修改实验室人员信息';
                this.seen = false;
                this.beInvalid = true;
            } else {
                this.formType = 0;
                this.formTypeDsc = '新增实验室人员信息';
                this.seenNo = false;
            }
            this.dialogTableVisible = true;
        }
    }
}
</script>
<style lang="less" scoped>
.tb-row {
    margin-bottom: 1px !important;
}
</style>