parent
63f7926a7c
commit
4f59674e77
@ -0,0 +1,94 @@
|
|||||||
|
<template>
|
||||||
|
<el-dialog v-model="state.visible" title="员工调动">
|
||||||
|
<el-form ref="refsForm" v-loading="state.loading" label-width="130px" :model="state.form" :rules="state.rules">
|
||||||
|
<el-form-item label="原所在组织">
|
||||||
|
{{ state.form.oldDept }}
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="调动到目标组织" prop="departmentId">
|
||||||
|
<el-cascader
|
||||||
|
v-model="state.form.departmentId"
|
||||||
|
:options="list"
|
||||||
|
:props="{
|
||||||
|
label: 'name',
|
||||||
|
value: 'id',
|
||||||
|
trigger: 'hover',
|
||||||
|
checkStrictly: true,
|
||||||
|
emitPath: false,
|
||||||
|
children: 'childDepartment',
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="选择角色权限" prop="handType">
|
||||||
|
<el-radio-group v-model="state.form.handType" :opts="state.opts.handType" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="state.visible = false">取消</el-button>
|
||||||
|
<el-button :loading="state.loading" type="primary" @click="handleSave">确定</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
const store = useStore();
|
||||||
|
const emits = defineEmits(['save']);
|
||||||
|
const { proxy } = getCurrentInstance();
|
||||||
|
const list = computed(() => store.state.dept.list);
|
||||||
|
const state = reactive({
|
||||||
|
visible: false,
|
||||||
|
loading: false,
|
||||||
|
form: {
|
||||||
|
employeeId: null,
|
||||||
|
oldDept: null,
|
||||||
|
departmentId: null,
|
||||||
|
handType: null,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
departmentId: [{ required: true, message: '调动到目标组织不能为空' }],
|
||||||
|
handType: [{ required: true, message: '选择角色权限不能为空' }],
|
||||||
|
},
|
||||||
|
opts: {
|
||||||
|
handType: [
|
||||||
|
{
|
||||||
|
label: '删除原组织权限并调动',
|
||||||
|
value: 1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除所有权限并调动',
|
||||||
|
value: 2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '保留所有权限并调动',
|
||||||
|
value: 3,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const refsForm = ref(null);
|
||||||
|
const handleShow = (row) => {
|
||||||
|
state.visible = true;
|
||||||
|
state.form = { employeeId: row.id, oldDept: row.departmentNameChain, departmentId: null, handType: 1 };
|
||||||
|
store.dispatch('dept/search', { hiddenDisable: true });
|
||||||
|
};
|
||||||
|
const handleClose = () => {
|
||||||
|
state.visible = false;
|
||||||
|
};
|
||||||
|
const handleSave = async () => {
|
||||||
|
try {
|
||||||
|
await proxy.$validate(refsForm);
|
||||||
|
state.loading = true;
|
||||||
|
await store.dispatch('deptEmployee/transfer', state.form);
|
||||||
|
state.loading = false;
|
||||||
|
state.visible = false;
|
||||||
|
emits('save');
|
||||||
|
} catch (e) {
|
||||||
|
console.log('取消调动', e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
defineExpose({
|
||||||
|
show: handleShow,
|
||||||
|
close: handleClose,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped></style>
|
Loading…
Reference in new issue