zhangjie 1 жил өмнө
parent
commit
710f865556

+ 8 - 1
src/api/base.ts

@@ -6,6 +6,7 @@ import type {
   AgentListPageParam,
   AgentListPageRes,
   AgentUpdateParams,
+  AgentGuideUpdateParams,
   RoomListPageParam,
   RoomListPageRes,
   RoomUpdateParams,
@@ -29,7 +30,7 @@ export function updateTeaching(
 export function ableTeaching(params: AbleParams): Promise<boolean> {
   return axios.post('/api/admin/teaching/enable', {}, { params });
 }
-// // 教学点管理-导入模板下载
+// 教学点管理-导入模板下载
 export function teachingTemplate(): Promise<AxiosResponse<Blob>> {
   return axios.post(
     '/api/admin/teaching/template',
@@ -51,6 +52,12 @@ export function agentListPage(
 export function updateAgent(datas: AgentUpdateParams): Promise<{ id: number }> {
   return axios.post('/api/admin/agent/save', datas);
 }
+// 考点管理-新增编辑
+export function updateAgentGuide(
+  datas: AgentGuideUpdateParams
+): Promise<{ id: number }> {
+  return axios.post('/api/admin/agent/save', datas);
+}
 // 考点管理-启用禁用
 export function ableAgent(params: AbleParams): Promise<boolean> {
   return axios.post('/api/admin/agent/enable', {}, { params });

+ 14 - 0
src/api/order.ts

@@ -12,6 +12,7 @@ import type {
   StudentExportListPageRes,
   OrderRecordPrintTimeItem,
   OrderRecordPrintParam,
+  ExportOrderRecordDetailParam,
 } from './types/order';
 import { AbleParams, PageParams } from './types/common';
 
@@ -136,3 +137,16 @@ export function orderRecordPrint(
     }
   );
 }
+// 预约名单详情-导出考场预约情况表
+export function exportOrderRecordDetail(
+  params: ExportOrderRecordDetailParam
+): Promise<AxiosResponse<Blob>> {
+  return axios.post(
+    '/api/apply/std/auto/sign/in/apply',
+    {},
+    {
+      responseType: 'blob',
+      params,
+    }
+  );
+}

+ 5 - 1
src/api/types/base.ts

@@ -55,9 +55,13 @@ export interface AgentUpdateParams {
   code: string;
   address: string;
   teachingId: number | null;
-  guide: string;
+  guide?: string;
   enable?: boolean;
 }
+export interface AgentGuideUpdateParams {
+  id: number;
+  guide: string;
+}
 
 export interface RoomListFilter {
   teachingId: number;

+ 4 - 0
src/api/types/order.ts

@@ -109,3 +109,7 @@ export interface OrderRecordPrintParam {
   agentId: number | null;
   examDate: number | undefined;
 }
+export interface ExportOrderRecordDetailParam {
+  teachingId: number | null;
+  agentId: number | null;
+}

+ 9 - 3
src/views/base/agent-manage/index.vue

@@ -64,7 +64,7 @@
           v-if="!record.cancel"
           type="text"
           class="btn-primary"
-          @click="toPlace(record)"
+          @click="toGuide(record)"
           >考点指引</a-button
         >
         <a-button
@@ -90,6 +90,8 @@
     />
     <!-- ModifyAgent -->
     <ModifyAgent ref="modifyAgentRef" :row-data="curRow" @modified="getList" />
+    <!-- ModifyGuide -->
+    <ModifyGuide ref="modifyGuideRef" :row-data="curRow" @modified="getList" />
   </div>
 </template>
 
@@ -106,6 +108,7 @@
 
   import ImportDialog from '@/components/import-dialog/index.vue';
   import ModifyAgent from './modifyAgent.vue';
+  import ModifyGuide from './modifyGuide.vue';
 
   defineOptions({
     name: 'AgentManage',
@@ -203,9 +206,12 @@
     getList();
   }
 
-  function toPlace(row: AgentItem) {
-    console.log(row);
+  const modifyGuideRef = ref();
+  function toGuide(row: AgentItem) {
+    curRow.value = row;
+    modifyGuideRef.value?.open();
   }
+
   function toRoom(row: AgentItem) {
     console.log(row);
   }

+ 102 - 0
src/views/base/agent-manage/modifyGuide.vue

@@ -0,0 +1,102 @@
+<template>
+  <a-modal
+    v-model:visible="visible"
+    :width="800"
+    title-align="start"
+    top="10vh"
+    :align-center="false"
+    :mask-closable="false"
+    :esc-to-close="false"
+    @before-open="modalBeforeOpen"
+  >
+    <template #title> 编辑考点指引 </template>
+    <a-form
+      ref="formRef"
+      :model="formData"
+      :rules="rules"
+      auto-label-width
+      layout="vertical"
+    >
+      <a-form-item field="notice" label="考点指引" :content-flex="false">
+        <rich-editor v-model="formData.guide" placeholder="请输入" />
+      </a-form-item>
+    </a-form>
+
+    <template #footer>
+      <a-button @click="close">取消</a-button>
+      <a-button type="primary" :disabled="loading" @click="confirm"
+        >确认</a-button
+      >
+    </template>
+  </a-modal>
+</template>
+
+<script setup lang="ts">
+  import { nextTick, reactive, ref } from 'vue';
+  import { Message } from '@arco-design/web-vue';
+  import type { FormInstance } from '@arco-design/web-vue/es/form';
+  import { updateAgentGuide } from '@/api/base';
+  import useLoading from '@/hooks/loading';
+  import useModal from '@/hooks/modal';
+  import { objAssign, objModifyAssign } from '@/utils/utils';
+  import { AgentItem, AgentGuideUpdateParams } from '@/api/types/base';
+  import { FormRules } from '@/types/global';
+
+  import RichEditor from '@/components/rich-editor/index.vue';
+
+  defineOptions({
+    name: 'ModifyGuide',
+  });
+
+  /* modal */
+  const { visible, open, close } = useModal();
+  defineExpose({ open, close });
+
+  const defaultFormData = {
+    id: 0,
+    guide: '',
+  };
+
+  const props = defineProps<{
+    rowData: AgentItem;
+  }>();
+  const emit = defineEmits(['modified']);
+
+  const formRef = ref<FormInstance>();
+  const formData = reactive<AgentGuideUpdateParams>({ ...defaultFormData });
+  const rules: FormRules<keyof AgentGuideUpdateParams> = {
+    guide: [
+      {
+        required: true,
+        message: '请输入考点指引',
+      },
+    ],
+  };
+
+  /* confirm */
+  const { loading, setLoading } = useLoading();
+  async function confirm() {
+    const err = await formRef.value?.validate();
+    if (err) return;
+
+    setLoading(true);
+    const datas = objAssign(formData, {});
+    const res = await updateAgentGuide(datas).catch(() => false);
+    setLoading(false);
+    if (!res) return;
+    Message.success('修改成功!');
+    emit('modified', datas);
+    close();
+  }
+  /* init modal */
+  function modalBeforeOpen() {
+    if (props.rowData.id) {
+      objModifyAssign(formData, props.rowData);
+    } else {
+      objModifyAssign(formData, defaultFormData);
+    }
+    nextTick(() => {
+      formRef.value?.clearValidate();
+    });
+  }
+</script>

+ 13 - 0
src/views/order/order-record-manage/index.vue

@@ -67,6 +67,10 @@
         <template #icon> <svg-icon name="icon-print" /> </template>
         导出签到表
       </a-button>
+      <a-button type="text" @click="toExportOrderDetail">
+        <template #icon> <svg-icon name="icon-print" /> </template>
+        导出考场预约情况表
+      </a-button>
     </a-space>
     <a-table
       class="page-table"
@@ -109,6 +113,8 @@
     />
     <!-- PrintDialog -->
     <PrintDialog ref="printDialogRef" />
+    <!-- orderDetailDialog -->
+    <OrderDetailDialog ref="orderDetailDialogRef" />
   </div>
 </template>
 
@@ -134,6 +140,7 @@
 
   import ImportDialog from '@/components/import-dialog/index.vue';
   import PrintDialog from './printDialog.vue';
+  import OrderDetailDialog from './orderDetailDialog.vue';
 
   defineOptions({
     name: 'OrderRecordManage',
@@ -275,6 +282,12 @@
     printDialogRef.value?.open();
   }
 
+  // 导出考场预约情况表
+  const orderDetailDialogRef = ref();
+  function toExportOrderDetail() {
+    orderDetailDialogRef.value?.open();
+  }
+
   // 取消
   async function toCancel(row: OrderRecordItem) {
     const confirmRes = await modalConfirm(

+ 109 - 0
src/views/order/order-record-manage/orderDetailDialog.vue

@@ -0,0 +1,109 @@
+<template>
+  <a-modal
+    v-model:visible="visible"
+    :width="500"
+    title-align="start"
+    top="10vh"
+    :align-center="false"
+    :mask-closable="false"
+    :esc-to-close="false"
+    @before-open="modalBeforeOpen"
+  >
+    <template #title> 导出考场预约情况表 </template>
+    <a-form ref="formRef" :model="formData" :rules="rules" auto-label-width>
+      <a-form-item field="teachingId" label="教学点">
+        <SelectTeaching
+          v-model="formData.teachingId"
+          placeholder="请选择"
+          allow-clear
+        />
+      </a-form-item>
+      <a-form-item label="考点">
+        <SelectAgent
+          v-model="formData.agentId"
+          placeholder="请选择"
+          allow-clear
+          :teaching-id="formData.teachingId"
+        />
+      </a-form-item>
+    </a-form>
+
+    <template #footer>
+      <a-button @click="close">取消</a-button>
+      <a-button type="primary" :disabled="loading" @click="confirm"
+        >确认</a-button
+      >
+    </template>
+  </a-modal>
+</template>
+
+<script setup lang="ts">
+  import { nextTick, reactive, ref } from 'vue';
+  import { Message } from '@arco-design/web-vue';
+  import type { FormInstance } from '@arco-design/web-vue/es/form';
+  import { exportOrderRecordDetail } from '@/api/order';
+  import useLoading from '@/hooks/loading';
+  import useModal from '@/hooks/modal';
+  import { objAssign, objModifyAssign } from '@/utils/utils';
+  import { ExportOrderRecordDetailParam } from '@/api/types/order';
+  import { FormRules } from '@/types/global';
+  import { downloadByApi } from '@/utils/download';
+
+  defineOptions({
+    name: 'OrderDetailDialog',
+  });
+
+  /* modal */
+  const { visible, open, close } = useModal();
+  defineExpose({ open, close });
+
+  const defaultFormData = {
+    teachingId: null,
+    agentId: null,
+  };
+
+  const formRef = ref<FormInstance>();
+  const formData = reactive<ExportOrderRecordDetailParam>({
+    ...defaultFormData,
+  });
+  const rules: FormRules<keyof ExportOrderRecordDetailParam> = {
+    teachingId: [
+      {
+        required: true,
+        message: '请选择教学点',
+      },
+    ],
+    agentId: [
+      {
+        required: true,
+        message: '请选择考点',
+      },
+    ],
+  };
+
+  /* confirm */
+  const { loading, setLoading } = useLoading();
+  async function confirm() {
+    const err = await formRef.value?.validate();
+    if (err) return;
+
+    setLoading(true);
+    const datas = objAssign(formData, {});
+    const res = await downloadByApi(() => exportOrderRecordDetail(datas)).catch(
+      (e) => {
+        Message.error(e || '下载失败,请重新尝试!');
+      }
+    );
+    setLoading(false);
+    if (!res) return;
+    Message.success('操作成功,开始下载!');
+    close();
+  }
+  /* init modal */
+  function modalBeforeOpen() {
+    objModifyAssign(formData, defaultFormData);
+    nextTick(() => {
+      formRef.value?.clearValidate();
+    });
+  }
+</script>

+ 1 - 5
src/views/order/task-manage/noticeForm.vue

@@ -8,11 +8,7 @@
       layout="vertical"
     >
       <a-form-item field="notice" label="考试说明" :content-flex="false">
-        <rich-editor
-          v-model="formData.notice"
-          placeholder="请输入"
-          :max-length="999"
-        />
+        <rich-editor v-model="formData.notice" placeholder="请输入" />
       </a-form-item>
     </a-form>
   </div>