dev
This commit is contained in:
parent
c6953c2b0b
commit
9123ba273f
|
|
@ -1,131 +0,0 @@
|
|||
<template>
|
||||
<Mask :is-show="isShow" @close="isShow = false" title="添加子项目">
|
||||
<div style="display: flex">
|
||||
<el-form
|
||||
:model="form"
|
||||
:rules="{name: [{required: true, message: '请输入项目名称', trigger: 'blur'}]}"
|
||||
class="form"
|
||||
label-width="auto"
|
||||
>
|
||||
<el-form-item label="项目名称" prop="name">
|
||||
<el-input
|
||||
class="input"
|
||||
v-model="form.name"
|
||||
placeholder="请输入项目名称"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
<el-input v-model="search" placeholder="请输入搜索内容" style="width: 300px"></el-input>
|
||||
<el-button type="primary" @click="addProject">添加项目</el-button>
|
||||
<List :dataList="dataList" :search="search" ref="listRef" @selected="select"></List>
|
||||
<div class="page">
|
||||
<el-pagination
|
||||
background
|
||||
layout="prev, pager, next"
|
||||
:total="total"
|
||||
:page-size="size"
|
||||
:current-page="current_page"
|
||||
@current-change="current_page = $event"
|
||||
>
|
||||
</el-pagination>
|
||||
<div class="page_btn_list">
|
||||
<el-button type="primary" @click="save">保存</el-button>
|
||||
<el-button @click="close">取消</el-button>
|
||||
<el-button @click="deleteDetail">删除</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</Mask>
|
||||
<Mask :is-show="isShowAdd" @close="isShowAdd = false" title="子项目列表">
|
||||
<ListChild @close="isShowAdd=false" @selected="selected"></ListChild>
|
||||
</Mask>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {nextTick, ref, defineExpose, defineProps} from 'vue'
|
||||
import Mask from "@/components/common/Mask.vue";
|
||||
import CloseBtn from "@/components/CloseBtn.vue";
|
||||
import {post} from "@/utils/request.ts"
|
||||
import {ElMessage} from "element-plus";
|
||||
import List from "@/components/settings/List.vue";
|
||||
import ListChild from "@/components/settings/ListChild.vue";
|
||||
|
||||
const props = defineProps({
|
||||
add: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
})
|
||||
const isShow = ref<any>(false)
|
||||
const search = ref<any>('')
|
||||
const current_page = ref<any>(1)
|
||||
const size = ref<any>(20)
|
||||
const total = ref<any>(0)
|
||||
const dataList = ref<any>([])
|
||||
const id = ref<any>('')
|
||||
const init = (row: any) => {
|
||||
isShow.value = true
|
||||
id.value = row.id
|
||||
form.value.name = row.name
|
||||
if (row.itemJson) {
|
||||
dataList.value = JSON.parse(row.itemJson)
|
||||
}
|
||||
}
|
||||
const initData = () => {
|
||||
isShow.value = true
|
||||
}
|
||||
const emit = defineEmits(['close'])
|
||||
const close = () => {
|
||||
isShow.value = false
|
||||
form.value = {name: '', ids: []}
|
||||
emit('close')
|
||||
}
|
||||
|
||||
const form = ref<any>({name: '', ids: [], id: ''})
|
||||
const save = () => {
|
||||
if (dataList.value) {
|
||||
dataList.value.forEach((item: any) => {
|
||||
form.value.ids.push(item.id)
|
||||
})
|
||||
} else {
|
||||
form.value.ids = []
|
||||
}
|
||||
if (id.value) {
|
||||
form.value.id = id.value
|
||||
post('item/group/save', {data: form.value}).then(() => {
|
||||
ElMessage.success('保存成功')
|
||||
close()
|
||||
})
|
||||
} else {
|
||||
post('item/group/save', {data: form.value}).then(() => {
|
||||
ElMessage.success('保存成功')
|
||||
close()
|
||||
})
|
||||
}
|
||||
}
|
||||
const addProject = () => {
|
||||
isShowAdd.value = true
|
||||
}
|
||||
const listRef = ref<any>('')
|
||||
const selected = (e: any) => {
|
||||
dataList.value.push(...e)
|
||||
}
|
||||
const select = (e: any) => {
|
||||
dataList.value = dataList.value.filter((item: any) => item.id != e.id)
|
||||
}
|
||||
const isShowAdd = ref<any>(false)
|
||||
const deleteDetail = () => {
|
||||
post('item/group/delete', {id: id.value}).then(() => {
|
||||
ElMessage.success('删除成功')
|
||||
close()
|
||||
})
|
||||
}
|
||||
defineExpose({init, initData})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -76,7 +76,7 @@ import {defineProps, defineEmits, ref, nextTick, onMounted} from 'vue'
|
|||
import {post} from "@/utils/request.ts";
|
||||
import {ElMessage} from "element-plus";
|
||||
import Mask from "@/components/common/Mask.vue";
|
||||
import ItemSearch from "@/components/settings/ItemSearch.vue";
|
||||
import ItemSearch from "@/components/settings/item/ItemSearch.vue";
|
||||
import UnitSelector from "@/components/inventory/UnitSelector.vue";
|
||||
import {itemUnitList} from "@/utils/unitList.ts"
|
||||
|
||||
|
|
@ -0,0 +1,148 @@
|
|||
<template>
|
||||
<Mask :is-show="isShow" @close="close" title="添加组套">
|
||||
<el-form :model="form" label-width="auto" ref="formRef">
|
||||
<el-descriptions
|
||||
:column="2"
|
||||
direction="vertical"
|
||||
border
|
||||
>
|
||||
<el-descriptions-item label="组套名称">
|
||||
<el-form-item prop="itemName">
|
||||
<el-input v-model="form.itemName"/>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="单位">
|
||||
<el-form-item prop="unit">
|
||||
<el-popover
|
||||
placement="bottom"
|
||||
title="Title"
|
||||
trigger="click"
|
||||
>
|
||||
<template #reference>
|
||||
<el-input v-model="form.unit"></el-input>
|
||||
</template>
|
||||
<UnitSelector :units="itemUnitList" v-model="form.unit"></UnitSelector>
|
||||
</el-popover>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="原价">
|
||||
<el-form-item>
|
||||
<el-input v-model="form.purchaseUnitPrice" readonly>
|
||||
<template #prefix>
|
||||
¥
|
||||
</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="售价">
|
||||
<el-form-item prop="unitPrice">
|
||||
<el-input v-model="form.unitPrice" readonly>
|
||||
<template #prefix>¥</template>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-form>
|
||||
<div class="top">
|
||||
<div class="default-btn" @click="openSearchDialog">添加子项目</div>
|
||||
</div>
|
||||
<el-table v-if="list.length>0" :data="list">
|
||||
<el-table-column label="名称" prop="name"></el-table-column>
|
||||
<el-table-column label="单位" prop="unit"></el-table-column>
|
||||
<el-table-column label="医保编码" prop="socialCode"></el-table-column>
|
||||
<el-table-column label="原价" prop="purchaseUnitPrice">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.purchaseUnitPrice" type="number">
|
||||
<template #prefix>¥</template>
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="售价" prop="unitPrice">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.unitPrice" type="number">
|
||||
<template #prefix>¥</template>
|
||||
</el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<ItemSearch ref="createSearchRef" @confirm="createConfirm"/>
|
||||
</Mask>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {ref, defineExpose, nextTick, watch} from 'vue'
|
||||
import Mask from "@/components/common/Mask.vue";
|
||||
import ItemSearch from "@/components/settings/item/ItemSearch.vue";
|
||||
const createSearchRef = ref<any>('')
|
||||
import {itemUnitList} from "@/utils/unitList.ts"
|
||||
import UnitSelector from "@/components/inventory/UnitSelector.vue";
|
||||
const isShow = ref<any>(false)
|
||||
const list=ref<any[]>([])
|
||||
const id = ref<any>('')
|
||||
const init = (row: any) => {
|
||||
isShow.value = true
|
||||
form.value=default_form
|
||||
if(row!=null){
|
||||
id.value = row.id
|
||||
form.value.name = row.name
|
||||
}
|
||||
}
|
||||
|
||||
const openSearchDialog=()=>{
|
||||
nextTick(() => {
|
||||
createSearchRef.value?.init(form.value.itemName);
|
||||
});
|
||||
}
|
||||
|
||||
const createConfirm= (data: any) => {
|
||||
let row={
|
||||
id:null,
|
||||
name:data.name,
|
||||
unit:data.unit,
|
||||
socialCode:data.code,
|
||||
purchaseUnitPrice:0,
|
||||
unitPrice:0,
|
||||
}
|
||||
list.value.push(row)
|
||||
calculateTotalPrices();
|
||||
}
|
||||
const emit = defineEmits(['close'])
|
||||
const close = () => {
|
||||
isShow.value = false
|
||||
form.value = {name: '', ids: []}
|
||||
emit('close')
|
||||
}
|
||||
const default_form={
|
||||
id:null,
|
||||
name:"",
|
||||
unit:"次",
|
||||
purchaseUnitPrice:"",
|
||||
unitPrice:"",
|
||||
}
|
||||
const form = ref<any>(default_form)
|
||||
const calculateTotalPrices = () => {
|
||||
const totalPurchasePrice = list.value.reduce((sum, item) => sum + parseFloat(item.purchaseUnitPrice || 0), 0);
|
||||
const totalPrice = list.value.reduce((sum, item) => sum + parseFloat(item.unitPrice || 0), 0);
|
||||
|
||||
form.value.purchaseUnitPrice = totalPurchasePrice.toFixed(2); // 可以保留两位小数
|
||||
form.value.unitPrice = totalPrice.toFixed(2);
|
||||
};
|
||||
watch(
|
||||
() => list.value.map(item => ({
|
||||
purchaseUnitPrice: item.purchaseUnitPrice,
|
||||
unitPrice: item.unitPrice
|
||||
})),
|
||||
() => {
|
||||
calculateTotalPrices();
|
||||
},
|
||||
{ deep: true }
|
||||
);
|
||||
defineExpose({init})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
.page {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -1,22 +1,15 @@
|
|||
<template>
|
||||
<Mask :width="800" :height="600" :is-show="show" @close="show=false" title="项目列表" :show-footer="true">
|
||||
<Mask :width="800" :height="600" :is-show="show" @close="show=false" title="项目组套列表" :show-footer="true">
|
||||
<template #default>
|
||||
<div class="search_content_wrapper">
|
||||
<div class="search_wrapper">
|
||||
<span>药品名称:</span>
|
||||
<el-input
|
||||
class="input"
|
||||
v-model="keyword"
|
||||
placeholder="请输入药品名称或者编号"
|
||||
@input="search_social"
|
||||
clearable/>
|
||||
<el-button type="primary" @click="add">添加项目</el-button>
|
||||
<el-button type="primary" @click="add">添加组套</el-button>
|
||||
</div>
|
||||
<div class="content">
|
||||
<el-table :data="tableList" @row-click="rowClick">
|
||||
<el-table-column
|
||||
prop="name"
|
||||
label="项目名称">
|
||||
label="组套名称">
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
prop="purchaseUnitPrice"
|
||||
|
|
@ -43,33 +36,19 @@
|
|||
</div>
|
||||
</template>
|
||||
</Mask>
|
||||
<AddProject :add="true" ref="addProjectMaskRef" @close="init"></AddProject>
|
||||
<GroupAdd :add="true" ref="addGroupRef" @close="init"></GroupAdd>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {ref, nextTick} from "vue";
|
||||
import {post} from '@/utils/request.ts'
|
||||
import Mask from "@/components/common/Mask.vue";
|
||||
import AddProject from "@/components/settings/AddProject.vue";
|
||||
import CloseBtn from "@/components/CloseBtn.vue";
|
||||
import {ElMessage} from "element-plus";
|
||||
|
||||
let current_search_data: any = null;
|
||||
let keyword = ref('');
|
||||
import GroupAdd from "@/components/settings/item/group/GroupAdd.vue";
|
||||
let current_page = ref(1)
|
||||
const show = ref(false);
|
||||
|
||||
const emit = defineEmits(["confirm"])
|
||||
|
||||
let search_result = ref({
|
||||
totalPage: 0,
|
||||
list: [],
|
||||
pageNum: 1,
|
||||
});
|
||||
|
||||
const init = () => {
|
||||
|
||||
post("item/group/list", {
|
||||
name: keyword.value,
|
||||
post("item/groupList", {
|
||||
page: current_page.value,
|
||||
size: 10,
|
||||
}).then((res: any) => {
|
||||
|
|
@ -81,15 +60,6 @@ const init = () => {
|
|||
};
|
||||
defineExpose({init});
|
||||
|
||||
function init_search_data() {
|
||||
isloading.value = false;
|
||||
current_search_data = null;
|
||||
search_result.value = {
|
||||
totalPage: 0,
|
||||
list: [],
|
||||
pageNum: 1,
|
||||
}
|
||||
}
|
||||
|
||||
const tableList = ref<any>([
|
||||
{
|
||||
|
|
@ -98,19 +68,16 @@ const tableList = ref<any>([
|
|||
unitPrice: '',
|
||||
}
|
||||
])
|
||||
let isloading = ref(false);
|
||||
let search_social = () => {
|
||||
isloading.value = true;
|
||||
}
|
||||
const addProjectMaskRef = ref<any>(null);
|
||||
|
||||
const addGroupRef = ref<any>(null);
|
||||
const rowClick = (row: any) => {
|
||||
nextTick(() => {
|
||||
addProjectMaskRef.value?.init(row);
|
||||
addGroupRef.value?.init(row);
|
||||
})
|
||||
}
|
||||
const add = () => {
|
||||
nextTick(() => {
|
||||
addProjectMaskRef.value?.initData();
|
||||
addGroupRef.value?.init(null);
|
||||
})
|
||||
}
|
||||
const total = ref<any>(0)
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
</div>
|
||||
<div class="title-btn">
|
||||
<span class="default-btn" @click="initData()">查询</span>
|
||||
<span class="default-btn" @click="resetSearch" style="margin: 0 24px">重置</span>
|
||||
<span class="default-btn" @click="resetSearch">重置</span>
|
||||
<span class="default-btn" @click="openDialog">新建项目</span>
|
||||
<!-- <el-button type="primary" @click="openSetMenu">组套</el-button>-->
|
||||
<span class="default-btn" @click="openGroupDialog">组套</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="table">
|
||||
|
|
@ -54,26 +54,19 @@
|
|||
</div>
|
||||
</div>
|
||||
<ItemEdit :id="id" ref="ItemEditRef" @close="initData()"></ItemEdit>
|
||||
<SetMenu ref="setMenuRef"></SetMenu>
|
||||
<GroupList ref="isOpenGroup"></GroupList>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import {nextTick, onMounted, ref} from "vue";
|
||||
import {post} from "@/utils/request.ts";
|
||||
import Mask from "@/components/common/Mask.vue";
|
||||
import ItemEdit from "@/components/settings/ItemEdit.vue";
|
||||
import SetMenu from "@/components/settings/SetMenu.vue";
|
||||
import ItemEdit from "@/components/settings/item/ItemEdit.vue";
|
||||
import GroupList from "@/components/settings/item/group/GroupList.vue";
|
||||
import {formatDate} from "@/utils/dateUtils.ts";
|
||||
import {Plus} from "@element-plus/icons-vue"
|
||||
|
||||
const state = ref([])
|
||||
const options = ref([
|
||||
{
|
||||
value: '选项1',
|
||||
label: '黄金糕',
|
||||
disabled: true
|
||||
},
|
||||
])
|
||||
const selectRef = ref();
|
||||
|
||||
const isOpenGroup = ref();
|
||||
const emit = defineEmits(['selectCallBack'])
|
||||
const isShow = ref(false)
|
||||
const ItemEditRef = ref<any>('')
|
||||
|
|
@ -96,9 +89,9 @@ onMounted(() => {
|
|||
initData()
|
||||
})
|
||||
const setMenuRef = ref<any>('')
|
||||
const openSetMenu = () => {
|
||||
const openGroupDialog = () => {
|
||||
nextTick(() => {
|
||||
setMenuRef.value?.init();
|
||||
isOpenGroup.value?.init();
|
||||
});
|
||||
}
|
||||
const changePage = (val: any) => {
|
||||
|
|
@ -126,7 +119,15 @@ const loading= ref(true)
|
|||
background: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.title-btn{
|
||||
.default-btn{
|
||||
margin-right: 24px;
|
||||
&:last-child{
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
.title {
|
||||
display: flex;
|
||||
height: 60px;
|
||||
|
|
|
|||
Loading…
Reference in New Issue