|
@@ -0,0 +1,105 @@
|
|
|
+<template>
|
|
|
+ <a-modal
|
|
|
+ title="切换分组"
|
|
|
+ v-model:visible="visible"
|
|
|
+ @ok="handleOk"
|
|
|
+ @cancel="handleCancel"
|
|
|
+ >
|
|
|
+ <table class="group-table">
|
|
|
+ <tr>
|
|
|
+ <th>分组号</th>
|
|
|
+ <th>分组名</th>
|
|
|
+ <th>进度</th>
|
|
|
+ <td class="tw-text-right">操作</td>
|
|
|
+ </tr>
|
|
|
+ <tr
|
|
|
+ v-for="(group, index) in store.groups"
|
|
|
+ :key="index"
|
|
|
+ :class="isCurrentGroup(group.number) && 'current-group'"
|
|
|
+ >
|
|
|
+ <td>{{ group.number }}</td>
|
|
|
+ <td>{{ group.title }}</td>
|
|
|
+ <td>{{ (group.markedCount / group.totalCount).toFixed(1) }}%</td>
|
|
|
+ <td class="tw-text-right">
|
|
|
+ <QmButton type="primary" @click="chooseGroup(group.markerId)"
|
|
|
+ >选择</QmButton
|
|
|
+ >
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+ </a-modal>
|
|
|
+</template>
|
|
|
+<script lang="ts">
|
|
|
+import { doSwitchGroup, getGroups } from "@/api/markPage";
|
|
|
+import QmButton from "@/components/QmButton.vue";
|
|
|
+import { message } from "ant-design-vue";
|
|
|
+import { ref, defineComponent, onUpdated } from "vue";
|
|
|
+import { store } from "./store";
|
|
|
+
|
|
|
+export default defineComponent({
|
|
|
+ components: { QmButton },
|
|
|
+ name: "MarkSwitchGroupDialog",
|
|
|
+ setup() {
|
|
|
+ const visible = ref<boolean>(false);
|
|
|
+
|
|
|
+ onUpdated(async () => {
|
|
|
+ const groups = await getGroups();
|
|
|
+ store.groups = groups.data;
|
|
|
+ });
|
|
|
+
|
|
|
+ const showModal = () => {
|
|
|
+ visible.value = true;
|
|
|
+ };
|
|
|
+
|
|
|
+ const isCurrentGroup = (groupNumber: number) => {
|
|
|
+ return groupNumber === store.setting.groupNumber;
|
|
|
+ };
|
|
|
+
|
|
|
+ const chooseGroup = async (markerId: number) => {
|
|
|
+ const res = await doSwitchGroup(markerId).then((res) => {
|
|
|
+ if (res.data.success) {
|
|
|
+ window.location.reload();
|
|
|
+ } else {
|
|
|
+ message.error({ content: res.data.message || "错误", duration: 5 });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleOk = () => {
|
|
|
+ // confirmLoading.value = true;
|
|
|
+ // changeUserInfo(user.name, user.password)
|
|
|
+ // .then(() => doLogout())
|
|
|
+ // .finally(() => {
|
|
|
+ // visible.value = false;
|
|
|
+ // confirmLoading.value = false;
|
|
|
+ // });
|
|
|
+ };
|
|
|
+
|
|
|
+ const handleCancel = () => {
|
|
|
+ // user.name = store.setting.userName;
|
|
|
+ // user.password = "";
|
|
|
+ // user.confirmPassword = "";
|
|
|
+ };
|
|
|
+
|
|
|
+ return {
|
|
|
+ store,
|
|
|
+ visible,
|
|
|
+ showModal,
|
|
|
+ isCurrentGroup,
|
|
|
+ chooseGroup,
|
|
|
+ handleOk,
|
|
|
+ handleCancel,
|
|
|
+ };
|
|
|
+ },
|
|
|
+});
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+.group-table {
|
|
|
+ width: 100%;
|
|
|
+}
|
|
|
+
|
|
|
+.current-group {
|
|
|
+ background-color: lightblue;
|
|
|
+}
|
|
|
+</style>
|