代码提交-3-13

This commit is contained in:
2026-03-13 14:32:43 +08:00
parent dba9080e8c
commit 68b50e2577
39 changed files with 5658 additions and 922 deletions

16
.env.cas Normal file
View File

@@ -0,0 +1,16 @@
# 页面标题
VITE_APP_TITLE = 平安水电
# CAS 专用构建环境(生产模式)
VITE_APP_ENV = production
# 生产环境后端前缀
VITE_APP_BASE_API = '/prod-api'
# 启用 gzip 压缩
VITE_BUILD_COMPRESS = gzip
# CAS 配置启用CAS模式打包
VITE_APP_CAS_ENABLE = true
VITE_APP_CAS_SERVER_URL = https://rsso.gxsdxy.cn
VITE_APP_CAS_VALIDATE_URL = https://rsso.gxsdxy.cn/p3/serviceValidate

View File

@@ -2,10 +2,15 @@
VITE_APP_TITLE = 平安水电
# 生产环境配置
VITE_APP_ENV = 'production'
VITE_APP_ENV = production
# 若依管理系统/生产环境
VITE_APP_BASE_API = '/prod-api'
# 是否在打包时开启压缩,支持 gzip 和 brotli
VITE_BUILD_COMPRESS = gzip
# CAS 配置非CAS模式打包
VITE_APP_CAS_ENABLE = false
VITE_APP_CAS_SERVER_URL = https://rsso.gxsdxy.cn
VITE_APP_CAS_VALIDATE_URL = https://rsso.gxsdxy.cn/p3/serviceValidate

BIN
dist.zip

Binary file not shown.

View File

