Browse Source

Merge branch 'master' of http://47.100.37.243:10191/wutt/manHourHousekeeper

Min 10 tháng trước cách đây
mục cha
commit
bfd743fea7

+ 204 - 0
fhKeeper/formulahousekeeper/timesheet/src/components/departmentSelectionPersonnel.vue

@@ -0,0 +1,204 @@
+<template>
+    <el-dialog :title="$t('selectingParticipants')" :visible.sync="participantsVisible" :close-on-click-modal="false"
+        customClass="customWidth" width="500px" :before-close="changeVisable">
+        <div class="tree" style="height:400px">
+            <el-scrollbar style="height:100%">
+                <el-input v-if="user.userNameNeedTranslate != 1" :placeholder="$t('keywordfiltering')"
+                    v-model="participantsFilterText">
+                </el-input>
+
+                <div v-if="user.userNameNeedTranslate == '1'">
+                    <el-input :placeholder="$t('qingShuShuRuGuanJianZiGuoLv')" v-model.trim="participantsFilterText"
+                        class="input-with-select" @keyup.enter.native="echartDepartment()">
+                        <el-button slot="append" icon="el-icon-search" @click="echartDepartment()"></el-button>
+                    </el-input>
+                </div>
+
+                <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id" ref="chooseMembTree2"
+                    @check-change="onTreeItemChange" :default-checked-keys="alreadyPartArray" highlight-current
+                    :filter-node-method="filterNode" v-loading="filterNodeFlag">
+                    <span class="custom-tree-node" slot-scope="{ node, data }">
+                        <span v-if="user.userNameNeedTranslate == '1'">
+                            <span v-if="node.data.children">
+                                <TranslationOpenDataText type='departmentName' :openid='node.label'>
+                                </TranslationOpenDataText>
+                            </span>
+                            <span v-else>
+                                <TranslationOpenDataText type='userName' :openid='node.label'></TranslationOpenDataText>
+                            </span>
+                        </span>
+                        <span v-if="user.userNameNeedTranslate != '1'">
+                            {{ node.label }}
+                        </span>
+                    </span>
+                </el-tree>
+            </el-scrollbar>
+        </div>
+        <div>{{ $t('btn.choose') }}&nbsp;{{ chosenMembCount }}&nbsp;{{ $t('other.people') }}</div>
+        <div slot="footer" class="dialog-footer">
+            <el-button @click="changeVisable()">{{ $t('btn.cancel') }}</el-button>
+            <el-button type="primary" @click="submitData()">{{ $t('btn.determine') }}</el-button>
+        </div>
+    </el-dialog>
+</template>
+
+<script>
+export default {
+    name: '',
+    components: {},
+    props: {
+        visible: {
+            type: Boolean,
+            default: false
+        }
+    },
+    data() {
+        return {
+            participantsFilterText: '',
+            participantsVisible: false,
+            filterNodePersonnel: [],
+            chosenMembCount: 0,
+            alreadyPartArray: [], // 已参与的人员
+            filterNodeFlag: false,
+            user: JSON.parse(sessionStorage.getItem("user")),
+            permissions: JSON.parse(sessionStorage.getItem("permissions")),
+            deptMembData: [
+                {
+                    id: 0,
+                    label: this.$t('lable.unassigned'),
+                }
+            ],
+            defaultProps: {
+                children: 'children',
+                label: 'label'
+            },
+        }
+    },
+    computed: {},
+    watch: {
+        visible(val) {
+            console.log('执行')
+            this.participantsVisible = val
+        },
+        participantsFilterText(val) {
+            let { userNameNeedTranslate } = JSON.parse(sessionStorage.getItem("user"))
+            if (userNameNeedTranslate != 1) {
+                this.$refs.chooseMembTree2.filter(val);
+            }
+            if (!val) {
+                this.$refs.chooseMembTree2.filter(val);
+            }
+        }
+    },
+    created() { },
+    mounted() {
+        this.getDepartmentList()
+    },
+    methods: {
+        submitData() {
+            let chosenList = this.$refs.chooseMembTree2.getCheckedNodes();
+            let chose2 = chosenList.filter(item => item.isUser == 1)
+            if((chose2 || []).length == 0) {
+                this.$message({
+                    message: this.$t('pleaseselectpersonnel'),
+                    type: "error"
+                });
+                return
+            }
+            this.$refs.chooseMembTree2.setCheckedKeys([]);
+            this.$emit("submitParticipant", chose2)
+        },
+        changeVisable(done) {
+            this.$refs.chooseMembTree2.setCheckedKeys([]);
+            this.$emit("changeParticipant", false)
+            if (done) {
+                done()
+            }
+        },
+        // 筛选逻辑
+        filterNode(value, data) {
+            let { userNameNeedTranslate } = this.user
+            if (!value) return true;
+            if (userNameNeedTranslate != '1') {
+                return data.label.indexOf(value) !== -1;
+            } else {
+                return this.filterNodePersonnel.some(item => item.includes(data.label))
+            }
+        },
+        // 选中改变
+        onTreeItemChange() {
+            var chosenList = this.$refs.chooseMembTree2.getCheckedNodes();
+            var list = chosenList.filter(item => item.isUser == 1);
+            this.chosenMembCount = list.length;
+        },
+        echartDepartment() {
+            if (this.participantsFilterText != '') {
+                this.filterNodeFlag = true
+                this.http.post("/user/getEmployeeList", {
+                    keyword: this.participantsFilterText,
+                    cursor: '',
+                    departmentId: -1,
+                    pageIndex: 1,
+                    pageSize: 1000
+                },
+                    res => {
+                        if (res.code == "ok") {
+                            this.filterNodePersonnel = res.data.records.map(item => item.name)
+                            this.$refs.chooseMembTree2.filter(this.participantsFilterText);
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                        this.filterNodeFlag = false
+                    },
+                    error => {
+                        this.filterNodeFlag = false
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                    });
+            }
+        },
+        getDepartmentList() {
+            this.http.post('/department/listAllMemb', {
+            }, res => {
+                if (res.code == 'ok') {
+                    let list = res.data
+                    this.haveUsersList(list)
+                    this.deptMembData = JSON.parse(JSON.stringify(list))
+                } else {
+                    this.$message({
+                        message: res.msg,
+                        type: 'error'
+                    })
+                }
+            }, error => {
+                this.$message({
+                    message: error,
+                    type: 'error'
+                })
+            })
+        },
+        haveUsersList(list) {
+            for (var i in list) {
+                if (list[i].children != null) {
+                    this.haveUsersList(list[i].children);
+                }
+                if (list[i].userList != null) {
+                    if (list[i].children == null) {
+                        list[i].children = [];
+                    }
+                    list[i].userList.forEach(element => {
+                        var obj = { id: element.id, label: element.name, parentId: element.departmentId, isUser: 1 };
+                        list[i].children.push(obj);
+                    });
+                }
+            }
+        },
+    },
+}
+</script>
+<style scoped lang='scss'></style>

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/i18n/en.json

@@ -2164,5 +2164,6 @@
   "xiangMuFuWu": "Project Services",
   "buShuYuNingDeQuanXianNei": "Not within your permission",
   "piLiangXiuGaiXiangMuJieDuan": "Batch modification project phase",
-  "piLiangCaoZuo": "Batch operation"
+  "piLiangCaoZuo": "Batch operation",
+  "piLiangTianJiaRenWuChanYuRen": "Batch add task participants"
 }

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/i18n/zh.json

