You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-spms-vue/src/views/basic/product/drug/drugAdd.vue

1383 lines
49 KiB
Vue

12 months ago
<template>
<div>
12 months ago
<el-form :model="newProductData" :rules="formRules" label-width="140px" ref="dataForm">
12 months ago
<el-collapse v-model="activeNames">
<el-collapse-item name="0" v-if="type != 1">
<template slot="title">
<p class="form-title">第三方信息</p>
</template>
<el-table :data="sysList" style="width: 100%; margin-bottom: 8px" key="2" border>
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="第三方系统名称" prop="sysName" show-overflow-tooltip></el-table-column>
<el-table-column label="第三方系统药品编码" prop="thirdId" show-overflow-tooltip></el-table-column>
<el-table-column label="第三方系统药品名称" prop="thirdName" show-overflow-tooltip></el-table-column>
<el-table-column label="第三方系统包装规格" prop="spec" show-overflow-tooltip></el-table-column>
<el-table-column label="注册号" prop="registerNo" show-overflow-tooltip></el-table-column>
<el-table-column label="生产企业" prop="manufactory" show-overflow-tooltip></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" @click="addSelectErp(scope.row)" :disabled="scope.row.thirdId==rowData.nameCode">
关联
</el-button>
<el-button type="text" @click.native.stop="removeErp(scope.row)"
:disabled=" scope.row.thirdId==null || scope.row.thirdId==''"
>解绑
</el-button>
</template>
</el-table-column>
</el-table>
</el-collapse-item>
12 months ago
<el-collapse-item name="1">
<template slot="title">
<p class="form-title">药品层级</p>
</template>
12 months ago
<div style=" float: right;
text-align: right;
margin-bottom: 8px;"
>
<el-button type="primary" size="mini" icon="search" @click="selectDrugLevel"
style="text-align:right"
>选入药品层级
</el-button>
<el-button type="primary" size="mini" icon="search" @click="addDrugLevel"
style="text-align:right"
>新增药品层级
12 months ago
</el-button>
</div>
12 months ago
<el-table
v-loading="loading"
:data="detailList"
style="width: 100%;"
border
key="3"
@current-change="handleDetail"
>
12 months ago
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="层级标识" prop="nameCode" show-overflow-tooltip width="160">
12 months ago
<template slot-scope="scope">
12 months ago
<el-input size="small" v-model="scope.row.nameCode" style="width: 100%;margin: 4px;"
:disabled="scope.$index !== selectedIndex"
></el-input>
</template>
</el-table-column>
<!-- 1.主标识2使用单元标识3.本体标识4包装标识-->
<el-table-column label="标识类型" prop="diType" show-overflow-tooltip width="160">
<template slot-scope="scope">
<el-select v-model="scope.row.diType"
:disabled="scope.$index !== selectedIndex"
style="width: 90%" placeholder="选择标识类型" clearable>
<el-option label="最小销售标识" :value="1"></el-option>
<!-- <el-option label="使用单元标识" :value="2"></el-option>-->
<!-- <el-option label="本体标识" :value="3"></el-option>-->
<el-option label="外包装标识" :value="4"></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="包装级别" prop="packLevel" show-overflow-tooltip width="100">
12 months ago
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.packLevel" style="width: 100%"
type="number"
:disabled="scope.$index !== selectedIndex"
@input="handleInput(scope.$index, $event,1)"
12 months ago
></el-input>
</template>
</el-table-column>
<el-table-column label="层级单位" prop="packUnit" show-overflow-tooltip width="120">
12 months ago
<template slot-scope="scope">
12 months ago
<el-input size="small" v-model="scope.row.packUnit" style="width: 100%"
:disabled="scope.$index !== selectedIndex"
12 months ago
></el-input>
</template>
</el-table-column>
<el-table-column label="下级数量" prop="bhxjsl" show-overflow-tooltip width="100">
12 months ago
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.bhxjsl" style="width: 100%"
type="number"
:disabled="scope.$index !== selectedIndex"
@input="handleInput(scope.$index, $event,1)"
></el-input>
</template>
</el-table-column>
<el-table-column label="下级单位" prop="xjdw" show-overflow-tooltip width="120">
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.xjdw" style="width: 100%"
12 months ago
:disabled="scope.$index !== selectedIndex"
12 months ago
></el-input>
</template>
</el-table-column>
12 months ago
<el-table-column label="下级标识" prop="bhxjcpbm" show-overflow-tooltip width="160">
12 months ago
<template slot-scope="scope">
12 months ago
<el-input size="small" v-model="scope.row.bhxjcpbm" style="width: 100%"
:disabled="scope.$index !== selectedIndex "
12 months ago
></el-input>
</template>
</el-table-column>
<el-table-column label="上级标识" prop="sjcpbm" show-overflow-tooltip width="160">
12 months ago
<template slot-scope="scope">
<el-input size="small" v-model="scope.row.sjcpbm" style="width: 100%"
12 months ago
:disabled="scope.$index !== selectedIndex"
12 months ago
></el-input>
</template>
</el-table-column>
12 months ago
<el-table-column label="操作" width="180px" fixed="right">
12 months ago
<template slot-scope="scope">
<el-button type="text" size="small" v-if="scope.$index == selectedIndex " @click.stop="true"
@click.native="levelSave(scope.row)"
>保存
12 months ago
</el-button>
<el-button
type="text"
size="small"
v-if="scope.$index != selectedIndex "
12 months ago
@click.stop="true"
@click.native="rowChange(scope.$index,scope.row)"
>编辑
</el-button>
<!--:disabled=" scope.row.id != null"-->
12 months ago
<el-button
type="text"
size="small"
@click.stop="true"
@click.native="deleteLevel(scope.$index, scope.row)"
>删除
12 months ago
</el-button>
12 months ago
</template>
</el-table-column>
</el-table>
<template>
<p class="form-title2">流通时采用的计量单位设置</p>
</template>
<el-row :gutter="20">
<el-col :span="11" class="el-col">
<el-form-item label="计量单位:" prop="distributeLevel" label-width="160px">
<el-select v-model="newProductData.distributeLevel" size="small" style="width: 90%"
@change="distributeLevelDiChange"
placeholder="请选择计量单位"
>
<el-option
v-for="item in levelUnitList"
:key="item.packLevel"
:value="item.packLevel"
:label="item.packUnit"
>
<span style="float: right; color: #8492a6; font-size: 13px">单位:{{ item.packUnit }}</span>
<span style="float: left">层级:{{ item.packLevel }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="允许采集的最大层级:" prop="distributeMaxLevel" label-width="160px">
<el-select v-model="newProductData.distributeMaxLevel" size="small" style="width: 90%"
placeholder="请选择允许采集的最大层级"
>
<el-option
v-for="item in levelUnitList"
:key="item.packLevel"
:value="item.packLevel"
:label="item.packLevel"
>
<span style="float: right; color: #8492a6; font-size: 13px">单位:{{ item.packUnit }}</span>
<span style="float: left">层级:{{ item.packLevel }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-divider></el-divider>
<template>
<p class="form-title2">使用时采用的计量单位设置</p>
</template>
<el-row :gutter="20">
<el-col :span="11" class="el-col">
<el-form-item label="计量单位:" prop="useLevel" label-width="160px">
<el-select v-model="newProductData.useLevel" size="small" style="width: 90%"
clearable
@change="useLevelDiChange"
placeholder="请选择计量单位"
>
<el-option
v-for="item in levelUnitList"
:key="item.packLevel"
:value="item.packLevel"
:label="item.packUnit"
>
<span style="float: right; color: #8492a6; font-size: 13px">单位:{{ item.packUnit }}</span>
<span style="float: left">层级:{{ item.packLevel }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="允许采集的最大层级:" prop="useMaxLevel" label-width="160px">
<el-select v-model="newProductData.useMaxLevel" size="small" style="width: 90%"
clearable
placeholder="请选择允许采集的最大层级"
>
<el-option
v-for="item in levelUnitList"
:key="item.packLevel"
:value="item.packLevel"
:label="item.packLevel"
>
<span style="float: right; color: #8492a6; font-size: 13px">单位:{{ item.packUnit }}</span>
<span style="float: left">层级:{{ item.packLevel }}</span>
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="11" class="el-col">
<el-form-item label="拆包后可用时长(小时):" prop="unpackUseTime" label-width="160px">
<el-input v-model="newProductData.unpackUseTime" size="small" style="width: 90%"
clearable
placeholder="请输入拆包后可用时长(小时)"
>
</el-input>
</el-form-item>
</el-col>
</el-row>
12 months ago
</el-collapse-item>
<el-collapse-item name="2">
<template slot="title">
<p class="form-title">基本信息</p>
</template>
<el-row type="flex">
<el-col :span="11" class="el-col">
<el-form-item label="医保编码:" prop="ybbm">
<el-input style="width: 90%" size="small" placeholder="请输入医保编码"
v-model.trim="newProductData.ybbm"
v-debounce-input:500ms="getYbDrugData"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="商品条码:" prop="sptm">
<el-input style="width: 90%" size="small" placeholder="请输入药品商品条码"
v-model.trim="newProductData.sptm"
></el-input>
</el-form-item>
</el-col>
</el-row>
12 months ago
<el-row type="flex">
<el-col :span="11" class="el-col">
<el-form-item label="药品通用名称:" prop="cpmctymc">
<el-input style="width: 90%" size="small" placeholder="请输入药品通用名称"
v-model.trim="newProductData.cpmctymc"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="商品名称:" prop="spmc">
<el-input style="width: 90%" size="small" placeholder="请输入商品名称"
v-model.trim="newProductData.spmc"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<el-col :span="11" class="el-col">
<el-form-item label="包装规格:" prop="bzgg">
<el-input style="width: 90%" size="small" placeholder="请输入包装规格"
v-model.trim="newProductData.bzgg"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="最小包装单位:" prop="packUnit">
<el-input style="width: 90%" size="small" placeholder="请输入最小包装单位"
12 months ago
v-model.trim="newProductData.packUnit"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<el-col :span="11" class="el-col">
<el-form-item label="制剂规格:" prop="prepnSpec">
<el-input style="width: 90%" size="small" placeholder="请输入制剂规格"
v-model.trim="newProductData.prepnSpec"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="剂型:" prop="prepnUnit">
<el-input style="width: 90%" size="small" placeholder="请输入剂型"
12 months ago
v-model.trim="newProductData.prepnUnit"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
<el-col :span="11" class="el-col">
<el-form-item label="包装材质:" prop="packMatrial">
<el-input style="width: 90%" size="small" placeholder="请输入包装材质"
v-model.trim="newProductData.packMatrial"
></el-input>
</el-form-item>
</el-col>
<!--<el-col :span="11" class="el-col">-->
<!-- <el-form-item label="包装比例:" prop="packRatio">-->
<!-- <el-input style="width: 90%" size="small" placeholder="请输入制剂单位"-->
<!-- v-model.trim="newProductData.packRatio"-->
<!-- ></el-input>-->
<!-- </el-form-item>-->
<!--</el-col>-->
12 months ago
<el-col :span="11" class="el-col">
<el-form-item label="批准文号:" prop="zczbhhzbapzbh">
<el-input style="width: 90%" size="small" placeholder="请输入批准文号"
v-model="newProductData.zczbhhzbapzbh"
12 months ago
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
12 months ago
<el-col :span="11" class="el-col">
<el-form-item label="生产企业:" prop="manufactory">
<el-input style="width: 90%" size="small" placeholder="请输入生产企业"
v-model.trim="newProductData.manufactory"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="药品类型:" prop="physicType">
<el-select v-model="newProductData.physicType" style="width: 90%" placeholder="选择药品类型">
<el-option label="普通药品" :value="3"></el-option>
12 months ago
<el-option label="特殊药品原料药" :value="1"></el-option>
<el-option label="特殊药品制剂" :value="2"></el-option>
<el-option label="未分类" :value="9"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
12 months ago
<el-col :span="11" type="flex">
<el-form-item label="药品分类:" prop="majorType">
<el-select v-model="newProductData.majorType" style="width: 90%" placeholder="选择药品分类" clearable>
<el-option label="中药" :value="1"></el-option>
<el-option label="化学药" :value="2"></el-option>
<el-option label="生物制品" :value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="医保分类:" prop="medicareType">
<el-select v-model="newProductData.medicareType" style="width: 90%" placeholder="选择医保分类"
clearable
>
<el-option label="甲类" :value="1"></el-option>
<el-option label="乙类" :value="2"></el-option>
<el-option label="丙类" :value="3"></el-option>
</el-select>
</el-form-item>
</el-col>
12 months ago
</el-row>
<el-row type="flex">
12 months ago
<el-col :span="11" class="el-col">
<el-form-item label="药品价格:" prop="price">
<el-input
style="width: 90%"
size="small"
placeholder="请输入药品价格"
type="text"
v-model="newProductData.price"
12 months ago
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="存储条件:" prop="ylqxzcrbarmc">
<el-input style="width: 90%" size="small" placeholder="请输入存储条件"
v-model.trim="newProductData.storageCondition"
></el-input>
</el-form-item>
</el-col>
</el-row>
<!--<el-row type="flex">-->
<!-- <el-col :span="11" class="el-col">-->
<!-- <el-form-item label="有效期:" prop="indate">-->
<!-- <el-date-picker-->
<!-- style="width: 90%"-->
<!-- v-model="newProductData.indate"-->
<!-- type="datetime"-->
<!-- format="yyyy 年 MM 月 dd 日 HH 点 mm 分 ss 秒"-->
<!-- value-format="yyyy-MM-dd HH:mm:ss"-->
<!-- placeholder="选择有效期"-->
<!-- >-->
<!-- </el-date-picker>-->
<!-- </el-form-item>-->
<!-- </el-col>-->
<!--</el-row>-->
<el-row type="flex">
12 months ago
<el-col :span="11" class="el-col">
<el-form-item label="运输条件:" prop="transportCondition">
<el-input style="width: 90%" size="small" placeholder="请输入运输条件"
v-model.trim="newProductData.transportCondition"
></el-input>
</el-form-item>
</el-col>
<el-col :span="11" class="el-col">
<el-form-item label="统一社会信用号:" prop="tyshxydm">
<el-input style="width: 90%" size="small" placeholder="请输入统一社会信用号"
v-model.trim="newProductData.tyshxydm"
></el-input>
</el-form-item>
</el-col>
</el-row>
<el-row type="flex">
12 months ago
<el-col :span="11" class="el-col">
<el-form-item label="药品状态:" prop="majorStatus">
<el-select v-model="newProductData.majorStatus" style="width: 90%" placeholder="选择药品状态">
12 months ago
<el-option label="停用" :value="0"></el-option>
<el-option label="在用" :value="1"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
12 months ago
<el-row type="flex">
<el-col :span="23" class="el-col">
<el-form-item label="产品描述:" prop="cpms">
<el-input style="width: 92%" type="textarea" size="mini" rows="3" placeholder="请输入产品描述"
v-model.trim="newProductData.cpms"
></el-input>
</el-form-item>
</el-col>
</el-row>
</el-collapse-item>
</el-collapse>
</el-form>
<div style="text-align: center; margin-top: 20px;">
<el-button type="primary" @click="saveNewProduct" :loading="saveLoading">提交</el-button>
<el-button @click="closeAddDialog"></el-button>
12 months ago
</div>
<el-dialog
title="药品字典-从指定系统添加药品字典"
:visible.sync="chooseHouseDrugVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="85%"
v-if="chooseHouseDrugVisible"
>
<chooseHouseDrug
:uuid="uuid"
:relId="relId"
:isImport="isImport"
:data="thisData"
:defaultSys="defaultSys"
:supEnable="false"
@closeUdi="closeUdi"
></chooseHouseDrug>
</el-dialog>
<el-dialog
title="选入药品层级"
:visible.sync="selectDrugLevelVisible"
:close-on-click-modal="false"
:close-on-press-escape="false"
width="85%"
v-if="selectDrugLevelVisible"
>
8 months ago
<el-form :model="filterQueryDrugLevel" class="query-form" label-width="100px">
<el-row>
<el-col :span="8">
<el-form-item label="层级标识:">
8 months ago
<el-input v-model="filterQueryDrugLevel.nameCode" placeholder="请输入层级标识" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="通用名称:">
8 months ago
<el-input v-model="filterQueryDrugLevel.cpmctymc" placeholder="请输入通用名称" clearable></el-input>
</el-form-item>
</el-col>
<el-col :span="8">
<div style=" float: right;
text-align: right;
margin-bottom: 8px;
margin-right: 15px;"
>
<el-button type="primary" icon="search" @click="handleCurrentChange"
style="text-align:right"
>查询
</el-button>
</div>
</el-col>
</el-row>
</el-form>
<el-table :data="selectDrugLevelList" style="width: 100%; margin-bottom: 8px" key="2" border>
8 months ago
<el-table-column label="序号" type="index"></el-table-column>
<el-table-column label="层级标识" prop="nameCode" show-overflow-tooltip></el-table-column>
<el-table-column label="药品类型" prop="type" show-overflow-tooltip></el-table-column>
<el-table-column label="生产企业" prop="manufacturer" show-overflow-tooltip width="200px"></el-table-column>
<el-table-column label="产品名称通用名称" prop="cpmctymc" show-overflow-tooltip width="200px"></el-table-column>
<el-table-column label="剂型" prop="form" show-overflow-tooltip></el-table-column>
<el-table-column label="剂型规格" prop="formSpec" show-overflow-tooltip></el-table-column>
<el-table-column label="商品名称" prop="spmc" show-overflow-tooltip></el-table-column>
<el-table-column label="包装规格" prop="bzgg" show-overflow-tooltip></el-table-column>
<el-table-column label="包装比例" prop="packRatio" show-overflow-tooltip></el-table-column>
<el-table-column label="包装级别" prop="packLevel" show-overflow-tooltip></el-table-column>
8 months ago
<el-table-column label="操作" fixed="right">
<template slot-scope="scope">
8 months ago
<el-button type="text" @click="selectDrugLevelItem(scope.row)">
选入
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="filterQueryDrugLevel.total>0"
:total="filterQueryDrugLevel.total"
:page.sync="filterQueryDrugLevel.page"
:limit.sync="filterQueryDrugLevel.limit"
@pagination="handleCurrentChange"
></pagination>
</el-dialog>
12 months ago
</div>
</template>
<script>
12 months ago
import {
addDrug,
updatetDrug,
delDrugLevel,
updateLevelDrug, calculateDistCount, calculateUseCount,
8 months ago
getDrugLevelList, getDrugLevelListBycode
} from '@/api/basic/product/drugUdiinfos'
import {getCodeRelDetail} from '@/api/basic/product/udiRelevance'
import {isBlank} from "@/utils/strUtil";
import {
getYbDrugDetail, removeRl, thirdSysDetail
12 months ago
} from '@/api/basic/product/udiRelevance'
import {filterClassify} from '@/api/purchase/classifyCode'
import {filterByUuid, levelByUuid} from '@/api/basic/product/udiInfo'
// import selectChargesProjectDialog from './selectChargesProjectDialog'
import chooseHouseDrug from './chooseHouseDrug'
12 months ago
export default {
name: 'drugAdd',
props: {
closeDialog: {
type: Function,
required: true
},
rowData: {
type: Object,
required: false
},
type: {
12 months ago
//1新增2编辑
12 months ago
type: Object,
required: false
},
uuid: {
type: Object,
required: true
},
relId: {
type: Object,
required: true
},
thisData: {
type: Object,
required: true
},
relevanceEdit: {
type: Object,
required: true
12 months ago
}
},
// components: {selectChargesProjectDialog, chooseHouseDrug},
8 months ago
components: {chooseHouseDrug},
12 months ago
data() {
return {
ybDrugDetail: {},
12 months ago
productData: {},
filterQueryDrugLevel: {
nameCode: "",
cpmctymc: "",
page: 1,
limit: 20,
total: 0,
8 months ago
approvalNum: "",
},
12 months ago
newProductData: {
cpmctymc: null,
bzgg: null,
spmc: null,
measname: null,
manufactory: null,
ybbm: null,
sptm: null,
12 months ago
cpms: null,
productsType: 2,
//高级设置默认开启扫码
12 months ago
status: false,
relId: null,
drugLevelLists: [],
productId: null,
12 months ago
useLevelDi: null,
distributeLevelDi: null,
distributeLevelUnit: null,
useLeverCount: null,
distributeLevelCount: null,
useLevelUnit: null,
distributeLevel: null,
useLevel: null,
majorStatus: 1,
physicType: 3
12 months ago
12 months ago
},
thirdSys: [],
classifyList: [],
selectDrugLevelList: [],
12 months ago
saveLoading: false,
activeNames: ['0', '1', '2'],
12 months ago
formRules: {
cpmctymc: [
12 months ago
{required: true, message: '请输入药品通用名', trigger: 'blur'}
12 months ago
],
prepnSpec: [
12 months ago
{required: true, message: '请输入制剂规格', trigger: 'blur'}
12 months ago
],
packUnit: [
12 months ago
{required: true, message: '请输入包装单位', trigger: 'blur'}
12 months ago
],
prepnUnit: [
12 months ago
{required: true, message: '请输入制剂单位', trigger: 'blur'}
12 months ago
],
// packRatio: [
// {required: true, message: '请输入包装比例', trigger: 'blur'}
// ],
12 months ago
packMatrial: [
12 months ago
{required: true, message: '请输入包装材质', trigger: 'blur'}
12 months ago
],
zczbhhzbapzbh: [
12 months ago
{required: true, message: '请输入批准文号', trigger: 'blur'}
12 months ago
],
manufactory: [
12 months ago
{required: true, message: '生产企业不能为空', trigger: 'blur'}
12 months ago
],
physicType: [
12 months ago
{required: true, message: '药品类型不能为空', trigger: 'blur'}
12 months ago
],
ybbm: [
12 months ago
{required: true, message: '医保编码不能为空', trigger: 'blur'}
12 months ago
],
price: [
12 months ago
{required: true, message: '药品价格不能为空', trigger: 'blur'}
],
majorStatus: [
{required: true, message: '请选择药品状态', trigger: 'blur'}
],
distributeLevel: [
{required: true, message: '请选择计量单位', trigger: 'blur'}
],
// distributeMaxLevel: [
// {required: true, message: '请选择允许采集的最大层级', trigger: 'blur'}
// ],
useLevel: [
{required: true, message: '请选择计量单位', trigger: 'blur'}
],
// useMaxLevel: [
// {required: true, message: '请选择允许采集的最大层级', trigger: 'blur'}
// ],
12 months ago
},
12 months ago
detailList: [
// 初始化一个空对象或包含默认值的对象
{
productId: null,
nameCode: '',
packLevel: null,
bhxjsl: null,
isDisabled: false,
isUpDisabled: true,
rowDisabled: false
}
12 months ago
],
status: false,
rowDisabled: false,
selectedIndex: null,
isSave: true,
12 months ago
loading: false,
tollProjectDialogVisible: false,
sysList: [],
chooseHouseDrugVisible: false,
selectDrugLevelVisible: false,
isImport: false,
defaultSys: null,
levelUnitList: [],
maxLevel: 1,
editRowSwitch: false //产品标识编辑开关 没保存前其他编辑不能按
12 months ago
}
},
methods: {
classifyChange() {
this.classifyChange(this.newProductData.flbm)
let item = this.classifyList.find(item => item.code == this.newProductData.flbm)
if (item != null) this.newProductData.requireScanCode = item.requireScanCode
},
classifySearch(key) {
let query = {
key: key
}
filterClassify(query)
.then(response => {
this.loading = false
this.classifyList = response.data.list || []
})
.catch(() => {
this.loading = false
this.classifyList = []
})
},
getYbDrugData() {
12 months ago
let query = {
goodsCode: this.newProductData.ybbm
12 months ago
}
getYbDrugDetail(query).then((response) => {
12 months ago
if (response.code == 20000) {
this.ybDrugDetail = response.data
//对照关系
this.newProductData.prepnSpec = this.ybDrugDetail.realityOutlook
this.newProductData.zczbhhzbapzbh = this.ybDrugDetail.approvalCode
this.newProductData.cpmctymc = this.ybDrugDetail.registeredProductName
this.newProductData.spmc = this.ybDrugDetail.goodsName
this.newProductData.bzgg = this.ybDrugDetail.factor + this.ybDrugDetail.minUnit + "/" + this.ybDrugDetail.unit
this.newProductData.matrial = this.ybDrugDetail.materialName
this.newProductData.packMatrial = this.ybDrugDetail.materialName
this.newProductData.packUnit = this.ybDrugDetail.unit
this.newProductData.bhxjsl = this.ybDrugDetail.factor
this.newProductData.manufactory = this.ybDrugDetail.companyNameSc
this.newProductData.prepnUnit = this.ybDrugDetail.realityMedicinemodel
if (this.ybDrugDetail.productInsuranceType != "" && this.ybDrugDetail.productInsuranceType != null) {
if ("甲" == this.ybDrugDetail.productInsuranceType) {
this.newProductData.medicareType = 1
} else if ("乙" == this.ybDrugDetail.productInsuranceType) {
this.newProductData.medicareType = 2
} else if ("丙" == this.ybDrugDetail.productInsuranceType) {
this.newProductData.medicareType = 3
} else {
this.newProductData.medicareType = null
}
console.log(this.newProductData.medicareType)
}
12 months ago
this.$forceUpdate()
} else {
// this.$forceUpdate()
12 months ago
}
}).catch(() => {
})
},
saveNewProduct() {
if (!this.isSave) {
return this.$message.error("请先保存药品层级")
}
12 months ago
this.addProductDialogVisible = false
this.newProductData.registerNo = this.newProductData.zczbhhzbapzbh
this.newProductData.splitEnable = true
this.newProductData.autoCode = true
// this.newProductData.updateLevelDrugRequests = this.detailList
12 months ago
//新增
12 months ago
if (this.type == 1) {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
if (this.status) {
this.newProductData.requireScanCode = 1
} else {
this.newProductData.requireScanCode = 0
}
12 months ago
if (this.detailList.length <= 0) {
this.$message.error('请先添加药品层级标识')
return
} else {
const validateItem = (item, fieldName, errorMessage) => {
if (!item[fieldName]) {
this.$message.error(errorMessage)
return false
12 months ago
}
return true
}
12 months ago
for (let i = 0; i < this.detailList.length; i++) {
const item = this.detailList[i]
12 months ago
if (!validateItem(item, 'nameCode', '药品层级标识不能为空!') ||
!validateItem(item, 'packLevel', '包装级别不能为空') ||
!validateItem(item, 'packUnit', '层级单位不能为空')) {
return
12 months ago
}
}
const isLevel1 = this.detailList.some(item => item.packLevel === 1)
12 months ago
if (!isLevel1) {
this.$message.error('药品层级缺少一级标识!')
12 months ago
}
this.newProductData.drugLevelLists = this.detailList
12 months ago
}
12 months ago
this.saveLoading = true
12 months ago
addDrug(this.newProductData).then((res) => {
this.saveLoading = false
if (res.code == 20000) {
this.$message.success('添加成功')
//清空弹窗数据
this.closeDialog()
} else {
this.$message.error(res.message)
}
}).catch((error) => {
this.saveLoading = false
this.$message.error(error.message)
})
}
})
} else {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return this.$message.error('请补充必要数据')
}
if (this.status) {
this.newProductData.requireScanCode = 1
12 months ago
} else {
this.newProductData.requireScanCode = 0
12 months ago
}
this.newProductData.uuid = this.rowData.uuid
this.newProductData.nameCode = this.rowData.nameCode
this.newProductData.relId = this.newProductData.id
updatetDrug(this.newProductData).then(res => {
this.saveLoading = false
if (res.code == 20000) {
//清空弹窗数据
this.closeDialog()
this.$message.success('保存成功')
} else {
this.$message.error(res.message)
}
})
12 months ago
})
}
},
closeAddDialog() {
this.closeDialog()
},
12 months ago
//层级保存
levelSave(row) {
this.editRowSwitch = false
if (isBlank(row.nameCode)) {
this.$message.error('层级标识不能为空')
12 months ago
return
}
if (isBlank(row.packLevel)) {
this.$message.error('包装级别不能为空')
12 months ago
return
}
if (isBlank(row.packUnit)) {
this.$message.error('层级单位不能为空')
12 months ago
return
}
if (isBlank(row.bhxjsl)) {
this.$message.error('请填写下级数量')
return
}
12 months ago
let editQuery = {
nameCode: row.nameCode,
packLevel: row.packLevel,
packUnit: row.packUnit,
sjcpbm: row.sjcpbm,
bhxjcpbm: row.bhxjcpbm,
bhxjsl: row.bhxjsl,
8 months ago
relId: this.newProductData.rlId,
uuid: this.newProductData.uuid,
productId: row.productId,
diType: row.diType,
xjdw: row.xjdw
12 months ago
}
updateLevelDrug(editQuery).then(res => {
this.saveLoading = false
if (res.code == 20000) {
this.isSave = true
this.$message.success('保存成功!')
this.selectedIndex = null
this.getDetailList()
this.getDiLevel();
//如果都为空 进行补充
if (!this.$isNotBlank(this.newProductData.sptm) && !this.$isNotBlank(this.newProductData.ybbm)) {
8 months ago
getCodeRelDetail({drugCode: row.nameCode}).then((response) => {
if (response.code == 20000) {
if (response.data != null && response.data.length > 0) {
this.newProductData.sptm = response.data[0].sptm;
this.newProductData.ybbm = response.data[0].ybbm;
this.getYbDrugData()
}
8 months ago
}
}).catch(() => {
})
}
12 months ago
} else {
this.isSave = true
12 months ago
this.$message.error(res.message)
}
})
},
update(row) {
row.isDisabled = false
row.isUpDisabled = true
row.rowDisabled = false
},
8 months ago
selectDrugLevel() {
//获取分页列表
this.filterQueryDrugLevel.approvalNum = this.newProductData.zczbhhzbapzbh
getDrugLevelList(this.filterQueryDrugLevel).then((response) => {
if (response.code == 20000) {
this.selectDrugLevelList = response.data.list || []
this.filterQueryDrugLevel.total = response.data.total || 0
this.selectDrugLevelVisible = true
}
}).catch(() => {
})
},
8 months ago
extractNumber(bzgg) {
// 使用正则表达式提取数字
const match = bzgg.match(/^\d+/);
// 如果匹配到则返回数字否则返回null
return match ? parseInt(match[0], 10) : null;
},
extractUnitAfterNumber(bzgg) {
// 使用正则表达式提取数字后面的单位
const match = bzgg.match(/^\d+([^\d/]+)/);
// 如果匹配到则返回单位否则返回null
return match ? match[1].trim() : null;
},
selectDrugLevelItem(row) {
getDrugLevelListBycode({nameCode: row.nameCode}).then((response) => {
if (response.code == 20000) {
8 months ago
if (response.data.length > 0) {
response.data.forEach(item => {
let parts = item.bzgg.split('/');
8 months ago
const levels = item.packRatio.split(":").map(Number);
const calculatedLevels = [levels[0]];
for (let i = levels.length - 1; i > 0; i--) {
const ratio = levels[i] / levels[i - 1];
calculatedLevels.unshift(ratio);
}
8 months ago
calculatedLevels.reverse();
let selectedValue = calculatedLevels[item.packLevel - 1];
console.log(item)
if (item.packLevel == 1) {
selectedValue = this.extractNumber(this.newProductData.bzgg)
item.xjdw = this.extractUnitAfterNumber(this.newProductData.bzgg)
}
// const ratioParts = item.packRatio.split(':');
// let selectedValue;
// if (item.packLevel >= 0 && item.packLevel < ratioParts.length) {
// selectedValue = ratioParts[item.packLevel];
// } else {
// selectedValue = 1; // 或者你可以设置一个默认值
// }
let editQuery = {
nameCode: item.nameCode,
packLevel: item.packLevel,
packUnit: parts[1] || '',
bhxjsl: selectedValue,
relId: this.newProductData.id,
uuid: this.newProductData.uuid,
productId: item.productId,
8 months ago
diType: item.packLevel == 1 ? 1 : 4,
xjdw: item.xjdw
}
updateLevelDrug(editQuery).then(res => {
this.saveLoading = false
if (res.code == 20000) {
this.detailList.push({
nameCode: item.nameCode,
packLevel: item.packLevel,
packUnit: parts[1] || '',
bhxjsl: selectedValue,
8 months ago
diType: item.packLevel == 1 ? 1 : 4,
isDisabled: false,
rowDisabled: false,
isUpDisabled: true
})
}
})
})
}
}
}).catch(() => {
})
this.newProductData.productId = null
this.selectedIndex = this.detailList.length - 1
this.isSave = false
this.selectDrugLevelVisible = false
8 months ago
this.getDetailList()
}
,
handleCurrentChange() {
this.selectDrugLevel()
8 months ago
}
,
12 months ago
addDrugLevel() {
this.detailList.push({
nameCode: '',
packLevel: null,
bhxjsl: null,
isDisabled: false,
rowDisabled: false,
isUpDisabled: true
})
this.newProductData.productId = null
this.selectedIndex = this.detailList.length - 1
this.isSave = false
8 months ago
}
,
12 months ago
rowChange(index, val) {
8 months ago
if (this.editRowSwitch == true) {
this.$message.error('请先保存当前产品标识编辑')
return
}
this.selectedIndex = index
this.isSave = false
this.editRowSwitch = true
8 months ago
}
,
12 months ago
deleteLevel(index, row) {
this.$confirm('此操作将删除该层级,是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (row.id != null) {
let params = {nameCode: row.nameCode}
delDrugLevel(params).then((res) => {
if (res.code === 20000) {
this.isSave = true
this.$message.success('删除成功')
this.getDetailList()
this.getDiLevel()
this.newProductData.distributeLevel = null
this.newProductData.distributeMaxLevel = null
this.newProductData.useLevel = null
this.newProductData.useMaxLevel = null
}
})
} else {
this.isSave = true
this.detailList.splice(index, 1)
this.$message.success('删除成功')
}
12 months ago
}).catch(() => {
})
8 months ago
}
,
//设置层级
// setDefaultLevel(){
// //判断流通 最大层级
// if (this.newProductData.distributeMaxLevel == null){
// let levelUnit = this.levelUnitList[this.levelUnitList.length - 1];
// this.newProductData.distributeMaxLevel = levelUnit.packLevel
// }
// // 判断使用 采集最大层级
// if (this.newProductData.useMaxLevel == null){
// //获取获取第一个 如果packUnit且为null的话就设置第二个
// let levelUnit = this.levelUnitList[0];
// if (isBlank(levelUnit.packUnit)){
// levelUnit = this.levelUnitList[1]
// }
// this.newProductData.useMaxLevel = levelUnit.packLevel
// }
// },
//获取层级标识
12 months ago
getDetailList() {
if (this.newProductData.uuid != null) {
let query = {
uuid: this.newProductData.uuid,
id: this.newProductData.id,
nameCode: this.newProductData.nameCode,
productType: this.newProductData.productsType,
12 months ago
}
this.loading = true
12 months ago
filterByUuid(query)
.then((response) => {
this.loading = false
this.detailList = response.data || []
12 months ago
})
.catch(() => {
this.loading = false
this.detailList = []
})
12 months ago
}
8 months ago
}
,
12 months ago
distributeLevelDiChange(val) {
const matchingItem = this.detailList.find(item => item.nameCode == val)
12 months ago
if (matchingItem) {
this.newProductData.distributeLevelUnit = matchingItem.packUnit
this.newProductData.distributeLevel = matchingItem.packLevel
12 months ago
}
calculateDistCount(matchingItem).then((res) => {
this.newProductData = {
...this.newProductData,
distributeLevelCount: res.data.distributeLevelCount
}
})
8 months ago
}
,
12 months ago
useLevelDiChange(val) {
const matchingItem = this.detailList.find(item => item.nameCode == val)
12 months ago
if (matchingItem) {
this.newProductData.useLevelUnit = matchingItem.packUnit
this.newProductData.useLevel = matchingItem.packLevel
12 months ago
}
calculateUseCount(matchingItem).then((res) => {
this.newProductData = {
...this.newProductData,
useLeverCount: res.data.useLeverCount
}
})
8 months ago
}
,
getDiLevel() {
let query = {
id: this.relId
}
this.loading = true
levelByUuid(query)
.then((response) => {
this.loading = false
this.levelUnitList = response.data || []
this.findMaxLevelObject()
})
.catch(() => {
this.loading = false
this.levelUnitList = []
})
8 months ago
}
,
12 months ago
findMaxLevelObject() {
this.maxLevel = 1;
for (const obj of this.levelUnitList) {
if (obj.packLevel > this.maxLevel) {
this.maxLevel = Number(obj.packLevel);
}
}
8 months ago
}
,
/**
* 选择收费项目
*/
selectPayFeecode() {
this.tollProjectDialogVisible = true
8 months ago
}
,
getData(data) {
this.tollProjectDialogVisible = false
this.newProductData.payFeeCode = data.medCatalogCode
8 months ago
}
,
/**
* 第三方系统药品信息
*/
getThirdSysDetail() {
let query = {
id: this.relevanceEdit.id
}
thirdSysDetail(query)
.then((response) => {
this.loading = false
this.sysList = response.data.list || []
this.resetThirdId()
})
.catch(() => {
this.loading = false
this.sysList = []
})
8 months ago
}
,
resetThirdId() {
this.sysList.forEach((item) => {
if (item.sysId === 'thirdId') {
this.newProductData.thirdId = item.thirdId
} else if (item.sysId === 'thirdId1') {
this.newProductData.thirdId1 = item.thirdId
} else if (item.sysId === 'thirdId2') {
this.newProductData.thirdId2 = item.thirdId
} else if (item.sysId === 'thirdId3') {
this.newProductData.thirdId3 = item.thirdId
} else if (item.sysId === 'thirdId4') {
this.newProductData.thirdId4 = item.thirdId
}
})
8 months ago
}
,
/**
* 关联 第三方
*/
addSelectErp(row) {
this.defaultSys = row.sysId
this.isImport = false
this.chooseHouseDrugVisible = true
8 months ago
}
,
removeErp(row) {
this.$confirm('此操作将解除该绑定药品信息, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
let query = {
relId: this.relId,
thirdSys: row.sysId
}
removeRl(query)
.then((response) => {
if (response.code == 20000) {
this.$message({
type: 'success',
message: '解绑成功!'
})
this.getThirdSysDetail()
} else {
this.$message.error(response.message)
}
})
.catch(() => {
})
})
.catch(() => {
})
8 months ago
}
,
closeUdi(val) {
this.chooseHouseDrugVisible = false
this.getThirdSysDetail()
8 months ago
}
,
handleInput(index, value, type) {
const intValue = parseInt(value, 10);
// 更新行的数据
8 months ago
if (type == 1) {
this.$set(this.detailList[index], 'packLevel', intValue);
8 months ago
} else {
this.$set(this.detailList[index], 'bhxjsl', intValue);
}
}
12 months ago
12 months ago
},
created() {
if (this.rowData != null) {
this.newProductData = this.rowData
this.newProductData.cpmctymc = this.rowData.cpmctymc
this.newProductData.zczbhhzbapzbh = this.rowData.zczbhhzbapzbh
12 months ago
if (this.rowData.requireScanCode == 1) {
this.status = true
} else {
this.status = false
}
this.getDiLevel()
this.getDetailList()
this.getThirdSysDetail()
} else {
this.selectedIndex = 0
12 months ago
}
8 months ago
}
,
12 months ago
directives: {
8 months ago
'debounce-input':
{
inserted(el, binding) {
let timeout
el.addEventListener('input', () => {
clearTimeout(timeout)
timeout = setTimeout(() => {
binding.value()
}, parseInt(binding.arg) || 300)
})
}
12 months ago
}
}
}
</script>
<style scoped>
.form-title {
font-size: 16px;
font-family: Noto Sans SC;
font-weight: bold;
color: #303133;
padding-bottom: 17px;
padding-top: 17px;
}
.form-title2 {
font-size: 16px;
font-family: Noto Sans SC;
font-weight: bold;
color: #303133;
}
12 months ago
</style>