fix: 新功能开发完善。

This commit is contained in:
tianyongbao
2024-10-28 13:09:06 +08:00
parent df34762355
commit 66c776c753
48 changed files with 5845 additions and 1633 deletions

View File

@@ -0,0 +1,517 @@
<template>
<view class="container" style="paddingBottom:1rpx;">
<u-navbar
leftIconSize="40rpx"
leftIconColor="#333333"
title="药品入库清单"
>
</u-navbar>
<view class="section">
<view class="section-title">{{ title}}</view>
<view class="form-view">
<u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" label-width="auto"
:labelStyle="{ color: '#333333', fontSize: '30rpx' }">
<u-form-item label="治疗类型" prop="marTypeName" @click="handleMarType">
<u--input v-model="form.marTypeName" disabled disabledColor="#ffffff" placeholder="请选择治疗类型"
inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-down"></u-icon>
</u-form-item>
<u-form-item label="药品名称" prop="medicineName" required @click="handleMedical">
<u--input v-model="form.medicineName" disabled disabledColor="#ffffff" placeholder="请选择药品名称"
inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-down"></u-icon>
</u-form-item>
<u-form-item label="入库编号" prop="code" required >
<u--input v-model="form.code" placeholder="请填写入库编号"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="入库数量" prop="quantity" required >
<u--input v-model="form.quantity" placeholder="请填写入库数量"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="购买时间" prop="purchaseDate" required @click="selectDate()">
<u--input v-model="form.purchaseDate" disabled disabledColor="#ffffff" placeholder="请选择购买时间" inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<u-form-item label="使用状态" prop="stateName" required @click="handleState">
<u--input v-model="form.stateName" disabled disabledColor="#ffffff" placeholder="请选择使用状态"
inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-down"></u-icon>
</u-form-item>
<u-form-item label="生产日期" prop="productionDate" required @click="selectProductionDate()">
<u--input v-model="form.productionDate" disabled disabledColor="#ffffff" placeholder="请选择生产日期" inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<u-form-item label="过期日期" prop="expiringDate" required @click="selectExpiringDate()">
<u--input v-model="form.expiringDate" disabled disabledColor="#ffffff" placeholder="请选择过期日期" inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-right"></u-icon>
</u-form-item>
<u-form-item label="包装单位" prop="packageUnitName" @click="handlePackageUnit">
<u--input v-model="form.packageUnitName" disabled disabledColor="#ffffff" placeholder="请选择包装单位"
inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-down"></u-icon>
</u-form-item>
<u-form-item label="规格总数" prop="totalCount" required >
<u--input v-model="form.totalCount" placeholder="请填写规格总数"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="规格单位" prop="unitName" @click="handleUnit">
<u--input v-model="form.unitName" disabled disabledColor="#ffffff" placeholder="请选择规格单位"
inputAlign="right" border="none"></u--input>
<u-icon slot="right" name="arrow-down"></u-icon>
</u-form-item>
<u-form-item label="已使用数量" prop="usedCount" >
<u--input v-model="form.usedCount" placeholder="请填写已使用数量"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="剩余数量" prop="leftCount" >
<u--input v-model="form.leftCount" placeholder="请填写剩余数量"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="年龄体重" prop="ageWeight" >
<u--input v-model="form.ageWeight" placeholder="请填写年龄体重"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="药品单价" prop="purchasePrice" >
<u--input v-model="form.purchasePrice" placeholder="请填写药品单价"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="药品总价" prop="totalPrice" >
<u--input v-model="form.totalPrice" placeholder="请填写药品总价"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="购买地址" prop="purchaseAddress" labelPosition="top">
<u--input v-model="form.purchaseAddress" placeholder="请填写购买地址"
inputAlign="right" border="none"></u--input>
</u-form-item>
<u-form-item label="医嘱" prop="usage" labelPosition="top">
<u--textarea v-model="form.usage" placeholder="请填写医嘱" border="none" autoHeight inputAlign="right" count
maxlength="2000" style="padding:18rpx 0;"></u--textarea>
</u-form-item>
<u-form-item label="备注" prop="remark" labelPosition="top">
<u--textarea v-model="form.remark" placeholder="请填写备注" border="none" autoHeight inputAlign="right" count
maxlength="2000" style="padding:18rpx 0;"></u--textarea>
</u-form-item>
</u--form>
<view class="form-btn">
<u-button type="primary" text="提交" @click="submit"></u-button>
</view>
</view>
</view>
<u-toast ref="uToast"></u-toast>
<u-picker itemHeight="88" :show="showState" :columns="stateList" keyName="dictLabel" @cancel="handleStateCancel"
@confirm="handleStateConfirm"></u-picker>
<u-picker itemHeight="88" :show="showMarType" :columns="marTypeList" keyName="dictLabel" @cancel="handleMarTypeCancel"
@confirm="handleMarTypeConfirm"></u-picker>
<u-picker itemHeight="88" :show="showMedical" :columns="medicalList" keyName="shortNameBrandPackaging" @cancel="handleMedicalCancel"
@confirm="handleMedicalConfirm"></u-picker>
<u-picker itemHeight="88" :show="showPackageUnit" :columns="packageUnitList" keyName="dictLabel" @cancel="handlePackageUnitCancel"
@confirm="handlePackageUnitConfirm"></u-picker>
<u-picker itemHeight="88" :show="showUnit" :columns="unitList" keyName="dictLabel" @cancel="handleUnitCancel"
@confirm="handleUnitConfirm"></u-picker>
<u-datetime-picker
:show="datePickShow"
mode="datetime"
ref="purchaseDateRef"
@cancel="datePickShow=false"
@confirm="datePickConfirm"
itemHeight="88"
></u-datetime-picker>
<u-datetime-picker
:show="productionDateShow"
mode="date"
ref="productionDateRef"
@cancel="productionDateShow=false"
@confirm="productionDateConfirm"
itemHeight="88"
></u-datetime-picker>
<u-datetime-picker
:show="expiringDateShow"
mode="date"
ref="expiringDateRef"
@cancel="expiringDateShow=false"
@confirm="expiringDateConfirm"
itemHeight="88"
></u-datetime-picker>
</view>
</template>
<script setup>
import { getMedicineStockIn, addMedicineStockIn, updateMedicineStockIn } from '@/api/health/medicineStockIn'
import { listMedicineBasic, getMedicineBasic } from '@/api/health/medicineBasic'
const { proxy } = getCurrentInstance()
import { getDicts } from '@/api/system/dict/data.js'
import dayjs from 'dayjs'
import {onLoad,onReady} from "@dcloudio/uni-app";
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
import {reactive ,toRefs,ref,computed ,getCurrentInstance }from "vue";
const datePickShow = ref(false)
const flag = ref('add')
const title = ref("药品入库清单")
const productionDateShow = ref(false)
const expiringDateShow = ref(false)
const medicalList = ref([])
const showMedical = ref(false)
const marTypeList = ref([])
const showMarType = ref(false)
const stateList = ref([])
const showState = ref(false)
const packageUnitList = ref([])
const showPackageUnit = ref(false)
const unitList = ref([])
const showUnit = ref(false)
const data = reactive({
form: {
id: null,
medicineId: null,
quantity: 1,
productionDate: null,
expiringDate: null,
purchaseDate: null,
purchasePrice: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null,
delFlag: null,
remark: null,
code: null,
state: '0',
stateName: '未使用',
leftCount: null,
usedCount: null,
purchaseAddress: null,
totalPrice: null,
usage: null,
ageWeight: null,
totalCount: null,
unit: null,
packageUnit: null
},
queryPersonParams: {
pageNum: 1,
status: '1',
pageSize: 1000
},
queryHealthRecordParams: {
pageNum: 1,
personId:null,
pageSize: 1000
},
queryMedicineParams: {
pageNum: 1,
treatmentType: null,
pageSize: 1000
},
rules: {
medicineName: [{ required: true, message: '药品名称不能为空', trigger: ['change', 'blur'] }],
quantity: [{type: 'number', required: true, message: '数量不能为空', trigger: ['change', 'blur'] }],
productionDate: [{ required: true, message: '生产日期不能为空', trigger: ['change', 'blur'] }],
expiringDate: [{ required: true, message: '过期日期不能为空', trigger: ['change', 'blur'] }],
code: [{ type: 'number', required: true, message: '入库编号不能为空', trigger: ['change', 'blur'] }],
stateName: [{ required: true, message: '使用状态不能为空', trigger: ['change', 'blur'] }]
}
})
const { form,queryMedicineParams, rules} = toRefs(data)
onLoad((option) => {
form.value.id = option.id
flag.value = option.flag
if(flag.value==null){
if(form.value.id!=null){
title.value="药品入库清单-修改"
}else{
title.value="药品入库清单-新增"
}
}else{
title.value="药品入库清单-复制"
}
getData()
})
onReady(() => {
form.value.purchaseDate = dayjs(new Date().getTime()).format("YYYY-MM-DD HH:mm:ss")
})
function dictStr(val, arr) {
let str = ''
arr.map(item => {
if (item.dictValue === val) {
str = item.dictLabel
}
})
return str
}
function selectProductionDate() {
productionDateShow.value = true
proxy.$refs['productionDateRef'].innerValue = new Date().getTime()
}
function productionDateConfirm(e) {
form.value.productionDate = dayjs(e.value).format("YYYY-MM-DD")
productionDateShow.value = false
}
function selectExpiringDate() {
expiringDateShow.value = true
proxy.$refs['expiringDateRef'].innerValue = new Date().getTime()
}
function expiringDateConfirm(e) {
form.value.expiringDate = dayjs(e.value).format("YYYY-MM-DD")
expiringDateShow.value = false
}
function getData() {
listMedicineBasic(queryMedicineParams.value).then((response) => {
medicalList.value = [response.rows]
})
// 类型
getDicts('used_state').then(res => {
stateList.value =[res.data]
})
// 类型
getDicts('mar_type').then(res => {
marTypeList.value =[res.data]
})
// 类型
getDicts('medical_unit').then(res => {
unitList.value =[res.data]
})
// 类型
getDicts('package_unit').then(res => {
packageUnitList.value =[res.data]
})
if(form.value.id!=null){
getMedicineStockIn(form.value.id).then(res => {
form.value = res.data
getDicts('package_unit').then(result => {
form.value.packageUnitName=dictStr(form.value.packageUnit, result.data)
})
// 药品来源
getDicts('medical_unit').then(result => {
form.value.unitName=dictStr(form.value.unit, result.data)
})
// 药品来源
getDicts('used_state').then(result => {
form.value.stateName=dictStr(form.value.state, result.data)
})
// 用药类型
getDicts('mar_type').then(result => {
form.value.marTypeName=dictStr(form.value.type, result.data)
})
})
}else {
const date = new Date()
const year = date.getFullYear() // 年份
let month = date.getMonth() + 1 // 月份返回值为0-11所以需要加1
let day = date.getDate() // 日期
let hour = date.getHours()
let minute = date.getMinutes()
let second = date.getSeconds()
// 对月份和日期进行补零
month = month < 10 ? '0' + month : month.toString()
day = day < 10 ? '0' + day : day.toString()
hour = hour < 10 ? '0' + hour : hour.toString()
minute = minute < 10 ? '0' + minute : minute.toString()
second = second < 10 ? '0' + second : second.toString()
const currentDate = year + month + day + hour + minute + second
form.value.code = currentDate
}
}
function handlePackageUnit() {
if (packageUnitList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '药品来源为空 ', type: 'warning'
})
} else {
showPackageUnit.value = true
}
}
function handlePackageUnitConfirm(e) {
form.value.packageUnitName = e.value[0].dictLabel
form.value.packageUnit = e.value[0].dictValue
showPackageUnit.value = false
}
function handlePackageUnitCancel() {
showPackageUnit.value = false
}
function handleMedical() {
if (medicalList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '药品为空 ', type: 'warning'
})
} else {
showMedical.value = true
}
}
function handleMedicalConfirm(e) {
form.value.medicineName = e.value[0].shortNameBrandPackaging
form.value.name = e.value[0].shortNameBrandPackaging
form.value.medicineId = e.value[0].id
getMedicineBasic(e.value[0].id).then((response) => {
form.value.unit = response.data.unit
// 药品来源
getDicts('medical_unit').then(result => {
form.value.unitName=dictStr( response.data.unit, result.data)
})
form.value.packageUnit = response.data.packageUnit
// 药品来源
getDicts('package_unit').then(result => {
form.value.packageUnitName=dictStr( response.data.packageUnit, result.data)
})
})
showMedical.value = false
}
function handleMedicalCancel() {
showMedical.value = false
}
function handleState() {
if (stateList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '使用状态为空 ', type: 'warning'
})
} else {
showState.value = true
}
}
function handleStateConfirm(e) {
form.value.stateName = e.value[0].dictLabel
form.value.state = e.value[0].dictValue
showState.value = false
}
function handleStateCancel() {
showState.value = false
}
function handleUnit() {
if (unitList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '规格单位为空 ', type: 'warning'
})
} else {
showUnit.value = true
}
}
function handleUnitConfirm(e) {
form.value.unitName = e.value[0].dictLabel
form.value.unit = e.value[0].dictValue
showUnit.value = false
}
function handleUnitCancel() {
showUnit.value = false
}
function handleMarType() {
if (marTypeList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '治疗类型为空 ', type: 'warning'
})
} else {
showMarType.value = true
}
}
function handleMarTypeConfirm(e) {
form.value.marTypeName = e.value[0].dictLabel
form.value.type = e.value[0].dictValue
queryMedicineParams.value.treatmentType = e.value[0].dictValue
form.value.medicineName = ""
form.value.name = ""
form.value.medicineId = null
listMedicineBasic(queryMedicineParams.value).then((response) => {
medicalList.value = [response.rows]
})
showMarType.value = false
}
function handleMarTypeCancel() {
showMarType.value = false
}
function selectDate() {
datePickShow.value = true
proxy.$refs['purchaseDateRef'].innerValue = new Date().getTime()
}
function datePickConfirm(e) {
form.value.purchaseDate = dayjs(e.value).format("YYYY-MM-DD HH:mm:ss")
datePickShow.value = false
}
function submit() {
proxy.$refs['uForm'].validate().then(() => {
if (form.value.id != null) {
if(flag.value==null){
updateMedicineStockIn(form.value).then(res => {
proxy.$refs['uToast'].show({
message: '修改成功', complete() {
uni.navigateTo({ url: `/pages/health/medicineStockIn/list` })
}
})
})
}else {
form.value.id == null
addMedicineStockIn(form.value).then(res => {
proxy.$refs['uToast'].show({
message: '新增成功', complete() {
uni.navigateTo({ url: `/pages/health/medicineStockIn/list` })
}
})
})
}
}else {
addMedicineStockIn(form.value).then(res => {
proxy.$refs['uToast'].show({
message: '新增成功', complete() {
uni.navigateTo({ url: `/pages/health/medicineStockIn/list` })
}
})
})
}
})
}
</script>
<style lang="scss" scoped>
.section {
margin: 24rpx;
padding: 16rpx 24rpx;
background-color: #fff;
border-radius: 8rpx;
.section-title {
width: 360rpx;
color: #333333;
line-height: 44rpx;
font-size: 30rpx;
border-left: 6rpx solid #2681FF;
padding-left: 26rpx;
}
.form-view {
padding: 20rpx 0rpx 0 10rpx;
.form-btn {
padding-top: 20rpx;
}
}
}
</style>

