龚焕茏
2024-07-08 c19bb5ac1b4013aa700c0a658f20375be9703ea3
src/views/education/department/list.vue
@@ -15,9 +15,16 @@
      </el-form-item>
    </el-form>
    <el-table v-loading="listLoading" :data="tableData" stripe border fit highlight-current-row style="width: 100%">
    <el-table
      v-loading="listLoading"
      :data="tableData" border fit
      style="width: 100%"
      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
      :row-class-name="tableRowClassName"
      row-key="id"
    >
      <el-table-column prop="name" label="部门"/>
      <el-table-column prop="adminName" label="部门负责人"/>
      <el-table-column prop="adminNames" label="部门负责人"/>
<!--      <el-table-column prop="levelName" label="部门" />-->
      <el-table-column width="400px" label="操作" align="center">
        <template slot-scope="{row}">
@@ -29,15 +36,13 @@
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total>0" :total="total" :page.sync="queryParam.pageIndex" :limit.sync="queryParam.pageSize"
                @pagination="search"/>
    <el-dialog
      :title="title"
      :visible.sync="dialogVisible"
      width="400px"
      :before-close="handleClose">
      <el-select v-model="updateAdminForm.adminId" filterable placeholder="选择管理员">
      <el-select v-model="updateAdminForm.adminIds" @change="changSelect" multiple filterable placeholder="选择管理员">
        <el-option
          v-for="item in deptUserList"
          :key="item.id"
@@ -67,12 +72,13 @@
      deptUserList: [],
      dialogVisible: false,
      title: '',
      updateAdminForm: {},
      updateAdminForm: {
        id: null,
        adminIds: []
      },
      depart: [],
      queryParam: {
        level: null,
        pageIndex: 1,
        pageSize: 10
      },
      listLoading: true,
      tableData: [],
@@ -83,12 +89,21 @@
    this.search()
  },
  methods: {
    tableRowClassName({row, rowIndex}) {
      if (row.children && row.children.length > 0) {
        return 'success-row';
      }
      return '';
    },
    changSelect( value ) {
      this.updateAdminForm.adminId = value
    },
    handleClose () {
      this.dialogVisible = false
      this.title = ''
    },
    submitUpdate () {
      if (!this.updateAdminForm.adminId) {
      if (!this.updateAdminForm.adminIds) {
        this.$message.warning('请选择部门负责人')
        return
      }
@@ -103,7 +118,8 @@
    },
    updateDeptAdmin (row) {
      this.updateAdminForm.id = row.id
      this.updateAdminForm.adminId = row.adminId
      this.updateAdminForm.adminIds = row.adminIds
      console.log(this.updateAdminForm.adminIds, "dd")
      this.title = row.name + '--管理员修改'
      this.getUserSelect(row.id)
      this.dialogVisible = true
@@ -116,15 +132,16 @@
    search () {
      this.listLoading = true
      departmentApi.pageList(this.queryParam).then(data => {
        const re = data.response
        this.tableData = re.list
        this.total = re.total
        this.queryParam.pageIndex = re.pageNum
        this.tableData = data.response
        this.tableData.forEach(item => {
          if (item.adminNames) {
            item.adminNames = item.adminNames.join("、")
          }
        })
        this.listLoading = false
        this.depart = data.response.list
        console.log(this.depart)
        this.depart.map(item => {
        this.depart = data.response
        this.depart.forEach(item => {
          item.key = item.id
          item.value = item.name
        })
@@ -132,7 +149,6 @@
      })
    },
    submitForm () {
      this.queryParam.pageIndex = 1
      this.search()
    },
    delSubject (row) {
@@ -161,3 +177,8 @@
  }
}
</script>
<style scoped>
.el-table .success-row {
  background: oldlace;
}
</style>