@@ -2,13 +2,14 @@
"name": "ruoyi",
"version": "3.8.8",
"description": "平安水电",
"author": "若依",
"author": "厚溥",
"license": "MIT",
"type": "module",
"scripts": {
"dev": "vite",
"build:prod": "vite build",
"build:stage": "vite build --mode staging",
"build:cas": "vite build --mode cas",
"preview": "vite preview"
},
"repository": {

View File

@@ -1,23 +1,30 @@
import request from '@/utils/request'
// 查询患者诊断信息列表
const defaultYearDate = () => new Date()
const withYearDate = (query) => ({
yearDate: (query && query.yearDate) || defaultYearDate(),
...(query || {})
})
// 查询患者诊断信息列<E681AF>?
export function listPatientDiagnosis(query) {
return request({
url: '/outpatientService/patientDiagnosis/list',
method: 'get',
params: query
params: withYearDate(query)
})
}
// 查询患者诊断信息详
// 查询患者诊断信息详<EFBFBD>?
export function getPatientDiagnosis(id) {
return request({
url: '/outpatientService/patientDiagnosis/getInfo/' + id,
method: 'get'
method: 'get',
params: { yearDate: defaultYearDate() }
})
}
// 新增患者诊断信
// 新增患者诊断信<EFBFBD>?
export function addPatientDiagnosis(data) {
return request({
url: '/outpatientService/patientDiagnosis/add',
@@ -26,7 +33,7 @@ export function addPatientDiagnosis(data) {
})
}
// 修改患者诊断信
// 修改患者诊断信<EFBFBD>?
export function updatePatientDiagnosis(data) {
return request({
url: '/outpatientService/patientDiagnosis/update',
@@ -35,11 +42,12 @@ export function updatePatientDiagnosis(data) {
})
}
// 删除患者诊断信
// 删除患者诊断信<EFBFBD>?
export function delPatientDiagnosis(id) {
return request({
url: '/outpatientService/patientDiagnosis/remove/' + id,
method: 'get'
method: 'get',
params: { yearDate: defaultYearDate() }
})
}
@@ -58,7 +66,7 @@ export function gainDrugPriceList(query) {
return request({
url: '/outpatientService/patientDiagnosis/gainDrugPriceList',
method: 'get',
params: query
params: withYearDate(query)
})
}
@@ -67,6 +75,7 @@ export function gainDrugNameList() {
return request({
url: '/outpatientService/patientDiagnosis/gainMedicineNameList',
method: 'get',
params: { yearDate: defaultYearDate() },
})
}
@@ -75,6 +84,7 @@ export function gainDrugNameListName(name) {
return request({
url: '/outpatientService/patientDiagnosis/gainMedicineNameListName?name=' + name,
method: 'get',
params: { yearDate: defaultYearDate() },
})
}
@@ -83,7 +93,7 @@ export function gainMedicineArchiveList(query) {
return request({
url: '/outpatientService/patientDiagnosis/gainMedicineArchiveList',
method: 'get',
params: query
params: withYearDate(query)
})
}
@@ -92,27 +102,29 @@ export function gainDrugInventoryList(query) {
return request({
url: '/outpatientService/patientDiagnosis/gainDrugInventoryList',
method: 'get',
params: query
params: withYearDate(query)
})
}
// 修改患者诊断状( 修改为 已发药 )
// 修改患者诊断状<EFBFBD>?( 修改<EFBFBD>?已发<E5B7B2>?)
export function deliverMedicine(id) {
return request({
url: '/outpatientService/patientDiagnosis/deliverMedicine/' + id,
method: 'get'
method: 'get',
params: { yearDate: defaultYearDate() }
})
}
// 修改患者诊断状( 修改为 已退药 )
// 修改患者诊断状<EFBFBD>?( 修改<EFBFBD>?已退<E5B7B2>?)
export function returnedMedication(id) {
return request({
url: '/outpatientService/patientDiagnosis/returnedMedication/' + id,
method: 'get'
method: 'get',
params: { yearDate: defaultYearDate() }
})
}
// 保存 患诊断 信息
// 保存 患<EFBFBD>?诊断 信息
export function saveDiagnosis(data) {
return request({
url: '/outpatientService/patientDiagnosis/save',
@@ -121,7 +133,7 @@ export function saveDiagnosis(data) {
})
}
// 保存 变成 待发 修改 库存 患诊断 信息
// 保存 变成 待发 修改 库存 患<EFBFBD>?诊断 信息
export function saveAddDiagnosis(data) {
return request({
url: '/outpatientService/patientDiagnosis/saveAddDiagnosis',
@@ -130,7 +142,7 @@ export function saveAddDiagnosis(data) {
})
}
// 保存 修改 患诊断 信息
// 保存 修改 患<EFBFBD>?诊断 信息
export function saveUpdate(data) {
return request({
url: '/outpatientService/patientDiagnosis/saveUpdate',
@@ -145,6 +157,7 @@ export function gainPatientDiagnosisListXml() {
return request({
url: '/outpatientService/patientDiagnosis/gainPatientDiagnosisListXml',
method: 'get',
params: { yearDate: defaultYearDate() },
})
}
@@ -153,6 +166,7 @@ export function gainPatientDiagnosisListTotalPriceXml() {
return request({
url: '/outpatientService/patientDiagnosis/gainPatientDiagnosisListTotalPriceXml',
method: 'get',
params: { yearDate: defaultYearDate() },
})
}
@@ -164,7 +178,7 @@ export function obtainSymptomStatisticsNumber(query) {
return request({
url: '/outpatientService/patientDiagnosis/obtainSymptomStatisticsNumber',
method: 'get',
params: query
params: withYearDate(query)
})
}
@@ -174,15 +188,33 @@ export function obtainSymptomStatisticsNumberMonth(query) {
return request({
url: '/outpatientService/patientDiagnosis/obtainSymptomStatisticsNumberMonth',
method: 'get',
params: query
params: withYearDate(query)
})
}
// 调用后端的代码判断是否可用医
export function verifyInsuranceStatus(idCard,name) {
// 调用后端的代码判断是否可用医<EFBFBD>?
export function verifyInsuranceStatus(idCard, name) {
return request({
url: '/outpatientService/patientDiagnosis/verify',
method: 'get',
params: { idCard,name}
params: withYearDate({ idCard, name })
})
}
// 获取历史医保报销累计金额按患者ID<49>?
export function getHistoryReimbursement(patientId, yearDate = new Date()) {
return request({
url: '/outpatientService/patientDiagnosis/getHistoryReimbursementByYear',
method: 'get',
params: { patientId, yearDate }
})
}
// 发药更正:仅调整医保与报销比率
export function adjustBasic(data) {
return request({
url: '/outpatientService/patientDiagnosis/adjustBasic',
method: 'post',
data: data
})
}

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询巡检异常列表
export function listAbnormal(query) {
return request({
url: '/inspection/abnormal/list',
method: 'get',
params: query
})
}
// 查询巡检异常详细
export function getAbnormal(id) {
return request({
url: '/inspection/abnormal/' + id,
method: 'get'
})
}
// 新增巡检异常
export function addAbnormal(data) {
return request({
url: '/inspection/abnormal',
method: 'post',
data: data
})
}
// 修改巡检异常
export function updateAbnormal(data) {
return request({
url: '/inspection/abnormal',
method: 'put',
data: data
})
}
// 删除巡检异常
export function delAbnormal(id) {
return request({
url: '/inspection/abnormal/' + id,
method: 'delete'
})
}

View File

@@ -34,3 +34,92 @@ export function RoundList(query) {
params: query
})
}
// 按天趋势统计
export function trendDaily(query) {
return request({
url: '/inspection/report/trendDaily',
method: 'get',
params: query
})
}
// 新增:按天双序列
export function trendDailyDual(query) {
return request({
url: '/inspection/report/trendDailyDual',
method: 'get',
params: query
})
}
// 新增:按月双序列
export function trendMonthlyDual(query) {
return request({
url: '/inspection/report/trendMonthlyDual',
method: 'get',
params: query
})
}
// 巡检类型占比
export function typeProportion(query) {
return request({
url: '/inspection/report/typeProportion',
method: 'get',
params: query
})
}
// 覆盖率统计
export function coverage(query) {
return request({
url: '/inspection/report/coverage',
method: 'get',
params: query
})
}
// 未巡检点清单
export function uninspectedPoints(query) {
return request({
url: '/inspection/report/uninspectedPoints',
method: 'get',
params: query
})
}
// 点位类型已巡检次数distinct
export function pointTypeCounts(query) {
return request({
url: '/inspection/report/pointTypeCounts',
method: 'get',
params: query
})
}
// 点位状态分布
export function statusDistribution() {
return request({
url: '/inspection/report/statusDistribution',
method: 'get'
})
}
// 巡检人统计(三合一:总/月/日)
export function inspectorStats3(query) {
return request({
url: '/inspection/report/inspectorStats3',
method: 'get',
params: query
})
}
// 巡检点统计(三合一:总/月/日)
export function pointStats3(query) {
return request({
url: '/inspection/report/pointStats3',
method: 'get',
params: query
})
}

View File

@@ -58,3 +58,17 @@ export function getCodeImg() {
timeout: 20000
})
}
// CAS 登录方法(通过请求参数传递 ticket 与 service
export function casLogin(data) {
return request({
url: '/cas/login',
headers: {
isToken: false,
repeatSubmit: false
},
method: 'post',
// 后端使用 @RequestParam 接收参数
params: data
})
}

View File

@@ -171,7 +171,7 @@
</el-form-item>
</el-col>
</el-row>
<!-- 6 是否医保 医保率 -->
<!-- 6 是否医保 报销比率 -->
<el-row v-if="controlData[0].data[0].colList[0].rowList[5].display">
<!-- 6 是否医保 -->
<el-col v-if="controlData[0].data[0].colList[0].rowList[5].colList[0].display" :span="12">
@@ -187,16 +187,16 @@
</el-select>
</el-form-item>
</el-col>
<!-- 6 医保率 -->
<!-- 6 报销比率 -->
<el-col v-if="controlData[0].data[0].colList[0].rowList[5].colList[1].display" :span="12">
<el-form-item v-if="
controlData[0].data[0].colList[0].rowList[5].colList[1].data[0]
.display && form.isInsured == 0
" label="医保率" prop="value">
" label="报销比率" prop="value">
<el-input :disabled="
controlData[0].data[0].colList[0].rowList[5].colList[1].data[0]
.prohibit
" @input="calculationWholeTotal()" v-model="form.value" clearable placeholder="请输入医保率" />
" @input="calculationWholeTotal()" v-model="form.value" clearable placeholder="请输入报销比率" />
</el-form-item>
</el-col>
</el-row>
@@ -297,13 +297,27 @@
</el-row>
<!-- 处方 -->
<el-row v-if="controlData[3].display" v-for="(index, item) in form.prescriptionDetailsList" :key="item">
<PrescriptionList :controlButton="controlButtonPrescriptionList" :controlData="controlDataPrescriptionList" v-model:prescriptionData="form.prescriptionDetailsList[item]" />
<PrescriptionList
:controlButton="controlButtonPrescriptionList"
:controlData="controlDataPrescriptionList"
v-model:prescriptionData="form.prescriptionDetailsList[item]"
:isInsured="form.isInsured"
:reimbursementRate="form.value"
/>
</el-row>
<!-- 展示总价和 -->
<!-- 汇总展示 -->
<el-row>
<el-col :span="24">
<div style="text-align: right; margin-top: 20px;color: red">
<span>所有药品总价和: {{ totalPriceSum }} 元</span>
<div style="text-align: right; margin-top: 20px; color: red">
<span>
应收金额:{{ form.isInsured === 0 ? patientPay : ceilPrice(totalPriceSum) }} 元
</span>
<span style="margin-left: 16px; color: #666">
处方总金额:{{ ceilPrice(totalPriceSum) }} 元
</span>
<span v-if="form.isInsured === 0" style="margin-left: 16px; color: #333">
预计报销:{{ Number(currentReimbursement).toFixed(2) }} 元
</span>
</div>
</el-col>
</el-row>
@@ -321,6 +335,16 @@
//
const { proxy } = getCurrentInstance()
// 价格向上取整到小数点后两位进一法
// 先缩放到整数避免浮点精度问题
function ceilPrice(value) {
const num = Number(value)
if (isNaN(num)) return '0.00'
const scaled = Math.round(num * 10000)
const cents = Math.ceil(scaled / 100)
return (cents / 100).toFixed(2)
}
// 患者类型
const { healthcare_os_patient_type } = proxy.useDict('healthcare_os_patient_type')
// os_patient_type
@@ -348,6 +372,8 @@ const form = ref({})
const checkId = ref(0)
const totalPriceSum = ref(0) //所有药品总价和
const currentReimbursement = ref(0)
const patientPay = ref(0)
//
const props = defineProps({
@@ -593,7 +619,7 @@ const props = defineProps({
{
id: 5,
name: 'el-row',
description: '6 是否医保 医保率 ',
description: '6 是否医保 报销比率 ',
display: true,
colList: [
{
@@ -614,12 +640,12 @@ const props = defineProps({
{
id: 1,
name: 'el-col',
description: '6 医保率 col',
description: '6 报销比率 col',
display: true,
data: [
{
id: 0,
name: '医保率',
name: '报销比率',
display: true,
prohibit: false
}
@@ -844,11 +870,24 @@ watch(
// title.value = '患者诊断信息'
// console.log('获取数据111111111111', form.value)
// 更新总价和
totalPriceSum.value = form.value.prescriptionDetailsList
totalPriceSum.value = ceilPrice(form.value.prescriptionDetailsList
.reduce((sum, prescription) => {
return sum + prescription.reduce((innerSum, drug) => innerSum + parseFloat(drug.totalPrice || 0), 0)
}, 0)
.toFixed(2)
}, 0))
const insured = form.value?.isInsured
const sumNum = Number(totalPriceSum.value || 0)
if (insured === 0) {
const rate = Number(form.value?.value || 0) / 100
const r = isNaN(rate) ? 0 : rate
// 先计算个人应付(向上取整)
const pay = ceilPrice(sumNum * (1 - r))
patientPay.value = pay
// 预计报销 = 总价 - 个人应付
currentReimbursement.value = (sumNum - Number(pay)).toFixed(2)
} else {
currentReimbursement.value = '0.00'
patientPay.value = ceilPrice(sumNum)
}
})
}
)

View File

@@ -238,7 +238,7 @@ export default function () {
{
id: 5,
name: "el-row",
description: "6 是否医保 医保率 ",
description: "6 是否医保 报销比率 ",
display: true,
colList: [
{
@@ -259,12 +259,12 @@ export default function () {
{
id: 1,
name: "el-col",
description: "6 医保率 col",
description: "6 报销比率 col",
display: true,
data: [
{
id: 0,
name: "医保率",
name: "报销比率",
display: true,
prohibit: true,
},
@@ -679,7 +679,7 @@ export default function () {
{
id: 5,
name: "el-row",
description: "6 是否医保 医保率 ",
description: "6 是否医保 报销比率 ",
display: true,
colList: [
{
@@ -700,12 +700,12 @@ export default function () {
{
id: 1,
name: "el-col",
description: "6 医保率 col",
description: "6 报销比率 col",
display: true,
data: [
{
id: 0,
name: "医保率",
name: "报销比率",
display: true,
prohibit: false,
},

View File

@@ -183,6 +183,7 @@ function selectValue(row) {
if (row != null) {
console.log('获取患者信息', row)
const data = {
id: row.id,
patientType: row.patientType,
studentId: row.studentId,
name: row.name,

View File

@@ -274,7 +274,7 @@
},
]">
<el-button :disabled="controlData[8].prohibit" width="100%" @click="selectDrugPriceInput(item, scope)">
{{ prescription[scope.$index].unitPrice.toFixed(2) }}
{{ Number(prescription[scope.$index].unitPrice || 0).toFixed(2) }}
</el-button>
</el-form-item>
</template>
@@ -289,7 +289,13 @@
trigger: controlData[9].check[0].trigger,
},
]">
{{ prescription[scope.$index].totalPrice.toFixed(2) }}
{{
Number(isInsured) === 0
? ceilPrice(
(parseFloat(prescription[scope.$index].totalPrice || 0) * (1 - (parseFloat(reimbursementRate || 0) / 100)))
)
: ceilPrice(prescription[scope.$index].totalPrice || 0)
}}
</el-form-item>
</template>
</el-table-column>
@@ -339,6 +345,16 @@ import { listCommonUsage, listEatingTime, listFrequency } from '@/api/healthcare
const { proxy } = getCurrentInstance()
// 价格向上取整到小数点后两位(进一法)
// 先缩放到整数避免浮点精度问题
function ceilPrice(value) {
const num = Number(value)
if (isNaN(num)) return '0.00'
const scaled = Math.round(num * 10000)
const cents = Math.ceil(scaled / 100)
return (cents / 100).toFixed(2)
}
const { os_patient_type } = proxy.useDict('os_patient_type')
// os_patient_type
const { os_diagnosis_type } = proxy.useDict('os_diagnosis_type')
@@ -390,6 +406,14 @@ const props = defineProps({
prescriptionData: {
type: Array
},
isInsured: {
type: [Number, String],
default: 1
},
reimbursementRate: {
type: [Number, String],
default: 0
},
// 控制 纽约 的 显示 隐藏
controlButton: {
type: Array,
@@ -891,11 +915,10 @@ function calculationTotal(index) {
}
console.log('totalPrice11111:', form.value.prescription)
// 更新总价和
totalPriceSum.value = form.value.prescription
totalPriceSum.value = ceilPrice(form.value.prescription
.reduce((sum, prescri) => {
return sum + prescri.reduce((innerSum, drug) => innerSum + parseFloat(drug.totalPrice || 0), 0)
}, 0)
.toFixed(2)
}, 0))
}
// 药品 档案 弹框

View File

@@ -4,7 +4,7 @@
<script setup>
import * as echarts from "echarts";
import { nextTick, onMounted, ref } from "vue";
import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
import { listCircularDiagram } from "@/api/sidebar/reportAnalytics.js";
import { defineProps } from "vue";
@@ -53,10 +53,12 @@ var option = {
};
//监听到有新值传入,调用函数重新渲染
watch(props, newData => {
option.series.data = newData.data;
freshEchart();
});
watch(() => props.data, (newData) => {
if (chartInstance && newData) {
option.series[0].data = newData;
freshEchart();
}
}, { deep: true });
onMounted(async () => {
await nextTick(); //确保dow已经渲染完成

View File

@@ -69,18 +69,22 @@ var option = {
};
const getList = function() {
// 初始化ECharts实例并设置配置项这里以折线图为例但可灵活替换
onMounted(async () => {
await nextTick(); // 确保DOM已经渲染完成
chartInstance = echarts.init(chartDom.value);
});
listLineChartTable().then(res => {
const seriesList = res.data;
option.series[0].data = seriesList;
chartInstance.setOption(option);
if (chartInstance) {
chartInstance.setOption(option);
}
});
};
// 初始化ECharts实例并设置配置项
onMounted(async () => {
await nextTick(); // 确保DOM已经渲染完成
chartInstance = echarts.init(chartDom.value);
getList(); // 初始化后获取数据
});
// 销毁ECharts实例
onUnmounted(() => {
if (chartInstance != null && chartInstance.dispose) {

View File

@@ -4,7 +4,7 @@
<script setup>
import * as echarts from "echarts";
import { nextTick, onMounted, ref } from "vue";
import { nextTick, onMounted, onUnmounted, ref, watch } from "vue";
import { listCircularDiagram } from "@/api/sidebar/reportAnalytics.js";
import { defineProps } from "vue";
@@ -51,10 +51,12 @@ var option = {
};
//监听到有新值传入,调用函数重新渲染
watch(props, newData => {
option.series.data = newData.data;
freshEchart();
});
watch(() => props.data, (newData) => {
if (chartInstance && newData) {
option.series[0].data = newData;
freshEchart();
}
}, { deep: true });
onMounted(async () => {
await nextTick(); //确保dow已经渲染完成

View File

@@ -165,7 +165,16 @@ function loadArchives() {
// 合并 archiveList 和 drugFilings
mergedData.value = formattedRows.flatMap(row => [
{ ...row, filingId: null },
{
...row,
filingId: null,
packCount: row.packCount ?? 0,
inventoryUnit: row.inventoryUnit,
splitUnit: row.splitUnit,
minNumber: row.minNumber,
unitQuantity: row.minNumber ?? row.unitQuantity,
isSplit: row.isSplit
},
...row.drugFilings.map(filing => ({
medicineName: row.medicineName,
manufacturer: row.manufacturer,
@@ -174,11 +183,18 @@ function loadArchives() {
batch: filing.batch,
expiryDate: filing.expiryDate,
boxCount: filing.boxCount,
packCount: filing.packCount,
retailPrice: filing.retailPrice,
minPrice: filing.minPrice,
minNumber: filing.minNumber ?? row.minNumber,
unitQuantity: filing.minNumber ?? row.minNumber,
inventoryUnit: filing.inventoryUnit ?? row.inventoryUnit,
splitUnit: filing.splitUnit ?? row.splitUnit,
filingId: filing.id,
archiveId: row.id,
storeroomId: filing.storeroomId,
storeroomName: filing.storeroomName
storeroomName: filing.storeroomName,
isSplit: row.isSplit
}))
]);

View File

@@ -49,6 +49,7 @@
<script setup>
import { ElMessageBox } from 'element-plus'
import { useRouter } from 'vue-router'
import Breadcrumb from '@/components/Breadcrumb'
import TopNav from '@/components/TopNav'
import Hamburger from '@/components/Hamburger'
@@ -64,6 +65,7 @@ import useSettingsStore from '@/store/modules/settings'
const appStore = useAppStore()
const userStore = useUserStore()
const settingsStore = useSettingsStore()
const router = useRouter()
function toggleSideBar() {
appStore.toggleSideBar()
@@ -89,7 +91,7 @@ function logout() {
type: 'warning'
}).then(() => {
userStore.logOut().then(() => {
location.href = '/index';
router.replace('/login')
})
}).catch(() => { });
}

View File

@@ -11,7 +11,7 @@ import usePermissionStore from '@/store/modules/permission'
NProgress.configure({ showSpinner: false });
const whiteList = ['/login', '/register'];
const whiteList = ['/login', '/register', '/cas-callback'];
router.beforeEach((to, from, next) => {
NProgress.start()

View File

@@ -47,6 +47,11 @@ export const constantRoutes = [
component: () => import('@/views/register'),
hidden: true
},
{
path: '/cas-callback',
component: () => import('@/views/cas-callback'),
hidden: true
},
{
path: "/:pathMatch(.*)*",
component: () => import('@/views/error/404'),
@@ -90,6 +95,19 @@ export const constantRoutes = [
component: () => import('@/views/healthcare/inventory/DrugFiling/index.vue'),
hidden: true,
},
// 巡检大屏
{
path: '/inspection/report/big-screen',
component: Layout,
children: [
{
path: '',
component: () => import('@/views/inspection/report/bigScreen.vue'),
name: 'InspectionBigScreen',
meta: { title: '巡检大屏', icon: 'chart' }
}
]
},
]
// 动态路由,基于用户权限动态去加载
@@ -167,7 +185,8 @@ export const dynamicRoutes = [
]
const router = createRouter({
history: createWebHistory(),
// 使用构建时的 BASE_URL 作为路由基础路径,以兼容 /srs/ 与 /cas/ 部署
history: createWebHistory(import.meta.env?.BASE_URL || '/'),
routes: constantRoutes,
scrollBehavior(to, from, savedPosition) {
if (savedPosition) {

View File

@@ -2,7 +2,7 @@ export default {
/**
* 网页标题
*/
title: import.meta.env.VITE_APP_TITLE,
title: import.meta.env?.VITE_APP_TITLE || '平安水电',
/**
* 侧边栏主题 深色主题theme-dark,浅色主题theme-light
*/
@@ -43,5 +43,22 @@ export default {
* The default is only used in the production env
* If you want to also use it in dev, you can pass ['production', 'development']
*/
errorLog: 'production'
errorLog: 'production',
/**
* CAS登录配置
*/
// 是否启用CAS登录 (true: CAS登录模式, false: 传统登录模式)
casEnable: (import.meta.env?.VITE_APP_CAS_ENABLE || 'false') === 'true',
// CAS服务器地址
casServerUrl: import.meta.env?.VITE_APP_CAS_SERVER_URL || 'https://rsso.gxsdxy.cn',
// CAS票据验证地址(CAS3默认 p3)
casValidateUrl: import.meta.env?.VITE_APP_CAS_VALIDATE_URL || 'https://rsso.gxsdxy.cn/p3/serviceValidate',
// 部署路径配置 (CAS模式: /cas/, 传统模式: /srs/)
deployPath: function() {
return this.casEnable ? '/cas/' : '/srs/'
}
}

View File

@@ -1,4 +1,4 @@
import { login, logout, getInfo } from '@/api/login'
import { login, logout, getInfo, casLogin as casLoginApi } from '@/api/login'
import { getToken, setToken, removeToken } from '@/utils/auth'
import defAva from '@/assets/images/profile.jpg'
@@ -30,6 +30,18 @@ const useUserStore = defineStore(
})
})
},
// CAS 登录
casLogin(userInfo) {
return new Promise((resolve, reject) => {
casLoginApi(userInfo).then(res => {
setToken(res.token)
this.token = res.token
resolve()
}).catch(error => {
reject(error)
})
})
},
// 获取用户信息
getInfo() {
return new Promise((resolve, reject) => {

View File

@@ -87,7 +87,7 @@ service.interceptors.response.use(res => {
ElMessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' }).then(() => {
isRelogin.show = false;
useUserStore().logOut().then(() => {
location.href = '/index';
window.location.href = (import.meta.env?.BASE_URL || '/') + 'login';
})
}).catch(() => {
isRelogin.show = false;

115
src/views/cas-callback.vue Normal file
View File

@@ -0,0 +1,115 @@
<template>
<div class="cas-callback">
<div class="loading-container">
<el-loading v-loading="loading" text="正在验证登录信息...">
<div class="loading-content">
<el-icon class="loading-icon">
<Loading />
</el-icon>
<p>正在处理CAS登录...</p>
</div>
</el-loading>
</div>
</div>
</template>
<script setup>
import { onMounted, ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { ElMessage, ElLoading } from 'element-plus'
import { Loading } from '@element-plus/icons-vue'
import useUserStore from '@/store/modules/user'
import settings from '@/settings'
const route = useRoute()
const router = useRouter()
const userStore = useUserStore()
const loading = ref(true)
onMounted(() => {
handleCasCallback()
})
async function handleCasCallback() {
try {
const ticket = route.query.ticket
if (!ticket) {
// 没有ticket参数,说明是直接访问此页面,根据设备类型进行跳转
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
if (isMobile) {
// 移动端跳转到移动端页面
window.location.href = `${window.location.origin}/app-cas/`;
} else {
// PC端跳转到PC端页面
router.push('/');
}
return;
}
// 有ticket参数,处理CAS登录回调
// 构建服务URL(与登录页保持一致,包含构建时的 base 前缀)
const base = import.meta.env?.BASE_URL || '/'
const serviceUrl = window.location.origin + base + 'cas-callback'
// 交由后端进行CAS票据验证与登录(更安全、与后端接口一致)
await userStore.casLogin({ ticket, service: serviceUrl })
// 获取用户信息
await userStore.getInfo()
ElMessage.success('CAS登录成功')
// 登录成功后,根据设备类型跳转到相应页面
const isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
if (isMobile) {
// 移动端跳转到移动端页面
window.location.href = `${window.location.origin}/app-cas/`;
} else {
// PC端跳转到PC端页面
const redirect = route.query.state || '/';
router.push(redirect);
}
} catch (error) {
console.error('CAS登录失败:', error)
ElMessage.error('CAS登录失败: ' + error.message)
// 跳转回登录页面
router.push('/login')
} finally {
loading.value = false
}
}
</script>
<style lang="scss" scoped>
.cas-callback {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.loading-container {
background: white;
padding: 40px;
border-radius: 10px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
text-align: center;
min-width: 300px;
}
.loading-content {
.loading-icon {
font-size: 40px;
color: #409eff;
margin-bottom: 20px;
}
p {
margin: 0;
color: #666;
font-size: 16px;
}
}
</style>

View File

@@ -76,7 +76,7 @@
</el-col>
</el-row>
<!-- 详情弹窗所有弹窗共用均带分页 -->
<!-- 详情弹窗(所有弹窗共用,均带分页) -->
<el-dialog
v-model="detailDialog"
:title="dialogTitle"
@@ -124,7 +124,7 @@
<el-table-column prop="remark" label="备注" />
</el-table>
<!-- 分页控件所有弹窗均显示 -->
<!-- 分页控件(所有弹窗均显示) -->
<div class="pagination-wrap">
<el-pagination
v-model:current-page="pagination.currentPage"
@@ -166,7 +166,7 @@ const { fire_facility_type, fire_facility_status } = proxy.useDict(
const facilityTypes = computed(() => fire_facility_type.value || []);
const facilityStatuses = computed(() => fire_facility_status.value || []);
const isDictLoaded = computed(() => {
// 不仅判断长度还要验证是否包含有效数据避免空数组误判
// 不仅判断长度,还要验证是否包含有效数据(避免空数组误判)
return facilityTypes.value.length > 0 &&
facilityStatuses.value.length > 0 &&
facilityTypes.value.some(item => item.value !== undefined) &&
@@ -183,7 +183,7 @@ const detailDialog = ref(false);
const dialogTitle = ref("");
// 弹窗类型标识
const dialogType = ref(""); // 'total' 表示总数弹窗'status' 表示状态弹窗
const dialogType = ref(""); // 'total' 表示总数弹窗,'status' 表示状态弹窗
const currentStatusValue = ref(null);
// 分页配置
@@ -193,15 +193,15 @@ const pagination = reactive({
total: 0
});
// 查询参数 - 确保初始值为null符合后端预期
// 查询参数 - 确保初始值为null(符合后端预期)
const queryParams = reactive({
facilityType: null,
});
// 3. 核心方法查询报表数据
// 3. 核心方法:查询报表数据
const handleQuery = () => {
loading.value = true;
// 打印查询参数便于调试
// 打印查询参数,便于调试
console.log("查询参数:", queryParams);
getReportData(queryParams)
.then((res) => {
@@ -214,7 +214,7 @@ const handleQuery = () => {
})
.catch((err) => {
console.error("查询报表失败:", err);
proxy.$message.error("获取数据失败请稍后重试");
proxy.$message.error("获取数据失败,请稍后重试");
reportData.value = [];
totalCount.value = 0;
})
@@ -314,7 +314,7 @@ const showTotalDetail = async () => {
const loadTotalDetailPage = async () => {
detailLoading.value = true;
try {
// 获取所有数据不分页用于计算总数和分页
// 获取所有数据(不分页)用于计算总数和分页
const allDataRes = await getAllData({
facilityType: queryParams.facilityType
});
@@ -382,7 +382,7 @@ const resetQuery = () => {
handleQuery();
};
// 8. 辅助方法时间格式化
// 8. 辅助方法:时间格式化
const parseTime = (time) => {
if (!time) return "-";
const date = new Date(time);
@@ -393,7 +393,7 @@ const parseTime = (time) => {
});
};
// 9. 辅助方法过期日期标签类型
// 9. 辅助方法:过期日期标签类型
const getExpiryTagType = (expiryDate) => {
if (!expiryDate) return "default";
const today = new Date();
@@ -411,7 +411,7 @@ onMounted(() => {
// proxy.$message.warning(`检测到${invalidStatus.length}个状态样式配置错误`);
// }
// 初始化查询逻辑确保字典加载后执行
// 初始化查询逻辑(确保字典加载后执行)
const initQuery = () => {
if (isDictLoaded.value) {
handleQuery();
@@ -420,7 +420,7 @@ onMounted(() => {
const unwatch = watch(isDictLoaded, (loaded) => {
if (loaded) {
handleQuery();
unwatch(); // 执行后销毁监听避免重复调用
unwatch(); // 执行后销毁监听,避免重复调用
}
});
}
@@ -430,7 +430,7 @@ onMounted(() => {
initQuery();
});
// 移除原有的watch(isDictLoaded)改用onMounted中的逻辑
// 移除原有的watch(isDictLoaded),改用onMounted中的逻辑
</script>
<style scoped>

View File

@@ -7,6 +7,23 @@
<el-form-item label="条码" prop="barcode">
<el-input v-model="queryParams.barcode" placeholder="请输入条码" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="是否拆分" prop="isSplit">
<el-select v-model="queryParams.isSplit" placeholder="请选择" clearable style="width: 150px">
<el-option v-for="dict in sys_yes_no" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="批次" prop="batch">
<el-input v-model="queryParams.batch" placeholder="请输入批次" clearable @keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="有效期" prop="expiryDateRange">
<el-date-picker v-model="queryParams.expiryDateRange" type="daterange" range-separator="至"
start-placeholder="开始日期" end-placeholder="结束日期" value-format="YYYY-MM-DD" style="width: 260px" clearable />
</el-form-item>
<el-form-item label="库房" prop="storeroomId">
<el-select v-model="queryParams.storeroomId" placeholder="请选择库房" clearable style="width: 180px">
<el-option v-for="item in storeroomList" :key="item.id" :label="item.storeroomName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
@@ -54,6 +71,10 @@
<el-button type="warning" plain icon="Upload" @click="handleImport"
v-hasPermi="['healthcare:archive:add']">批量建档</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Download" @click="handleExport"
v-hasPermi="['healthcare:archive:export']">导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -332,18 +353,28 @@
<script setup name="Archive">
// 价格向上取整到小数点后两位(进一法)
function ceilPrice(value) {
const num = Number(value)
if (isNaN(num)) return '0.00'
const scaled = Math.round(num * 10000)
const cents = Math.ceil(scaled / 100)
return (cents / 100).toFixed(2)
}
import {
addArchive,
delArchive,
getArchive,
listArchive,
updateArchive,
updateBatch,
deleteBatch,
} from "@/api/healthcare/inventory/DrugFiling/archive.js";
import { getToken } from "@/utils/auth";
import { getCurrentInstance, reactive, ref, toRefs } from "vue";
import { useRoute } from 'vue-router';
addArchive,
delArchive,
deleteBatch,
getArchive,
listArchive,
updateArchive,
updateBatch,
} from "@/api/healthcare/inventory/DrugFiling/archive.js"
import { listStoreroom } from "@/api/healthcare/inventory/StoreRoom/storeroom.js"
import { getToken } from "@/utils/auth"
import { getCurrentInstance, reactive, ref, toRefs } from "vue"
import { useRoute } from 'vue-router'
// import { ElNotification } from 'element-plus'
@@ -428,7 +459,7 @@ const handleBatchSave = (row, parentRow) => {
if (parentRow.isSplit === 'Y' && parentRow.minNumber) {
const retailPrice = parseFloat(row.retailPrice) || 0;
const minNumber = parseFloat(parentRow.minNumber) || 1;
row.minPrice = (retailPrice / minNumber).toFixed(2);
row.minPrice = ceilPrice(retailPrice / minNumber);
}
// 不可拆分药品,最小单位价格等于零售价 暂时不使用
@@ -497,6 +528,10 @@ const data = reactive({
pageSize: 10,
medicineName: null,
barcode: null,
isSplit: null,
batch: null,
expiryDateRange: null,
storeroomId: null,
type: null
},
rules: {
@@ -596,6 +631,15 @@ const childBorder = ref(false);
const expandedRows = ref([]);
const storeList = ref([]);
// 库房列表
const storeroomList = ref([]);
// 获取库房列表
function getStoreroomList() {
listStoreroom().then((response) => {
storeroomList.value = response.rows || [];
});
}
const route = useRoute();
let drugType = ref(route.query.type);
console.log('Initial received route:', drugType.value); // 添加日志以调试
@@ -603,7 +647,14 @@ console.log('Initial received route:', drugType.value); // 添加日志以调试
function getList() {
loading.value = true;
queryParams.value.type = drugType.value;
listArchive(queryParams.value)
// 处理有效期日期范围参数
const params = { ...queryParams.value };
if (params.expiryDateRange && params.expiryDateRange.length === 2) {
params.expiryDateStart = params.expiryDateRange[0];
params.expiryDateEnd = params.expiryDateRange[1];
}
delete params.expiryDateRange;
listArchive(params)
.then((response) => {
const rows = response.rows || [];
archiveList.value = formatData(rows);
@@ -831,11 +882,10 @@ function handleDelete(row) {
// 导出按钮操作
function handleExport() {
const { pageNum, pageSize, ...exportParams } = queryParams.value;
proxy.download(
"healthcare/archive/export",
{
...queryParams.value,
},
exportParams,
`archive_${new Date().getTime()}.xlsx`
);
}
@@ -856,6 +906,7 @@ function toggleExpand(row, column, event) {
}
getList();
getStoreroomList();
</script>
<style scoped>

View File

@@ -193,8 +193,8 @@
</el-form-item>
<el-form-item label="出库数量合计" prop="outQuantity" label-width="100">
<el-input
v-model="form.outQuantity"
placeholder="请输入出库数量"
:model-value="outQuantitySummary"
placeholder="出库数量合计"
style="width: 350px"
:disabled="true"
/>
@@ -264,7 +264,7 @@
<el-form-item label="证明材料" prop="proofMaterial">
<file-upload v-model="form.proofMaterial" :disabled="isDisabled" />
</el-form-item>
<el-form-item label="用途详" prop="purposeDetails">
<el-form-item label="用途详" prop="purposeDetails">
<el-input
v-model="form.purposeDetails"
type="textarea"
@@ -296,7 +296,7 @@
:disabled="isDisabled"
/>
</el-form-item>
<el-form-item label="用途详" prop="purposeDetails">
<el-form-item label="用途详" prop="purposeDetails">
<el-input
v-model="form.purposeDetails"
type="textarea"
@@ -390,7 +390,7 @@
<el-form-item label="证明材料" prop="proofMaterial">
<file-upload v-model="form.proofMaterial" :disabled="isDisabled" />
</el-form-item>
<el-form-item label="用途详" prop="purposeDetails">
<el-form-item label="用途详" prop="purposeDetails">
<el-input
v-model="form.purposeDetails"
type="textarea"
@@ -423,7 +423,7 @@
<el-form-item label="处理方式" prop="disposalMethod">
<el-input
v-model="form.disposalMethod"
placeholder="请输入处理方"
placeholder="请输入处理方"
style="width: 310px"
:disabled="isDisabled"
/>
@@ -468,7 +468,7 @@
>
</el-col>
</el-row>
<el-table
<el-table
:data="healthcareInventoryDrugoutDetailsList"
:row-class-name="rowHealthcareInventoryDrugoutDetailsIndex"
@selection-change="
@@ -483,68 +483,76 @@
prop="index"
width="50"
/>
<el-table-column label="药品档案" prop="medicineName" width="300px">
<el-table-column label="药品名称" prop="medicineName" width="300px">
<template #default="scope">
<el-form-item
:prop="`healthcareInventoryDrugoutDetailsList.${scope.$index}.medicineName`"
:rules="[
{
required: true,
message: '药品名称不能为空',
trigger: 'blur',
},
]"
>
<el-input
v-model="
healthcareInventoryDrugoutDetailsList[scope.$index]
.medicineName
"
placeholder="请输入药品名称"
:disabled="true"
style="width: 250px"
@blur="handleBlur(scope.$index)"
/>
</el-form-item>
<el-input
v-model="scope.row.medicineName"
placeholder="请输入药品名称"
:disabled="true"
style="width: 250px"
@blur="syncDrugoutDetails()"
/>
</template>
</el-table-column>
<el-table-column label="条码" align="center" prop="barcode" />
<el-table-column label="厂商" align="center" prop="manufacturer" />
<el-table-column label="批次" prop="outBatch" />
<el-table-column label="所在库房" prop="outPointName" />
<el-table-column label="剩余数量" prop="remainingQuantity" />
<el-table-column label="生产厂家" align="center" prop="manufacturer" />
<el-table-column label="出库批次" prop="outBatch" />
<el-table-column label="出库库房" prop="outPointName" />
<el-table-column label="剩余库存" width="220">
<template #default="scope">
<span>{{ formatRemainingInventory(scope.row) }}</span>
</template>
</el-table-column>
<el-table-column label="是否拆分" width="120">
<template #default="scope">
<span>{{ (String(scope.row.isSplit).toUpperCase() === 'Y') ? '是' : '否' }}</span>
</template>
</el-table-column>
<el-table-column label="出库单位" width="160">
<template #default="scope">
<el-select
v-model="scope.row.unitType"
placeholder="选择单位"
:disabled="isDisabled || getUnitOptions(scope.row).length === 1"
style="width: 140px"
@change="handleUnitChange(scope.row)"
>
<el-option
v-for="option in getUnitOptions(scope.row)"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column label="出库数量" prop="quantity" width="200px">
<template #default="scope">
<el-form-item
:prop="`healthcareInventoryDrugoutDetailsList.${scope.$index}.quantity`"
:rules="[
{ required: true, message: '数量不能为空', trigger: 'blur' },
{ required: true, message: '出库数量不能为空', trigger: 'change' },
{
required: true,
pattern: /^\d+$/,
message: '禁止包含小数',
trigger: 'blur',
validator: (rule, value, callback) =>
validateQuantityRule(scope.row, value, callback),
trigger: ['change', 'blur'],
},
{
required: true,
pattern: /^[1-9]\d*$/,
message: '数量不能为0',
trigger: 'blur',
},
]"
>
<el-input
<el-input-number
v-model="scope.row.quantity"
placeholder="请输入出库数量"
:min="1"
:precision="0"
:disabled="isDisabled"
@blur="handleBlur(scope.$index)"
controls-position="right"
style="width: 160px"
@change="handleQuantityChange(scope.row)"
@blur="handleQuantityBlur(scope.row)"
/>
</el-form-item>
</template>
</el-table-column>
<el-table-column
label="操作"
label="档案"
align="center"
class-name="small-padding fixed-width"
>
@@ -563,12 +571,10 @@
<template #footer>
<div class="dialog-footer">
<el-button type="primary" @click="submitForm" :disabled="isDisabled"
>出 库</el-button
>
>提交</el-button>
<el-button type="primary" @click="handleSave" :disabled="isDisabled">
{{ isSaving ? "保存中..." : "保存" }}</el-button
>
<el-button @click="cancel">取 消</el-button>
{{ isSaving ? "保存中.." : "保存" }}</el-button>
<el-button @click="cancel">取消</el-button>
</div>
</template>
<DrugArchive
@@ -582,17 +588,16 @@
<script setup name="Drugout">
import {
listDrugout,
getDrugout,
delDrugout,
addDrugout,
updateDrugout,
delDrugout,
getDrugout,
listDrugout,
saveDrugout,
updateDrugout,
} from "@/api/healthcare/inventory/DrugOut/drugout.js";
import DrugArchive from "@/components/drugFiling/index.vue";
import { getFiling } from "@/api/healthcare/inventory/DrugFiling/drugfiling.js";
import { ref, computed, watchEffect } from "vue";
import { listStoreroom } from "@/api/healthcare/inventory/StoreRoom/storeroom.js";
import DrugArchive from "@/components/drugFiling/index.vue";
import { ref, watchEffect, computed } from "vue";
const archiveSelectorRef = ref(null);
// 详情信息下标
@@ -624,14 +629,16 @@ const selectedRow = reactive([]);
const data = reactive({
form: {
variety: null,
outQuantity: null,
variety: 0,
outQuantity: 0,
outBoxQuantity: 0,
outPackQuantity: 0,
},
queryParams: {
pageNum: 1,
pageSize: 10,
outStatus: null,
variety: null,
variety: 0,
outTime: null,
},
rules: {
@@ -651,100 +658,79 @@ const data = reactive({
],
outRemark: [
{ required: true, message: "出库备注不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},,
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},
],
inboundLocation: [
{ required: true, message: "入库地点不能为空", trigger: "blur" },
],
signee: [{ required: true, message: "签收人不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},],
proofMaterial: [
{ required: true, message: "凭证材料不能为空", trigger: "blur" },
signee: [
{ required: true, message: "签收人不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},
],
purposeDetails: [
{ required: true, message: "用途明细不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},,
],
scrapReason: [
{ required: true, message: "报废原因不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},,
],
disposalMethod: [
{ required: true, message: "处理方式不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},,
],
damageReason: [
{ required: true, message: "破损原因不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},,
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},
],
expirationDate: [
{ required: true, message: "过期时间不能为空", trigger: "blur" },
,
],
currentDatetime: [
{ required: true, message: "当前时间不能为空", trigger: "blur" },
],
destroyer: [{ required: true, message: "销毁人不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},],
destroyer: [
{ required: true, message: "销毁人不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},
],
destructionLocation: [
{ required: true, message: "销毁地点不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},,
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},
],
destructionProcess: [
{ required: true, message: "销毁过程不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},,
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},
],
scrapReason: [
{ required: true, message: "报废原因不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},,
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},
],
affiliation: [
{ required: true, message: "所在单位不能为空", trigger: "blur" },
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},,
{
pattern: /^[^\s]+$/,
message: '禁止包含空格',
trigger: 'blur',
},
],
proofMaterial: [
// 证明材料字段为非必填
],
},
});
@@ -755,74 +741,293 @@ const { queryParams, form, rules } = toRefs(data);
const openArchiveSelector = (index) => {
archiveSelectorRef.value.showSelector();
ListIndex.value = index - 1;
// console.log("待出库查询",archiveSelectorRef.value)
};
const UNIT_TYPES = {
BOX: "BOX",
PACK: "PACK",
};
const quantityTotals = computed(() => {
return healthcareInventoryDrugoutDetailsList.value.reduce(
(acc, cur) => {
if (!cur) {
return acc;
}
const qty = Number(cur.quantity) || 0;
if (!qty) {
return acc;
}
const unitType = cur.unitType || UNIT_TYPES.BOX;
const ratio = Number(cur.unitQuantity) || 1;
if (unitType === UNIT_TYPES.PACK) {
acc.pack += qty;
acc.total += qty;
} else {
acc.box += qty;
acc.total += qty * ratio;
}
return acc;
},
{ box: 0, pack: 0, total: 0 }
);
});
const outQuantitySummary = computed(() => {
const totals = quantityTotals.value;
const parts = [];
if (totals.box) {
parts.push("箱:" + totals.box);
}
if (totals.pack) {
parts.push("包:" + totals.pack);
}
parts.push("最小单位:" + totals.total);
return parts.join(' / ');
});
// 计算药品品种合计
const calculateVarietyTotal = () => {
const total = healthcareInventoryDrugoutDetailsList.value.length;
const total = healthcareInventoryDrugoutDetailsList.value.filter(
(item) => item && item.drugId
).length;
form.value.variety = total;
return total;
};
// 计算出库数量合计
const calculateQuantityTotal = () => {
const total = healthcareInventoryDrugoutDetailsList.value.reduce(
(acc, cur) => {
return acc + (parseFloat(cur.quantity) || 0);
},
0
);
form.value.outQuantity = total;
return total;
};
// 监听出库数量的变化
watchEffect(() => {
const totals = quantityTotals.value;
form.value.outQuantity = totals.total;
form.value.outBoxQuantity = totals.box;
form.value.outPackQuantity = totals.pack;
calculateVarietyTotal();
calculateQuantityTotal();
});
// 处理选中药品档案后的回调
const handleArchiveSelected = (archive) => {
console.log("选中的档案信息", archive);
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].drugId =
archive.archiveId || archive.id;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].medicineName =
archive.medicineName;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].barcode =
archive.barcode;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].manufacturer =
archive.manufacturer;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].outBatch =
archive.batch;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].filingId =
archive.filingId;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].outPointName =
archive.storeroomName;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].expiryDate =
archive.expiryDate;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].retailPrice =
archive.retailPrice;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].outPointId =
archive.storeroomId;
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].remainingQuantity =
archive.boxCount;
if(archive.storeroomId != form.value.outPoint){
proxy.$modal.msgError("出库库房记录与药品库存库记录不一致,请重新选择!");
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].drugId = ""
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].medicineName = ""
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].barcode = ""
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].manufacturer = ""
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].outBatch = ""
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].filingId = ""
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].outPointName = "";
healthcareInventoryDrugoutDetailsList.value[ListIndex.value].remainingQuantity = ""
}
const syncDrugoutDetails = () => {
form.value.healthcareInventoryDrugoutDetailsList =
healthcareInventoryDrugoutDetailsList.value;
};
const ensureUnitMetadata = (row) => {
if (!row) {
return;
}
const normalizeUnit = (n, f) => {
const s = String(n || "").trim();
if (!s || /^\d+$/.test(s)) return f;
return s;
};
row.inventoryUnit = normalizeUnit(row.inventoryUnit || row.unit, "主单位");
row.splitUnit = normalizeUnit(row.splitUnit, "");
row.unitQuantity = Number(row.unitQuantity) || 1;
if (!row.unitType) {
row.unitType = UNIT_TYPES.BOX;
}
const isSplit = String(row.isSplit || '').toUpperCase() === 'Y';
if (row.unitType === UNIT_TYPES.PACK && !row.splitUnit) {
if (isSplit) {
row.splitUnit = "最小单位";
} else {
row.unitType = UNIT_TYPES.BOX;
}
}
row.unit = row.unitType === UNIT_TYPES.PACK
? (row.splitUnit || "最小单位")
: row.inventoryUnit;
};
const formatRemainingInventory = (row) => {
if (!row) {
return "0";
}
const boxNum = Number(row.remainingQuantity ?? row.boxCount ?? 0);
const packNum = Number(row.remainingPackQuantity ?? row.packCount ?? 0);
const parts = [];
if (boxNum) {
parts.push(String(boxNum) + (row.inventoryUnit || ""));
}
if (packNum) {
parts.push(String(packNum) + (row.splitUnit || ""));
}
if (!parts.length) {
return "0";
}
return parts.join(" / ");
};
const getUnitOptions = (row) => {
const options = [];
const normalizeUnit = (n, f) => {
const s = String(n || "").trim();
if (!s || /^\d+$/.test(s)) return f;
return s;
};
const boxName = normalizeUnit(row && row.inventoryUnit, "主单位");
const packName = normalizeUnit(row && row.splitUnit, "最小单位");
options.push({ label: `主单位(${boxName}`, value: UNIT_TYPES.BOX });
const isSplit = String(row?.isSplit || '').toUpperCase() === 'Y';
if (isSplit || (row && row.splitUnit)) {
options.push({ label: `最小单位(${packName}`, value: UNIT_TYPES.PACK });
}
return options;
};
const validateQuantityRule = (row, value, callback) => {
if (!row) {
callback();
return;
}
if (value === null || value === undefined || value === "") {
callback(new Error("出库数量不能为空"));
return;
}
const parsed = Number(value);
if (!Number.isInteger(parsed) || parsed <= 0) {
callback(new Error("数量需为正整数"));
return;
}
ensureUnitMetadata(row);
const available =
row.unitType === UNIT_TYPES.PACK
? Number(row.remainingPackQuantity ?? row.packCount ?? 0)
: Number(row.remainingQuantity ?? row.boxCount ?? 0);
if (available <= 0) {
callback(new Error("当前单位无可用库存"));
return;
}
if (parsed > available) {
callback(
new Error(
row.unitType === UNIT_TYPES.PACK ? "输入数量超过剩余库存" : "输入数量超过剩余库存"
)
);
return;
}
callback();
};
const enforceQuantityBounds = (row) => {
if (!row) {
return;
}
if (row.quantity === null || row.quantity === "" || row.quantity === undefined) {
return;
}
ensureUnitMetadata(row);
let parsed = Number(row.quantity);
if (!Number.isFinite(parsed) || !Number.isInteger(parsed) || parsed <= 0) {
row.quantity = null;
return;
}
const available =
row.unitType === UNIT_TYPES.PACK
? Number(row.remainingPackQuantity ?? row.packCount ?? 0)
: Number(row.remainingQuantity ?? row.boxCount ?? 0);
if (available <= 0) {
row.quantity = null;
return;
}
if (parsed > available) {
row.quantity = available;
} else {
row.quantity = parsed;
}
};
const handleQuantityChange = (row) => {
enforceQuantityBounds(row);
syncDrugoutDetails();
};
const handleQuantityBlur = (row) => {
enforceQuantityBounds(row);
syncDrugoutDetails();
};
const handleUnitChange = (row) => {
ensureUnitMetadata(row);
if (row && row.quantity != null) {
enforceQuantityBounds(row);
}
syncDrugoutDetails();
};
const normalizeDetailRows = () => {
healthcareInventoryDrugoutDetailsList.value.forEach((row) => {
if (!row) {
return;
}
if (row.quantity === "") {
row.quantity = null;
}
row.remainingQuantity =
Number(row.remainingQuantity ?? row.boxCount ?? 0) || 0;
row.remainingPackQuantity =
Number(row.remainingPackQuantity ?? row.packCount ?? 0) || 0;
row.unitQuantity =
Number(row.unitQuantity ?? row.minNumber ?? 1) || 1;
ensureUnitMetadata(row);
});
syncDrugoutDetails();
};
const handleArchiveSelected = (archive) => {
if (archive == null || ListIndex.value == null) {
return;
}
const rowIndex = ListIndex.value;
const detail = healthcareInventoryDrugoutDetailsList.value[rowIndex];
if (!detail) {
return;
}
detail.drugId = archive.archiveId || archive.id || "";
detail.medicineName = archive.medicineName || "";
detail.barcode = archive.barcode || "";
detail.manufacturer = archive.manufacturer || "";
detail.outBatch = archive.batch || "";
detail.filingId = archive.filingId || "";
detail.outPointName = archive.storeroomName || "";
detail.outPointId = archive.storeroomId || "";
detail.expiryDate = archive.expiryDate || "";
detail.retailPrice = archive.retailPrice || "";
detail.remainingQuantity = Number(archive.boxCount ?? 0) || 0;
detail.remainingPackQuantity = Number(archive.packCount ?? 0) || 0;
detail.inventoryUnit = archive.inventoryUnit || detail.inventoryUnit || "";
detail.splitUnit = archive.splitUnit || detail.splitUnit || "";
detail.unitQuantity =
Number(archive.unitQuantity ?? archive.minNumber ?? detail.unitQuantity ?? 1) || 1;
detail.isSplit = (archive.isSplit ?? detail.isSplit ?? '').toString();
if (archive.storeroomId && archive.storeroomId !== form.value.outPoint) {
proxy.$modal.msgError("出库库房记录与药品库存库记录不一致,请重新选择!");
detail.drugId = "";
detail.medicineName = "";
detail.barcode = "";
detail.manufacturer = "";
detail.outBatch = "";
detail.filingId = "";
detail.outPointName = "";
detail.outPointId = "";
detail.expiryDate = "";
detail.retailPrice = "";
detail.remainingQuantity = 0;
detail.remainingPackQuantity = 0;
detail.inventoryUnit = "";
detail.splitUnit = "";
detail.unitQuantity = 1;
detail.quantity = null;
normalizeDetailRows();
return;
}
if (detail.unitType === UNIT_TYPES.PACK && !detail.splitUnit) {
detail.unitType = UNIT_TYPES.BOX;
}
detail.quantity = null;
normalizeDetailRows();
};;;
const storeroomList = ref([]);
/** 查询药品出库记录列表 */
function getList() {
@@ -854,8 +1059,10 @@ function reset() {
outCode: null,
outStatus: null,
outType: null,
variety: null,
outQuantity: null,
variety: 0,
outQuantity: 0,
outBoxQuantity: 0,
outPackQuantity: 0,
cffiliation: null,
outPoint: null,
outPerson: null,
@@ -882,6 +1089,7 @@ function reset() {
outBatch: null,
};
healthcareInventoryDrugoutDetailsList.value = [];
syncDrugoutDetails();
proxy.resetForm("drugoutRef");
}
@@ -921,6 +1129,7 @@ function handleUpdate(row) {
healthcareInventoryDrugoutDetailsList.value =
response.data.healthcareInventoryDrugoutDetailsList;
console.log(healthcareInventoryDrugoutDetailsList.value);
normalizeDetailRows();
if (form.value.outStatus === 0) {
isDisabled.value = true;
} else if (form.value.outStatus === 1) {
@@ -931,11 +1140,7 @@ function handleUpdate(row) {
});
}
// 在输入框失去焦点时触发
function handleBlur() {
form.value.healthcareInventoryDrugoutDetailsList =
healthcareInventoryDrugoutDetailsList.value;
}
/** 提交按钮 */
function submitForm() {
@@ -990,7 +1195,7 @@ const handleSave = () => {
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal
.confirm('是否确认删除药品出库记录编号"' + _ids + '"的数据项?')
.confirm('是否确认删除药品出库记录编号 "' + _ids + '" 的数据项?')
.then(function () {
return delDrugout(_ids);
})
@@ -1001,33 +1206,41 @@ function handleDelete(row) {
.catch(() => {});
}
/** 出库详情,用于记录药品出库的详细信息序号 */
/** 出库详情:序号处理函数 */
function rowHealthcareInventoryDrugoutDetailsIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
}
/** 出库详情,用于记录药品出库的详细信息添加按钮操作 */
/** 出库详情添加按钮操作 */
function handleAddHealthcareInventoryDrugoutDetails() {
let obj = {};
obj.drugId = "";
obj.quantity = "";
obj.medicineName = "";
obj.batch = "";
obj.manufacturer = "";
obj.outBatch = "";
obj.barcode = "";
obj.outPointName ="";
obj.filingId = "";
obj.outPointId = "";
obj.expiryDate = "";
obj.retailPrice = "";
obj.remainingQuantity = ""
obj.drugFilings = [];
const obj = {
drugId: "",
quantity: null,
medicineName: "",
batch: "",
manufacturer: "",
outBatch: "",
barcode: "",
outPointName: "",
filingId: "",
outPointId: "",
expiryDate: "",
retailPrice: "",
remainingQuantity: 0,
remainingPackQuantity: 0,
inventoryUnit: "",
splitUnit: "",
unitQuantity: 1,
unitType: UNIT_TYPES.BOX,
unit: "",
drugFilings: [],
};
healthcareInventoryDrugoutDetailsList.value.push(obj);
ensureUnitMetadata(obj);
syncDrugoutDetails();
}
/** 出库详情,用于记录药品出库的详细信息删除按钮操作 */
/** 出库详情删除按钮操作 */
function handleDeleteHealthcareInventoryDrugoutDetails() {
if (checkedHealthcareInventoryDrugoutDetails.value.length == 0) {
proxy.$modal.msgError(
@@ -1044,6 +1257,7 @@ function handleDeleteHealthcareInventoryDrugoutDetails() {
checkedHealthcareInventoryDrugoutDetailss.indexOf(item.index) == -1
);
});
normalizeDetailRows();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -161,16 +161,16 @@
<el-row>
<el-col :span="12">
<el-form-item label="是否医保" prop="isInsured">
<el-select v-model="form.isInsured" placeholder="是否医保" clearable :disabled="true">
<el-select v-model="form.isInsured" placeholder="是否医保" clearable :disabled="!editMode">
<el-option v-for="dict in healthcare_os_insured" :key="dict.value" :label="dict.label"
:value="parseInt(dict.value)"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item v-if="form.isInsured == 0" label="医保率" prop="value">
<el-input @input="calculationWholeTotal()" v-model="form.value" clearable placeholder="请输入医保率"
:disabled="true" />
<el-form-item v-if="form.isInsured == 0" label="报销比率" prop="value">
<el-input @input="calculationWholeTotal()" v-model="form.value" clearable placeholder="请输入报销比率"
:disabled="!editMode" />
</el-form-item>
</el-col>
</el-row>
@@ -439,7 +439,7 @@
},
]">
<el-button width="100%" @click="selectDrugPriceInputButton(item, scope)">
{{ form.prescriptionDetailsList[item][scope.$index].unitPrice.toFixed(2) }}
{{ Number(form.prescriptionDetailsList[item][scope.$index].unitPrice || 0).toFixed(2) }}
</el-button>
</el-form-item>
<!-- -->
@@ -452,7 +452,7 @@
},
]">
<el-button width="100%">
{{ form.prescriptionDetailsList[item][scope.$index].unitPrice.toFixed(2) }}
{{ Number(form.prescriptionDetailsList[item][scope.$index].unitPrice || 0).toFixed(2) }}
</el-button>
</el-form-item>
</template>
@@ -461,7 +461,14 @@
<template #default="scope">
<el-form-item label-width="0px" :prop="`prescriptionDetailsList.${item}.${scope.$index}.totalPrice`"
:rules="[{ required: true, message: '总价不能为空', trigger: 'blur' }]">
{{ form.prescriptionDetailsList[item][scope.$index].totalPrice.toFixed(2) }}
{{
form.isInsured === 0
? ceilPrice(
Number(form.prescriptionDetailsList[item][scope.$index].totalPrice || 0) *
(1 - Number(form.value || 0) / 100)
)
: ceilPrice(form.prescriptionDetailsList[item][scope.$index].totalPrice || 0)
}}
</el-form-item>
</template>
@@ -481,12 +488,21 @@
</el-table>
</el-row>
<!-- 展示总价和 -->
<!-- 查看详情汇总展示 -->
<el-row>
<el-col :span="24">
<div style="text-align: right; margin-top: 20px;color: red">
<span>所有药品总价和: {{ totalPriceSum }} 元</span>
<span>
应收金额:{{ form.isInsured === 0 ? patientPay : ceilPrice(totalPriceSum) }} 元
</span>
<span style="margin-left: 16px; color: #666">
处方总金额:{{ ceilPrice(totalPriceSum) }} 元
</span>
<span v-if="form.isInsured === 0" style="margin-left: 16px; color: #333">
预计报销:{{ Number(currentReimbursement).toFixed(2) }} 元
</span>
</div>
</el-col>
</el-row>
</el-form>
@@ -498,6 +514,11 @@
<el-button type="danger" @click="withdrawal" v-if="form.status == 0 || form.status == 1"
v-hasPermi="['os:patientDiagnosis:returnedMedication']">
驳回</el-button>
<el-button type="warning" @click="startAdjust" v-if="form.status == 1 && !editMode"
v-hasPermi="['os:patientDiagnosis:adjustBasic']">更正</el-button>
<el-button type="primary" @click="saveAdjust" v-if="form.status == 1 && editMode"
v-hasPermi="['os:patientDiagnosis:adjustBasic']">保存更正</el-button>
<el-button @click="cancelAdjust" v-if="form.status == 1 && editMode">取消</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</template>
@@ -516,7 +537,18 @@
<script setup name="PatientDiagnosis">
const dsada = ref()
import { deliverMedicine, delPatientDiagnosis, getPatientDiagnosis, listPatientDiagnosis, returnedMedication } from '@/api/healthcare/outpatientService/patientDiagnosis'
// 价格向上取整到小数点后两位进一法
// 例如: 8.123 8.13, 2.234 2.24, 8.02 8.02, 0.55 0.55
// 先缩放到整数避免浮点精度问题0.55*100=55.0000001 会导致 Math.ceil 错误进位
function ceilPrice(value) {
const num = Number(value)
if (isNaN(num)) return '0.00'
const scaled = Math.round(num * 10000)
const cents = Math.ceil(scaled / 100)
return (cents / 100).toFixed(2)
}
import { adjustBasic, deliverMedicine, delPatientDiagnosis, getPatientDiagnosis, listPatientDiagnosis, returnedMedication } from '@/api/healthcare/outpatientService/patientDiagnosis'
// healthcare/outpatientService/patientDiagnosis
// src\components\Healthcare\OutpatientService\PatientDossier\index.vue
// healthcareOsComplaints DrugArchives
@@ -525,6 +557,10 @@ import DrugInventory from '@/components/Healthcare/OutpatientService/DrugInvento
const { proxy } = getCurrentInstance()
// 汇总展示变量查看详情页
const currentReimbursement = ref(0)
const patientPay = ref(0)
// 新增 选择诊断地址后刷新页面数据--知无涯
onActivated(() => {
// 当组件被激活时刷新数据
@@ -591,6 +627,7 @@ const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const title = ref('')
const editMode = ref(false)
const ListTotalPrice = ref(0)
@@ -726,6 +763,7 @@ function getList() {
function cancel() {
open.value = false
reset()
editMode.value = false
}
// 表单重置
@@ -800,15 +838,58 @@ function handleUpdate(row) {
console.log('处方信息---', form.value)
open.value = true
title.value = '查看患者诊断信息'
// 更新总价和
totalPriceSum.value = form.value.prescriptionDetailsList
.reduce((sum, prescription) => {
return sum + prescription.reduce((innerSum, drug) => innerSum + parseFloat(drug.totalPrice || 0), 0)
}, 0)
.toFixed(2)
editMode.value = false
// 更新总价和(优先用行总价,缺失时用数量*单价回算)
const sumAll = (Array.isArray(form.value.prescriptionDetailsList) ?
form.value.prescriptionDetailsList.reduce((sum, prescription) => {
return sum + prescription.reduce((innerSum, drug) => {
const tp = parseFloat(drug.totalPrice)
if (!isNaN(tp)) return innerSum + tp
const qty = parseFloat(drug.totalQuantity || 0)
const up = parseFloat(drug.unitPrice || 0)
return innerSum + (qty * up)
}, 0)
}, 0) : 0)
totalPriceSum.value = ceilPrice(sumAll)
// 计算本次预计报销与应收
const insured = form.value?.isInsured
const sum = Number(totalPriceSum.value || 0)
if (insured === 0) {
const rate = Number(form.value?.value ?? form.value?.value) / 100
const r = isNaN(rate) ? 0 : rate
// 先计算个人应付(向上取整)
const pay = ceilPrice(sum * (1 - r))
patientPay.value = pay
// 预计报销 = 总价 - 个人应付
currentReimbursement.value = (sum - Number(pay)).toFixed(2)
} else {
currentReimbursement.value = '0.00'
patientPay.value = ceilPrice(sum)
}
})
}
function startAdjust() {
editMode.value = true
proxy.$modal.msgInfo('已进入更正模式:可修改是否医保与报销比率')
}
function cancelAdjust() {
editMode.value = false
}
function saveAdjust() {
const payload = {
patientDiagnosisId: form.value.patientDiagnosisId,
isInsured: form.value.isInsured,
value: form.value.value
}
adjustBasic(payload).then(() => {
proxy.$modal.msgSuccess('更正已保存')
editMode.value = false
getList()
})
}
/** 发药按钮 */
function submitForm() {
// console.log("新增成功", form, form.value);
@@ -857,18 +938,17 @@ function calculationTotal(index, index2) {
// console.log('totalPrice值:', totalPrice.value)
if (!Number.isNaN(totalPrice.value)) {
// 进行 四舍五入 0.00
totalPrice.value = totalPrice.value.toFixed(2)
totalPrice.value = ceilPrice(totalPrice.value)
form.value.prescriptionDetailsList[index][index2].totalPrice = totalPrice
} else {
form.value.prescriptionDetailsList[index][index2].totalPrice = 0
}
// 更新总价和
totalPriceSum.value = form.value.prescriptionDetailsList
totalPriceSum.value = ceilPrice(form.value.prescriptionDetailsList
.reduce((sum, prescription) => {
return sum + prescription.reduce((innerSum, drug) => innerSum + parseFloat(drug.totalPrice || 0), 0)
}, 0)
.toFixed(2)
}, 0))
// console.log('prescriptionDetailsList值:', form.value.prescriptionDetailsList)
}
@@ -965,7 +1045,6 @@ const updateMedicineName = value => {
// 患者 诊断 信息 弹框
import DiagnosisInformation from '@/components/Healthcare/OutpatientService/DiagnosisInformation'
import DiagnosisInformationUse from '@/components/Healthcare/OutpatientService/DiagnosisInformation/use.ts'
import { el } from 'element-plus/es/locales.mjs'
const diagnosisInformationRef = ref(null)

View File

@@ -0,0 +1,381 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="巡检点地址" prop="inspectionPoint">
<el-input
v-model="queryParams.inspectionPoint"
placeholder="请输入巡检点地址"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<el-form-item label="巡检人" prop="inspectorId">
<el-input
v-model="queryParams.inspectorId"
placeholder="请输入巡检人"
clearable
@keyup.enter="handleQuery"
/>
</el-form-item>
<!-- 新增巡检类型字典选择 -->
<el-form-item label="巡检类型" prop="inspectionType">
<el-select v-model="queryParams.inspectionType" placeholder="请选择巡检类型" clearable style="width: 240px">
<el-option v-for="dict in inspection_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="巡检时间" prop="inspectionTime" style="width: 308px">
<el-date-picker
v-model="dateRange"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="Plus"
@click="handleAdd"
v-hasPermi="['inspection:abnormal:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="Edit"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['inspection:abnormal:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="Delete"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['inspection:abnormal:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="Download"
@click="handleExport"
v-hasPermi="['inspection:abnormal:export']"
>导出</el-button>
</el-col>
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="abnormalList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="id" />
<el-table-column label="巡检点地址" align="center" prop="inspectionPoint" />
<el-table-column label="巡检人" align="center" prop="inspectorId" />
<!-- 修改巡检类型显示字典标签 -->
<el-table-column label="巡检类型" align="center" prop="inspectionType">
<template #default="scope">
<dict-tag :options="inspection_type" :value="scope.row.inspectionType" />
</template>
</el-table-column>
<el-table-column label="巡检时间" align="center" prop="inspectionTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.inspectionTime, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column label="巡检图片" align="center" prop="inspectionImg" width="100">
<template #default="scope">
<image-preview :src="scope.row.inspectionImg" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Search" @click="handleUpdate(scope.row)"
v-hasPermi="['inspection:abnormal:query']">查看</el-button>
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['inspection:abnormal:edit']">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['inspection:abnormal:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
v-model:page="queryParams.pageNum"
v-model:limit="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改巡检异常对话框 -->
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
<el-form ref="abnormalRef" :model="form" :rules="rules" label-width="90px">
<el-form-item label="巡检点地址" prop="inspectionPoint">
<el-input v-model="form.inspectionPoint" placeholder="请输入巡检点地址" disabled="true"/>
</el-form-item>
<el-form-item label="巡检人" prop="inspectorId">
<el-input v-model="form.inspectorId" placeholder="请输入巡检人" disabled="true"/>
</el-form-item>
<!-- 新增表单中的巡检类型字典选择 -->
<el-form-item label="巡检类型" prop="inspectionType">
<el-select v-model="form.inspectionType" placeholder="请选择巡检类型" disabled="true">
<el-option v-for="dict in inspection_type" :key="dict.value" :label="dict.label"
:value="parseInt(dict.value)"></el-option>
</el-select>
</el-form-item>
<el-form-item label="巡检时间" prop="inspectionTime">
<el-date-picker clearable
v-model="form.inspectionTime"
type="date" disabled="true"
value-format="YYYY-MM-DD"
placeholder="请选择巡检时间">
</el-date-picker>
</el-form-item>
<el-form-item label="巡检图片" prop="inspectionImg">
<el-upload action="#" :auto-upload="false" :show-file-list="false" :on-change="handleImageUpload">
<template #tip>
<div class="el-upload__tip">
<!-- 展示已上传的图片 -->
<div v-if="form.inspectionImg && typeof form.inspectionImg === 'string'" style="display: flex; flex-wrap: wrap;">
<img
v-for="(url, index) in getFullImageUrls(form.inspectionImg)"
:key="index"
:src="url"
style="max-width: 200px; max-height: 200px; margin: 4px;"
:alt="'巡检图片' + index"
/>
</div>
<!-- 没有图片时显示提示 -->
<span v-else>暂无图片</span>
</div>
</template>
</el-upload>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" disabled="true"/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<!-- <el-button type="primary" @click="submitForm"> </el-button> -->
<el-button @click="cancel"> </el-button>
</div>
</template>
</el-dialog>
</div>
</template>
<script setup name="Abnormal">
import { listAbnormal, getAbnormal, delAbnormal, addAbnormal, updateAbnormal } from "@/api/inspection/abnormal";
import { getCurrentInstance, ref, reactive, toRefs } from 'vue';
import { parseTime } from '@/utils/ruoyi';
import { addWatermarkToImage } from '@/utils/watermark';
import request from '@/utils/request'
const { proxy } = getCurrentInstance();
// 使用全局字典获取方式,保持与其它页面一致
const { inspection_type } = proxy.useDict('inspection_type');
const abnormalList = ref([]);
const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
// 基础路径用于拼接图片完整URL
const baseUrl = import.meta.env.VITE_APP_BASE_API;
const dateRange = ref([]);
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
inspectionPoint: null,
inspectorId: null,
inspectionType: null,
inspectionTime: null,
inspectionImg: null,
},
rules: {
}
});
const { queryParams, form, rules } = toRefs(data);
// 获取图片的完整URL与巡检记录一致
function getFullImageUrls(relativePaths) {
if (!relativePaths) return [];
const paths = typeof relativePaths === 'string' ? relativePaths.split(',') : relativePaths;
return paths.map(path => `${baseUrl}${path.trim()}`);
}
// 处理图片上传,加水印并生成预览(与巡检记录一致)
async function handleImageUpload(file) {
try {
if (!file || !file.raw) {
throw new Error('无效的文件对象');
}
const watermarkText = `${form.value.inspectionPoint || '未命名地点'} ${form.value.inspectionTime || '未设置时间'}`;
const watermarkedFile = await addWatermarkToImage(file.raw, watermarkText, {
font: 'bold 48px Arial',
color: 'rgba(0, 0, 0, 0.7)'
});
const previewUrl = URL.createObjectURL(watermarkedFile);
form.value.inspectionImg = { raw: watermarkedFile, name: watermarkedFile.name, url: previewUrl };
} catch (error) {
console.error('水印处理失败:', error);
proxy.$modal.msgError('图片处理失败: ' + error.message);
}
}
/** 查询巡检异常列表 */
function getList() {
loading.value = true;
queryParams.value.params = {};
proxy.addDateRange(queryParams.value, dateRange.value);
listAbnormal(queryParams.value).then(response => {
abnormalList.value = response.rows;
total.value = response.total;
loading.value = false;
});
}
// 取消按钮
function cancel() {
open.value = false;
reset();
}
// 表单重置
function reset() {
form.value = {
id: null,
inspectionPoint: null,
inspectorId: null,
inspectionType: null,
inspectionTime: null,
inspectionImg: null,
remark: null
};
proxy.resetForm("abnormalRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
dateRange.value = [];
proxy.resetForm("queryRef");
handleQuery();
}
// 多选框选中数据
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.id);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加巡检异常";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const _id = row.id || ids.value
getAbnormal(_id).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改巡检异常";
});
}
/** 提交按钮 */
async function submitForm() {
proxy.$refs["abnormalRef"].validate(async (valid) => {
if (valid) {
try {
// 克隆数据以避免直接修改响应式对象
const dataToSubmit = { ...form.value };
// 如果是新选择的图片对象,先上传到服务器换取字符串路径
if (dataToSubmit.inspectionImg && typeof dataToSubmit.inspectionImg === 'object' && dataToSubmit.inspectionImg.raw) {
const formData = new FormData();
formData.append('file', dataToSubmit.inspectionImg.raw);
const res = await request({
url: '/common/upload',
method: 'post',
data: formData,
headers: { 'Content-Type': 'multipart/form-data' }
});
if (res.code !== 200) {
throw new Error(res.msg || '图片上传失败');
}
// RuoYi 通用上传返回 fileName相对路径后端字段期望 String
dataToSubmit.inspectionImg = res.fileName;
}
if (dataToSubmit.id != null) {
await updateAbnormal(dataToSubmit);
proxy.$modal.msgSuccess("修改成功");
} else {
await addAbnormal(dataToSubmit);
proxy.$modal.msgSuccess("新增成功");
}
open.value = false;
getList();
} catch (error) {
console.error('提交失败:', error);
proxy.$modal.msgError('操作失败: ' + (error.message || '未知错误'));
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const _ids = row.id || ids.value;
proxy.$modal.confirm('是否确认删除巡检异常编号为"' + _ids + '"的数据项?').then(function() {
return delAbnormal(_ids);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => {});
}
/** 导出按钮操作 */
function handleExport() {
proxy.download('inspection/abnormal/export', {
...queryParams.value
}, `abnormal_${new Date().getTime()}.xlsx`)
}
getList();
</script>

View File

@@ -36,7 +36,7 @@
>删除</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button type="success" plain :disabled="multiple" @click="getQRCodes">批量生二维码</el-button>
<el-button type="success" plain :disabled="multiple" @click="getQRCodes">批量生二维码</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button
@@ -55,6 +55,12 @@
<el-table-column label="序号" align="center" prop="id" />
<el-table-column label="巡检点" align="center" prop="inspectionPoint" />
<el-table-column label="巡检要求" align="center" prop="inspectionRequirements" />
<!-- 新增巡检点类型展示 -->
<el-table-column label="巡检点类型" align="center" prop="inspectionPointType">
<template #default="scope">
<dict-tag :options="inspection_point_type" :value="scope.row.inspectionPointType" />
</template>
</el-table-column>
<el-table-column label="巡检点状态" align="center" prop="inspectionStatus">
<template #default="scope">
<el-switch v-model="scope.row.inspectionStatus" :active-value="'1'" :inactive-value="'0'" active-text="开"
@@ -86,6 +92,12 @@
<el-form-item label="巡检要求" prop="inspectionRequirements">
<el-input v-model="form.inspectionRequirements" placeholder="请输入巡检要求" type="textarea" />
</el-form-item>
<!-- 新增巡检点类型选择 -->
<el-form-item label="巡检点类型" prop="inspectionPointType">
<el-select v-model="form.inspectionPointType" placeholder="请选择巡检点类型">
<el-option v-for="dict in inspection_point_type" :key="dict.value" :label="dict.label" :value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="巡检点状态" prop="inspectionStatus">
<el-select v-model="form.inspectionStatus" placeholder="请选择巡检点状态">
<el-option v-for="dict in inspection_point_status" :key="dict.value" :label="dict.label"
@@ -118,6 +130,8 @@ import { ref, onMounted, onUnmounted, nextTick } from "vue";
const { proxy } = getCurrentInstance();
const { inspection_point_status } = proxy.useDict("inspection_point_status");
// 新增:巡检点类型字典
const { inspection_point_type } = proxy.useDict("inspection_point_type");
// 子组件
const qrCodeDownloaderRef = ref(null);
@@ -149,6 +163,10 @@ const data = reactive({
inspectionRequirements: [
{ required: true, message: "巡检要求不能为空", trigger: "blur" }
],
// 新增:类型为必填
inspectionPointType: [
{ required: true, message: "巡检点类型不能为空", trigger: "change" }
],
inspectionStatus: [
{ required: true, message: "巡检点状态不能为空", trigger: "change" }
]
@@ -188,6 +206,8 @@ function reset() {
id: null,
inspectionPoint: null,
inspectionRequirements: null,
// 新增:重置类型字段
inspectionPointType: null,
inspectionStatus: null,
inspectionQrCode: null
};
@@ -296,14 +316,22 @@ function getQRCode(row) {
// 多选二维码
function getQRCodes() {
//console.log(ids.value);
//console.log(inspectionPoint.value);
ids.value.forEach((item, index) => {
qrCodeDownloaderRef.value.generateQRCodeWithTextAndNotifyParent(
item.id + "",
inspectionPoint.value[index]
);
//qrCodeDownloaderRef.value.Download(inspectionPoint.value[index]);
// 防呆:未选择任何项时提示
if (!ids.value || ids.value.length === 0) {
proxy.$modal.msgWarning("请先选择需要生成二维码的巡检点");
return;
}
// 逐个生成二维码文本内容使用巡检点ID字符串下方文字使用巡检点名称
ids.value.forEach((id, index) => {
if (
qrCodeDownloaderRef.value &&
qrCodeDownloaderRef.value.generateQRCodeWithTextAndNotifyParent
) {
qrCodeDownloaderRef.value.generateQRCodeWithTextAndNotifyParent(
String(id),
inspectionPoint.value[index]
);
}
});
}

View File

@@ -84,28 +84,37 @@
placeholder="请选择巡检时间" disabled="true"></el-date-picker>
</el-form-item>
<el-form-item label="巡检图片" prop="inspectionImg">
<el-upload action="#" :auto-upload="false" :show-file-list="false" :on-change="handleImageUpload">
<template #tip>
<div class="el-upload__tip">
<!-- 展示已上传的图片 -->
<div v-if="form.inspectionImg && typeof form.inspectionImg === 'string'" style="display: flex; flex-wrap: wrap;">
<img
v-for="(url, index) in getFullImageUrls(form.inspectionImg)"
:key="index"
:src="url"
style="max-width: 200px; max-height: 200px; margin: 4px;"
:alt="'巡检图片' + index"
/>
<el-upload action="#" :auto-upload="false" :show-file-list="false" :on-change="handleImageUpload">
<template #tip>
<div class="el-upload__tip">
<!-- 展示已上传的图片 -->
<div v-if="form.inspectionImg && typeof form.inspectionImg === 'string'" style="display: flex; flex-wrap: wrap;">
<img
v-for="(url, index) in getFullImageUrls(form.inspectionImg)"
:key="index"
:src="url"
style="max-width: 200px; max-height: 200px; margin: 4px;"
:alt="'巡检图片' + index"
/>
</div>
<!-- 没有图片时显示提示 -->
<span v-else>暂无图片</span>
</div>
<!-- 没有图片时显示提示 -->
<span v-else>暂无图片</span>
</div>
</template>
</el-upload>
</template>
</el-upload>
</el-form-item>
<el-form-item label="备注:" prop="remark" v-if="form.remark != null">
<span>{{ form.remark }}</span>
</el-form-item>
<el-form-item label="创建者:" v-if="form.createBy">
<span>{{ form.createBy }}</span>
</el-form-item>
<el-form-item label="创建时间:" v-if="form.createTime">
<span>{{ parseTime(form.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</el-form-item>
<el-form-item label="更新时间:" v-if="form.updateTime">
<span>{{ parseTime(form.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</el-form-item>
</el-form>
@@ -121,15 +130,15 @@
<script setup name="Record">
//引入新添加方法 --知无涯
import { addWatermarkToImage } from '@/utils/watermark';
import { getCurrentInstance, ref, reactive, toRefs } from 'vue';
import {
listRecord,
getRecord,
delRecord,
addRecord,
delRecord,
getRecord,
listRecord,
updateRecord
} from "@/api/inspection/record";
import { addWatermarkToImage } from '@/utils/watermark';
import { getCurrentInstance, reactive, ref, toRefs } from 'vue';
//时间处理格式
import { parseTime } from '@/utils/ruoyi';

View File

@@ -0,0 +1,211 @@
<template>
<div class="big-screen-wrap">
<div class="header">
<div class="filters">
<el-date-picker v-model="dateRange" type="daterange" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" format="YYYY-MM-DD" value-format="YYYY-MM-DD" />
<el-button type="primary" @click="reloadAll">查询</el-button>
</div>
<div class="cards">
<div class="card">
<div class="label">总巡检次数</div>
<div class="value">{{ total }}</div>
</div>
<div class="card">
<div class="label">期间巡检次数</div>
<div class="value">{{ monthTotal }}</div>
</div>
<div class="card">
<div class="label">覆盖率</div>
<div class="value">{{ (coverage.coverageRate * 100).toFixed(1) }}% ({{ coverage.inspectedCount }}/{{ coverage.totalCount }})</div>
</div>
</div>
</div>
<div class="charts-row">
<div class="chart" ref="barDom"></div>
<div class="chart" ref="pieInspectorDom"></div>
<div class="chart" ref="pieTypeDom"></div>
</div>
<div class="charts-row">
<div class="chart wide" ref="lineDom"></div>
<div class="chart" ref="barTypeDom"></div>
<div class="chart" ref="pieStatusDom"></div>
</div>
<div class="table-wrap">
<el-card>
<template #header>
<span>未巡检点位清单</span>
</template>
<el-table :data="uninspected" height="300">
<el-table-column prop="id" label="ID" width="80" />
<el-table-column prop="inspectionPoint" label="巡检点" />
<el-table-column prop="inspectionPointType" label="类型" width="120" />
<el-table-column prop="inspectionStatus" label="状态" width="120" />
</el-table>
</el-card>
</div>
</div>
</template>
<script setup>
import { ref, onMounted, onUnmounted, nextTick } from 'vue'
import * as echarts from 'echarts'
import { ColumnList, RoundList, listTotal, listmonthTotal, trendDaily, typeProportion, coverage as fetchCoverage, uninspectedPoints, pointTypeCounts, statusDistribution } from '@/api/inspection/report.js'
const dateRange = ref([])
// numbers
const total = ref(0)
const monthTotal = ref(0)
const coverageData = ref({ inspectedCount: 0, totalCount: 0, coverageRate: 0 })
// tables
const uninspected = ref([])
// chart doms
const barDom = ref(null)
const pieInspectorDom = ref(null)
const pieTypeDom = ref(null)
const lineDom = ref(null)
const barTypeDom = ref(null)
const pieStatusDom = ref(null)
let barChart, pieInspectorChart, pieTypeChart, lineChart, barTypeChart, pieStatusChart
const buildParams = () => {
const params = {}
if (dateRange.value && dateRange.value.length === 2) {
params.startTime = dateRange.value[0]
params.endTime = dateRange.value[1]
}
return params
}
const reloadAll = async () => {
const params = buildParams()
// totals
const [totalRes, monthRes, covRes] = await Promise.all([
listTotal(params),
listmonthTotal(params),
fetchCoverage(params)
])
total.value = (totalRes?.data?.data) ?? (totalRes?.data) ?? 0
monthTotal.value = (monthRes?.data?.data) ?? (monthRes?.data) ?? 0
const cov = (covRes?.data?.data) ?? covRes?.data ?? {}
coverageData.value = cov
// charts
const [barRes, pieInspectorRes, pieTypeRes, lineRes, barTypeRes, pieStatusRes] = await Promise.all([
ColumnList(params),
RoundList(params),
typeProportion(params),
trendDaily(params),
pointTypeCounts(params),
statusDistribution()
])
// bar (地点巡检次数)
const barData = (barRes?.data?.data) ?? barRes?.data ?? {}
const barOption = {
title: { text: '地点巡检次数' },
tooltip: {},
xAxis: { type: 'category', data: barData.xAxis || [] },
yAxis: { type: 'value' },
series: [{ type: 'bar', data: barData.seriesData || [] }]
}
barChart && barChart.setOption(barOption)
// pie inspectors
const pieInspectorData = (pieInspectorRes?.data?.data) ?? pieInspectorRes?.data ?? {}
const pieInspectorOption = {
title: { text: '巡检人分布' },
tooltip: { trigger: 'item' },
series: [{ type: 'pie', radius: ['40%', '70%'], data: pieInspectorData.seriesData || [] }]
}
pieInspectorChart && pieInspectorChart.setOption(pieInspectorOption)
// pie types
const pieTypeData = (pieTypeRes?.data?.data) ?? pieTypeRes?.data ?? {}
const pieTypeOption = {
title: { text: '巡检类型占比' },
tooltip: { trigger: 'item' },
series: [{ type: 'pie', radius: ['40%', '70%'], data: pieTypeData.seriesData || [] }]
}
pieTypeChart && pieTypeChart.setOption(pieTypeOption)
// line daily trend
const lineData = (lineRes?.data?.data) ?? lineRes?.data ?? {}
const lineOption = {
title: { text: '按日巡检趋势' },
tooltip: { trigger: 'axis' },
xAxis: { type: 'category', data: lineData.xAxis || [] },
yAxis: { type: 'value' },
series: [{ type: 'line', smooth: true, data: lineData.seriesData || [] }]
}
lineChart && lineChart.setOption(lineOption)
// bar type counts
const barTypeData = (barTypeRes?.data?.data) ?? barTypeRes?.data ?? {}
const barTypeOption = {
title: { text: '类型已巡检点数量' },
tooltip: {},
xAxis: { type: 'category', data: barTypeData.xAxis || [] },
yAxis: { type: 'value' },
series: [{ type: 'bar', data: barTypeData.seriesData || [] }]
}
barTypeChart && barTypeChart.setOption(barTypeOption)
// pie status distribution
const pieStatusData = (pieStatusRes?.data?.data) ?? pieStatusRes?.data ?? {}
const pieStatusOption = {
title: { text: '点位状态分布' },
tooltip: { trigger: 'item' },
series: [{ type: 'pie', radius: ['40%', '70%'], data: pieStatusData.seriesData || [] }]
}
pieStatusChart && pieStatusChart.setOption(pieStatusOption)
// table
const uninspectedRes = await uninspectedPoints(params)
uninspected.value = uninspectedRes?.data?.rows ?? uninspectedRes?.data ?? []
}
onMounted(async () => {
await nextTick()
barChart = echarts.init(barDom.value)
pieInspectorChart = echarts.init(pieInspectorDom.value)
pieTypeChart = echarts.init(pieTypeDom.value)
lineChart = echarts.init(lineDom.value)
barTypeChart = echarts.init(barTypeDom.value)
pieStatusChart = echarts.init(pieStatusDom.value)
reloadAll()
})
onUnmounted(() => {
;[barChart, pieInspectorChart, pieTypeChart, lineChart, barTypeChart, pieStatusChart].forEach(c => {
if (c && c.dispose) c.dispose()
})
})
// 暴露覆盖率方便模板取值
const coverage = {
get inspectedCount() { return coverageData.value.inspectedCount || 0 },
get totalCount() { return coverageData.value.totalCount || 0 },
get coverageRate() { return coverageData.value.coverageRate || 0 }
}
</script>
<style scoped>
.big-screen-wrap { padding: 16px; }
.header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.filters { display: flex; gap: 8px; align-items: center; }
.cards { display: flex; gap: 12px; }
.card { background: #fff; border-radius: 8px; padding: 12px 16px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); min-width: 220px; }
.card .label { font-size: 14px; color: #666; }
.card .value { font-size: 20px; font-weight: 600; margin-top: 4px; }
.charts-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.chart { height: 320px; background: #fff; border-radius: 8px; }
.chart.wide { grid-column: span 2; }
.table-wrap { margin-top: 12px; }
</style>

View File

@@ -10,15 +10,11 @@
v-show="showSearch"
label-width="100px"
>
<el-form-item label="巡检时间" style="width: 308px">
<el-date-picker
v-model="daterangeOccurTime"
value-format="YYYY-MM-DD"
type="daterange"
range-separator="-"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
<el-form-item label="巡检" prop="inspectionPoint">
<el-input v-model="queryParams.inspectionPoint" placeholder="输入巡检点"></el-input>
</el-form-item>
<el-form-item label="巡检人" prop="inspectorId">
<el-input v-model="queryParams.inspectorId" placeholder="输入巡检人姓名"></el-input>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
@@ -27,29 +23,46 @@
</el-form>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="6"></el-col>
<el-col :span="4">
<div class="box1">
<p class="p1">总巡检数</p>
<p class="p2">{{ total }}</p>
</div>
</el-col>
<el-col :span="3"></el-col>
<el-col :span="4">
<div class="box1">
<p class="p1">本月巡检数</p>
<p class="p2">{{ monthTotal }}</p>
</div>
</el-col>
</el-row>
<!-- 总计左柱状巡检点右环形巡检人 -->
<el-row :gutter="24">
<el-col :span="2"></el-col>
<el-col :span="10">
<Histogram :chart-data="histogramData" />
<el-col :span="20">
<el-card shadow="never" class="section-card">
<div class="section-title">总计</div>
<el-row :gutter="16">
<el-col :span="12"><Histogram :chart-data="histogramTotalData" /></el-col>
<el-col :span="12"><CircularDiagram :data="inspectorTotalData" /></el-col>
</el-row>
</el-card>
</el-col>
<el-col :span="12">
<CircularDiagram :data="circularDiagramData"/>
</el-row>
<!-- 本月左柱状巡检点右环形巡检人 -->
<el-row :gutter="24">
<el-col :span="2"></el-col>
<el-col :span="20">
<el-card shadow="never" class="section-card">
<div class="section-title">本月</div>
<el-row :gutter="16">
<el-col :span="12"><Histogram :chart-data="histogramMonthData" /></el-col>
<el-col :span="12"><CircularDiagram :data="inspectorMonthData" /></el-col>
</el-row>
</el-card>
</el-col>
</el-row>
<!-- 本日左柱状巡检点右环形巡检人 -->
<el-row :gutter="24">
<el-col :span="2"></el-col>
<el-col :span="20">
<el-card shadow="never" class="section-card">
<div class="section-title">本日</div>
<el-row :gutter="16">
<el-col :span="12"><Histogram :chart-data="histogramDayData" /></el-col>
<el-col :span="12"><CircularDiagram :data="inspectorDayData" /></el-col>
</el-row>
</el-card>
</el-col>
</el-row>
</div>
@@ -59,70 +72,70 @@
import * as echarts from "echarts";
import Histogram from "@/components/ReportAnalytics/Histogram.vue";
import CircularDiagram from "@/components/ReportAnalytics/reportCircularDiagram.vue"
import { ColumnList, listTotal ,RoundList,listmonthTotal} from "@/api/inspection/report.js";
import { pointStats3, inspectorStats3 } from "@/api/inspection/report.js";
import { ref, reactive, toRefs, getCurrentInstance } from "vue";
const showSearch = ref(true);
const { proxy } = getCurrentInstance();
const total = ref(0);
const monthTotal = ref(0);
const histogramData = ref({ xAxis: [], seriesData: [] });
const circularDiagramData = ref([]);
// 三套柱状数据:总计 / 本月 / 本日(巡检点统计)
const histogramTotalData = ref({ xAxis: [], seriesData: [] });
const histogramMonthData = ref({ xAxis: [], seriesData: [] });
const histogramDayData = ref({ xAxis: [], seriesData: [] });
// 三套环形数据:总计 / 本月 / 本日(巡检人统计)
const inspectorTotalData = ref([]);
const inspectorMonthData = ref([]);
const inspectorDayData = ref([]);
const daterangeOccurTime = ref([]);
// 汇总展示(可选)
const totalPoint = ref(0);
const totalUser = ref(0);
const monthPoint = ref(0);
const monthUser = ref(0);
// const daterangeOccurTime = ref([]);
const data = reactive({
queryParams: {
startTime: null,
endTime: null
endTime: null,
inspectionPoint: '',
inspectorId: ''
}
});
const { queryParams } = toRefs(data);
function getList() {
queryParams.value = {};
if (null != daterangeOccurTime && "" != daterangeOccurTime) {
queryParams.value["startTime"] = daterangeOccurTime.value[0];
queryParams.value["endTime"] = daterangeOccurTime.value[1];
}
// 柱形图请求
ColumnList(queryParams.value).then(response => {
const responseData = response.data;
// monthTotal.value = responseData.monthTotal;
// 赋值给 histogramData
histogramData.value = {
xAxis: responseData.xAxis,
seriesData: responseData.seriesData
queryParams.value = {
inspectionPoint: data.queryParams.inspectionPoint,
inspectorId: data.queryParams.inspectorId
};
// 巡检点统计(三合一:总/月/日)
pointStats3(queryParams.value).then(res => {
const d = res.data || {};
const total = d.total || { xAxis: [], seriesData: [] };
const month = d.month || { xAxis: [], seriesData: [] };
const day = d.day || { xAxis: [], seriesData: [] };
histogramTotalData.value = { xAxis: total.xAxis || [], seriesData: total.seriesData || [] };
histogramMonthData.value = { xAxis: month.xAxis || [], seriesData: month.seriesData || [] };
histogramDayData.value = { xAxis: day.xAxis || [], seriesData: day.seriesData || [] };
totalPoint.value = (histogramTotalData.value.seriesData || []).reduce((a,b)=>a+(b||0),0);
monthPoint.value = (histogramMonthData.value.seriesData || []).reduce((a,b)=>a+(b||0),0);
});
//圆形图请求
RoundList(queryParams.value).then(response => {
circularDiagramData.value = response.data.seriesData.map(item => ({
value: item.value,
name: item.name
}));
console.log(circularDiagramData.value);
// 巡检人统计(三合一:总/月/日)
inspectorStats3(queryParams.value).then(res=>{
const d = res.data || {};
inspectorTotalData.value = (d.total || []).map(i=>({ name:i.name, value:i.value }));
inspectorMonthData.value = (d.month || []).map(i=>({ name:i.name, value:i.value }));
inspectorDayData.value = (d.day || []).map(i=>({ name:i.name, value:i.value }));
// 统计卡片上的“巡检人总次数”汇总
totalUser.value = inspectorTotalData.value.reduce((a,b)=>a+(b.value||0),0);
monthUser.value = inspectorMonthData.value.reduce((a,b)=>a+(b.value||0),0);
});
// 总条数请求
listTotal().then(response => {
total.value = response.data;
}).catch(error => {
console.error("Error fetching total count:", error);
proxy.$message.error("总条数数据获取失败,请稍后再试。");
});
// 本月总条数请求
listmonthTotal(queryParams.value).then(response => {
monthTotal.value = response.data;
}).catch(error => {
console.error("Error fetching monthTotal count:", error);
proxy.$message.error("本月条数数据获取失败,请稍后再试。");
});
// 巡检人统计(三合一:总/月/日)保持不变
}
function handleQuery() {
@@ -130,12 +143,24 @@ function handleQuery() {
}
function resetQuery() {
daterangeOccurTime.value = [];
proxy.resetForm("queryRef");
handleQuery();
}
getList();
// 时间格式工具yyyy-MM-dd HH:mm:ss
function pad(n){ return n < 10 ? '0'+n : ''+n }
function formatDateTime(d){
const y = d.getFullYear();
const m = pad(d.getMonth()+1);
const day = pad(d.getDate());
const hh = pad(d.getHours());
const mm = pad(d.getMinutes());
const ss = pad(d.getSeconds());
return `${y}-${m}-${day} ${hh}:${mm}:${ss}`;
}
</script>
<style lang="scss" scoped>
@@ -143,24 +168,6 @@ getList();
margin-bottom: 20px;
margin-top: 50px;
}
.box1 {
background-color: rgb(187, 187, 187);
width: 200px;
height: 100px;
.p1 {
display: inline-block;
color: #fff;
font-weight: 900;
font-size: larger;
margin-bottom: auto;
margin-top: 20px;
margin-left: 30%;
}
.p2 {
text-align: center;
color: #fff;
margin: auto;
font-size: 22px;
}
}
.section-card { padding: 8px 12px; }
.section-title { font-weight: 600; margin-bottom: 8px; }
</style>

View File

@@ -2,73 +2,71 @@
<div class="login">
<el-form ref="loginRef" :model="loginForm" :rules="loginRules" class="login-form">
<h3 class="title">平安水电后台管理系统</h3>
<el-form-item prop="username">
<el-input
v-model="loginForm.username"
type="text"
size="large"
auto-complete="off"
placeholder="账号"
>
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input
v-model="loginForm.password"
type="password"
size="large"
auto-complete="off"
placeholder="密码"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-input
v-model="loginForm.code"
size="large"
auto-complete="off"
placeholder="验证码"
style="width: 63%"
@keyup.enter="handleLogin"
>
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
<!-- CAS登录模式 -->
<div v-if="settings.casEnable" class="cas-login-container">
<div class="cas-login-info">
<el-icon class="info-icon">
<InfoFilled />
</el-icon>
<p>请使用学校统一身份认证系统登录</p>
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;">
<el-button
:loading="loading"
size="large"
type="primary"
style="width:100%;"
@click.prevent="handleLogin"
>
<span v-if="!loading"> </span>
<span v-else> 中...</span>
<el-button :loading="loading" size="large" type="primary" style="width:100%; margin-top: 20px;"
@click="handleCasLogin">
<span v-if="!loading">学校统一登录</span>
<span v-else>跳转中...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
</div>
</el-form-item>
</div>
<!-- 传统登录模式 -->
<div v-else>
<el-form-item prop="username">
<el-input v-model="loginForm.username" type="text" size="large" auto-complete="off" placeholder="账号">
<template #prefix><svg-icon icon-class="user" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
<el-form-item prop="password">
<el-input v-model="loginForm.password" type="password" size="large" auto-complete="off" placeholder="密码"
@keyup.enter="handleLogin">
<template #prefix><svg-icon icon-class="password" class="el-input__icon input-icon" /></template>
</el-input>
</el-form-item>
<el-form-item prop="code" v-if="captchaEnabled">
<el-input v-model="loginForm.code" size="large" auto-complete="off" placeholder="验证码" style="width: 63%"
@keyup.enter="handleLogin">
<template #prefix><svg-icon icon-class="validCode" class="el-input__icon input-icon" /></template>
</el-input>
<div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img" />
</div>
</el-form-item>
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
<el-form-item style="width:100%;">
<el-button :loading="loading" size="large" type="primary" style="width:100%;" @click.prevent="handleLogin">
<span v-if="!loading"> </span>
<span v-else> 中...</span>
</el-button>
<div style="float: right;" v-if="register">
<router-link class="link-type" :to="'/register'">立即注册</router-link>
</div>
</el-form-item>
</div>
</el-form>
<!-- 底部 -->
<div class="el-login-footer">
<span>Copyright © 2018-2024 ruoyi.vip All Rights Reserved.</span>
<span></span>
</div>
</div>
</template>
<script setup>
import { getCodeImg } from "@/api/login";
import settings from "@/settings";
import useUserStore from '@/store/modules/user';
import { decrypt, encrypt } from "@/utils/jsencrypt";
import { InfoFilled } from '@element-plus/icons-vue';
import Cookies from "js-cookie";
import { encrypt, decrypt } from "@/utils/jsencrypt";
import useUserStore from '@/store/modules/user'
import { onMounted } from 'vue';
const userStore = useUserStore()
const route = useRoute();
@@ -78,7 +76,7 @@ const { proxy } = getCurrentInstance();
const loginForm = ref({
// username: "admin",
// password: "admin123",
username: null,
username: null,
password: null,
rememberMe: false,
code: "",
@@ -102,7 +100,7 @@ const redirect = ref(undefined);
watch(route, (newRoute) => {
redirect.value = newRoute.query && newRoute.query.redirect;
redirect.value = newRoute.query && newRoute.query.redirect;
}, { immediate: true });
function handleLogin() {
@@ -162,8 +160,36 @@ function getCookie() {
};
}
getCode();
getCookie();
// CAS登录处理函数
function handleCasLogin() {
loading.value = true;
// 构建CAS登录URL(带 base 前缀以兼容不同部署路径)
// 使用统一的CAS回调地址,让后端处理设备检测和分发
const casServerUrl = settings.casServerUrl || 'https://cas.example.edu';
const base = import.meta.env?.BASE_URL || '/';
const serviceUrl = encodeURIComponent(window.location.origin + base + 'cas-callback');
const casLoginUrl = `${casServerUrl}/login?service=${serviceUrl}`;
// 跳转到CAS登录页面
window.location.href = casLoginUrl;
}
// 页面加载时检查CAS配置,如果启用则自动跳转
onMounted(() => {
const path = (window.location && window.location.pathname) || '';
if (settings.casEnable && path.startsWith('/cas/')) {
handleCasLogin();
} else {
getCode();
getCookie();
}
});
// 非 CAS 页面或非 CAS 模式下初始化验证码与 cookie
if (!(settings.casEnable && (typeof window !== 'undefined' && window.location && window.location.pathname.startsWith('/cas/')))) {
getCode();
getCookie();
}
</script>
<style lang='scss' scoped>
@@ -175,6 +201,7 @@ getCookie();
background-image: url("../assets/images/login-background.jpg");
background-size: cover;
}
.title {
margin: 0px auto 30px auto;
text-align: center;
@@ -186,32 +213,39 @@ getCookie();
background: #ffffff;
width: 400px;
padding: 25px 25px 5px 25px;
.el-input {
height: 40px;
input {
height: 40px;
}
}
.input-icon {
height: 39px;
width: 14px;
margin-left: 0px;
}
}
.login-tip {
font-size: 13px;
text-align: center;
color: #bfbfbf;
}
.login-code {
width: 33%;
height: 40px;
float: right;
img {
cursor: pointer;
vertical-align: middle;
}
}
.el-login-footer {
height: 40px;
line-height: 40px;
@@ -224,8 +258,38 @@ getCookie();
font-size: 12px;
letter-spacing: 1px;
}
.login-code-img {
height: 40px;
padding-left: 12px;
}
// CAS登录相关样式
.cas-login-container {
text-align: center;
padding: 20px 0;
.cas-login-info {
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 20px;
padding: 15px;
background-color: #f0f9ff;
border: 1px solid #bfdbfe;
border-radius: 6px;
.info-icon {
color: #3b82f6;
margin-right: 8px;
font-size: 16px;
}
p {
margin: 0;
color: #1e40af;
font-size: 14px;
}
}
}
</style>

View File

@@ -70,7 +70,7 @@
</el-form>
<!-- 底部 -->
<div class="el-register-footer">
<span>Copyright © 2018-2024 ruoyi.vip All Rights Reserved.</span>
<span></span>
</div>
</div>
</template>

View File

@@ -5,11 +5,13 @@ import createVitePlugins from './vite/plugins'
// https://vitejs.dev/config/
export default defineConfig(({ mode, command }) => {
const env = loadEnv(mode, process.cwd())
const { VITE_APP_ENV } = env
const { VITE_APP_ENV, VITE_APP_CAS_ENABLE } = env
return {
// 部署生产环境和开发环境下的URL.
base: VITE_APP_ENV === 'production' ? '/' : '/',
// 根据 .env 中的 CAS 开关动态设置 base 路径
// 注意:不要从 src/settings 引入,因为 vite 配置运行在 Node 环境,无法使用 import.meta.env
base: VITE_APP_ENV === 'production' ? ((VITE_APP_CAS_ENABLE === 'true') ? '/cas/' : '/srs/') : '/',
plugins: createVitePlugins(env, command === 'build'),
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias
@@ -26,8 +28,8 @@ export default defineConfig(({ mode, command }) => {
proxy: {
// https://cn.vitejs.dev/config/#server-proxy
'/dev-api': {
target: 'http://localhost:8080', // 测试
// target: 'http://172.16.129.101:8080', // 正式环境
// target: 'http://localhost:8080', // 测试
target: 'http://172.16.129.101:8080', // 正式环境
changeOrigin: true,
rewrite: (p) => p.replace(/^\/dev-api/, '')
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long