|
@@ -0,0 +1,258 @@
|
|
|
+<template>
|
|
|
+ <el-row :gutter="5">
|
|
|
+ <el-col :span="6">
|
|
|
+ <ReportTree v-if="isShowTree" :reportTreeData="reportTreeData" @treeNodeClick="treeNodeClick" />
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="18">
|
|
|
+ <PageLayer>
|
|
|
+ <template #header class="hd-cl">
|
|
|
+ <el-button type="primary" icon="Plus" @click="addForm(ruleFormRef)"
|
|
|
+ style="margin-left: 10px">新增</el-button>
|
|
|
+ <el-button type="primary" icon="Edit" @click="editForm(ruleFormRef)"
|
|
|
+ style="margin-left: 10px">编辑</el-button>
|
|
|
+ <el-button type="primary" icon="Check" @click="submitForm(ruleFormRef)"
|
|
|
+ style="margin-left: 10px">保存</el-button>
|
|
|
+ <el-button type="primary" icon="Refresh" @click="resetForm(ruleFormRef)"
|
|
|
+ style="margin-left: 10px">重置</el-button>
|
|
|
+ </template>
|
|
|
+ <template #main>
|
|
|
+ <el-form ref="ruleFormRef" :model="reportForm" :rules="rules" label-width="120px" class="demo-ruleForm"
|
|
|
+ :size="formSize" status-icon :disabled="isShowForm">
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="报表名称" prop="reportName">
|
|
|
+ <el-input v-model="reportForm.reportName" minlength="1" maxlength="256"
|
|
|
+ show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="报表编码" prop="reportId">
|
|
|
+ <el-input v-model="reportForm.reportId" minlength="1" maxlength="12" show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="报表类型" prop="reportType">
|
|
|
+ <el-input v-model="reportForm.reportType" minlength="1" maxlength="12"
|
|
|
+ show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="聚合sql" prop="gatherSql">
|
|
|
+ <el-input v-model="reportForm.gatherSql" minlength="1" maxlength="256"
|
|
|
+ show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="单位" prop="unit">
|
|
|
+ <el-input v-model="reportForm.unit" minlength="0" maxlength="8" show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="报表分组类型" prop="level">
|
|
|
+ <el-input v-model="reportForm.reportId" minlength="1" maxlength="12" show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-form-item label="基础sql" prop="baseSql">
|
|
|
+ <el-input v-model="reportForm.baseSql" type="textarea" :rows="8" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="菜单id" prop="menuId">
|
|
|
+ <el-input v-model="reportForm.menuId" minlength="0" maxlength="12" show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="面板排序" prop="sort">
|
|
|
+ <el-input v-model="reportForm.sort" minlength="0" maxlength="12" show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="指标排序" prop="reportSort">
|
|
|
+ <el-input v-model="reportForm.reportSort" minlength="0" maxlength="256"
|
|
|
+ show-word-limit />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="是否财务报表" prop="isCw">
|
|
|
+ <el-switch v-model="reportForm.isCw" active-value="Y" inactive-value="N"
|
|
|
+ active-color="#13ce66" inactive-color="#ff4949" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="是否医技报表" prop="isYj">
|
|
|
+ <el-switch v-model="reportForm.isYj" active-value="Y" inactive-value="N"
|
|
|
+ active-color="#13ce66" inactive-color="#ff4949" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="6">
|
|
|
+ <el-form-item label="是否有效" prop="flag">
|
|
|
+ <el-switch v-model="reportForm.flag" active-value="Y" inactive-value="N"
|
|
|
+ active-color="#13ce66" inactive-color="#ff4949" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+ </PageLayer>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+</template>
|
|
|
+<script setup name="TargetDictInfo" lang="ts">
|
|
|
+import { ref, reactive, onMounted, nextTick } from 'vue'
|
|
|
+import ReportTree from '../target-comm/ReportTree.vue'
|
|
|
+import PageLayer from '../../../layout/PageLayer.vue'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import { formatDate } from '../../../utils/date'
|
|
|
+import { seltYearAndNowLast } from '../../../data/shortcuts'
|
|
|
+import type { FormInstance, FormRules } from 'element-plus'
|
|
|
+import { selectReportDictTree, selectReportDict } from '../../../api/target-management/report-dict'
|
|
|
+import { queryDept } from '../../../api/public-api'
|
|
|
+
|
|
|
+const reportTreeData = ref({
|
|
|
+ data: [{}],
|
|
|
+ height: 900,
|
|
|
+})
|
|
|
+
|
|
|
+const isShowTree = ref(false)
|
|
|
+const isShowForm = ref(true)
|
|
|
+const start = formatDate(seltYearAndNowLast[0].value[0])
|
|
|
+const end = formatDate(seltYearAndNowLast[1].value[1])
|
|
|
+const deptWardList = ref([])
|
|
|
+const formSize = ref('default')
|
|
|
+const ruleFormRef = ref<FormInstance>()
|
|
|
+
|
|
|
+const deptMethod = (val: string) => {
|
|
|
+ queryDept(val).then((res: any) => {
|
|
|
+ deptWardList.value = res
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+const queryParam = reactive({
|
|
|
+ reportId: '', // 报表id
|
|
|
+ reportName: '', // 报表名称
|
|
|
+ reportType: '', // 报表类型
|
|
|
+ startTime: '', // 开始时间
|
|
|
+ endTime: '', // 结束时间
|
|
|
+})
|
|
|
+
|
|
|
+const reportForm = ref({
|
|
|
+ reportId: '', // 报表id
|
|
|
+ reportName: '', // 报表名称
|
|
|
+ reportType: '', // 报表类型
|
|
|
+ unit: '', // 单位
|
|
|
+ level: '', // 报表分组类型
|
|
|
+ gatherSql: '', // 聚合sql
|
|
|
+ baseSql: '', // 基础sql
|
|
|
+ displayType: '', // 展示类型
|
|
|
+ menuId: '', // 菜单id
|
|
|
+ sort: '', // 面板排序
|
|
|
+ reportSort: '', // 报表统计排序
|
|
|
+ isCw: 'N', // 是否财务报表大屏显示指标(Y: 是)
|
|
|
+ isYj: 'N', // 是否医技报表大屏显示指标(Y: 是)
|
|
|
+ flag: 'Y', // 是否有效
|
|
|
+})
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ nextTick(() => {
|
|
|
+ queryParam.startTime = start + ' 00:00:00'
|
|
|
+ queryParam.endTime = end + ' 23:59:59'
|
|
|
+ queryReportDictTree()
|
|
|
+ deptMethod('')
|
|
|
+ })
|
|
|
+})
|
|
|
+
|
|
|
+// 查询指标字典树
|
|
|
+const queryReportDictTree = () => {
|
|
|
+ isShowTree.value == true ? false : true
|
|
|
+ queryParam.reportId = ''
|
|
|
+ selectReportDictTree(queryParam)
|
|
|
+ .then((res: any) => {
|
|
|
+ reportTreeData.value.data = res
|
|
|
+ isShowTree.value = true
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+// ------ 接收树页面传来的数据 -------
|
|
|
+const treeNodeClick = async (data: any, node: any, obj: any) => {
|
|
|
+ if (node.data) {
|
|
|
+ // 查询指标字典
|
|
|
+ queryParam.reportId = node.data.id
|
|
|
+ let selectReportDictRes = await selectReportDict(queryParam)
|
|
|
+ reportForm.value = selectReportDictRes[0]
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// ---------- 新增报表 ------------
|
|
|
+const addForm = (formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return
|
|
|
+
|
|
|
+ if (queryParam.reportId === '') {
|
|
|
+ ElMessage({
|
|
|
+ type: "info",
|
|
|
+ message: "请选择一个指标报表!",
|
|
|
+ duration: 2500,
|
|
|
+ showClose: true,
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// ---------- 编辑报表 ------------
|
|
|
+const editForm = (formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+// ---------- 保存报表 ------------
|
|
|
+const submitForm = async (formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return
|
|
|
+}
|
|
|
+
|
|
|
+// ---------- 重置报表 ------------
|
|
|
+const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
+ if (!formEl) return
|
|
|
+
|
|
|
+ if (isShowForm.value) {
|
|
|
+ isShowForm.value = false
|
|
|
+ }
|
|
|
+
|
|
|
+ formEl.resetFields()
|
|
|
+}
|
|
|
+
|
|
|
+const rules = $ref<FormRules>({
|
|
|
+ reportId: [
|
|
|
+ { required: true, message: '请填写指标id', trigger: 'blur' },
|
|
|
+ { min: 1, max: 12, message: '指标id长度范围1-12个字符', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ reportName: [
|
|
|
+ { required: true, message: '请填写指标名称', trigger: 'blur' },
|
|
|
+ { min: 1, max: 256, message: '指标名称长度范围1-256个字符', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ reportType: [
|
|
|
+ { required: true, message: '请填写指标类型', trigger: 'blur' },
|
|
|
+ { min: 1, max: 12, message: '指标类型长度范围1-12个字符', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ menuId: [
|
|
|
+ { type: 'number', message: '菜单id请填写数字', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+ sort: [
|
|
|
+ { type: 'number', message: '面板排序请填写数字', trigger: 'blur' },
|
|
|
+ ],
|
|
|
+})
|
|
|
+
|
|
|
+</script>
|
|
|
+<style lang="scss" scoped deep>
|
|
|
+.hd-cl {
|
|
|
+ margin-bottom: 1px !important;
|
|
|
+}
|
|
|
+
|
|
|
+:deep(.el-textarea.is-disabled .el-textarea__inner) {
|
|
|
+ color: #1146f3;
|
|
|
+}
|
|
|
+</style>
|