|
@@ -175,6 +175,7 @@ import { ElMessage } from 'element-plus'
|
|
|
import { formatDate } from '../../../utils/date'
|
|
|
import type { FormInstance, FormRules } from 'element-plus'
|
|
|
import { selectReportDictTree, selectReportDict, selectReportType, reportSqlExecute, selectReportLevel, saveReportBaseInfo, selectReportLevelDict } from '../../../api/target-management/report-dict'
|
|
|
+import { selectReportInfoData } from '../../../api/reports/high-report'
|
|
|
import ReportLevel from '../target-comm/ReportLevel.vue'
|
|
|
import ReportDetails from '../target-comm/ReportDetails.vue'
|
|
|
import { queryDept } from '../../../api/public-api'
|
|
@@ -184,7 +185,7 @@ const reportTreeData = ref({
|
|
|
data: [{}],
|
|
|
height: 900,
|
|
|
})
|
|
|
-
|
|
|
+const isAddSave = ref(true)
|
|
|
const isShowTree = ref(false)
|
|
|
// 是否开启Form表单编辑
|
|
|
const isDisabledForm = ref(false)
|
|
@@ -200,6 +201,22 @@ const reportTypeList = ref([
|
|
|
reportLabel: ''
|
|
|
}
|
|
|
])
|
|
|
+const reportData = ref({
|
|
|
+ reportId: '', // 报表id
|
|
|
+ reportName: '', // 报表名称
|
|
|
+ reportType: '', // 报表类型
|
|
|
+ unit: '', // 单位
|
|
|
+ level: '', // 报表分组类型
|
|
|
+ gatherSql: '', // 聚合sql
|
|
|
+ baseSql: '', // 基础sql
|
|
|
+ displayType: '', // 展示类型
|
|
|
+ menuId: '', // 菜单id
|
|
|
+ sort: '', // 面板排序
|
|
|
+ reportSort: '', // 报表统计排序
|
|
|
+ isCw: 'N', // 是否财务报表大屏显示指标(Y: 是)
|
|
|
+ isYj: 'N', // 是否医技报表大屏显示指标(Y: 是)
|
|
|
+ flag: 'Y', // 是否有效
|
|
|
+})
|
|
|
|
|
|
const levelList = ref([
|
|
|
{
|
|
@@ -367,6 +384,8 @@ const addForm = (formEl: FormInstance | undefined) => {
|
|
|
reportForm.value = {} as any
|
|
|
ruleFormRef.value?.resetFields()
|
|
|
sqlForm.calcResult = ''
|
|
|
+ reportForm.value.flag = 'Y'
|
|
|
+ isAddSave.value = true
|
|
|
|
|
|
}
|
|
|
|
|
@@ -378,6 +397,10 @@ const editForm = (formEl: FormInstance | undefined) => {
|
|
|
isDisabledForm.value = false
|
|
|
}
|
|
|
|
|
|
+ if (isAddSave.value) {
|
|
|
+ isAddSave.value = false
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
// ---------- 保存报表 ------------
|
|
@@ -394,6 +417,28 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ // 新增指标验证指标id是否已存在
|
|
|
+ let badFlag = false
|
|
|
+ if (isAddSave.value) {
|
|
|
+ await selectReportInfoData(reportForm.value).then((res: any) => {
|
|
|
+ reportData.value = res
|
|
|
+ if (reportData.value) {
|
|
|
+ badFlag = true
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "已有指标报表: " + reportData.value.reportName + ",请确认!",
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ if (badFlag) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
await formEl.validate((valid, fields) => {
|
|
|
if (valid) {
|
|
|
if (reportForm.value.gatherSql == '' || reportForm.value.baseSql == '' || reportForm.value.reportName == '') {
|