From 9fc6db6472b1b8a5e8b78849b9a363d2cb5eb0ee Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Mon, 15 Jan 2024 16:09:02 +0800
Subject: [PATCH] 更新

---
 src/views/evaluate/components/referrerPopover.vue   |    6 +
 src/views/assessment/components/assessorDetails.vue |  136 ++++++++++++++++++++++
 src/views/evaluate/components/editSectionTask.vue   |   81 ++++++++++++-
 src/views/assessment/assessmentTask.vue             |   11 +
 src/views/evaluate/components/addSectionTask.vue    |   67 ++++++++++
 src/views/assessment/components/resultDetail.vue    |   29 +++-
 src/views/assessment/components/taskResult.vue      |   10 
 7 files changed, 311 insertions(+), 29 deletions(-)

diff --git a/src/views/assessment/assessmentTask.vue b/src/views/assessment/assessmentTask.vue
index 8b46238..0640d77 100644
--- a/src/views/assessment/assessmentTask.vue
+++ b/src/views/assessment/assessmentTask.vue
@@ -24,11 +24,11 @@
             考核设置
           </el-button>
           <el-button type="primary" icon="el-icon-view" text @click="handleAssessorDetails(row)">
-            考核人员详情
+            考核结果详情
           </el-button>
-          <el-button type="primary" icon="el-icon-view" text @click="handleTaskResult(row)">
+          <!-- <el-button type="primary" icon="el-icon-view" text @click="handleTaskResult(row)">
             考核结果
-          </el-button>
+          </el-button> -->
           <el-button type="danger" icon="el-icon-delete" text @click="rowDel(row)">
             删除
           </el-button>
@@ -142,6 +142,11 @@
       return ids.join(",");
     }
   },
