From 577e08110d491269dd1bcb03cf2ae16e6fe7df27 Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期三, 22 五月 2024 12:02:30 +0800
Subject: [PATCH] 题目绑定部门
---
src/views/education/department/list.vue | 88 ++++++++++++++++++++++++++++++++++++++-----
1 files changed, 77 insertions(+), 11 deletions(-)
diff --git a/src/views/education/department/list.vue b/src/views/education/department/list.vue
index 2821948..9c2dc67 100644
--- a/src/views/education/department/list.vue
+++ b/src/views/education/department/list.vue
@@ -15,34 +15,63 @@
</el-form-item>
</el-form>
- <el-table v-loading="listLoading" :data="tableData" border fit highlight-current-row style="width: 100%">
+ <el-table v-loading="listLoading" :data="tableData" stripe border fit highlight-current-row style="width: 100%">
<el-table-column prop="name" label="閮ㄩ棬"/>
+ <el-table-column prop="adminNames" label="閮ㄩ棬璐熻矗浜�"/>
<!-- <el-table-column prop="levelName" label="閮ㄩ棬" />-->
- <el-table-column width="220px" label="鎿嶄綔" align="center">
+ <el-table-column width="400px" label="鎿嶄綔" align="center">
<template slot-scope="{row}">
+ <el-button type="success" size="mini" @click="updateDeptAdmin(row)" class="link-left" plain>淇敼閮ㄩ棬璐熻矗浜�</el-button>
<router-link :to="{path:'/education/department/edit', query:{id:row.id}}" class="link-left">
- <el-button size="mini">缂栬緫</el-button>
+ <el-button size="mini" plain>缂栬緫</el-button>
</router-link>
- <el-button size="mini" type="danger" @click="delSubject(row)" class="link-left">鍒犻櫎</el-button>
+ <el-button size="mini" type="danger" plain @click="delSubject(row)" class="link-left">鍒犻櫎</el-button>
</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.adminIds" @change="changSelect" multiple filterable placeholder="閫夋嫨绠$悊鍛�">
+ <el-option
+ v-for="item in deptUserList"
+ :key="item.id"
+ :label="item.value"
+ :value="item.id">
+ </el-option>
+ </el-select>
+ <span slot="footer" class="dialog-footer">
+ <el-button @click="dialogVisible = false">鍙� 娑�</el-button>
+ <el-button type="primary" @click="submitUpdate">纭� 瀹�</el-button>
+ </span>
+ </el-dialog>
+
</div>
</template>
<script>
import { mapGetters, mapState } from 'vuex'
import Pagination from '@/components/Pagination'
-import subjectApi from '@/api/subject'
import departmentApi from '@/api/department'
import enumItem from '@/store/modules/enumItem'
export default {
components: { Pagination },
data () {
return {
- depart:[],
+ // 閮ㄩ棬浜哄憳
+ deptUserList: [],
+ dialogVisible: false,
+ title: '',
+ updateAdminForm: {
+ id: null,
+ adminIds: []
+ },
+ depart: [],
queryParam: {
level: null,
pageIndex: 1,
@@ -57,23 +86,60 @@
this.search()
},
methods: {
+ changSelect( value ) {
+ this.updateAdminForm.adminId = value
+ },
+ handleClose () {
+ this.dialogVisible = false
+ this.title = ''
+ },
+ submitUpdate () {
+ if (!this.updateAdminForm.adminIds) {
+ this.$message.warning('璇烽�夋嫨閮ㄩ棬璐熻矗浜�')
+ return
+ }
+ departmentApi.updateDeptAdmin(this.updateAdminForm).then(res => {
+ if (res.code === 1) {
+ this.$message.success('淇敼鎴愬姛')
+ this.dialogVisible = false
+ this.title = ''
+ this.search()
+ }
+ })
+ },
+ updateDeptAdmin (row) {
+ this.updateAdminForm.id = row.id
+ this.updateAdminForm.adminIds = row.adminIds
+ console.log(this.updateAdminForm.adminIds, "dd")
+ this.title = row.name + '--绠$悊鍛樹慨鏀�'
+ this.getUserSelect(row.id)
+ this.dialogVisible = true
+ },
+ getUserSelect (id) {
+ departmentApi.getDeptUserList(id).then(res => {
+ this.deptUserList = res.response
+ })
+ },
search () {
this.listLoading = true
departmentApi.pageList(this.queryParam).then(data => {
const re = data.response
this.tableData = re.list
+ this.tableData.map(item => {
+ if (item.adminNames) {
+ item.adminNames = item.adminNames.join("銆�")
+ }
+ })
this.total = re.total
this.queryParam.pageIndex = re.pageNum
this.listLoading = false
this.depart = data.response.list
- console.log(this.depart)
- this.depart.map(item=>{
+ this.depart.map(item => {
item.key = item.id
item.value = item.name
})
enumItem.state.user.levelEnum = this.depart
-
})
},
submitForm () {
@@ -83,8 +149,8 @@
delSubject (row) {
let _this = this
let obj = {
- id :row.id,
- deleted:1
+ id: row.id,
+ deleted: 1
}
departmentApi.edit(obj).then(re => {
if (re.code === 1) {
--
Gitblit v1.8.0