|
@@ -1,15 +1,18 @@
|
|
|
<template>
|
|
|
<div class="layout_display_flex_y">
|
|
|
<el-dialog
|
|
|
- title="模板信息"
|
|
|
- draggable
|
|
|
- width="90vw"
|
|
|
- append-to-body
|
|
|
- v-model="dialog">
|
|
|
- <el-table ref="detailsTableRef"
|
|
|
- height="60vh"
|
|
|
- @row-click="(row) => detailsTableRef.toggleRowSelection(row)"
|
|
|
- :data="muBanXiangQing.data ">
|
|
|
+ title="模板信息"
|
|
|
+ draggable
|
|
|
+ width="90vw"
|
|
|
+ append-to-body
|
|
|
+ v-model="dialog"
|
|
|
+ >
|
|
|
+ <el-table
|
|
|
+ ref="detailsTableRef"
|
|
|
+ height="60vh"
|
|
|
+ @row-click="row => detailsTableRef.toggleRowSelection(row)"
|
|
|
+ :data="muBanXiangQing.data"
|
|
|
+ >
|
|
|
<el-table-column type="selection"></el-table-column>
|
|
|
<el-table-column label="项目名称" prop="chargeName"></el-table-column>
|
|
|
<el-table-column label="厂家" prop="manuName"></el-table-column>
|
|
@@ -19,7 +22,12 @@
|
|
|
<el-table-column label="数量" prop="amount"></el-table-column>
|
|
|
<el-table-column label="金额">
|
|
|
<template #default="scope">
|
|
|
- {{ XEUtils.toFixed(Dig.multiply(scope.row.chargeAmount, scope.row.amount), 2) }}
|
|
|
+ {{
|
|
|
+ XEUtils.toFixed(
|
|
|
+ Dig.multiply(scope.row.chargeAmount, scope.row.amount),
|
|
|
+ 2
|
|
|
+ )
|
|
|
+ }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="编码" prop="chargeCodeMx"></el-table-column>
|
|
@@ -27,17 +35,10 @@
|
|
|
</el-table>
|
|
|
|
|
|
<template #footer>
|
|
|
- <el-button
|
|
|
- type="danger"
|
|
|
- size="large"
|
|
|
- @click="dialog = false">
|
|
|
+ <el-button type="danger" size="large" @click="dialog = false">
|
|
|
取消
|
|
|
</el-button>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- @click="confirmTemplate"
|
|
|
- size="large"
|
|
|
- >
|
|
|
+ <el-button type="primary" @click="confirmTemplate" size="large">
|
|
|
确认
|
|
|
</el-button>
|
|
|
</template>
|
|
@@ -45,22 +46,33 @@
|
|
|
|
|
|
<div class="layout_flex_1-y">
|
|
|
<el-table
|
|
|
- @rowClick="getMuBanXinXiClick"
|
|
|
- :data="templateData.data"
|
|
|
- height="100%">
|
|
|
- <el-table-column label="模板名称" prop="name" width="120px"/>
|
|
|
+ @rowClick="getMuBanXinXiClick"
|
|
|
+ :data="templateData.data"
|
|
|
+ height="100%"
|
|
|
+ >
|
|
|
+ <el-table-column label="模板名称" prop="name" width="120px">
|
|
|
+ <template #header>
|
|
|
+ <el-input
|
|
|
+ placeholder="按下回车搜索"
|
|
|
+ v-model="templateData.searchName"
|
|
|
+ @keydown.enter.stop.prevent="
|
|
|
+ () => reloadData(templateData.searchName)
|
|
|
+ "
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column>
|
|
|
<template #header>
|
|
|
- <el-button type="primary" @click="reloadData">刷新</el-button>
|
|
|
+ <el-button type="primary" @click="reloadData(null)">刷新</el-button>
|
|
|
</template>
|
|
|
<template #default="scope">
|
|
|
<el-popconfirm
|
|
|
- cancel-button-text="取消"
|
|
|
- confirm-button-text="确认"
|
|
|
- icon="InfoFilled"
|
|
|
- iconColor="red"
|
|
|
- title="是否删除该数据"
|
|
|
- @confirm="shanChuMuBanClick(scope.$index, scope.row)"
|
|
|
+ cancel-button-text="取消"
|
|
|
+ confirm-button-text="确认"
|
|
|
+ icon="InfoFilled"
|
|
|
+ iconColor="red"
|
|
|
+ title="是否删除该数据"
|
|
|
+ @confirm="shanChuMuBanClick(scope.$index, scope.row)"
|
|
|
>
|
|
|
<template #reference>
|
|
|
<el-button @click.stop.prevent type="danger">删除</el-button>
|
|
@@ -72,108 +84,126 @@
|
|
|
</div>
|
|
|
<div>
|
|
|
<el-pagination
|
|
|
- :current-page="templateData.currentPage"
|
|
|
- :page-size="templateData.pageSize"
|
|
|
- :pager-count="5"
|
|
|
- :total="templateData.total"
|
|
|
- layout=" prev, pager, next"
|
|
|
- small
|
|
|
- style="margin-top: 5px"
|
|
|
- @current-change="templatePaging"/>
|
|
|
+ :current-page="templateData.currentPage"
|
|
|
+ :page-size="templateData.pageSize"
|
|
|
+ :pager-count="5"
|
|
|
+ :total="templateData.total"
|
|
|
+ layout=" prev, pager, next"
|
|
|
+ small
|
|
|
+ style="margin-top: 5px"
|
|
|
+ @current-change="templatePaging"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import {onMounted, ref, reactive} from 'vue'
|
|
|
-import {getMuBan, getMuBanXinXi, shanChuMuBan} from '@/api/inpatient/xiang-mu-lu-ru'
|
|
|
-import {ElMessageBox, ElTable} from 'element-plus'
|
|
|
-import {useUserStore} from "@/pinia/user-store";
|
|
|
+import { onMounted, ref, reactive } from "vue";
|
|
|
+import {
|
|
|
+ getMuBan,
|
|
|
+ getMuBanXinXi,
|
|
|
+ shanChuMuBan,
|
|
|
+} from "@/api/inpatient/xiang-mu-lu-ru";
|
|
|
+import { ElMessageBox, ElTable } from "element-plus";
|
|
|
+import { useUserStore } from "@/pinia/user-store";
|
|
|
import useCompRef from "@/utils/useCompRef";
|
|
|
import Dig from "../../utils/math";
|
|
|
-import XEUtils from 'xe-utils'
|
|
|
+import XEUtils from "xe-utils";
|
|
|
|
|
|
-const dialog = ref(false)
|
|
|
-const emit = defineEmits(['selectionFeiYong'])
|
|
|
-const detailsTableRef = useCompRef(ElTable)
|
|
|
+const dialog = ref(false);
|
|
|
+const emit = defineEmits(["selectionFeiYong"]);
|
|
|
+const detailsTableRef = useCompRef(ElTable);
|
|
|
|
|
|
-let templateData = reactive({
|
|
|
+const templateData = reactive({
|
|
|
data: [],
|
|
|
currentPage: 1,
|
|
|
pageSize: 10,
|
|
|
total: 0,
|
|
|
-})
|
|
|
+ searchName: "",
|
|
|
|
|
|
-const userInfo = useUserStore().userInfo
|
|
|
+ tmpName: "",
|
|
|
+});
|
|
|
|
|
|
-const templatePaging = (val) => {
|
|
|
- templateData.currentPage = val
|
|
|
- getMuBan(userInfo.deptCode, templateData.currentPage, templateData.pageSize, templateData.total).then((res) => {
|
|
|
- templateData.data = res.records
|
|
|
- })
|
|
|
-}
|
|
|
+const userInfo = useUserStore().userInfo;
|
|
|
+
|
|
|
+const templatePaging = val => {
|
|
|
+ templateData.currentPage = val;
|
|
|
+ const { data, tmpName, ...value } = templateData;
|
|
|
+ getMuBan({ ...value, searchName: templateData.tmpName }).then(res => {
|
|
|
+ templateData.data = res.records;
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
// 获取模板信息
|
|
|
-const getMuBanXinXiClick = (row) => {
|
|
|
- getMuBanXinXi(row.name, row.opIdCode).then((res) => {
|
|
|
- muBanXiangQing.value.data = res
|
|
|
- muBanXiangQing.value.total = res.length
|
|
|
- dialog.value = true
|
|
|
- })
|
|
|
-}
|
|
|
+const getMuBanXinXiClick = row => {
|
|
|
+ getMuBanXinXi(row.name, row.opIdCode).then(res => {
|
|
|
+ muBanXiangQing.value.data = res;
|
|
|
+ muBanXiangQing.value.total = res.length;
|
|
|
+ dialog.value = true;
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
// 获取模板的详情
|
|
|
const muBanXiangQing = ref({
|
|
|
data: [],
|
|
|
currentPage: 1,
|
|
|
pageSize: 30,
|
|
|
- total: 0
|
|
|
-})
|
|
|
+ total: 0,
|
|
|
+});
|
|
|
|
|
|
function confirmTemplate() {
|
|
|
const data = detailsTableRef.value.getSelectionRows();
|
|
|
if (data.length > 0) {
|
|
|
- emit('selectionFeiYong', data)
|
|
|
+ emit("selectionFeiYong", data);
|
|
|
}
|
|
|
- dialog.value = false
|
|
|
+ dialog.value = false;
|
|
|
}
|
|
|
|
|
|
const shanChuMuBanClick = (index, data) => {
|
|
|
if (data.opIdCode !== userInfo.code) {
|
|
|
- ElMessageBox.confirm('该模板非本人创建是否强制删除', '提示', {
|
|
|
- type: 'error',
|
|
|
- }).then(() => {
|
|
|
- shanChuMuBan(data.name, data.opIdCode).then((res) => {
|
|
|
- templateData.data.splice(index, 1)
|
|
|
- })
|
|
|
- }).catch(() => {
|
|
|
+ ElMessageBox.confirm("该模板非本人创建是否强制删除", "提示", {
|
|
|
+ type: "error",
|
|
|
})
|
|
|
+ .then(() => {
|
|
|
+ shanChuMuBan(data.name, data.opIdCode).then(res => {
|
|
|
+ templateData.data.splice(index, 1);
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {});
|
|
|
} else {
|
|
|
- shanChuMuBan(data.name, data.opIdCode).then((res) => {
|
|
|
- templateData.data.splice(index, 1)
|
|
|
- })
|
|
|
+ shanChuMuBan(data.name, data.opIdCode).then(res => {
|
|
|
+ templateData.data.splice(index, 1);
|
|
|
+ });
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
|
|
|
-const reloadData = () => {
|
|
|
- getMuBan(userInfo.deptCode, 1, 10, 0).then((res) => {
|
|
|
- templateData.total = res.total
|
|
|
- templateData.data = res.records
|
|
|
- templateData.currentPage = 1
|
|
|
- })
|
|
|
-}
|
|
|
+const reloadData = (name = "") => {
|
|
|
+ templateData.total = 0;
|
|
|
+ templateData.data = [];
|
|
|
+ templateData.currentPage = 1;
|
|
|
+ templateData.pageSize = 10;
|
|
|
+
|
|
|
+ if (name !== "") {
|
|
|
+ templateData.searchName = name;
|
|
|
+ templateData.tmpName = name;
|
|
|
+ }
|
|
|
+
|
|
|
+ const { data, tmpName, ...value } = templateData;
|
|
|
+
|
|
|
+ getMuBan(value).then(res => {
|
|
|
+ templateData.total = res.total;
|
|
|
+ templateData.data = res.records;
|
|
|
+ templateData.currentPage = 1;
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
defineExpose({
|
|
|
- reloadData
|
|
|
-})
|
|
|
+ reloadData: () => reloadData(),
|
|
|
+});
|
|
|
|
|
|
onMounted(() => {
|
|
|
- getMuBan(userInfo.deptCode, templateData.currentPage, templateData.pageSize, templateData.total).then((res) => {
|
|
|
- templateData.total = res.total
|
|
|
- templateData.data = res.records
|
|
|
- templateData.currentPage = 1
|
|
|
- })
|
|
|
-})
|
|
|
+ reloadData();
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style></style>
|