zhangjie 1 жил өмнө
parent
commit
72d6bedfdf

+ 2 - 6
src/App.vue

@@ -1,14 +1,10 @@
 <template>
   <a-config-provider>
     <template #empty>
-      <div class="empty-none">
-        <ImageNone />
-      </div>
+      <div class="empty-none"> </div>
     </template>
     <router-view />
   </a-config-provider>
 </template>
 
-<script lang="ts" setup>
-  import ImageNone from './assets/svgs/image-none.svg?component';
-</script>
+<script lang="ts" setup></script>

+ 16 - 12
src/api/base.ts

@@ -18,7 +18,7 @@ import { AbleParams } from './types/common';
 export function teachingListPage(
   params: TeachingListPageParam
 ): Promise<TeachingListPageRes> {
-  return axios.post('/api/admin/teaching/query', {}, { params });
+  return axios.post('/api/admin/teaching/page', params);
 }
 // 教学点管理-新增编辑
 export function updateTeaching(
@@ -33,7 +33,7 @@ export function ableTeaching(params: AbleParams): Promise<boolean> {
 // 教学点管理-导入模板下载
 export function teachingTemplate(): Promise<AxiosResponse<Blob>> {
   return axios.post(
-    '/api/admin/teaching/template',
+    '/api/admin/teaching/import/template',
     {},
     {
       responseType: 'blob',
@@ -46,26 +46,30 @@ export function teachingTemplate(): Promise<AxiosResponse<Blob>> {
 export function agentListPage(
   params: AgentListPageParam
 ): Promise<AgentListPageRes> {
-  return axios.post('/api/admin/agent/query', {}, { params });
+  return axios.post('/api/admin/site/page', params);
 }
 // 考点管理-新增编辑
 export function updateAgent(datas: AgentUpdateParams): Promise<{ id: number }> {
-  return axios.post('/api/admin/agent/save', datas);
+  return axios.post('/api/admin/site/save', datas);
 }
-// 考点管理-新增编辑
+// 考点管理-考点指引
+export function agentGuideDetail(id: number): Promise<string> {
+  return axios.post('/api/admin/site/guide', {}, { params: { id } });
+}
+// 考点管理-编辑指引
 export function updateAgentGuide(
   datas: AgentGuideUpdateParams
 ): Promise<{ id: number }> {
-  return axios.post('/api/admin/agent/save', datas);
+  return axios.post('/api/admin/site/guide/save', datas);
 }
 // 考点管理-启用禁用
 export function ableAgent(params: AbleParams): Promise<boolean> {
-  return axios.post('/api/admin/agent/enable', {}, { params });
+  return axios.post('/api/admin/site/enable', {}, { params });
 }
-// // 考点管理-导入模板下载
+// 考点管理-导入模板下载
 export function agentTemplate(): Promise<AxiosResponse<Blob>> {
   return axios.post(
-    '/api/admin/agent/template',
+    '/api/admin/site/import/template',
     {},
     {
       responseType: 'blob',
@@ -78,7 +82,7 @@ export function agentTemplate(): Promise<AxiosResponse<Blob>> {
 export function roomListPage(
   params: RoomListPageParam
 ): Promise<RoomListPageRes> {
-  return axios.post('/api/admin/room/query', {}, { params });
+  return axios.post('/api/admin/room/page', params);
 }
 // 考场管理-新增编辑
 export function updateRoom(datas: RoomUpdateParams): Promise<{ id: number }> {
@@ -88,10 +92,10 @@ export function updateRoom(datas: RoomUpdateParams): Promise<{ id: number }> {
 export function ableRoom(params: AbleParams): Promise<boolean> {
   return axios.post('/api/admin/room/enable', {}, { params });
 }
-// // 考场管理-导入模板下载
+// 考场管理-导入模板下载
 export function roomTemplate(): Promise<AxiosResponse<Blob>> {
   return axios.post(
-    '/api/admin/room/template',
+    '/api/admin/import/template',
     {},
     {
       responseType: 'blob',

+ 4 - 0
src/api/order.ts

@@ -33,6 +33,10 @@ export function agentQuery(teachingId: number): Promise<OptionItem[]> {
     { params: { id: teachingId } }
   );
 }
+// 通用查询-城市查询
+export function cityQuery(): Promise<OptionItem[]> {
+  return axios.post('/api/admin/teaching/city/list', {});
+}
 
 // 预约任务管理
 // 预约任务管理-查询

+ 6 - 12
src/api/types/base.ts

@@ -23,9 +23,7 @@ export interface TeachingUpdateParams {
   id?: number;
   name: string;
   code: string;
-  cityId: number | undefined;
-  capacity: number | undefined;
-  enable?: boolean;
+  cityId: number | null;
 }
 
 export interface AgentListFilter {
@@ -43,7 +41,6 @@ export interface AgentItem {
   teachingId: number;
   teachingName: string;
   capacity: number;
-  guide: string;
   enable: boolean;
 }
 
@@ -55,8 +52,6 @@ export interface AgentUpdateParams {
   code: string;
   address: string;
   teachingId: number | null;
-  guide?: string;
-  enable?: boolean;
 }
 export interface AgentGuideUpdateParams {
   id: number;
@@ -64,8 +59,8 @@ export interface AgentGuideUpdateParams {
 }
 
 export interface RoomListFilter {
-  teachingId: number;
-  agentId: number;
+  teachingId: number | null;
+  examSiteId: number | null;
   name: string;
   enable: boolean | undefined;
 }
@@ -78,8 +73,8 @@ export interface RoomItem {
   address: string;
   teachingId: number;
   teachingName: string;
-  agentId: number;
-  agentName: string;
+  examSiteId: number;
+  examSiteName: string;
   capacity: number;
   enable: boolean;
 }
@@ -93,6 +88,5 @@ export interface RoomUpdateParams {
   address: string;
   capacity: number | undefined;
   teachingId: number | null;
-  agentId: number | null;
-  enable?: boolean;
+  examSiteId: number | null;
 }

BIN
src/assets/images/bg-empty.png


+ 6 - 0
src/assets/style/base.less

@@ -117,6 +117,12 @@
 .empty-none {
   text-align: center;
   padding: 10px 0;
+  height: 95px;
+
+  background-image: url(../images/bg-empty.png);
+  background-size: 98px 74px;
+  background-position: center;
+  background-repeat: no-repeat;
 }
 
 /* table */

+ 1 - 1
src/assets/style/home.less

@@ -28,7 +28,7 @@
       margin-bottom: 20px;
     }
     .svg-icon {
-      margin-top: -2px;
+      margin-top: -3px;
     }
 
     .arco-menu-inline-header {

+ 12 - 0
src/assets/svgs/icon-base.svg

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>database-filled@3x</title>
+    <g id="图标" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="Icon" transform="translate(-352, -912)" fill="#000000">
+            <g id="database-filled" transform="translate(352, 912)">
+                <rect id="矩形" opacity="0" x="0" y="0" width="16" height="16"></rect>
+                <path d="M13,1 L3,1 C2.7234375,1 2.5,1.2234375 2.5,1.5 L2.5,5 L13.5,5 L13.5,1.5 C13.5,1.2234375 13.2765625,1 13,1 Z M4.5,3.625 C4.1546875,3.625 3.875,3.3453125 3.875,3 C3.875,2.6546875 4.1546875,2.375 4.5,2.375 C4.8453125,2.375 5.125,2.6546875 5.125,3 C5.125,3.3453125 4.8453125,3.625 4.5,3.625 Z M2.5,14.5 C2.5,14.7765625 2.7234375,15 3,15 L13,15 C13.2765625,15 13.5,14.7765625 13.5,14.5 L13.5,11 L2.5,11 L2.5,14.5 Z M4.5,12.375 C4.8453125,12.375 5.125,12.6546875 5.125,13 C5.125,13.3453125 4.8453125,13.625 4.5,13.625 C4.1546875,13.625 3.875,13.3453125 3.875,13 C3.875,12.6546875 4.1546875,12.375 4.5,12.375 Z M2.5,10 L13.5,10 L13.5,6 L2.5,6 L2.5,10 Z M4.5,7.375 C4.8453125,7.375 5.125,7.6546875 5.125,8 C5.125,8.3453125 4.8453125,8.625 4.5,8.625 C4.1546875,8.625 3.875,8.3453125 3.875,8 C3.875,7.6546875 4.1546875,7.375 4.5,7.375 Z" id="形状"></path>
+            </g>
+        </g>
+    </g>
+</svg>

+ 0 - 32
src/assets/svgs/image-none.svg

@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<svg width="98px" height="74px" viewBox="0 0 98 74" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
-    <title>image-暂无数据</title>
-    <defs>
-        <linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="linearGradient-1">
-            <stop stop-color="#3196FF" offset="0%"></stop>
-            <stop stop-color="#165DFF" offset="100%"></stop>
-        </linearGradient>
-    </defs>
-    <g id="页面-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
-        <g id="image-暂无数据">
-            <path d="M81.768585,6.83478261 L97.6,22.6872687 L97.6,69.2 C97.6,70.4150264 97.1075132,71.5150264 96.3112698,72.3112698 C95.5150264,73.1075132 94.4150264,73.6 93.2,73.6 L16.0459016,73.6 C14.8308752,73.6 13.7308752,73.1075132 12.9346318,72.3112698 C12.1383884,71.5150264 11.6459016,70.4150264 11.6459016,69.2 L11.6459016,11.2347826 C11.6459016,10.0197562 12.1383884,8.91975616 12.9346318,8.12351277 C13.7308752,7.32726938 14.8308752,6.83478261 16.0459016,6.83478261 L81.768585,6.83478261 Z" id="形状结合" stroke="#E5E5E5" stroke-width="0.8" fill="#FFFFFF"></path>
-            <rect id="矩形" fill="#E5E6EB" x="19.2786885" y="14.4782609" width="70.6885246" height="10.4565217"></rect>
-            <rect id="矩形备份-18" fill="#E5E6EB" x="19.2786885" y="14.4782609" width="17.6721311" height="51.4782609"></rect>
-            <rect id="矩形" stroke="#C9CDD4" stroke-width="0.8" x="19.6786885" y="14.8782609" width="69.8885246" height="50.6782609"></rect>
-            <rect id="矩形" fill="#C9CDD4" x="19.2786885" y="24.1304348" width="70.6885246" height="1"></rect>
-            <rect id="矩形备份-15" fill="#C9CDD4" x="36.147541" y="14.4782609" width="1" height="51.4782609"></rect>
-            <rect id="矩形备份-16" fill="#C9CDD4" x="53.8196721" y="14.4782609" width="1" height="51.4782609"></rect>
-            <rect id="矩形备份-17" fill="#C9CDD4" x="71.4918033" y="14.4782609" width="1" height="51.4782609"></rect>
-            <rect id="矩形备份-12" fill="#C9CDD4" x="19.2786885" y="34.5869565" width="70.6885246" height="1"></rect>
-            <rect id="矩形备份-13" fill="#C9CDD4" x="19.2786885" y="45.0434783" width="70.6885246" height="1"></rect>
-            <rect id="矩形备份-14" fill="#C9CDD4" x="19.2786885" y="55.5" width="70.6885246" height="1"></rect>
-            <polygon id="矩形" fill="#C9CDD4" opacity="0.752208891" points="79.5245902 6.43478261 81.9938485 6.43478261 98 22.5217391 98 24.9347826 79.5245902 24.9347826"></polygon>
-            <polygon id="矩形" fill="#FFFFFF" points="81.9344262 6.43478261 98 22.5217391 81.9344262 22.5217391"></polygon>
-            <path d="M14.4459016,6.43478261 L56.2295082,6.43478261 L56.2295082,6.43478261 L56.2295082,21.7347826 C56.2295082,23.5020938 54.7968194,24.9347826 53.0295082,24.9347826 L11.2459016,24.9347826 L11.2459016,24.9347826 L11.2459016,9.63478261 C11.2459016,7.86747141 12.6785904,6.43478261 14.4459016,6.43478261 Z" id="矩形备份-19" fill="#C9CDD4" opacity="0.75"></path>
-            <rect id="矩形" fill="url(#linearGradient-1)" x="0" y="0" width="53.0163934" height="22.5217391" rx="3.2"></rect>
-            <text id="NO-DATA" font-family="SourceHanSansCN-Bold, Source Han Sans CN" font-size="9.6" font-weight="bold" line-spacing="16" fill="#FFFFFF">
-                <tspan x="5.54659672" y="10.2608696">NO DATA</tspan>
-            </text>
-        </g>
-    </g>
-</svg>

+ 2 - 0
src/components/index.ts

@@ -7,6 +7,7 @@ import SelectTeaching from './select-teaching/index.vue';
 import SelectAgent from './select-agent/index.vue';
 import SelectRangeDatetime from './select-range-datetime/index.vue';
 import SelectRangeTime from './select-range-time/index.vue';
+import SelectCity from './select-city/index.vue';
 import StatusTag from './status-tag/index.vue';
 
 export default {
@@ -17,6 +18,7 @@ export default {
     Vue.component('SelectAgent', SelectAgent);
     Vue.component('SelectRangeDatetime', SelectRangeDatetime);
     Vue.component('SelectRangeTime', SelectRangeTime);
+    Vue.component('SelectCity', SelectCity);
     Vue.component('StatusTag', StatusTag);
   },
 };

+ 2 - 2
src/components/rich-editor/index.vue

@@ -80,8 +80,8 @@
 </script>
 
 <style>
-  .rich-editor {
-    height: 400px;
+  .rich-editor .ql-container {
+    height: 300px;
   }
   .rich-editor em {
     font-style: italic;

+ 23 - 13
src/components/select-agent/index.vue

@@ -23,15 +23,21 @@
   });
   type ValueType = number | Array<number> | null;
 
-  const props = defineProps<{
-    modelValue: ValueType;
-    clearable?: boolean;
-    disabled?: boolean;
-    placeholder?: string;
-    multiple?: boolean;
-    teachingId: number | null;
-    prefix?: boolean;
-  }>();
+  const props = withDefaults(
+    defineProps<{
+      modelValue: ValueType;
+      clearable?: boolean;
+      disabled?: boolean;
+      placeholder?: string;
+      multiple?: boolean;
+      teachingId: number | null;
+      cascade?: boolean;
+      prefix?: boolean;
+    }>(),
+    {
+      cascade: true,
+    }
+  );
   const emit = defineEmits(['update:modelValue', 'change']);
   const attrs = useAttrs();
 
@@ -75,10 +81,14 @@
   );
   watch(
     () => props.teachingId,
-    () => {
-      emit('update:modelValue', null);
-      emit('change', null);
-      search();
+    (val, oldval) => {
+      if (val !== oldval) {
+        search();
+        if (props.cascade) {
+          emit('update:modelValue', null);
+          emit('change', null);
+        }
+      }
     },
     {
       immediate: true,

+ 78 - 0
src/components/select-city/index.vue

@@ -0,0 +1,78 @@
+<template>
+  <a-select
+    v-model="selected"
+    :placeholder="placeholder"
+    :allow-clear="clearable"
+    :disabled="disabled"
+    :options="optionList"
+    filter-option
+    popup-container="body"
+    v-bind="attrs"
+    @change="onChange"
+  >
+    <template v-if="prefix || prefixStr" #prefix>{{
+      prefixStr || '城市'
+    }}</template>
+  </a-select>
+</template>
+
+<script setup lang="ts">
+  import { ref, useAttrs, watch } from 'vue';
+  import { cityQuery } from '@/api/order';
+
+  defineOptions({
+    name: 'SelectCity',
+  });
+
+  type ValueType = number | Array<number> | null;
+
+  const props = defineProps<{
+    modelValue: ValueType;
+    clearable?: boolean;
+    disabled?: boolean;
+    placeholder?: string;
+    multiple?: boolean;
+    prefix?: boolean;
+    prefixStr?: string;
+  }>();
+  const emit = defineEmits(['update:modelValue', 'change']);
+  const attrs = useAttrs();
+
+  interface OptionListItem {
+    value: number;
+    label: string;
+  }
+
+  const selected = ref<number | Array<number> | undefined>();
+  const optionList = ref<OptionListItem[]>([]);
+  const search = async () => {
+    optionList.value = [];
+    const resData = await cityQuery();
+
+    optionList.value = (resData || []).map((item) => {
+      return { ...item, value: item.id, label: item.name };
+    });
+  };
+  search();
+
+  const onChange = () => {
+    const selectedData = props.multiple
+      ? optionList.value.filter(
+          (item) =>
+            selected.value && (selected.value as number[]).includes(item.value)
+        )
+      : optionList.value.filter((item) => selected.value === item.value);
+    emit('update:modelValue', selected.value || null);
+    emit('change', props.multiple ? selectedData : selectedData[0]);
+  };
+
+  watch(
+    () => props.modelValue,
+    (val) => {
+      selected.value = val || undefined;
+    },
+    {
+      immediate: true,
+    }
+  );
+</script>

+ 2 - 0
src/components/svg-icon/index.vue

@@ -19,6 +19,7 @@
   import IconFile from '../../assets/svgs/icon-file.svg?component';
   import IconSuccess from '../../assets/svgs/icon-success.svg?component';
   import IconError from '../../assets/svgs/icon-error.svg?component';
+  import IconBase from '../../assets/svgs/icon-base.svg?component';
 
   defineOptions({
     name: 'SvgIcon',
@@ -49,6 +50,7 @@
     IconFile,
     IconSuccess,
     IconError,
+    IconBase,
   };
 
   const iconName = snakeToHump(props.name) as keyof typeof icons;

+ 3 - 3
src/store/modules/app/menuData.ts

@@ -65,7 +65,7 @@ export const menus = [
     parentId: 11,
     sequence: 1,
     enable: true,
-    roles: [],
+    roles: ['ADMIN', 'TEACHING'],
   },
   {
     id: 13,
@@ -75,7 +75,7 @@ export const menus = [
     parentId: 11,
     sequence: 2,
     enable: true,
-    roles: [],
+    roles: ['ADMIN', 'TEACHING'],
   },
   {
     id: 14,
@@ -85,6 +85,6 @@ export const menus = [
     parentId: 11,
     sequence: 3,
     enable: true,
-    roles: [],
+    roles: ['ADMIN', 'TEACHING'],
   },
 ];

+ 7 - 8
src/views/base/agent-manage/index.vue

@@ -67,13 +67,12 @@
           @click="toGuide(record)"
           >考点指引</a-button
         >
-        <a-button
-          v-if="!record.cancel"
+        <!-- <a-button
           type="text"
           class="btn-primary"
           @click="toRoom(record)"
           >考场</a-button
-        >
+        > -->
       </template>
     </a-table>
 
@@ -81,7 +80,7 @@
     <ImportDialog
       ref="importDialogRef"
       title="导入考点"
-      upload-url="/api/admin/agent/import"
+      upload-url="/api/admin/site/import"
       :format="['xls', 'xlsx']"
       :download-handle="downloadTemplate"
       download-filename="考点导入模板.xlsx"
@@ -156,7 +155,7 @@
     {
       title: '操作',
       slotName: 'action',
-      width: 210,
+      width: 180,
       fixed: 'right',
       cellClass: 'action-column',
     },
@@ -212,7 +211,7 @@
     modifyGuideRef.value?.open();
   }
 
-  function toRoom(row: AgentItem) {
-    console.log(row);
-  }
+  // function toRoom(row: AgentItem) {
+  //   console.log(row);
+  // }
 </script>

+ 8 - 23
src/views/base/agent-manage/modifyAgent.vue

@@ -24,7 +24,7 @@
           v-model.trim="formData.code"
           placeholder="请输入"
           allow-clear
-          :max-length="50"
+          :max-length="30"
         ></a-input>
       </a-form-item>
       <a-form-item field="address" label="考点地址">
@@ -35,24 +35,13 @@
           :max-length="100"
         ></a-input>
       </a-form-item>
-      <a-form-item field="teachingId" label="教学点">
+      <a-form-item field="teachingId" label="所属教学点">
         <SelectTeaching
           v-model="formData.teachingId"
           placeholder="请选择"
           allow-clear
         />
       </a-form-item>
-      <a-form-item field="guide" label="考点指引">
-        <a-textarea
-          v-model="formData.guide"
-          placeholder="请输入"
-          :auto-size="{
-            minRows: 4,
-            maxRows: 10,
-          }"
-          :max-length="999"
-        />
-      </a-form-item>
     </a-form>
 
     <template #footer>
@@ -89,7 +78,6 @@
     code: '',
     address: '',
     teachingId: null,
-    guide: '',
   };
 
   const props = defineProps<{
@@ -119,8 +107,8 @@
         message: '请输入代码',
       },
       {
-        maxLength: 50,
-        message: '代码不能超过50字符',
+        maxLength: 30,
+        message: '代码不能超过30字符',
       },
     ],
     address: [
@@ -139,12 +127,6 @@
         message: '请选择教学点',
       },
     ],
-    guide: [
-      {
-        required: true,
-        message: '请输入考点指引',
-      },
-    ],
   };
 
   /* confirm */
@@ -155,7 +137,10 @@
 
     setLoading(true);
     const datas = objAssign(formData, {});
-    const res = await updateAgent(datas).catch(() => false);
+    let res = true;
+    await updateAgent(datas).catch(() => {
+      res = false;
+    });
     setLoading(false);
     if (!res) return;
     Message.success('修改成功!');

+ 17 - 10
src/views/base/agent-manage/modifyGuide.vue

@@ -17,7 +17,12 @@
       auto-label-width
       layout="vertical"
     >
-      <a-form-item field="notice" label="考点指引" :content-flex="false">
+      <a-form-item
+        field="notice"
+        label="考点指引"
+        hide-label
+        :content-flex="false"
+      >
         <rich-editor v-model="formData.guide" placeholder="请输入" />
       </a-form-item>
     </a-form>
@@ -35,10 +40,10 @@
   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 { updateAgentGuide, agentGuideDetail } from '@/api/base';
   import useLoading from '@/hooks/loading';
   import useModal from '@/hooks/modal';
-  import { objAssign, objModifyAssign } from '@/utils/utils';
+  import { objAssign } from '@/utils/utils';
   import { AgentItem, AgentGuideUpdateParams } from '@/api/types/base';
   import { FormRules } from '@/types/global';
 
@@ -81,7 +86,10 @@
 
     setLoading(true);
     const datas = objAssign(formData, {});
-    const res = await updateAgentGuide(datas).catch(() => false);
+    let res = true;
+    await updateAgentGuide(datas).catch(() => {
+      res = false;
+    });
     setLoading(false);
     if (!res) return;
     Message.success('修改成功!');
@@ -89,12 +97,11 @@
     close();
   }
   /* init modal */
-  function modalBeforeOpen() {
-    if (props.rowData.id) {
-      objModifyAssign(formData, props.rowData);
-    } else {
-      objModifyAssign(formData, defaultFormData);
-    }
+  async function modalBeforeOpen() {
+    const guide = await agentGuideDetail(props.rowData.id);
+    formData.id = props.rowData.id;
+    formData.guide = guide || '';
+
     nextTick(() => {
       formRef.value?.clearValidate();
     });

+ 3 - 3
src/views/base/room-manage/index.vue

@@ -8,7 +8,7 @@
         prefix
       />
       <SelectAgent
-        v-model="searchModel.agentId"
+        v-model="searchModel.examSiteId"
         placeholder="请选择"
         allow-clear
         prefix
@@ -111,7 +111,7 @@
 
   const searchModel = reactive({
     teachingId: null,
-    agentId: '',
+    examSiteId: null,
     name: '',
     enable: undefined,
   });
@@ -137,7 +137,7 @@
     },
     {
       title: '所属考点',
-      dataIndex: 'agentName',
+      dataIndex: 'examSiteName',
     },
     {
       title: '所属教学点',

+ 25 - 10
src/views/base/room-manage/modifyRoom.vue

@@ -24,7 +24,7 @@
           v-model.trim="formData.code"
           placeholder="请输入"
           allow-clear
-          :max-length="50"
+          :max-length="30"
         ></a-input>
       </a-form-item>
       <a-form-item field="address" label="考场地址">
@@ -45,18 +45,20 @@
           :step="1"
         />
       </a-form-item>
-      <a-form-item label="教学点">
+      <a-form-item field="teachingId" label="教学点">
         <SelectTeaching
           v-model="formData.teachingId"
           placeholder="请选择"
           allow-clear
+          @change="teachingChange"
         />
       </a-form-item>
-      <a-form-item field="agentId" label="考点">
+      <a-form-item field="examSiteId" label="考点">
         <SelectAgent
-          v-model="formData.agentId"
+          v-model="formData.examSiteId"
           placeholder="请选择"
           allow-clear
+          :cascade="false"
           :teaching-id="formData.teachingId"
         />
       </a-form-item>
@@ -97,7 +99,7 @@
     address: '',
     capacity: undefined,
     teachingId: null,
-    agentId: null,
+    examSiteId: null,
   };
 
   const props = defineProps<{
@@ -127,8 +129,8 @@
         message: '请输入代码',
       },
       {
-        maxLength: 50,
-        message: '代码不能超过50字符',
+        maxLength: 30,
+        message: '代码不能超过30字符',
       },
     ],
     address: [
@@ -141,7 +143,13 @@
         message: '地址不能超过100字符',
       },
     ],
-    agentId: [
+    teachingId: [
+      {
+        required: true,
+        message: '请选择教学点',
+      },
+    ],
+    examSiteId: [
       {
         required: true,
         message: '请选择考点',
@@ -150,11 +158,15 @@
     capacity: [
       {
         required: true,
-        message: '请输入容量',
+        message: '请输入机房容量',
       },
     ],
   };
 
+  function teachingChange() {
+    formData.examSiteId = null;
+  }
+
   /* confirm */
   const { loading, setLoading } = useLoading();
   async function confirm() {
@@ -163,7 +175,10 @@
 
     setLoading(true);
     const datas = objAssign(formData, {});
-    const res = await updateRoom(datas).catch(() => false);
+    let res = true;
+    await updateRoom(datas).catch(() => {
+      res = false;
+    });
     setLoading(false);
     if (!res) return;
     Message.success('修改成功!');

+ 7 - 8
src/views/base/teaching-manage/index.vue

@@ -57,13 +57,12 @@
           @click="toEnable(record)"
           >{{ record.enable ? '禁用' : '启用' }}</a-button
         >
-        <a-button
-          v-if="!record.cancel"
+        <!-- <a-button
           type="text"
           class="btn-primary"
           @click="toPlace(record)"
           >考点</a-button
-        >
+        > -->
       </template>
     </a-table>
 
@@ -130,7 +129,7 @@
       dataIndex: 'cityName',
     },
     {
-      title: '容量',
+      title: '容量',
       dataIndex: 'capacity',
       width: 100,
     },
@@ -142,7 +141,7 @@
     {
       title: '操作',
       slotName: 'action',
-      width: 140,
+      width: 120,
       fixed: 'right',
       cellClass: 'action-column',
     },
@@ -192,7 +191,7 @@
     getList();
   }
 
-  function toPlace(row: TeachingItem) {
-    console.log(row);
-  }
+  // function toPlace(row: TeachingItem) {
+  //   console.log(row);
+  // }
 </script>

+ 10 - 26
src/views/base/teaching-manage/modifyTeaching.vue

@@ -24,29 +24,17 @@
           v-model.trim="formData.code"
           placeholder="请输入"
           allow-clear
-          :max-length="50"
+          :max-length="30"
         ></a-input>
       </a-form-item>
-      <a-form-item field="capacity" label="容量">
-        <a-input-number
-          v-model="formData.capacity"
-          placeholder="请输入"
-          :style="{ width: '120px' }"
-          :min="1"
-          :max="99999"
-          :step="1"
-        />
-      </a-form-item>
       <a-form-item field="cityId" label="城市">
-        <a-select
+        <select-city
           v-model="formData.cityId"
           placeholder="请选择"
           filter-option
           allow-clear
-          popup-container="body"
-          :options="[]"
         >
-        </a-select>
+        </select-city>
       </a-form-item>
     </a-form>
 
@@ -82,8 +70,7 @@
     id: undefined,
     name: '',
     code: '',
-    cityId: undefined,
-    capacity: undefined,
+    cityId: null,
   };
 
   const props = defineProps<{
@@ -113,14 +100,8 @@
         message: '请输入代码',
       },
       {
-        maxLength: 50,
-        message: '代码不能超过50字符',
-      },
-    ],
-    capacity: [
-      {
-        required: true,
-        message: '请输入容量',
+        maxLength: 30,
+        message: '代码不能超过30字符',
       },
     ],
     cityId: [
@@ -139,7 +120,10 @@
 
     setLoading(true);
     const datas = objAssign(formData, {});
-    const res = await updateTeaching(datas).catch(() => false);
+    let res = true;
+    await updateTeaching(datas).catch(() => {
+      res = false;
+    });
     setLoading(false);
     if (!res) return;
     Message.success('修改成功!');

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

@@ -18,6 +18,7 @@
         placeholder="请选择"
         allow-clear
         prefix
+        cascade
         :teaching-id="searchModel.teachingId"
       />
       <select-range-datetime