View File

@@ -0,0 +1,117 @@
<template>
<view class="container" style="paddingBottom:1rpx;">
<u-navbar
leftIconSize="40rpx"
leftIconColor="#333333"
title="药品入库清单详情"
>
</u-navbar>
<view class="section">
<u-cell-group>
<u-cell title="药品名称:" titleStyle="font-weight:bolder" :value="detailInfo.medicineName"></u-cell>
<u-cell title="入库编号:" titleStyle="font-weight:bolder" :value="detailInfo.code"></u-cell>
<u-cell title="入库数量:" titleStyle="font-weight:bolder" :value="detailInfo.quantity"></u-cell>
<u-cell title="购买时间:" titleStyle="font-weight:bolder" :value="detailInfo.purchaseDate"></u-cell>
<u-cell title="使用状态:" titleStyle="font-weight:bolder" center :value="detailInfo.state"> </u-cell>
<u-cell title="生产日期:" titleStyle="font-weight:bolder" :value="detailInfo.productionDate"></u-cell>
<u-cell title="过期日期:" titleStyle="font-weight:bolder" :value="detailInfo.expiringDate"></u-cell>
<u-cell title="包装单位:" titleStyle="font-weight:bolder" :value="detailInfo.packageUnit"></u-cell>
<u-cell title="规格总数:" titleStyle="font-weight:bolder" :value="detailInfo.totalCount"></u-cell>
<u-cell title="规格单位:" titleStyle="font-weight:bolder" :value="detailInfo.unit"></u-cell>
<u-cell title="已使用数量:" titleStyle="font-weight:bolder" :value="detailInfo.usedCount"></u-cell>
<u-cell title="剩余数量:" titleStyle="font-weight:bolder" :value="detailInfo.leftCount"></u-cell>
<u-cell title="年龄体重:" titleStyle="font-weight:bolder" :value="detailInfo.ageWeight"></u-cell>
<u-cell title="药品单价:" titleStyle="font-weight:bolder" :value="detailInfo.purchasePrice"></u-cell>
<u-cell title="药品总价:" titleStyle="font-weight:bolder" :value="detailInfo.totalPrice"></u-cell>
<u-cell title="医嘱:" titleStyle="font-weight:bolder" :value="detailInfo.usage"></u-cell>
<u-cell title="购买地址:" titleStyle="font-weight:bolder" :value="detailInfo.purchaseAddress"></u-cell>
<u-cell title="备注:" titleStyle="font-weight:bolder" center :value="detailInfo.remark"> </u-cell>
</u-cell-group>
</view>
<u-toast ref="uToast"></u-toast>
</view>
</template>
<script setup>
import { getMedicineStockIn } from '@/api/health/medicineStockIn'
import { getDicts } from '@/api/system/dict/data.js'
import {onLoad} from "@dcloudio/uni-app";
import {reactive ,toRefs,ref,computed }from "vue";
const id = ref('')
const data = reactive({
detailInfo: {}
})
const {detailInfo} = toRefs(data)
onLoad((option) => {
id.value = option.id
getInfo()
})
function getInfo() {
getMedicineStockIn(id.value).then(res => {
detailInfo.value = res.data
// 类型
getDicts('used_state').then(result => {
detailInfo.value.state=dictStr(detailInfo.value.state, result.data)
})
// 类型
getDicts('package_unit').then(result => {
detailInfo.value.packageUnit=dictStr(detailInfo.value.packageUnit, result.data)
})
// 类型
getDicts('medical_unit').then(result => {
detailInfo.value.unit=dictStr(detailInfo.value.unit, result.data)
})
})
}
function dictStr(val, arr) {
let str = ''
arr.map(item => {
if (item.dictValue === val) {
str = item.dictLabel
}
})
return str
}
</script>
<style lang="scss" scoped>
.section {
margin: 24rpx;
padding: 16rpx 24rpx;
background-color: #fff;
border-radius: 8rpx;
.section-title {
width: 280rpx;
color: #333333;
line-height: 44rpx;
font-size: 30rpx;
border-left: 6rpx solid #2681FF;
padding-left: 26rpx;
}
.content {
width: 647rpx;
font-size: 28rpx;
color: #333333;
line-height: 40rpx;
text-align: left;
}
.img-con {
display: flex;
flex-wrap: wrap;
gap: 20rpx
}
.form-view {
padding: 20rpx 0rpx 0 10rpx;
.form-btn {
padding-top: 20rpx;
}
}
}
</style>

