瀏覽代碼

6-5 bug修改

bzkf3 1 年之前
父節點
當前提交
e74d86b39c
共有 5 個文件被更改,包括 1237 次插入991 次删除
  1. 3 0
      components.d.ts
  2. 459 420
      src/pages/process/fjct/[ze_id]/[zs_id].vue
  3. 557 416
      src/pages/process/index.vue
  4. 141 118
      src/pages/process/jyysz/[ykj_id].vue
  5. 77 37
      src/pages/step/[id].vue

+ 3 - 0
components.d.ts

@@ -24,6 +24,9 @@ declare module '@vue/runtime-core' {
     ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
     ElDatePicker: typeof import('element-plus/es')['ElDatePicker']
     ElDialog: typeof import('element-plus/es')['ElDialog']
+    ElDropdown: typeof import('element-plus/es')['ElDropdown']
+    ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
+    ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
     ElForm: typeof import('element-plus/es')['ElForm']
     ElFormItem: typeof import('element-plus/es')['ElFormItem']
     ElIcon: typeof import('element-plus/es')['ElIcon']

文件差異過大導致無法顯示
+ 459 - 420
src/pages/process/fjct/[ze_id]/[zs_id].vue


文件差異過大導致無法顯示
+ 557 - 416
src/pages/process/index.vue


+ 141 - 118
src/pages/process/jyysz/[ykj_id].vue

@@ -1,154 +1,152 @@
 <script setup>
-import request from "~/utils/request";
-import {REQUEST} from "~/utils/request";
-import {user} from "~/store";
-import {useRouter} from "vue-router";
+import { useRouter } from 'vue-router'
+import request from '~/utils/request'
 
-const router = useRouter();
-const route = useRoute();
-const linkTo = (obj) => {
-  router.push(obj);
-};
-let ykj_id = $ref('');
-let keyword = $ref('');
-let limit = $ref(10);
-let total = $ref(0);
-let cur_page = $ref(1);
-let listData = $ref([]);
-let dialogVisible = $ref(false);
-let title = $ref('');
-let is_edit = $ref(false);
+import { user } from '~/store'
+
+const router = useRouter()
+const route = useRoute()
+function linkTo(obj) {
+  router.push(obj)
+}
+let ykj_id = $ref('')
+const keyword = $ref('')
+const limit = $ref(10)
+let total = $ref(0)
+let cur_page = $ref(1)
+let listData = $ref([])
+let dialogVisible = $ref(false)
+let title = $ref('')
+let is_edit = $ref(false)
 let project = $ref({})
 let subject = $ref([])
 let subject_list = $ref([])
 let teacher = $ref({
   value: '',
   label: '',
-  user_realname: ''
+  user_realname: '',
 })
 let yj_id = $ref('')
 let teacher_list = $ref([])
 
 function getListData() {
   request({
-    url: "/yzy/jyy/index",
+    url: '/yzy/jyy/index',
     data: {
-      ykj_id: ykj_id,
-      keyword: keyword,
+      ykj_id,
+      keyword,
       page: cur_page,
-      limit: limit
+      limit,
     },
   }).then((res) => {
     if (res.code === '1') {
-      listData = res.data.page_data;
-      total = Number(res.data.total_rows);
-      cur_page = Number(res.data.page_now);
+      listData = res.data.page_data
+      total = Number(res.data.total_rows)
+      cur_page = Number(res.data.page_now)
     }
   })
 }
 
 function getProjectInfo() {
-  let data = {
-    ykj_id: ykj_id
+  const data = {
+    ykj_id,
   }
   request({
-    url: "/yzy/ksjh/detail",
-    data: data,
+    url: '/yzy/ksjh/detail',
+    data,
   }).then((res) => {
     if (res.code === '1') {
-      project = res.data.one_info;
-      subject_list = project.lc;
-      gerUsers();
+      project = res.data.one_info
+      subject_list = project.lc
+      gerUsers()
     }
   })
 }
 
 function filterData() {
-  cur_page = 1;
-  getListData();
+  cur_page = 1
+  getListData()
 }
 
-const handleSelectionChange = (val) => {
-  cur_page = val;
-  getListData();
-};
+function handleSelectionChange(val) {
+  cur_page = val
+  getListData()
+}
 
 function addTeacher() {
-  is_edit = false;
-  subject = [];
-  title = '增加教研员';
-  dialogVisible = true;
+  is_edit = false
+  subject = []
+  title = '增加教研员'
+  dialogVisible = true
   teacher = {
     value: '',
     label: '',
-    user_realname: ''
+    user_realname: '',
   }
 }
 
 function gerUsers() {
   request({
-    url: window.GLOBAL_CONFIG.uc + "/user/main/index",
+    url: `${window.GLOBAL_CONFIG.uc}/user/main/teachers`,
     data: {
       sm_id: project.ykj_lkxx,
       user_role_id: user.user_role_id,
       page: '1',
-      limit: '999'
+      limit: '9999',
     },
   }).then((res) => {
-    if (res.code === '1') {
-      teacher_list = res.data.page_data;
-    }
+    if (res.code === '1')
+      teacher_list = res.data.page_data
   })
 }
 
 function editTeacher(item) {
-  is_edit = true;
-  title = '编辑教研员';
+  is_edit = true
+  title = '编辑教研员'
   teacher = {
-    value:item.yj_user_id,
-    label:item.yj_username,
-    user_realname:item.yj_realname
+    value: item.yj_user_id,
+    label: item.yj_username,
+    user_realname: item.yj_realname,
   }
-  yj_id = item.yj_id;
-  subject = [];
-  for(let i in item.yj_subject_id.split(',')) {
-    let obj = {
-      value:item.yj_subject_id.split(',')[i],
-      label:item.yj_subject_name.split(',')[i]
+  yj_id = item.yj_id
+  subject = []
+  for (const i in item.yj_subject_id.split(',')) {
+    const obj = {
+      value: item.yj_subject_id.split(',')[i],
+      label: item.yj_subject_name.split(',')[i],
     }
     subject.push(obj)
   }
-  dialogVisible = true;
+  dialogVisible = true
 }
 function del_teacher(item) {
-  ElMessageBox.confirm("确认删除该教研员?", "", {
-    confirmButtonText: "确认",
-    cancelButtonText: "取消",
-    type: "warning",
+  ElMessageBox.confirm('确认删除该教研员?', '', {
+    confirmButtonText: '确认',
+    cancelButtonText: '取消',
+    type: 'warning',
   }).then(() => {
-
     request({
-      url: "/yzy/jyy/delete",
+      url: '/yzy/jyy/delete',
       data: {
-        yj_id:item.yj_id
+        yj_id: item.yj_id,
       },
     }).then((res) => {
-      if (res.code === "1") {
+      if (res.code === '1') {
         ElMessage({
-          type: "success",
-          message: "删除成功",
-        });
-        getListData();
+          type: 'success',
+          message: '删除成功',
+        })
+        getListData()
       }
-    });
+    })
   })
 }
 function handleSubmit() {
-  let subject_ids = [];
-  let subject_names = [];
-  for (let i in subject) {
-    subject_ids.push(subject[i].value);
-    subject_names.push(subject[i].label);
+  const subject_ids = []
+  const subject_names = []
+  for (const i in subject) {
+    subject_ids.push(subject[i].value)
+    subject_names.push(subject[i].label)
   }
   if (!is_edit) {
     request({
@@ -157,54 +155,55 @@ function handleSubmit() {
       data: {
         issubmit: '1',
         yzy_jyy: {
-          ykj_id: ykj_id,
+          ykj_id,
           yj_user_id: teacher.value,
           yj_realname: teacher.user_realname,
           yj_username: teacher.label,
           yj_subject_id: subject_ids.join(','),
-          yj_subject_name: subject_names.join(',')
-        }
+          yj_subject_name: subject_names.join(','),
+        },
       },
     }).then((res) => {
       if (res.code === '1') {
-        ElMessage.success("教研员添加成功!");
-        dialogVisible = false;
-        getListData();
+        ElMessage.success('教研员添加成功!')
+        dialogVisible = false
+        getListData()
       }
     })
-  } else {
+  }
+  else {
     request({
 
       url: '/yzy/jyy/edit',
       data: {
         issubmit: '1',
-        yj_id:yj_id,
+        yj_id,
         yzy_jyy: {
-          ykj_id: ykj_id,
+          ykj_id,
           yj_user_id: teacher.value,
           yj_realname: teacher.user_realname,
           yj_username: teacher.label,
           yj_subject_id: subject_ids.join(','),
-          yj_subject_name: subject_names.join(',')
-        }
+          yj_subject_name: subject_names.join(','),
+        },
       },
     }).then((res) => {
       if (res.code === '1') {
-        ElMessage.success("教研员编辑成功!");
-        dialogVisible = false;
-        getListData();
+        ElMessage.success('教研员编辑成功!')
+        dialogVisible = false
+        getListData()
       }
     })
   }
-
 }
 
 if (route.params.ykj_id) {
-  ykj_id = route.params.ykj_id;
-  getListData();
-  getProjectInfo();
+  ykj_id = route.params.ykj_id
+  getListData()
+  getProjectInfo()
 }
 </script>
+
 <route lang="json">
 {
 "meta":{
@@ -213,12 +212,15 @@ if (route.params.ykj_id) {
 }
 }
 </route>
+
 <template>
-  <NavHeader/>
-  <bread-crumb/>
+  <NavHeader />
+  <bread-crumb />
   <div class="w-1200px m-auto">
     <div class="relative -mt-40px flex justify-end">
-      <button type="button" class="back-btn" @click="linkTo({name:'process'})">返回</button>
+      <button type="button" class="back-btn" @click="linkTo({ name: 'process' })">
+        返回
+      </button>
     </div>
     <div class="mt-10px w-full bg-hex-fff min-h-700px py-20px px-15px">
       <div class="flex align-center">
@@ -228,19 +230,23 @@ if (route.params.ykj_id) {
           style="width: 225px;"
           size="large"
           clearable
+          placeholder="请输入关键字"
           @keyup.enter="filterData"
           @clear="filterData"
-          placeholder="请输入关键字"
         />
-        <el-button color="#003eee" class="ml-10px" type="primary" size="large" @click="filterData">搜索</el-button>
+        <el-button color="#003eee" class="ml-10px" type="primary" size="large" @click="filterData">
+          搜索
+        </el-button>
         <button type="button" class="ml-10px add-btn">
           <el-icon class="inline-block align-middle">
-            <Plus/>
+            <Plus />
           </el-icon>
           <span class="ml-5px inline-block align-middle" @click="addTeacher">新增教研员</span>
         </button>
       </div>
-      <h3 class="mt-20px mb-10px text-13px text-hex-6F6F6F">(此处为查看扫描批阅进度的权限赋予设置)</h3>
+      <h3 class="mt-20px mb-10px text-13px text-hex-6F6F6F">
+        (此处为查看扫描批阅进度的权限赋予设置)
+      </h3>
       <div v-if="listData.length > 0">
         <table class="data-table" cellpadding="0" cellspacing="0">
           <tr>
@@ -254,25 +260,33 @@ if (route.params.ykj_id) {
             <td>{{ item.yj_username }}</td>
             <td>{{ item.yj_subject_name }}</td>
             <td>
-              <button type="button" class="op-btn edit" @click="editTeacher(item)">编辑</button>
-              <button type="button" class="ml-15px op-btn del" @click="del_teacher(item)">删除</button>
+              <button type="button" class="op-btn edit" @click="editTeacher(item)">
+                编辑
+              </button>
+              <button type="button" class="ml-15px op-btn del" @click="del_teacher(item)">
+                删除
+              </button>
             </td>
           </tr>
         </table>
         <div class="mt-20px page-new flex justify-end">
-          <el-pagination v-model:current-page="cur_page" v-model:page-size="limit" layout="total,prev, pager, next"
-                         :total="total" :background="true" @current-change="handleSelectionChange"></el-pagination>
+          <el-pagination
+            v-model:current-page="cur_page" v-model:page-size="limit" layout="total,prev, pager, next"
+            :total="total" :background="true" @current-change="handleSelectionChange"
+          />
         </div>
       </div>
       <div v-else class="no-data">
         <div>
-          <h3 class="no-data-img"></h3>
-          <h4 class="mt-25px text-18px text-hex-0048e5 text-center">暂无数据</h4>
+          <h3 class="no-data-img" />
+          <h4 class="mt-25px text-18px text-hex-0048e5 text-center">
+            暂无数据
+          </h4>
         </div>
       </div>
     </div>
   </div>
-  <commonFooter/>
+  <commonFooter />
   <el-dialog
     v-model="dialogVisible"
     :title="title"
@@ -283,20 +297,29 @@ if (route.params.ykj_id) {
       <el-form label-width="120px" size="large">
         <el-form-item label="教研员">
           <el-select v-model="teacher" placeholder="请选择教研员" filterable style="width: 100%">
-            <el-option v-for="item in teacher_list" :label="item.user_realname+' '+ item.user_phone"
-                       :value="{value:item.user_id,label:item.user_name,user_realname:item.user_realname}"/>
+            <el-option
+              v-for="item in teacher_list" :label="`${item.user_realname} - ${item.user_name}`"
+              :value="{ value: item.user_id, label: item.user_name, user_realname: item.user_realname }"
+            />
           </el-select>
         </el-form-item>
         <el-form-item label="可查看学科">
           <el-select v-model="subject" placeholder="请选择学科" multiple filterable style="width: 100%">
-            <el-option :value-key="item.ze_xueke" v-for="item in subject_list" :label="item.ze_xueke_name"
-                       :value="{value:item.ze_xueke,label:item.ze_xueke_name}"/>
+            <el-option
+              v-for="item in subject_list" :value-key="item.ze_xueke" :label="item.ze_xueke_name"
+              :value="{ value: item.ze_xueke, label: item.ze_xueke_name }"
+            />
           </el-select>
         </el-form-item>
         <div class="mt-40px text-center">
-          <el-button class="mr-30px" @click="dialogVisible = false">取消</el-button>
-          <el-button type="primary" color="#003eee" :disabled="teacher.value === '' || subject.length === 0"
-                     @click="handleSubmit">确定
+          <el-button class="mr-30px" @click="dialogVisible = false">
+            取消
+          </el-button>
+          <el-button
+            type="primary" color="#003eee" :disabled="teacher.value === '' || subject.length === 0"
+            @click="handleSubmit"
+          >
+            确定
           </el-button>
         </div>
       </el-form>

+ 77 - 37
src/pages/step/[id].vue

@@ -243,6 +243,7 @@ watch(() => stepsReactiveMap, (val) => {
 
 let currentStep = $ref<number>(gid)
 
+// 当前步骤的card的ref
 const CardsRef = $shallowRef<Array<Array<typeof import('~/components/TheCard.vue')['default']>>>([])
 const lineList: any[][][] = []
 
@@ -274,38 +275,49 @@ function handleSwitchCurrentStep(id: number) {
 
 onMounted(() => {
   watch(() => currentStep, (val, old) => {
-    if (old !== undefined)
+    if (old !== undefined) {
+      console.log('上次线条存在并隐藏')
       lineList[old].forEach(lines => lines.forEach(line => line?.hide('none')))
+    }
     if (lineList[val]?.length) {
+      console.log('这次线条存在并显示')
       lineList[val].forEach(lines => lines.forEach(line => line?.show('none')))
     }
     else {
+      console.log('这次线条不存在并创建', CardsRef)
       nextTick(() => {
+        console.log('nextTick')
         CardsRef.forEach((cards, idx) => {
           if (idx === CardsRef.length - 1)
             return
           cards.forEach((card, idy) => {
-            if (card === null || CardsRef[idx + 1][0] === null)
+            if ((!card) || (!CardsRef[idx + 1][0]))
               return
-            const line = new LeaderLine(
-              card.getDom(),
-              CardsRef[idx + 1][0].getDom(),
-              {
-                path: 'grid',
-                endPlug: 'behind',
-                size: 6,
-                startSocket: 'right',
-                endSocket: 'left',
-                color: stepsReactiveMap[currentStep][idx][idy] ? '#003eee' : '#a3a3a3',
-              },
-            )
-            line?.position()
-            if (stepsReactiveMap[currentStep][idx][idy])
-              document.querySelectorAll('.leader-line')[line._id as number - 1]?.classList.add('z10')
-
-            lineList[val] = lineList[val] || []
-            lineList[val][idx] = lineList[val][idx] || []
-            lineList[val][idx][idy] = line
+            try {
+              const line = new LeaderLine(
+                card.getDom(),
+                CardsRef[idx + 1][0].getDom(),
+                {
+                  path: 'grid',
+                  endPlug: 'behind',
+                  size: 6,
+                  startSocket: 'right',
+                  endSocket: 'left',
+                  color: stepsReactiveMap[currentStep][idx][idy] ? '#003eee' : '#a3a3a3',
+                },
+              )
+              line?.position()
+              if (stepsReactiveMap[currentStep][idx][idy])
+                document.querySelectorAll('.leader-line')[line._id as number - 1]?.classList.add('z10')
+
+              lineList[val] = lineList[val] || []
+              lineList[val][idx] = lineList[val][idx] || []
+              lineList[val][idx][idy] = line
+              console.log('线条绘制成功', lineList)
+            }
+            catch (error) {
+              console.error('线条绘制失败, error')
+            }
           })
         })
       })
@@ -358,29 +370,47 @@ function handleValidTask(currentStep: number, idx: number, idy: number) {
   }
 }
 
-function judgeIfContinueDoTask(gid: number, pid: number, idy: number) {
+function getArrayLastElement<T>(arr: T[]) {
+  return arr[arr.length - 1]
+}
+
+function judgeIfContinueDoTask(gid: number, pid: number, idy: number, ifMessage: boolean, ifUselessWhenStepEnd: boolean /* 考试关闭后禁用 */) {
   const currentTask = steps[gid].children[pid].children[idy]
-  const continueDoTask = !currentTask.ifCreateUser || isCreateUser
-  if (!continueDoTask) {
-    ElMessage({
+  const continueDoTaskByUser = !currentTask.ifCreateUser || isCreateUser
+  if (!continueDoTaskByUser) {
+    ifMessage && ElMessage({
       message: '只有考试创建人才能操作',
       type: 'warning',
       grouping: true,
     })
+    return false
+  }
+  if (ifUselessWhenStepEnd) {
+    if (judgeStepCompleted(getArrayLastElement(getArrayLastElement(stepsReactiveMap))[0])) {
+      ifMessage && ElMessage({
+        message: '考试已关闭,无法操作',
+        type: 'warning',
+        grouping: true,
+      })
+      return false
+    }
   }
-  return continueDoTask
+
+  return true
 }
 
+const ifUselessWhenStepEndTaskList = ['修改成绩', '考试关闭']
 function beforeClickTask(gid: number, pid: number, idy: number) {
-  const continueDoTask = judgeIfContinueDoTask(gid, pid, idy)
+  const currentTask = steps[gid].children[pid].children[idy]
+  const continueDoTask = judgeIfContinueDoTask(gid, pid, idy, true, ifUselessWhenStepEndTaskList.includes(currentTask.title))
   if (!continueDoTask)
     return false
   else
     return handleValidTask(gid, pid, idy)
 }
 
-function judgeTaskCanClick(gid: number, pid: number, idy: number) {
-  const continueDoTask = judgeIfContinueDoTask(gid, pid, idy)
+function judgeTaskCanClick(gid: number, pid: number, idy: number, ifUselessWhenStepEnd?: boolean /* 考试关闭后是否禁用 */) {
+  const continueDoTask = judgeIfContinueDoTask(gid, pid, idy, false, ifUselessWhenStepEnd)
   if (!continueDoTask) {
     return false
   }
@@ -402,7 +432,7 @@ function judgeTaskCanClick(gid: number, pid: number, idy: number) {
 }
 
 function judgeStepCompleted(val: unknown) {
-  return (!!val) || (typeof val === 'object' && !!(val?.value))
+  return (!!val) || (typeof val === 'object' && val !== null && !!(val?.value))
 }
 
 function handleCompleteTask(gid: number, pid: number, cid: number, val?: unknown, ext?: any): Promise<any> {
@@ -468,16 +498,26 @@ async function handleJumpTask(gid: number, pid: number, idy: number, ext?: objec
   const res = await handleCompleteTask(gid, pid, idy, 1, ext)
   if (res.code === '1') {
     if (pid !== stepsReactiveMap[gid].length - 1) {
-      const line = lineList[gid][pid][idy]
-      line.setOptions({ color: '#003eee' })
-      document.querySelectorAll('.leader-line')[line._id - 1]?.classList.add('z10')
+      try {
+        const line = lineList[gid][pid][idy]
+        line.setOptions({ color: '#003eee' })
+        document.querySelectorAll('.leader-line')[line._id - 1]?.classList.add('z10')
+      }
+      catch (error) {
+        console.error('线条更新失败', error)
+      }
     }
   }
   return res
 }
 
 onBeforeRouteLeave(() => {
-  lineList.forEach(lines => lines.forEach(line => line.forEach(l => l?.hide('none'))))
+  try {
+    lineList.forEach(lines => lines.forEach(line => line.forEach(l => l?.hide('none'))))
+  }
+  catch (error) {
+    console.error('线条卸载失败', error)
+  }
 })
 
 function handleCompleteTaskAuto(ext?: object) {
@@ -717,9 +757,9 @@ const TaskEventMap: { [key: string]: () => void } = {
                 <template #tip>
                   <template v-if="task.title === '成绩发布'">
                     <div class="mt-2 flex flex-col items-start px-1 text-xs space-y-1" style="--el-font-size-base:10px">
-                      <xgstda :disabled="!judgeTaskCanClick(currentStep, idx, idy)" />
-                      <szcjckqx :disabled="!judgeTaskCanClick(currentStep, idx, idy)" />
-                      <bjqk :disabled="!judgeTaskCanClick(currentStep, idx, idy)" />
+                      <xgstda :disabled="!judgeTaskCanClick(currentStep, idx, idy, true)" />
+                      <szcjckqx :disabled="!judgeTaskCanClick(currentStep, idx, idy, false)" />
+                      <bjqk :disabled="!judgeTaskCanClick(currentStep, idx, idy, true)" />
                     </div>
                   </template>
                 </template>