@@ -2164,5 +2164,6 @@
   "tongYiGeZhiHangRenFuWuBuNengXiangTong": "同一个执行人,服务不能相同",
   "piLiangXiuGaiXiangMuJieDuan": "批量修改项目阶段",
   "buShuYuNingDeQuanXianNei": "不属于您的权限内",
-  "piLiangCaoZuo": "批量操作"
+  "piLiangCaoZuo": "批量操作",
+  "piLiangTianJiaRenWuChanYuRen": "批量添加任务参与人"
 }

+ 42 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -409,6 +409,7 @@
                         <el-dropdown-item><el-button type="text" @click="addGroupPerson()" :loading="addGroupPersonBtnLoading">{{ $t('groupparticipantsinbatches') }}</el-button></el-dropdown-item>
                     </template>
                     <template v-if="(showColumnWidth != '0' || permissions.projectManagement)">
+                        <el-dropdown-item><el-button type="text" @click="batchProjectTaskParticipant()">{{ $t('piLiangTianJiaRenWuChanYuRen') }}</el-button></el-dropdown-item>
                         <el-dropdown-item><el-button type="text" @click="addProPreson()">{{ $t('projectparticipantsinbatches') }}</el-button></el-dropdown-item>
                         <el-dropdown-item><el-button type="text" v-if="permissions.projectManagement" @click="batchIncharger()">{{ $t('projectmanagersinbatches') }}</el-button></el-dropdown-item>
                         <el-dropdown-item><el-button type="text" v-if="user.company.packageProject" @click="batchProjectStage()">{{ $t('piLiangXiuGaiXiangMuJieDuan') }}</el-button></el-dropdown-item>
@@ -1770,6 +1771,8 @@
                 </el-link>
             </div>
         </el-dialog>
+        <!-- 选择人 -->
+        <DepartmentSelectionPersonnel :visible="batchProjectTaskParticipantVisible" @changeParticipant="changeTaskParticipantVisible" @submitParticipant="addProjectTaskParticipant"></DepartmentSelectionPersonnel>
     </section>
 </template>
 <style scoped>
@@ -1806,12 +1809,14 @@ a {
     import selectCat from "@/components/select.vue"
     import vueCascader from "@/components/cascader.vue"
     import vueCascadeSelection from "@/components/cascadeSelection.vue"
+    import DepartmentSelectionPersonnel from "@/components/departmentSelectionPersonnel.vue"
     export default {
         components:{
             projectgantt,
             selectCat,
             vueCascader,
-            vueCascadeSelection
+            vueCascadeSelection,
+            DepartmentSelectionPersonnel
         },
         data() {
             return {
@@ -2083,7 +2088,8 @@ a {
                 participatorVisible: false,
                 participatorValue: [],
                 batchChangeStageDialogVisible: false,
-                batchChangeStageLoading: false
+                batchChangeStageLoading: false,
+                batchProjectTaskParticipantVisible: false
             };
         },
         // 过滤器
@@ -2135,6 +2141,40 @@ a {
             })
         },
         methods: {
+            addProjectTaskParticipant(userList) {
+                const userIds = userList.map(item => item.id).join(',')
+                const projectIds = this.checkedProjectArr.map(a => a.id).join(',')
+                this.http.post('/project/batchSetProjectTaskExecutor', {
+                    userIds, projectIds
+                },
+                res => {
+                    if (res.code == "ok") {
+                        this.getList()
+                        this.changeTaskParticipantVisible(false);
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+            batchProjectTaskParticipant() {
+                if (this.checkedProjectArr.length == 0) {
+                    this.$message(this.$t('defaultText.pleaseSelectSnItem'))
+                    return
+                }
+                this.changeTaskParticipantVisible(true)
+            },
+            changeTaskParticipantVisible(flag) {
+                this.batchProjectTaskParticipantVisible = flag
+            },
             showAllparticipator(item) {
                 this.participatorVisibleTitle = item.projectName + ' -- '+this.$t('participantin')
                 this.participatorValue = item.participator || []