zhengyiming
1 天以前 bd7dd96c732ded6854d47bf77f65e5c64d3d15e2
packages/components/src/views/GasBillRecharge/GasBillRechargeBaseForm.vue
@@ -4,8 +4,16 @@
    ref="formRef"
    :rules="rules"
    label-position="top"
    class="order-bill-recharge electric"
    class="order-bill-recharge electric chunk-form"
  >
    <slot name="top"></slot>
    <NutFormItem label="所在城市" class="bole-form-item" prop="areaList" required>
      <ChooseInputWithAreaPicker
        :columns="cityAreaTree"
        v-model="form.areaList"
        placeholder="请选择所在城市"
      ></ChooseInputWithAreaPicker>
    </NutFormItem>
    <NutFormItem label="缴费户号" class="bole-form-item" prop="gasAccount" required>
      <NutInput
        v-model.trim="form.gasAccount"
@@ -13,6 +21,14 @@
        placeholder="请输入缴费户号"
        type="text"
        max-length="13"
      />
    </NutFormItem>
    <NutFormItem label="户主姓名" class="bole-form-item" prop="name" required>
      <NutInput
        v-model.trim="form.name"
        class="bole-input-text"
        placeholder="请填写户主姓名"
        type="text"
      />
    </NutFormItem>
    <slot></slot>
@@ -23,24 +39,33 @@
import { Form as NutForm, FormItem as NutFormItem, Input as NutInput } from '@nutui/nutui-taro';
import { FormRules } from '@nutui/nutui-taro/dist/types/__VUE/form/types';
import { reactive, ref, computed, watch } from 'vue';
import { useGetGasParValue } from '../../hooks';
import ChooseInputWithAreaPicker from '../../components/Input/ChooseInputWithAreaPicker.vue';
import { useAllAreaList } from '../../hooks/area';
import { FormValidator } from '../../utils';
defineOptions({
  name: 'GasBillRechargeBaseForm',
});
const form = defineModel<{
  province: string;
  city: string;
  gasAccount: string;
}>('form');
const { findAreaNameFromCode, cityAreaTree } = useAllAreaList();
const { gasParValueList } = useGetGasParValue();
const form = defineModel<{
  // province: string;
  // city: string;
  gasAccount: string;
  areaList: string[];
  name: string;
}>('form');
const rules = reactive<FormRules>({
  province: [{ required: true, message: '请选择所在区域' }],
  city: [{ required: true, message: '请选择所在城市' }],
  gasAccount: [{ required: true, message: '请输入缴费户号', regex: /^\d{13}$/ }],
  // gasAccount: [{ required: true, message: '请输入缴费户号', regex: /^\d{13}$/ }],
  gasAccount: [{ required: true, message: '请输入缴费户号' }],
  areaList: [
    { required: true, message: '请选择所在城市', validator: FormValidator.validatorArray },
  ],
  name: [{ required: true, message: '请填写户主姓名' }],
});
const formRef = ref<any>(null);