|
@@ -14,10 +14,22 @@ import {
|
|
|
import { getTemplateInfoList } from "@/api/templateInfo";
|
|
|
import { useRouter } from "vue-router";
|
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
-import { treeDept, postListTreeWithUserApi } from "@/api/department";
|
|
|
+import {
|
|
|
+ treeDept,
|
|
|
+ postListTreeWithUserApi,
|
|
|
+ postListTree
|
|
|
+} from "@/api/department";
|
|
|
import { Search } from "@element-plus/icons-vue";
|
|
|
import messagePerson from "./message.vue";
|
|
|
import dayjs from "dayjs";
|
|
|
+// 人员,医疗组,负责人
|
|
|
+import {
|
|
|
+ postUserList,
|
|
|
+ postOrganizationUserPage,
|
|
|
+ getLeaderList
|
|
|
+} from "@/api/userSetting";
|
|
|
+// 获取医疗组的数据
|
|
|
+import { postPageGroup } from "@/api/userGroup";
|
|
|
const $props = defineProps({
|
|
|
message: {
|
|
|
type: Object
|
|
@@ -70,9 +82,38 @@ const state = reactive({
|
|
|
tableType: 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 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 dpetTree = ref([]);
|
|
|
onMounted(() => {
|
|
|
- // messageData.value.assessmentType
|
|
|
- console.log("dsafa", messageData.value);
|
|
|
Object.assign(messageData.value, $props.message);
|
|
|
switch (messageData.value.assessmentType) {
|
|
|
case 0:
|
|
@@ -87,16 +128,38 @@ onMounted(() => {
|
|
|
case 3:
|
|
|
initParams.assessmentType = "员工";
|
|
|
}
|
|
|
+ assessmentTypeApi(messageData.value.assessmentType);
|
|
|
initParams.params.assessmentId = $props.message.id;
|
|
|
initParams.objParams.assessmentId = $props.message.id;
|
|
|
initParams.indexParams.assessmentId = $props.message.id;
|
|
|
state.tableType = $props.message.assessmentType;
|
|
|
getAssessmentQuotaDetailsApi();
|
|
|
getTemplateInfoListApi();
|
|
|
- postListTreeWithUserApi();
|
|
|
getAssessmentObjectDetailsApi();
|
|
|
- console.log("onMounted", $props.message);
|
|
|
});
|
|
|
+const treeDeptList = ref([]);
|
|
|
+const assessmentTypeApi = async value => {
|
|
|
+ switch (value) {
|
|
|
+ case 0:
|
|
|
+ postListTreeWithUserApi();
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ const { data, code } = await postListTree();
|
|
|
+ dpetTree.value = convertDepartmentDataRecursive(data);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ const yiliao = await postPageGroup({
|
|
|
+ pageNumber: 1,
|
|
|
+ pageSize: 1000
|
|
|
+ });
|
|
|
+ treeDeptList.value = yiliao.data.records;
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ const fuzhere = await getLeaderList();
|
|
|
+ console.log(fuzhere);
|
|
|
+ treeDeptList.value = fuzhere.data;
|
|
|
+ }
|
|
|
+};
|
|
|
// 指标分页查询
|
|
|
const getAssessmentQuotaDetailsApi = async () => {
|
|
|
const res = await getAssessmentQuotaDetails(initParams.indexParams);
|
|
@@ -153,13 +216,11 @@ const changeSelection = val => {
|
|
|
if (val) {
|
|
|
valSelection.value = true;
|
|
|
delParams.objectAddVoList = [];
|
|
|
- console.log(val, "获取的批量选中的数据");
|
|
|
delParams.assessmentId = messageData.value.id;
|
|
|
addPersonParams.assessmentId = messageData.value.id;
|
|
|
let assessmentObjectId;
|
|
|
let assessmentObjectName;
|
|
|
val.forEach((item, index) => {
|
|
|
- console.log(item, "循环过滤的数据");
|
|
|
const obj = {
|
|
|
assessmentObjectId: item.assessmentObjectId,
|
|
|
assessmentObjectName: item.assessmentObjectName
|
|
@@ -191,22 +252,62 @@ const publish = () => {
|
|
|
};
|
|
|
// 添加被考核人
|
|
|
const dialogVisibleAdd = ref(false);
|
|
|
+const assessmentTypeRef = ref();
|
|
|
+const transformArrayFormat = data => {
|
|
|
+ return data.assessmentObjectId
|
|
|
+ .map((item, index) => {
|
|
|
+ return {
|
|
|
+ assessmentObjectId: item,
|
|
|
+ assessmentObjectName: data.assessmentObjectName[index]
|
|
|
+ };
|
|
|
+ })
|
|
|
+ .flat();
|
|
|
+};
|
|
|
+// 人员 ---- 部门
|
|
|
const handleRreeSelect = data => {
|
|
|
- addPersonParams.objectAddVoList.push({
|
|
|
- assessmentObjectId: data.userCode,
|
|
|
- assessmentObjectName: data.userName
|
|
|
+ const list = ref({});
|
|
|
+ const arr = assessmentTypeRef.value.getCheckedNodes().filter(item => {
|
|
|
+ return item.children.length == 0;
|
|
|
});
|
|
|
- console.log("1111111", data);
|
|
|
+ list.value.assessmentObjectId = arr.map(item => item.value);
|
|
|
+ list.value.assessmentObjectName = arr.map(item => item.label);
|
|
|
+ addPersonParams.objectAddVoList = transformArrayFormat(list);
|
|
|
};
|
|
|
+// 医疗 --- 医疗主任
|
|
|
+const handChange = () => {
|
|
|
+ const list = ref({});
|
|
|
+ const arr = treeDeptList.value.filter(item => {
|
|
|
+ return value1.value.includes(item.groupCode);
|
|
|
+ });
|
|
|
+ list.value.assessmentObjectId = arr.map(item => item.groupCode);
|
|
|
+ list.value.assessmentObjectName = arr.map(item => item.groupName);
|
|
|
+ addPersonParams.objectAddVoList = transformArrayFormat(list);
|
|
|
+};
|
|
|
+
|
|
|
const dialogVisibleAddShow = () => {
|
|
|
dialogVisibleAdd.value = true;
|
|
|
};
|
|
|
// 跳转对应科室
|
|
|
const GoView = row => {
|
|
|
- router.push({
|
|
|
- name: "departmentDrank",
|
|
|
- query: { ...messageData.value, deptId: row.deptId }
|
|
|
- });
|
|
|
+ const arr = {
|
|
|
+ "0": "/draw/children/worker/workerDrak",
|
|
|
+ "1": "/draw/children/department/departmentDrank",
|
|
|
+ "2": "/draw/children/health/healthDrank",
|
|
|
+ "3": "/draw/children/head/headDrank"
|
|
|
+ };
|
|
|
+ for (let key in arr) {
|
|
|
+ if ($props.message.assessmentType == key) {
|
|
|
+ router.push({
|
|
|
+ path: arr[key],
|
|
|
+ query: { ...messageData.value, deptId: row.deptId }
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // router.push({
|
|
|
+ // name: "departmentDrank",
|
|
|
+ // query: { ...messageData.value, },
|
|
|
+ // });
|
|
|
};
|
|
|
// 考核对象
|
|
|
const objList = ref([]);
|
|
@@ -245,7 +346,8 @@ const updateAssessmentQuotaDetailsApi = async row => {
|
|
|
assessmentObjectId: row.assessmentObjectId,
|
|
|
assessmentModelId: row.assessmentModelId,
|
|
|
score: row.score,
|
|
|
- finalValue: row.finalValue
|
|
|
+ finalValue: row.finalValue,
|
|
|
+ assessmentId: messageData.value.id
|
|
|
});
|
|
|
if (code === 200) {
|
|
|
ElMessage.success("修改成功");
|
|
@@ -259,7 +361,6 @@ const editConfig = ref({
|
|
|
mode: "cell"
|
|
|
});
|
|
|
const editClosedEvent = ({ row, column }) => {
|
|
|
- console.log("row", row);
|
|
|
const $table = tableVxeRef.value;
|
|
|
if ($table) {
|
|
|
updateAssessmentQuotaDetailsApi(row);
|
|
@@ -267,6 +368,28 @@ const editClosedEvent = ({ row, column }) => {
|
|
|
// postUpdateApi();
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+// 关闭弹窗
|
|
|
+const closePerson = () => {
|
|
|
+ Object.assign(addPersonParams, {
|
|
|
+ assessmentId: "",
|
|
|
+ objectAddVoList: []
|
|
|
+ });
|
|
|
+ value1.value = [];
|
|
|
+ dialogVisibleAdd.value = false;
|
|
|
+};
|
|
|
+
|
|
|
+// 添加被考核人
|
|
|
+const addPerson = async () => {
|
|
|
+ addPersonParams.assessmentId = $props.message.id;
|
|
|
+ const { data, msg, code } = await postAddAssessmentObject(addPersonParams);
|
|
|
+ if (code === 200) {
|
|
|
+ ElMessage.success("添加成功");
|
|
|
+ dialogVisibleAdd.value = false;
|
|
|
+ getAssessmentObjectDetailsApi();
|
|
|
+ closePerson();
|
|
|
+ }
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
@@ -535,29 +658,52 @@ const editClosedEvent = ({ row, column }) => {
|
|
|
>
|
|
|
<el-form-item label="维度权重" label-position="top">
|
|
|
<el-tree-select
|
|
|
+ v-if="$props.message.assessmentType == 0"
|
|
|
+ ref="assessmentTypeRef"
|
|
|
v-model="value1"
|
|
|
- :data="treeDept"
|
|
|
+ :data="convertDepartmentDataRecursive_Person(treeDept)"
|
|
|
multiple
|
|
|
- :props="{
|
|
|
- label: 'userNameNew',
|
|
|
- value: 'userCodeNew',
|
|
|
- children: 'children'
|
|
|
- }"
|
|
|
:render-after-expand="false"
|
|
|
show-checkbox
|
|
|
- check-strictly
|
|
|
- check-on-click-node
|
|
|
style="width: 240px"
|
|
|
@check-change="handleRreeSelect"
|
|
|
/>
|
|
|
+ <el-tree-select
|
|
|
+ v-if="$props.message.assessmentType == 1"
|
|
|
+ ref="assessmentTypeRef"
|
|
|
+ v-model="value1"
|
|
|
+ :data="dpetTree"
|
|
|
+ multiple
|
|
|
+ :render-after-expand="false"
|
|
|
+ show-checkbox
|
|
|
+ style="width: 240px"
|
|
|
+ @check-change="handleRreeSelect"
|
|
|
+ />
|
|
|
+ <el-select
|
|
|
+ v-if="
|
|
|
+ $props.message.assessmentType != 0 &&
|
|
|
+ $props.message.assessmentType != 1
|
|
|
+ "
|
|
|
+ ref="selectRefs"
|
|
|
+ v-model="value1"
|
|
|
+ multiple
|
|
|
+ @change="handChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(it, id) in treeDeptList"
|
|
|
+ :key="id"
|
|
|
+ :label="it.groupName"
|
|
|
+ :value="it.groupCode"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer w-full flex justify-between mt-4">
|
|
|
<div>
|
|
|
- <el-button>取消</el-button>
|
|
|
- <el-button type="primary"> 确认 </el-button>
|
|
|
+ <el-button @click="closePerson">取消</el-button>
|
|
|
+ <el-button type="primary" @click="addPerson"> 确认 </el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|