1
lzhe
2024-04-10 3ca71791b839d7c9731643a8653c0b6fe1c6233a
src/views/master/person/main/personDepartment.vue
@@ -2,7 +2,7 @@
 * @Author: lzhe lzhe@example.com
 * @Date: 2024-03-26 10:28:33
 * @LastEditors: lzhe lzhe@example.com
 * @LastEditTime: 2024-04-09 21:00:31
 * @LastEditTime: 2024-04-10 17:05:04
 * @FilePath: /smart-web/src/views/master/person/main/index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
@@ -26,33 +26,15 @@
            </div>
         </div>
         <div class="right-table">
            <el-table
               ref="multipleTableRef"
               :data="departmentList"
               border
               style="width: 100%"
               class="multipleTableRef"
               @selection-change="handleSelectionChange"
            >
            <!-- lazy :load="tableLoad" -->
            <el-table :data="departmentList" style="width: 100%;margin-bottom: 20px;"  row-key="id" border default-expand-all ref="treeRef" @selection-change="handleSelectionChange">
               <el-table-column type="selection" width="55" />
               <el-table-column
               prop="date"
               label="岗位名称">
               </el-table-column>
               <el-table-column
               prop="name"
               label="部门人数">
               </el-table-column>
               <el-table-column
               prop="name"
               label="上级部门">
               </el-table-column>
               <el-table-column
               fixed="right"
               label="操作">
               <el-table-column prop="name" label="岗位名称"></el-table-column>
               <el-table-column prop="peopleNum" label="部门人数"></el-table-column>
               <el-table-column prop="parentName" label="上级部门"></el-table-column>
               <el-table-column fixed="right" label="操作">
               <template #default="scope">
                  <el-button type="text" size="small" @click="table_edit(scope.row, scope.$index)">编辑</el-button>
                  <el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
               </template>
               </el-table-column>
            </el-table>
@@ -77,6 +59,7 @@
      name: "bakalaka",
      data(){
         return {
            selection: [],
            total: 0,
            searchData: {
               groupType: 'group_organization',
@@ -86,26 +69,9 @@
            },
            statusList: [],
            isSaveing: false,
            groups: [],
            departmentFrom: {
               department: ""
            },
            departmentVisibleRules: {
               department:[
                  {required: true, message: '请选择部门'}
               ]
            },
            departmentVisible: false,
            dialog: {
               save: false
            },
            leftActive: true,
            input: '',
            options: [{
               value: '选项1',
               label: '黄金糕'
            }],
            input3: '',
            departmentList: []
         }
      },
@@ -114,15 +80,29 @@
      },
      mounted(){
         this.getStatus();
         this.getOrganizationList();
      },
      components: {
         saveDialog
      },
      methods: {
         removeHasChildren(arr) {
            return arr.map(item => {
               // 创建一个不包含hasChildren的新对象
               const newItem = { ...item };
               delete newItem.hasChildren; // 删除hasChildren字段
               // 如果children字段存在且是数组,则递归处理children
               if (Array.isArray(newItem.children)) {
               newItem.children = this.removeHasChildren(newItem.children);
               }
               return newItem;
            });
         },
         getOrganizationList() {
            this.$HTTP.get(`/api/blade-cps/organization/tree?` + this.$TOOL.qsStringify(this.searchData)).then(res=> {
               if(res.code == 200) {
                  this.departmentList = res.data;
                  this.departmentList = this.removeHasChildren(res.data);
               }
            })
         },
@@ -132,9 +112,6 @@
                  this.statusList = res.data;
               }
            })
         },
         departmentSubmit() {
            this.departmentVisible=false;  //部门调整
         },
         //添加
         addPerson(){
@@ -149,25 +126,10 @@
               this.$refs.saveDialog.open('edit').setData(row)
            })
         },
         //查看
         table_show(row){
            this.dialog.save = true
            this.$nextTick(() => {
               this.$refs.saveDialog.open('show').setData(row)
            })
         handleSelectionChange (selection) {
            this.selection = selection;
         },
         handleSelectionChange() {},
         delPerson() {},
         changeDepartment() {
            this.departmentVisible = true;
         },
         changeTab(name) {
            if(name == 1) {
               this.leftActive = true;
            }else {
               this.leftActive = false;
            }
         },
         handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
         },