刘洋 7 mesiacov pred
rodič
commit
65bd71fc8d

+ 3 - 1
src/components/upload-button/index.vue

@@ -11,8 +11,8 @@
       :custom-request="customRequest"
       :disabled="disabled"
       :on-before-upload="handleBeforeUpload"
-      :limit="1"
       :accept="accept"
+      :multiple="multiple"
       @change="handleFileChange"
       @error="handleError"
       @success="handleSuccess"
@@ -57,6 +57,7 @@
       disabled?: boolean;
       btnText?: string;
       accept?: string;
+      multiple?: boolean;
     }>(),
     {
       uploadUrl: '',
@@ -69,6 +70,7 @@
       disabled: false,
       btnText: '选择',
       accept: '.xls,.xlsx',
+      multiple: false,
     }
   );
 

+ 34 - 0
src/utils/index.ts

@@ -22,4 +22,38 @@ export const regexUrl = new RegExp(
   'i'
 );
 
+export function urlToBlob(url: string, cb: any) {
+  const xhr = new XMLHttpRequest();
+  xhr.open('GET', url, true);
+  xhr.responseType = 'blob';
+  xhr.onload = function () {
+    if (xhr.status === 200) {
+      cb(URL.createObjectURL(xhr.response));
+    }
+  };
+  xhr.send();
+}
+
+export function saveAs(blob: Blob, filename: string) {
+  if ((window as any).navigator.msSaveOrOpenBlob) {
+    (navigator as any).msSaveBlob(blob, filename);
+  } else {
+    const link: any = document.createElement('a');
+    const body = document.querySelector('body') as HTMLBodyElement;
+    link.href = blob;
+    link.download = filename;
+    link.style.display = 'none';
+    body.appendChild(link);
+    link.click();
+    body.removeChild(link);
+    window.URL.revokeObjectURL(link.href);
+  }
+}
+
+export function downloadByCrossUrl(url: string, filename: string) {
+  urlToBlob(url, (blob: Blob) => {
+    saveAs(blob, filename);
+  });
+}
+
 export default null;

+ 27 - 6
src/views/base/agent-manage/index.vue

@@ -24,7 +24,8 @@
     </a-space>
   </div>
   <div class="part-box">
-    <a-space v-if="userStore.isAdmin" class="part-action" :size="6">
+    <!-- <a-space v-if="userStore.isAdmin" class="part-action" :size="6"> -->
+    <a-space class="part-action" :size="6">
       <a-button type="text" @click="toAdd">
         <template #icon>
           <svg-icon name="icon-add" />
@@ -51,19 +52,28 @@
         <status-tag type="enable" :value="record.enable" />
       </template>
       <template #action="{ record }">
-        <a-button
+        <!-- <a-button
           v-if="userStore.isAdmin"
           type="text"
           class="btn-primary"
           @click="toEdit(record)"
           >编辑</a-button
+        > -->
+        <a-button type="text" class="btn-primary" @click="toEdit(record)"
+          >编辑</a-button
         >
-        <a-button
+        <!-- <a-button
           v-if="userStore.isAdmin"
           :class="record.enable ? 'btn-danger' : 'btn-primary'"
           type="text"
           @click="toEnable(record)"
           >{{ record.enable ? '禁用' : '启用' }}</a-button
+        > -->
+        <a-button
+          :class="record.enable ? 'btn-danger' : 'btn-primary'"
+          type="text"
+          @click="toEnable(record)"
+          >{{ record.enable ? '禁用' : '启用' }}</a-button
         >
         <a-button type="text" class="btn-primary" @click="toGuide(record)"
           >考点指引</a-button
@@ -78,7 +88,7 @@
     </a-table>
 
     <!-- ImportDialog -->
-    <ImportDialog
+    <!-- <ImportDialog
       v-if="userStore.isAdmin"
       ref="importDialogRef"
       title="导入考点"
@@ -88,14 +98,25 @@
       download-filename="考点导入模板.xlsx"
       :auto-upload="false"
       @upload-success="getList"
+    /> -->
+    <ImportDialog
+      ref="importDialogRef"
+      title="导入考点"
+      upload-url="/api/admin/site/import"
+      :format="['xls', 'xlsx']"
+      :download-handle="downloadTemplate"
+      download-filename="考点导入模板.xlsx"
+      :auto-upload="false"
+      @upload-success="getList"
     />
     <!-- ModifyAgent -->
