|
|
@ -3,43 +3,43 @@ |
|
|
@ 时间: 2023-06-06 11:06:04 |
|
|
@ 时间: 2023-06-06 11:06:04 |
|
|
@ 备注: 编辑行政组织内容 |
|
|
@ 备注: 编辑行政组织内容 |
|
|
--> |
|
|
--> |
|
|
<script lang='ts' setup> |
|
|
<script lang="ts" setup> |
|
|
import { addOrgInfo,orgInfo } from '@/api/hr/org/type' |
|
|
import { addOrgInfo, orgInfo } from "@/api/hr/org/type"; |
|
|
import { editOrgInfoApi,getOrgTreeList } from '@/api/hr/org/index' |
|
|
import { editOrgInfoApi, getOrgTreeList } from "@/api/hr/org/index"; |
|
|
const props = defineProps({ |
|
|
const props = defineProps({ |
|
|
editOrgIsShow:{ |
|
|
editOrgIsShow: { |
|
|
type:Boolean, |
|
|
type: Boolean, |
|
|
default:false |
|
|
default: false, |
|
|
|
|
|
}, |
|
|
|
|
|
editorginfocont: { |
|
|
|
|
|
type: Object, |
|
|
|
|
|
default() { |
|
|
|
|
|
return { organizationtype: 0 }; |
|
|
|
|
|
}, |
|
|
|
|
|
}, |
|
|
|
|
|
orgclasslistary: { |
|
|
|
|
|
type: Object, |
|
|
|
|
|
default() { |
|
|
|
|
|
return { id: 0 }; |
|
|
}, |
|
|
}, |
|
|
editorginfocont:{ |
|
|
|
|
|
type:Object, |
|
|
|
|
|
default(){ |
|
|
|
|
|
return {organizationtype:0} |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
}, |
|
|
orgclasslistary:{ |
|
|
|
|
|
type:Object, |
|
|
|
|
|
default(){ |
|
|
|
|
|
return {id:0} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
}); |
|
|
const editOrgFormRef = ref(ElForm); //编辑表单 |
|
|
const editOrgFormRef = ref(ElForm); //编辑表单 |
|
|
const emits = defineEmits(["update:editOrgIsShow","refreshorgtree"]); |
|
|
const emits = defineEmits(["update:editOrgIsShow", "refreshorgtree"]); |
|
|
const titlename = ref(""); //标题名称 |
|
|
const titlename = ref(""); //标题名称 |
|
|
const editOrgLoading = ref(false) //编辑按钮 |
|
|
const editOrgLoading = ref(false); //编辑按钮 |
|
|
const editOrgCont = reactive<addOrgInfo>({}) // |
|
|
const editOrgCont = reactive<addOrgInfo>({}); // |
|
|
const orgOptionsList = ref<orgInfo[]>(); |
|
|
const orgOptionsList = ref<orgInfo[]>(); |
|
|
const optLoading = ref(false); |
|
|
const optLoading = ref(false); |
|
|
const systemMenuTreeProps = { |
|
|
const systemMenuTreeProps = { |
|
|
children: "child", |
|
|
children: "child", |
|
|
label: "name", |
|
|
label: "name", |
|
|
value:"id" |
|
|
value: "id", |
|
|
} |
|
|
}; |
|
|
/** |
|
|
/** |
|
|
* 弹窗显示控制 |
|
|
* 弹窗显示控制 |
|
|
*/ |
|
|
*/ |
|
|
const edit_org_is_Show = computed({ |
|
|
const edit_org_is_Show = computed({ |
|
|
get: () => props.editOrgIsShow, |
|
|
get: () => props.editOrgIsShow, |
|
|
set: (val) => { |
|
|
set: (val) => { |
|
|
emits("update:editOrgIsShow", val); |
|
|
emits("update:editOrgIsShow", val); |
|
|
@ -48,89 +48,102 @@ const systemMenuTreeProps = { |
|
|
/** |
|
|
/** |
|
|
* 关闭添加弹窗 |
|
|
* 关闭添加弹窗 |
|
|
*/ |
|
|
*/ |
|
|
function handleCloseEditOrg(){ |
|
|
function handleCloseEditOrg() { |
|
|
emits("update:editOrgIsShow", false); |
|
|
emits("update:editOrgIsShow", false); |
|
|
initOriginalData(); |
|
|
initOriginalData(); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 初始化数据 |
|
|
* 初始化数据 |
|
|
*/ |
|
|
*/ |
|
|
function initOriginalData(){ |
|
|
function initOriginalData() { |
|
|
editOrgFormRef.value.resetFields(); |
|
|
editOrgFormRef.value.resetFields(); |
|
|
titlename.value="" |
|
|
titlename.value = ""; |
|
|
orgOptionsList.value?.splice(orgOptionsList.value.length); |
|
|
orgOptionsList.value?.splice(orgOptionsList.value.length); |
|
|
editOrgLoading.value = false; |
|
|
editOrgLoading.value = false; |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 表单验证规则 |
|
|
* 表单验证规则 |
|
|
*/ |
|
|
*/ |
|
|
const addOrgRules = reactive({ |
|
|
const addOrgRules = reactive({ |
|
|
superior: [{ required: true, message: "请选择上机行政组织", trigger: "blur" }], |
|
|
superior: [{ required: true, message: "请选择上机行政组织", trigger: "blur" }], |
|
|
name: [{ required: true, message: "请输入行政组织名称", trigger: "blur" }], |
|
|
name: [{ required: true, message: "请输入行政组织名称", trigger: "blur" }], |
|
|
number: [{ required: true, message: "请输入行政组织编号", trigger: "blur" }], |
|
|
number: [{ required: true, message: "请输入行政组织编号", trigger: "blur" }], |
|
|
govclass: [{ required: true, message: "请选择行政组织分类", trigger: "blur" }], |
|
|
govclass: [{ required: true, message: "请选择行政组织分类", trigger: "blur" }], |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|
/** |
|
|
/** |
|
|
* 获取行政组织数据 |
|
|
* 获取行政组织数据 |
|
|
*/ |
|
|
*/ |
|
|
function haveOrgTreeInfo(){ |
|
|
function haveOrgTreeInfo() { |
|
|
optLoading.value = true; |
|
|
optLoading.value = true; |
|
|
getOrgTreeList({}) |
|
|
getOrgTreeList({}) |
|
|
.then(({ data })=>{ |
|
|
.then(({ data }) => { |
|
|
orgOptionsList.value = data |
|
|
orgOptionsList.value = data; |
|
|
orgOptionsList.value.push({ |
|
|
orgOptionsList.value.push({ |
|
|
id:0, |
|
|
id: 0, |
|
|
name:"顶级行政组织" |
|
|
name: "顶级行政组织", |
|
|
|
|
|
}); |
|
|
}) |
|
|
}) |
|
|
}).finally(()=>{optLoading.value = false;}) |
|
|
.finally(() => { |
|
|
|
|
|
optLoading.value = false; |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
/** |
|
|
/** |
|
|
* 监听数据 |
|
|
* 监听数据 |
|
|
*/ |
|
|
*/ |
|
|
watch(() => props.editOrgIsShow,() => { |
|
|
watch( |
|
|
|
|
|
() => props.editOrgIsShow, |
|
|
|
|
|
() => { |
|
|
// console.log("监听数据---》",props.editorginfocont) |
|
|
// console.log("监听数据---》",props.editorginfocont) |
|
|
if(props.editOrgIsShow){ |
|
|
if (props.editOrgIsShow) { |
|
|
editOrgCont.id = props.editorginfocont.id |
|
|
editOrgCont.id = props.editorginfocont.id; |
|
|
editOrgCont.name = props.editorginfocont.name //全称 |
|
|
editOrgCont.name = props.editorginfocont.name; //全称 |
|
|
editOrgCont.number = props.editorginfocont.number //编号 |
|
|
editOrgCont.number = props.editorginfocont.number; //编号 |
|
|
editOrgCont.superior = props.editorginfocont.superior //上级 |
|
|
editOrgCont.superior = props.editorginfocont.superior; //上级 |
|
|
editOrgCont.govclass = props.editorginfocont.organizationtype //分类 |
|
|
editOrgCont.govclass = props.editorginfocont.organizationtype; //分类 |
|
|
editOrgCont.abbreviation = props.editorginfocont.abbreviation //简称 |
|
|
editOrgCont.abbreviation = props.editorginfocont.abbreviation; //简称 |
|
|
editOrgCont.wechatid = props.editorginfocont.wechatorganizationid //企业微信对照吗 |
|
|
editOrgCont.wechatid = props.editorginfocont.wechatorganizationid; //企业微信对照吗 |
|
|
editOrgCont.kingdeeid = props.editorginfocont.kingdeeid //金蝶对照码 |
|
|
editOrgCont.kingdeeid = props.editorginfocont.kingdeeid; //金蝶对照码 |
|
|
titlename.value = "编辑<" + props.editorginfocont.name + ">信息" |
|
|
editOrgCont.sort = props.editorginfocont.sort; |
|
|
|
|
|
titlename.value = "编辑<" + props.editorginfocont.name + ">信息"; |
|
|
haveOrgTreeInfo(); |
|
|
haveOrgTreeInfo(); |
|
|
}else{ |
|
|
} else { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
|
); |
|
|
/** |
|
|
/** |
|
|
* 提交数据 |
|
|
* 提交数据 |
|
|
*/ |
|
|
*/ |
|
|
function submitEditOrgForm(){ |
|
|
function submitEditOrgForm() { |
|
|
editOrgLoading.value = true; |
|
|
editOrgLoading.value = true; |
|
|
|
|
|
|
|
|
editOrgFormRef.value.validate((isValid: boolean) => { |
|
|
editOrgFormRef.value.validate((isValid: boolean) => { |
|
|
if (isValid) { |
|
|
if (isValid) { |
|
|
editOrgCont.superior = editOrgCont.superior?.toString() |
|
|
editOrgCont.superior = editOrgCont.superior?.toString(); |
|
|
editOrgCont.govclass = editOrgCont.govclass?.toString() |
|
|
editOrgCont.govclass = editOrgCont.govclass?.toString(); |
|
|
editOrgCont.number = editOrgCont.number?.toString() |
|
|
editOrgCont.number = editOrgCont.number?.toString(); |
|
|
editOrgCont.wechatid = editOrgCont.wechatid?.toString() |
|
|
editOrgCont.wechatid = editOrgCont.wechatid?.toString(); |
|
|
// console.log("提交数据====>",editOrgCont) |
|
|
// console.log("提交数据====>",editOrgCont) |
|
|
editOrgInfoApi(editOrgCont) |
|
|
editOrgInfoApi(editOrgCont) |
|
|
.then((data) =>{ |
|
|
.then((data) => { |
|
|
ElMessage.success("编辑成功"); |
|
|
ElMessage.success("编辑成功"); |
|
|
handleCloseEditOrg(); |
|
|
handleCloseEditOrg(); |
|
|
emits('refreshorgtree'); |
|
|
emits("refreshorgtree"); |
|
|
}).finally(() =>{editOrgLoading.value = false;}) |
|
|
}) |
|
|
|
|
|
.finally(() => { |
|
|
|
|
|
editOrgLoading.value = false; |
|
|
|
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
<template> |
|
|
<template> |
|
|
<el-dialog v-model="edit_org_is_Show" custom-class="dialog_box" :title="titlename" :before-close="handleCloseEditOrg" width="400"> |
|
|
<el-dialog |
|
|
|
|
|
v-model="edit_org_is_Show" |
|
|
|
|
|
custom-class="dialog_box" |
|
|
|
|
|
:title="titlename" |
|
|
|
|
|
:before-close="handleCloseEditOrg" |
|
|
|
|
|
width="400" |
|
|
|
|
|
> |
|
|
<el-form |
|
|
<el-form |
|
|
ref="editOrgFormRef" |
|
|
ref="editOrgFormRef" |
|
|
:model="editOrgCont" |
|
|
:model="editOrgCont" |
|
|
@ -146,9 +159,8 @@ function submitEditOrgForm(){ |
|
|
check-strictly |
|
|
check-strictly |
|
|
:render-after-expand="false" |
|
|
:render-after-expand="false" |
|
|
:props="systemMenuTreeProps" |
|
|
:props="systemMenuTreeProps" |
|
|
style="width: 100%;" |
|
|
style="width: 100%" |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="行政组织全称" prop="name"> |
|
|
<el-form-item label="行政组织全称" prop="name"> |
|
|
<el-input v-model="editOrgCont.name" placeholder="请输入行政组织全称" /> |
|
|
<el-input v-model="editOrgCont.name" placeholder="请输入行政组织全称" /> |
|
|
@ -160,7 +172,11 @@ function submitEditOrgForm(){ |
|
|
<el-input v-model="editOrgCont.number" placeholder="请输入行政组织编码" /> |
|
|
<el-input v-model="editOrgCont.number" placeholder="请输入行政组织编码" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="行政组织类别" prop="govclass"> |
|
|
<el-form-item label="行政组织类别" prop="govclass"> |
|
|
<el-select v-model="editOrgCont.govclass" placeholder="请选择行政组织类别" style="width: 100%;"> |
|
|
<el-select |
|
|
|
|
|
v-model="editOrgCont.govclass" |
|
|
|
|
|
placeholder="请选择行政组织类别" |
|
|
|
|
|
style="width: 100%" |
|
|
|
|
|
> |
|
|
<el-option |
|
|
<el-option |
|
|
v-for="item in props.orgclasslistary" |
|
|
v-for="item in props.orgclasslistary" |
|
|
:key="item.id" |
|
|
:key="item.id" |
|
|
@ -173,15 +189,23 @@ function submitEditOrgForm(){ |
|
|
<el-form-item label="企业微信对照码" prop="wechatid"> |
|
|
<el-form-item label="企业微信对照码" prop="wechatid"> |
|
|
<el-input v-model="editOrgCont.wechatid" placeholder="请输入企业微信对照码" /> |
|
|
<el-input v-model="editOrgCont.wechatid" placeholder="请输入企业微信对照码" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item label="排序" prop="wechatid"> |
|
|
|
|
|
<el-input-number |
|
|
|
|
|
v-model="editOrgCont.sort" |
|
|
|
|
|
:min="1" |
|
|
|
|
|
:max="1000" |
|
|
|
|
|
placeholder="请输入序号" |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
<template #footer> |
|
|
<template #footer> |
|
|
<div class="dialog-footer"> |
|
|
<div class="dialog-footer"> |
|
|
<el-button type="primary" :loading="editOrgLoading" @click="submitEditOrgForm" >确 定</el-button> |
|
|
<el-button type="primary" :loading="editOrgLoading" @click="submitEditOrgForm" |
|
|
|
|
|
>确 定</el-button |
|
|
|
|
|
> |
|
|
<el-button @click="handleCloseEditOrg">取 消</el-button> |
|
|
<el-button @click="handleCloseEditOrg">取 消</el-button> |
|
|
</div> |
|
|
</div> |
|
|
</template> |
|
|
</template> |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
</template> |
|
|
</template> |
|
|
<style lang='scss' scoped> |
|
|
<style lang="scss" scoped></style> |
|
|
|
|
|
|
|
|
</style> |
|
|
|
|
|
|