Преглед на файлове

Merge branch 'master' of http://49.234.186.218:9000/root/ieplus

mingfu преди 1 ден
родител
ревизия
70dd6207c4

+ 8 - 0
back-ui/src/api/dz/cards.js

@@ -279,3 +279,11 @@ export function updateUserEvalCounts(data) {
     data: data,
   });
 }
+
+// 清空用户定向信息
+export function clearUserDirectedStudy(userId) {
+  return request({
+    url: "/system/user/clearDirectedStudy/" + userId,
+    method: "put",
+  });
+}

+ 1 - 1
back-ui/src/api/learn/student.js

@@ -49,6 +49,6 @@ export function statisticStudyRecord(query) {
     url: '/learn/student/statisticStudyRecord',
     method: 'get',
     params: query,
-    timeout: 20000  // 设置超时时间为20秒
+    timeout: 40000  // 设置超时时间为40秒
   })
 }

+ 1 - 1
back-ui/src/api/login.js

@@ -55,6 +55,6 @@ export function getCodeImg() {
       isToken: false
     },
     method: 'get',
-    timeout: 20000
+    timeout: 40000
   })
 }

+ 1 - 1
back-ui/src/utils/request.js

@@ -17,7 +17,7 @@ const service = axios.create({
   // axios中请求配置有baseURL选项,表示请求URL公共部分
   baseURL: import.meta.env.VITE_APP_BASE_API,
   // 超时
-  timeout: 20000
+  timeout: 40000
 })
 
 // request拦截器

+ 36 - 3
back-ui/src/views/dz/cards/components/CardTable.vue

@@ -141,6 +141,7 @@
         <el-table-column label="模考次数" prop="simulate" align="center" min-width="100" :fixed="hideActions ? 'right' : undefined">
           <template #default="scope">
             <el-button type="primary" link @click="handleShowSimulate(scope.row.cardId)">查看</el-button>
+            <el-button type="warning" link @click="handleClearDirectedStudy(scope.row)" v-if="scope.row.userId && scope.row.directedStudy">清空定向</el-button>
           </template>
         </el-table-column>
         <el-table-column v-if="!hideActions" label="操作" min-width="110" fixed="right" align="center">
@@ -209,8 +210,8 @@
 <script setup>
 import DictTag from '@/components/DictTag/index.vue';
 import { getCurrentInstance, ref } from 'vue';
-import { getUserSimulateList, updateUserEvalCounts } from '@/api/dz/cards';
-import { ElMessage } from 'element-plus';
+import { getUserSimulateList, updateUserEvalCounts, clearUserDirectedStudy } from '@/api/dz/cards';
+import { ElMessage, ElMessageBox } from 'element-plus';
 const { proxy } = getCurrentInstance();
 const { card_type, exam_type, card_distribute_status, card_status, card_settlement_status, card_time_status, card_pay_status } = 
 proxy.useDict("card_type", "exam_type", "card_distribute_status", "card_status", "card_settlement_status", "card_time_status", "card_pay_status");
@@ -232,7 +233,7 @@ const props = defineProps({
     default: false,
   },
 });
-const emit = defineEmits(['selectionChange', 'delete']);
+const emit = defineEmits(['selectionChange', 'delete', 'refresh']);
 const handleSelectionChange = (selection) => {
   emit('selectionChange', selection);
 };
@@ -419,6 +420,38 @@ const handleSaveCount = async () => {
     savingCount.value = false
   }
 };
+
+// 清空定向
+const handleClearDirectedStudy = async (row) => {
+  if (!row || !row.userId) {
+    ElMessage.warning('用户ID不存在')
+    return
+  }
+  
+  try {
+    await ElMessageBox.confirm('确定要清空该用户的定向信息吗?', '提示', {
+      confirmButtonText: '确定',
+      cancelButtonText: '取消',
+      type: 'warning'
+    })
+    
+    await clearUserDirectedStudy(row.userId)
+    ElMessage.success('清空定向成功')
+    
+    // 更新本地数据,将 directedStudy 设置为 null
+    if (row) {
+      row.directedStudy = null
+    }
+    
+    // 触发刷新,通知父组件更新数据
+    emit('refresh')
+  } catch (error) {
+    if (error !== 'cancel') {
+      console.error('清空定向失败:', error)
+      ElMessage.error('清空定向失败')
+    }
+  }
+};
 </script>
 <style lang="scss" scoped>
 /* 在弹窗中使用时的样式 */

+ 1 - 1
back-ui/src/views/dz/cards/index.vue

@@ -192,7 +192,7 @@
       <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
     <card-table :data="cardList" :loading="loading" :hide-actions="true" @selectionChange="handleSelectionChange"
-      @delete="handleDelete" />
+      @delete="handleDelete" @refresh="getList" />
     <div class="flex justify-end">
       <Pagination :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
         @pagination="getList" />

+ 4 - 3
back-ui/src/views/dz/papers/components/paper-full-intelligent.vue

@@ -37,7 +37,7 @@
 </template>
 
 <script setup name="PaperFullIntelligent">
-import { ref, computed } from 'vue'
+import { ref, computed, watch, toValue } from 'vue'
 import consts from "@/utils/consts.js";
 import {useProvidePaperFullCondition} from "@/views/dz/papers/hooks/usePaperFullCondition.js";
 import ClassStatisticTable from "@/views/dz/papers/components/plugs/class-statistic-table.vue";