View File

@@ -0,0 +1,522 @@
<template>
<view class="container">
<u-sticky offsetTop="8rpx" customNavHeight="8rpx">
<view class="search-view">
<u-input v-model="queryParams.medicalName" border="false" type="select" @click="handleMedical" placeholder="请选择药品" suffixIcon="search"
suffixIconStyle="color: #909399" class="search-input">
</u-input>
<u-icon name="plus-circle-fill" color="#666666" size="28" style="margin-left:10px" label="新增"
labelPos="left" labelSize="32rpx" labelColor="#666666" @click="handleAdd()"></u-icon>
</view>
</u-sticky>
<u-sticky offsetTop="8rpx" customNavHeight="8rpx">
<view class="search-view">
<u-input v-model="queryParams.time" border="false" type="select" readonly placeholder="请选择购买时间" suffixIcon="calendar"
suffixIconStyle="color: #909399" class="search-input">
</u-input>
<u-icon :name="filterPanel ? 'arrow-up-fill' : 'arrow-down-fill'" color="#666666" size="28" label="筛选"
labelPos="left" labelSize="32rpx" labelColor="#666666" @click="filterPanel = !filterPanel"></u-icon>
<u-transition :show="filterPanel" mode="fade">
<view class="filter-panel" :style="{ height: `${windowHeight - 42}px` }">
<view class="filter-panel-content">
<view class="filter-title">使用状态</view>
<view class="state-list">
<view v-for="item in stateList" :key="item.id" class="state-item"
:class="item.selected ? 'active' : ''" @click="selectType(item)">{{ item.dictLabel }}</view>
</view>
<view class="select-header">购买时间</view>
<view class="selcet-content" style="padding: 0 24rpx">
<u-input
:disabled="true"
:disabledColor="'#fff'"
class="dateInput"
border="surround"
v-model="queryParams.startTime"
placeholder="请选择开始时间"
>
<template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(true)"></u-icon>
</template>
</u-input>
<u-input
:disabled="true"
:disabledColor="'#fff'"
class="dateInput"
border="surround"
v-model="queryParams.endTime"
placeholder="请选择结束时间"
>
<template v-slot:suffix>
<u-icon name="calendar" @click="openOrCloseDate(false)"></u-icon>
</template>
</u-input>
</view>
</view>
<view class="btn-box">
<u-button text="重置" style="margin-right:20rpx" @click="resetQuery()"></u-button>
<u-button type="primary" text="确定" @click="searchSubmit()"></u-button>
</view>
<u-datetime-picker
:closeOnClickOverlay="true"
:show="timeShow"
v-model="time"
mode="datetime"
@close="openOrCloseDate"
@cancel="openOrCloseDate"
@confirm="confirm"
></u-datetime-picker>
</view>
</u-transition>
</view>
</u-sticky>
<u-list @scrolltolower="loadmore" :spaceHeight="116" lowerThreshold="100">
<u-list-item v-for="(item, index) in listData" :key="index">
<view class="list-item">
<view class="item-header" @click="enterDetails(item)">
<u--text lines="1" iconStyle="font-size: 18px; color: #333333; font-weight:bold"
:text="item.medicineName" size="30rpx" color="#333333" :bold="true"></u--text>
</view>
<view class="item-row">
<text class="row-label">购买时间</text>
<text class="row-value">{{ item.purchaseDate }}</text>
</view>
<view class="item-row">
<text class="row-label">使用状态</text>
<text class="row-value">{{ dictStr(item.state, stateList) }}</text>
</view>
<view class="item-row">
<text class="row-label">入库编号</text>
<text class="row-value">{{ item.code }}</text>
</view>
<view class="item-row">
<text class="row-label">入库数量</text>
<text class="row-value">{{ item.quantity }}</text>
</view>
<view class="item-row">
<text class="row-label">包装单位</text>
<text class="row-value">{{ dictStr(item.packageUnit, packageUnitList) }}</text>
</view>
<view class="item-row">
<text class="row-label">过期日期</text>
<text class="row-value">{{item.expiringDate }}</text>
</view>
<view class="item-row">
<text class="row-label">规格总数</text>
<text class="row-value">{{ item.totalCount }}</text>
</view>
<view class="item-row">
<text class="row-label">规格单位</text>
<text class="row-value">{{ dictStr(item.unit, unitList) }}</text>
</view>
<view class="item-row">
<text class="row-label">剩余数量</text>
<text class="row-value">{{ item.leftCount }}</text>
</view>
<view class="item-row">
<text class="row-label">备注</text>
<text class="row-value">{{ item.remark }}</text>
</view>
<view class="operate" >
<view class="btn filling" @click="handleEdit(item)">修改</view>
<view class="btn filling" @click="handleCopy(item)">复制</view>
<view class="btn filling" @click="handleDelete(item)">删除</view>
</view>
</view>
</u-list-item>
<view>
</view>
<u-loadmore :status="status" loadingIcon="semicircle" height="88" fontSize="32rpx" @loadmore="loadmore" />
</u-list>
<u-picker itemHeight="88" :show="settingPickShow" :columns="settingColumns" keyName="settingName"
@confirm="settingConfirm" @cancel="settingCancel"></u-picker>
<u-picker itemHeight="88" :show="showMedical" :columns="medicalList" keyName="shortNameBrandPackaging" @cancel="handleMedicalCancel"
@confirm="handleMedicalConfirm"></u-picker>
</view>
</template>
<script setup>
import { listMedicineStockIn, delMedicineStockIn, } from '@/api/health/medicineStockIn'
import { listMedicineBasic, getMedicineBasic } from '@/api/health/medicineBasic'
import { getDicts } from '@/api/system/dict/data.js'
import { timeHandler } from '@/utils/common.ts'
import {onLoad,onShow} from "@dcloudio/uni-app";
import dayjs from 'dayjs'
// 计算属性与监听属性是在vue中而非uniap中 需要注意!!!
import {reactive ,toRefs,ref,computed }from "vue";
const pageNum = ref(1)
const listData = ref([])
const isShow = ref(false)
const status = ref('loadmore')
const settingPickShow = ref(false)
const settingColumns = ref([])
const timeShow= ref(false)
const stateList = ref([])
const unitList = ref([])
const packageUnitList = ref([])
const medicalList = ref([])
const showMedical = ref(false)
const flag= ref(true)
const time =ref( Number(new Date()))
const data = reactive({
filterPanel: false,
queryMedicalParams: {
pageNum: 1,
pageSize: 100
},
queryParams: {
name: null,
type: null,
healthRecordId: null,
dosingTime: null,
dosage: null,
medicalId: null,
resource: null,
place: null
}
})
const { filterPanel, queryMedicalParams, queryParams} = toRefs(data)
const windowHeight = computed(() => {
uni.getSystemInfoSync().windowHeight - 50
})
onLoad(() => {
getList()
});
onShow(() => {
if (isShow.value) {
listData.value=[]
getList()
isShow.value = false
}
});
function dictStr(val, arr) {
let str = ''
arr.map(item => {
if (item.dictValue === val) {
str = item.dictLabel
}
})
return str
}
function selectType(item) {
queryParams.value.state = item.dictValue
stateList.value.map(ele => {
if (ele.dictValue == item.dictValue) {
ele.selected = true
Reflect.set(ele, 'selected', true)
} else {
Reflect.set(ele, 'selected', false)
}
})
}
function openOrCloseDate(data) {
timeShow.value = !timeShow.value
flag.value = data
}
function loadmore() {
pageNum.value += 1
if (status.value == 'loadmore') {
getList()
}
}
function getList() {
listMedicineBasic(queryMedicalParams.value).then((response) => {
medicalList.value = [response.rows]
})
// 使用状态
getDicts('used_state').then(res => {
stateList.value = res.data
})
// 用药地点
getDicts('medical_unit').then(res => {
unitList.value = res.data
})
// 单位
getDicts('package_unit').then(res => {
packageUnitList.value = res.data
})
status.value = 'loading'
listMedicineStockIn({ pageSize: 10, pageNum: pageNum.value, ...queryParams.value }).then(res => {
listData.value = listData.value.concat(res.rows)
if (listData.value.length < res.total) {
status.value = 'loadmore'
} else {
status.value = 'nomore'
}
}).catch(() => {
status.value = 'nomore'
})
}
function confirm(e) {
const date = timeHandler(new Date(e.value), '-', ':')
let formatValue = 'YYYY-MM-DD'
dayjs(date).format(formatValue)
if (flag.value) {
queryParams.value.startTime = dayjs(date).format(formatValue)
} else {
queryParams.value.endTime = dayjs(date).format(formatValue)
}
timeShow.value = false
}
function settingConfirm(e) {
queryParams.value.settingId = e.value[0].settingId
queryParams.value.settingName = e.value[0].settingName
settingPickShow.value = false
}
function settingCancel() {
settingPickShow.value = false
}
function searchSubmit() {
if(queryParams.value.startTime!=''&&queryParams.value.startTime!=undefined&&queryParams.value.endTime!=''&&queryParams.value.endTime!=undefined){
queryParams.value.time = queryParams.value.startTime+'-'+queryParams.value.endTime
}
pageNum.value = 1
listData.value = []
getList()
filterPanel.value = false
}
function handleMedical() {
if (medicalList.value[0].length === 0) {
proxy.$refs['uToast'].show({
message: '药品名称为空 ', type: 'warning'
})
} else {
showMedical.value = true
}
}
function handleMedicalConfirm(e) {
queryParams.value.medicalName = e.value[0].shortNameBrandPackaging
queryParams.value.medicineId= e.value[0].id
showMedical.value = false
pageNum.value = 1
listData.value = []
getList()
}
function handleMedicalCancel() {
showMedical.value = false
}
function searchBlur() {
pageNum.value = 1
listData.value = []
getList()
}
function resetQuery() {
queryParams.value.medicalName = ''
queryParams.value.state = ''
queryParams.value.startTime = ''
queryParams.value.time = ''
queryParams.value.endTime = ''
queryParams.value.medicineId = ''
}
function enterDetails(item) {
uni.navigateTo({ url: `/pages/health/medicineStockIn/details?id=${item.id}` })
}
function handleEdit(item) {
uni.navigateTo({ url: `/pages/health/medicineStockIn/addEdit?id=${item.id}` })
isShow.value = true
}
function handleCopy(item) {
uni.navigateTo({ url: `/pages/health/medicineStockIn/addEdit?flag=copy&id=${item.id}` })
isShow.value = true
}
function handleAdd() {
uni.navigateTo({ url: `/pages/health/medicineStockIn/addEdit` })
isShow.value = true
}
function handleDelete(item) {
uni.showModal({
title: '提示',
content: '你确定要删除吗',
success: function (res) {
if (res.confirm) {
delMedicineStockIn(item.id)
uni.navigateTo({ url: `/pages/health/medicineStockIn/list` })
} else if (res.cancel) {
console.log('取消');
}
}
});
}
</script>
<style lang="scss" scoped>
.btnAdd {
width: 146rpx;
height: 56rpx;
line-height: 56rpx;
border-radius: 8rpx;
display:float;
text-align: center;
}
.search-view {
padding: 12rpx 32rpx;
background-color: #ffffff;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
.search-input {
background: #F5F5F5;
color: #333333;
margin-right: 36rpx;
}
.filter-panel {
width: 100%;
position: absolute;
left: 0;
top: 96rpx;
background-color: rgba(0, 0, 0, 0.5);
.filter-panel-content {
background-color: #ffff;
padding: 0 30rpx 30rpx;
.filter-title {
color: #000000;
font-size: 30rpx;
font-weight: 500;
padding: 30rpx 0;
}
.state-list {
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
.state-item {
width: 210rpx;
height: 72rpx;
border: 1rpx solid rgba(0, 0, 0, 0.25);
border-radius: 72rpx;
text-align: center;
line-height: 72rpx;
margin: 0 20rpx 20rpx 0;
font-size: 28rpx;
color: #000000;
}
.active {
background-color: rgba(222, 241, 255, 1);
border: 1rpx solid rgba(22, 119, 255, 1);
}
}
}
.btn-box {
display: flex;
padding: 24rpx 30rpx;
background-color: #fff;
box-shadow: 0rpx -10rpx 20rpx #EEEEEE;
}
}
}
.list-item {
margin: 0 24rpx 24rpx;
padding: 32rpx;
background-color: #fff;
.item-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 16rpx;
.status {
.status-item {
width: 120rpx;
height: 44rpx;
text-align: center;
line-height: 44rpx;
border-radius: 4rpx;
font-size: 24rpx;
}
.status1 {
background: #F0F0F0;
color: #8C8C8C;
}
.status2 {
background: rgba(38, 129, 255, 0.2);
color: #2681FF;
}
.status3 {
background: #F7F7F7;
color: #2681FF;
}
.status4 {
background: rgba(255, 85, 51, 0.2);
color: #FF5533;
}
.status5 {
background: #F7F7F7;
color: rgba(0, 0, 0, 0.85);
}
.status7 {
background: rgba(255, 129, 51, 0.2);
color: #FF8133;
}
.status8 {
background: rgba(65, 217, 165, 0.2);
color: #41D9A5;
}
}
}
.item-row {
padding: 16rpx 0;
.row-label {
color: rgba(0, 0, 0, 0.55);
}
.row-value {
color: rgba(0, 0, 0, 0.85)
}
}
.operate {
display: flex;
justify-content: flex-end;
.btn {
width: 146rpx;
height: 56rpx;
line-height: 56rpx;
border-radius: 8rpx;
margin-left: 5rpx;
text-align: center;
}
.circulation {
background: rgba(0, 0, 0, 0.04);
margin-right: 24rpx;
color: rgba(0, 0, 0, 0.85);
}
.filling {
background: #2681FF;
border-radius: 8rpx;
color: #FFFFFF;
}
}
}
</style>