|
@@ -1,11 +1,190 @@
|
|
|
-<script setup name="noticeUser">
|
|
|
+<template>
|
|
|
+ <div class="app-container">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <div style="font-size: 16px;margin-left: 12px;line-height: 32px;font-weight: 700;color: #606266;">公告标题:{{ noticeTitle }}</div>
|
|
|
+ </el-col>
|
|
|
+ <br />
|
|
|
+ <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form-item label="姓名" prop="name">
|
|
|
+ <el-input v-model="queryParams.name" @keyup.enter="handleQuery"/>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="用户类型" prop="userType">
|
|
|
+ <el-input v-model="queryParams.userType" @keyup.enter="handleQuery"/>
|
|
|
+ </el-form-item>
|
|
|
|
|
|
-</script>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
|
|
+ <el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <el-row :gutter="10" class="mb8">
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ plain
|
|
|
+ icon="Plus"
|
|
|
+ @click="handleAddUser"
|
|
|
+ >添加用户
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="1.5">
|
|
|
+ <el-button
|
|
|
+ type="danger"
|
|
|
+ plain
|
|
|
+ icon="Delete"
|
|
|
+ :disabled="multiple"
|
|
|
+ @click="handleDelete"
|
|
|
+ >移除用户
|
|
|
+ </el-button>
|
|
|
+ </el-col>
|
|
|
|
|
|
-<template>
|
|
|
+ <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-table v-loading="loading" :data="userList" @selection-change="handleSelectionChange" :row-key="getRowKey">
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
+ <el-table-column label="名字" align="center" prop="name"/>
|
|
|
+ <el-table-column label="类型" align="center" prop="userType"/>
|
|
|
+ <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">移除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+
|
|
|
+ <pagination
|
|
|
+ v-show="total>0"
|
|
|
+ :total="total"
|
|
|
+ v-model:page="queryParams.pageNum"
|
|
|
+ v-model:limit="queryParams.pageSize"
|
|
|
+ @pagination="getList"
|
|
|
+ />
|
|
|
+
|
|
|
+ <!--关联学生-->
|
|
|
+ <el-dialog title="选择用户" v-model="userOpen" append-to-body style="padding: 20px 60px;">
|
|
|
|
|
|
+ <template #footer>
|
|
|
+ <div class="dialog-footer">
|
|
|
+ <el-button type="success" @click="addStudent">添加用户</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
-<style scoped lang="scss">
|
|
|
+<script setup name="noticeUser">
|
|
|
+import { listNoticeUser } from "@/api/system/notice";
|
|
|
+
|
|
|
+const router = useRoute();
|
|
|
+const rows = ref([]);
|
|
|
+const {proxy} = getCurrentInstance();
|
|
|
+const noticeId=ref("");
|
|
|
+const noticeTitle = ref("");
|
|
|
+const routerType = ref("");
|
|
|
+const userList = ref([]);
|
|
|
+const loading = ref(true);
|
|
|
+const userOpen = ref(false);
|
|
|
+const showSearch = ref(true);
|
|
|
+const ids = ref([]);
|
|
|
+const single = ref(true);
|
|
|
+const multiple = ref(true);
|
|
|
+const total = ref(0);
|
|
|
+const title = ref("");
|
|
|
+const classLoading = ref(true);
|
|
|
+const classList = ref([]);
|
|
|
+const addUsers = ref([]);
|
|
|
+
|
|
|
+const data = reactive({
|
|
|
+ form: {},
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ name: null,
|
|
|
+ userType: null
|
|
|
+ },
|
|
|
+});
|
|
|
+
|
|
|
+const {queryParams, form} = toRefs(data);
|
|
|
+
|
|
|
+/** 保存选中的数据编号 */
|
|
|
+function getRowKey(row) {
|
|
|
+ return row.studentId;
|
|
|
+}
|
|
|
+
|
|
|
+/** 查询已选择的用户列表 */
|
|
|
+function getList() {
|
|
|
+ loading.value = true;
|
|
|
+ listNoticeUser(noticeId.value, queryParams.value).then(response => {
|
|
|
+ userList.value = response.rows;
|
|
|
+ total.value = response.total;
|
|
|
+ loading.value = false;
|
|
|
+ });
|
|
|
|
|
|
-</style>
|
|
|
+}
|
|
|
+
|
|
|
+/** 搜索按钮操作 */
|
|
|
+function handleQuery() {
|
|
|
+ queryParams.value.pageNum = 1;
|
|
|
+ getList();
|
|
|
+}
|
|
|
+
|
|
|
+/** 重置按钮操作 */
|
|
|
+function resetQuery() {
|
|
|
+ proxy.resetForm("queryRef");
|
|
|
+ handleQuery();
|
|
|
+}
|
|
|
+
|
|
|
+// 多选框选中数据
|
|
|
+function handleSelectionChange(selection) {
|
|
|
+ ids.value = selection.map(item => item.studentId);
|
|
|
+ single.value = selection.length !== 1;
|
|
|
+ multiple.value = !selection.length;
|
|
|
+}
|
|
|
+
|
|
|
+/** 添加学生按钮操作 */
|
|
|
+function handleAddUser() {
|
|
|
+ userOpen.value = true;
|
|
|
+ title.value = "选择学生";
|
|
|
+}
|
|
|
+
|
|
|
+function getStudents(value) {
|
|
|
+ addUsers.value = value;
|
|
|
+}
|
|
|
+
|
|
|
+function addStudent() {
|
|
|
+ if (addUsers.value.length > 0) {
|
|
|
+ console.info(noticeId.value+"-----"+addUsers.value);
|
|
|
+ } else {
|
|
|
+ proxy.$modal.msgWarning("请先选择学生后再添加");
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+/** 删除按钮操作 */
|
|
|
+function handleDelete(row) {
|
|
|
+ const _studentIds = row.studentId ? [row.studentId] : ids.value;
|
|
|
+ // proxy.$modal.confirm('是否确认移除所选中的学生?').then(function () {
|
|
|
+ // if (routerType.value === "paper") {
|
|
|
+ // return removePaperStudent(paperId.value, _studentIds);
|
|
|
+ // } else {
|
|
|
+ // return removePracticeStudent(paperId.value, _studentIds);
|
|
|
+ // }
|
|
|
+ // }).then(() => {
|
|
|
+ // getList();
|
|
|
+ // proxy.$modal.msgSuccess("移除成功");
|
|
|
+ // }).catch(() => {
|
|
|
+ // });
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+(() => {
|
|
|
+ noticeId.value = router.params;
|
|
|
+ noticeTitle.value = router.query && router.query.noticeTitle;
|
|
|
+
|
|
|
+ if (noticeId.value) {
|
|
|
+ loading.value = true;
|
|
|
+ getList();
|
|
|
+ loading.value = false;
|
|
|
+ }
|
|
|
+})();
|
|
|
+</script>
|