Browse Source

人员新建/编辑可关联培训

cfort 2 years ago
parent
commit
d23bd6e358

+ 92 - 47
src/views/platform/org/employee/edit/basic-info.vue

@@ -8,11 +8,7 @@
                     <div
                     <div
                         v-if="!readonly"
                         v-if="!readonly"
                         :class="formData.photo !== '' ? 'handle-photo-buttons' : null"
                         :class="formData.photo !== '' ? 'handle-photo-buttons' : null"
-                        @click.stop="
-                            () => {
-                                dialogFormVisible = false
-                            }
-                        "
+                        @click.stop="() => { dialogFormVisible = false }"
                     >
                     >
                         <div v-if="formData.photo !== ''">
                         <div v-if="formData.photo !== ''">
                             <i class="el-icon-edit" @click.stop="dialogFormVisible = !readonly" />
                             <i class="el-icon-edit" @click.stop="dialogFormVisible = !readonly" />
@@ -22,31 +18,50 @@
                 </span>
                 </span>
             </div>
             </div>
             <span v-if="!readonly" class="operation">点击上方进行头像操作</span>
             <span v-if="!readonly" class="operation">点击上方进行头像操作</span>
-            <ibps-uploader :visible="dialogFormVisible" :limit="limit" :accept="accept" @action-event="uploaderAction" @close="(visible) => (dialogFormVisible = visible)" />
+            <ibps-uploader
+                :visible="dialogFormVisible"
+                :limit="limit"
+                :accept="accept"
+                @action-event="uploaderAction"
+                @close="(visible) => (dialogFormVisible = visible)"
+            />
         </el-col>
         </el-col>
         <el-col :span="16">
         <el-col :span="16">
-            <el-form ref="employeeForm" :rules="rules" :model="formData" label-width="130px" @submit.native.prevent>
+            <el-form
+                ref="employeeForm"
+                :rules="rules"
+                :model="formData"
+                label-width="130px"
+                @submit.native.prevent
+            >
                 <input type="password" style="width: 0; height: 0; line-height: 0; padding: 0; border-width: 0">
                 <input type="password" style="width: 0; height: 0; line-height: 0; padding: 0; border-width: 0">
                 <el-form-item label="账号" prop="account">
                 <el-form-item label="账号" prop="account">
                     <el-input v-if="!readonly" v-model="formData.account" autocomplete="off" clearable />
                     <el-input v-if="!readonly" v-model="formData.account" autocomplete="off" clearable />
                     <span v-else>{{ formData.account }}</span>
                     <span v-else>{{ formData.account }}</span>
                 </el-form-item>
                 </el-form-item>
                 <el-form-item v-show="!formData.id" label="密码" :prop="!formData.id ? 'password' : ''">
                 <el-form-item v-show="!formData.id" label="密码" :prop="!formData.id ? 'password' : ''">
-                    <el-input v-if="!readonly" v-model="formData.password" autocomplete="off" type="password" show-password clearable />
+                    <el-input
+                        v-if="!readonly"
+                        v-model="formData.password"
+                        autocomplete="off"
+                        type="password"
+                        show-password
+                        clearable
+                    />
                     <span v-else>{{ formData.password }}</span>
                     <span v-else>{{ formData.password }}</span>
                 </el-form-item>
                 </el-form-item>
                 <!-- <el-form-item label="是否管理员" prop="isSuper">
                 <!-- <el-form-item label="是否管理员" prop="isSuper">
