Browse Source

feat: 页面调整

zhangjie 1 year ago
parent
commit
ff66431897

+ 1 - 0
config/vite.config.base.ts

@@ -29,6 +29,7 @@ export default defineConfig({
   },
   define: {
     'process.env': {},
+    '__VUE_PROD_HYDRATION_MISMATCH_DETAILS__': false,
   },
   css: {
     preprocessorOptions: {

+ 2 - 1
src/api/order.ts

@@ -106,7 +106,8 @@ export function orderRecordTemplate(): Promise<AxiosResponse<Blob>> {
 }
 // 预约名单详情-打印签到表
 export function orderRecordPrint(params: {
-  teachingId?: number;
+  teachingId: number;
+  agentId?: number;
 }): Promise<AxiosResponse<Blob>> {
   return axios.post(
     '/api/apply/std/auto/sign/in/print',

+ 4 - 4
src/components/select-agent/index.vue

@@ -20,7 +20,7 @@
   defineOptions({
     name: 'SelectAgent',
   });
-  type ValueType = number | Array<number>;
+  type ValueType = number | Array<number> | null;
 
   const props = defineProps<{
     modelValue: ValueType;
@@ -39,7 +39,7 @@
     label: string;
   }
 
-  const selected = ref<ValueType>();
+  const selected = ref<number | Array<number> | undefined>();
   const optionList = ref<OptionListItem[]>([]);
   const search = async () => {
     optionList.value = [];
@@ -66,7 +66,7 @@
   watch(
     () => props.modelValue,
     (val) => {
-      selected.value = val;
+      selected.value = val || undefined;
     },
     {
       immediate: true,
@@ -75,7 +75,7 @@
   watch(
     () => props.teachingId,
     () => {
-      emit('update:modelValue', '');
+      emit('update:modelValue', null);
       emit('change', null);
       search();
     },

+ 3 - 3
src/components/select-task/index.vue

@@ -20,7 +20,7 @@
   defineOptions({
     name: 'SelectTask',
   });
-  type ValueType = number | Array<number>;
+  type ValueType = number | Array<number> | null;
 
   const props = defineProps<{
     modelValue: ValueType;
@@ -38,7 +38,7 @@
     label: string;
   }
 
-  const selected = ref<ValueType>();
+  const selected = ref<number | Array<number> | undefined>();
   const optionList = ref<OptionListItem[]>([]);
   const search = async () => {
     optionList.value = [];
@@ -64,7 +64,7 @@
   watch(
     () => props.modelValue,
     (val) => {
-      selected.value = val;
+      selected.value = val || undefined;
     },
     {
       immediate: true,

+ 3 - 3
src/components/select-teaching/index.vue

@@ -21,7 +21,7 @@
     name: 'SelectTeaching',
   });
 
-  type ValueType = number | Array<number>;
+  type ValueType = number | Array<number> | null;
 
   const props = defineProps<{
     modelValue: ValueType;
@@ -39,7 +39,7 @@
     label: string;
   }
 
-  const selected = ref<ValueType>();
+  const selected = ref<number | Array<number> | undefined>();
   const optionList = ref<OptionListItem[]>([]);
   const search = async () => {
     optionList.value = [];
@@ -65,7 +65,7 @@
   watch(
     () => props.modelValue,
     (val) => {
-      selected.value = val;
+      selected.value = val || undefined;
     },
     {
       immediate: true,

+ 5 - 5
src/hooks/table.ts

@@ -45,16 +45,16 @@ export default function useTable<T extends Record<string, any>>(
     toPage(page);
   }
 
-  const pagination = {
-    total: total.value,
-    current: pageNumber.value,
-    pageSize: pageSize.value,
+  const pagination = ref({
+    total,
+    current: pageNumber,
+    pageSize,
     showTotal: true,
     showJumper: true,
     showPageSize: true,
     onChange: toPage,
     onPageSizeChange: pageSizeChange,
-  };
+  });
 
   return {
     dataList,

+ 8 - 3
src/views/order/order-record-manage/index.vue

@@ -160,12 +160,12 @@
     {
       title: '教学点',
       dataIndex: 'teachingName',
-      width: 160,
+      width: 200,
     },
     {
       title: '考点',
       dataIndex: 'agentName',
-      width: 160,
+      width: 200,
     },
     {
       title: '预约时段',
@@ -256,11 +256,16 @@
   const { loading: printLoading, setLoading: setPrintLoading } = useLoading();
   async function toPrint() {
     if (printLoading.value) return;
+    if (!searchModel.teachingId) {
+      Message.error('请先选择教学点');
+      return;
+    }
     setPrintLoading(true);
 
     const res = await downloadByApi(() =>
       orderRecordPrint({
-        teachingId: searchModel.teachingId || undefined,
+        teachingId: searchModel.teachingId as number,
+        agentId: searchModel.agentId || undefined,
       })
     ).catch((e) => {
       Message.error(e || '下载失败,请重新尝试!');

+ 1 - 0
src/views/order/task-manage/index.vue

@@ -17,6 +17,7 @@
       </a-button>
     </a-space>
     <a-table
+      class="page-table"
       :columns="columns"
       :data="dataList"
       :pagination="pagination"

+ 31 - 17
src/views/order/task-manage/timeForm.vue

@@ -4,23 +4,26 @@
       <a-form-item label="可选考试时段">
         <a-button type="primary" @click="toAdd">添加</a-button>
       </a-form-item>
-      <a-form-item
-        v-for="(time, index) in formData.times"
-        :key="index"
-        :field="`times[${index}].startTime`"
-        :rules="rules"
-      >
-        <select-range-datetime
-          v-model:startTime="formData.times[index].startTime"
-          v-model:endTime="formData.times[index].endTime"
+      <div class="time-box">
+        <a-form-item
+          v-for="(time, index) in formData.times"
+          :key="index"
+          :field="`times[${index}].startTime`"
+          :rules="rules"
+          :label="index + 1 + ''"
         >
-        </select-range-datetime>
-        <a-button class="ml-10" status="danger" @click="toDelete(index)">
-          <template #icon>
-            <svg-icon name="icon-delete"></svg-icon>
-          </template>
-        </a-button>
-      </a-form-item>
+          <select-range-datetime
+            v-model:startTime="time.startTime"
+            v-model:endTime="time.endTime"
+          >
+          </select-range-datetime>
+          <a-button class="ml-10" status="danger" @click="toDelete(index)">
+            <template #icon>
+              <svg-icon name="icon-delete"></svg-icon>
+            </template>
+          </a-button>
+        </a-form-item>
+      </div>
     </a-form>
   </div>
 
@@ -86,8 +89,9 @@
     formData.times.push(...times);
   }
 
-  function toDelete(index: number) {
+  async function toDelete(index: number) {
     formData.times.splice(index, 1);
+    await formRef.value?.validate();
   }
 
   /* confirm */
@@ -119,3 +123,13 @@
     initData();
   });
 </script>
+
+<style lang="less" scoped>
+  .time-box {
+    height: 400px;
+    overflow: auto;
+    padding: 10px 0;
+    border-radius: var(--border-radius-small);
+    border: 1px solid var(--color-border);
+  }
+</style>