Commit c4a92d7d authored by 刘春's avatar 刘春
parents 7c8db0ac 8784ce1d
...@@ -22,3 +22,11 @@ export const getDictDetailDataRequest = (data: DictionaryDetailParams) => ...@@ -22,3 +22,11 @@ export const getDictDetailDataRequest = (data: DictionaryDetailParams) =>
export const getDictsDataByCodeArrary = (data: string[]) => export const getDictsDataByCodeArrary = (data: string[]) =>
request<DictCodeDataItem[]>('/portal/public/api/web/getDict', 'post', data); request<DictCodeDataItem[]>('/portal/public/api/web/getDict', 'post', data);
/**
* 根据类型获取字典项
* @param data
* @returns
*/
export const getClassify = (data) =>
request<string>('/bi-manager/dict/getClassify', 'post', data);
\ No newline at end of file
...@@ -17,14 +17,15 @@ export async function uploadFile( ...@@ -17,14 +17,15 @@ export async function uploadFile(
const formData = new FormData(); const formData = new FormData();
formData.append('file', file, fileName); formData.append('file', file, fileName);
const res = await request<ApiResult<FileRecord>>( const res = await request<ApiResult<FileRecord>>(
'/file/upload', '/bi-manager/uploadFile/upload',
'POST', 'POST',
config formData
); );
if (res.data.code === 0 && res.data.data) { console.log("🚀 ~ res:", res)
return res.data.data; if (res.code === 200 && res.data) {
return res.data;
} }
return Promise.reject(new Error(res.data.message)); return Promise.reject(new Error(res.message));
} }
/** /**
......
...@@ -167,7 +167,7 @@ ...@@ -167,7 +167,7 @@
.then((res) => { .then((res) => {
item.progress = 100; item.progress = 100;
item.status = 'done'; item.status = 'done';
item.url = res.url; item.url = res.imgUrl;
}) })
.catch((e) => { .catch((e) => {
item.status = 'exception'; item.status = 'exception';
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<ElRow v-else v-bind="rowProps || {}"> <ElRow v-else v-bind="rowProps || {}">
<template v-for="item in items"> <template v-for="item in items">
<ElCol <ElCol
v-if="isShowItem(item, model, formItems || items, searchExpand)" v-if="isShowItem(item, model, formItems || items, searchExpand) && !item.isHide"
:key="item.key ?? item.prop" :key="item.key ?? item.prop"
v-bind="{ v-bind="{
...(grid === true ? { span: 12 } : grid), ...(grid === true ? { span: 12 } : grid),
......
...@@ -1135,6 +1135,7 @@ ...@@ -1135,6 +1135,7 @@
<ImageUpload <ImageUpload
v-else-if="item.type === 'imageUpload'" v-else-if="item.type === 'imageUpload'"
v-bind="item.props || {}" v-bind="item.props || {}"
:limit="item?.limit || 9"
ref="imageUploadRef" ref="imageUploadRef"
:modelValue="model[item.prop]" :modelValue="model[item.prop]"
@update:modelValue="updateValue" @update:modelValue="updateValue"
......
...@@ -11,6 +11,7 @@ declare module 'vue' { ...@@ -11,6 +11,7 @@ declare module 'vue' {
AddExpert: typeof import('./../components/TaskAllocation/AddExpert.vue')['default'] AddExpert: typeof import('./../components/TaskAllocation/AddExpert.vue')['default']
AddMenu: typeof import('./../views/web/components/AddMenu.vue')['default'] AddMenu: typeof import('./../views/web/components/AddMenu.vue')['default']
AddReport: typeof import('./../views/report/components/AddReport.vue')['default'] AddReport: typeof import('./../views/report/components/AddReport.vue')['default']
AddReportDetail: typeof import('./../views/report/components/AddReportDetail.vue')['default']
AddRole: typeof import('./../views/role/components/AddRole.vue')['default'] AddRole: typeof import('./../views/role/components/AddRole.vue')['default']
AddSys: typeof import('./../views/report/components/AddSys.vue')['default'] AddSys: typeof import('./../views/report/components/AddSys.vue')['default']
AddTheme: typeof import('./../views/theme/components/AddTheme.vue')['default'] AddTheme: typeof import('./../views/theme/components/AddTheme.vue')['default']
......
<template> <template>
<ele-modal <ele-modal
v-if="modalVisible"
v-model="modalVisible" v-model="modalVisible"
:title="modalTitle" :title="modalTitle"
width="600px" width="600px"
position="center" position="center"
:close-on-click-modal="false"
@close="handleClose"
> >
<ele-loading :loading="pageLoading"> <ele-loading :loading="pageLoading">
<ele-card> <ele-card>
...@@ -19,7 +22,7 @@ ...@@ -19,7 +22,7 @@
</ele-card> </ele-card>
</ele-loading> </ele-loading>
<template #footer> <template #footer>
<el-button type="primary" plain @click="handleCancel">取消</el-button> <el-button type="primary" plain @click="handleClose">取消</el-button>
<el-button type="primary" @click="onSubmit">确定</el-button> <el-button type="primary" @click="onSubmit">确定</el-button>
</template> </template>
</ele-modal> </ele-modal>
...@@ -50,13 +53,26 @@ ...@@ -50,13 +53,26 @@
const open = (type: 'add' | 'edit' = 'add', info?: addUserDto) => { const open = (type: 'add' | 'edit' = 'add', info?: addUserDto) => {
useType.value = type; useType.value = type;
modalVisible.value = true; modalVisible.value = true;
const passwordItem = items.value.find(
(item) => item.prop === 'userPassword'
);
if (type === 'edit') { if (type === 'edit') {
curInfo.value = info; curInfo.value = info;
Object.assign(form, info); Object.assign(form, info);
if ('jurisdictionCode' in info!) {
form.jurisdictionCode = (info.jurisdictionCode as string)!.split(','); if (info.jurisdictionCode) {
form.jurisdictionCode = info.jurisdictionCode.split(',');
} }
console.log(info, form, '表单数据');
// if ('jurisdictionCode' in info!) {
// form.jurisdictionCode = (info.jurisdictionCode as string)!.split(',');
// }
passwordItem.isHide = true;
} else {
passwordItem.isHide = false;
} }
}; };
defineExpose({ defineExpose({
...@@ -112,10 +128,17 @@ ...@@ -112,10 +128,17 @@
{ label: '科室编码', prop: 'deptCode', type: 'input', required: true }, { label: '科室编码', prop: 'deptCode', type: 'input', required: true },
{ {
label: '用户密码', label: '用户密码',
<<<<<<< HEAD
vIf: useType.value === 'add', vIf: useType.value === 'add',
prop: 'userPassword', prop: 'userPassword',
type: 'input', type: 'input',
required: true required: true
=======
prop: 'userPassword',
type: 'input',
required: true,
isHide: false
>>>>>>> 8784ce1dfad9c9c2e8d810ac337eda4130deb7f9
}, },
{ label: '微信id', prop: 'wxId', type: 'input', required: false }, { label: '微信id', prop: 'wxId', type: 'input', required: false },
{ {
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
:title="modalTitle" :title="modalTitle"
width="600px" width="600px"
position="center" position="center"
:close-on-click-modal="false"
@close="handleClose"
> >
<ele-loading :loading="pageLoading"> <ele-loading :loading="pageLoading">
<ele-card> <ele-card>
...@@ -19,7 +21,7 @@ ...@@ -19,7 +21,7 @@
</ele-card> </ele-card>
</ele-loading> </ele-loading>
<template #footer> <template #footer>
<el-button type="primary" plain @click="handleCancel">取消</el-button> <el-button type="primary" plain @click="handleClose">取消</el-button>
<el-button type="primary" @click="onSubmit">确定</el-button> <el-button type="primary" @click="onSubmit">确定</el-button>
</template> </template>
</ele-modal> </ele-modal>
...@@ -36,6 +38,8 @@ ...@@ -36,6 +38,8 @@
import { EleMessage } from 'ele-admin-plus'; import { EleMessage } from 'ele-admin-plus';
// apis // apis
import reportApi from '@/api/reportApi'; import reportApi from '@/api/reportApi';
import sysApi from '@/api/sysApi';
import { getClassify } from '@/api/common/dictionary';
const props = defineProps<{ const props = defineProps<{
curSelectSys: any; curSelectSys: any;
...@@ -48,17 +52,24 @@ ...@@ -48,17 +52,24 @@
return useType.value === 'add' ? '添加报表' : '编辑报表'; return useType.value === 'add' ? '添加报表' : '编辑报表';
}); });
onMounted(() => {
getClassifyList(); // 获取报表分类
});
// 打开 // 打开
const curInfo = ref<addReportDto>(); const curInfo = ref<addReportDto>();
const open = (type: 'add' | 'edit' = 'add', info?: addReportDto) => { const open = (type: 'add' | 'edit' = 'add', info?: addReportDto) => {
useType.value = type; useType.value = type;
modalVisible.value = true; modalVisible.value = true;
getSysList(); // 获取系统列表
if (type === 'edit') { if (type === 'edit') {
curInfo.value = info; curInfo.value = info;
Object.assign(form, info); Object.assign(form, info);
} form.reportCategory = info.dictDataValue.split(',');
console.log(props.curSelectSys); } else {
form.sysId = [props.curSelectSys.sysId]; form.sysId = [props.curSelectSys.sysId];
}
}; };
defineExpose({ defineExpose({
open: open as (type: 'add' | 'edit', info?: addReportDto) => void open: open as (type: 'add' | 'edit', info?: addReportDto) => void
...@@ -69,17 +80,70 @@ ...@@ -69,17 +80,70 @@
reportStyleUrl: '', reportStyleUrl: '',
reportName: '', reportName: '',
reportCategory: [], reportCategory: [],
sysId: [], reportType: 1,
reportType: 1 sysId: [] // 系统id
});
const sysList = ref([]); // 系统列表
/** 获取系统列表 */
const getSysList = async () => {
let params = {
pageNum: 1,
pageSize: 99999
};
const [error, ret] = await tryit(sysApi.getSysList)(params);
if (error) {
console.error(error);
return;
}
if (ret.code === 200) {
sysList.value = ret.data.list.map((item) => {
return {
label: item.sysName,
value: item.sysId
};
}); });
}
};
const classifyList = ref([]); // 报表类型
// 获取报表分类
const getClassifyList = async () => {
let params = {
typeId: 'MEDICAL_ROLE'
};
const [error, ret] = await tryit(getClassify)(params);
if (error) {
console.error(error);
return;
}
if (ret.code === 200) {
classifyList.value = ret.data.map((item) => {
return {
label: item.dataLabel,
value: item.dataValue
};
});
}
};
/** 表单项 */ /** 表单项 */
const items = computed<Array<ProFormItemProps>>(() => [ const items = computed<Array<ProFormItemProps>>(() => [
{
label: '所属系统',
prop: 'sysId',
type: 'multipleSelect',
options: sysList.value,
required: true
},
{ label: '报表名称', prop: 'reportName', type: 'input', required: true }, { label: '报表名称', prop: 'reportName', type: 'input', required: true },
{ {
label: '报表样式图片地址', label: '报表分类',
prop: 'reportStyleUrl', prop: 'reportCategory',
type: 'input', type: 'multipleSelect',
multiple: true,
options: classifyList.value,
required: true required: true
}, },
{ {
...@@ -99,12 +163,12 @@ ...@@ -99,12 +163,12 @@
required: true required: true
}, },
{ {
label: '报表分类', label: '报表样式图片地址',
prop: ' reportCategory', prop: 'reportStyleUrl',
type: 'select', // type: 'input',
multiple: true, type: 'imageUpload',
options: [], limit: 1,
required: false required: true
} }
]); ]);
......
<template>
<ele-modal
v-model="modalVisible"
:title="modalTitle"
width="600px"
position="center"
:close-on-click-modal="false"
@close="handleClose"
>
<ele-loading :loading="pageLoading">
<ele-card>
<pro-form
ref="ProFormRef"
label-width="auto"
:model="form"
:items="items"
:footer="false"
:grid="{ span: 24 }"
@updateValue="setFieldValue"
/>
</ele-card>
</ele-loading>
<template #footer>
<el-button type="primary" plain @click="handleClose">取消</el-button>
<el-button type="primary" @click="onSubmit">确定</el-button>
</template>
</ele-modal>
</template>
<script lang="ts" setup>
// tools
import { useFormData } from '@/utils/use-form-data';
import { tryit } from 'radash';
// types
import type { addReportDetailDto } from '@/types/BiReport';
import type { ProFormItemProps } from '@/components/ProForm/types';
import type { FormInstance } from 'element-plus';
import { EleMessage } from 'ele-admin-plus';
// apis
import reportApi from '@/api/reportApi';
const props = defineProps<{
curSelectReport: any;
}>();
const useType = ref<'add' | 'edit'>('add');
const modalVisible = ref(false);
const modalTitle = computed(() => {
return useType.value === 'add' ? '添加详情' : '编辑详情';
});
// 打开
const curInfo = ref<addReportDetailDto>();
const open = (type: 'add' | 'edit' = 'add', info?: addReportDetailDto) => {
useType.value = type;
modalVisible.value = true;
if (type === 'edit') {
curInfo.value = info;
Object.assign(form, info);
} else {
form.reportId = props.curSelectReport.reportId;
}
};
defineExpose({
open: open as (type: 'add' | 'edit', info?: addReportDetailDto) => void
});
/** 表单数据 */
const [form, resetFields, , setFieldValue] = useFormData<addReportDetailDto>({
calculationFormula: '', // 计算公式
fieldName: '', // 字段名称
remark: '', // 备注信息
reportId: '' // 绑定报表id
// detailId: '' //
});
/** 表单项 */
const items = computed<Array<ProFormItemProps>>(() => [
{
label: '字段名',
prop: 'fieldName',
type: 'input',
required: true
},
{
label: '公式',
prop: 'calculationFormula',
type: 'input',
required: true
},
{
label: '备注',
prop: 'remark',
type: 'textarea'
}
]);
/** 提交 */
const ProFormRef = ref<FormInstance>();
const pageLoading = ref(false);
const emits = defineEmits(['reload']);
const onSubmit = () => {
ProFormRef.value?.validate(async (valid) => {
if (!valid) {
EleMessage.warning('请填写必填项');
return;
}
ElMessageBox.confirm(
`确定要${useType.value === 'add' ? '保存' : '修改'}?`,
'提示',
{
type: 'warning'
}
).then(async () => {
pageLoading.value = true;
const apiObj = {
add: reportApi.addReportDetail,
edit: reportApi.editReportDetail
};
const [, ret] = await tryit(apiObj[useType.value!])(form);
if (ret?.code === 200) {
EleMessage.success(useType.value === 'add' ? '添加成功' : '修改成功');
emits('reload');
handleClose();
}
pageLoading.value = false;
});
});
};
// 关闭
const handleClose = () => {
modalVisible.value = false;
resetFields();
};
// 点击取消
const handleCancel = () => {
modalVisible.value = false;
};
</script>
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
:title="modalTitle" :title="modalTitle"
width="600px" width="600px"
position="center" position="center"
:close-on-click-modal="false"
@close="handleClose"
> >
<ele-loading :loading="pageLoading"> <ele-loading :loading="pageLoading">
<ele-card> <ele-card>
...@@ -19,7 +21,7 @@ ...@@ -19,7 +21,7 @@
</ele-card> </ele-card>
</ele-loading> </ele-loading>
<template #footer> <template #footer>
<el-button type="primary" plain @click="handleCancel">取消</el-button> <el-button type="primary" plain @click="handleClose">取消</el-button>
<el-button type="primary" @click="onSubmit">确定</el-button> <el-button type="primary" @click="onSubmit">确定</el-button>
</template> </template>
</ele-modal> </ele-modal>
......
This diff is collapsed.
...@@ -16,6 +16,16 @@ ...@@ -16,6 +16,16 @@
</el-button> </el-button>
</div> </div>
</template> </template>
<!-- 操作列 -->
<template #action="{ row }">
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
<el-button
type="text"
style="color: #ff1616"
@click="handleDelete(row)"
>删除</el-button
>
</template>
</vxe-grid> </vxe-grid>
</div> </div>
<div class="wrapper-right"> <div class="wrapper-right">
...@@ -108,6 +118,13 @@ ...@@ -108,6 +118,13 @@
{ {
field: 'roleNames', field: 'roleNames',
title: '关联角色' title: '关联角色'
},
{
field: 'action',
title: '操作',
fixed: 'right',
width: 100,
slots: { default: 'action' }
} }
], ],
toolbarConfig: { toolbarConfig: {
...@@ -208,6 +225,31 @@ ...@@ -208,6 +225,31 @@
} }
}; };
// 编辑主题
const handleEdit = async (row) => {
AddThemeRef.value.open('edit', row); // 传递菜单信息
}
// 删除主题
const handleDelete = async (row) => {
ElMessageBox.confirm(`确定要删除此主题吗?`, '提示', {
type: 'warning'
}).then(async (res) => {
let params = {
themeId: row.themeId
};
const [err, ret] = await tryit(themeApi.delTheme)(params);
if (err) {
console.error(err);
return;
}
if (ret?.code === 200) {
EleMessage.success('删除成功');
fetchTheme(); // 重新获取菜单列表
}
});
};
// 移动端保存配置 // 移动端保存配置
const handleSaveByMobile = async () => { const handleSaveByMobile = async () => {
console.log(mobileTreeRef.value.getCheckedKeys(true)); console.log(mobileTreeRef.value.getCheckedKeys(true));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment