| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- import { getCardTypeEnumList } from '@/common/constants/enumsList';
- import { queryResultLoadingAndInfo } from '@/common/methods/request/resultInfo';
- import { validateCommon } from '@/common/setup/validate';
- import { getUserId } from '@/services/bus/user';
- import { QueryAddUserInfoApply } from '@/services/go/ermcp/customInfo';
- import { AddUserInfoApplyReq } from '@/services/go/ermcp/customInfo/interface';
- import { QueryBrokerApply, queryParentAreaList } from '@/services/go/ermcp/qhj';
- import { QhjParentAreaList, QueryBrokerApplyRsp } from '@/services/go/ermcp/qhj/interface';
- import { message } from 'ant-design-vue';
- import { RuleObject } from 'ant-design-vue/lib/form/interface';
- import { reactive, Ref, ref, UnwrapRef } from 'vue';
- import { FormState } from './interface';
- /**
- * 获取证件类型
- * @returns
- */
- export function getCardType() {
- const arr = [2, 4, 18, 21];
- return getCardTypeEnumList().filter(e => arr.includes(e.enumitemname))
- }
- export function handleForm() {
- const formRef = ref();
- const formState: UnwrapRef<FormState> = reactive(initFormState());
- // 验证仓库类型
- async function v_cardtype(rule: RuleObject, value: number) {
- return validateCommon(value, '请选择证件类型')
- }
- const rules = {
- userinfotype: [{ required: true, message: '请选择客户类型', trigger: 'change' }],
- areaid: [{ required: true, message: '请选择所属机构' }],
- sex: [{ required: true, message: '请选择性别' }],
- customername: [{ required: true, message: '请输入企业名称', trigger: 'blur' }],
- mobilephone: [
- { required: true, message: '请输入联系人手机号', trigger: 'blur' },
- { message: '请输入正确的手机号', pattern: /^[1][3,4,5,7,8,9][0-9]{9}$/ }
- ],
- username: [{ required: true, message: '请输入姓名', trigger: 'blur' }],
- nickname: [{ required: true, message: '请输入企业简称', trigger: 'blur' }],
- // cardtype: [{ required: true, validator: v_cardtype, trigger: 'change' }],
- };
- return { formRef, formState, rules }
- }
- /**
- * 初始化表单数据
- * @returns
- */
- export function initFormState(): FormState {
- return {
- areaid: undefined,
- logincode: '',
- loginpwd: '',
- userinfotype: '2',
- customername: '',
- nickname: '',
- cardtype: undefined,
- cardnum: '',
- legalpersonname: '',
- taxpayernum: '',
- attachment1: '',
- attachment2: '',
- attachment3: '',
- attachment4: '',
- attachment5: '',
- contactname: '',
- mobilephone: '',
- telphone: '',
- provinceid: undefined,
- cityid: undefined,
- districtid: undefined,
- cardaddress: '',
- remark: '',
- username: '',
- cardbackphotourl: '',
- cardfrontphotourl: '',
- email: '',
- birthday: '',
- teammanageruserid: undefined,
- sex: undefined,
- }
- }
- export function handleApply() {
- const loading = ref<boolean>(false);
- function applyAction(param: AddUserInfoApplyReq) {
- loading.value = true;
- QueryAddUserInfoApply(param).then(res => {
- }).catch(err => {
- message.error(err)
- }).finally(() => loading.value = false)
- }
- return { loading, applyAction }
- }
- // 查询所属机构列表
- export function handleAreaList() {
- const areaList = ref<QhjParentAreaList[]>([])
- function getAreaList(loading: Ref<boolean>) {
- queryResultLoadingAndInfo(queryParentAreaList, loading).then(res => {
- areaList.value = res
- })
- }
- return { areaList, getAreaList }
- }
- // 查询客户经理
- export function handleBrokerApplyt() {
- const brokerList = ref<QueryBrokerApplyRsp[]>([])
- function getBrokerApply(loading: Ref<boolean>) {
- const param = {
- userid: getUserId(),
- filterstatus: 2,
- includesub: 1,
- }
- queryResultLoadingAndInfo(QueryBrokerApply, loading, param).then(res => {
- brokerList.value = res
- })
- }
- return { brokerList, getBrokerApply }
- }
|