+  provide() {
+    return {
+      type: () => this.defaultTaskType
+    }
+  },
   methods: {
     handleTaskSetting(row) {
       this.curIndex = 1;
diff --git a/src/views/assessment/components/assessorDetails.vue b/src/views/assessment/components/assessorDetails.vue
index 5cf15e1..5c3ac6e 100644
--- a/src/views/assessment/components/assessorDetails.vue
+++ b/src/views/assessment/components/assessorDetails.vue
@@ -1,11 +1,25 @@
 <template>
-    <el-dialog v-model="params.visible" :title="params.data.assessmentNo ? `考核编号(${params.data.assessmentNo})` : '考核人员详情'">
+    <el-dialog v-model="params.visible" :title="params.data?.assessmentNo ? `考核编号(${params.data.assessmentNo})` : '考核人员详情'"
+        width="65%" @open="dialogOpen">
+        <avue-crud :option="option" :table-loading="loading" :data="data" v-model:page="page" @search-change="searchChange"
+            @search-reset="searchReset" @current-change="currentChange" @size-change="sizeChange"
+            @refresh-change="refreshChange" @on-load="onLoad">
+            <template #menu="{ row }">
+                <el-button type="success" icon="el-icon-view" text @click="handleViewDetails(row)">查看详情</el-button>
+            </template>
+        </avue-crud>
+        <resultDetail :params="detailParams" />
     </el-dialog>
 </template>
 
 <script>
+import { getList } from '@/api/assessment/assessmentScore'
+import resultDetail from './resultDetail.vue'
 
 export default {
+    components: {
+        resultDetail
+    },
     props: {
         params: {
             type: Object,
@@ -16,11 +30,125 @@
                 }
             }
         }
+    },
+    data() {
+        return {
+            loading: true,
+            query: {},
+            data: [],
+            page: {
+                pageSize: 10,
+                currentPage: 1,
+                total: 0
+            },
+            option: {
+                height: '400',
+                calcHeight: 30,
+                tip: false,
+                searchShow: true,
+                searchMenuSpan: 6,
+                border: true,
+                index: true,
+                viewBtn: false,
+                addBtn: false,
+                editBtn: false,
+                delBtn: false,
+                viewBtn: false,
+                menuWidth: 150,
+                dialogClickModal: false,
+                column: [
+                    {
+                        label: "工号",
+                        prop: 'code',
+                        type: "input",
+                    },
+                    {
+                        label: "被考核人",
+                        prop: "userName",
+                        type: "input",
+                        search: true,
+                    },
+                    {
+                        label: "部门",
+                        prop: "deptName",
+                        type: "select",
+                        dicUrl: '/api/blade-system/dept/lazy-list?parentId=1737282385453543425',
+                        search: true,
+                        props: {
+                            label: 'deptName',
+                            value: 'fullName'
+                        },
+                        overHidden: true
+                    },
+                    {
+                        label: "职务",
+                        prop: "postName",
+                        type: "input",
+                    },
+                    {
+                        label: "考核分",
+                        prop: "scoreVal",
+                        type: "input",
+                    }
+                ]
+            },
+            detailParams: {}
+        }
+    },
+    methods: {
+        searchReset() {
+            this.query = {};
+            this.onLoad(this.page, { type: this.defaultTaskType });
+        },
+        searchChange(params, done) {
+            this.query = {
+                ...params,
+            };
+            this.page.currentPage = 1;
+            this.onLoad(this.page, params);
+            done();
+        },
+        currentChange(currentPage) {
+            this.page.currentPage = currentPage;
+        },
+        sizeChange(pageSize) {
+            this.page.pageSize = pageSize;
+        },
+        refreshChange() {
+            this.onLoad(this.page, this.query);
+        },
+        onLoad(page, params = {}) {
+            this.loading = true;
+
+            const { id, type } = this.params.data
+
+            const {
+            } = this.query;
+
+            let values = {
+                ...this.query,
+                ...params
+            };
+            getList(page.currentPage, page.pageSize, values, type, id).then(res => {
+                const data = res.data.data;
+                this.page.total = data.total;
+                this.data = data.records;
+                this.loading = false;
+            });
+        },
+        dialogOpen() {
+            this.onLoad(this.page)
+        },
+        handleViewDetails(row) {
+            this.detailParams = {
+                visible: true,
+                isSendBack: true,
+                ...row
+            }
+        }
     }
 }
 
 </script>
 
-<style lang="scss" scoped>
-
-</style>
\ No newline at end of file
+<style lang="scss" scoped></style>
\ No newline at end of file
diff --git a/src/views/assessment/components/resultDetail.vue b/src/views/assessment/components/resultDetail.vue
index 6e09a3f..5f87ede 100644
--- a/src/views/assessment/components/resultDetail.vue
+++ b/src/views/assessment/components/resultDetail.vue
@@ -1,6 +1,9 @@
 <template>
     <el-dialog title="详情" v-model="params.visible" width="60%" destroy-on-close>
         <avue-crud :data="data" v-model:page="page" :option="option" @on-load="onLoad" >
+            <!-- <template #menu="{row}">
+                <el-button type="warning" icon="el-icon-info-filled" text @click="sendBack(row)">驳回</el-button>
+            </template> -->
         </avue-crud>
     </el-dialog>
 </template>
@@ -23,40 +26,49 @@
     menu: false,
     menuLeft: false,
     header: false,
+    menuWidth: 120,
     column: [
         {
             label: '参与考核人',
             type: 'input',
-            prop: 'scoreUserName'
+            prop: 'scoreUserName',
+            minWidth: 100
         },
         {
             label: '职务',
             type: 'input',
-            prop: 'scorePostName'
+            prop: 'scorePostName',
+            minWidth: 100
         },
         {
             label: '部门',
             type: 'input',
-            prop: 'scoreDeptName'
+            prop: 'scoreDeptName',
+            minWidth: 130
         },
         {
             label: '权值',
             type: 'input',
-            prop: 'weight'
+            prop: 'weight',
+            minWidth: 100
         },
         {
             label: '考核分数',
             type: 'input',
-            prop: 'scoreVal'
+            prop: 'scoreVal',
+            minWidth: 100
         },
         {
             label: '考核评语',
             type: 'input',
-            prop: 'remark'
+            prop: 'remark',
+            overHidden: true,
+            minWidth: 100
         },
         {
             label: '考核状态',
             type: 'input',
+            minWidth: 100,
             formatter: () => {
                 return '评分完成'
             }
@@ -78,17 +90,20 @@
         default: () => {
             return {
                 visible: false,
+                isSendBack: false
             }
         }
     }
 })
 
