1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177 |
- <template>
- <div>
- <el-button
- style="float: right"
- size="small"
- icon="el-icon-printer"
- @click="PrintAction"
- type="primary"
- >打印
- </el-button>
- <el-button
- v-if="org_id != 10265 && org_id!=0&&org_id!=10480"
- style="float: right;margin-right:10px"
- size="small"
- @click="exportListDetai"
- type="primary"
- >明细导出
- </el-button>
- <el-button
- v-if="org_id == 10265"
- style="float: right;margin-right:10px"
- size="small"
- @click="exportListDetaiOne"
- type="primary"
- >明细导出
- </el-button>
- <el-button
- v-if="org_id == 10480 || org_id == 0"
- style="float: right;margin-right:10px"
- size="small"
- @click="exportListDetaiTwo"
- type="primary"
- >明细导出
- </el-button>
- <el-button
- style="float: right;margin-right:10px"
- size="small"
- @click="exportList"
- type="primary"
- >汇总导出
- </el-button>
-
- <div class="cell clearfix">
- <label class="title"><span class="name">仓库</span> :</label>
- <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" @change="changeHouseList">
- <el-option
- v-for="(option, index) in houseList"
- :key="index"
- :label="option.storehouse_name"
- :value="option.id">
- </el-option>
- </el-select>
- <el-input
- size="small"
- style="width: 200px;"
- class="filter-item"
- v-model.trim="searchKey"
- placeholder="单据编码/制单人/药品名称"
- />
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- icon="el-icon-search"
- @click="search"
- >搜索</el-button
- >
- <label class="title"><span class="name">日期查询</span> : </label>
- <el-date-picker
- size="small"
- v-model="start_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="startTimeChange"
- ></el-date-picker>
- <span class="cellLine"> - </span>
- <el-date-picker
- size="small"
- v-model="end_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="endTimeChange"
- ></el-date-picker>
-
- </div>
-
-
- <el-row :gutter="12" style="margin-top: 10px">
- <el-table
- :data="tableData"
- :class="signAndWeighBoxPatients"
- border
- highlight-current-row
- ref="multipleTable"
- @selection-change="select"
- :row-style="{ color: '#303133' }"
- :header-cell-style="{
- backgroundColor: 'rgb(245, 247, 250)',
- color: '#606266'
- }"
- >
- <el-table-column label="单据编号" align="center" width="200">
- <template slot-scope="scope">
- {{ scope.row.warehouse_out_order_number }}
- </template>
- </el-table-column>
-
- <el-table-column label="药品类型" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.drug_type == 1">西药</span>
- <span v-if="scope.row.drug_type == 2">草药</span>
- <span v-if="scope.row.drug_type == 3">成药</span>
- <!-- {{getTypeList(scope.row.drug_type)}} -->
- </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.drug_spec}} -->
- {{scope.row.specification_name}}
- </template>
- </el-table-column>
-
- <el-table-column label="生产厂商" align="center">
- <template slot-scope="scope">
- {{getManufacturerName(scope.row.manufacturer)}}
- </template>
- </el-table-column>
-
-
- <el-table-column label="操作时间" align="center">
- <template slot-scope="scope">
- <span>{{getTime(scope.row.ctime)}}</span>
- </template>
- </el-table-column>
- <el-table-column label="制单人" align="center">
- <template slot-scope="scope">
- {{getAdminUser(scope.row.creater)}}
- </template>
- </el-table-column>
- <el-table-column label="仓库名称" align="center">
- <template slot-scope="scope">
- {{getStorehouseName(scope.row.storehouse_id)}}
- </template>
- </el-table-column>
- <el-table-column label="出货价" align="center">
- <template slot-scope="scope">
- <span v-if="org_id == 9919">{{scope.row.last_price}} </span>
- <span v-else>
- <span v-if="scope.row.price >0"> {{scope.row.price}}</span>
- <span v-if="scope.row.price == 0"> {{getPrice(scope.row.drug_id)}}</span>
- </span>
- </template>
- </el-table-column>
- <el-table-column label="使用人" align="center">
- <template slot-scope="scope">
- {{getPatientName(scope.row.patient_id) }}
- </template>
- </el-table-column>
- <el-table-column label="数量" align="center">
- <template slot-scope="scope">
- {{scope.row.count}}
- </template>
- </el-table-column>
- <el-table-column label="单位" align="center">
- <template slot-scope="scope">
- {{scope.row.count_unit}}
- </template>
- </el-table-column>
- <el-table-column label="总价" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.is_total !=1">
- <span v-if="org_id == 9919">{{(scope.row.last_price * scope.row.count).toFixed(2)}} </span>
- <span v-if="org_id == 10210 ">{{(scope.row.price * scope.row.count).toFixed(2)}} </span>
- <span v-if ="org_id!=9919 && org_id!=10210">
- {{scope.row.total_price}}
- </span>
- </span>
- <span v-if="scope.row.is_total == 1">
- {{scope.row.total_price}}
- </span>
- </template>
- </el-table-column>
- </el-table>
-
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 50, 100,1000,2000,3000,4000,5000,6000,7000]"
- :page-size="10"
- background
- style="margin-top:20px;float: right"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- </el-row>
- </div>
- </template>
-
- <script>
- import { uParseTime } from "@/utils/tools";
- import { fetchAllAdminUsers } from "@/api/doctor";
- import {GetAllConfig } from "@/api/stock";
- import {getDrugOutDetail,getDrugOutOrderPrint } from "@/api/drug/drug_stock"
- import {getBaseDrugLibList} from '@/api/data'
- export default {
- name: "stockOutDetail",
-
- created() {
- this.org_id = this.$store.getters.xt_user.org.id
-
- var nowDate = new Date();
- var nowYear = nowDate.getFullYear();
- var nowMonth = nowDate.getMonth() + 1;
- var nowDay = nowDate.getDate();
- this.end_time =
- nowYear +
- "-" +
- (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
- "-" +
- (nowDay < 10 ? "0" + nowDay : nowDay);
- nowDate.setMonth(nowDate.getMonth() - 1);
- nowYear = nowDate.getFullYear();
- nowMonth = nowDate.getMonth() + 1;
- nowDay = nowDate.getDate();
- this.start_time =
- nowYear +
- "-" +
- (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
- "-" +
- (nowDay < 10 ? "0" + nowDay : nowDay);
- var start_time = window.sessionStorage.getItem('start_out_time')
- var end_time = window.sessionStorage.getItem('end_out_time')
- if(start_time!=null){
- this.start_time = start_time
- }
- if(end_time!=null){
-
- this.end_time = end_time
- }
-
- this.getDrugOutOrderPrint()
- this.GetConfigInfo();
- this.fetchAllAdminUsers();
- this.getlist()
- this.getBaseDrugLibList()
-
- },
- data() {
- return {
- orderTypeArr: [
- { value: 1, label: "药品出库单" },
- { value: 2, label: "其他入库单" }
- ],
- manufacturer_id: "",
- dealer_id: "",
- order_type:"",
-
- searchKey: "",
- type: 2,
- page: 1,
- limit: 10,
- checked: false,
- total: 0,
- pageTotal: 0,
- pageSelect: 0,
- adminUserOptions: [],
- multipleSelection: [],
- signAndWeighBoxPatients: "sign-and-weigh-box-patients",
- start_time: "",
- cancelStockDate: [],
- end_time: "",
- goodType: [],
- goodInfo: [],
- manufacturer: [],
- selectedTableData: [],
- dealer: [],
- tableData:[],
- tableList:[],
- drugList:[],
- tablePrint:[],
- org_id:0,
- drugTypeList:[],
- storehouse_id:0,
- houseList:[],
- dealerList:[],
- manufacturerList:[],
- patientsList:[]
- };
- },
- methods: {
- changeType: function(val) {
- this.order_type = val;
- this.getlist()
- },
- changeManufacturer: function(val) {
- this.manufacturer_id = val;
- this.getlist()
- },
- getTypeName: function(row) {
- let name = "";
- const name2 = "";
- if (row.type == 1) {
- name = "药品出库单";
- } else if (row.type == 2) {
- name = "其他出库单";
- }
-
- return name;
- },
- search: function() {
- this.getlist()
- this.getDrugOutOrderPrint()
- },
-
- getXuserName(id) {
- if (id <= 0) {
- return "";
- }
- var name = "";
- if (
- this.adminUserOptions == null ||
- typeof this.adminUserOptions.length === "undefined"
- ) {
- return name;
- }
- var leng = this.adminUserOptions.length;
- if (leng == 0) {
- return name;
- }
- for (let index = 0; index < leng; index++) {
- if (this.adminUserOptions[index].id == id) {
- name = this.adminUserOptions[index].name;
- break;
- }
- }
- return name;
- },
- fetchAllAdminUsers() {
- fetchAllAdminUsers().then(response => {
-
- if (response.data.state == 1) {
- this.adminUserOptions = response.data.data.users;
- }
- });
- },
- handleSelectionChange: function(val) {
- this.multipleSelection = val;
- },
- handleSizeChange(val) {
- this.limit = val;
- this.getlist()
- },
- handleCurrentChange(val) {
- this.page = val;
- this.getlist()
- },
- startTimeChange(val) {
- var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
- if (time > 0) {
- this.$message.error("结束时间不能小于开始时间");
- this.start_time = "";
- } else {
- this.getlist()
- this.getDrugOutOrderPrint()
- }
- },
- endTimeChange(val) {
- var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
- if (time < 0) {
- this.$message.error("结束时间不能小于开始时间");
- this.end_time = "";
- } else {
- this.getlist()
- this.getDrugOutOrderPrint()
- }
- },
- getTimestamp(time) {
- // 把时间日期转成时间戳
- return new Date(time).getTime() / 1000;
- },
- calculate: function(val) {
- return Math.round(parseFloat(val) * 100) / 100;
- },
- GetConfigInfo() {
- GetAllConfig().then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.manufacturer = response.data.data.manufacturer;
- this.dealer = response.data.data.dealer;
- this.goodInfo = response.data.data.goodInfo;
- this.goodType = response.data.data.goodType;
- }
- });
- },
-
- getTime: function(val) {
- if (val == 0) {
- return "";
- } else {
- return uParseTime(val, "{y}-{m}-{d}");
- }
- },
- getTimeOne: function(val) {
- if (val == 0) {
- return "";
- } else {
- return uParseTime(val, "{y}-{m}-{d} {h}:{i}");
- }
- },
- PrintAction: function() {
- // window.sessionStorage.setItem('start_out_time',this.start_time)
- // window.sessionStorage.setItem('end_out_time',this.end_time)
- this.$router.push("/stock/drugoutorderprint?start_time="+this.start_time+"&end_time="+this.end_time+"&order_type="+2+"&manufacturer_id="+this.manufacturer_id+"&keyword="+this.keyword+"&limit="+this.limit+"&page="+this.page)
- },
- getlist(){
- var params = {
- start_time:this.start_time,
- end_time:this.end_time,
- order_type:this.order_type,
- manufacturer_id:this.manufacturer_id,
- keyword:this.searchKey,
- page:this.page,
- limit:this.limit,
- storehouse_id:this.storehouse_id,
- }
- getDrugOutDetail(params).then(response=>{
- this.tableData = []
- this.tableList = []
- if(response.data.state == 1){
- var order = response.data.data.order
- console.log("order233322332323223",order)
-
- var obj = {id:0,storehouse_name:"全部"}
- this.houseList = []
- this.houseList.push(obj)
- for(let i=0;i<response.data.data.houseList.length;i++){
- this.houseList.push(response.data.data.houseList[i])
- }
- this.patientsList = []
- this.patientsList = response.data.data.patientsList
-
- var total_price = 0
- for(let i=0;i<order.length;i++){
- order[i].specification_name = order[i].dose + order[i].dose_unit + "*" + order[i].min_number + order[i].min_unit + "/" + order[i].max_unit
- order[i].is_total = 0
- if(this.org_id == 9919){
- order[i].total_price = order[i].count * order[i].last_price
- total_price += order[i].count * order[i].last_price
- }else{
- if(order[i].price > 0){
- order[i].total_price = 0
- if(order[i].count_unit == order[i].min_unit && order[i].max_unit!=order[i].min_unit){
- order[i].total_price = order[i].count * order[i].price
- }
- if(order[i].count_unit == order[i].max_unit){
- if(order[i].is_sys == 0){
- order[i].total_price += order[i].count * order[i].price
- }else{
-
- order[i].total_price += order[i].count * order[i].price * order[i].min_number
- }
- }
-
- total_price += order[i].total_price
-
- }
-
- if(order[i].price ==0 ){
- if(order[i].count_unit == order[i].min_unit && order[i].max_unit!=order[i].min_unit){
- order[i].total_price = order[i].count * this.getPrice(order[i].drug_id)
-
- order[i].price = this.getPrice(order[i].drug_id)
- }
-
- if(order[i].count_unit == order[i].max_unit){
- if(order[i].is_sys == 0){
- order[i].total_price += order[i].count * this.getPrice(order[i].drug_id)
- }else{
- order[i].total_price += order[i].count * this.getPrice(order[i].drug_id) * order[i].min_number
- }
- order[i].price = this.getPrice(order[i].drug_id)
- }
- total_price +=order[i].total_price
- }
-
- }
-
- }
-
- if(this.org_id!=0&&this.org_id!=10480){
- order.push({
- warehouse_out_order_number: "合计",
- is_total: 1,
- specification_name:"",
- ctime:"",
- total_price:total_price,
- });
- }
-
- for(let i=0;i<order.length;i++){
- order[i].total_price = order[i].total_price.toFixed(2)
- }
-
- console.log("orderwowoowwowoo",order)
- this.tableData = order
-
- let objInfo = {}
- order.forEach((item,index)=>{
- let { drug_id } = item
- if( this.org_id == 9919){
- if(!objInfo[drug_id]){
- objInfo[drug_id] = {
- drug_id,
- child:[],
- drug_name:item.drug_name,
- drug_spec:item.drug_spec,
- min_unit:item.min_unit,
- count:0,
- price:item.last_price,
- remark:item.remark,
- total_price:0.0,
- dose:item.dose,
- dose_unit:item.dose_unit,
- min_number:item.min_number,
- max_unit:item.max_unit,
- in_price:item.in_price,
- }
- }
- }else{
- if(!objInfo[drug_id]){
- objInfo[drug_id] = {
- drug_id,
- child:[],
- drug_name:item.drug_name,
- drug_spec:item.drug_spec,
- min_unit:item.min_unit,
- count:0,
- price:item.price,
- remark:item.remark,
- total_price:0.0,
- dose:item.dose,
- dose_unit:item.dose_unit,
- min_number:item.min_number,
- max_unit:item.max_unit,
- in_price:item.in_price,
- }
- }
- }
-
- })
- let list = Object.values(objInfo);
-
- for(let i=0;i<order.length;i++){
- list.map(item=>{
- if(order[i].drug_id == item.drug_id){
- item.child.push(order[i])
- }
- })
- }
-
-
- for(let i=0;i<list.length;i++){
- for(let j=0;j<list[i].child.length;j++){
- if(list[i].child[j].count!=null || list[i].child[j].count != "" || list[i].child[j].count!=0){
- list[i].count += list[i].child[j].count
- }
- }
- }
-
- for(let i=0;i<list.length;i++){
- list[i].total_price = list[i].count * list[i].price
- }
-
- this.tableList = list
- var total = response.data.data.total
- this.total = total
- }
- })
- },
-
- select(){
-
- },
-
- getAdminUser(id){
- var name = ""
- for(let i=0;i<this.adminUserOptions.length;i++){
- if(id == this.adminUserOptions[i].id){
- name = this.adminUserOptions[i].name
- }
- }
- return name
- },
- getPatientName(id){
-
- var name =""
- for(let i=0;i<this.patientsList.length;i++){
- if(id == this.patientsList[i].id){
- name = this.patientsList[i].name
- }
- }
- return name
- },
-
- exportList(){
-
-
-
- for(let i=0;i<this.tablePrint.length;i++){
- this.tablePrint[i].index = i+1
- this.tablePrint[i].ctime = this.getTime(this.tablePrint[i].ctime)
- this.tablePrint[i].manufacturer_name = this.getManufacturerName(this.tablePrint[i].manufacturer)
- this.tablePrint[i].dealer_name = this.getDealerName(this.tablePrint[i].dealer)
- }
- for(let i=0;i<this.tablePrint.length;i++){
- if(this.org_id == 9919 || this.org_id == 9671){
- this.tablePrint[i].min_price = this.tablePrint[i].price
- this.tablePrint[i].count = parseInt((this.getCountSix(this.tablePrint[i].drug_id,this.tablePrint[i].child))/this.tablePrint[i].min_number)
- this.tablePrint[i].total_price = ((parseInt((this.getCountSix(this.tablePrint[i].drug_id,this.tablePrint[i].child))/this.tablePrint[i].min_number))*this.tablePrint[i].price).toFixed(2)
- this.tablePrint[i].unit = this.tablePrint[i].dose + this.tablePrint[i].dose_unit + "*" + this.tablePrint[i].min_number +this.tablePrint[i].min_unit +"/"+this.tablePrint[i].max_unit
- this.tablePrint[i].total = this.getCountSenvenOne(this.tablePrint.drug_id,this.tablePrint[i].child,this.tablePrint[i].price)/this.tablePrint[i].min_number
-
- }else{
- this.tablePrint[i].count = this.getCount(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_unit,this.tablePrint[i].min_number)
- this.tablePrint[i].total_price = this.getTotalPrice(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_number,this.tablePrint[i].min_price)
- this.tablePrint[i].unit = this.tablePrint[i].dose + this.tablePrint[i].dose_unit + "*" + this.tablePrint[i].min_number +this.tablePrint[i].min_unit +"/"+this.tablePrint[i].max_unit
- this.tablePrint[i].total = this.getTotalPriceOne(this.tablePrint[i].child,this.tablePrint[i].max_unit,this.tablePrint[i].min_number,this.tablePrint[i].min_price)
- }
- }
- console.log("wowowoowowowowo",this.tablePrint)
-
-
-
- import('@/vendor/Export2Excel').then(excel => {
- const tHeader = ['序号','药品名称', '规格型号','生产厂商','进销商', '单位','数量','单价','总价','出库时间','备注']
- if(this.org_id == 9919){
- const filterVal = ['index','drug_name', 'unit', 'manufacturer_name','dealer_name','max_unit','count','min_price','total_price','ctime','remark']
-
- let obj = {'index':'合计','total_price':0.00}
- for(let i=0;i<this.tablePrint.length;i++){
- obj.total_price += this.tablePrint[i].total
- }
- obj.total_price = obj.total_price.toFixed(2)
- this.tablePrint.push(obj)
- const data = this.formatJson(filterVal, this.tablePrint)
-
-
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: '药品汇总明细'
- })
- this.downloadLoading = false
- }else{
- const filterVal = ['index','drug_name', 'unit', 'manufacturer_name','dealer_name','min_unit','count','min_price','total_price','ctime','remark']
-
- let obj = {'index':'合计','total_price':0.00}
- for(let i=0;i<this.tablePrint.length;i++){
- obj.total_price += this.tablePrint[i].total
- }
- obj.total_price = obj.total_price.toFixed(2)
- this.tablePrint.push(obj)
- const data = this.formatJson(filterVal, this.tablePrint)
-
-
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: '药品汇总明细'
- })
- this.downloadLoading = false
- }
-
- })
- },
-
- formatJson(filterVal, jsonData) {
- return jsonData.map(v => filterVal.map(j => v[j]));
- },
- exportListDetai(){
- import('@/vendor/Export2Excel').then(excel => {
- const tHeader = ['序号','单据编号', '药品类型', '药品名称','规格型号','生产厂商','进销商','操作时间','制单人','进货价','出货价','数量','总价']
- const filterVal = ['index','warehouse_out_order_number', 'drugtype', 'drug_name','specification_name','manufacturer_name','dealer_name','time','user_name','in_price','price','count','total_price']
-
- console.log("hwhhwhwhwhwhw",this.tableData)
-
- for(let i=0;i<this.tableData.length;i++){
- if(this.tableData[i].is_total == 0){
- this.tableData[i].index = i+1
- if(this.tableData[i].drug_type == 1){
- this.tableData[i].drugtype = "西药"
- }
- if(this.tableData[i].drug_type == 2){
- this.tableData[i].drugtype = "草药"
- }
- if(this.tableData[i].drug_type == 3){
- this.tableData[i].drugtype = "成药"
- }
- this.tableData[i].specification_name = this.tableData[i].dose + this.tableData[i].dose_unit +"*" + this.tableData[i].min_number + this.tableData[i].min_unit + "/" + this.tableData[i].max_unit
- this.tableData[i].time = this.getTime(this.tableData[i].ctime)
- this.tableData[i].user_name = this.getAdminUser(this.tableData[i].creater)
- this.tableData[i].manufacturer_name = this.getManufacturerName(this.tableData[i].manufacturer)
- this.tableData[i].dealer_name = this.getDealerName(this.tableData[i].dealer)
- if(this.org_id == 9919){
- this.tableData[i].total = (this.tableData[i].count * this.tableData[i].last_price)
- if(this.tableData[i].count >=this.tableData[i].min_number){
- this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].last_price)/this.tableData[i].min_number
- }else{
- this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].last_price)
- }
-
- }else{
- this.tableData[i].total = (this.tableData[i].count * this.tableData[i].price)
- if(this.tableData[i].count_unit == this.tableData[i].min_unit && this.tableData[i].max_unit!=this.tableData[i].min_unit){
- this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)
- }
- if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit !=this.tableData[i].min_unit){
- this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
- }
- if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit ==this.tableData[i].min_unit){
- this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
- }
- }
- }
- }
- const data = this.formatJson(filterVal, this.tableData)
-
-
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: '药品出库明细'
- })
- this.downloadLoading = false
- })
- },
- exportListDetaiOne(){
- import('@/vendor/Export2Excel').then(excel => {
- const tHeader = ['序号','单据编号', '药品类型', '药品名称','规格型号','生产厂商','进销商','操作时间','制单人','进货价','出货价','数量','单位','总价']
- const filterVal = ['index','warehouse_out_order_number', 'drugtype', 'drug_name','specification_name','manufacturer_name','dealer_name','time','user_name','in_retail_price','price','count','count_unit','total_price']
-
- console.log("hwhhwhwhwhwhw",this.tableData)
-
-
- for(let i=0;i<this.tableData.length;i++){
- if(this.tableData[i].is_total == 0){
- this.tableData[i].index = i+1
- if(this.tableData[i].drug_type == 1){
- this.tableData[i].drugtype = "西药"
- }
- if(this.tableData[i].drug_type == 2){
- this.tableData[i].drugtype = "草药"
- }
- if(this.tableData[i].drug_type == 3){
- this.tableData[i].drugtype = "成药"
- }
- this.tableData[i].specification_name = this.tableData[i].dose + this.tableData[i].dose_unit +"*" + this.tableData[i].min_number + this.tableData[i].min_unit + "/" + this.tableData[i].max_unit
- this.tableData[i].time = this.getTime(this.tableData[i].ctime)
- this.tableData[i].user_name = this.getAdminUser(this.tableData[i].creater)
- this.tableData[i].manufacturer_name = this.getManufacturerName(this.tableData[i].manufacturer)
- this.tableData[i].dealer_name = this.getDealerName(this.tableData[i].dealer)
- this.tableData[i].in_retail_price = (this.tableData[i].in_price/this.tableData[i].min_number).toFixed(2)
-
- this.tableData[i].total = (this.tableData[i].count * this.tableData[i].price)
- if(this.tableData[i].count_unit == this.tableData[i].min_unit && this.tableData[i].max_unit!=this.tableData[i].min_unit){
- this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)
- }
- if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit !=this.tableData[i].min_unit){
- this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
- }
- if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit ==this.tableData[i].min_unit){
- this.tableData[i].total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
- }
-
- }
- }
- const data = this.formatJson(filterVal, this.tableData)
-
-
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: '药品出库明细'
- })
- this.downloadLoading = false
- })
- },
-
- exportListDetaiTwo(){
- var obj = {index:"合计",out_total_price:0,in_total_price:0}
- var out_total = 0
- var in_total =0
- console.log("tatbledateawowowo",this.tableData)
-
- for(let i=0;i<this.tableData.length;i++){
- if(this.tableData[i].is_total == 0){
- this.tableData[i].index = i+1
- if(this.tableData[i].drug_type == 1){
- this.tableData[i].drugtype = "西药"
- }
- if(this.tableData[i].drug_type == 2){
- this.tableData[i].drugtype = "草药"
- }
- if(this.tableData[i].drug_type == 3){
- this.tableData[i].drugtype = "成药"
- }
- this.tableData[i].specification_name = this.tableData[i].dose + this.tableData[i].dose_unit +"*" + this.tableData[i].min_number + this.tableData[i].min_unit + "/" + this.tableData[i].max_unit
- this.tableData[i].time = this.getTime(this.tableData[i].ctime)
- this.tableData[i].user_name = this.getAdminUser(this.tableData[i].creater)
- this.tableData[i].manufacturer_name = this.getManufacturerName(this.tableData[i].manufacturer)
- this.tableData[i].out_count = this.tableData[i].count
- this.tableData[i].in_retail_price = (this.tableData[i].in_price/this.tableData[i].min_number).toFixed(2)
- this.tableData[i].total = (this.tableData[i].count * this.tableData[i].price)
- this.tableData[i].patient_name = this.getPatientName(this.tableData[i].patient_id)
- if(this.tableData[i].count_unit == this.tableData[i].min_unit && this.tableData[i].max_unit!=this.tableData[i].min_unit){
- this.tableData[i].out_total_price = (this.tableData[i].count * this.tableData[i].price)
- this.tableData[i].in_total_price = this.tableData[i].in_retail_price * this.tableData[i].count
- }
- if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit !=this.tableData[i].min_unit){
- this.tableData[i].out_total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
- this.tableData[i].in_total_price = this.tableData[i].min_number * (this.tableData[i].count * this.tableData[i].in_retail_price)
- }
- if(this.tableData[i].count_unit == this.tableData[i].max_unit && this.tableData[i].max_unit ==this.tableData[i].min_unit){
- this.tableData[i].out_total_price = (this.tableData[i].count * this.tableData[i].price)*this.tableData[i].min_number
-
- this.tableData[i].in_total_price = this.tableData[i].min_number * (this.tableData[i].count * this.tableData[i].in_retail_price)
- }
-
- this.tableData[i].project_name = "居民医保"
-
- this.tableData[i].expiry_date = this.getTime(this.tableData[i].expiry_date)
-
-
- this.tableData[i].ctimeOne = this.getTime(this.tableData[i].ctime)
-
- this.tableData[i].ctimeTwo = this.getTimeOne(this.tableData[i].ctime)
-
- out_total += this.tableData[i].out_total_price
- in_total += this.tableData[i].in_total_price
- }
- }
- obj.out_total_price = out_total.toFixed(2)
- obj.in_total_price = in_total.toFixed(2)
- this.tableData.push(obj)
-
- import('@/vendor/Export2Excel').then(excel => {
- const tHeader = ['序号','药品名称', '药品规格', '批号','生成厂家','药品类型','报销方式','入库单价','出库单价','出库数量','实际出库数量','单位','出库金额','实际出库金额','实际成本','出库对象','有效日期','出库日期','操作时间','出库单号','备注']
- const filterVal = ['index','drug_name', 'specification_name', 'batch_number','manufacturer_name','drug_type','project_name','in_price','price','out_count','out_count','max_unit','out_total_price','out_total_price','in_total_price','patient_name','expiry_date','ctimeOne','ctimeTwo','warehouse_out_order_number','remark']
-
- console.log("hwhhwhwhwhwhw",this.tableData)
-
-
-
- const data = this.formatJson(filterVal, this.tableData)
-
-
- excel.export_json_to_excel({
- header: tHeader,
- data,
- filename: '药品出库明细'
- })
- this.downloadLoading = false
- })
- },
- getManufacturerName(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
- },
- getDealerName(id){
- var dealer_name = ""
- for(let i=0;i<this.dealerList.length;i++){
- if(id == this.dealerList[i].id){
- dealer_name = this.dealerList[i].dealer_name
- }
- }
- return dealer_name
- },
- getBaseDrugLibList() {
- let params = {
- page: 1,
- limit: 1000,
- keyword:"",
- is_use: "",
- is_charge: "",
- is_inject: "",
- manufacturer:"",
- is_record:""
- }
- getBaseDrugLibList(params).then(response => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg)
- return false
- } else {
- this.drugList = []
- for (let i = 0; i < response.data.data.list.length; i++) {
- this.drugList.push(response.data.data.list[i])
- }
-
- }
- })
- },
- getDrugOutOrderPrint(){
- var params = {
- start_time:this.start_time,
- end_time:this.end_time,
- order_type:2,
- }
- getDrugOutOrderPrint(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- console.log("很粗扣扣我噢噢",list)
-
- this.dealerList = response.data.data.dealerList
- this.manufacturerList = response.data.data.manufacturerList
- let objInfo = {}
- if(this.org_id == 9919){
- list.forEach((item,index)=>{
- let { drug_id } = item
- if(!objInfo[drug_id]){
- objInfo[drug_id] = {
- drug_id,
- child:[],
- drug_name:item.XtBaseDrug.drug_name,
- drug_spec:item.XtBaseDrug.drug_spec,
- min_unit:item.XtBaseDrug.min_unit,
- count:0,
- price:item.XtBaseDrug.last_price,
- remark:item.XtBaseDrug.remark,
- total_price:"",
- dose:item.XtBaseDrug.dose,
- dose_unit:item.XtBaseDrug.dose_unit,
- min_number:item.XtBaseDrug.min_number,
- max_unit:item.XtBaseDrug.max_unit,
- min_price:item.XtBaseDrug.min_price,
- ctime:item.ctime,
- manufacturer:item.manufacturer,
- dealer:item.dealer,
- }
- }
- })
- }else{
- list.forEach((item,index)=>{
- let { drug_id } = item
- if(!objInfo[drug_id]){
- objInfo[drug_id] = {
- drug_id,
- child:[],
- drug_name:item.XtBaseDrug.drug_name,
- drug_spec:item.XtBaseDrug.drug_spec,
- min_unit:item.XtBaseDrug.min_unit,
- count:0,
- price:item.XtBaseDrug.last_price,
- remark:item.XtBaseDrug.remark,
- total_price:"",
- dose:item.XtBaseDrug.dose,
- dose_unit:item.XtBaseDrug.dose_unit,
- min_number:item.XtBaseDrug.min_number,
- max_unit:item.XtBaseDrug.max_unit,
- min_price:item.XtBaseDrug.min_price,
- ctime:item.ctime,
- manufacturer:item.manufacturer,
- dealer:item.dealer,
- }
- }
- })
- }
-
- let newArr = Object.values(objInfo);
- for(let i=0;i<newArr.length;i++){
- for(let j=0;j<list.length;j++){
- if(newArr[i].drug_id == list[j].drug_id){
- newArr[i].child.push(list[j])
- }
- }
- }
-
- console.log("newArrwowowowowoowowowowowowow",newArr)
- this.tablePrint = newArr
-
- }
- })
- },
- getCount(arr,max_unit,min_unit,min_number){
- var total = 0
- var str = ""
- var min_str = ""
- for(let i=0;i<arr.length;i++){
- if(arr[i].count_unit == max_unit){
- arr[i].count_one = 0
- arr[i].count_one = arr[i].count * min_number
- }else{
- arr[i].count_one = arr[i].count
- }
- }
- for(let i=0;i<arr.length;i++){
- total+= arr[i].count_one
- }
-
- if(total<min_number){
- str = ""
- min_str = total + min_unit
- }
- if(total >= min_number){
- if(parseInt(total/min_number)!=0){
- str = parseInt(total/min_number)+ max_unit
- }
- if((total%min_number)!=0){
- min_str = total%min_number + min_unit
- }
- }
- return str + min_str
- },
- getTotalPrice(arr,max_unit,min_number,min_price){
- console.log("arrwoowowow",arr)
-
- var total = 0
- for(let i=0;i<arr.length;i++){
- if(arr[i].count_unit == max_unit){
- arr[i].count = arr[i].count * min_number
- }else{
- arr[i].count = arr[i].count
- }
- }
- for(let j=0;j<arr.length;j++){
- total +=arr[j].count
- }
-
- return (total*min_price).toFixed(2)
- },
-
- getTotalPriceOne(arr,max_unit,min_number,min_price){
- var total = 0
- for(let i=0;i<arr.length;i++){
- if(arr[i].count_unit == max_unit){
- arr[i].count = arr[i].count * min_number
- }else{
- arr[i].count = arr[i].count
- }
- }
- for(let j=0;j<arr.length;j++){
- total +=arr[j].count
- }
-
- return total*min_price
- },
- getCountSix(drug_id,val){
-
- var count = 0
- for(let i=0;i<val.length;i++){
- count+= val[i].count
- }
- return count
- },
- getCountSenven(drug_id,val,price,min_number){
- console.log("min_number232333223",min_number)
- var count = 0
- for(let i=0;i<val.length;i++){
- count+= val[i].count
- }
- return (parseInt(count/min_number)*price).toFixed(2)
- },
- getCountSenvenOne(drug_id,val,price){
- var count = 0
- for(let i=0;i<val.length;i++){
- count+= val[i].count
- }
- return (count*price)
- },
- getTypeList(id){
- var name = ""
- for(let i=0;i<this.drugTypeList.length;i++){
- if(id == this.drugTypeList[i].value){
- name = this.drugTypeList[i].name
- }
- }
- return name
- },
- getPrice(drug_id){
- var price = ""
- for(let i=0;i<this.drugList.length;i++){
- if(drug_id == this.drugList[i].id){
- price = this.drugList[i].min_price
- }
- }
- return price
- },
- getStorehouseName(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
- }
- }
- if(storehouse_name == "全部"){
- return ""
- }else{
- return storehouse_name
- }
- },
- changeHouseList(){
- this.houseList = []
- this.getlist()
- }
- }
- };
- </script>
-
- <style rel="stylesheet/css" lang="scss" scoped>
- .information {
- border: 1px #dcdfe6 solid;
- padding: 30px 20px 30px 20px;
-
- .border {
- border-bottom: 1px #dcdfe6 solid;
- margin: 0px 0 20px 0;
- }
- }
-
- .edit_separater {
- border-top: 1px solid rgb(233, 233, 233);
- margin-top: 15px;
- margin-bottom: 15px;
- }
- </style>
-
- <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;
- }
- </style>
|