Bladeren bron

fix: 移动端-申请带离,新增字段和web端不一致,缺少字段

Lambert 3 weken geleden
bovenliggende
commit
0ff908f9f8

+ 1 - 0
src/constants/pageConstants.ts

@@ -162,6 +162,7 @@ export interface CreateAnimalApplyLeavePayload {
   deptId: string // 用户部门
   deptName: string // 用户部门名称
   categoryName: string //动物类别
+  isReturn: number // 是否带回
 }
 
 export interface TurnBackPayload {

+ 32 - 1
src/view/animal/applicationRemoval/components/addEdit.vue

@@ -30,7 +30,7 @@
                 :rules="rules.takeawayReason" />
               <van-field v-model="state.form.takeawayTransport" label="运输方式" placeholder="请输入" :readonly="isReadOnly" required
                 :rules="rules.takeawayTransport" />
-              <!-- <van-field v-model="state.form.accessCardNumber" label="门禁卡序列号" placeholder="请输入" :readonly="isReadOnly" /> -->
+<!--               <van-field v-model="state.form.accessCardNumber" label="门禁卡序列号" placeholder="请输入" :readonly="isReadOnly" />-->
               <van-field v-model="state.form.takeawayMaleNumber" label="雄性" placeholder="雄性数量" type="digit" :readonly="isReadOnly">
                 <template #button>
                   <van-stepper v-model="state.form.takeawayMaleNumber" :min="0" integer :disabled="isReadOnly" />
@@ -43,6 +43,9 @@
               </van-field>
             </van-cell-group>
 
+            <h4 class="mb20 mt20">转回备注</h4>
+            <van-field v-model="isReturnLabel" label="是否转回" placeholder="请选择" :readonly="isReadOnly" :is-link="!isReadOnly" required
+                       @click="!isReadOnly && (showReturnPicker = true)" :rules="rules.isReturn"/>
             <div class="mt30 mb30 checkbox-wrapper">
               <van-checkbox v-model="safePromiseStatus" :disabled="isReadOnly">
                 本人已阅读并同意
@@ -81,6 +84,12 @@
       <van-calendar v-model:show="showDatePicker" @confirm="onDateConfirm" :min-date="new Date()" />
     </van-popup>
 
+    <!-- 是否转回选择器 -->
+    <van-popup v-model:show="showReturnPicker" position="bottom" :style="{ height: '80vh' }" round>
+      <van-picker :columns="groupOptions" :columns-field-names="{ text: 'text', value: 'value'}"
+                  @confirm="onReturnOptionConfirm" @cancel="showReturnPicker = false" />
+    </van-popup>
+
     <!-- 须知弹窗 -->
     <van-popup v-model:show="isShowNotice" position="bottom" round :closeable="true" :style="{ height: '70vh' }">
       <div class="notice-content">
@@ -132,6 +141,7 @@ const isShowNotice = ref<boolean>(false)
 const showCategoryPicker = ref<boolean>(false)
 const showDatePicker = ref<boolean>(false)
 const selectedDate = ref<Date | null>(null)
+const showReturnPicker = ref<boolean>(false)
 
 const isReadOnly = computed(() => state.dialog.type === 'detail')
 
@@ -144,6 +154,7 @@ const rules = {
   takeawayAddress: [{ required: true, message: '送往地点不能为空' }],
   takeawayReason: [{ required: true, message: '带出原因不能为空' }],
   takeawayTransport: [{ required: true, message: '运输方式不能为空' }],
+  isReturn: [{ required: true, message: '是否转回不能为空' }],
 }
 
 const defaultFormFields: CreateAnimalApplyLeavePayload & { categoryName?: string } = {
@@ -163,6 +174,7 @@ const defaultFormFields: CreateAnimalApplyLeavePayload & { categoryName?: string
   phone: '',
   deptId: '',
   deptName: '',
+  isReturn: 0,
 }
 
 const state = reactive<{
@@ -263,6 +275,7 @@ const closeDialog = () => {
     phone: '',
     deptId: '',
     deptName: '',
+    isReturn: 0,
   }
   safePromiseStatus.value = false
   selectedDate.value = null
@@ -360,6 +373,24 @@ const onCategoryConfirm = ({ selectedOptions }: { selectedOptions: any[] }) => {
   showCategoryPicker.value = false
 }
 
+const isReturnLabel = computed(() => {
+  const option = groupOptions.find(opt => opt.value === state.form.isReturn);
+  return option ? option.text : '';
+});
+
+const groupOptions = [
+  { text: '是', value: 10 },
+  { text: '否', value: 20 },
+];
+
+const onReturnOptionConfirm = ({ selectedOptions }: any) => {
+  if (selectedOptions && selectedOptions.length > 0) {
+    // 这里的 value 就会拿到 10 或 20
+    state.form.isReturn = selectedOptions[0].value;
+  }
+  showReturnPicker.value = false;
+}
+
 const onDateConfirm = (date: Date) => {
   selectedDate.value = date
   state.form.takeawayDate = formatDate(date, 'YYYY-mm-dd')

+ 11 - 2
src/view/todo/component/plat_animal_takeway_applications.vue

@@ -46,9 +46,13 @@
         title="运输方式"
         :value="state.form.takeawayTransport"
       />
+<!--      <van-cell-->
+<!--        title="门禁卡序列号"-->
+<!--        :value="state.form.accessCardNumber"-->
+<!--      />-->
       <van-cell
-        title="门禁卡序列号"
-        :value="state.form.accessCardNumber"
+        title="是否转回"
+        :value="isReturnLabel"
       />
       <van-cell title="数量(雄性+雌性=总数)">
         <template #value>
@@ -101,8 +105,13 @@
     phone: '',
     deptId: '',
     deptName: '',
+    isReturn: 0,
   }
 
+  const isReturnLabel = computed(() => {
+    return state.form.isReturn === 10 ? '是' : '否';
+  });
+
   const state = reactive<{
     form: CreateAnimalApplyLeavePayload
     safePromise: boolean