From ceed4eccea0e2d9d51c6906ca214d251d7d22ca4 Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Tue, 26 Dec 2023 15:57:24 +0800
Subject: [PATCH] 头部按钮显示修改

---
 src/views/assessment/assessmentTaskSetting.vue |  238 +++++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 198 insertions(+), 40 deletions(-)

diff --git a/src/views/assessment/assessmentTaskSetting.vue b/src/views/assessment/assessmentTaskSetting.vue
index a956ea2..63e285c 100644
--- a/src/views/assessment/assessmentTaskSetting.vue
+++ b/src/views/assessment/assessmentTaskSetting.vue
@@ -1,48 +1,55 @@
 <template>
     <basic-container>
         <template v-if="isWeight">
-            <avue-crud ref="crud" v-model="form" v-model:search="search" :option="option" :data="data" v-model:page="page"
-                @search-change="searchChange" @search-reset="searchReset" @current-change="currentChange"
-                @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
+            <avue-tabs ref="tabs" :option="taskTypeList" @change="tabChange"></avue-tabs>
+            <avue-crud ref="crud" v-model="form" v-model:search="search" :option="!defaultTaskType ? option : deptOption"
+                :data="data" v-model:page="page" @search-change="searchChange" @search-reset="searchReset"
+                @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange"
+                @tree-load="treeLoad" @on-load="onLoad">
                 <template #menu="{ size, row, index }">
                     <el-button type="primary" size="small" @click="handleWeight(row)">
-                        考核权重
+                        添加考核人
                     </el-button>
+                </template>
+                <template #assessmentPerson="{ row }">
+                    <popoverTable :params="{...row, type: defaultTaskType}">
+                        <template #content>
+                            <el-button type="success" text size="small" icon="el-icon-pointer">考核人预览</el-button>
+                        </template>
+                    </popoverTable>
+                </template>
+                <template #deptCategory="{ row }">
+                    <el-tag>{{ row.deptCategoryName }}</el-tag>
                 </template>
             </avue-crud>
         </template>
         <template v-else>
-            <assessmentWeight :is="isWeight" @changeIs="changeIs" />
+            <assessmentWeight v-model:params="weightParams" @changeIs="changeIs" />
         </template>
     </basic-container>
 </template>
-  
+
 <script>
-import assessmentWeight from './assessmentWeight.vue'
+import assessmentWeight from './components/assessmentWeight.vue'
+import popoverTable from '@/views/assessment/components/popoverTable.vue'
 import { getList } from '@/api/system/user.js'
