|
@@ -46,6 +46,7 @@
|
|
|
<v-btn color="primary" variant="text" @click="handleBinding(item)">{{ $t('enterprise.userManagement.jobBinding') }}</v-btn>
|
|
|
<v-btn v-if="item.status === '1' && item.userType !== '1'" color="primary" variant="text" @click="handleAction('', 0, item)">{{ $t('enterprise.userManagement.enable') }}</v-btn>
|
|
|
<v-btn v-if="item.status === '0' && item.userType !== '1'" color="primary" variant="text" @click="handleAction('', 1, item)">{{ $t('enterprise.userManagement.disable') }}</v-btn>
|
|
|
+ <v-btn color="primary" variant="text" @click="handleChangeEmail(item)">修改员工邮箱</v-btn>
|
|
|
</template>
|
|
|
</CtTable>
|
|
|
</v-col>
|
|
@@ -55,6 +56,9 @@
|
|
|
<CtDialog :visible="show" :widthType="2" titleClass="text-h6" :title="$t('enterprise.userManagement.selectBinding')" @close="handleClose" @submit="handleSubmit">
|
|
|
<CtForm ref="formPageRef" :items="formItems"></CtForm>
|
|
|
</CtDialog>
|
|
|
+ <CtDialog :visible="showEditEmail" :widthType="2" titleClass="text-h6" title="修改员工邮箱" @close="showEditEmail = false" @submit="handleEditEmailSubmit">
|
|
|
+ <CtForm ref="editEmailFormRef" class="mt-3" :items="emailFormItems"></CtForm>
|
|
|
+ </CtDialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
@@ -67,6 +71,8 @@ import { getEnterpriseTree } from '@/api/recruit/enterprise/system/group'
|
|
|
import { getEnterpriseUserList, systemUserEnable, systemUserDisable, systemUserBindingPost } from '@/api/recruit/enterprise/system/user'
|
|
|
import Confirm from '@/plugins/confirm'
|
|
|
import Snackbar from '@/plugins/snackbar'
|
|
|
+import { checkEmail } from '@/utils/validate'
|
|
|
+import { entUpdateEmail } from '@/api/enterprise'
|
|
|
// import { useRouter } from 'vue-router'; const router = useRouter()
|
|
|
|
|
|
const { t } = useI18n()
|
|
@@ -208,6 +214,51 @@ const handleSubmit = async () => {
|
|
|
handleClose()
|
|
|
getUserList()
|
|
|
}
|
|
|
+
|
|
|
+const emailFormItems = ref({
|
|
|
+ options: [
|
|
|
+ {
|
|
|
+ type: 'text',
|
|
|
+ key: 'email',
|
|
|
+ value: '',
|
|
|
+ label: '电子邮箱',
|
|
|
+ disabled: false,
|
|
|
+ rules: [
|
|
|
+ value => {
|
|
|
+ if (value) return true
|
|
|
+ return '请输入联系邮箱'
|
|
|
+ },
|
|
|
+ value => {
|
|
|
+ if (checkEmail(value)) return true
|
|
|
+ return '请输入正确的电子邮箱'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ ]
|
|
|
+})
|
|
|
+// 修改员工邮箱
|
|
|
+const showEditEmail = ref(false)
|
|
|
+const editEmailFormRef = ref()
|
|
|
+let editEmailItem = {}
|
|
|
+const handleChangeEmail = async (item) => {
|
|
|
+ emailFormItems.value.options.forEach(e => { if (item[e.key]) { e.value = item[e.key] } })
|
|
|
+ editEmailItem = item
|
|
|
+ showEditEmail.value = true
|
|
|
+}
|
|
|
+// 提交
|
|
|
+const handleEditEmailSubmit = async () => {
|
|
|
+ const { valid } = await editEmailFormRef.value.formRef.validate()
|
|
|
+ if (!valid) return
|
|
|
+ if (!editEmailItem?.id) return
|
|
|
+ const obj = { id: editEmailItem.id }
|
|
|
+ emailFormItems.value.options.forEach(e => { obj[e.key] = e.value })
|
|
|
+ await entUpdateEmail(obj)
|
|
|
+ setTimeout(async () => {
|
|
|
+ showEditEmail.value = false
|
|
|
+ getUserList()
|
|
|
+ Snackbar.success(t('common.submittedSuccessfully'))
|
|
|
+ }, 1000)
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|