+const sendBack = (row) => {
+    console.log(row);
+}
 
 const onLoad = () => {
     const { beId, assessmentTaskId, visible } = $props.params
     visible && getDetailList(beId, assessmentTaskId).then(res => {
         data.value = res.data.data.records
-        console.log(res.data.data);
     })
 }
 
diff --git a/src/views/assessment/components/taskResult.vue b/src/views/assessment/components/taskResult.vue
index 87630cf..ad1a7b2 100644
--- a/src/views/assessment/components/taskResult.vue
+++ b/src/views/assessment/components/taskResult.vue
@@ -58,15 +58,15 @@
                 searchLabelWidth: 100,
                 column: [
                     {
+                        label: "工号",
+                        prop: 'code',
+                        type: "input",
+                    },
+                    {
                         label: "被考核人",
                         prop: "userName",
                         type: "input",
                         search: true,
-                    },
-                    {
-                        label: "工号",
-                        prop: 'code',
-                        type: "input",
                     },
                     {
                         label: "部门",
diff --git a/src/views/evaluate/components/addSectionTask.vue b/src/views/evaluate/components/addSectionTask.vue
index 366e638..9e8ec3c 100644
--- a/src/views/evaluate/components/addSectionTask.vue
+++ b/src/views/evaluate/components/addSectionTask.vue
@@ -13,8 +13,11 @@
                 </el-form-item>
                 <el-form-item label="投票人员" prop="pollingPersons">
                     <el-checkbox-group v-model="form.pollingPersons">
-                        <el-checkbox v-for="item in employeeDict" :key="item.id" :label="item.dictKey">
+                        <el-checkbox v-for="item in employeeDict" :key="item.id" :label="item.dictKey"
+                            @change="checkBoxChange($event, item)">
                             {{ item.dictValue }}
+                            <el-button type="primary" icon="el-icon-edit" text
+                                @click="selectionHandler(item)">设置人员</el-button>
                         </el-checkbox>
                     </el-checkbox-group>
                 </el-form-item>
@@ -35,6 +38,8 @@
             <el-button @click="() => params.visible = false">取消</el-button>
             <el-button type="primary" @click="submit">确定</el-button>
         </template>
+        <!-- 人员选择 -->
+        <selectionDialog :params="selectionParams" @addEvaluateParams="addEvaluateParams" />
     </el-dialog>
 </template>
 
@@ -42,9 +47,13 @@
 import { getDict } from '@/api/dict'
 import { update } from '@/api/evaluate/evaluateTask'
 import _ from 'lodash';
+import selectionDialog from './selectionDialog.vue';
 
 export default {
     inject: ['type'],
+    components: {
+        selectionDialog
+    },
     props: {
         params: {
             type: Object,
@@ -65,6 +74,7 @@
                 evaluateAwards: '',
                 identificationStandard: '',
                 pollingPersons: [],
+                votePersonObjInfo: [],
                 evaluateCutoffTimeStart: '',
                 evaluateCutoffTimeEnd: ''
             },
@@ -122,7 +132,8 @@
                     }
                 ]
             },
-            employeeDict: []
+            employeeDict: [],
+            selectionParams: {}
         }
     },
     methods: {
@@ -153,6 +164,58 @@
                 }
                 this.employeeDict = data
             })