+import { getLazyList } from '@/api/system/dept';
+import _ from 'lodash'
 
 export default {
     components: {
-        assessmentWeight
-    },  
+        assessmentWeight,
+        popoverTable,
+    },
     data() {
         return {
             isWeight: true,
             form: {},
             query: {},
             search: {},
-            data: [
-                {
-                    id: '1',
-                    assessor: '张三',
-                    jobNumber: '123456',
-                    section: '研发部',
-                    postion: '研发工程师',
-                    personnelType: '普通员工',
-                    partnerType: '',
-                    contact: '123456789'
-                }
-            ],
+            weightParams: {},
+            data: [],
+            parentId: 0,
             option: {
                 height: 'auto',
                 calcHeight: 32,
@@ -55,6 +62,7 @@
                 editBtn: false,
                 delBtn: false,
                 menuWidth: 200,
+                menuFixed: 'right',
                 column: [
                     {
                         label: "主键",
@@ -67,81 +75,231 @@
                     },
                     {
                         label: "被考核人",
-                        prop: "assessor",
+                        prop: "name",
+                        // prop: "userName",
                         type: "input",
-                        search: true
+                        search: true,
+                        minWidth: 70
                     },
                     {
                         label: "工号",
-                        prop: 'jobNumber',
+                        prop: 'code',
                         type: "input",
+                        minWidth: 70
                     },
                     {
                         label: "部门",
-                        prop: "section",
-                        type: "input",
-                        search: true
+                        prop: "deptName",
+                        type: "tree",
+                        search: true,
+                        minWidth: 120,
+                        dicUrl: `/blade-system/dept/tree?tenantId=${this.website.tenantId}`,
+                        dicFormatter: (res) => {
+                            this.selectGroup.depts = res.data
+                            return res.data
+                        },
+                        props: {
+                            label: 'title',
+                            values: 'id'
+                        }
                     },
                     {
                         label: "职务",
                         prop: "postName",
-                        type: "input",
-                        search: true
+                        type: "select",
+                        search: true,
+                        minWidth: 100,
+                        dicUrl: `/blade-system/post/select?tenantId=${this.website.tenantId}`,
+                        dicFormatter: (res) => {
+                            this.selectGroup.posts = res.data
+                            return res.data
+                        },
+                        props: {
+                            label: 'postName',
+                            value: 'id'
+                        }
                     },
                     {
                         label: "人员类型",
                         prop: "personnelType",
                         type: "input",
+                        minWidth: 70
                     },
                     {
                         label: "合伙类型",
                         prop: "partnerType",
                         type: "input",
+                        minWidth: 70
                     },
                     {
                         label: "联系方式",
                         prop: "phone",
                         type: "input",
+                        minWidth: 150,
+                    },
+                    {
+                        label: "考核人",
+                        minWidth: 120,
+                        prop: "assessmentPerson",
+                        slot: true,
                     },
                 ]
+            },
+            deptOption: {
+                height: 'auto',
+                calcHeight: 32,
+                tip: false,
+                tree: true,
+                lazy: true,
+                searchMenuSpan: 6,
+                border: true,
+                index: true,
+                addBtn: false,
+                viewBtn: false,
+                editBtn: false,
+                delBtn: false,
+                menuWidth: 200,
+                column: [
+                    {
+                        label: '部门名称',
+                        prop: 'deptName',
+                        search: true,
+                    },
+                    {
+                        label: '部门全称',
+                        prop: 'fullName',
+                        // search: true,
+                    },
+                    {
+                        label: '机构类型',
+                        type: 'select',
+                        dicUrl: '/blade-system/dict/dictionary?code=org_category',
+                        props: {
+                            label: 'dictValue',
+                            value: 'dictKey',
+                        },
+                        dataType: 'number',
+                        width: 120,
+                        prop: 'deptCategory',
+                        slot: true,
+                    },
+                    {
+                        label: '考核人',
+                        prop: 'assessmentPerson',
+                        slot: true
+                    }
+                ],
             },
             page: {
                 pageSize: 10,
                 currentPage: 1,
                 total: 0,
             },
+            selectGroup: {
+                depts: [],
+                posts: []
+            },
+            // 考核结果参数
+            defaultTaskType: 0,
+            taskTypeList: {
+                column: [
+                    {
+                        label: '个人考核权重设置',
+                        prop: 0
+                    },
+                    {
+                        label: '部门考核权重设置',
+                        prop: 1
+                    }
+                ]
+            },
+        }
+    },
+    watch: {
+        defaultTaskType: {
+            handler(n) {
+                this.form = {}
+                this.query = {}
+                this.search = {}
+                this.weightParams = {}
+                this.page.currentPage = 1
+                this.onLoad(this.page, this.query);
+            },
+            immediate: true,
         }
     },
     methods: {
-        handleWeight(value) {
+        handleWeight(row) {
+            this.weightParams = { ...row }
+            this.defaultTaskType && (this.weightParams = { ...row, isDept: true })
+            this.weightParams.type = this.defaultTaskType
             this.isWeight = false
         },
         changeIs(is) {
             this.isWeight = is
+            this.$nextTick(() => {
+                this.$refs.tabs.active = this.defaultTaskType.toString()
+            })
         },
-        searchChange() { },
-        searchReset() { },
-        currentChange() { },
-        sizeChange() { },
-        refreshChange() { },
+        searchChange(params, done) {
+            if (!this.defaultTaskType) {
+                params.deptId = params.deptName || ''
+                params.postId = params.postName || ''
+                delete params.deptName
+                delete params.postName
+            }
+            this.parentId = ''
+            this.query = params;
+            this.page.currentPage = 1;
+            this.onLoad(this.page, params);
+            done();
+        },
+        searchReset() {
+            this.query = {};
+            this.parentId = void 0
+            this.onLoad(this.page);
+        },
+        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 {
             } = this.query;
             let values = {
+                ...this.query,
+                ...params,
+                userType: 2
             };
-
-            getList(page.currentPage, page.pageSize, values).then(res => {
-                console.log(res);
+            this.data = []
+            !this.defaultTaskType && getList(page.currentPage, page.pageSize, values, values.deptId).then(res => {
                 const data = res.data.data;
                 this.page.total = data.total;
                 this.data = data.records;
                 this.loading = false;
             });
+            this.defaultTaskType && getLazyList(this.parentId, values).then(res => {
+                this.data = res.data.data;
+                this.loading = false;
+            });
+        },
+        treeLoad(tree, treeNode, resolve) {
+            const parentId = tree.id;
+            getLazyList(parentId).then(res => {
+                resolve(res.data.data);
+            });
+        },
+        tabChange(value) {
+            this.defaultTaskType = value.prop
         }
     }
 }
 </script>
-  
+
 <style></style>
-  
\ No newline at end of file

--
Gitblit v1.9.3