|
@@ -30,9 +30,10 @@ const form = reactive({
|
|
cycle: "月度",
|
|
cycle: "月度",
|
|
cycleValue: "",
|
|
cycleValue: "",
|
|
assessmentType: null,
|
|
assessmentType: null,
|
|
- assessmentObjectList: [
|
|
|
|
|
|
+ listArr: [
|
|
{
|
|
{
|
|
assessmentObjectId: "",
|
|
assessmentObjectId: "",
|
|
|
|
+ idList: [],
|
|
assessmentObjectName: "",
|
|
assessmentObjectName: "",
|
|
assessmentModelId: "",
|
|
assessmentModelId: "",
|
|
assessmentModelName: ""
|
|
assessmentModelName: ""
|
|
@@ -61,12 +62,25 @@ const handleClose = () => {
|
|
// // catch error
|
|
// // catch error
|
|
// });
|
|
// });
|
|
};
|
|
};
|
|
|
|
+const arrList = ref([]); // 考核对象与模版设置
|
|
|
|
+const transformArrayFormat = data => {
|
|
|
|
+ return data
|
|
|
|
+ .map(item => {
|
|
|
|
+ return item.idList.map((id, index) => {
|
|
|
|
+ return {
|
|
|
|
+ assessmentObjectId: item.assessmentObjectId[index],
|
|
|
|
+ assessmentObjectName: item.assessmentObjectName[index],
|
|
|
|
+ assessmentModelId: item.assessmentModelId,
|
|
|
|
+ assessmentModelName: item.assessmentModelName
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+ })
|
|
|
|
+ .flat();
|
|
|
|
+};
|
|
// 添加部门保存
|
|
// 添加部门保存
|
|
const saveDepartment = async () => {
|
|
const saveDepartment = async () => {
|
|
form.cycleValue = dayjs(form.cycleValue).format(format.value);
|
|
form.cycleValue = dayjs(form.cycleValue).format(format.value);
|
|
- //
|
|
|
|
- console.log("form", dayjs(form.cycleValue).format(format.value));
|
|
|
|
- console.log(form, "获取的数据");
|
|
|
|
|
|
+ form.assessmentObjectList = transformArrayFormat(form.listArr);
|
|
const { code, msg } = await postAddAssessment(form);
|
|
const { code, msg } = await postAddAssessment(form);
|
|
if (code === 200) {
|
|
if (code === 200) {
|
|
ElMessage({
|
|
ElMessage({
|
|
@@ -86,8 +100,9 @@ const open = (item: any, index: string) => {
|
|
cycle: "月度",
|
|
cycle: "月度",
|
|
cycleValue: "",
|
|
cycleValue: "",
|
|
assessmentType: null,
|
|
assessmentType: null,
|
|
- assessmentObjectList: [
|
|
|
|
|
|
+ listArr: [
|
|
{
|
|
{
|
|
|
|
+ idList: [],
|
|
assessmentObjectId: null,
|
|
assessmentObjectId: null,
|
|
assessmentObjectName: null,
|
|
assessmentObjectName: null,
|
|
assessmentModelId: null,
|
|
assessmentModelId: null,
|
|
@@ -101,16 +116,18 @@ const open = (item: any, index: string) => {
|
|
dialogVisibleAdd.value = true;
|
|
dialogVisibleAdd.value = true;
|
|
};
|
|
};
|
|
const addNew = () => {
|
|
const addNew = () => {
|
|
- form.assessmentObjectList.push({
|
|
|
|
|
|
+ form.listArr.push({
|
|
assessmentObjectId: "",
|
|
assessmentObjectId: "",
|
|
|
|
+ idList: [],
|
|
assessmentObjectName: "",
|
|
assessmentObjectName: "",
|
|
assessmentModelId: "",
|
|
assessmentModelId: "",
|
|
assessmentModelName: ""
|
|
assessmentModelName: ""
|
|
});
|
|
});
|
|
|
|
+ arrList.value.push([]);
|
|
// form.assessmentObjectList.left.push({ value: "" });
|
|
// form.assessmentObjectList.left.push({ value: "" });
|
|
};
|
|
};
|
|
const deleteItem = (index: any) => {
|
|
const deleteItem = (index: any) => {
|
|
- form.assessmentObjectList.splice(index, 1);
|
|
|
|
|
|
+ form.listArr.splice(index, 1);
|
|
// form.assessmentObjectList.right.splice(index, 1);
|
|
// form.assessmentObjectList.right.splice(index, 1);
|
|
};
|
|
};
|
|
// 单选
|
|
// 单选
|
|
@@ -119,9 +136,7 @@ const quarterValue = ref(true);
|
|
const format = ref<any>("YYYY-MM");
|
|
const format = ref<any>("YYYY-MM");
|
|
const pickerType = ref<any>("month");
|
|
const pickerType = ref<any>("month");
|
|
const handleRegionChange = (value: any) => {
|
|
const handleRegionChange = (value: any) => {
|
|
- console.log(value);
|
|
|
|
timeType.value = value;
|
|
timeType.value = value;
|
|
- console.log("111", form.cycleValue);
|
|
|
|
switch (value) {
|
|
switch (value) {
|
|
case "年度":
|
|
case "年度":
|
|
form.cycleValue = "";
|
|
form.cycleValue = "";
|
|
@@ -200,57 +215,76 @@ const templateparams = reactive({
|
|
pageSize: 100
|
|
pageSize: 100
|
|
});
|
|
});
|
|
const resTmp = ref([]);
|
|
const resTmp = ref([]);
|
|
-// const postListTreeWithUserApi = async () => {
|
|
|
|
-// const res = await postListTreeWithUser();
|
|
|
|
|
|
|
|
-// console.log("人员", res.data);
|
|
|
|
-// console.log("人员", transformData(res.data));
|
|
|
|
-// treeDept.value = [];
|
|
|
|
-// let aa = res.data;
|
|
|
|
-// treeDept.value = transformData(aa);
|
|
|
|
-// };
|
|
|
|
|
|
+// 医疗 -- 部门负责人
|
|
|
|
+const selectRefs = ref();
|
|
|
|
+const handChange = index => {
|
|
|
|
+ const arr = treeDeptList.value.filter(item => {
|
|
|
|
+ return form.listArr[index].idList.includes(item.userCode);
|
|
|
|
+ });
|
|
|
|
+ form.listArr[index].assessmentObjectId = arr.map(item => item.userCode);
|
|
|
|
+ form.listArr[index].assessmentObjectName = arr.map(item => item.realName);
|
|
|
|
+};
|
|
|
|
+
|
|
const assessmentTypeRef = ref();
|
|
const assessmentTypeRef = ref();
|
|
const handleRreeSelect = index => {
|
|
const handleRreeSelect = index => {
|
|
- const node = assessmentTypeRef.value[index].getCheckedNodes();
|
|
|
|
- form.assessmentObjectList[index].assessmentObjectName =
|
|
|
|
- node[node.length - 1].deptName;
|
|
|
|
|
|
+ const arr = assessmentTypeRef.value[index].getCheckedNodes().filter(item => {
|
|
|
|
+ return item.children.length == 0;
|
|
|
|
+ });
|
|
|
|
+ form.listArr[index].assessmentObjectId = arr.map(item => item.value);
|
|
|
|
+ form.listArr[index].assessmentObjectName = arr.map(item => item.label);
|
|
};
|
|
};
|
|
const handleSelect = index => {
|
|
const handleSelect = index => {
|
|
- // console.log(index,'form.assessmentObjectList',form.assessmentObjectList[index].am);
|
|
|
|
- form.assessmentObjectList[index].assessmentModelName =
|
|
|
|
- form.assessmentObjectList[index].am.tpName;
|
|
|
|
- form.assessmentObjectList[index].assessmentModelId =
|
|
|
|
- form.assessmentObjectList[index].am.id;
|
|
|
|
- // resTmp.value.map(item => {
|
|
|
|
- // console.log(item);
|
|
|
|
- // if (item.id == node) {
|
|
|
|
- // form.assessmentObjectList.assessmentModelName = item.tpName;
|
|
|
|
- // }
|
|
|
|
- // });
|
|
|
|
|
|
+ form.listArr[index].assessmentModelName = form.listArr[index].am.tpName;
|
|
|
|
+ form.listArr[index].assessmentModelId = form.listArr[index].am.id;
|
|
};
|
|
};
|
|
const aaaa = a => {
|
|
const aaaa = a => {
|
|
console.log(a);
|
|
console.log(a);
|
|
};
|
|
};
|
|
// 考核类型
|
|
// 考核类型
|
|
const dpetTree = ref();
|
|
const dpetTree = ref();
|
|
|
|
+// 转换函数 --- 部门
|
|
|
|
+const convertDepartmentDataRecursive = data => {
|
|
|
|
+ return data.map(department => {
|
|
|
|
+ const { deptCode, deptName, childrenRes } = department;
|
|
|
|
+ return {
|
|
|
|
+ value: deptCode,
|
|
|
|
+ label: deptName,
|
|
|
|
+ children:
|
|
|
|
+ childrenRes.length > 0
|
|
|
|
+ ? childrenRes.map(child => convertDepartmentDataRecursive([child])[0])
|
|
|
|
+ : []
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+// 转换函数 --- 人员
|
|
|
|
+const convertDepartmentDataRecursive_Person = data => {
|
|
|
|
+ return data.map(department => {
|
|
|
|
+ const { userNameNew, userCodeNew, children } = department;
|
|
|
|
+ return {
|
|
|
|
+ value: userCodeNew,
|
|
|
|
+ label: userNameNew,
|
|
|
|
+ children:
|
|
|
|
+ children.length > 0
|
|
|
|
+ ? children.map(
|
|
|
|
+ child => convertDepartmentDataRecursive_Person([child])[0]
|
|
|
|
+ )
|
|
|
|
+ : []
|
|
|
|
+ };
|
|
|
|
+ });
|
|
|
|
+};
|
|
|
|
+const treeDeptListOkay = ref([]);
|
|
const assessmentTypeApi = async value => {
|
|
const assessmentTypeApi = async value => {
|
|
// 人员,医疗组,负责人
|
|
// 人员,医疗组,负责人
|
|
const { data, code } = await getTemplateInfoList(templateparams);
|
|
const { data, code } = await getTemplateInfoList(templateparams);
|
|
resTmp.value = data.records;
|
|
resTmp.value = data.records;
|
|
- console.log(value);
|
|
|
|
- // treeDept
|
|
|
|
- // postUserList,
|
|
|
|
- // postOrganizationUserPage,
|
|
|
|
- // getLeaderList
|
|
|
|
- const password = localStorage.getItem("password");
|
|
|
|
- const rolesName = localStorage.getItem("rolesName");
|
|
|
|
switch (value) {
|
|
switch (value) {
|
|
case 0:
|
|
case 0:
|
|
postListTreeWithUserApi();
|
|
postListTreeWithUserApi();
|
|
break;
|
|
break;
|
|
case 1:
|
|
case 1:
|
|
const { data, code } = await postListTree();
|
|
const { data, code } = await postListTree();
|
|
- dpetTree.value = data;
|
|
|
|
|
|
+ dpetTree.value = convertDepartmentDataRecursive(data);
|
|
break;
|
|
break;
|
|
case 2:
|
|
case 2:
|
|
const yiliao = await postOrganizationUserPage({
|
|
const yiliao = await postOrganizationUserPage({
|
|
@@ -270,6 +304,7 @@ const monthTime = ref("");
|
|
defineExpose({
|
|
defineExpose({
|
|
open
|
|
open
|
|
});
|
|
});
|
|
|
|
+const idList = ref([]);
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<template>
|
|
<template>
|
|
@@ -386,51 +421,45 @@ defineExpose({
|
|
<div class="w-1/3">
|
|
<div class="w-1/3">
|
|
<el-form
|
|
<el-form
|
|
label-position="top"
|
|
label-position="top"
|
|
- :model="form.assessmentObjectList"
|
|
|
|
|
|
+ :model="form.listArr"
|
|
:rules="formLeftRules"
|
|
:rules="formLeftRules"
|
|
>
|
|
>
|
|
<el-form-item label="被考核对象" prop="left">
|
|
<el-form-item label="被考核对象" prop="left">
|
|
<div
|
|
<div
|
|
- v-for="(item, index) in form.assessmentObjectList"
|
|
|
|
|
|
+ v-for="(item, index) in form.listArr"
|
|
:key="index"
|
|
:key="index"
|
|
class="w-full mt-1"
|
|
class="w-full mt-1"
|
|
>
|
|
>
|
|
<el-tree-select
|
|
<el-tree-select
|
|
v-if="form.assessmentType === 0"
|
|
v-if="form.assessmentType === 0"
|
|
ref="assessmentTypeRef"
|
|
ref="assessmentTypeRef"
|
|
- v-model="item.assessmentObjectId"
|
|
|
|
- :data="treeDept"
|
|
|
|
|
|
+ v-model="item.idList"
|
|
|
|
+ multiple
|
|
|
|
+ :data="convertDepartmentDataRecursive_Person(treeDept)"
|
|
:render-after-expand="false"
|
|
:render-after-expand="false"
|
|
show-checkbox
|
|
show-checkbox
|
|
- :props="{
|
|
|
|
- label: 'userNameNew',
|
|
|
|
- value: 'userCodeNew',
|
|
|
|
- children: 'children'
|
|
|
|
- }"
|
|
|
|
style="width: 180px"
|
|
style="width: 180px"
|
|
@check-change="handleRreeSelect(index)"
|
|
@check-change="handleRreeSelect(index)"
|
|
/>
|
|
/>
|
|
<el-tree-select
|
|
<el-tree-select
|
|
v-if="form.assessmentType === 1"
|
|
v-if="form.assessmentType === 1"
|
|
ref="assessmentTypeRef"
|
|
ref="assessmentTypeRef"
|
|
- v-model="item.assessmentObjectId"
|
|
|
|
|
|
+ v-model="item.idList"
|
|
:data="dpetTree"
|
|
:data="dpetTree"
|
|
- :render-after-expand="false"
|
|
|
|
show-checkbox
|
|
show-checkbox
|
|
- :props="{
|
|
|
|
- label: 'deptName',
|
|
|
|
- value: 'deptCode',
|
|
|
|
- children: 'childrenRes'
|
|
|
|
- }"
|
|
|
|
|
|
+ multiple
|
|
style="width: 180px"
|
|
style="width: 180px"
|
|
|
|
+ :render-after-expand="false"
|
|
@check-change="handleRreeSelect(index)"
|
|
@check-change="handleRreeSelect(index)"
|
|
/>
|
|
/>
|
|
<el-select
|
|
<el-select
|
|
v-if="
|
|
v-if="
|
|
form.assessmentType != 0 && form.assessmentType != 1
|
|
form.assessmentType != 0 && form.assessmentType != 1
|
|
"
|
|
"
|
|
- v-model="item.assessmentObjectId"
|
|
|
|
- @change="handChange"
|
|
|
|
|
|
+ ref="selectRefs"
|
|
|
|
+ v-model="item.idList"
|
|
|
|
+ multiple
|
|
|
|
+ @change="handChange(index)"
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="(it, id) in treeDeptList"
|
|
v-for="(it, id) in treeDeptList"
|
|
@@ -446,12 +475,12 @@ defineExpose({
|
|
<div class="w-1/2 ml-7">
|
|
<div class="w-1/2 ml-7">
|
|
<el-form
|
|
<el-form
|
|
label-position="top"
|
|
label-position="top"
|
|
- :model="form.assessmentObjectList"
|
|
|
|
|
|
+ :model="form.listArr"
|
|
:rules="formRightRules"
|
|
:rules="formRightRules"
|
|
>
|
|
>
|
|
<el-form-item label="考核模板" prop="right">
|
|
<el-form-item label="考核模板" prop="right">
|
|
<div
|
|
<div
|
|
- v-for="(item, index) in form.assessmentObjectList"
|
|
|
|
|
|
+ v-for="(item, index) in form.listArr"
|
|
:key="index"
|
|
:key="index"
|
|
class="w-full flex mt-1"
|
|
class="w-full flex mt-1"
|
|
>
|
|
>
|