添加注册流程
This commit is contained in:
parent
a661a5e1ea
commit
03bb66a095
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
|
@ -12,5 +12,11 @@ export enum PageEnum {
|
||||||
//文件路由
|
//文件路由
|
||||||
SYS_FILES_PATH = '/file/share',
|
SYS_FILES_PATH = '/file/share',
|
||||||
// 邮件中的跳转地址
|
// 邮件中的跳转地址
|
||||||
TOKEN_LOGIN = '/tokenLogin'
|
TOKEN_LOGIN = '/tokenLogin',
|
||||||
|
// h5白名单
|
||||||
|
H5_ADVISORYINFO = '/h5/advisoryInfo',
|
||||||
|
// h5白名单
|
||||||
|
H5_REGISTER_ADVISORY = '/h5/registerAdvisory',
|
||||||
|
// h5白名单
|
||||||
|
H5_EDIT_ADVISORY = '/h5/editAdvisory',
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,15 @@ const SYS_FILES_PATH = PageEnum.SYS_FILES_PATH;
|
||||||
// 邮件中的跳转地址,对应此路由,携带token免登录直接去办理页面
|
// 邮件中的跳转地址,对应此路由,携带token免登录直接去办理页面
|
||||||
const TOKEN_LOGIN = PageEnum.TOKEN_LOGIN;
|
const TOKEN_LOGIN = PageEnum.TOKEN_LOGIN;
|
||||||
|
|
||||||
|
const H5_ADVISORYINFO = PageEnum.H5_ADVISORYINFO;
|
||||||
|
const H5_REGISTER_ADVISORY = PageEnum.H5_REGISTER_ADVISORY;
|
||||||
|
const H5_EDIT_ADVISORY = PageEnum.H5_EDIT_ADVISORY;
|
||||||
|
|
||||||
const ROOT_PATH = RootRoute.path;
|
const ROOT_PATH = RootRoute.path;
|
||||||
|
|
||||||
//update-begin---author:wangshuai ---date:20220629 for:[issues/I5BG1I]vue3不支持auth2登录------------
|
//update-begin---author:wangshuai ---date:20220629 for:[issues/I5BG1I]vue3不支持auth2登录------------
|
||||||
//update-begin---author:wangshuai ---date:20221111 for: [VUEN-2472]分享免登录------------
|
//update-begin---author:wangshuai ---date:20221111 for: [VUEN-2472]分享免登录------------
|
||||||
const whitePathList: PageEnum[] = [LOGIN_PATH, OAUTH2_LOGIN_PAGE_PATH,SYS_FILES_PATH, TOKEN_LOGIN ];
|
const whitePathList: PageEnum[] = [LOGIN_PATH, OAUTH2_LOGIN_PAGE_PATH,SYS_FILES_PATH, TOKEN_LOGIN,H5_ADVISORYINFO,H5_REGISTER_ADVISORY,H5_EDIT_ADVISORY];
|
||||||
//update-end---author:wangshuai ---date:20221111 for: [VUEN-2472]分享免登录------------
|
//update-end---author:wangshuai ---date:20221111 for: [VUEN-2472]分享免登录------------
|
||||||
//update-end---author:wangshuai ---date:20220629 for:[issues/I5BG1I]vue3不支持auth2登录------------
|
//update-end---author:wangshuai ---date:20220629 for:[issues/I5BG1I]vue3不支持auth2登录------------
|
||||||
|
|
||||||
|
|
|
@ -64,5 +64,33 @@ export const TokenLoginRoute: AppRouteRecordRaw = {
|
||||||
ignoreAuth: true,
|
ignoreAuth: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
//h5页面首页
|
||||||
|
export const H5_REGISTER_ADVISORY: AppRouteRecordRaw = {
|
||||||
|
path: '/h5/registerAdvisory',
|
||||||
|
name: 'registerAdvisory',
|
||||||
|
component: () => import('../../views/biz/NuBizAdvisoryInfo/h5/RegisterAdvisoryInfo.vue'),
|
||||||
|
meta: {
|
||||||
|
title: "注册信息",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
//h5页面首页
|
||||||
|
export const H5_ADVISORYINFO: AppRouteRecordRaw = {
|
||||||
|
path: '/h5/advisoryInfo',
|
||||||
|
name: 'advisoryInfo',
|
||||||
|
component: () => import('../../views/biz/NuBizAdvisoryInfo/h5/AdvisoryInfo.vue'),
|
||||||
|
meta: {
|
||||||
|
title: "信息",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
//h5页面首页
|
||||||
|
export const H5_EDIT_ADVISORY: AppRouteRecordRaw = {
|
||||||
|
path: '/h5/editAdvisory',
|
||||||
|
name: 'editAdvisoryInfo',
|
||||||
|
component: () => import('../../views/biz/NuBizAdvisoryInfo/h5/EditAdvisoryInfo.vue'),
|
||||||
|
meta: {
|
||||||
|
title: "修改信息",
|
||||||
|
},
|
||||||
|
};
|
||||||
// Basic routing without permission
|
// Basic routing without permission
|
||||||
export const basicRoutes = [LoginRoute, RootRoute, ...mainOutRoutes, REDIRECT_ROUTE, PAGE_NOT_FOUND_ROUTE, TokenLoginRoute, Oauth2LoginRoute];
|
export const basicRoutes = [LoginRoute, RootRoute, ...mainOutRoutes, REDIRECT_ROUTE, PAGE_NOT_FOUND_ROUTE, TokenLoginRoute, Oauth2LoginRoute,H5_REGISTER_ADVISORY,H5_ADVISORYINFO,H5_EDIT_ADVISORY];
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
<template>
|
||||||
|
<div style="padding: 14px;" class="advisoryClass" >
|
||||||
|
<a-card :title="formData.name">
|
||||||
|
<template #extra>{{formData.sexName}}</template>
|
||||||
|
<p>机构名称:{{formData.sysOrgCodeName}}</p>
|
||||||
|
<p>入住类型:{{formData.advisoryTypeName}}</p>
|
||||||
|
<p>联系电话:{{formData.tel}}</p>
|
||||||
|
<p>审核状态:{{formData.statusName}}</p>
|
||||||
|
<p>
|
||||||
|
<a-button type="primary" @click="handleEdit">修改信息</a-button>
|
||||||
|
<a-button type="primary" style="margin-left: 10px;">办理入住</a-button>
|
||||||
|
</p>
|
||||||
|
</a-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
import { getValueType } from '/@/utils';
|
||||||
|
import { Form } from 'ant-design-vue';
|
||||||
|
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||||
|
import { useGlobSetting } from "/@/hooks/setting";
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const props = defineProps({
|
||||||
|
formDisabled: { type: Boolean, default: false },
|
||||||
|
formData: { type: Object, default: () => ({})},
|
||||||
|
formBpm: { type: Boolean, default: true }
|
||||||
|
});
|
||||||
|
const formRef = ref();
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const emit = defineEmits(['register', 'ok']);
|
||||||
|
const glob = useGlobSetting()
|
||||||
|
const institutionsSource = ref([]);
|
||||||
|
const openId = ref<string>('公众号openId');
|
||||||
|
const wechatName = ref<string>('公众号姓名');
|
||||||
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||||
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
|
const formData = reactive<Record<string, any>>({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
sex: '',
|
||||||
|
sysOrgCode: '',
|
||||||
|
tel: '',
|
||||||
|
advisoryType: '',
|
||||||
|
status: '',
|
||||||
|
content: '',
|
||||||
|
serverUrl: '',
|
||||||
|
openId: '',
|
||||||
|
wechatName: '',
|
||||||
|
});
|
||||||
|
//表单验证
|
||||||
|
const validatorRules = reactive({
|
||||||
|
});
|
||||||
|
|
||||||
|
function handleEdit(){
|
||||||
|
//跳转到信息页面
|
||||||
|
router.push({ path: "/h5/editAdvisory" });
|
||||||
|
}
|
||||||
|
|
||||||
|
//自动加载
|
||||||
|
onMounted(() => {
|
||||||
|
//TODO 获取微信公众号信息
|
||||||
|
|
||||||
|
//获取是否注册了信息
|
||||||
|
const getWechartInfoUrl = glob.domainUrl+"/h5Api/nuBizAdvisoryInfo/queryByOpenId?openId="+openId.value;
|
||||||
|
axios.get(getWechartInfoUrl).then(response => {
|
||||||
|
const tmpData = response.data.result;
|
||||||
|
|
||||||
|
Object.assign(formData, tmpData);
|
||||||
|
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.antd-modal-form {
|
||||||
|
padding: 14px;
|
||||||
|
}
|
||||||
|
.advisoryClass{
|
||||||
|
background-image: url(/@/assets/images/advisory.jpg);
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,191 @@
|
||||||
|
<template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<JFormContainer class="advisoryClass">
|
||||||
|
<template #detail>
|
||||||
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuBizAdvisoryInfoForm">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="选择机构" v-bind="validateInfos.sysOrgCode" id="NuBizAdvisoryInfoForm-sysOrgCode" name="sysOrgCode">
|
||||||
|
<a-radio-group v-model:value="formData.sysOrgCode" @change="handleChangeRadio">
|
||||||
|
<template v-for="item in institutionsSource" :key="`${item.id}`">
|
||||||
|
<a-radio :value="item.id">
|
||||||
|
{{ item.departName }}
|
||||||
|
</a-radio>
|
||||||
|
</template>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="咨询类型" v-bind="validateInfos.advisoryType" id="NuBizAdvisoryInfoForm-advisoryType" name="advisoryType">
|
||||||
|
<j-dict-select-tag type='radio' v-model:value="formData.advisoryType" dictCode="advisory_type" placeholder="请选择咨询类型" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="咨询人姓名" v-bind="validateInfos.name" id="NuBizAdvisoryInfoForm-name" name="name">
|
||||||
|
<a-input v-model:value="formData.name" placeholder="请输入咨询人姓名" allow-clear ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="性别" v-bind="validateInfos.sex" id="NuBizAdvisoryInfoForm-sex" name="sex">
|
||||||
|
<j-dict-select-tag type='radio' v-model:value="formData.sex" dictCode="sex" placeholder="请选择性别" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="联系电话" v-bind="validateInfos.tel" id="NuBizAdvisoryInfoForm-tel" name="tel">
|
||||||
|
<a-input v-model:value="formData.tel" placeholder="请输入联系电话" allow-clear ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24" style="text-align: center;">
|
||||||
|
<a-button type="primary" @click="handleSubmit()">提交</a-button>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
</JFormContainer>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
import { getValueType } from '/@/utils';
|
||||||
|
import { Form } from 'ant-design-vue';
|
||||||
|
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||||
|
import { useGlobSetting } from "/@/hooks/setting";
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const props = defineProps({
|
||||||
|
formDisabled: { type: Boolean, default: false },
|
||||||
|
formData: { type: Object, default: () => ({})},
|
||||||
|
formBpm: { type: Boolean, default: true }
|
||||||
|
});
|
||||||
|
const formRef = ref();
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const emit = defineEmits(['register', 'ok']);
|
||||||
|
const glob = useGlobSetting()
|
||||||
|
const institutionsSource = ref([]);
|
||||||
|
const openId = ref<string>('公众号openId');
|
||||||
|
const wechatName = ref<string>('公众号姓名');
|
||||||
|
const formData = reactive<Record<string, any>>({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
sex: '1',
|
||||||
|
sysOrgCode: '',
|
||||||
|
tel: '',
|
||||||
|
advisoryType: '1',
|
||||||
|
status: '1',
|
||||||
|
content: '',
|
||||||
|
serverUrl: '',
|
||||||
|
openId: '',
|
||||||
|
wechatName: '',
|
||||||
|
});
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||||
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
|
const confirmLoading = ref<boolean>(false);
|
||||||
|
//表单验证
|
||||||
|
const validatorRules = reactive({
|
||||||
|
name: [{ required: true, message: '请输入姓名!' }],
|
||||||
|
sysOrgCode: [{ required: true, message: '请选择入住机构!' }],
|
||||||
|
advisoryType: [{ required: true, message: '请选择咨询类型!' }],
|
||||||
|
tel: [{ required: true, message: '请输入联系电话!' }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '联系电话错误!' }],
|
||||||
|
sex: [{ required: true, message: '请选择性别!' }],
|
||||||
|
});
|
||||||
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
|
|
||||||
|
//选中机构后获取serverUrl地址
|
||||||
|
function handleChangeRadio(item){
|
||||||
|
const checkId = item.target.value;
|
||||||
|
const checkData = institutionsSource.value.filter(item => item.id === checkId);
|
||||||
|
if(checkData.length>0){
|
||||||
|
const serverUrl = checkData[0].serverUrl;
|
||||||
|
formData.serverUrl = serverUrl;
|
||||||
|
}
|
||||||
|
console.log('formData--->',formData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//提交信息
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
// 触发表单验证
|
||||||
|
await validate();
|
||||||
|
} catch ({ errorFields }) {
|
||||||
|
if (errorFields) {
|
||||||
|
const firstField = errorFields[0];
|
||||||
|
if (firstField) {
|
||||||
|
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Promise.reject(errorFields);
|
||||||
|
}
|
||||||
|
//时间格式化
|
||||||
|
let model = formData;
|
||||||
|
//循环数据
|
||||||
|
for (let data in model) {
|
||||||
|
//如果该数据是数组并且是字符串类型
|
||||||
|
if (model[data] instanceof Array) {
|
||||||
|
let valueType = getValueType(formRef.value.getProps, data);
|
||||||
|
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||||
|
if (valueType === 'string') {
|
||||||
|
model[data] = model[data].join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model.openId = openId.value;
|
||||||
|
model.wechatName = wechatName.value;
|
||||||
|
model.status = '1';//强制在提交时把status置为1 审核中
|
||||||
|
console.log('model--->',model);
|
||||||
|
const serverUrl = formData.serverUrl;
|
||||||
|
axios.post(serverUrl+"/h5Api/nuBizAdvisoryInfo/edit",model).then(response => {
|
||||||
|
var data = response.data;
|
||||||
|
if(data.code === 200){
|
||||||
|
createMessage.success("操作成功");
|
||||||
|
//跳转到信息页面
|
||||||
|
router.push({ path: "/h5/advisoryInfo" });
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWechatInfo(){
|
||||||
|
|
||||||
|
const institutionsUrl = glob.domainUrl+"/sys/sysDepart/queryInstitutionsList";
|
||||||
|
axios.get(institutionsUrl).then(response => {
|
||||||
|
institutionsSource.value = response.data;
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
//获取是否注册了信息
|
||||||
|
const getWechartInfoUrl = glob.domainUrl+"/h5Api/nuBizAdvisoryInfo/queryByOpenId?openId="+openId.value;
|
||||||
|
axios.get(getWechartInfoUrl).then(response => {
|
||||||
|
const tmpData = response.data.result;
|
||||||
|
Object.assign(formData, tmpData);
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
//自动加载
|
||||||
|
onMounted(() => {
|
||||||
|
//TODO 获取微信公众号信息
|
||||||
|
getWechatInfo()
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.antd-modal-form {
|
||||||
|
padding: 14px;
|
||||||
|
}
|
||||||
|
.advisoryClass{
|
||||||
|
background-image: url(/@/assets/images/advisory.jpg);
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,194 @@
|
||||||
|
<template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<JFormContainer class="advisoryClass">
|
||||||
|
<template #detail>
|
||||||
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuBizAdvisoryInfoForm">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="选择机构" v-bind="validateInfos.sysOrgCode" id="NuBizAdvisoryInfoForm-sysOrgCode" name="sysOrgCode">
|
||||||
|
<a-radio-group v-model:value="formData.sysOrgCode" @change="handleChangeRadio">
|
||||||
|
<template v-for="item in institutionsSource" :key="`${item.id}`">
|
||||||
|
<a-radio :value="item.id">
|
||||||
|
{{ item.departName }}
|
||||||
|
</a-radio>
|
||||||
|
</template>
|
||||||
|
</a-radio-group>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="咨询类型" v-bind="validateInfos.advisoryType" id="NuBizAdvisoryInfoForm-advisoryType" name="advisoryType">
|
||||||
|
<j-dict-select-tag type='radio' v-model:value="formData.advisoryType" dictCode="advisory_type" placeholder="请选择咨询类型" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="咨询人姓名" v-bind="validateInfos.name" id="NuBizAdvisoryInfoForm-name" name="name">
|
||||||
|
<a-input v-model:value="formData.name" placeholder="请输入咨询人姓名" allow-clear ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="性别" v-bind="validateInfos.sex" id="NuBizAdvisoryInfoForm-sex" name="sex">
|
||||||
|
<j-dict-select-tag type='radio' v-model:value="formData.sex" dictCode="sex" placeholder="请选择性别" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="联系电话" v-bind="validateInfos.tel" id="NuBizAdvisoryInfoForm-tel" name="tel">
|
||||||
|
<a-input v-model:value="formData.tel" placeholder="请输入联系电话" allow-clear ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24" style="text-align: center;">
|
||||||
|
<a-button type="primary" @click="handleSubmit()">提交</a-button>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
</JFormContainer>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
import { getValueType } from '/@/utils';
|
||||||
|
import { Form } from 'ant-design-vue';
|
||||||
|
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||||
|
import { useGlobSetting } from "/@/hooks/setting";
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
import axios from 'axios';
|
||||||
|
|
||||||
|
const router = useRouter();
|
||||||
|
const props = defineProps({
|
||||||
|
formDisabled: { type: Boolean, default: false },
|
||||||
|
formData: { type: Object, default: () => ({})},
|
||||||
|
formBpm: { type: Boolean, default: true }
|
||||||
|
});
|
||||||
|
const formRef = ref();
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const emit = defineEmits(['register', 'ok']);
|
||||||
|
const glob = useGlobSetting()
|
||||||
|
const institutionsSource = ref([]);
|
||||||
|
const openId = ref<string>('公众号openId');
|
||||||
|
const wechatName = ref<string>('公众号姓名');
|
||||||
|
const formData = reactive<Record<string, any>>({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
sex: '1',
|
||||||
|
sysOrgCode: '',
|
||||||
|
tel: '',
|
||||||
|
advisoryType: '1',
|
||||||
|
status: '1',
|
||||||
|
content: '',
|
||||||
|
serverUrl: '',
|
||||||
|
openId: '',
|
||||||
|
wechatName: '',
|
||||||
|
});
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||||
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
|
const confirmLoading = ref<boolean>(false);
|
||||||
|
//表单验证
|
||||||
|
const validatorRules = reactive({
|
||||||
|
name: [{ required: true, message: '请输入姓名!' }],
|
||||||
|
sysOrgCode: [{ required: true, message: '请选择入住机构!' }],
|
||||||
|
advisoryType: [{ required: true, message: '请选择咨询类型!' }],
|
||||||
|
tel: [{ required: true, message: '请输入联系电话!' }, { pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: '联系电话错误!' }],
|
||||||
|
sex: [{ required: true, message: '请选择性别!' }],
|
||||||
|
});
|
||||||
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
|
|
||||||
|
//选中机构后获取serverUrl地址
|
||||||
|
function handleChangeRadio(item){
|
||||||
|
const checkId = item.target.value;
|
||||||
|
const checkData = institutionsSource.value.filter(item => item.id === checkId);
|
||||||
|
if(checkData.length>0){
|
||||||
|
const serverUrl = checkData[0].serverUrl;
|
||||||
|
formData.serverUrl = serverUrl;
|
||||||
|
}
|
||||||
|
console.log('formData--->',formData);
|
||||||
|
}
|
||||||
|
|
||||||
|
//提交信息
|
||||||
|
async function handleSubmit() {
|
||||||
|
try {
|
||||||
|
// 触发表单验证
|
||||||
|
await validate();
|
||||||
|
} catch ({ errorFields }) {
|
||||||
|
if (errorFields) {
|
||||||
|
const firstField = errorFields[0];
|
||||||
|
if (firstField) {
|
||||||
|
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Promise.reject(errorFields);
|
||||||
|
}
|
||||||
|
//时间格式化
|
||||||
|
let model = formData;
|
||||||
|
//循环数据
|
||||||
|
for (let data in model) {
|
||||||
|
//如果该数据是数组并且是字符串类型
|
||||||
|
if (model[data] instanceof Array) {
|
||||||
|
let valueType = getValueType(formRef.value.getProps, data);
|
||||||
|
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||||
|
if (valueType === 'string') {
|
||||||
|
model[data] = model[data].join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
model.openId = openId.value;
|
||||||
|
model.wechatName = wechatName.value;
|
||||||
|
model.status = '1';//强制在提交时把status置为1 审核中
|
||||||
|
console.log('model--->',model);
|
||||||
|
const serverUrl = formData.serverUrl;
|
||||||
|
axios.post(serverUrl+"/h5Api/nuBizAdvisoryInfo/add",model).then(response => {
|
||||||
|
var data = response.data;
|
||||||
|
if(data.code === 200){
|
||||||
|
createMessage.success("操作成功");
|
||||||
|
getWechatInfo();
|
||||||
|
}
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWechatInfo(){
|
||||||
|
//获取是否注册了信息
|
||||||
|
const getWechartInfoUrl = glob.domainUrl+"/h5Api/nuBizAdvisoryInfo/queryByOpenId?openId="+openId.value;
|
||||||
|
axios.get(getWechartInfoUrl).then(response => {
|
||||||
|
console.log('response--->',response);
|
||||||
|
if(response.data.code == '200'){
|
||||||
|
//跳转到信息页面
|
||||||
|
router.push({ path: "/h5/advisoryInfo" });
|
||||||
|
}else{
|
||||||
|
//走注册流程
|
||||||
|
const institutionsUrl = glob.domainUrl+"/sys/sysDepart/queryInstitutionsList";
|
||||||
|
axios.get(institutionsUrl).then(response => {
|
||||||
|
institutionsSource.value = response.data;
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// institutionsSource.value = response.data;
|
||||||
|
}).catch(error => {
|
||||||
|
console.error(error);
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
//自动加载
|
||||||
|
onMounted(() => {
|
||||||
|
//TODO 获取微信公众号信息
|
||||||
|
getWechatInfo()
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.antd-modal-form {
|
||||||
|
padding: 14px;
|
||||||
|
}
|
||||||
|
.advisoryClass{
|
||||||
|
background-image: url(/@/assets/images/advisory.jpg);
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,72 @@
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from "/@/hooks/web/useMessage";
|
||||||
|
|
||||||
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
list = '/NuBizAdvisoryInfo/nuBizAdvisoryInfo/list',
|
||||||
|
save='/NuBizAdvisoryInfo/nuBizAdvisoryInfo/add',
|
||||||
|
edit='/NuBizAdvisoryInfo/nuBizAdvisoryInfo/edit',
|
||||||
|
deleteOne = '/NuBizAdvisoryInfo/nuBizAdvisoryInfo/delete',
|
||||||
|
deleteBatch = '/NuBizAdvisoryInfo/nuBizAdvisoryInfo/deleteBatch',
|
||||||
|
importExcel = '/NuBizAdvisoryInfo/nuBizAdvisoryInfo/importExcel',
|
||||||
|
exportXls = '/NuBizAdvisoryInfo/nuBizAdvisoryInfo/exportXls',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出api
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const getExportUrl = Api.exportXls;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入api
|
||||||
|
*/
|
||||||
|
export const getImportUrl = Api.importExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表接口
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const deleteOne = (params,handleSuccess) => {
|
||||||
|
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const batchDelete = (params, handleSuccess) => {
|
||||||
|
createConfirm({
|
||||||
|
iconType: 'warning',
|
||||||
|
title: '确认删除',
|
||||||
|
content: '是否删除选中数据',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存或者更新
|
||||||
|
* @param params
|
||||||
|
* @param isUpdate
|
||||||
|
*/
|
||||||
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
import {BasicColumn} from '/@/components/Table';
|
||||||
|
import {FormSchema} from '/@/components/Table';
|
||||||
|
import { rules} from '/@/utils/helper/validator';
|
||||||
|
import { render } from '/@/utils/common/renderUtils';
|
||||||
|
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||||
|
//列表数据
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{
|
||||||
|
title: '咨询人姓名',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '性别',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'sex_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '联系电话',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'tel'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '咨询类型',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'advisoryType_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '状态',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'status_dictText'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '审核备注',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'content'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// 高级查询数据
|
||||||
|
export const superQuerySchema = {
|
||||||
|
name: {title: '咨询人姓名',order: 0,view: 'text', type: 'string',},
|
||||||
|
sex: {title: '性别',order: 1,view: 'radio', type: 'string',dictCode: 'sex',},
|
||||||
|
tel: {title: '联系电话',order: 2,view: 'text', type: 'string',},
|
||||||
|
advisoryType: {title: '咨询类型',order: 3,view: 'radio', type: 'string',dictCode: 'advisory_type',},
|
||||||
|
status: {title: '状态',order: 4,view: 'radio', type: 'string',dictCode: 'advisory_approval',},
|
||||||
|
content: {title: '审核备注',order: 5,view: 'textarea', type: 'string',},
|
||||||
|
};
|
|
@ -0,0 +1,255 @@
|
||||||
|
<template>
|
||||||
|
<div class="p-2">
|
||||||
|
<!--查询区域-->
|
||||||
|
<div class="jeecg-basic-table-form-container">
|
||||||
|
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
<a-col :lg="6">
|
||||||
|
<a-form-item name="name">
|
||||||
|
<template #label><span title="咨询人姓名">咨询人姓</span></template>
|
||||||
|
<a-input placeholder="请输入咨询人姓名" v-model:value="queryParam.name" allow-clear ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :lg="6">
|
||||||
|
<a-form-item name="tel">
|
||||||
|
<template #label><span title="联系电话">联系电话</span></template>
|
||||||
|
<a-input placeholder="请输入联系电话" v-model:value="queryParam.tel" allow-clear ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :lg="6">
|
||||||
|
<a-form-item name="advisoryType">
|
||||||
|
<template #label><span title="咨询类型">咨询类型</span></template>
|
||||||
|
<j-select-multiple placeholder="请选择咨询类型" v-model:value="queryParam.advisoryType" dictCode="advisory_type" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :lg="6">
|
||||||
|
<a-form-item name="status">
|
||||||
|
<template #label><span title="状态">状态</span></template>
|
||||||
|
<j-select-multiple placeholder="请选择状态" v-model:value="queryParam.status" dictCode="advisory_approval" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||||
|
<a-col :lg="6">
|
||||||
|
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||||
|
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset" style="margin-left: 8px">重置</a-button>
|
||||||
|
<a-button type="primary" v-auth="'NuBizAdvisoryInfo:nu_biz_advisory_info:exportXls'" preIcon="ant-design:export-outlined" @click="onExportXls" style="margin-left: 8px"> 导出</a-button>
|
||||||
|
</a-col>
|
||||||
|
</span>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
<!--引用表格-->
|
||||||
|
<BasicTable @register="registerTable" >
|
||||||
|
<!--插槽:table标题-->
|
||||||
|
<template #tableTitle>
|
||||||
|
<a-button type="primary" v-auth="'NuBizAdvisoryInfo:nu_biz_advisory_info:add'" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||||
|
<j-upload-button type="primary" v-auth="'NuBizAdvisoryInfo:nu_biz_advisory_info:importExcel'" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button>
|
||||||
|
</template>
|
||||||
|
<!--操作栏-->
|
||||||
|
<template #action="{ record }">
|
||||||
|
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)"/>
|
||||||
|
</template>
|
||||||
|
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<NuBizAdvisoryInfoModal ref="registerModal" @success="handleSuccess"></NuBizAdvisoryInfoModal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="NuBizAdvisoryInfo-nuBizAdvisoryInfo" setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||||
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
|
import { columns, superQuerySchema } from './NuBizAdvisoryInfo.data';
|
||||||
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './NuBizAdvisoryInfo.api';
|
||||||
|
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||||
|
import NuBizAdvisoryInfoModal from './components/NuBizAdvisoryInfoModal.vue'
|
||||||
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
|
||||||
|
|
||||||
|
const formRef = ref();
|
||||||
|
const queryParam = reactive<any>({});
|
||||||
|
const toggleSearchStatus = ref<boolean>(false);
|
||||||
|
const registerModal = ref();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
//注册table数据
|
||||||
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
|
tableProps: {
|
||||||
|
title: '咨询信息',
|
||||||
|
api: list,
|
||||||
|
columns,
|
||||||
|
canResize:false,
|
||||||
|
useSearchForm: false,
|
||||||
|
showIndexColumn: true,
|
||||||
|
actionColumn: {
|
||||||
|
width: 120,
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
beforeFetch: async (params) => {
|
||||||
|
return Object.assign(params, queryParam);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exportConfig: {
|
||||||
|
name: "咨询信息",
|
||||||
|
url: getExportUrl,
|
||||||
|
params: queryParam,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
const labelCol = reactive({
|
||||||
|
xs:24,
|
||||||
|
sm:4,
|
||||||
|
xl:6,
|
||||||
|
xxl:4
|
||||||
|
});
|
||||||
|
const wrapperCol = reactive({
|
||||||
|
xs: 24,
|
||||||
|
sm: 20,
|
||||||
|
});
|
||||||
|
|
||||||
|
// 高级查询配置
|
||||||
|
const superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高级查询事件
|
||||||
|
*/
|
||||||
|
function handleSuperQuery(params) {
|
||||||
|
Object.keys(params).map((k) => {
|
||||||
|
queryParam[k] = params[k];
|
||||||
|
});
|
||||||
|
searchQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增事件
|
||||||
|
*/
|
||||||
|
function handleAdd() {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.add();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑事件
|
||||||
|
*/
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
function handleDetail(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = true;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除事件
|
||||||
|
*/
|
||||||
|
async function handleDelete(record) {
|
||||||
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除事件
|
||||||
|
*/
|
||||||
|
async function batchHandleDelete() {
|
||||||
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功回调
|
||||||
|
*/
|
||||||
|
function handleSuccess() {
|
||||||
|
(selectedRowKeys.value = []) && reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作栏
|
||||||
|
*/
|
||||||
|
function getTableAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
onClick: handleEdit.bind(null, record),
|
||||||
|
auth: 'NuBizAdvisoryInfo:nu_biz_advisory_info:edit'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉操作栏
|
||||||
|
*/
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '详情',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
}, {
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '是否确认删除',
|
||||||
|
confirm: handleDelete.bind(null, record),
|
||||||
|
placement: 'topLeft',
|
||||||
|
},
|
||||||
|
auth: 'NuBizAdvisoryInfo:nu_biz_advisory_info:delete'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*/
|
||||||
|
function searchQuery() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function searchReset() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
//刷新数据
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.jeecg-basic-table-form-container {
|
||||||
|
padding: 0;
|
||||||
|
.table-page-search-submitButtons {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.query-group-cust{
|
||||||
|
min-width: 100px !important;
|
||||||
|
}
|
||||||
|
.query-group-split-cust{
|
||||||
|
width: 30px;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center
|
||||||
|
}
|
||||||
|
.ant-form-item:not(.ant-form-item-with-help){
|
||||||
|
margin-bottom: 16px;
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
:deep(.ant-picker),:deep(.ant-input-number){
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,176 @@
|
||||||
|
<template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<JFormContainer :disabled="disabled">
|
||||||
|
<template #detail>
|
||||||
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="NuBizAdvisoryInfoForm">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="咨询人姓名" v-bind="validateInfos.name" id="NuBizAdvisoryInfoForm-name" name="name">
|
||||||
|
<a-input v-model:value="formData.name" placeholder="请输入咨询人姓名" allow-clear ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="性别" v-bind="validateInfos.sex" id="NuBizAdvisoryInfoForm-sex" name="sex">
|
||||||
|
<j-dict-select-tag type='radio' v-model:value="formData.sex" dictCode="sex" placeholder="请选择性别" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="联系电话" v-bind="validateInfos.tel" id="NuBizAdvisoryInfoForm-tel" name="tel">
|
||||||
|
<a-input v-model:value="formData.tel" placeholder="请输入联系电话" allow-clear ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="咨询类型 1入住nu 2入驻机构 3我要加盟" v-bind="validateInfos.advisoryType" id="NuBizAdvisoryInfoForm-advisoryType" name="advisoryType">
|
||||||
|
<j-dict-select-tag type='radio' v-model:value="formData.advisoryType" dictCode="advisory_type" placeholder="请选择咨询类型 1入住nu 2入驻机构 3我要加盟" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="状态 1审核中 2审核完成 3驳回" v-bind="validateInfos.status" id="NuBizAdvisoryInfoForm-status" name="status">
|
||||||
|
<j-dict-select-tag type='radio' v-model:value="formData.status" dictCode="advisory_approval" placeholder="请选择状态 1审核中 2审核完成 3驳回" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="审核备注" v-bind="validateInfos.content" id="NuBizAdvisoryInfoForm-content" name="content">
|
||||||
|
<a-textarea v-model:value="formData.content" :rows="4" placeholder="请输入审核备注" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
</JFormContainer>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
import { getValueType } from '/@/utils';
|
||||||
|
import { saveOrUpdate } from '../NuBizAdvisoryInfo.api';
|
||||||
|
import { Form } from 'ant-design-vue';
|
||||||
|
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||||
|
const props = defineProps({
|
||||||
|
formDisabled: { type: Boolean, default: false },
|
||||||
|
formData: { type: Object, default: () => ({})},
|
||||||
|
formBpm: { type: Boolean, default: true }
|
||||||
|
});
|
||||||
|
const formRef = ref();
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const emit = defineEmits(['register', 'ok']);
|
||||||
|
const formData = reactive<Record<string, any>>({
|
||||||
|
id: '',
|
||||||
|
name: '',
|
||||||
|
sex: '',
|
||||||
|
tel: '',
|
||||||
|
advisoryType: '',
|
||||||
|
status: '',
|
||||||
|
content: '',
|
||||||
|
});
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||||
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
|
const confirmLoading = ref<boolean>(false);
|
||||||
|
//表单验证
|
||||||
|
const validatorRules = reactive({
|
||||||
|
});
|
||||||
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
|
|
||||||
|
// 表单禁用
|
||||||
|
const disabled = computed(()=>{
|
||||||
|
if(props.formBpm === true){
|
||||||
|
if(props.formData.disabled === false){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return props.formDisabled;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
edit({});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
nextTick(() => {
|
||||||
|
resetFields();
|
||||||
|
const tmpData = {};
|
||||||
|
Object.keys(formData).forEach((key) => {
|
||||||
|
if(record.hasOwnProperty(key)){
|
||||||
|
tmpData[key] = record[key]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//赋值
|
||||||
|
Object.assign(formData, tmpData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交数据
|
||||||
|
*/
|
||||||
|
async function submitForm() {
|
||||||
|
try {
|
||||||
|
// 触发表单验证
|
||||||
|
await validate();
|
||||||
|
} catch ({ errorFields }) {
|
||||||
|
if (errorFields) {
|
||||||
|
const firstField = errorFields[0];
|
||||||
|
if (firstField) {
|
||||||
|
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Promise.reject(errorFields);
|
||||||
|
}
|
||||||
|
confirmLoading.value = true;
|
||||||
|
const isUpdate = ref<boolean>(false);
|
||||||
|
//时间格式化
|
||||||
|
let model = formData;
|
||||||
|
if (model.id) {
|
||||||
|
isUpdate.value = true;
|
||||||
|
}
|
||||||
|
//循环数据
|
||||||
|
for (let data in model) {
|
||||||
|
//如果该数据是数组并且是字符串类型
|
||||||
|
if (model[data] instanceof Array) {
|
||||||
|
let valueType = getValueType(formRef.value.getProps, data);
|
||||||
|
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||||
|
if (valueType === 'string') {
|
||||||
|
model[data] = model[data].join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await saveOrUpdate(model, isUpdate.value)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
createMessage.success(res.message);
|
||||||
|
emit('ok');
|
||||||
|
} else {
|
||||||
|
createMessage.warning(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
confirmLoading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
submitForm,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.antd-modal-form {
|
||||||
|
padding: 14px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,77 @@
|
||||||
|
<template>
|
||||||
|
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||||
|
<NuBizAdvisoryInfoForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></NuBizAdvisoryInfoForm>
|
||||||
|
</j-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, nextTick, defineExpose } from 'vue';
|
||||||
|
import NuBizAdvisoryInfoForm from './NuBizAdvisoryInfoForm.vue'
|
||||||
|
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||||
|
|
||||||
|
const title = ref<string>('');
|
||||||
|
const width = ref<number>(800);
|
||||||
|
const visible = ref<boolean>(false);
|
||||||
|
const disableSubmit = ref<boolean>(false);
|
||||||
|
const registerForm = ref();
|
||||||
|
const emit = defineEmits(['register', 'success']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
title.value = '新增';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.add();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param record
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.edit(record);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定按钮点击事件
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
registerForm.value.submitForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* form保存回调事件
|
||||||
|
*/
|
||||||
|
function submitCallback() {
|
||||||
|
handleCancel();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消按钮回调事件
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
visible.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
disableSubmit,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
/**隐藏样式-modal确定按钮 */
|
||||||
|
.jee-hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style lang="less" scoped></style>
|
Loading…
Reference in New Issue