申请单打印优化

This commit is contained in:
wuyy 2026-03-16 18:01:58 +08:00
parent db210ef85c
commit e71eb5929f
17 changed files with 228 additions and 552 deletions

View File

@ -40,8 +40,8 @@ export function queryReqDetail(query: Object) {
export function reqPrint(query: Object) {
return request({
url: '/regRequestInfo/print',
method: 'get',
params: query
method: 'post',
data: query
})
}
//作废申请单

View File

@ -1,7 +1,7 @@
import request from '@/utils/request'
// 查询医疗机构列表
export function listhospital(query: Object) {
export function listhospital(query?: Object) {
return request({
url: '/transitdict/hospital/list',
method: 'get',

View File

@ -8,6 +8,14 @@ export function listregdict(query: Object) {
params: query
})
}
// 获取字典最大编码
export function getMaxDictCode(query: Object) {
return request({
url: '/transitdict/regdict/getMaxDictCode',
method: 'get',
params: query
})
}
// 查询字典详细
export function getregdict(regdictId: number) {

View File

@ -347,7 +347,8 @@ aside {
&.is-active {
border-bottom: .125rem solid #1F6DD3 !important;
background-color: #e9f1fb;
background-color: #1F6DD3;
color: #fff;
}
}
}

View File

@ -132,10 +132,10 @@ const handleRowClick = (params: { row: any }) => {
emits('current-change', params.row)
}
const handleCheckboxChange = ({ checked, records }: { checked: boolean, records: any[] }) => {
const handleCheckboxChange = ({ checked, row, records }: { checked: boolean, row: any, records: any[] }) => {
// console.log('选中的数据:', records);
// console.log('是否全选:', checked);
emits('selection-change', records)
emits('selection-change', checked, row, records)
};
// 处理行选择

View File

@ -1,9 +1,9 @@
<template>
<div class="labpat_box">
<el-form :model="labPat" label-width="5rem" label-position="right" class="left-form ">
<!-- <div :class="['sh_box', getColor(lastJgbz)]" v-if="lastJgbz != null && lastJgbz != 0 && lastJgbz != 'C'">
<div :class="['sh_box', getColor(lastJgbz)]" v-if="lastJgbz > 10">
<div class="text">{{ getLableType(lastJgbz) }}</div>
</div> -->
</div>
<el-form-item label="病人来源">
<!-- <el-col :span="16"> -->
<SelectTable v-model:data="labPat.patType" :fields="brlyFields" :table-data="dictData.PT" placeholder=""
@ -32,12 +32,16 @@
@getDataValue="handleFieldChange" />
</el-col>
</el-form-item>
<el-form-item label="生理周期" v-if="labPat.patSex == '2'">
<SelectTable v-model:data="labPat.slzq" :table-data="dictData.SLZQ" placeholder=""
@getDataValue="handleFieldChange" />
</el-form-item>
<el-form-item label="送检医生">
<SelectTable v-model:data="labPat.yhdh" :fields="ysFields" :tableData="userList || []" label="nickName"
value="userName" objKey="userName" :border="true" placeholder="" @getDataValue="handleFieldChange" />
<SelectTable v-model:data="labPat.doctorCode" :tableData="dictData.DOCTOR" placeholder=""
@getDataValue="handleFieldChange" />
</el-form-item>
<el-form-item label="送检科室">
<SelectTable v-model:data="labPat.execDeptCode" :table-data="dictData.DP" placeholder=""
<SelectTable v-model:data="labPat.execDeptCode" :table-data="dictData.DEPT" placeholder=""
@getDataValue="handleFieldChange" />
</el-form-item>
<el-form-item label="床 号">
@ -52,7 +56,6 @@
</el-form-item>
<el-form-item label="登记人员">
<!-- <SelectTable v-model:data="labPat.userName" :table-data="dictData.SRD" placeholder="" :disabled="true" /> -->
<el-input v-model="labPat.userName" disabled />
</el-form-item>
<el-form-item label="登记时间">
@ -96,9 +99,10 @@ const props = defineProps({
},
});
const lastJgbz = ref();
// watch(() => props.labPat, (newVal) => {
// lastValue.value = JSON.stringify(newVal);
// })
watch(() => props.labPat, (newVal: any) => {
lastValue.value = JSON.stringify(newVal);
lastJgbz.value = newVal.status;
})
const emit = defineEmits(['update:labPat']);
@ -141,21 +145,21 @@ const handleFieldChange = async () => {
};
const getLableType = (type: string) => {
const item = lisReqs.value.find((p: any) => p.value === type);
return item ? item.label : '开单';
const item = dictData.value.ZT.find((p: any) => p.value === type);
return item ? item.label : '';
}
const getColor = (type: string) => {
switch (type) {
case '1':
case '10':
return 'cs_color';
case '2':
case '20':
return 'sh_color';
case '3':
case '30':
return 'cb_color';
case '4':
case '40':
return 'eb_color';
case '5':
case '50':
return 'sd_color';
default:
return 'default';
@ -175,7 +179,7 @@ const brdhHandle = () => {
const lisReqs = ref([]);
const userList = ref([]);
onMounted(() => {
const data = { status: '0', del_flag: '0', pageSize: 1000, pageNum: 1 }
@ -183,15 +187,6 @@ onMounted(() => {
userList.value = res.rows;
});
getDicts('lis_req_type').then((resp: any) => {
lisReqs.value = resp.data.map((p: any) => ({
label: p.dictLabel,
value: p.dictValue,
elTagType: p.listClass,
elTagClass: p.cssClass
}))
})
})
</script>

View File

@ -32,21 +32,28 @@
</el-tabs>
<div style="height: calc(60% - 1.875rem)" class="mb5">
<CustomVxeTable :table-data="filterData" :columns="xmColumns" @cell-dblclick="dbRowclick"
keyField='applyid' :scrollYConfig="{ enabled: true, rSize: 30, height: '100%', }"
class="mytable-style">
:cell-style="cellStyle" keyField='applyid'
:scrollYConfig="{ enabled: true, rSize: 30, height: '100%', }" class="mytable-style">
<template #itemclass="{ row }">
{{itemclassList.find((item) => item.itemclassCode == row.itemclass)?.itemclassName}}
</template>
</CustomVxeTable>
</div>
<div style="height: calc(40% - 30px)">
<CustomVxeTable :table-data="sqXmList" :columns="sqXmColumns" keyField='applyid'
:scrollYConfig="{ enabled: true, rSize: 30, height: '100%', }" class="mytable-style">
<template #classid="{ row }">
{{xmdlList.find((item) => item.dictCode == row.classid)?.dictName}}
<CustomVxeTable :table-data="sqXmList" :columns="sqXmColumns" keyField='uid' :cell-style="cellStyle"
:config="tableConfig" :scrollYConfig="{ enabled: true, rSize: 30, height: '100%', }" ref="xmRef"
@selection-change="selectionChange" class="mytable-style">
<template #itemclass="{ row }">
{{itemclassList.find((item) => item.itemclassCode == row.itemclass)?.itemclassName}}
</template>
<template #itemclass_yblx="{ row }">
<SelectTable v-model:data="row.itemclass_yblx" :tableData="dictData.BT" placeholder="请选择"
value="label" class="full-width-input" />
</template>
<template #zt="{ row }">
{{ formatDict(labpat.status, 'ZT') }}
</template>
<template #action="{ row }">
<template #action="{ row }" v-if="labpat.status < 20">
<el-button type="danger" :text='true' size="small" @click="delItem(row)">删除</el-button>
</template>
</CustomVxeTable>
@ -93,8 +100,7 @@
<div class="table-box">
<CustomVxeTable :table-data="labPatList" :loading="loading" :columns="tableColumns"
@current-change="handleRowClick" size="small" keyField='applyid'
:scrollYConfig="{ enabled: true, rSize: 30, height: '100%', }" :row-style="rowStyle"
:cell-style="cellStyle" class="mytable-style" ref="tableRef">
:scrollYConfig="{ enabled: true, rSize: 30, height: '100%', }" class="mytable-style" ref="tableRef">
<template #status="{ row }">
{{ formatDict(row.status, 'ZT') }}
</template>
@ -107,7 +113,7 @@
</div>
</template>
<script setup>
<script setup name="Issueorder">
import Info from './components/info.vue'
import { getDictData, formatDict, dictData } from '@/hooks'
import { getXmItemInfo, saveReqInfo, queryRegRequestInfo, queryReqDetail, reqPrint, cancelReq } from '@/api/liswork/order'
@ -116,8 +122,8 @@ import { ElMessage, ElMessageBox } from 'element-plus'
import { getFirstLetter } from '@/utils/pinyin';
import { listregdict } from "@/api/regional/dict/regdict.ts";
import { checkPrintService } from '@/utils/printHelper.ts';
import { listitemclass } from "@/api/regional/dict/itemclass.ts";
import { classCom } from '@/utils/classCom';
const { proxy } = getCurrentInstance();
const labpat = ref({})
const saveLoading = ref(false)
@ -133,7 +139,7 @@ const today = ref(dayjs().format('YYYY-MM-DD'))
const searchForm = ref({
brxm: '',
status: '',
days: 0,
days: 3,
begdate: '',
enddate: '',
})
@ -150,6 +156,15 @@ const rowStyle = ({ row }) => {
}
const cellStyle = ({ row, column }) => {
if (column.title == "类别") {
const bkcolor = itemclassList.value.find((item) => item.itemclassCode == row.itemclass)?.itemclassBkcolor;
const bgColor = classCom.decimalToHexColor(bkcolor);
const textColor = classCom.getContrastTextColor(bgColor);
return {
backgroundColor: `${bgColor} !important`,
color: textColor,
};
}
}
const rowInfo = ref({})
@ -167,6 +182,7 @@ const handleRowClick = (row) => {
uid: item.uid,
classid: item.classid,
barcode: item.barcode,
itemclass: item.itemclass,
}))
})
}
@ -253,11 +269,29 @@ const deleteHandle = () => {
}
const printHandle = () => {
if (!labpat.value.applyid) return ElMessage.warning('请选择要打印的申请单!')
let arr = xmRef.value.allSelection().map(item => {
return {
applyId: item.applyid,
barcode: item.barcode,
}
})
const uniqueData = [];
const tempObj = {}; // 记录已出现的 barcode
arr.forEach(item => {
// 若 tempObj 中无该 barcode,则保留并记录
if (!tempObj[item.barcode]) {
tempObj[item.barcode] = true;
uniqueData.push(item);
}
});
if (labpat.value.status > 10) return ElMessage.warning('申请单已审核,不能打印条码!')
if (!uniqueData.length) return ElMessage.warning('请选择要打印的条码!')
checkPrintService().then((isConnected) => {
if (!isConnected) return
reqPrint({ applyId: labpat.value.applyid }).then(res => {
reqPrint(uniqueData).then(res => {
if (res.code == 0) {
handleQuery()
ElMessage.success('正在打印中...')
}
})
@ -269,13 +303,13 @@ const printHandle = () => {
const filterData = ref([])
const xmColumns = ref([
{ field: 'itemcode', title: '代号', align: 'center', resizable: true },
{ field: 'itemname', title: '简称', align: 'center', width: 250, resizable: true },
{ field: 'itemname', title: '简称', align: 'center', width: 280, resizable: true },
{ field: 'dj', title: '单价', align: 'center', resizable: true },
{ field: 'spec', title: '规格', align: 'center', resizable: true },
{ field: 'itemclass', title: '类别', align: 'center', slotName: 'itemclass', resizable: true },
{ field: 'itemclass_tips', title: '采样提示', align: 'center', resizable: true },
{ field: 'itemclass_yblx', title: '样本', align: 'center', resizable: true },
])
const searchList = ref([])
const handleTabClick = (tab) => {
@ -301,7 +335,6 @@ const filterDictData = () => {
const matchLabel = item.pinyin.toString().toLowerCase().includes(key);
return matchLabel;
})
}
const processTableData = (data) => {
@ -315,16 +348,43 @@ const processTableData = (data) => {
const sqXmList = ref([])
const sqXmColumns = ref([
{ field: 'classid', title: '类别', align: 'center', width: 100, slotName: 'classid', resizable: true },
{ type: 'selection', field: '', title: '', resizable: true, align: 'center', width: 40 },
{ field: 'itemclass', title: '类别', align: 'center', width: 100, slotName: 'itemclass', resizable: true },
{ field: 'itemcode', title: '代号', align: 'center', resizable: true },
{ field: 'itemname', title: '简称', align: 'center', width: 150, resizable: true },
{ field: 'barcode', title: '条码号', align: 'center', width: 150, resizable: true },
{ field: 'dj', title: '单价', align: 'center', resizable: true },
{ field: 'spec', title: '规格', align: 'center', resizable: true },
{ field: 'itemclass_yblx', title: '样本', align: 'center', resizable: true },
{ field: 'itemclass_yblx', title: '样本', align: 'center', slotName: 'itemclass_yblx', resizable: true },
{ field: 'zt', title: '状态', align: 'center', resizable: true, slotName: 'zt' },
])
const tableConfig = ref({
// 复选框配置
checkboxConfig: {
// 可选配置项
checkField: 'checked', // 绑定数据中的字段(默认:checked)
range: false, // 是否支持范围选择(按住 Shift 连续选择)
disabled: false, // 是否禁用全部复选框
reserve: false, // 是否保留勾选状态(分页/筛选时)
highlight: false // 是否高亮选中行
}
})
const xmRef = useTemplateRef('xmRef')
const selectionChange = (checked, row, selection) => {
// console.log('==>', checked, row, selection);
sqXmList.value.forEach(item => {
if (row.barcode === item.barcode) {
xmRef.value.toggleRowSelection(item, checked)
}
});
}
const delItem = (row) => {
const index = sqXmList.value.findIndex(item => item.itemcode === row.itemcode)
if (index !== -1) {
@ -333,6 +393,7 @@ const delItem = (row) => {
}
const dbRowclick = ({ row }) => {
if (labpat.value.status > 10) return ElMessage.warning('申请单已审核,不能添加项目!')
const index = sqXmList.value.findIndex(item => item.itemcode == row.itemcode)
if (index > -1) {
ElMessage.warning('已存在该项目')
@ -348,16 +409,21 @@ const getXmList = () => {
})
}
const itemclassList = ref([]) // 容器类别
onMounted(() => {
changeDays(0)
changeDays(3)
getXmList()
getDictData('PT', 'SX', 'AU', 'BT', 'DP', 'ZT', 'ZJLX')
getDictData('PT', 'SX', 'AU', 'ZT', 'ZJLX', 'DEPT', 'DOCTOR', 'SLZQ', 'BT')
listregdict({ dictType: 'CLASS' }).then(response => {
xmdlList.value = response.rows;
activeName.value = xmdlList.value.length > 0 ? xmdlList.value[0].dictCode : '';
handleTabClick({ paneName: activeName.value });
});
listitemclass({ pageSize: 9999, pageNum: 1 }).then(response => {
itemclassList.value = response.rows;
})
})
</script>

View File

@ -0,0 +1,77 @@
<template>
<div class="table-container">
<!-- vxe-table 核心组件 -->
<vxe-table border :data="tableData" :group-config="groupConfig" :expand-config="{ trigger: 'row', showIcon: true }"
style="width: 100%;">
<!-- 时间列:格式化显示 -->
<vxe-column field="createTime" title="创建时间" width="220" :formatter="formatDate" />
<!-- 业务列 -->
<vxe-column field="name" title="订单名称" width="150" />
<vxe-column field="amount" title="订单金额" width="120" />
<vxe-column field="status" title="订单状态" width="120" />
</vxe-table>
</div>
</template>
<script setup>
import { ref, reactive } from 'vue'
// 2. 定义响应式表格数据(包含时间字段)
const tableData = ref([
{ id: 1, name: '订单1', amount: 100, status: '已支付', createTime: '2026-03-15 08:30:00' },
{ id: 2, name: '订单2', amount: 200, status: '已支付', createTime: '2026-03-15 09:40:00' },
{ id: 3, name: '订单3', amount: 150, status: '待支付', createTime: '2026-03-16 10:20:00' },
{ id: 4, name: '订单4', amount: 300, status: '已取消', createTime: '2026-04-15 14:10:00' },
{ id: 5, name: '订单5', amount: 250, status: '已支付', createTime: '2026-04-16 15:30:00' }
])
// 3. 时间格式化方法
const formatDate = ({ cellValue }) => {
return cellValue
// 格式化时间为:年-月-日 时:分:秒
// return xeUtils.toDateString(cellValue, 'yyyy-MM-dd HH:mm:ss')
}
// 4. 分组配置(核心:按时间分组)
const groupConfig = reactive({
// 分组字段配置
fields: [
{
field: 'createTime', // 要分组的原始字段
// 分组标题显示格式
formatter: ({ cellValue }) => {
// 分组行显示:xxxx年xx月xx日
const date = xeUtils.toDate(cellValue)
return `${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日`
},
// 分组判断逻辑(核心:返回相同值则归为一组)
getter: ({ cellValue }) => {
// 👉 按需修改分组粒度:
// 按【日】分组(默认):return xeUtils.toDateString(cellValue, 'yyyy-MM-dd')
// 按【月】分组:return xeUtils.toDateString(cellValue, 'yyyy-MM')
// 按【年】分组:return xeUtils.toDateString(cellValue, 'yyyy')
return xeUtils.toDateString(cellValue, 'yyyy-MM-dd')
}
}
],
showGroup: true, // 显示分组汇总行
showFooter: true, // 显示分组脚注
expandAll: true, // 默认展开所有分组
// 可选:分组汇总行的自定义内容
groupMethod: ({ rows, field }) => {
if (field === 'createTime') {
// 计算当前分组的金额总和
const total = rows.reduce((sum, item) => sum + item.amount, 0)
return { amount: `合计:${total} 元` }
}
return ''
}
})
</script>
<style scoped>
.table-container {
padding: 20px;
}
</style>

View File

@ -103,7 +103,7 @@
</div>
</template>
<script setup lang="ts">
<script setup lang="ts" name="Bbcx">
import CustomTable from '@/components/elTable/index.vue'
import { querySample } from '@/api/regional/index'
import SelectTable from '@/components/SelectTable/index.vue';

View File

@ -77,7 +77,7 @@
</div>
</template>
<script setup lang="ts">
<script setup lang="ts" name="Bbqs">
import CustomTable from '@/components/elTable/index.vue'
import { querySampleSign, sampleSign } from '@/api/regional/index'
import SelectTable from '@/components/SelectTable/index.vue';

View File

@ -77,7 +77,7 @@
</div>
</template>
<script setup lang="ts">
<script setup lang="ts" name="Bbth">
import CustomTable from '@/components/elTable/index.vue'
import { querySampleSignBack, sampleSign } from '@/api/regional/index'
import SelectTable from '@/components/SelectTable/index.vue';

View File

@ -125,7 +125,7 @@
</div>
</template>
<script setup>
<script setup name="Mzcy">
import {
querySQD,
queryPatList,

View File

@ -86,7 +86,7 @@
</div>
</template>
<script setup lang="ts">
<script setup lang="ts" name="Sjdj">
import CustomTable from '@/components/elTable/index.vue'
import { querySample, sampleSign } from '@/api/regional/index'
// @ts-ignore

View File

@ -118,7 +118,7 @@
<img class="timg" src="@/assets/images/yjt.png" alt="">
</div>
<div :class="['timeline-content', i > lastTimeIndex ? 'no_active' : '']">
<div :class="['index', lastTimeIndex == i ? 'active' : '']">{{ i + 1 }}</div>
<div :class="['index', lastTimeIndex == i ? 'active' : '']">{{ Number(i) + 1 }}</div>
<div class="timeline-title">{{ item.title }}</div>
<div class="timeline-time">{{ item.time }}</div>
</div>
@ -159,28 +159,24 @@
</div>
</template>
<script setup lang="ts">
import { ref, reactive, toRaw, computed, watch, nextTick, onMounted, } from 'vue';
import { HiprintPrinter } from '@/utils/hiprintPrinter';
<script setup lang="ts" name="Zycy">
import { classCom } from '@/utils/classCom';
import CustomTable from '@/components/elTable/index.vue'
import { useRouter } from 'vue-router'
import { usePrintStore } from '@/store/modules/printStore'
import { fetchCodeList, addObj, fetchCodeDetail, fetchCodeExec, fetchCodeReqmain, printSendSample, printsetup } from '@/api/checkCode/index'
// @ts-ignore
import { listhospital } from "@/api/regional/dict/hospital.ts";
import { listhospital } from "@/api/regional/dict/hospital";
const aotuSize = classCom.useAutoSize();
//@ts-ignore
import useUserStore from '@/store/modules/user'
import { comDict } from '@/utils/dict'
import SelectTable from '@/components/SelectTable/index.vue';
import { ElMessage, ElMessageBox } from 'element-plus'
// @ts-ignore
import iFrame from "@/components/iFrame/index.vue";
import { checkPrintService } from '@/utils/printHelper';
const router = useRouter()
const printStore = usePrintStore();
const printerList = computed(() => printStore.printerList);
const printName = ref(printStore.defaultPrinter || '');
const userStore = useUserStore()
const compactForm = ref<HTMLElement | null>(null);
const heightForm = ref(90);
const dialogVisible = ref(false)
@ -202,7 +198,7 @@ const queryParams = reactive<QueryParams>({
userid: '',
yljg: '1',
zt: '',
SrcHospName: '',
SrcHospName: userStore.sysLoginParam.loginYLJGName,
failed4: '',
failed5: '',
});

View File

@ -1,238 +0,0 @@
/**
* @file index.vue 科室列表
* @author: w
* @since: 2026-03-12
*/
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
<el-form-item label="科室编码" prop="hospitalCode">
<el-input v-model="queryParams.hospitalCode" placeholder="请输入科室编码" clearable style="width: 200px"
@keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="科室名称" prop="hospitalName">
<el-input v-model="queryParams.hospitalName" placeholder="请输入科室名称" clearable style="width: 200px"
@keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="有效状态" clearable style="width: 200px">
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
</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>
</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">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
</el-col> -->
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange"
height="calc(100vh - 250px)">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="hospitalId" />
<el-table-column label="科室编码" align="center" prop="hospitalCode" />
<el-table-column label="科室名称" align="center" prop="hospitalName" />
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</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="35vw" append-to-body>
<el-form ref="postRef" :model="form" :rules="rules" label-width="150px">
<el-form-item label="科室名称" prop="hospitalName">
<el-input v-model="form.hospitalName" placeholder="请输入科室名称" />
</el-form-item>
<el-form-item label="科室编码" prop="hospitalCode">
<el-input v-model="form.hospitalCode" placeholder="请输入编码名称" />
</el-form-item>
<el-form-item label="科室状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label
}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</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="hospital">
import { listhospital, addhospital, delhospital, gethospital, updatehospital } from "@/api/regional/dict/hospital.ts";
import { getComDicts } from "@/api/liswork/dict/ComDict";
import { fa } from "element-plus/es/locales.mjs";
const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const postList = ref([]);
const open = ref(false);
const loading = ref(false);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const yljbList = ref([]);
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
hospitalCode: undefined,
hospitalName: undefined,
status: undefined
},
rules: {
hospitalName: [{ required: true, message: "科室名称不能为空", trigger: "blur" }],
hospitalCode: [{ required: true, message: "科室编码不能为空", trigger: "blur" }],
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询科室列表 */
function getList() {
// loading.value = true;
// listhospital(queryParams.value).then(response => {
// postList.value = response.rows;
// total.value = response.total;
// loading.value = false;
// });
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
hospitalId: undefined,
hospitalCode: undefined,
hospitalName: undefined,
hospitalUserinfo: undefined,
status: "0",
remark: undefined
};
proxy.resetForm("postRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.hospitalId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加科室";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const hospitalId = row.hospitalId || ids.value;
gethospital(hospitalId).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改科室";
});
}
/** 提交按钮 */
function submitForm() {
return
proxy.$refs["postRef"].validate(valid => {
if (valid) {
if (form.value.hospitalId != undefined) {
updatehospital(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addhospital(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const hospitalIds = row.hospitalId || ids.value;
proxy.$modal.confirm('是否确认删除科室编号为"' + hospitalIds + '"的数据项?').then(function () {
return delhospital(hospitalIds);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => { });
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("transitdict/hospital/export", {
...queryParams.value
}, `hospital_${new Date().getTime()}.xlsx`);
}
getList();
onMounted(() => {
getComDicts({ dict_type: 'HTYPE' }).then(response => {
yljbList.value = response.data;
});
})
</script>

View File

@ -1,238 +0,0 @@
/**
* @file index.vue 医生列表
* @author: w
* @since: 2026-03-12
*/
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
<el-form-item label="医生编码" prop="hospitalCode">
<el-input v-model="queryParams.hospitalCode" placeholder="请输入医生编码" clearable style="width: 200px"
@keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="医生名称" prop="hospitalName">
<el-input v-model="queryParams.hospitalName" placeholder="请输入医生名称" clearable style="width: 200px"
@keyup.enter="handleQuery" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="有效状态" clearable style="width: 200px">
<el-option v-for="dict in sys_normal_disable" :key="dict.value" :label="dict.label" :value="dict.value" />
</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>
</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">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="warning" plain icon="Download" @click="handleExport">导出</el-button>
</el-col> -->
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange"
height="calc(100vh - 250px)">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" align="center" prop="hospitalId" />
<el-table-column label="医生编码" align="center" prop="hospitalCode" />
<el-table-column label="医生名称" align="center" prop="hospitalName" />
<el-table-column label="状态" align="center" prop="status">
<template #default="scope">
<dict-tag :options="sys_normal_disable" :value="scope.row.status" />
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template #default="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" align="center" class-name="small-padding fixed-width">
<template #default="scope">
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</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="35vw" append-to-body>
<el-form ref="postRef" :model="form" :rules="rules" label-width="150px">
<el-form-item label="医生名称" prop="hospitalName">
<el-input v-model="form.hospitalName" placeholder="请输入医生名称" />
</el-form-item>
<el-form-item label="医生编码" prop="hospitalCode">
<el-input v-model="form.hospitalCode" placeholder="请输入编码名称" />
</el-form-item>
<el-form-item label="医生状态" prop="status">
<el-radio-group v-model="form.status">
<el-radio v-for="dict in sys_normal_disable" :key="dict.value" :value="dict.value">{{ dict.label
}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</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="hospital">
import { listhospital, addhospital, delhospital, gethospital, updatehospital } from "@/api/regional/dict/hospital.ts";
import { getComDicts } from "@/api/liswork/dict/ComDict";
import { fa } from "element-plus/es/locales.mjs";
const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
const postList = ref([]);
const open = ref(false);
const loading = ref(false);
const showSearch = ref(true);
const ids = ref([]);
const single = ref(true);
const multiple = ref(true);
const total = ref(0);
const title = ref("");
const yljbList = ref([]);
const data = reactive({
form: {},
queryParams: {
pageNum: 1,
pageSize: 10,
hospitalCode: undefined,
hospitalName: undefined,
status: undefined
},
rules: {
hospitalName: [{ required: true, message: "医生名称不能为空", trigger: "blur" }],
hospitalCode: [{ required: true, message: "医生编码不能为空", trigger: "blur" }],
}
});
const { queryParams, form, rules } = toRefs(data);
/** 查询医生列表 */
function getList() {
// loading.value = true;
// listhospital(queryParams.value).then(response => {
// postList.value = response.rows;
// total.value = response.total;
// loading.value = false;
// });
}
/** 取消按钮 */
function cancel() {
open.value = false;
reset();
}
/** 表单重置 */
function reset() {
form.value = {
hospitalId: undefined,
hospitalCode: undefined,
hospitalName: undefined,
hospitalUserinfo: undefined,
status: "0",
remark: undefined
};
proxy.resetForm("postRef");
}
/** 搜索按钮操作 */
function handleQuery() {
queryParams.value.pageNum = 1;
getList();
}
/** 重置按钮操作 */
function resetQuery() {
proxy.resetForm("queryRef");
handleQuery();
}
/** 多选框选中数据 */
function handleSelectionChange(selection) {
ids.value = selection.map(item => item.hospitalId);
single.value = selection.length != 1;
multiple.value = !selection.length;
}
/** 新增按钮操作 */
function handleAdd() {
reset();
open.value = true;
title.value = "添加医生";
}
/** 修改按钮操作 */
function handleUpdate(row) {
reset();
const hospitalId = row.hospitalId || ids.value;
gethospital(hospitalId).then(response => {
form.value = response.data;
open.value = true;
title.value = "修改医生";
});
}
/** 提交按钮 */
function submitForm() {
return
proxy.$refs["postRef"].validate(valid => {
if (valid) {
if (form.value.hospitalId != undefined) {
updatehospital(form.value).then(response => {
proxy.$modal.msgSuccess("修改成功");
open.value = false;
getList();
});
} else {
addhospital(form.value).then(response => {
proxy.$modal.msgSuccess("新增成功");
open.value = false;
getList();
});
}
}
});
}
/** 删除按钮操作 */
function handleDelete(row) {
const hospitalIds = row.hospitalId || ids.value;
proxy.$modal.confirm('是否确认删除医生编号为"' + hospitalIds + '"的数据项?').then(function () {
return delhospital(hospitalIds);
}).then(() => {
getList();
proxy.$modal.msgSuccess("删除成功");
}).catch(() => { });
}
/** 导出按钮操作 */
function handleExport() {
proxy.download("transitdict/hospital/export", {
...queryParams.value
}, `hospital_${new Date().getTime()}.xlsx`);
}
getList();
onMounted(() => {
getComDicts({ dict_type: 'HTYPE' }).then(response => {
yljbList.value = response.data;
});
})
</script>

View File

@ -69,7 +69,7 @@
<el-form ref="regdictRef" :model="form" :rules="rules" label-width="150px">
<el-form-item :label="`${menuname}编码`" prop="dictCode">
<el-input v-model="form.dictCode" :placeholder="`请输入${menuname}编码名称`" />
<el-input v-model="form.dictCode" disabled />
</el-form-item>
<el-form-item :label="`${menuname}名称`" prop="dictName">
<el-input v-model="form.dictName" :placeholder="`请输入${menuname}名称`" />
@ -99,7 +99,7 @@
</template>
<script setup name="regdict">
import { listregdict, addregdict, delregdict, getregdict, updateregdict } from "@/api/regional/dict/regdict.ts";
import { listregdict, addregdict, delregdict, getregdict, updateregdict, getMaxDictCode } from "@/api/regional/dict/regdict.ts";
const { proxy } = getCurrentInstance();
const { sys_normal_disable } = proxy.useDict("sys_normal_disable");
@ -176,9 +176,16 @@ function handleSelectionChange(selection) {
single.value = selection.length != 1;
multiple.value = !selection.length;
}
const getMaxCode = () => {
getMaxDictCode({ dictType: queryParams.value.dictType }).then(response => {
form.value.dictCode = response.data;
});
}
/** 新增按钮操作 */
function handleAdd() {
reset();
getMaxCode()
open.value = true;
title.value = "添加" + menuname.value;
}
@ -236,4 +243,6 @@ function getTypes(dictType, typeName) {
menuname.value = typeName;
getList();
}
</script>