+        },
+        selectionHandler(row) {
+            const obj = this.form.votePersonObjInfo.find(item => item.employeeType === row.dictKey) || {}
+            this.selectionParams = {
+                visible: true,
+                data: row,
+                values: obj
+            }
+        },
+        checkBoxChange(e, { dictKey }) {
+            const index = this.form.votePersonObjInfo.findIndex(item => item.employeeType === dictKey)
+            if (!e) {
+                this.form.votePersonObjInfo.splice(index, 1)
+                return
+            }
+            getEmployeeLevelList(dictKey).then((res) => {
+                const { code, data } = res.data
+                if (code !== 200) return this.$message.error('当前级别人员加载失败,请重试!!')
+                const participateInList = data.map(item => {
+                    const { id, name, deptId, deptName, postId, postName } = item
+                    return { id, name, deptId, deptName, postId, postName }
+                })
+                const params = {
+                    employeeType: dictKey,
+                    participateIn: participateInList,
+                    notParticipateIn: []
+                }
+                if (index === -1) {
+                    this.form.votePersonObjInfo.push(params)
+                } else {
+                    this.form.votePersonObjInfo[index] = params
+                }
+            })
+        },
+        addEvaluateParams(params) {
+            const { participateIn, employeeType } = params
+            const index = this.form.votePersonObjInfo.findIndex(item => item.employeeType === employeeType)
+            const typeIndex = this.form.pollingPersons.findIndex(item => item === employeeType)
+
+            if (index === -1) {
+                if (participateIn.length > 0) {
+                    this.form.votePersonObjInfo.push(params)
+                    this.form.pollingPersons.push(params.employeeType)
+                }
+            } else {
+                if (participateIn.length > 0) {
+                    this.form.votePersonObjInfo[index] = params
+                } else {
+                    this.form.votePersonObjInfo.splice(index, 1)
+                    this.form.pollingPersons.splice(typeIndex, 1)
+                }
+            }
         }
     }
 };
diff --git a/src/views/evaluate/components/editSectionTask.vue b/src/views/evaluate/components/editSectionTask.vue
index 74027f0..b1ed574 100644
--- a/src/views/evaluate/components/editSectionTask.vue
+++ b/src/views/evaluate/components/editSectionTask.vue
@@ -14,8 +14,11 @@
                 </el-form-item>
                 <el-form-item label="投票人员" prop="pollingPersons">
                     <el-checkbox-group v-model="form.pollingPersons">
-                        <el-checkbox v-for="item in employeeDict" :key="item.id" :label="item.dictKey">
+                        <el-checkbox v-for="item in employeeDict" :key="item.id" :label="item.dictKey"
+                            @change="checkBoxChange($event, item)">
                             {{ item.dictValue }}
+                            <el-button type="primary" icon="el-icon-edit" text
+                                @click="selectionHandler(item)">设置人员</el-button>
                         </el-checkbox>
                     </el-checkbox-group>
                 </el-form-item>
@@ -36,6 +39,8 @@
             <el-button @click="() => params.visible = false">取消</el-button>
             <el-button type="primary" @click="submit">确定</el-button>
         </template>
+        <!-- 人员选择 -->
+        <selectionDialog :params="selectionParams" @addEvaluateParams="addEvaluateParams" />
     </el-dialog>
 </template>
 
@@ -43,9 +48,13 @@
 import { getDict } from '@/api/dict'
 import { update } from '@/api/evaluate/evaluateTask'
 import _ from 'lodash';
+import selectionDialog from './selectionDialog.vue';
 
 export default {
     inject: ['type'],
+    components: {
+        selectionDialog
+    },
     props: {
         params: {
             type: Object,
@@ -66,6 +75,7 @@
                 evaluateAwards: '',
                 identificationStandard: '',
                 pollingPersons: [],
+                votePersonObjInfo: [],
                 evaluateCutoffTimeStart: '',
                 evaluateCutoffTimeEnd: ''
             },
@@ -122,7 +132,8 @@
                     }
                 ]
             },
