18 changed files with 1694 additions and 841 deletions
@ -0,0 +1,232 @@ |
|||
<!-- |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-03-19 13:27:12 |
|||
@ 备注: 岗位选择 |
|||
--> |
|||
<script lang="ts" setup> |
|||
import { basis_org_postList } from "@/api/hr/org/index"; |
|||
|
|||
import { orgInfo } from "@/api/hr/org/type"; |
|||
import { getOrgTreeList } from "@/api/hr/org/index"; |
|||
import { getgovcont, getpositioncont } from "@/api/hr/org/index"; |
|||
|
|||
const props = withDefaults( |
|||
defineProps<{ |
|||
modelValue?: string; |
|||
disabled?: boolean; |
|||
type?: number; |
|||
data?: object; |
|||
}>(), |
|||
{} |
|||
); |
|||
const emits = defineEmits<{ |
|||
(e: "update:modelValue", value: string): void; |
|||
}>(); |
|||
const value = computed({ |
|||
get: () => { |
|||
if (props.modelValue != "" && props.modelValue != undefined) { |
|||
console.log("初始结果", props.modelValue); |
|||
let ads = props.modelValue.split("#@#"); |
|||
console.log("初始结果", ads); |
|||
if (ads.length >= 2) { |
|||
orgPostInfo.orgId = ads[0] * 1; |
|||
orgPostInfo.postId = ads[1] * 1; |
|||
orgChange(ads[0] * 1); |
|||
} else if (ads.length == 1) { |
|||
orgPostInfo.orgId = ads[0] * 1; |
|||
orgChange(ads[0] * 1); |
|||
} else { |
|||
orgPostInfo.orgId = ""; |
|||
orgPostInfo.postId = ""; |
|||
} |
|||
// if (props.type == 4) { |
|||
// writeInfo(props.modelValue); |
|||
// return valueHtml; |
|||
// } else { |
|||
// return props.modelValue; |
|||
// } |
|||
return props.modelValue; |
|||
} else { |
|||
return props.modelValue; |
|||
} |
|||
}, |
|||
set: (newVal: any) => { |
|||
emits("update:modelValue", newVal); |
|||
}, |
|||
}); |
|||
const postOptions = ref([]); |
|||
const valueHtml = ref(""); |
|||
const valueHtmlPost = ref(""); |
|||
const orgTreeList = ref<orgInfo[]>(); |
|||
const orgTreeLoading = ref(false); //加载行政组织树 |
|||
const orgTreeProps = { |
|||
children: "child", |
|||
label: "name", |
|||
}; //行政组织树对照值 |
|||
const orgPostTreeLoading = ref(false); |
|||
const orgPostInfo = reactive({ |
|||
orgId: "", |
|||
postId: "", |
|||
}); |
|||
|
|||
function haveOrgTreeInfo() { |
|||
orgTreeLoading.value = true; |
|||
getOrgTreeList({ orgid: 309 }) |
|||
.then(({ data }) => { |
|||
console.log("行政组织树对照值", data); |
|||
orgTreeList.value = data; |
|||
}) |
|||
.finally(() => { |
|||
orgTreeLoading.value = false; |
|||
}); |
|||
} |
|||
|
|||
onBeforeMount(() => { |
|||
haveOrgTreeInfo(); |
|||
}); |
|||
|
|||
onMounted(() => { |
|||
// console.log("value---1--》",value.value,props.modelValue) |
|||
nextTick(() => { |
|||
haveOrgTreeInfo(); |
|||
if (props.type == 4) { |
|||
console.log("value---1--》", props.modelValue); |
|||
} |
|||
}); |
|||
}); |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-03-20 14:43:57 |
|||
@ 功能: 改变行政组织获取相应岗位 |
|||
*/ |
|||
const orgChange = (val: any) => { |
|||
// console.log("改变行政组织获取相应岗位", val); |
|||
orgPostTreeLoading.value = true; |
|||
basis_org_postList({ id: [val] }) |
|||
.then(({ data }) => { |
|||
console.log("改变行政组织获取相应岗位", data); |
|||
postOptions.value = data; |
|||
}) |
|||
.finally(() => { |
|||
orgPostTreeLoading.value = false; |
|||
}); |
|||
}; |
|||
watch( |
|||
() => orgPostInfo, |
|||
(val: any) => { |
|||
if (val.orgId != "") { |
|||
value.value = val.orgId; |
|||
if (val.postId != "") { |
|||
value.value = val.orgId + "#@#" + val.postId; |
|||
if (props.type == 4) { |
|||
if (postOptions.value && postOptions.value.length > 0) { |
|||
orgPostInfo.postId.forEach((item: any) => { |
|||
if (item.id == val.postId) { |
|||
value.value = value.value + item.name; |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} else { |
|||
value.value = ""; |
|||
} |
|||
} else { |
|||
value.value = ""; |
|||
} |
|||
}, |
|||
{ |
|||
deep: true, |
|||
} |
|||
); |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-03-20 16:06:01 |
|||
@ 功能: 获取行政组织基本信息 |
|||
*/ |
|||
const gainOrgCont = (val: string) => { |
|||
let name = ""; |
|||
getgovcont({ id: val * 1, idstr: val }) |
|||
.then(({ data }) => { |
|||
console.log("选择行政组织-3->", data, data.name); |
|||
// orgName.value = data.name |
|||
valueHtml.value = data.name; |
|||
}) |
|||
.finally(() => {}); |
|||
return name; |
|||
}; |
|||
|
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-03-20 16:36:03 |
|||
@ 功能: 获取岗位 |
|||
*/ |
|||
const getPostInfo = (val: string) => { |
|||
getpositioncont({ id: val * 1, idstr: val }).then(({ data }) => { |
|||
console.log("选择行政组织----4->", data, data.name); |
|||
valueHtmlPost.value = data.name; |
|||
}); |
|||
}; |
|||
|
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-03-20 16:15:48 |
|||
@ 功能: 输出结果 |
|||
*/ |
|||
const writeInfo = (val: any) => { |
|||
console.log("输出结果-3->", val); |
|||
if (val != "" && val != undefined) { |
|||
let ads = val.split("#@#"); |
|||
if (ads.length >= 2) { |
|||
gainOrgCont(ads[0]); |
|||
getPostInfo(ads[1]); |
|||
} else if (ads.length == 1) { |
|||
gainOrgCont(ads[0]); |
|||
} |
|||
} |
|||
let sendInfo = valueHtml.value; |
|||
if (valueHtmlPost.value != "") { |
|||
sendInfo = sendInfo + "-" + valueHtmlPost.value; |
|||
} |
|||
return sendInfo; |
|||
}; |
|||
</script> |
|||
<template> |
|||
<el-row v-if="props.type != 4"> |
|||
<el-col :span="24"> |
|||
<el-tree-select |
|||
v-bind="$props" |
|||
v-model="orgPostInfo.orgId" |
|||
v-loading="orgTreeLoading" |
|||
node-key="id" |
|||
:props="orgTreeProps" |
|||
:data="orgTreeList" |
|||
check-strictly |
|||
b |
|||
:render-after-expand="false" |
|||
placeholder="请选择行政组织" |
|||
@change="orgChange" |
|||
/> |
|||
</el-col> |
|||
<el-col :span="24"> |
|||
<el-select |
|||
v-model="orgPostInfo.postId" |
|||
v-loading="orgPostTreeLoading" |
|||
placeholder="请选择岗位" |
|||
> |
|||
<el-option |
|||
v-for="item in postOptions" |
|||
:key="item.id" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
/> |
|||
</el-select> |
|||
</el-col> |
|||
<el-input style="display: none" v-model="value" placeholder="请选择" /> |
|||
</el-row> |
|||
<div v-else v-html="writeInfo(value)"></div> |
|||
</template> |
|||
<style lang="scss" scoped> |
|||
.el-row { |
|||
width: 100%; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,51 @@ |
|||
<!-- |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-03-19 13:26:28 |
|||
@ 备注: 角色选择 |
|||
--> |
|||
<script lang="ts" setup> |
|||
import { gainRoleList } from "@/api/role/index"; |
|||
const props = withDefaults( |
|||
defineProps<{ |
|||
modelValue?: string; |
|||
disabled?: boolean; |
|||
type?: number; |
|||
}>(), |
|||
{} |
|||
); |
|||
const emits = defineEmits<{ |
|||
(e: "update:modelValue", value: string): void; |
|||
}>(); |
|||
const value = computed({ |
|||
get: () => { |
|||
return props.modelValue * 1; |
|||
}, |
|||
set: (newVal: any) => { |
|||
emits("update:modelValue", newVal); |
|||
}, |
|||
}); |
|||
const roleLoading = ref(false); //加载行政组织树 |
|||
const roleLiet = ref([]); |
|||
onBeforeMount(() => { |
|||
roleLoading.value = true; |
|||
gainRoleList() |
|||
.then(({ data }) => { |
|||
console.log("角色列表", data); |
|||
roleLiet.value = data; |
|||
}) |
|||
.finally(() => { |
|||
roleLoading.value = false; |
|||
}); |
|||
}); |
|||
</script> |
|||
<template> |
|||
<el-select v-model="value" placeholder="请选择"> |
|||
<el-option |
|||
v-for="item in roleLiet" |
|||
:key="item.id" |
|||
:label="item.name" |
|||
:value="item.id" |
|||
/> |
|||
</el-select> |
|||
</template> |
|||
<style lang="scss" scoped></style> |
|||
@ -0,0 +1,39 @@ |
|||
<template> |
|||
<el-table |
|||
:data="tableData" |
|||
@selection-change="handleSelectionChange" |
|||
row-key="id" |
|||
> |
|||
<el-table-column type="selection" /> |
|||
<el-table-column prop="name" label="Name" /> |
|||
</el-table> |
|||
<button @click="selectRows([1, 3])">Select Items 1 and 3</button> |
|||
</template> |
|||
|
|||
<script setup> |
|||
import { ref, nextTick } from 'vue'; |
|||
|
|||
const tableData = ref([ |
|||
{ id: 1, name: 'Item 1' }, |
|||
{ id: 2, name: 'Item 2' }, |
|||
{ id: 3, name: 'Item 3' }, |
|||
]); |
|||
|
|||
const selectedRows = ref([]); |
|||
|
|||
function handleSelectionChange(selection) { |
|||
selectedRows.value = selection; |
|||
} |
|||
|
|||
async function selectRows(ids) { |
|||
// 更新数据中的选中状态 |
|||
tableData.value = tableData.value.map(item => ({ |
|||
...item, |
|||
selected: ids.includes(item.id), |
|||
})); |
|||
|
|||
// 确保el-table更新 |
|||
await nextTick(); |
|||
selectedRows.value = tableData.value.filter(item => ids.includes(item.id)); |
|||
} |
|||
</script> |
|||
@ -0,0 +1,126 @@ |
|||
<!-- |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-03-18 14:04:28 |
|||
@ 备注: 编辑移动菜单弹窗 |
|||
--> |
|||
<script lang="ts" setup> |
|||
import { gainAppGroupMenus, moveAppMenus } from "@/api/api/index"; |
|||
const props = defineProps({ |
|||
menuInfo: { |
|||
type: Object, |
|||
default() { |
|||
return {}; |
|||
}, |
|||
}, |
|||
show: { |
|||
type: Boolean, |
|||
default: false, |
|||
}, |
|||
}); |
|||
const emits = defineEmits(["update:show", "update:appPageKey", "updateMenu"]); |
|||
const menuLoading = ref(false); |
|||
const menuListLoading = ref(false); |
|||
const menuList = ref([]); |
|||
const menuInfo = reactive<any>({ |
|||
menuid: "", |
|||
oldmenuid: "", |
|||
}); |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-03-18 14:17:55 |
|||
@ 功能: 获取列表 |
|||
*/ |
|||
const appMenusList = () => { |
|||
menuListLoading.value = true; |
|||
gainAppGroupMenus() |
|||
.then((data: any) => { |
|||
menuList.value = data.data; |
|||
}) |
|||
.finally(() => { |
|||
menuListLoading.value = false; |
|||
}); |
|||
}; |
|||
watch( |
|||
() => props.show, |
|||
(val: boolean) => { |
|||
menuInfo.menuid = props.menuInfo.id; |
|||
menuInfo.oldmenuid = props.menuInfo.id; |
|||
if (val) { |
|||
appMenusList(); |
|||
} else { |
|||
menuList.value = []; |
|||
} |
|||
}, |
|||
{ |
|||
deep: true, |
|||
} |
|||
); |
|||
onMounted(() => { |
|||
nextTick(() => { |
|||
menuInfo.menuid = props.menuInfo.id; |
|||
menuInfo.oldmenuid = props.menuInfo.id; |
|||
appMenusList(); |
|||
}); |
|||
}); |
|||
//关闭 |
|||
const closeBox = () => { |
|||
emits("updateMenu"); |
|||
emits("update:show", false); |
|||
}; |
|||
const menuTreePropsBut = { |
|||
children: "children", |
|||
value: "id", |
|||
label: "label", |
|||
}; |
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2025-03-18 15:00:29 |
|||
@ 功能: 确定移动 |
|||
*/ |
|||
const pickmove = () => { |
|||
menuLoading.value = true; |
|||
moveAppMenus(menuInfo) |
|||
.then((data: any) => { |
|||
// menuList.value = data.data; |
|||
console.log("确定移动", data); |
|||
closeBox(); |
|||
}) |
|||
.finally(() => { |
|||
menuLoading.value = false; |
|||
}); |
|||
}; |
|||
</script> |
|||
<template> |
|||
<el-dialog |
|||
v-model="props.show" |
|||
title="移动菜单" |
|||
width="500" |
|||
draggable |
|||
:before-close="closeBox" |
|||
> |
|||
<el-form :model="menuInfo" label-width="auto" style="max-width: 600px"> |
|||
<el-form-item label="归属于"> |
|||
<el-tree-select |
|||
v-model="menuInfo.menuid" |
|||
:data="menuList" |
|||
:render-after-expand="false" |
|||
filterable |
|||
style="width: 240px" |
|||
clearable |
|||
:props="menuTreePropsBut" |
|||
check-strictly |
|||
v-loading="menuListLoading" |
|||
/> |
|||
</el-form-item> |
|||
</el-form> |
|||
<template #footer> |
|||
<div class="dialog-footer"> |
|||
<el-button @click="closeBox">取消</el-button> |
|||
<el-button v-loading="menuLoading" type="primary" @click="pickmove"> |
|||
确定 |
|||
</el-button> |
|||
</div> |
|||
</template> |
|||
</el-dialog> |
|||
</template> |
|||
<style lang="scss" scoped></style> |
|||
File diff suppressed because it is too large
Loading…
Reference in new issue