-    <ModifyAgent
+    <!-- <ModifyAgent
       v-if="userStore.isAdmin"
       ref="modifyAgentRef"
       :row-data="curRow"
       @modified="getList"
-    />
+    /> -->
+    <ModifyAgent ref="modifyAgentRef" :row-data="curRow" @modified="getList" />
     <!-- ModifyGuide -->
     <ModifyGuide ref="modifyGuideRef" :row-data="curRow" />
   </div>

+ 17 - 0
src/views/order/my-task/index.vue

@@ -39,6 +39,11 @@
       <template #result="{ record }">{{
         taskResultEnum[record.result]
       }}</template>
+      <template #action="{ record }">
+        <a-button type="text" class="btn-primary" @click="download(record)"
+          >下载</a-button
+        >
+      </template>
     </a-table>
   </div>
 </template>
@@ -51,6 +56,7 @@
   import useTable from '@/hooks/table';
   import { useAppStore } from '@/store';
   import { modalConfirm } from '@/utils/arco';
+  import { downloadByCrossUrl } from '@/utils';
 
   defineOptions({
     name: 'MyTask',
@@ -113,6 +119,13 @@
         title: '创建时间',
         dataIndex: 'operator',
       },
+      {
+        title: '操作',
+        slotName: 'action',
+        width: 180,
+        fixed: 'right',
+        cellClass: 'action-column',
+      },
     ];
   });
   const { dataList, pagination, toPage, getList } = useTable<any>(
@@ -120,4 +133,8 @@
     computedModel,
     true
   );
+
+  const download = (record: any) => {
+    downloadByCrossUrl(record.exportFilePath, `${Date.now()}`);
+  };
 </script>

+ 5 - 1
src/views/order/order-record-manage/index.vue

@@ -113,7 +113,7 @@
       :download-handle="downloadTemplate"
       download-filename="预考导入模板.xlsx"
       :auto-upload="false"
-      @upload-success="getList"
+      @upload-success="importSuccess"
     />
     <!-- PrintDialog -->
     <PrintDialog ref="printDialogRef" />
@@ -259,6 +259,10 @@
   function toImport() {
     importStudentDialogRef.value?.open();
   }
+  function importSuccess() {
+    importStudentDialogRef.value?.close();
+    toPage(1);
+  }
 
   // 一键分配
   const { loading: assginLoading, setLoading: setAssignLoading } = useLoading();

+ 17 - 8
src/views/order/reservation-set/index.vue

@@ -26,12 +26,16 @@
     </a-space>
   </div>
   <div class="part-box">
-    <a-space v-if="searchModel.examSiteId" class="part-action" :size="12">
+    <a-space
+      v-if="searchModel.examSiteId && searchModel.taskId"
+      class="part-action"
+      :size="12"
+    >
       <a-button type="primary" @click="save">保存</a-button>
       <span style="color: #ff9a2e">时段关联最小单位是考点</span>
     </a-space>
     <div
-      v-if="searchModel.examSiteId"
+      v-if="searchModel.examSiteId && searchModel.taskId"
       class="part-action"
       :size="12"
       style="display: flex; align-items: center"
@@ -149,6 +153,11 @@
   };
   onMounted(() => {});
   const search = () => {
+    if (!searchModel.taskId) {
+      Message.error('请选择任务');
+      tableData.value = [];
+      return;
+    }
     getTimeSilce();
     getDateAndTimeList({ examSiteId: searchModel.examSiteId || null }).then(
       (res) => {
@@ -156,12 +165,12 @@
       }
     );
   };
-  watch(
-    () => searchModel.examSiteId,
-    (val) => {
-      search();
-    }
-  );
+  // watch(
+  //   () => searchModel.examSiteId,
+  //   (val) => {
+  //     search();
+  //   }
+  // );
 
   const switchChange = (rowIndex: number, head: string, bool: boolean) => {
     console.log(rowIndex, head, bool);

+ 6 - 2
src/views/order/student-import/index.vue

@@ -41,7 +41,7 @@
       :download-handle="downloadTemplate"
       download-filename="考生信息导入模板.xlsx"
       :auto-upload="false"
-      @upload-success="getList"
+      @upload-success="importSuccess"
     />
   </div>
 </template>
@@ -102,7 +102,7 @@
     //   cellClass: 'action-column',
     // },
   ];