-          <el-switch
-            v-if="!readonly"
-            v-model="formData.isSuper"
-            :disabled="isSuper?false:formData.id===''&&isSuper?false:true"
-            active-value="Y"
-            inactive-value="N"
-          />
-          <el-tag v-else :type="formData.isSuper|optionsFilter(isSuperOptions,'type')">
-            {{ formData.isSuper|optionsFilter(isSuperOptions,'label') }}
-          </el-tag>
-        </el-form-item> -->
+                    <el-switch
+                        v-if="!readonly"
+                        v-model="formData.isSuper"
+                        :disabled="isSuper?false:formData.id===''&&isSuper?false:true"
+                        active-value="Y"
+                        inactive-value="N"
+                    />
+                    <el-tag v-else :type="formData.isSuper|optionsFilter(isSuperOptions,'type')">
+                        {{ formData.isSuper|optionsFilter(isSuperOptions,'label') }}
+                    </el-tag>
+                </el-form-item> -->
                 <el-form-item label="单位名称">
                 <el-form-item label="单位名称">
                     <el-input v-if="!readonly" v-model="formData.qq" clearable />
                     <el-input v-if="!readonly" v-model="formData.qq" clearable />
                     <span v-else>{{ formData.qq }}</span>
                     <span v-else>{{ formData.qq }}</span>
@@ -84,14 +99,14 @@
                 <el-form-item>
                 <el-form-item>
                     <template slot="label">
                     <template slot="label">
                         用户类型
                         用户类型
-                        <help-tip :title="formAsterisk.title" :content="formAsterisk.content"/>
+                        <help-tip :title="formAsterisk.title" :content="formAsterisk.content" />
                     </template>
                     </template>
                     <el-radio-group v-if="!readonly" v-model="formData.jiNengZhiCheng">
                     <el-radio-group v-if="!readonly" v-model="formData.jiNengZhiCheng">
                         <el-radio label="inside">内部员工</el-radio>
                         <el-radio label="inside">内部员工</el-radio>
                         <el-radio label="ordinary">临床医护</el-radio>
                         <el-radio label="ordinary">临床医护</el-radio>
                     </el-radio-group>
                     </el-radio-group>
                     <el-tag v-else>
                     <el-tag v-else>
-                        {{ formData.jiNengZhiCheng == 'ordinary' ? '临床医护' : '内部员工'}}
+                        {{ formData.jiNengZhiCheng == 'ordinary' ? '临床医护' : '内部员工' }}
                     </el-tag>
                     </el-tag>
                 </el-form-item>
                 </el-form-item>
                 <el-form-item label="邮箱" prop="email">
                 <el-form-item label="邮箱" prop="email">
@@ -107,22 +122,53 @@
                     <el-input v-if="!readonly || formType== 'part'" v-model="formData.mobile" clearable />
                     <el-input v-if="!readonly || formType== 'part'" v-model="formData.mobile" clearable />
                     <span v-else>{{ formData.mobile }}</span>
                     <span v-else>{{ formData.mobile }}</span>
                 </el-form-item>
                 </el-form-item>
+                <el-form-item v-if="!readonly">
+                    <template slot="label">
+                        入职/转岗培训
+                        <help-tip title="" content="开启时,保存数据后将为当前用户开启入职/转岗培训" />
+                    </template>
+                    <el-switch
+                        v-model="formData.isTrain"
+                        active-value="Y"
+                        active-text="开启"
+                        inactive-value="N"
+                        inactive-text="关闭"
+                        @change="value => { formData.isTrain = value }"
+                    />
+                </el-form-item>
+                <el-form-item v-if="!readonly && formData.isTrain === 'Y'" label="培训类型" required>
+                    <el-select v-model="formData.trainType" clearable placeholder="请选择" style="width: 100%">
+                        <el-option label="新员工" value="新员工" />
+                        <el-option label="转岗人员" value="转岗人员" />
+                        <el-option label="教学实习人员" value="教学实习人员" />
+                    </el-select>
+                </el-form-item>
+                <el-form-item v-if="!readonly && formData.isTrain === 'Y'" label="带教老师" required>
+                    <ibps-custom-dialog
+                        v-model="formData.teacher"
+                        size="mini"
+                        template-key="gjxcxryk"
+                        style="width: 200px;"
+                        :multiple="false"
+                        type="dialog"
+                        placeholder="请选择培训人员带教老师"
+                    />
+                </el-form-item>
             </el-form>
             </el-form>
         </el-col>
         </el-col>
     </el-row>
     </el-row>
 </template>
 </template>
 <script>
 <script>