@@ -101,7 +101,8 @@ const handleSubmit = async (qTypes) => {
     // validation
     if (!batchId.value) return ElMessage.error('请选择批次')
     if (!knowledgeCheckNodes.value.length) return ElMessage.error('请选择知识点')
-    if (!qTypes.value.length || qTypes.value.every(t => !t.count)) return ElMessage.error('请填写题量')
+    // qTypes 已经是过滤后的数组(count > 0),不需要再过滤
+    if (!qTypes || !qTypes.length || qTypes.every(t => !t.count)) return ElMessage.error('请填写题量')
     const classIds = selectedClasses.value.map(c => c.classId)
     if (!classIds.length) return ElMessage.error('请选择班级')
 
@@ -112,7 +113,7 @@ const handleSubmit = async (qTypes) => {
         examType: toValue(examType),
         subjectId: toValue(subjectId),
         knowledgeIds: knowledgeCheckNodes.value.map(k => k.id),
-        types: qTypes.value.map(t => ({
+        types: qTypes.map(t => ({
             type: t.dictValue,
             title: t.dictLabel,
             count: t.count,

+ 12 - 0
ie-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -422,6 +422,18 @@ public class SysUserController extends BaseController
         return toAjax(userService.resetPwd(user));
     }
 
+    /**
+     * 清空用户定向信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:user:edit')")
+    @Log(title = "用户管理", businessType = BusinessType.UPDATE)
+    @PutMapping("/clearDirectedStudy/{userId}")
+    public AjaxResult clearDirectedStudy(@PathVariable("userId") Long userId)
+    {
+        userService.checkUserDataScope(userId);
+        return toAjax(userService.clearDirectedStudy(userId));
+    }
+
     /**
      * 状态修改
      */

+ 11 - 0
ie-system/src/main/java/com/ruoyi/dz/domain/DzCards.java

@@ -192,6 +192,9 @@ public class DzCards extends BaseEntity
     /** 考生专业类别 **/
     private String examMajorName;
 
+    /** 用户ID */
+    private Long userId;
+
     public List<Long> getCardIds() {
         return cardIds;
     }
@@ -662,6 +665,14 @@ public class DzCards extends BaseEntity
         this.directedStudy = directedStudy;
     }
 
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 8 - 0
ie-system/src/main/java/com/ruoyi/system/mapper/SysUserMapper.java

@@ -122,6 +122,14 @@ public interface SysUserMapper
      */
     public int resetUserPwd(@Param("userId") Long userId, @Param("password") String password, @Param("password2") String password2);
 
+    /**
+     * 清空用户定向信息
+     *
+     * @param userId 用户ID
+     * @return 结果
+     */
+    public int updateDirectedStudy(@Param("userId") Long userId);
+
     /**
      * 通过用户ID删除用户
      *

+ 8 - 0
ie-system/src/main/java/com/ruoyi/system/service/ISysUserService.java

@@ -205,6 +205,14 @@ public interface ISysUserService
      */
     public int resetUserPwd(Long userId, String password, String password2);
 
+    /**
+     * 清空用户定向信息
+     *
+     * @param userId 用户ID
+     * @return 结果
+     */
+    public int clearDirectedStudy(Long userId);
+
     /**
      * 通过用户ID删除用户
      *

+ 12 - 0
ie-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -477,6 +477,18 @@ public class SysUserServiceImpl implements ISysUserService
         return userMapper.resetUserPwd(userId, password, password2);
     }
 
+    /**
+     * 清空用户定向信息
+     *
+     * @param userId 用户ID
+     * @return 结果
+     */
+    @Override
+    public int clearDirectedStudy(Long userId)
+    {
+        return userMapper.updateDirectedStudy(userId);
+    }
+
     /**
      * 新增用户角色信息
      *

+ 2 - 1
ie-system/src/main/resources/mapper/dz/DzCardsMapper.xml

@@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="closeTime"    column="close_time"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
+        <result property="userId"    column="user_id"    />
     </resultMap>
 
     <sql id="selectDzCardsVo">
@@ -113,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectDzCardsList2" parameterType="DzCards" resultMap="DzCardsResult">
-        select c.card_id, card_no, c.password, c.type, c.status, distribute_status, time_status, pay_status, is_settlement, c.dept_id, agent_id, leaf_agent_id, campus_id, campus_class_id, assign_location,assign_exam_type,assign_school_id, school_id, class_id, c.year, c.end_year, open_id, c.remark, distribute_time, out_date, open_time, pay_time, active_time, days, settlement_time, refund_time, close_time, c.create_time, c.update_time
+        select c.card_id, card_no, c.password, c.type, c.status, distribute_status, time_status, pay_status, is_settlement, c.dept_id, agent_id, leaf_agent_id, campus_id, campus_class_id, assign_location,assign_exam_type,assign_school_id, school_id, class_id, c.year, c.end_year, open_id, c.remark, distribute_time, out_date, open_time, pay_time, active_time, days, settlement_time, refund_time, close_time, c.create_time, c.update_time, u.user_id
         from dz_cards c left join sys_user u on c.`card_id` = u.`card_id`
         <where>
             <if test="cardNo != null  and cardNo != ''"> and c.card_no = #{cardNo}</if>

+ 5 - 1
ie-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -455,7 +455,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</update>
 
 	<update id="resetUserPwd" parameterType="SysUser">
- 		update sys_user set pwd_update_date = sysdate(), password = #{password}, password2 = #{password2}, update_time = sysdate() where user_id = #{userId}
+		update sys_user set pwd_update_date = sysdate(), password = #{password}, password2 = #{password2}, update_time = sysdate() where user_id = #{userId}
+	</update>
+
+	<update id="updateDirectedStudy" parameterType="Long">
+		update sys_user set directed_study = null, update_time = sysdate() where user_id = #{userId}
 	</update>
 
 	<delete id="deleteUserById" parameterType="Long">