-  const { dataList, pagination, getList } = useTable<StudentExportItem>(
+  const { dataList, pagination, getList, toPage } = useTable<StudentExportItem>(
     studentImportListPage,
     searchModel,
     true
@@ -122,6 +122,10 @@
   function toImport() {
     importStudentDialogRef.value?.open();
   }
+  function importSuccess() {
+    importStudentDialogRef.value?.close();
+    toPage(1);
+  }
 
   // 下载文件
   function toDownload(row: StudentExportItem) {

+ 6 - 4
src/views/order/student-manage/index.vue

@@ -13,13 +13,13 @@
         allow-clear
         prefix
       />
-      <SelectAgent
+      <!-- <SelectAgent
         v-model="searchModel.agentId"
         placeholder="请选择"
         allow-clear
         prefix
         :teaching-id="searchModel.teachingId"
-      />
+      /> -->
       <a-input v-model.trim="searchModel.name" placeholder="请输入" allow-clear>
         <template #prefix>姓名</template>
       </a-input>
@@ -42,7 +42,7 @@
     </a-space>
   </div>
   <div class="part-box">
-    <a-space class="part-action" :size="24">
+    <a-space v-if="userStore.isAdmin" class="part-action" :size="24">
       <a-button
         type="primary"
         status="danger"
@@ -84,6 +84,7 @@
           >照片</a-button
         >
         <a-button
+          v-if="userStore.isAdmin"
           class="btn-danger"
           type="text"
           @click="toDelete([record.id + ''])"
@@ -107,12 +108,13 @@
   import useTable from '@/hooks/table';
   // import useLoading from '@/hooks/loading';
   import { modalConfirm } from '@/utils/arco';
-  import { useAppStore } from '@/store';
+  import { useAppStore, useUserStore } from '@/store';
   import type { TableRowSelection } from '@arco-design/web-vue';
 
   defineOptions({
     name: 'StudentManage',
   });
+  const userStore = useUserStore();
   const imgVisible = ref(false);
   const imgSrc = ref('');
   const showImg = (record: any) => {

+ 16 - 7
src/views/order/user-manage/addUserDialog.vue

@@ -12,9 +12,13 @@
     <template #title> {{ `${curRow ? '编辑' : '新增'}账号` }} </template>
     <a-form ref="formRef" :model="formData" :rules="rules" auto-label-width>
       <a-form-item field="loginName" label="账号">
-        <a-input v-model="formData.loginName" />
+        <a-input
+          v-model="formData.loginName"
+          :disabled="!!curRow?.id"
+          maxlength="50"
+        />
       </a-form-item>
-      <a-form-item field="name" label="用户名">
+      <a-form-item field="name" label="用户名" maxlength="50">
         <a-input v-model="formData.name" />
       </a-form-item>
       <a-form-item field="roleCode" label="角色">
@@ -29,10 +33,11 @@
           v-model="formData.categoryId"
           placeholder="请选择"
           allow-clear
+          flag
         />
       </a-form-item>
       <a-form-item field="mobile" label="联系方式">
-        <a-input v-model="formData.mobile" />
+        <a-input v-model="formData.mobile" maxlength="20" />
       </a-form-item>
     </a-form>
 
@@ -109,10 +114,14 @@
     if (props.curRow) {
       params.id = props.curRow.id;
     }
-    addUser(params).then(() => {
-      Message.success('操作成功!');
-      emit('success');
-    });
+    addUser(params)
+      .then(() => {
+        Message.success('操作成功!');
+        emit('success');
+      })
+      .finally(() => {
+        setLoading(false);
+      });
     // const res = await downloadByApi(() => orderRecordPrint(datas)).catch(
     //   (e) => {
     //     Message.error(e || '下载失败,请重新尝试!');

+ 8 - 5
src/views/order/user-manage/index.vue

@@ -33,9 +33,9 @@
       :scroll="{ x: 1200 }"
       :bordered="false"
     >
-      <template #role="{ record }">
+      <!-- <template #role="{ record }">
         {{ record.roleCode === 'ADMIN' ? '学校管理员' : '教学点管理员' }}
-      </template>
+      </template> -->
       <template #action="{ record }">
         <a-button type="text" class="btn-primary" @click="toAdd(record)"
           >编辑</a-button
@@ -102,12 +102,15 @@
       },
       {
         title: '角色',
-        dataIndex: 'roleCode',
-        slotName: 'role',
+        dataIndex: 'roleName',
       },
       {
         title: '所属教学点',
-        dataIndex: 'loginName',
+        dataIndex: 'categoryName',
+      },
+      {
+        title: '联系方式',
+        dataIndex: 'mobile',
       },
       {
         title: '操作',