12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856 |
- <template>
- <div class="main-contain">
- <div class="app-container " style="padding-left:0px;margin:0px;" v-loading="loading"
- element-loading-text="拼命加载中">
- <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
- <div>
- <span style="font-size:14px;color:#606266">仓库:</span>
- <el-select v-model="storehouse_id" style="width:200px;margin-right:10px;" placeholder="请选择"
- filterable
- @change="changeStorehouseName">
- <el-option
- v-for="item in houseList"
- :key="item.id"
- :label="item.storehouse_name"
- :value="item.id">
- </el-option>
- </el-select>
- <span style="font-size:14px;color:#606266">库存预警:</span>
- <el-select v-model="good_type" style="width:250px;margin-right:10px;" placeholder="请选择"
- filterable
- @change="changeGoodName">
- <el-option
- v-for="item in goodList"
- :key="item.id"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- <el-input v-model="keyword" style="width:200px" placeholder="请输入药品名称或生产厂商" ></el-input>
- <el-button type="primary" icon="el-icon-search" @click="seach">搜索</el-button>
- </div>
-
- <div>
- <!-- <el-button
- size="small"
- class="filter-item"
- type="primary"
- @click="toCheck"
- >调试
- </el-button> -->
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- @click="toSet"
- >设置
- </el-button>
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- icon="el-icon-printer"
- @click="printOrder"
- >打印
- </el-button>
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- @click="exportStock"
- >导出
- </el-button>
- </div>
- </div>
-
- <el-table
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266'
- }"
- :data="tableList"
- :class="signAndWeighBoxPatients"
- border
- :cell-class-name="cellStyle"
- >
- <el-table-column label="药品类型" align="center">
- <template slot-scope="scope">
- {{getDrugTypeName(scope.row.drug_type)}}
- </template>
- </el-table-column>
-
- <el-table-column label="医保等级" align="center" v-if="org_id ==10697 || org_id == 0">
- <template slot-scope="scope">
- <span>{{getMedicalInsuranceLeve(scope.row.medical_insurance_level)?getMedicalInsuranceLeve(scope.row.medical_insurance_level):"" }}</span>
- </template>
- </el-table-column>
- <el-table-column label="药品名称" align="center">
- <template slot-scope="scope">
- {{scope.row.drug_name}}
- </template>
- </el-table-column>
- <el-table-column label="规格&单位" align="center">
- <template slot-scope="scope">
- {{scope.row.dose}}{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
- </template>
- </el-table-column>
- <el-table-column label="零售价" align="center" v-if="org_id ==10697 || org_id == 0">
- <template slot-scope="scope">
- {{scope.row.retail_price}}
- </template>
- </el-table-column>
- <el-table-column label="生产厂商" align="center">
- <template slot-scope="scope">
- {{getManufacturName(scope.row.manufacturer)}}
- </template>
- </el-table-column>
- <el-table-column label="经销商" align="center" v-if="org_id ==10485">
- <template slot-scope="scope">
- {{getDearName(scope.row.dealer)}}
- </template>
- </el-table-column>
- <el-table-column label="批准文号" align="center">
- <template slot-scope="scope">
- {{scope.row.number}}
- </template>
- </el-table-column>
- <el-table-column label="国家编码" align="center">
- <template slot-scope="scope">
- {{scope.row.medical_insurance_number}}
- </template>
- </el-table-column>
- <el-table-column label="仓库名称" align="center">
- <template slot-scope="scope">
- <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
- <td style="border-right: none;border-inline-end: none;text-align: center;">
- {{ getHouseName(item.storehouse_id) }}
- </td>
- </tr>
- </template>
- </el-table-column>
-
- <el-table-column label="入库数量" align="center">
- <template slot-scope="scope">
- <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
- <td style="border-right: none;border-inline-end: none;text-align: center; ">
-
- {{getDrugIn(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
- </td>
- </tr>
- </template>
- </el-table-column>
-
- <el-table-column label="出库数量" align="center">
- <template slot-scope="scope">
- <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
- <td style="border-right: none;border-inline-end: none;text-align: center;">
- <span>
-
- {{getActOut(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
- </span>
- </td>
- </tr>
- </template>
- </el-table-column>
-
- <el-table-column label="退库数量" align="center">
- <template slot-scope="scope">
- <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
- <td style="border-right: none;border-inline-end: none;text-align: center;">
-
- {{getDrugCancel(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
- </td>
- </tr>
- </template>
- </el-table-column>
-
- <el-table-column label="实际出库" align="center">
- <template slot-scope="scope">
- <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
- <td style="border-right: none;border-inline-end: none;text-align: center;">
-
- <span style="color:#0099FF" @click="toDialogClick(scope.row.id,scope.row.drug_name,scope.row.dose,scope.row.dose_unit,scope.row.min_number,scope.row.min_unit,scope.row.max_unit,item.storehouse_id)">
- {{getDrugOut(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
- </span>
- </td>
- </tr>
- </template>
- </el-table-column>
-
- <el-table-column label="剩余库存" align="center">
- <template slot-scope="scope">
- <tr style="background: none" v-for="(item, index) in scope.row.drug_stock_info" :key="index">
- <td style="border-right: none;border-inline-end: none;text-align: center;">
- {{getFlushCount(item.storehouse_id,scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
- </td>
- </tr>
- </template>
- </el-table-column>
-
- <el-table-column label="总库存量" align="center">
- <template slot-scope="scope">
- <div v-if="getWarehoseInfo(scope.row.drug_warehouse_info) > 0">
-
- <span v-if="scope.row.sum_count<= (parseInt(scope.row.drug_stock_limit)*scope.row.min_number)" style="color:red">{{getSumCount(scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}<i class="el-icon-warning"></i></span>
-
- <span v-if="scope.row.sum_count > (parseInt(scope.row.drug_stock_limit)*scope.row.min_number)">{{getSumCount(scope.row.drug_stock_count,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}</span>
- </div>
- </template>
- </el-table-column>
-
- <el-table-column
- prop="drug_name"
- label="操作"
- align="center"
- width="200px"
- >
- <template slot-scope="scope">
- <el-button
- size="small"
- type="primary"
- @click="handleDetail(scope.row)"
- >库存流水
- </el-button>
- <el-button
- size="small"
- type="primary"
- @click="handleBatch(scope.row)"
- >批次
- </el-button>
- <!-- <el-button
- size="small"
- type="primary"
- @click="handleCheckBatch(scope.row)"
- >自查
- </el-button> -->
- </template>
-
-
- </el-table-column>
- </el-table>
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 50, 100,200,300,400,500,1000]"
- :page-size="10"
- background
- align="right"
- style="margin-top:20px;"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </div>
-
-
- <el-dialog
- title="出库详情"
- :visible.sync="dialogVisible"
- width="70%">
- <span>
- 药品名称:{{drug_name}}
- 规格&单位:{{specification_name}}
- 查询日期:
- <el-date-picker
- size="small"
- v-model="start_first_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 150px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- @change="startFirstTimeChange"
- ></el-date-picker>
- <span>-</span>
- <el-date-picker
- size="small"
- v-model="end_first_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 150px;"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- @change="endEndTimeChange"
- ></el-date-picker>
- </span>
- <el-divider></el-divider>
- <el-table
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266'
- }"
- :data="tableData"
- :class="signAndWeighBoxPatients"
- border
- >
- <el-table-column label="序号" align="center">
- <template slot-scope="scope">
- {{scope.$index + 1}}
- </template>
- </el-table-column>
- <el-table-column label="单据编号" align="center">
- <template slot-scope="scope">
- {{scope.row.warehouse_out_order_number}}
- </template>
- </el-table-column>
- <el-table-column label="操作时间" align="center">
- <template slot-scope="scope">
- {{getTimeOne(scope.row.ctime)}}
- </template>
- </el-table-column>
- <el-table-column label="出库数量" align="center">
- <template slot-scope="scope">
- {{scope.row.count}}{{scope.row.count_unit}}
-
- </template>
- </el-table-column>
- <el-table-column label="库存数量" align="center">
- <template slot-scope="scope">
-
- <span v-if="parseInt(scope.row.over_count/scope.row.drug.min_number) > 0">{{parseInt(scope.row.over_count/scope.row.drug.min_number)}}{{scope.row.drug.max_unit}}</span>
- <span v-if="scope.row.over_count%scope.row.drug.min_number > 0">{{scope.row.over_count%scope.row.drug.min_number}}{{scope.row.drug.min_unit}}</span>
- </template>
- </el-table-column>
-
- <el-table-column label="使用人" align="center">
- <template slot-scope="scope">
- {{getName(scope.row.patient_id)}}
- </template>
- </el-table-column>
- <el-table-column label="备注" align="center">
- <template slot-scope="scope">
- {{scope.row.remark}}
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- @size-change="handleSizeChangeOne"
- @current-change="handleCurrentChangeOne"
- :page-sizes="[10, 50, 100,200,500,1000]"
- :page-size="10"
- background
- align="right"
- style="margin-top:20px;"
- layout="total, sizes, prev, pager, next, jumper"
- :total="totalone"
- >
- </el-pagination>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
- </span>
- </el-dialog>
-
- <el-dialog title="设置" :visible.sync="visibility" :close-on-click-modal="isClose"
- :close-on-press-escape="isClose">
- <div style="text-align: center;">
-
- <div>
- <el-button type="primary" v-if="!is_open" @click="changeOpen(1)">启用自动扣减</el-button>
- <el-button type="danger" v-if="is_open" @click="changeOpen(2)">关闭自动扣减</el-button>
- <div style="margin-top: 40px;"><p style="color:#909399;text-align: center;">
- 启用“药品管理”后,在开透析医嘱时,医生可以选择药品后将自动产生出库单</p></div>
- </div>
- </div>
-
- <span slot="footer" class="dialog-footer">
- <el-button @click="hide()">取 消</el-button>
- </span>
- </el-dialog>
-
-
- <el-dialog
- title="自查数据"
- :visible.sync="checkdialogVisible"
- width="50%">
- <span>
- <span>ID:{{drug_id}}</span>
- <el-table
- :data="checkData"
- border
- style="width: 100%">
- <el-table-column prop="date" label="开药日期" width="180" align="center">
- <template slot-scope="scope" >
- {{ getTime(scope.row.advice_date) }}
- </template>
- </el-table-column>
- <el-table-column prop="date" label="时间搓" width="180" align="center">
- <template slot-scope="scope" >
- {{scope.row.advice_date}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="开药数量" width="180" align="center">
- <template slot-scope="scope" >
- {{ scope.row.check_count }}
- </template>
- </el-table-column>
- <el-table-column prop="address" label="出库数量" align="center">
- <template slot-scope="scope" >
- {{getCount(scope.row.advice_date)}}
- </template>
- </el-table-column>
-
- <el-table-column prop="address" label="是否异常" align="center">
- <template slot-scope="scope" >
- <span v-if="scope.row.check_count==getCount(scope.row.advice_date)">否</span>
- <span v-if="scope.row.check_count!=getCount(scope.row.advice_date)" style="color:red">是</span>
- </template>
- </el-table-column>
- </el-table>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="checkdialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="checkdialogVisible = false">确 定</el-button>
- </span>
- </el-dialog>
-
- </div>
- </template>
- <script>
- import { getStorehouseList,getDrugNewQuery,getDrugWarehouseOutInfoById } from "@/api/drug/drug"
- import { createDrugStockAutomaticReduceConfig, getDrugStockAutomaticReduceConfig,getDrugInitDataList,getCheckDrugBatchList } from '@/api/drug/drug_stock'
- import { uParseTime } from '@/utils/tools'
- import { max } from 'moment'
-
- const moment = require('moment')
- export default {
-
- data(){
- return{
- tableList:[],
- goodList:[
- {id:1,name:"全部药品"},
- {id:2,name:"库存预警"},
- {id:3,name:"库存为零"},
- {id:4,name:"库存不为零"},
- ],
- houseList:[],
- storehouse_id:0,
- good_type:1,
- multipleSelection: [],
- signAndWeighBoxPatients: "sign-and-weigh-box-patients",
- manufacturerList:[],
- limit:10,
- page:1,
- total:0,
- limitone:10,
- pageone:1,
- totalone:0,
- keyword:"",
- goodTypeList:[],
- start_time:"",
- end_time:"",
- countList:[],
- outCountList:[],
- autoCountList:[],
- cancelCountList:[],
- org_id:this.$store.getters.xt_user.org_id,
- dialogVisible:false,
- start_first_time:moment().startOf('month').format("YYYY-MM-DD"),
- end_first_time:moment().endOf('month').format("YYYY-MM-DD"),
- tableData:[],
- drug_id:0,
- patientList:[],
- drug_name:"",
- specification_name:"",
- drugTypeList:[],
- loading:false,
- flushList:[],
- flushListOne:[],
- dose:"",
- dose_unit:"",
- min_number:0,
- max_unit:"",
- min_unit:"",
- is_open: false,
- visibility: false,
- isClose: false,
- drug_type: 0,
- storehouseId:0,
- dealerList:[],
- checkdialogVisible:false,
- checkData:[],
- outData:[],
- drug_id:0,
- medicalInsuranceLevelList:[]
- }
-
- },
- methods:{
- getMedicalInsuranceLeve(id){
- var name = ""
- for(let i=0;i<this.medicalInsuranceLevelList.length;i++){
- if(id == this.medicalInsuranceLevelList[i].value){
- name = this.medicalInsuranceLevelList[i].name
- }
- }
- return name
- },
- changeStorehouseName(){
- this.getlist()
- },
- changeGoodName(){
- this.getlist()
- },
- toClick(val){
- var manufacturer_name = ""
- var specification_name = ""
- for(let i=0;i<this.manufacturerList.length;i++){
- if(val.manufacturer == this.manufacturerList[i].id){
- manufacturer_name = this.manufacturerList[i].manufacturer_name
- }
- }
- specification_name = val.specification_name + "/" + val.packing_unit
- var overCount = this.getOverplus(val.xt_warehouse_info)
- // window.sessionStorage.setItem('start_time',this.start_time)
- // window.sessionStorage.setItem('end_time',this.end_time)
- this.$router.push({path:"/stock/in/stockflow?id="+val.id+"&manufacturer="+manufacturer_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
- },
- toClickOne(val){
-
- var manufacturer_name = ""
- var specification_name = ""
- for(let i=0;i<this.manufacturerList.length;i++){
- if(val.manufacturer == this.manufacturerList[i].id){
- manufacturer_name = this.manufacturerList[i].manufacturer_name
- }
- }
- specification_name = val.specification_name + "/" + val.packing_unit
- var overCount = this.getOverplus(val.xt_warehouse_info)
- // window.sessionStorage.setItem('start_time',this.start_time)
- // window.sessionStorage.setItem('end_time',this.end_time)
- this.$router.push({path:"/stock/in/stockbatchnumber?id="+val.id+"&manufacturer="+manufacturer_name+"&packing_unit="+val.packing_unit+"&overCount="+overCount})
- },
-
- getStorehouseList(){
- getStorehouseList().then(response=>{
- if(response.data.state == 1){
- var houseList = response.data.data.list
- var obj = {id:0,storehouse_name:"全部"}
- this.houseList.push(obj)
- for(let i=0;i<houseList.length;i++){
- this.houseList.push(houseList[i])
- }
- this.manufacturerList = response.data.data.manufacturerList
- this.goodTypeList = response.data.data.goodTypeList
- this.patientList = response.data.data.patientList
- this.dealerList = response.data.data.dealerList
- }
- })
- },
- getlist(){
- this.loading = true
- var params = {
- storehouse_id:this.storehouse_id,
- good_type:this.good_type,
- keyword:this.keyword,
- page:this.page,
- limit:this.limit,
- start_time:this.start_time,
- end_time:this.end_time,
- }
- this.tableList = []
- getDrugNewQuery(params).then(response=>{
- if(response.data.state == 1){
- this.loading = false
- // var list = response.data.data.list
-
- var countList = response.data.data.countList
- console.log("countList999999999999",countList)
- for (let i = 0; i < countList.length; i++) {
- if(countList[i].drug_stock_limit == ""){
- countList[i].drug_stock_limit = 0
- }
- for (let j = 0; j < countList[i].drug_warehouse_info.length; j++) {
- if (countList[i].max_unit == countList[i].drug_warehouse_info[j].max_unit) {
- countList[i].drug_warehouse_info[j].stock_max_number =countList[i].min_number *countList[i].drug_warehouse_info[j].stock_max_number
- countList[i].drug_warehouse_info[j].warehousing_count =countList[i].min_number *countList[i].drug_warehouse_info[j].warehousing_count
- }
- }
- }
- this.tableList = countList
- // for (let i = 0; i < list.length; i++) {
- // for (let j = 0; j < list[i].drug_warehouse_info.length; j++) {
- // if (list[i].max_unit == list[i].drug_warehouse_info[j].max_unit) {
- // list[i].drug_warehouse_info[j].stock_max_number =list[i].min_number *list[i].drug_warehouse_info[j].stock_max_number
- // list[i].drug_warehouse_info[j].warehousing_count =list[i].min_number *list[i].drug_warehouse_info[j].warehousing_count
- // }
- // }
- // for (let y = 0; y < list[i].drug_warehouse_out.length; y++) {
- // if (list[i].drug_warehouse_out[y].count_unit == list[i].max_unit) {
- // list[i].drug_warehouse_out[y].count =list[i].drug_warehouse_out[y].count * list[i].min_number
- // }
- // }
- // for (let z = 0; z < list[i].drug_cancel_stock_info.length; z++) {
- // if (list[i].drug_cancel_stock_info[z].max_unit == list[i].max_unit) {
- // list[i].drug_cancel_stock_info[z].count =list[i].drug_cancel_stock_info[z].count * list[i].min_number
- // }
- // }
-
- // for (let m = 0; m < list[i].drug_flow_info.length; m++) {
- // if (list[i].drug_flow_info[m].max_unit == list[i].max_unit) {
- // list[i].drug_flow_info[m].count =list[i].drug_flow_info[m].count * list[i].min_number
- // }
- // }
-
- // for (let n = 0; n< list[i].drug_act_flow_info.length; n++) {
- // if (list[i].drug_act_flow_info[n].max_unit == list[i].max_unit) {
- // list[i].drug_act_flow_info[n].count =list[i].drug_act_flow_info[n].count * list[i].min_number
- // }
- // }
- // }
- // var arr = [];
- // for (let i = 0; i < list.length; i++) {
- // if (list[i].drug_warehouse_info.length > 0) {
- // arr.push(list[i]);
- // }
- // }
- // this.tableList = arr;
- this.total = response.data.data.total
- this.drugTypeList = response.data.data.drugTypeList
-
- this.medicalInsuranceLevelList = response.data.data.medicalInsuranceLevelList
- }
- })
- },
- getManufacturName(id){
- var manufacturer_name = ""
- for(let i=0;i<this.manufacturerList.length;i++){
- if(id == this.manufacturerList[i].id){
- manufacturer_name = this.manufacturerList[i].manufacturer_name
- }
- }
- return manufacturer_name
- },
- handleSizeChange(val) {
- this.limit = val;
- this.getlist()
- },
- handleCurrentChange(val) {
- this.page = val;
- this.getlist()
- },
- handleSizeChangeOne(val) {
- this.limitone = val;
- this.toDialogClick(this.drug_id,this.drug_name,this.dose,this.dose_unit,this.min_number,this.min_unit,this.max_unit,this.storehouseId)
- },
- handleCurrentChangeOne(val) {
- this.pageone = val;
- this.toDialogClick(this.drug_id,this.drug_name,this.dose,this.dose_unit,this.min_number,this.min_unit,this.max_unit,this.storehouseId)
- },
- seach(){
- this.getlist()
- },
- getGoodTypeName(id){
- var type_name = ""
- for(let i=0;i<this.goodTypeList.length;i++){
- if(id == this.goodTypeList[i].id){
- type_name = this.goodTypeList[i].type_name
- }
- }
- return type_name
- },
- getHouseName(id){
- var storehouse_name = ""
- for(let i=0;i<this.houseList.length;i++){
- if(id == this.houseList[i].id){
- storehouse_name = this.houseList[i].storehouse_name
- }
- }
- return storehouse_name
- },
- getWareInfoCount(val,storehouse_id){
- var count = 0
- if(val.length > 0){
- for(let i=0;i<val.length;i++){
- if(val[i].storehouse_id == storehouse_id){
- count +=val[i].warehousing_count
- }
- }
- }
- if(count > 0){
- return count
- }else{
- return ""
- }
- },
- getOverFlushInfo(arr, max_unit, min_unit, min_number) {
- console.log("ar232323232323232wo",arr)
- var max_str = "";
- var min_str = "";
- var total = 0;
- var newarr = arr;
- if (newarr.length > 0) {
- for (let i = 0; i < newarr.length; i++) {
- total += newarr[i].stock_max_number + newarr[i].stock_min_number;
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
- toDialogClick(id,drug_name,dose,dose_unit,min_number,min_unit,max_unit,storehouse_id){
- this.drug_id = id
- this.drug_name = drug_name
- this.dose = dose
- this.dose_unit = dose_unit
- this.min_number = min_number
- this.min_unit = min_unit
- this.max_unit = max_unit
- this.specification_name = dose + dose_unit + "*"+min_number+min_unit +"/"+ max_unit
- this.storehouseId = storehouse_id
- var params = {
- drug_id:id,
- limit:this.limitone,
- page:this.pageone,
- start_first_time:this.start_first_time,
- end_first_time:this.end_first_time,
- storehouse_id:storehouse_id,
- }
- getDrugWarehouseOutInfoById(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- console.log("list23233233232w",list)
- this.tableData = list
- var flushList = response.data.data.flushList
- console.log("flushList",flushList)
- this.flushList = flushList
- var flushListOne = response.data.data.flushListOne
- this.flushListOne = flushListOne
- this.totalone = response.data.data.total
- this.dialogVisible = true
- }
- })
-
- },
- startFirstTimeChange(){
- this.toDialogClick(this.drug_id,this.drug_name,this.dose,this.dose_unit,this.min_number,this.min_unit,this.max_unit,this.storehouseId)
- },
- endEndTimeChange(){
- this.toDialogClick(this.drug_id,this.drug_name,this.dose,this.dose_unit,this.min_number,this.min_unit,this.max_unit,this.storehouseId)
- },
- getTime(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d}')
- }
- },
- getTimeOne(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d} {h}:{i}')
- }
- },
- getName(id){
- var name = ""
- for(let i=0;i<this.patientList.length;i++){
- if(id == this.patientList[i].id){
- name = this.patientList[i].name
- }
- }
- return name
- },
- getDrugTypeName(id){
- var type_name = ""
- for(let i=0;i<this.drugTypeList.length;i++){
- if(id == this.drugTypeList[i].value){
- type_name = this.drugTypeList[i].name
- }
- }
- return type_name
- },
- getWarehoseInfoSeven(arr, max_unit, min_unit, min_number, storehouse_id) {
- var total = 0;
- var max_str = "";
- var min_str = "";
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- if (arr[i].storehouse_id == storehouse_id) {
- total += parseInt(arr[i].warehousing_count);
- }
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
- getOutFlushNightSix(info, max_unit, min_unit,min_number,storehouse_id,val){
- var str = "";
- var str_min = "";
-
- //总库存
- var total = 0;
- var total_one = 0
- var total_two = 0
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- total_one += info[i].count;
- }
- }
- if(val!=null && val.length > 0){
- for (let i = 0; i < val.length; i++) {
- if (val[i].storehouse_id == storehouse_id) {
- total_two += val[i].count;
- }
- }
- }
-
- if((total_one - total_two) > 0){
- total = total_one - total_two
- }
-
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- str_min = (total % min_number) + min_unit;
- }
- return str + str_min;
- },
- getOutFlushNightSeven(info, max_unit, min_unit,min_number,storehouse_id){
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- var totalOne = 0
- var totalTwo = 0
- if(info!=null && info.length > 0){
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- totalOne += info[i].count;
- }
- }
- }
- total = totalOne
-
-
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- str_min = (total % min_number) + min_unit;
- }
- return str + str_min;
- },
- getOutFlushNight(info, max_unit, min_unit,min_number, cancel_info,storehouse_id){
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- var out_count = 0;
- var over_count = 0;
- var cancel_count = 0;
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- total += info[i].warehousing_count;
- }
- }
-
- for (let j = 0; j < info.length; j++) {
- if (info[j].storehouse_id == storehouse_id) {
- out_count += info[j].stock_max_number + info[j].stock_min_number;
- }
- }
- over_count = total - out_count;
- if (parseInt(over_count / min_number) != 0) {
- str = parseInt(over_count / min_number) + max_unit;
- }
- if (over_count % min_number != 0) {
- str_min = (over_count % min_number) + min_unit;
- }
- return str + str_min;
- },
- getOverFlushInfoEight(arr, max_unit, min_unit, min_number, storehouse_id) {
- var max_str = "";
- var min_str = "";
- var total = 0;
- var newarr = arr;
-
- if (newarr.length > 0) {
- for (let i = 0; i < newarr.length; i++) {
- if (newarr[i].storehouse_id == storehouse_id) {
- total += newarr[i].stock_max_number + newarr[i].stock_min_number;
- }
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return max_str + min_str;
- },
-
- getWarehoseInfo(arr) {
- var total = 0;
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total += parseInt(arr[i].warehousing_count);
- }
- }
- if (total == 0) {
- total = "";
- }
-
- return total;
- },
- getOutFlushTen(info, max_unit, min_unit,min_number,storehouse_id){
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- total += info[i].count;
- }
- }
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- str_min = (total % min_number) + min_unit;
- }
- return str + str_min;
- },
- getDrugOut(info, max_unit, min_unit,min_number,storehouse_id,cancel_stock_info){
-
- var str = "";
- var str_min = "";
- var cancel_count = 0
- var cha_count = 0
- //总库存
- var total = 0;
- for (let i = 0; i < info.length; i++) {
- if (info[i].storehouse_id == storehouse_id) {
- total += info[i].count;
- }
- }
- for (let i = 0; i < cancel_stock_info.length; i++) {
- if(cancel_stock_info[i].storehouse_id == storehouse_id) {
- cancel_count += cancel_stock_info[i].count;
- }
- }
- cha_count = total - cancel_count
-
- if (parseInt(cha_count / min_number) != 0) {
- str = parseInt(cha_count / min_number) + max_unit;
- }
- if (cha_count % min_number != 0) {
- str_min = (cha_count % min_number) + min_unit;
- }
- return str + str_min;
- },
- handleDetail(val) {
- var manufacturer_name = "";
- for (let i = 0; i < this.manufacturerList.length; i++) {
- if (val.manufacturer == this.manufacturerList[i].id) {
- manufacturer_name = this.manufacturerList[i].manufacturer_name;
- }
- }
- var over_plus = this.getOverFlushInfo(
- val.drug_warehouse_info,
- val.max_unit,
- val.min_unit,
- val.min_number
- );
- this.$router.push({
- path:
- "/drugstock/in/drugstockflow?drug_id=" +
- val.id +
- "&manufacturer=" +
- manufacturer_name +
- "&min_number=" +
- val.min_number +
- "&max_unit=" +
- val.max_unit +
- "&min_unit=" +
- val.min_unit +
- "&over_plus=" +
- over_plus,
- });
- window.sessionStorage.setItem("start_time", this.start_time);
- window.sessionStorage.setItem("end_time", this.end_time);
- },
- handleBatch(val) {
-
- var manufacturer_name = "";
- for (let i = 0; i < this.manufacturerList.length; i++) {
- if (val.manufacturer == this.manufacturerList[i].id) {
- manufacturer_name = this.manufacturerList[i].manufacturer_name;
- }
- }
- var unit =
- val.dose +
- val.dose_unit +
- "*" +
- val.min_number +
- val.min_unit +
- "/" +
- val.max_unit;
- var over_plus = this.getOverFlushInfo(
- val.drug_warehouse_info,
- val.max_unit,
- val.min_unit,
- val.min_number
- );
-
- window.sessionStorage.setItem("start_time", this.start_time);
- window.sessionStorage.setItem("end_time", this.end_time);
- this.$router.push({
- path:
- "/drugstock/in/drugbatchnumber?drug_id=" +
- val.id +
- "&manufacturer=" +
- manufacturer_name +
- "&unit=" +
- unit +
- "&min_number=" +
- val.min_number +
- "&max_unit=" +
- val.max_unit +
- "&min_unit=" +
- val.min_unit +
- "&over_plus=" +
- over_plus,
- });
- },
- handleCheckBatch(row){
- this.drug_id = row.id
- getCheckDrugBatchList(row.id).then(response=>{
- if(response.data.state ==1){
- var advicelist = response.data.data.advicelist
- var baseDrugList = response.data.data.baseDrugList
-
- var newArr= []
- var newArrOne = []
- if (advicelist.length >0){
- for(let i=0;i<advicelist.length;i++){
- advicelist[i].is_check_count =0
- if(advicelist[i].prescribing_number_unit == baseDrugList.max_unit && baseDrugList.max_unit!=baseDrugList.min_unit){
- advicelist[i].is_check_count = advicelist[i].prescribing_number * baseDrugList.min_number
- }
-
- if(advicelist[i].prescribing_number_unit == baseDrugList.min_unit && baseDrugList.max_unit!=baseDrugList.min_unit){
- advicelist[i].is_check_count = advicelist[i].prescribing_number
- }
-
- if(advicelist[i].prescribing_number_unit == baseDrugList.max_unit && baseDrugList.max_unit==baseDrugList.min_unit){
- advicelist[i].is_check_count = advicelist[i].prescribing_number
- }
- }
- console.log("advicelist",advicelist)
-
- let dataInfoOne = {}
- advicelist.forEach((item, index) => {
- let { advice_date } = item
- if (!dataInfoOne[advice_date]) {
- dataInfoOne[advice_date] = {
- advice_date:item.advice_date,
- check_count:0,
- child:[]
- }
- }
- })
- let hisarr = Object.values(dataInfoOne)
-
-
- if(hisarr!=null && hisarr.length>0){
- for(let i=0;i<hisarr.length;i++){
- for(let j=0;j<advicelist.length;j++){
- if(hisarr[i].advice_date == advicelist[j].advice_date){
- hisarr[i].child.push(advicelist[j])
- }
- }
- }
- }
- for(let i=0;i<hisarr.length;i++){
- for(let j=0;j<hisarr[i].child.length;j++){
- hisarr[i].check_count +=hisarr[i].child[j].is_check_count
- }
- }
- console.log("00000000000000000",hisarr)
-
- newArr=hisarr
- this.checkData = []
- this.checkData = hisarr
- }
-
- var outInfo = response.data.data.outInfo
-
- if(outInfo.length>0){
- for(let i=0;i<outInfo.length;i++){
- outInfo[i].is_check_count =0
- if(outInfo[i].count_unit == baseDrugList.max_unit && baseDrugList.max_unit!=baseDrugList.min_unit){
- outInfo[i].is_check_count = outInfo[i].count * baseDrugList.min_number
- }
-
- if(outInfo[i].count_unit == baseDrugList.min_unit && baseDrugList.max_unit!=baseDrugList.min_unit){
- outInfo[i].is_check_count = outInfo[i].count
- }
-
- if(outInfo[i].count_unit == baseDrugList.max_unit && baseDrugList.max_unit==baseDrugList.min_unit){
- outInfo[i].is_check_count = outInfo[i].count
- }
- }
-
- let dataInfoOne = {}
- outInfo.forEach((item, index) => {
- let { sys_record_time } = item
- if (!dataInfoOne[sys_record_time]) {
- dataInfoOne[sys_record_time] = {
- sys_record_time:item.sys_record_time,
- check_count:0,
- child:[]
- }
- }
- })
- let hisarr = Object.values(dataInfoOne)
-
-
- if(hisarr!=null && hisarr.length>0){
- for(let i=0;i<hisarr.length;i++){
- for(let j=0;j<outInfo.length;j++){
- if(hisarr[i].sys_record_time == outInfo[j].sys_record_time){
- hisarr[i].child.push(outInfo[j])
- }
- }
- }
- }
- for(let i=0;i<hisarr.length;i++){
- for(let j=0;j<hisarr[i].child.length;j++){
- hisarr[i].check_count +=hisarr[i].child[j].is_check_count
- }
- }
- console.log("00000000000000000",hisarr)
-
- newArrOne = hisarr
- this.outData=[]
- this.outData = hisarr
- }
-
- console.log("newArrOne",newArrOne)
- console.log("newarr",newArr)
- var outInfoOne = response.data.data.outInfoOne
- var drugflow = response.data.data.drugflow
- this.checkdialogVisible = true
- }
- })
- },
- getCount(advice_date){
- var count = 0
- for(let i=0;i<this.outData.length;i++){
- if(advice_date == this.outData[i].sys_record_time){
- count = this.outData[i].check_count
- }
- }
- return count
- },
- // 合并单元格样式
- cellStyle({ row, column, rowIndex, columnIndex }) {
- let arr = [5,6, 7, 8, 9,10,11];
- if (arr.indexOf(columnIndex) > -1) {
- return "spanClass";
- }
- },
-
- hide: function() {
- this.visibility = false
- },
- toSet: function() {
- this.getConfig()
- this.visibility = true
-
- }, changeOpen(val) {
- var message = ''
- if (val == 1) {
- message = '启用药品自动扣减功能'
- } else {
- message = '关闭药品自动扣减功能'
- }
-
- this.$confirm(message, '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'info'
- }).then(() => {
- createDrugStockAutomaticReduceConfig(val).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- if (response.data.data.is_open == 1) {
- this.is_open = true
- this.$message({
- type: 'success',
- message: '已启用'
- })
- } else {
- this.is_open = false
- this.$message({
- type: 'success',
- message: '已关闭'
- })
- }
- }
- })
- }).catch(() => {
-
- })
-
- },
- getConfig() {
- getDrugStockAutomaticReduceConfig().then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- var config = response.data.data.config
- if (config.is_open == 1) {
- this.is_open = true
- } else {
- this.is_open = false
- }
- }
- })
- },
- printOrder() {
- this.$router.push("/drugs/query/print?start_time="+this.start_time+"&end_time="+this.end_time+"&keyword="+this.keyword+"&storehouse_id="+this.storehouse_id+"&page="+this.page+"&limit="+this.limit+"&good_type="+this.good_type)
- },
- exportStock() {
- console.log("中共人家哈哈哈哈哈哈",this.tableList)
-
- if(this.org_id!=0&&this.org_id!=10697){
- if(this.tableList!=null && this.tableList.length > 0){
- for(let i=0;i<this.tableList.length;i++){
- this.tableList[i].index = i +1
- this.tableList[i].drug_type_name = this.getDrugTypeName(this.tableList[i].drug_type)
- this.tableList[i].specification_name = this.tableList[i].dose + this.tableList[i].dose_unit + "*" +this.tableList[i].min_number + this.tableList[i].min_unit +"/"+this.tableList[i].max_unit
- this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
- this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
- this.tableList[i].stock_in_count = this.getStockIn(this.tableList[i].drug_stock_count, this.tableList[i].max_unit, this.tableList[i].min_unit,this.tableList[i].min_number);
- this.tableList[i].stock_out_count = this.getActCount(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
- this.tableList[i].cancle_out_count = this.getCancleOut(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
- this.tableList[i].act_cout = this.getStockOut(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number,this.tableList[i].drug_cancel_stock_info)
- this.tableList[i].over_count = this.getOverCount(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
- this.tableList[i].sum_count = this.getOverCount(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
- }
- }
-
- import("@/vendor/Export2Excel").then((excel) => {
- const tHeader = [
- "序号",
- "药品类型",
- "药品名称",
- "规格&单位",
- "生产厂商",
- "经销商",
- "批准文号",
- "国家编码",
- "入库数量",
- "出库数量",
- "退库数量",
- "实际出库",
- "剩余库存",
- "总库存",
- ];
- const filterVal = [
- "index",
- "drug_type_name",
- "drug_name",
- "specification_name",
- "manufacturer_name",
- "dealer_name",
- "number",
- "medical_insurance_number",
- "stock_in_count",
- "stock_out_count",
- "cancle_out_count",
- "act_cout",
- "over_count",
- "sum_count",
- ];
-
- const data = this.formatJson(filterVal, this.tableList);
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: "药品查询",
- });
- this.downloadLoading = false;
- });
- }
-
- if(this.org_id == 0 || this.org_id == 10697){
-
- if(this.tableList!=null && this.tableList.length > 0){
- for(let i=0;i<this.tableList.length;i++){
- this.tableList[i].index = i +1
- this.tableList[i].medical_code = this.getMedicalInsuranceLeve(this.tableList[i].medical_insurance_level)
- this.tableList[i].drug_type_name = this.getDrugTypeName(this.tableList[i].drug_type)
- this.tableList[i].specification_name = this.tableList[i].dose + this.tableList[i].dose_unit + "*" +this.tableList[i].min_number + this.tableList[i].min_unit +"/"+this.tableList[i].max_unit
- this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
- this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
- this.tableList[i].stock_in_count = this.getStockIn(this.tableList[i].drug_stock_count, this.tableList[i].max_unit, this.tableList[i].min_unit,this.tableList[i].min_number);
- this.tableList[i].stock_out_count = this.getActCount(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
- this.tableList[i].cancle_out_count = this.getCancleOut(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
- this.tableList[i].act_cout = this.getStockOut(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number,this.tableList[i].drug_cancel_stock_info)
- this.tableList[i].over_count = this.getOverCount(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
- this.tableList[i].sum_count = this.getOverCount(this.tableList[i].drug_stock_count,this.tableList[i].max_unit,this.tableList[i].min_unit,this.tableList[i].min_number)
- }
- }
-
- import("@/vendor/Export2Excel").then((excel) => {
- const tHeader = [
- "序号",
- '医保等级',
- "药品类型",
- "药品名称",
- "规格&单位",
- "零售价",
- "生产厂商",
- "经销商",
- "批准文号",
- "国家编码",
- "入库数量",
- "出库数量",
- "退库数量",
- "实际出库",
- "剩余库存",
- "总库存",
- ];
- const filterVal = [
- "index",
- "medical_code",
- "drug_type_name",
- "drug_name",
- "specification_name",
- "retail_price",
- "manufacturer_name",
- "dealer_name",
- "number",
- "medical_insurance_number",
- "stock_in_count",
- "stock_out_count",
- "cancle_out_count",
- "act_cout",
- "over_count",
- "sum_count",
- ];
-
- const data = this.formatJson(filterVal, this.tableList);
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: "药品查询",
- });
- this.downloadLoading = false;
- });
- }
-
- },
- formatJson(filterVal, jsonData) {
- return jsonData.map((v) => filterVal.map((j) => v[j]));
- },
- getDrugType(id) {
- var name = "";
- for (let i = 0; i < this.drugTypeList.length; i++) {
- if (this.drugTypeList[i].id == id) {
- name = this.drugTypeList[i].name;
- }
- }
-
- return name;
- },
- getManufacturerList(id) {
- var name = "";
- for (let i = 0; i < this.manufacturerList.length; i++) {
- if (id == this.manufacturerList[i].id) {
- name = this.manufacturerList[i].manufacturer_name;
- }
- }
- return name;
- },
- getWarehoseInfoOne(arr, max_unit, min_unit, min_number) {
- var total = 0;
- var max_str = "";
- var min_str = "";
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total += parseInt(arr[i].warehousing_count);
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
- getWarehouseOutInfo(arr, max_unit, min_unit, min_number) {
- var min_str = "";
- var max_str = "";
- var total = 0;
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total += parseInt(arr[i].count);
- }
- }
-
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
- getStockIn(arr, max_unit, min_unit, min_number) {
- var total = 0;
- var max_str = "";
- var min_str = "";
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
- total += parseInt(arr[i].sum_in_count);
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- return max_str + min_str;
- },
- getStockOut(info, max_unit, min_unit,min_number,val){
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- var totalOne = 0
- // var totalTwo = 0
- if(info!=null && info.length > 0){
- for (let i = 0; i < info.length; i++) {
- totalOne += info[i].sum_out_count;
- }
- }
-
- // if(val!=null && val.length > 0){
- // for (let i = 0; i < val.length; i++) {
- // totalTwo += val[i].sum_cancel_count;
- // }
- // }
-
- total = totalOne
-
-
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- str_min = (total % min_number) + min_unit;
- }
- return str + str_min;
- },
- getCancleOut(info, max_unit, min_unit,min_number){
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- for (let i = 0; i < info.length; i++) {
- total += info[i].sum_cancel_count;
- }
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- str_min = (total % min_number) + min_unit;
- }
- return str + str_min;
- },
- getActCount(info, max_unit, min_unit,min_number){
- var str = "";
- var str_min = "";
- //总库存
- var total = 0;
- for (let i = 0; i < info.length; i++) {
-
- total += info[i].sum_act_out_count;
-
- }
-
- if (parseInt(total / min_number) != 0) {
- str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- str_min = (total % min_number) + min_unit;
- }
- return str + str_min;
- },
- getOverCount(arr, max_unit, min_unit, min_number) {
- var max_str = "";
- var min_str = "";
- var total = 0;
- if (arr.length > 0) {
- for (let i = 0; i < arr.length; i++) {
-
- total += arr[i].flush_count
-
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return max_str + min_str;
- },
-
- //修改后的
- getDrugIn(storehouse_id,val,max_unit,min_unit,min_number){
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if(val!=null && val!=undefined){
- for(let i=0;i<val.length;i++){
- if(storehouse_id == val[i].storehouse_id){
- total = val[i].sum_in_count
- }
- }
- }
-
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return max_str + min_str;
- },
- getDrugOut(storehouse_id,val,max_unit,min_unit,min_number){
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if(val!=null && val!=undefined){
- for(let i=0;i<val.length;i++){
- if(storehouse_id == val[i].storehouse_id){
- total = val[i].sum_out_count
- }
- }
- }
-
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return max_str + min_str;
- },
- getDrugCancel(storehouse_id,val,max_unit,min_unit,min_number){
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if(val!=null && val!=undefined){
- for(let i=0;i<val.length;i++){
- if(storehouse_id == val[i].storehouse_id){
- total = val[i].sum_cancel_count
- }
- }
- }
-
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return max_str + min_str;
- },
- getActOut(storehouse_id,val,max_unit,min_unit,min_number){
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if(val!=null && val!=undefined){
- for(let i=0;i<val.length;i++){
- if(storehouse_id == val[i].storehouse_id){
- total = val[i].sum_act_out_count
- }
- }
- }
-
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return max_str + min_str;
- },
- getFlushCount(storehouse_id,val,max_unit,min_unit,min_number){
- var max_str = "";
- var min_str = "";
- var total = 0;
-
- if(val!=null && val!=undefined){
- for(let i=0;i<val.length;i++){
- if(storehouse_id == val[i].storehouse_id){
- total = val[i].flush_count
- }
- }
- }
-
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
-
- return max_str + min_str;
- },
- getSumCount(val,max_unit,min_unit,min_number){
- var max_str = "";
- var min_str = "";
- var total = 0;
- if(val!=null && val!=undefined){
- for(let i=0;i<val.length;i++){
- total += val[i].flush_count
- }
- }
- if (total < min_number) {
- min_str = total + min_unit;
- }
- if (total == 0) {
- min_str = "";
- max_str = "";
- }
- console.log("total------",total)
- if (total >= min_number) {
- if (parseInt(total / min_number) != 0) {
- max_str = parseInt(total / min_number) + max_unit;
- }
- if (total % min_number != 0) {
- min_str = (total % min_number) + min_unit;
- }
- }
- console.log("库粗总量",max_str)
- console.log("库粗总量",min_str)
- return max_str + min_str;
- },
- toCheck(){
- getDrugInitDataList().then(response=>{
- if(response.data.state == 1){
-
- this.$message.success("保存成功!")
- }
- })
- },
- getDearName(id){
- var dear_name = ""
- for(let i=0;i<this.dealerList.length;i++){
- if(id == this.dealerList[i].id){
- dear_name = this.dealerList[i].dealer_name
- }
- }
- return dear_name
- },
- },
- created(){
- this.getStorehouseList()
- this.getlist()
-
- }
- }
- </script>
-
- <style>
- .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
- font-size: 12px;
- }
-
- .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
- background: #6fb5fa;
- }
-
- .count {
- color: #bd2c00;
- }
-
- .el-table td,
- .el-table th.is-leaf,
- .el-table--border,
- .el-table--group {
- border-color: #d0d3da;
- }
-
- .el-table--border::after,
- .el-table--group::after,
- .el-table::before {
- background-color: #d0d3da;
- }
-
- /* 合并表格线样式 */
- .spanClass .cell {
- padding: 0 !important;
- }
-
- .spanClass .cell tr {
- display: inline-block;
- width: 100%;
- }
-
- .spanClass .cell tr td {
- padding: 10px 0;
- border-bottom: 1px solid #ebeef5;
- display: block;
- width: 100%;
- }
- .spanClass .cell tr:last-of-type td {
- border-bottom: none;
- }
- </style>
|