-import helpTip from '@/business/platform/form/formbuilder/right-aside/components/help-tip.vue'
 import { fileUrl } from '@/api/platform/file/attachment'
 import { fileUrl } from '@/api/platform/file/attachment'
 import { getDefaultUserSecurity } from '@/api/platform/auth/userSecurity'
 import { getDefaultUserSecurity } from '@/api/platform/auth/userSecurity'
-import IbpsUploader from '@/business/platform/file/uploader'
 import { genderOptions, statusOptions, isSuperOptions, userSecurityTextObj, regx } from '../constants'
 import { genderOptions, statusOptions, isSuperOptions, userSecurityTextObj, regx } from '../constants'
 import { getFile } from '@/utils/avatar'
 import { getFile } from '@/utils/avatar'
 import { validateEmpty } from '@/utils/validate'
 import { validateEmpty } from '@/utils/validate'
 export default {
 export default {
     components: {
     components: {
-        IbpsUploader,
-        helpTip
+        IbpsUploader: () => import('@/business/platform/file/uploader'),
+        helpTip: () => import('@/business/platform/form/formbuilder/right-aside/components/help-tip.vue'),
+        IbpsCustomDialog: () => import('@/business/platform/data/templaterender/custom-dialog')
     },
     },
     props: {
     props: {
         data: Object,
         data: Object,
@@ -171,10 +217,11 @@ export default {
             if (value !== undefined) {
             if (value !== undefined) {
                 if (this.userSecurity.complexity.length === 0) {
                 if (this.userSecurity.complexity.length === 0) {
                     // if (!re.test(value)) {
                     // if (!re.test(value)) {
-                    //   callback(new Error('密码必须是由数字字母组成,至少1位'))
+                    //     callback(new Error('密码必须是由数字字母组成,至少1位'))
                     // } else {
                     // } else {
-                    callback()
+                    //     callback()
                     // }
                     // }
+                    callback()
                 } else {
                 } else {
                     const flag = []
                     const flag = []
                     for (var l in complexityRegular) {
                     for (var l in complexityRegular) {
@@ -244,11 +291,11 @@ export default {
                 ],
                 ],
                 status: [{ required: true, message: this.$t('validate.required') }],
                 status: [{ required: true, message: this.$t('validate.required') }],
                 gender: [{ required: true, message: this.$t('validate.required') }]
                 gender: [{ required: true, message: this.$t('validate.required') }]
-                /* email: [
-          { required: true, message: this.$t('validate.required') },
-          { type: 'email', message: '请输入正确的邮箱地址', min: 3, max: 18, trigger: ['blur', 'change'] },
-          { validator: validateEmail, trigger: 'blur' }
-        ] */
+                // email: [
+                //     { required: true, message: this.$t('validate.required') },
+                //     { type: 'email', message: '请输入正确的邮箱地址', min: 3, max: 18, trigger: ['blur', 'change'] },
+                //     { validator: validateEmail, trigger: 'blur' }
+                // ]
             }
             }
         }
         }
     },
     },
@@ -284,22 +331,20 @@ export default {
     },
     },
     methods: {
     methods: {
         handleGetDefaultUserSecurity () {
         handleGetDefaultUserSecurity () {
-            getDefaultUserSecurity()
-                .then((response) => {
-                    const userSecurityTextObj = this.userSecurityTextObj
-                    const complexityArr = response.data.complexity.split(',').sort()
-                    const arr = []
-                    complexityArr.forEach((i) => {
-                        arr.push(userSecurityTextObj[parseInt(i)])
-                    })
-                    this.userSecurity.complexity = complexityArr
-                    this.userSecurity.complexityText = arr.join(',')
-                    this.userSecurity.maxLength = response.data.maxLength
-                    this.userSecurity.maxLengthText = '最大长度' + response.data.maxLength
-                    this.userSecurity.minLength = response.data.minLength
-                    this.userSecurity.minLengthText = '最小长度' + response.data.minLength
+            getDefaultUserSecurity().then((response) => {
+                const userSecurityTextObj = this.userSecurityTextObj
+                const complexityArr = response.data.complexity.split(',').sort()
+                const arr = []
+                complexityArr.forEach((i) => {
+                    arr.push(userSecurityTextObj[parseInt(i)])
                 })
                 })
-                .catch(() => {})
+                this.userSecurity.complexity = complexityArr
+                this.userSecurity.complexityText = arr.join(',')
+                this.userSecurity.maxLength = response.data.maxLength
+                this.userSecurity.maxLengthText = '最大长度' + response.data.maxLength
+                this.userSecurity.minLength = response.data.minLength
+                this.userSecurity.minLengthText = '最小长度' + response.data.minLength
+            }).catch(() => {})
         },
         },
         /**
         /**
          * 表单验证
          * 表单验证

+ 53 - 27
src/views/platform/org/employee/edit/index.vue

@@ -137,7 +137,7 @@ export default {
         span: [Number, String]
         span: [Number, String]
     },
     },
     data () {
     data () {
-        const isSuper = this.$store.getters.isSuper
+        const { isSuper } = this.$store.getters
         return {
         return {
             isSuper,
             isSuper,
             info: [],
             info: [],
@@ -170,7 +170,7 @@ export default {
             toolbars: [
             toolbars: [
                 {
                 {
                     key: 'save',
                     key: 'save',
-                    hidden: () => { return this.readonly && this.formType == 'detail' }
+                    hidden: () => { return this.readonly && this.formType === 'detail' }
                 },
                 },
                 { key: 'cancel' }
                 { key: 'cancel' }
             ]
             ]
@@ -249,9 +249,9 @@ export default {
                 account: this.employee.account
                 account: this.employee.account
             }
             }
             upEmployee(params).then(res => {
             upEmployee(params).then(res => {
-                if (res.state == 200) {
+                if (res.state === 200) {
                     const data = res.variables.data
                     const data = res.variables.data
-                    if (data == 'Y') {
+                    if (data === 'Y') {
                         this.saveData()
                         this.saveData()
                     } else {
                     } else {
                         ActionUtils.warning(res.message)
                         ActionUtils.warning(res.message)
@@ -259,6 +259,35 @@ export default {
                 }
                 }
             })
             })
         },
         },
+        createTrain (id) {
+            const { isTrain, trainType, teacher, jianDingZiGeZ } = this.employee || {}
+            const { first, second } = this.$store.getters.level || {}
+            const { userList } = this.$store.getters || {}
+            if (isTrain !== 'Y') {
+                return
+            }
+            const time = this.$common.getDateNow(19)
+            const userInfo = userList.find(item => item.userId === teacher) || {}
+            const addTrainData = {
+                tableName: 't_lhgqpxjh',
+                paramWhere: [{
+                    di_dian_: second || first,
+                    nian_du_: time.slice(4),
+                    bian_zhi_bu_men_: userInfo ? userInfo.positionId.split(',').pop() : '',
+                    bian_zhi_ren_: teacher,
+                    bian_zhi_shi_jian: time,
+                    shi_fou_guo_shen_: '已编制',
+                    bu_men_: '',
+                    pei_xun_lei_xing_: trainType,
+                    ru_zhi_zhuan_gang: time,
+                    yuan_gong_xing_mi: id,
+                    gong_hao_: jianDingZiGeZ
+                }],
+                formKey: 'lhgqpxypjb',
+                defKey: 'Process_1a66tzk'
+            }
+            this.$common.request('add', addTrainData)
+        },
         saveData () {
         saveData () {
             const attrValidator = this.$refs['attrInfo'] && this.isSuper ? this.$refs['attrInfo'].callback() : null
             const attrValidator = this.$refs['attrInfo'] && this.isSuper ? this.$refs['attrInfo'].callback() : null
             const vo = this.formatSubmitData()
             const vo = this.formatSubmitData()
@@ -288,26 +317,19 @@ export default {
                 this.dialogLoading = false
                 this.dialogLoading = false
                 return
                 return
             }
             }
-            // 部门信息
-            if (vo.positionVoList.length > 0) {
-                const list = []
-                vo.positionVoList.forEach(item => {
-                    list.push(item.id)
-                })
-                vo.user.positions = list.join(',')
-            } else {
-                vo.user.positions = ''
+            const { isTrain, trainType, teacher } = this.employee || {}
+            if (isTrain === 'Y' && !trainType) {
+                this.dialogLoading = false
+                return ActionUtils.warning('请选择培训类型')
             }
             }
-            // 角色信息
-            if (vo.roleVoList.length > 0) {
-                const list = []
-                vo.roleVoList.forEach(item => {
-                    list.push(item.id)
-                })
-                vo.user.job = list.join(',')
-            } else {
-                vo.user.job = ''
+            if (isTrain === 'Y' && !teacher) {
+                this.dialogLoading = false
+                return ActionUtils.warning('请选择带教老师')
             }
             }
+            // 部门信息
+            vo.user.positions = vo.positionVoList.length ? vo.positionVoList.map(i => i.id).join(',') : ''
+            // 角色信息
+            vo.user.job = vo.roleVoList.length ? vo.roleVoList.map(i => i.id).join(',') : ''
             // 更新该表的job_字段
             // 更新该表的job_字段
             const updateParams = {
             const updateParams = {
                 tableName: 'ibps_party_employee',
                 tableName: 'ibps_party_employee',
@@ -323,9 +345,6 @@ export default {
                     }
                     }
                 ]
                 ]
             }
             }
-            this.$common.request('update', updateParams).then(() => {
-                console.log('更新数据成功')
-            })
 
 
             if (this.formId) {
             if (this.formId) {
                 update(vo).then(response => {
                 update(vo).then(response => {
@@ -333,6 +352,10 @@ export default {
                     if (this.wxyhId) {
                     if (this.wxyhId) {
                         this.updateWxyh()
                         this.updateWxyh()
                     }
                     }
+                    // 更新部门、岗位数据
+                    this.$common.request('update', updateParams)
+                    // 启动培训
+                    this.createTrain(response.variables.id)
                     this.$emit('dialog-callback', this)
                     this.$emit('dialog-callback', this)
                     ActionUtils.saveSuccessMessage(response.message, r => {
                     ActionUtils.saveSuccessMessage(response.message, r => {
                         // if (this.$utils.isEmpty(this.formId)) {
                         // if (this.$utils.isEmpty(this.formId)) {
@@ -349,6 +372,10 @@ export default {
             } else {
             } else {
                 create(vo).then(response => {
                 create(vo).then(response => {
                     this.dialogLoading = false
                     this.dialogLoading = false
+                    // 更新部门、岗位数据
+                    this.$common.request('update', updateParams)
+                    // 启动培训
+                    this.createTrain(response.variables.id)
                     this.$emit('dialog-callback', this)
                     this.$emit('dialog-callback', this)
                     ActionUtils.saveSuccessMessage(response.message, r => {
                     ActionUtils.saveSuccessMessage(response.message, r => {
                         if (r) {
                         if (r) {
@@ -359,8 +386,7 @@ export default {
                                 this.$refs.attrInfo.clearData()
                                 this.$refs.attrInfo.clearData()
                             }
                             }
                         }
                         }
-                    }
-                    )
+                    })
                 }).catch(() => {
                 }).catch(() => {
                     this.dialogLoading = false
                     this.dialogLoading = false
                 })
                 })