-            employeeDict: []
+            employeeDict: [],
+            selectionParams: {}
         }
     },
     methods: {
@@ -131,16 +142,18 @@
         },
         openDialog() {
             this.initDict()
-            const { id, taskName, evaluateAwards, identificationStandard, pollingPersons, evaluateCutoffTimeStart, evaluateCutoffTimeEnd } = this.params.data
+            const { id, taskName, evaluateAwards, identificationStandard, pollingPersons, votePersonObjInfo, evaluateCutoffTimeStart, evaluateCutoffTimeEnd } = this.params.data
             this.form = {
                 id,
-                taskName, 
-                evaluateAwards, 
-                identificationStandard, 
-                pollingPersons: pollingPersons.split(','), 
-                evaluateCutoffTimeStart, 
+                taskName,
+                evaluateAwards,
+                identificationStandard,
+                pollingPersons: pollingPersons.split(',') || [],
+                votePersonObjInfo: JSON.parse(votePersonObjInfo) || [],
+                evaluateCutoffTimeStart,
                 evaluateCutoffTimeEnd
             }
+            console.log(this.form);
         },
         submit() {
             this.$refs.formRef.validate(vaild => {
@@ -164,6 +177,58 @@
                 }
                 this.employeeDict = data
             })
+        },
+        selectionHandler(row) {
+            const obj = this.form.votePersonObjInfo.find(item => item.employeeType === row.dictKey) || {}
+            this.selectionParams = {
+                visible: true,
+                data: row,
+                values: obj
+            }
+        },
+        checkBoxChange(e, { dictKey }) {
+            const index = this.form.votePersonObjInfo.findIndex(item => item.employeeType === dictKey)
+            if (!e) {
+                this.form.votePersonObjInfo.splice(index, 1)
+                return
+            }
+            getEmployeeLevelList(dictKey).then((res) => {
+                const { code, data } = res.data
+                if (code !== 200) return this.$message.error('当前级别人员加载失败,请重试!!')
+                const participateInList = data.map(item => {
+                    const { id, name, deptId, deptName, postId, postName } = item
+                    return { id, name, deptId, deptName, postId, postName }
+                })
+                const params = {
+                    employeeType: dictKey,
+                    participateIn: participateInList,
+                    notParticipateIn: []
+                }
+                if (index === -1) {
+                    this.form.votePersonObjInfo.push(params)
+                } else {
+                    this.form.votePersonObjInfo[index] = params
+                }
+            })
+        },
+        addEvaluateParams(params) {
+            const { participateIn, employeeType } = params
+            const index = this.form.votePersonObjInfo.findIndex(item => item.employeeType === employeeType)
+            const typeIndex = this.form.pollingPersons.findIndex(item => item === employeeType)
+
+            if (index === -1) {
+                if (participateIn.length > 0) {
+                    this.form.votePersonObjInfo.push(params)
+                    this.form.pollingPersons.push(params.employeeType)
+                }
+            } else {
+                if (participateIn.length > 0) {
+                    this.form.votePersonObjInfo[index] = params
+                } else {
+                    this.form.votePersonObjInfo.splice(index, 1)
+                    this.form.pollingPersons.splice(typeIndex, 1)
+                }
+            }
         }
     }
 };
diff --git a/src/views/evaluate/components/referrerPopover.vue b/src/views/evaluate/components/referrerPopover.vue
index 8b16aee..9af3329 100644
--- a/src/views/evaluate/components/referrerPopover.vue
+++ b/src/views/evaluate/components/referrerPopover.vue
@@ -47,11 +47,17 @@
             label: '职位',
             type: 'input',
             prop: 'postName',
+            formatter: (_row, value) => {
+                return value.join('、')
+            }
         },
         {
             label: '部门',
             type: 'input',
             prop: 'deptName',
+            formatter: (_row, value) => {
+                return value.join('、')
+            }
         },
         {
             label: '推荐理由',

--
Gitblit v1.9.3