461 lines
15 KiB
Vue
461 lines
15 KiB
Vue
<template>
|
|
<div class="app-container">
|
|
<a-form :model="queryForm" ref="queryFormRef" layout="inline">
|
|
|
|
<a-form-item field="product_name" label="药品名称">
|
|
<a-input :style="{ width: '182px' }" v-model="queryForm.product_name" placeholder="请输入药品名称" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
<a-form-item field="common_name" label="通用名称">
|
|
<a-input :style="{ width: '182px' }" v-model="queryForm.common_name" placeholder="请输入药品通用名称" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
<a-form-item field="mnemonic_code" label="助记编码">
|
|
<a-input :style="{ width: '182px' }" v-model="queryForm.mnemonic_code" placeholder="请输入药品助记码" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
|
|
<a-form-item field="product_pharmacy_code" label="药店编码">
|
|
<a-input :style="{ width: '182px' }" v-model="queryForm.product_pharmacy_code" placeholder="请输入药品编码" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
<a-form-item field="pharmacy_id" label="所属药房">
|
|
<a-select v-model="queryForm.pharmacy_id" placeholder="请选择所属药房" allow-clear allow-search :style="{ width: '182px' }">
|
|
<a-option v-for="item in pharmacyList" :key="item.pharmacy_id" :value="item.pharmacy_id">
|
|
{{ item.pharmacy_name }}
|
|
</a-option>
|
|
</a-select>
|
|
</a-form-item>
|
|
<a-form-item field="pharmacy_code" label="药房编码">
|
|
<a-input :style="{ width: '182px' }" v-model="queryForm.pharmacy_code" placeholder="请输入药房编码" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
<a-form-item field="manufacturer" label="生产企业">
|
|
<a-input :style="{ width: '182px' }" v-model="queryForm.manufacturer" placeholder="请输入生产企业" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
<a-form-item field="license_number" label="批准文号">
|
|
<a-input :style="{ width: '182px' }" v-model="queryForm.license_number" placeholder="请输入批准文号" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
<a-form-item field="product_platform_code" label="处方编码">
|
|
<a-input :style="{ width: '182px' }" v-model="queryForm.product_platform_code
|
|
" placeholder="请输入处方平台编码" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
<a-form-item field="product_platform_id" label="平台药品id">
|
|
<a-input :style="{ width: '170px' }" v-model="queryForm.product_platform_id
|
|
" placeholder="请输入平台药品id" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
<a-form-item field="product_remarks" label="药品备注">
|
|
<a-input :style="{ width: '182px' }" v-model="queryForm.product_remarks
|
|
" placeholder="请输入药品备注" @press-enter="handleQuery" />
|
|
</a-form-item>
|
|
<a-form-item field="order.stock" label="库存排序">
|
|
<a-select v-model="queryForm.order.stock" placeholder="请选择库存排序" :style="{ width: '182px' }">
|
|
<a-option value="asc">正序</a-option>
|
|
<a-option value="desc">倒序</a-option>
|
|
</a-select>
|
|
</a-form-item>
|
|
<a-form-item field="product_type" label="药品类型">
|
|
<a-select v-model="queryForm.product_type" placeholder="请选择药品类型" :style="{ width: '182px' }">
|
|
<a-option :value="0">未知</a-option>
|
|
<a-option :value="1">中成药</a-option>
|
|
<a-option :value="2">西药</a-option>
|
|
</a-select>
|
|
</a-form-item>
|
|
<a-form-item>
|
|
<a-space>
|
|
<a-button type="primary" @click="handleQuery"><icon-search /> 搜索</a-button>
|
|
<a-button @click="handleResetQuery"><icon-loop /> 重置</a-button>
|
|
</a-space>
|
|
</a-form-item>
|
|
</a-form>
|
|
|
|
<a-divider />
|
|
|
|
<!-- action -->
|
|
<div class="action">
|
|
<a-space>
|
|
<a-button v-has="'admin:sysMedinceList:add'" type="primary" @click="handleAdd"><icon-plus /> 新增</a-button>
|
|
<!-- <a-button v-has="'admin:sysMedinceList:remove'" type="primary" status="danger" @click="handleAdd"><icon-delete /> 删除 </a-button> -->
|
|
<a-button v-has="'admin:sysMedinceList:selectExport'" type="primary" @click="handlExport(2)"><icon-export /> 选择数据导出 </a-button>
|
|
<a-button v-has="'admin:sysMedinceList:searchExport'" type="primary" @click="handlExport(1)"><icon-export /> 当前搜索全部导出</a-button>
|
|
<a-button v-has="'admin:sysMedinceList:allExport'" type="primary" @click="handlExport(3)"><icon-export /> 全部导出</a-button>
|
|
</a-space>
|
|
</div>
|
|
|
|
<!-- table -->
|
|
<a-table :columns="columns" :data="tableData"
|
|
:scroll="{ x: 2000 }"
|
|
:row-selection="{ type: 'checkbox', showCheckedAll: true }"
|
|
:pagination="{ 'show-total': true, 'show-jumper': true, 'show-page-size': true, total: pager.total, current: currentPage }"
|
|
row-key="product_id" @selection-change="(selection) => {deleteData = selection;console.log(selection)}"
|
|
@page-change="handlePageChange" @page-size-change="handlepage_sizeChange">
|
|
<template #doctor_id="{record,rowIndex}">
|
|
<div>{{(rowIndex+1)+(pager.page-1)*pager.page_size}}</div>
|
|
</template>
|
|
<template #pharmacy_name="{record}">
|
|
<div>{{ record.pharmacy_name || '-' }}</div>
|
|
<div v-if="record.pharmacy_code" style="font-size: 12px; color: #86909c;">
|
|
{{ record.pharmacy_code }}
|
|
</div>
|
|
</template>
|
|
<template #product_status="{record}">
|
|
<a-tag v-if="record.product_status == 1" color="green">{{formatProductStatus(record.product_status)}}</a-tag>
|
|
<a-tag v-else-if="record.product_status == 2" color="red">{{formatProductStatus(record.product_status)}}</a-tag>
|
|
|
|
</template>
|
|
<template #action="{ record }">
|
|
<a-space>
|
|
<a-button v-has="'admin:sysMedinceList:detail'" type="text"
|
|
@click="handleDetail(record,'detail')"><icon-book />详情</a-button>
|
|
<a-button v-has="'admin:sysMedinceList:edit'" type="text"
|
|
@click="handleDetail(record,'edit')"><icon-edit />修改</a-button>
|
|
<!-- <a-button v-has="'admin:sysMedinceList:edit'" type="text" @click="handleUpdate(record)"><icon-edit />
|
|
修改</a-button> -->
|
|
<!-- <a-button v-has="'admin:sysMedinceList:remove'" type="text"
|
|
@click="() => { deleteVisible = true; deleteData = [record.doctor_id]; }"><icon-delete /> 删除</a-button> -->
|
|
</a-space>
|
|
</template>
|
|
</a-table>
|
|
|
|
<sysmedinceDetailModal :modalVisible="modalVisible" :modalForm="modalForm" @freshList="getMedinceInfo({ ...pager, ...queryForm })" :modalSatus="modalSatus" @familyVisibleChange="familyVisibleChange" :modalTitle="modalTitle"></sysmedinceDetailModal>
|
|
<!-- Akiraka 20230223 删除与批量删除 开始 -->
|
|
<!-- <DeleteModal :data="deleteData" :visible="deleteVisible" :apiDelete="removeFamily"
|
|
@deleteVisibleChange="() => deleteVisible = false" /> -->
|
|
<!-- Akiraka 20230223 删除与批量删除 结束 -->
|
|
<a-modal v-model:visible="okVisible" :modal-style="{width:'320px'}" body-class="okmodal"
|
|
@cancel="()=>okVisible=false">
|
|
<template #title>
|
|
提示
|
|
</template>
|
|
<div>确定保存当前信息?</div>
|
|
</a-modal>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { reactive, ref, getCurrentInstance, onMounted, nextTick, watch, computed } from 'vue';
|
|
import { getSysMedinceList,getSysMedinceDetail,exportProduct} from '@/api/medince/list';
|
|
import { getPharmacyList } from '@/api/basic/pharmacy';
|
|
import { downloadFile } from '@/utils/downloadFile';
|
|
import {formatProductStatus} from '@/utils/format';
|
|
const pharmacyList = ref([]);
|
|
// Akiraka 20230210 删除数据
|
|
const deleteData = ref([])
|
|
// Akiraka 20230210 删除对话框
|
|
const deleteVisible = ref(false)
|
|
// Akiraka 20230210 监听删除事件
|
|
const okVisible = ref(false);
|
|
const lock= ref(false);
|
|
|
|
watch(() => deleteVisible.value, (value) => {
|
|
if (value == false) {
|
|
getMedinceInfo(pager);
|
|
}
|
|
});
|
|
|
|
const file = ref();
|
|
const { proxy } = getCurrentInstance();
|
|
const currentPage = ref(1);
|
|
|
|
|
|
// Pager
|
|
const pager = {
|
|
total: 0,
|
|
page: 1,
|
|
page_size: 10,
|
|
};
|
|
// form
|
|
const queryForm = reactive({
|
|
pharmacy_id: undefined,
|
|
pharmacy_code: '',
|
|
order:{
|
|
stock:''
|
|
}
|
|
});
|
|
const modalForm = reactive({
|
|
user:{},
|
|
avatar: 'https://img.applets.igandanyiyuan.com/basic/file/patient_avatar.png',
|
|
|
|
});
|
|
watch(() => queryForm.create_range_time,
|
|
(value) => {
|
|
if (value) {
|
|
let [startTime, endTime] = value;
|
|
queryForm.created_at = startTime + '&' + endTime;
|
|
} else {
|
|
queryForm.created_at = '';
|
|
}
|
|
}
|
|
);
|
|
// Modal
|
|
const modalVisible = ref(false);
|
|
const modalTitle = ref('默认标题');
|
|
|
|
// Batch Del List
|
|
let batchList = [];
|
|
|
|
// Table Columns
|
|
const columns = [
|
|
{ title: '编号', dataIndex: 'doctor_id', slotName: 'doctor_id', width: '90' },
|
|
{ title: '药品名称', dataIndex: 'product_name',width:200 },
|
|
{ title: '通用名称', dataIndex: 'common_name',width:200 },
|
|
{ title: '规格', dataIndex: 'product_spec',width:200 },
|
|
{ title: '所属药房', dataIndex: 'pharmacy_name', slotName: 'pharmacy_name', width: 170, ellipsis: true },
|
|
{ title: '单价(元)', dataIndex: 'product_price', slotName: 'product_price',width: 150 },
|
|
{ title: '批准文号', dataIndex: 'license_number',width:200 },
|
|
{ title: '生产厂家', dataIndex: 'manufacturer',width:200 },
|
|
{ title: '药店编码', dataIndex: 'product_pharmacy_code',width:100 },
|
|
{ title: '库存', dataIndex: 'stock',width:100 },
|
|
{ title: '购买上限', dataIndex: 'prescription_num',width:100 },
|
|
{ title: '状态', dataIndex: 'product_status',slotName:'product_status',width:100 },
|
|
// { title: '启用状态', dataIndex: 'status', slotName: 'status' },
|
|
{ title: '操作', slotName: 'action', fixed: "right", width: 180 },
|
|
];
|
|
|
|
// Table Data
|
|
const tableData = ref([]);
|
|
//弹框状态
|
|
const modalSatus = ref('add');
|
|
|
|
// 新增Satus
|
|
const handleAdd = () => {
|
|
modalVisible.value = true;
|
|
modalTitle.value = '新增药品';
|
|
modalSatus.value = 'add';
|
|
modalForm.product_id ='';
|
|
modalForm.pharmacy_id = '';
|
|
modalForm.pharmacy_name = '';
|
|
modalForm.pharmacy_code = '';
|
|
modalForm.frequency_use =null;
|
|
modalForm.available_days =null;
|
|
modalForm.product_name ='';
|
|
modalForm.common_name ='';
|
|
modalForm.product_spec ='';
|
|
modalForm.product_price =null;
|
|
modalForm.license_number ='';
|
|
modalForm.manufacturer ='';
|
|
modalForm.product_pharmacy_code ='';
|
|
modalForm.product_platform_code ='';
|
|
modalForm.stock ='';
|
|
modalForm.prescription_num =null;
|
|
modalForm.single_unit ='';
|
|
modalForm.single_use ='';
|
|
modalForm.packaging_unit ='';
|
|
modalForm.product_status ='';
|
|
modalForm.product_type='';
|
|
};
|
|
|
|
//详情
|
|
const handleDetail = async (record,type) => {
|
|
const { code, data, message } = await getSysMedinceDetail(record.product_id);
|
|
|
|
if (code == 200) {
|
|
Object.assign(modalForm, data);
|
|
if(type=="edit"){
|
|
modalSatus.value = 'edit';
|
|
modalTitle.value = '修改药品';
|
|
}else{
|
|
modalSatus.value = 'detail';
|
|
modalTitle.value = '药品详情';
|
|
}
|
|
modalVisible.value = true;
|
|
|
|
}
|
|
};
|
|
// 批量删除
|
|
const handleBatchDelete = () => {
|
|
if (batchList.length !== 0) {
|
|
proxy.$modal.warning({
|
|
title: '提示',
|
|
content: '是否批量删除以下选中的数据?',
|
|
hideCancel: false,
|
|
onOk: async () => {
|
|
const res = await removeFamily({ ids: batchList });
|
|
proxy.$message.success(res.message);
|
|
getMedinceInfo(pager);
|
|
},
|
|
onCancel: () => {
|
|
proxy.$message.info('已取消批量删除数据');
|
|
},
|
|
});
|
|
} else {
|
|
proxy.$message.error('请勾选需要删除的数据!');
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 分页改变
|
|
* @param {Number} [page]
|
|
*/
|
|
const handlePageChange = (page) => {
|
|
pager.page = page;
|
|
|
|
// 修改当前页码
|
|
currentPage.value = page;
|
|
getMedinceInfo({ ...pager, ...queryForm });
|
|
};
|
|
|
|
// 每页数据量
|
|
const handlepage_sizeChange = (page_size) => {
|
|
pager.page_size = page_size;
|
|
getMedinceInfo({ ...pager, ...queryForm });
|
|
};
|
|
|
|
// 获取患者信息
|
|
const getMedinceInfo = async (params = {}) => {
|
|
const { data, code, message } = await getSysMedinceList(params);
|
|
lock.value=false
|
|
if (code == 200) {
|
|
tableData.value = data.data;
|
|
Object.assign(pager, { total: data.total, page: data.page, page_size: data.page_size });
|
|
}
|
|
};
|
|
|
|
// 查询患者信息
|
|
const handleQuery = async () => {
|
|
pager.page = 1;
|
|
const params = {
|
|
page: pager.page,
|
|
page_size: pager.page_size,
|
|
...queryForm,
|
|
};
|
|
|
|
getMedinceInfo(params);
|
|
};
|
|
|
|
// 重置搜索
|
|
const handleResetQuery = () => {
|
|
proxy.$refs.queryFormRef.resetFields();
|
|
queryForm.pharmacy_id = undefined;
|
|
queryForm.pharmacy_code = '';
|
|
queryForm.order.stock='';
|
|
getMedinceInfo(queryForm);
|
|
}
|
|
const familyVisibleChange=(data)=>{
|
|
modalVisible.value=false;
|
|
}
|
|
const handlExport=async(type)=>{
|
|
proxy.$loading.show();
|
|
let fromData=null;
|
|
if(type==1){
|
|
fromData={
|
|
type,
|
|
...queryForm
|
|
}
|
|
}else if(type==2){
|
|
if(deleteData.value.length==0){
|
|
proxy.$message.warning('请勾选数据');
|
|
proxy.$loading.hide();
|
|
return false;
|
|
};
|
|
let id='';
|
|
deleteData.value.forEach((item)=>{
|
|
if(id){
|
|
id+=","+item
|
|
}else{
|
|
id=item;
|
|
}
|
|
})
|
|
fromData={
|
|
type,
|
|
id
|
|
}
|
|
}else if(type==3){
|
|
fromData={
|
|
type
|
|
}
|
|
}
|
|
const {code,data}=await exportProduct(fromData);
|
|
if(code==200){
|
|
downloadFile(data,'平台药品列表');
|
|
}
|
|
proxy.$loading.hide();
|
|
}
|
|
|
|
// 获取药房下拉数据
|
|
const fetchPharmacyList = async () => {
|
|
try {
|
|
const res = await getPharmacyList();
|
|
if (res.code === 200) {
|
|
pharmacyList.value = res.data || [];
|
|
}
|
|
} catch (e) {
|
|
console.error('获取药房列表异常:', e);
|
|
}
|
|
};
|
|
|
|
onMounted(() => {
|
|
getMedinceInfo(pager);
|
|
fetchPharmacyList();
|
|
});
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.action {
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.okmodal div {
|
|
text-align: center;
|
|
}
|
|
|
|
.hospital_name {
|
|
width: 140px;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
|
|
.headImg {
|
|
margin-right: 20px;
|
|
border-radius: 50%;
|
|
width: 80px;
|
|
height: 80px;
|
|
}
|
|
|
|
.arco-form-item-layout-horizontal:first-child,
|
|
.arco-form-item-layout-horizontal:nth-child(2) {
|
|
align-items: center;
|
|
}
|
|
.cellbox{
|
|
margin-top: 35px;
|
|
}
|
|
.cellbox .cell{
|
|
width:50%;
|
|
border-bottom:1px dashed #efefef;
|
|
margin-bottom: 20px;
|
|
}
|
|
.cellbox .cell:first-child{
|
|
border: none;
|
|
}
|
|
.cell{
|
|
.arco-form-item{
|
|
margin-bottom: 10px;
|
|
}
|
|
}
|
|
.box {
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.cert .arco-form-item-label-col {
|
|
flex: 0 0 8px !important;
|
|
}
|
|
|
|
.red {
|
|
display: inline-block;
|
|
margin-right: 5px;
|
|
font-size: 14px;
|
|
color: red;
|
|
margin-top: 5px;
|
|
}
|
|
|
|
.cardNum {
|
|
width: 148px;
|
|
}
|
|
.codbox{
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.reason{
|
|
width:250px;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
</style> |