Browse Source

添加手机角色和岗位

qin_v13
herenshan112 8 months ago
parent
commit
f04d302288
  1. 29
      src/api/hr/org/index.ts
  2. 4
      src/api/hr/org/type.ts
  3. 226
      src/components/lowCode/assistant/pickpost.vue
  4. 59
      src/components/lowCode/assistant/pickrole.vue
  5. 14
      src/components/lowCode/formItem.vue

29
src/api/hr/org/index.ts

@ -389,3 +389,32 @@ export const hotNews = (data: attributePage):any => {
data: data
})
}
//获取角色列表
export function gainRoleList(data?: any) {
return request({
url: "/systemapi/user/gainRoleList",
method: "POST",
data: data
});
}
/**
*
*/
export function basis_org_postList(data?: any){
return request({
url: '/hrapi/org/basis_org_postList',
method: 'post',
data: data
});
}
/**
*
*/
export function getpositioncont(data: getContId){
return request({
url: '/hrapi/org/getpositioncont',
method: 'post',
data: data
});
}

4
src/api/hr/org/type.ts

@ -288,4 +288,6 @@ export interface orgGardes{
}
export interface attributePage extends pageTurning{
type?:number
}
}

226
src/components/lowCode/assistant/pickpost.vue

@ -0,0 +1,226 @@
<!--
@ 作者: 秦东
@ 时间: 2025-03-21 10:49:07
@ 备注: 岗位组件
-->
<script lang='ts' setup>
import { orgInfo } from '@/api/hr/org/type'
import { basis_org_postList,getOrgTreeList,getgovcont,getpositioncont } from "@/api/hr/org/index";
const props = withDefaults(
defineProps<{
data: FormList
tablekey: any
numrun?: number
modelValue?: any //
tProp?: string // form-itemprop
}>(),
{}
)
const emits = defineEmits<{
(e: 'update:modelValue', numVal: any): 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-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-select
v-model="orgPostInfo.postId"
v-loading="orgPostTreeLoading"
placeholder="请选择岗位"
style="margin-top:10px;"
>
<el-option
v-for="item in postOptions"
:key="item.id"
:label="item.name"
:value="item.id"
/>
</el-select>
<el-input style="display: none" v-model="value" placeholder="请选择" />
</template>
<style lang="scss" scoped>
.el-row {
width: 100%;
}
</style>

59
src/components/lowCode/assistant/pickrole.vue

@ -0,0 +1,59 @@
<!--
@ 作者: 秦东
@ 时间: 2025-03-21 10:48:18
@ 备注: 角色组件
-->
<script lang='ts' setup>
import { gainRoleList } from '@/api/hr/org/index'
const props = withDefaults(
defineProps<{
data: FormList
tablekey: any
numrun?: number
modelValue?: any //
tProp?: string // form-itemprop
}>(),
{}
)
const emits = defineEmits<{
(e: 'update:modelValue', numVal: any): void
}>()
const value = computed({
get: () => {
if (props.modelValue != "" && props.modelValue != undefined){
return props.modelValue*1
}else{
return props.modelValue
}
},
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>

14
src/components/lowCode/formItem.vue

@ -45,6 +45,8 @@ import DigitpagePage from '@/components/lowCode/assistant/digitpage.vue'
import OrgCentent from '@/components/lowCode/assistant/org.vue'
// import Tinymce from '@/components/lowCode/assistant/tinymce.vue'
import QuillEditor from '@/components/lowCode/assistant/quillEditor.vue'
import PickRole from '@/components/lowCode/assistant/pickrole.vue'
import PickPost from '@/components/lowCode/assistant/pickpost.vue'
const props = withDefaults(
@ -551,6 +553,12 @@ const currentComponent = computed(() => {
if (props.data.type === "orgCentent") {
return markRaw(OrgCentent);
}
if (props.data.type === "pickpost") {
return markRaw(PickPost);
}
if (props.data.type === "pickrole") {
return markRaw(PickRole);
}
return `el-${props.data.type}`
})
//
@ -560,7 +568,7 @@ const handleClick = (event) => {
};
</script>
<template>
<div>{{data.type}}
<div>
<template class="form-value" v-if="type === 15">
2
</template>
@ -947,6 +955,8 @@ const handleClick = (event) => {
'deptOrg',
'digitpage',
'orgCentent',
'pickrole',
'pickpost'
].includes(data.type)"
:is="currentComponent"
:data="data"
@ -990,7 +1000,7 @@ const handleClick = (event) => {

Loading…
Cancel
Save