Merge branch 'master' of http://47.115.223.229:8888/yangjun/hldy_vue
This commit is contained in:
commit
3dc214bd74
|
@ -5,7 +5,12 @@
|
|||
<p>机构名称:{{formData.sysOrgCodeName}}</p>
|
||||
<p>入住类型:{{formData.advisoryTypeName}}</p>
|
||||
<p>联系电话:{{formData.tel}}</p>
|
||||
<p>审核状态:{{formData.statusName}}</p>
|
||||
<p v-if="formData.oldManName">老人姓名:{{formData.oldManName}}</p>
|
||||
<p v-if="formData.oldManAge">老人年龄:{{formData.oldManAge}}</p>
|
||||
<p v-if="formData.oldManSex">老人性别:{{formData.oldManSexName}}</p>
|
||||
<p v-if="formData.medicalInsuranceType">医保类型:{{formData.medicalInsuranceTypeName}}</p>
|
||||
<p v-if="formData.reimbType">报销类型:{{formData.reimbTypeName}}</p>
|
||||
<p v-if="formData.statusName">审核状态:{{formData.statusName}}</p>
|
||||
<p>
|
||||
<a-button type="primary" @click="handleEdit">修改信息</a-button>
|
||||
<a-button type="primary" style="margin-left: 10px;">办理入住</a-button>
|
||||
|
@ -87,7 +92,8 @@
|
|||
}
|
||||
.advisoryClass{
|
||||
background-image: url(/@/assets/images/advisory.jpg);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-size: cover; /* 确保图片覆盖整个元素 */
|
||||
background-position: center; /* 将图片居中显示 */
|
||||
min-height: 100vh; /* 确保至少为视口高度 */
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -35,6 +35,33 @@
|
|||
<a-input v-model:value="formData.tel" placeholder="请输入联系电话" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<div v-if="formData.advisoryType == '1'">
|
||||
<a-col :span="24">
|
||||
<a-form-item label="老人姓名" v-bind="validateInfos.oldManName" id="NuBizAdvisoryInfoForm-oldManName" name="oldManName">
|
||||
<a-input v-model:value="formData.oldManName" placeholder="请输入老人姓名" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="老人年龄" v-bind="validateInfos.oldManAge" id="NuBizAdvisoryInfoForm-oldManAge" name="oldManAge">
|
||||
<a-input v-model:value="formData.oldManAge" placeholder="请输入老人年龄" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="医保类型" v-bind="validateInfos.medicalInsuranceType" id="NuBizAdvisoryInfoForm-medicalInsuranceType" name="medicalInsuranceType">
|
||||
<j-dict-select-tag type='radio' v-model:value="formData.medicalInsuranceType" dictCode="medical_insurance_type" placeholder="请选择性别" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="老人性别" v-bind="validateInfos.oldManSex" id="NuBizAdvisoryInfoForm-oldManSex" name="oldManSex">
|
||||
<j-dict-select-tag type='radio' v-model:value="formData.oldManSex" dictCode="sex" placeholder="请选择性别" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24">
|
||||
<a-form-item label="报销类型" v-bind="validateInfos.reimbType" id="NuBizAdvisoryInfoForm-reimbType" name="reimbType">
|
||||
<j-dict-select-tag type='radio' v-model:value="formData.reimbType" dictCode="reimb_type" placeholder="请选择性别" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
</div>
|
||||
<a-col :span="24" style="text-align: center;">
|
||||
<a-button type="primary" @click="handleSubmit()">提交</a-button>
|
||||
</a-col>
|
||||
|
@ -139,6 +166,14 @@
|
|||
model.wechatName = wechatName.value;
|
||||
model.status = '1';//强制在提交时把status置为1 审核中
|
||||
console.log('model--->',model);
|
||||
|
||||
if(model.advisoryType == '1'){
|
||||
if(!model.oldManName){
|
||||
|
||||
return createMessage.error("老人姓名不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
const serverUrl = formData.serverUrl;
|
||||
axios.post(serverUrl+"/h5Api/nuBizAdvisoryInfo/edit",model).then(response => {
|
||||
var data = response.data;
|
||||
|
@ -185,7 +220,8 @@
|
|||
}
|
||||
.advisoryClass{
|
||||
background-image: url(/@/assets/images/advisory.jpg);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-size: cover; /* 确保图片覆盖整个元素 */
|
||||
background-position: center; /* 将图片居中显示 */
|
||||
min-height: 100vh; /* 确保至少为视口高度 */
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -35,6 +35,41 @@
|
|||
<a-input v-model:value="formData.tel" placeholder="请输入联系电话" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" v-if="formData.advisoryType == '1'">
|
||||
<a-form-item label="老人姓名" v-bind="validateInfos.oldManName" id="NuBizAdvisoryInfoForm-oldManName" name="oldManName">
|
||||
<a-input v-model:value="formData.oldManName" placeholder="请输入老人姓名" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" v-if="formData.advisoryType == '1'">
|
||||
<a-form-item label="老人年龄" v-bind="validateInfos.oldManAge" id="NuBizAdvisoryInfoForm-oldManAge" name="oldManAge">
|
||||
<a-input v-model:value="formData.oldManAge" placeholder="请输入老人年龄" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" v-if="formData.advisoryType == '1'">
|
||||
<a-form-item label="入住单元" v-bind="validateInfos.nuId" id="NuBizAdvisoryInfoForm-nuId" name="nuId">
|
||||
<a-input-group compact>
|
||||
<a-input v-model:value="formData.nuName" placeholder="选择入住单元" readonly style="width: calc(100% - 65px)" />
|
||||
<a-button type="primary" @click="handleCheckNu">选择</a-button>
|
||||
</a-input-group>
|
||||
<a-input v-model:value="formData.nuId" placeholder="入住单元名称" allow-clear ></a-input>
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" v-if="formData.advisoryType == '1'">
|
||||
<a-form-item label="医保类型" v-bind="validateInfos.medicalInsuranceType" id="NuBizAdvisoryInfoForm-medicalInsuranceType" name="medicalInsuranceType">
|
||||
<j-dict-select-tag type='radio' v-model:value="formData.medicalInsuranceType" dictCode="medical_insurance_type" placeholder="请选择性别" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" v-if="formData.advisoryType == '1'">
|
||||
<a-form-item label="老人性别" v-bind="validateInfos.oldManSex" id="NuBizAdvisoryInfoForm-oldManSex" name="oldManSex">
|
||||
<j-dict-select-tag type='radio' v-model:value="formData.oldManSex" dictCode="sex" placeholder="请选择性别" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
<a-col :span="24" v-if="formData.advisoryType == '1'">
|
||||
<a-form-item label="报销类型" v-bind="validateInfos.reimbType" id="NuBizAdvisoryInfoForm-reimbType" name="reimbType">
|
||||
<j-dict-select-tag type='radio' v-model:value="formData.reimbType" dictCode="reimb_type" placeholder="请选择性别" allow-clear />
|
||||
</a-form-item>
|
||||
</a-col>
|
||||
|
||||
<a-col :span="24" style="text-align: center;">
|
||||
<a-button type="primary" @click="handleSubmit()">提交</a-button>
|
||||
</a-col>
|
||||
|
@ -42,6 +77,7 @@
|
|||
</a-form>
|
||||
</template>
|
||||
</JFormContainer>
|
||||
<CheckNuListModal ref="checkNuListModal" @success="handleCheckNuOk" />
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
|
@ -56,6 +92,9 @@
|
|||
import { useGlobSetting } from "/@/hooks/setting";
|
||||
import { useRouter } from 'vue-router'
|
||||
import axios from 'axios';
|
||||
import CheckNuListModal from '/@/views/biz/NuBizAdvisoryInfo/h5/components/CheckNuListModal.vue';
|
||||
|
||||
|
||||
|
||||
const router = useRouter();
|
||||
const props = defineProps({
|
||||
|
@ -64,6 +103,7 @@
|
|||
formBpm: { type: Boolean, default: true }
|
||||
});
|
||||
const formRef = ref();
|
||||
const checkNuListModal = ref();
|
||||
const useForm = Form.useForm;
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const glob = useGlobSetting()
|
||||
|
@ -73,15 +113,17 @@
|
|||
const formData = reactive<Record<string, any>>({
|
||||
id: '',
|
||||
name: '',
|
||||
sex: '1',
|
||||
sex: '',
|
||||
sysOrgCode: '',
|
||||
tel: '',
|
||||
advisoryType: '1',
|
||||
status: '1',
|
||||
advisoryType: '',
|
||||
status: '',
|
||||
content: '',
|
||||
serverUrl: '',
|
||||
openId: '',
|
||||
wechatName: '',
|
||||
nuId: '',
|
||||
nuName: '',
|
||||
});
|
||||
const { createMessage } = useMessage();
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
|
@ -108,6 +150,26 @@
|
|||
console.log('formData--->',formData);
|
||||
}
|
||||
|
||||
//选择入住单元
|
||||
function handleCheckNu(){
|
||||
var serverUrl = formData.serverUrl;
|
||||
if(!serverUrl){
|
||||
createMessage.error('请先选择入住机构!');
|
||||
return;
|
||||
}
|
||||
checkNuListModal.value.disableSubmit = true;
|
||||
console.log("🚀 ~ handleCheckNu ~ serverUrl:", serverUrl)
|
||||
checkNuListModal.value.edit({serverUrl});
|
||||
}
|
||||
|
||||
//选择入住单元后的回显
|
||||
function handleCheckNuOk(record){
|
||||
console.log("🚀 ~ handleCheckNuOk ~ record:", record)
|
||||
formData.nuId = record.nuId;
|
||||
formData.nuName = record.nuName;
|
||||
|
||||
}
|
||||
|
||||
//提交信息
|
||||
async function handleSubmit() {
|
||||
try {
|
||||
|
@ -139,6 +201,14 @@
|
|||
model.wechatName = wechatName.value;
|
||||
model.status = '1';//强制在提交时把status置为1 审核中
|
||||
console.log('model--->',model);
|
||||
|
||||
if(model.advisoryType == '1'){
|
||||
if(!model.oldManName){
|
||||
|
||||
return createMessage.error("老人姓名不能为空");
|
||||
}
|
||||
}
|
||||
|
||||
const serverUrl = formData.serverUrl;
|
||||
axios.post(serverUrl+"/h5Api/nuBizAdvisoryInfo/add",model).then(response => {
|
||||
var data = response.data;
|
||||
|
@ -188,7 +258,8 @@
|
|||
}
|
||||
.advisoryClass{
|
||||
background-image: url(/@/assets/images/advisory.jpg);
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-size: cover; /* 确保图片覆盖整个元素 */
|
||||
background-position: center; /* 将图片居中显示 */
|
||||
min-height: 100vh; /* 确保至少为视口高度 */
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<template>
|
||||
<div>
|
||||
<div v-for="(item, index) in nulistSource" :key="index" style="padding: 4px">
|
||||
<a-card :title="index+1 +'、'+ item.nuName" style="width: 100%">
|
||||
<template #extra><a @click="handleCheckNu(item)">选择</a></template>
|
||||
</a-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||
import { defHttp } from '/@/utils/http/axios';
|
||||
import axios from 'axios';
|
||||
|
||||
const emit = defineEmits(['register', 'ok']);
|
||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||
const nulistSource = ref([]);
|
||||
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
function add() {
|
||||
edit({});
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
function edit(record) {
|
||||
var serverUrl = record.serverUrl;
|
||||
const getNulistUrl = serverUrl+"/h5Api/nuBaseInfo/list";
|
||||
console.log("🚀 ~ edit ~ getNulistUrl:", getNulistUrl)
|
||||
axios.get(getNulistUrl).then(response => {
|
||||
console.log("🚀 ~ axios.get ~ response:", response)
|
||||
var data = response.data;
|
||||
nulistSource.value = data.result;
|
||||
console.log("🚀 ~ axios.get ~ nulistSource:", nulistSource)
|
||||
}).catch(error => {
|
||||
console.error(error);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交数据
|
||||
*/
|
||||
async function submitForm() {
|
||||
emit('ok',{nuId:'1',nuName:'单元'});
|
||||
}
|
||||
|
||||
function handleCheckNu(record) {
|
||||
console.log("🚀 ~ handleCheckNu ~ record:", record)
|
||||
emit('ok',{nuId:record.id,nuName:record.nuName});
|
||||
}
|
||||
|
||||
|
||||
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="关闭">
|
||||
<CheckNuListForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></CheckNuListForm>
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, nextTick, defineExpose } from 'vue';
|
||||
import CheckNuListForm from './CheckNuListForm.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(record) {
|
||||
handleCancel();
|
||||
emit('success',record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消按钮回调事件
|
||||
*/
|
||||
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>
|
|
@ -61,7 +61,6 @@
|
|||
showFooter.value = data?.showFooter ?? true;
|
||||
setDrawerProps({ confirmLoading: false, showFooter: showFooter.value });
|
||||
isUpdate.value = !!data?.isUpdate;
|
||||
console.log(unref(isUpdate));
|
||||
if (unref(isUpdate)){
|
||||
await getDepartOptions('');
|
||||
}else{
|
||||
|
@ -93,7 +92,6 @@
|
|||
async function getDepartOptions(addFLag){
|
||||
departOptions.value = [];
|
||||
const data = await queryDeparts({ addFLag : addFLag });
|
||||
console.log(data);
|
||||
Object.assign(departOptions.value, data);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ enum Api {
|
|||
testConnection = '/online/cgreport/api/testConnection',
|
||||
deleteBatch = '/sys/dataSource/deleteBatch',
|
||||
departList = '/sys/dataSource/departList',
|
||||
getByCode = '/sys/dataSource/queryBySysOrgCode',
|
||||
// exportXlsUrl = 'sys/dataSource/exportXls',
|
||||
// importExcelUrl = 'sys/dataSource/importExcel',
|
||||
}
|
||||
|
@ -90,3 +91,11 @@ export const batchDeleteDataSource = (params, handleSuccess) => {
|
|||
export const queryDeparts = (params) => {
|
||||
return defHttp.get({ url: Api.departList, params });
|
||||
};
|
||||
|
||||
/**
|
||||
* 查询数据源详情
|
||||
* @param params
|
||||
*/
|
||||
export const getDataSourceByCode = (params) => {
|
||||
return defHttp.get({ url: Api.getByCode, params });
|
||||
};
|
||||
|
|
|
@ -187,7 +187,7 @@ export const formSchema: FormSchema[] = [
|
|||
field: 'dbUrl',
|
||||
label: '数据源地址',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
component: 'InputTextArea',
|
||||
},
|
||||
{
|
||||
field: 'dbUsername',
|
||||
|
@ -208,3 +208,80 @@ export const formSchema: FormSchema[] = [
|
|||
component: 'InputTextArea',
|
||||
},
|
||||
];
|
||||
|
||||
// 数据源基础表单
|
||||
export function useDataSourceFormSchema() {
|
||||
const dataSourceFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'id',
|
||||
label: 'id',
|
||||
component: 'Input',
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
field: 'sysOrgCode',
|
||||
label: '所属机构',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
show: false,
|
||||
},
|
||||
{
|
||||
field: 'code',
|
||||
label: '数据源编码',
|
||||
component: 'Input',
|
||||
// required: true,
|
||||
dynamicDisabled: true
|
||||
},
|
||||
{
|
||||
field: 'name',
|
||||
label: '数据源名称',
|
||||
component: 'Input',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
field: 'dbType',
|
||||
label: '数据库类型',
|
||||
component: 'JDictSelectTag',
|
||||
required: true,
|
||||
componentProps: ({ formModel }) => {
|
||||
return {
|
||||
dictCode: 'database_type',
|
||||
onChange: (e: any) => {
|
||||
formModel = Object.assign(formModel, dbDriverMap[e], dbUrlMap[e]);
|
||||
},
|
||||
};
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'dbDriver',
|
||||
label: '驱动类',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'dbUrl',
|
||||
label: '数据源地址',
|
||||
required: true,
|
||||
component: 'InputTextArea',
|
||||
},
|
||||
{
|
||||
field: 'dbUsername',
|
||||
label: '用户名',
|
||||
required: true,
|
||||
component: 'Input',
|
||||
},
|
||||
{
|
||||
field: 'dbPassword',
|
||||
label: '密码',
|
||||
required: true,
|
||||
component: 'InputPassword',
|
||||
slot: 'pwd',
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
label: '备注',
|
||||
component: 'InputTextArea',
|
||||
},
|
||||
];
|
||||
return { dataSourceFormSchema };
|
||||
}
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
<template>
|
||||
<a-spin :spinning="loading">
|
||||
<BasicForm @register="registerForm">
|
||||
<template #pwd="{ model, field }">
|
||||
<a-row :gutter="8">
|
||||
<a-col :sm="15" :md="16" :lg="17" :xl="19">
|
||||
<a-input-password v-model:value="model[field]" placeholder="请输入密码" />
|
||||
</a-col>
|
||||
<a-col :sm="9" :md="7" :lg="7" :xl="5">
|
||||
<a-button type="primary" style="width: 100%" @click="handleTest">测试</a-button>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</template>
|
||||
</BasicForm>
|
||||
<div class="j-box-bottom-button offset-20" style="margin-top: 30px">
|
||||
<div class="j-box-bottom-button-float" :class="[`${prefixCls}`]">
|
||||
<a-button preIcon="ant-design:sync-outlined" @click="onReset">重置</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:save-filled" @click="onSubmit">保存</a-button>
|
||||
</div>
|
||||
</div>
|
||||
</a-spin>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch, computed, inject, ref, unref, onMounted } from 'vue';
|
||||
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||
import {
|
||||
getDataSourceByCode,
|
||||
saveOrUpdateDataSource,
|
||||
testConnection
|
||||
} from '/@/views/monitor/datasource/datasource.api';
|
||||
import { useDataSourceFormSchema } from '/@/views/monitor/datasource/datasource.data';
|
||||
import { useDesign } from '/@/hooks/web/useDesign';
|
||||
import { useMessage } from "@/hooks/web/useMessage";
|
||||
const { createMessage } = useMessage();
|
||||
|
||||
const { prefixCls } = useDesign('j-depart-form-content');
|
||||
|
||||
const emit = defineEmits(['success']);
|
||||
const props = defineProps({
|
||||
data: { type: Object, default: () => ({}) },
|
||||
rootTreeData: { type: Array, default: () => [] },
|
||||
});
|
||||
const loading = ref<boolean>(false);
|
||||
// 当前是否是更新模式
|
||||
const isUpdate = ref<boolean>(true);
|
||||
// 当前的弹窗数据
|
||||
const model = ref<object>({});
|
||||
|
||||
//注册表单
|
||||
const [registerForm, { resetFields, setFieldsValue, validateFields, getFieldsValue, validate, updateSchema }] = useForm({
|
||||
schemas: useDataSourceFormSchema().dataSourceFormSchema,
|
||||
showActionButtonGroup: false,
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
// data 变化,重填表单
|
||||
watch(
|
||||
() => props.data,
|
||||
async () => {
|
||||
let record = unref(props.data);
|
||||
if (typeof record !== 'object') {
|
||||
record = {};
|
||||
}
|
||||
model.value = record;
|
||||
await resetFields();
|
||||
//获取数据源信息
|
||||
let data = await getDataSourceByCode({ sysOrgCode : model.value.orgCode });
|
||||
if(data == null){
|
||||
data = {};
|
||||
data.code = record.orgCode;
|
||||
data.sysOrgCode = record.orgCode;
|
||||
isUpdate.value = false;
|
||||
}
|
||||
await setFieldsValue({ ...data });
|
||||
},
|
||||
{ deep: true, immediate: true }
|
||||
);
|
||||
});
|
||||
|
||||
// 重置表单
|
||||
async function onReset() {
|
||||
await resetFields();
|
||||
await setFieldsValue({ ...model.value });
|
||||
}
|
||||
|
||||
async function handleTest() {
|
||||
let keys = ['dbType', 'dbDriver', 'dbUrl', 'dbName', 'dbUsername', 'dbPassword'];
|
||||
// 获取以上字段的值,并清除校验状态
|
||||
let fieldsValues = getFieldsValue(keys);
|
||||
let setFields = {};
|
||||
keys.forEach((key) => (setFields[key] = { value: fieldsValues[key], errors: null }));
|
||||
await validateFields(keys).then((values) => {
|
||||
let loading = createMessage.loading('连接中....', 0);
|
||||
testConnection(values)
|
||||
.then((data) => {
|
||||
if (data.success) {
|
||||
createMessage.success('连接成功');
|
||||
}
|
||||
})
|
||||
.catch((error) => {})
|
||||
.finally(() => loading());
|
||||
});
|
||||
}
|
||||
|
||||
// 提交事件
|
||||
async function onSubmit() {
|
||||
try {
|
||||
loading.value = true;
|
||||
let values = await validate();
|
||||
values = Object.assign({}, model.value, values);
|
||||
console.log(isUpdate.value);
|
||||
//提交表单
|
||||
await saveOrUpdateDataSource(values, isUpdate.value);
|
||||
//刷新列表
|
||||
emit('success');
|
||||
Object.assign(model.value, values);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less">
|
||||
// update-begin-author:liusq date:20230625 for: [issues/563]暗色主题部分失效
|
||||
|
||||
@prefix-cls: ~'@{namespace}-j-depart-form-content';
|
||||
/*begin 兼容暗夜模式*/
|
||||
.@{prefix-cls} {
|
||||
background: @component-background;
|
||||
border-top: 1px solid @border-color-base;
|
||||
}
|
||||
/*end 兼容暗夜模式*/
|
||||
// update-end-author:liusq date:20230625 for: [issues/563]暗色主题部分失效
|
||||
</style>
|
|
@ -1,12 +1,12 @@
|
|||
<template>
|
||||
<a-card :bordered="false" style="height: 100%">
|
||||
<div class="j-table-operator" style="width: 100%">
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="onAddDepart">新增</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="onAddChildDepart()">添加下级</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :customRequest="onImportXls">
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="onAddDepart">新增机构</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:plus-outlined" @click="onAddChildDepart()">新增区域</a-button>
|
||||
<!-- <a-upload name="file" :showUploadList="false" :customRequest="onImportXls">
|
||||
<a-button type="primary" preIcon="ant-design:import-outlined">导入</a-button>
|
||||
</a-upload>
|
||||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls">导出</a-button>
|
||||
<a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls">导出</a-button>-->
|
||||
<template v-if="checkedKeys.length > 0">
|
||||
<a-dropdown>
|
||||
<template #overlay>
|
||||
|
@ -37,7 +37,7 @@
|
|||
</template>
|
||||
</a-alert>
|
||||
<a-spin :spinning="loading">
|
||||
<a-input-search placeholder="按部门名称搜索…" style="margin-bottom: 10px" @search="onSearch" />
|
||||
<a-input-search placeholder="按机构名称搜索…" style="margin-bottom: 10px" @search="onSearch" />
|
||||
<!--组织机构树-->
|
||||
<template v-if="treeData.length > 0">
|
||||
<a-tree
|
||||
|
@ -69,7 +69,7 @@
|
|||
|
||||
<template #overlay>
|
||||
<a-menu @click="">
|
||||
<a-menu-item key="1" @click="onAddChildDepart(dataRef)">添加子级</a-menu-item>
|
||||
<a-menu-item key="1" @click="onAddChildDepart(dataRef)">添加区域</a-menu-item>
|
||||
<a-menu-item key="2" @click="visibleTreeKey = treeKey">
|
||||
<span style="color: red">删除</span>
|
||||
</a-menu-item>
|
||||
|
@ -226,7 +226,7 @@
|
|||
// 添加子级部门
|
||||
function onAddChildDepart(data = currentDepart.value) {
|
||||
if (data == null) {
|
||||
createMessage.warning('请先选择一个部门');
|
||||
createMessage.warning('请先选择一个机构');
|
||||
return;
|
||||
}
|
||||
const record = { parentId: data.id };
|
||||
|
|
|
@ -5,7 +5,7 @@ export function useBasicFormSchema() {
|
|||
const basicFormSchema: FormSchema[] = [
|
||||
{
|
||||
field: 'departName',
|
||||
label: '机构名称',
|
||||
label: '名称',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入机构/部门名称',
|
||||
|
@ -14,7 +14,7 @@ export function useBasicFormSchema() {
|
|||
},
|
||||
{
|
||||
field: 'parentId',
|
||||
label: '上级部门',
|
||||
label: '上级',
|
||||
component: 'TreeSelect',
|
||||
componentProps: {
|
||||
treeData: [],
|
||||
|
@ -24,7 +24,7 @@ export function useBasicFormSchema() {
|
|||
},
|
||||
{
|
||||
field: 'orgCode',
|
||||
label: '机构编码',
|
||||
label: '编码',
|
||||
component: 'Input',
|
||||
componentProps: {
|
||||
placeholder: '请输入机构编码',
|
||||
|
@ -32,7 +32,7 @@ export function useBasicFormSchema() {
|
|||
},
|
||||
{
|
||||
field: 'orgCategory',
|
||||
label: '机构类型',
|
||||
label: '类型',
|
||||
component: 'RadioButtonGroup',
|
||||
componentProps: { options: [] },
|
||||
},
|
||||
|
@ -42,6 +42,50 @@ export function useBasicFormSchema() {
|
|||
component: 'InputNumber',
|
||||
componentProps: {},
|
||||
},
|
||||
{
|
||||
field: 'operationStartTime',
|
||||
label: '运营开始时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'operationEndTime',
|
||||
label: '运营到期时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'contractStartTime',
|
||||
label: '合同开始时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'contractEndTime',
|
||||
label: '合同到期时间',
|
||||
component: 'DatePicker',
|
||||
componentProps: {
|
||||
valueFormat: 'YYYY-MM-DD',
|
||||
style: {
|
||||
width: '100%',
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
field: 'mobile',
|
||||
label: '电话',
|
||||
|
@ -81,10 +125,9 @@ export function useBasicFormSchema() {
|
|||
// 机构类型选项
|
||||
export const orgCategoryOptions = {
|
||||
// 一级部门
|
||||
root: [{ value: '1', label: '公司' }],
|
||||
root: [{ value: '1', label: '机构' }],
|
||||
// 子级部门
|
||||
child: [
|
||||
{ value: '2', label: '部门' },
|
||||
{ value: '3', label: '岗位' },
|
||||
{ value: '2', label: '区域' },
|
||||
],
|
||||
};
|
||||
|
|
|
@ -11,14 +11,19 @@
|
|||
<DepartFormTab :data="departData" :rootTreeData="rootTreeData" @success="onSuccess" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane tab="部门权限" key="role-info">
|
||||
<a-tab-pane tab="机构权限" key="role-info">
|
||||
<div style="padding: 0 20px 20px">
|
||||
<DepartRuleTab :data="departData" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
<a-tab-pane tab="数据源管理" key="data-info" v-if="departData.orgCategory == 1">
|
||||
<div style="padding: 0 20px 20px">
|
||||
<DataSourceTab :data="departData" />
|
||||
</div>
|
||||
</a-tab-pane>
|
||||
</a-tabs>
|
||||
<div v-show="departData == null" style="padding-top: 40px">
|
||||
<a-empty description="尚未选择部门" />
|
||||
<a-empty description="尚未选择机构" />
|
||||
</div>
|
||||
</div>
|
||||
</a-col>
|
||||
|
@ -31,6 +36,7 @@
|
|||
import DepartLeftTree from './components/DepartLeftTree.vue';
|
||||
import DepartFormTab from './components/DepartFormTab.vue';
|
||||
import DepartRuleTab from './components/DepartRuleTab.vue';
|
||||
import DataSourceTab from './components/DataSourceTab.vue';
|
||||
|
||||
const { prefixCls } = useDesign('depart-manage');
|
||||
provide('prefixCls', prefixCls);
|
||||
|
|
Loading…
Reference in New Issue