1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246 |
- <template>
- <div class="main-contain">
- <div class="position">
- <bread-crumb v-if="type == 1" :crumbs="crumbs"></bread-crumb>
- <bread-crumb v-if="type == 2" :crumbs="crumbs2"></bread-crumb>
-
- <div style="float: right">
- <el-button size="small" @click="back()" class="filter-item"
- >取 消</el-button
- >
- <el-button
- size="small"
- type="primary"
- @click="submit()"
- class="filter-item"
- >保 存</el-button
- >
- <el-button
- size="small"
- type="primary"
- @click="toCheck()"
- v-show ="showCheck"
- class="filter-item"
- >审核</el-button
- >
- <!-- <el-button
- size="small"
- type="primary"
- @click="toReturnCheck()"
- v-show ="showReturnCheck"
- class="filter-item"
- >反审核</el-button
- > -->
- </div>
- </div>
- <div class="app-container" v-loading="loading">
- <drugs-stock-dialog
- ref="dialog"
- :propForm="propForm"
- :visibility="isVisibility"
- v-on:dialog-comfirm="comfirm"
- v-on:dialog-cancle="cancle"
- ></drugs-stock-dialog>
-
- <div class="cell clearfix">
- <label class="title"
- ><span class="name"><span style="color: red">*</span>仓库</span>
- :</label
- >
- <el-select
- size="small"
- v-model="storehouse_id"
- filterable
- placeholder="请选择仓库"
- style="width: 200px"
- >
- <el-option
- v-for="(option, index) in list"
- :key="index"
- :label="option.storehouse_name"
- :value="option.id"
- >
- </el-option>
- </el-select>
- <label class="title"><span class="name">入库时间</span> : </label>
- <el-date-picker
- size="small"
- v-model="warehousing_time"
- prefix-icon="el-icon-date"
- :editable="false"
- style="width: 196px"
- type="date"
- placeholder="选择日期时间"
- align="right"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- ></el-date-picker>
- <div class="titleOne">
- 制单人:{{ this.$store.getters.xt_user.user.user_name }}
- </div>
- </div>
-
- <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
- <el-table
- id="oictable"
- :data="recordInfo.recordData"
- :class="signAndWeighBoxPatients"
- style="width: 100%"
- border
- max-height="450"
- v-loading="listLoading"
- :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
- >
- <el-table-column align="center" width="200" fixed="left">
- <template slot="header" slot-scope="scope">
- <span>药品名称<span style="color: red">*</span></span>
- </template>
-
- <template slot-scope="scope">
- <el-form-item style="padding-top: 20px">
- <el-autocomplete
- class="checkSearch"
- popper-class="my-autocomplete"
- v-model="scope.row.drug_name"
- :fetch-suggestions="querySearchAsync"
- :trigger-on-focus="true"
- placeholder="请输入药品名称"
- @select="handleSelect"
- @input="changeDrugName(scope.$index)"
- style="width: 160px"
- >
- <i class="el-icon-search el-input__icon" slot="suffix"></i>
- <template slot-scope="{ item }">
- <div class="name">
- {{
- item.drug_name +
- item.dose +
- item.dose_unit +
- "*" +
- item.min_number +
- item.min_unit +
- "/" +
- item.max_unit +
- " " +
- item.manufacturer
- }}
- </div>
- </template>
- </el-autocomplete>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column align="center" width="140">
- <template slot="header" slot-scope="scope">
- <span>药品类型</span>
- </template>
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.drug_type"
- filterable
- placeholder="请选择药品类型"
- >
- <el-option
- v-for="(option, index) in drugTypeList"
- :key="index"
- :label="option.name"
- :value="option.id"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column align="center" width="140">
- <template slot="header" slot-scope="scope">
- <span>规格&单位</span>
- </template>
- <template slot-scope="scope">
- <el-form-item style="padding-top: 20px">
- <el-input
- :disabled="true"
- placeholder="请输入规格&单位"
- v-model="scope.row.name"
- ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column align="center" width="150">
- <template slot="header" slot-scope="scope">
- <span>批号<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- style="padding-top: 20px"
- :rules="tableRules.batch_number"
- :prop="'recordData.' + scope.$index + '.batch_number'"
- >
- <el-input
- placeholder="请输入批号"
- v-model="scope.row.batch_number"
- ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
-
- <el-table-column align="center" width="200">
- <template slot="header" slot-scope="scope">
- <span>入库数量<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'recordData.' + scope.$index + '.warehousing_count'"
- :rules="tableRules.warehousing_count"
- style="padding-top: 10px"
- >
- <div style="display: flex">
- <!-- <el-input
- oninput="value=value.replace(/\D|^0/g,'')"
- placeholder="请输入入库数量"
- type="number"
- v-model="scope.row.warehousing_count"
- style="width:120px"
- ></el-input> -->
- <el-input
- placeholder="请输入入库数量"
- v-model="scope.row.warehousing_count"
- style="width: 120px"
- ></el-input>
- <!-- {{scope.row.max_unit}} -->
- <el-select
- v-model="scope.row.max_unit"
- filterable
- placeholder="请选择单位"
- style="width: 80px"
- @change="changeUnit(scope.row,scope.$index)"
- >
- <el-option
- v-for="(option, index) in scope.row.unitList"
- :key="index"
- :label="option.name"
- :value="option.name"
- >
- </el-option>
- </el-select>
- </div>
- </el-form-item>
- </template>
- </el-table-column>
-
- <el-table-column align="center" width="140">
- <template slot="header" slot-scope="scope">
- <span>拆零零售价(元)<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'recordData.' + scope.$index + '.retail_price'"
- :rules="tableRules.retail_price"
- style="padding-top: 20px"
- >
- <el-input
- style="width: 100px"
- placeholder="请输入拆零零售价"
- type="number"
- v-model="scope.row.retail_price"
- ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
-
- <el-table-column align="center" width="120">
- <template slot="header" slot-scope="scope">
- <span>进货单价(元)<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'recordData.' + scope.$index + '.price'"
- :rules="tableRules.last_price"
- style="padding-top: 20px"
- >
- <el-input
- style="width: 100px"
- placeholder="请输入单价"
- type="number"
- v-model="scope.row.last_price"
- ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
-
- <el-table-column label="总价(元)" align="center" width="80">
- <template slot-scope="scope">
- {{ calculate(scope.row.last_price * scope.row.warehousing_count) }}
- </template>
- </el-table-column>
-
- <el-table-column width="180" align="center">
- <template slot="header" slot-scope="scope">
- <span>有效日期<span style="color: red">*</span></span>
- </template>
- <template slot-scope="scope">
- <el-form-item
- :prop="'recordData.' + scope.$index + '.expiry_date'"
- :rules="tableRules.expiry_date"
- style="padding-top: 20px"
- >
- <el-date-picker
- prefix-icon="el-icon-date"
- style="width: 145px"
- v-model="scope.row.expiry_date"
- type="date"
- placeholder="选择日期时间"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- ></el-date-picker>
- </el-form-item>
- </template>
- </el-table-column>
-
- <el-table-column label="生产日期" width="180" align="center">
- <template slot-scope="scope">
- <el-date-picker
- prefix-icon="el-icon-date"
- style="width: 145px"
- v-model="scope.row.product_date"
- type="date"
- placeholder="选择日期时间"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- ></el-date-picker>
- </template>
- </el-table-column>
-
- <el-table-column label="生产厂家" width="140" align="center">
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.manufacturer"
- filterable
- placeholder="请选择厂商"
- >
- <el-option
- v-for="(option, index) in manufacturerList"
- :key="index"
- :label="option.manufacturer_name"
- :value="option.id"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
-
- <el-table-column label="经销商" width="140" align="center">
- <template slot-scope="scope">
- <el-select
- v-model="scope.row.dealer"
- filterable
- placeholder="请选择厂商"
- >
- <el-option
- v-for="(option, index) in dealerList"
- :key="index"
- :label="option.dealer_name"
- :value="option.id"
- >
- </el-option>
- </el-select>
- </template>
- </el-table-column>
-
- <el-table-column align="center" width="150" label="批准文号">
- <template slot-scope="scope">
- <el-form-item style="padding-top: 20px">
- <el-input
- placeholder="请输入批准文号"
- v-model="scope.row.number"
- ></el-input>
- </el-form-item>
- </template>
- </el-table-column>
-
- <el-table-column label="药品追溯码" width="150" align="center">
- <template slot-scope="scope">
- <el-input v-model="scope.row.drug_code" placeholder="请输入药品追溯码"></el-input>
- </template>
- </el-table-column>
-
- <el-table-column label="备注" width="150" align="center">
- <template slot-scope="scope">
- <el-input v-model="scope.row.remark" placeholder="请输入备注"></el-input>
- </template>
- </el-table-column>
-
- <el-table-column
- label="操作"
- fixed="right"
- align="center"
- width="150"
- >
- <template slot-scope="scope">
- <el-tooltip
- class="item"
- effect="dark"
- content="新增"
- placement="top"
- >
- <el-button
- size="mini"
- type="primary"
- icon="el-icon-circle-plus-outline"
- @click="handleEdit(scope.$index, scope.row)"
- >
- </el-button>
- </el-tooltip>
- <el-tooltip
- class="item"
- effect="dark"
- content="删除"
- placement="top"
- >
- <el-button
- size="mini"
- type="danger"
- icon="el-icon-delete"
- @click="handleDelete(scope.$index, scope.row)"
- >
- </el-button>
- </el-tooltip>
- </template>
- </el-table-column>
- </el-table>
-
- <div style="margin-top: 20px;">合计金额: {{getTotalPirce() }} </div>
- </el-form>
- </div>
- </div>
- </template>
-
- <script>
- import { uParseTime } from "@/utils/tools";
- import {
- GetAllConfig,
- GetAllDrugInfoByID,
- postDrugWarehouse,
- toCheckWarehousingInfo,
- toReturnCheckWarehousing
- } from "@/api/drug/drug_stock";
- import BreadCrumb from "../../components/bread-crumb";
- import DrugsStockDialog from "./drugsStockDialog/index";
- import { getDataConfig, getDictionaryDataConfig } from "@/utils/data";
- import { getAllDrugList, postSearchDrugList } from "@/api/data";
- export default {
- components: { DrugsStockDialog, BreadCrumb },
- name: "stockIn",
-
- data() {
- var checkGoodId = (rule, value, callback) => {
- setTimeout(() => {
- if (value == "" || value == 0) {
- return callback(new Error("规格名称不能为空"));
- }
- }, 2000);
- };
-
- return {
- crumbs: [
- { path: false, name: "库存管理" },
- { path: false, name: "药品入库单" },
- { path: false, name: "新增入库单" },
- ],
- crumbs2: [
- { path: false, name: "库存管理" },
- { path: false, name: "其他入库单" },
- { path: false, name: "新增入库单" },
- ],
- signAndWeighBoxPatients: "sign-and-weigh-box-patients",
- warehousing_time: "",
- adminUserOptions: null,
- currentIndex: 0,
- listLoading: false,
- recordInfo: {
- recordData: [],
- stock_in_code: "",
- current_index: "",
- },
- tableRules: {
- price: [{ required: true, message: "单价不能为空", trigger: "blur" }],
- warehousing_count: [
- { required: true, message: "数量不能为空", trigger: "blur" },
- ],
-
- good_id: [{ validator: checkGoodId, trigger: "blur" }],
-
- min_unit: [
- { required: true, message: "单位不能为空", trigger: "blur" },
- ],
- batch_number: [
- { required: true, message: "批号不能为空", trigger: "blur" },
- ],
- expiry_date: [
- { required: true, message: "有效日期不能为空", trigger: "blur" },
- ],
- retail_price: [
- { required: true, message: "请输入包装零售价", trigger: "blur" },
- ],
- },
- type: this.$route.query.type,
- total: "",
- product_date: "",
- expiry_date: "",
- numbers: "",
-
- // prop
- isVisibility: false,
- propForm: {
- goods: [],
- goodType: [],
- goodInfo: [],
- goodUnit: [],
- title: "入库",
- formValue: {
- good_type_id: "",
- good_id: "",
- number: "",
- product_date: "",
- expiry_date: "",
- warehousing_count: "",
- price: "",
- remark: "",
- dealer: "",
- manufacturer: "",
- },
- isCreated: 1,
- },
- form: {
- manufacturer: "",
- dealer: "",
- },
-
- formValue: {
- good_type_id: "",
- good_id: "",
- number: "",
- product_date: "",
- expiry_date: "",
- warehousing_count: "",
- price: "",
- remark: "",
- dealer: "",
- manufacturer: "",
- },
-
- manufacturer: [],
- dealer: [],
- goodType: [],
- goodInfo: [],
- drugList: [],
- manufacturerList: [],
- dealerList: [],
- showOne: true,
- showTwo: false,
- drugTypeList: [],
- totalPrice: 0,
- unitList: [],
- loading: false,
- list: [],
- storehouse_id: "",
- warehousing_id:0,
- showCheck:false,
- showReturnCheck:false,
- };
- },
- methods: {
- handleSave: function () {
- if (this.recordInfo.recordData.length <= 0) {
- this.$message.error("请添加入库信息");
- return;
- }
- sessionStorage.removeItem("warehousing_orders");
- this.$router.back(-1);
- },
- handleCancle: function () {
- this.$confirm("是否放弃编辑返回上一页?", "放弃编辑", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- sessionStorage.removeItem("warehousing_orders");
- this.$router.back(-1);
- })
- .catch(() => {});
- },
- handleCreate: function () {
- this.propForm.formValue = {};
- this.propForm.isCreated = 1;
- this.isVisibility = true;
- },
- comfirm: function (val) {
- this.$refs.dialog.hide();
- if (val.selectedGoodInfo.length > 0) {
- for (let i = val.selectedGoodInfo.length - 1; i >= 0; i--) {
- if (i == 0) {
- this.recordInfo.recordData[this.currentIndex].drug_id =
- val.selectedGoodInfo[i].id;
- this.recordInfo.recordData[this.currentIndex].price =
- val.selectedGoodInfo[i].last_price.toString();
- this.recordInfo.recordData[this.currentIndex].retail_price =
- val.selectedGoodInfo[i].retail_price.toString();
- this.recordInfo.recordData[this.currentIndex].min_unit =
- val.selectedGoodInfo[i].min_unit;
- } else {
- const tempForm = {};
- tempForm["id"] = 0;
- tempForm["drug_id"] = val.selectedGoodInfo[i].id;
- tempForm["number"] = "";
- tempForm["product_date"] = "";
- tempForm["expiry_date"] = "";
- tempForm["warehousing_count"] = "";
- tempForm["retail_price"] =
- val.selectedGoodInfo[i].retail_price.toString();
- tempForm["price"] = val.selectedGoodInfo[i].last_price.toString();
- tempForm["remark"] = "";
- tempForm["dealer"] = "";
- tempForm["manufacturer"] = "";
- tempForm["min_unit"] = val.selectedGoodInfo[i].min_unit;
- this.recordInfo.recordData.splice(
- this.currentIndex + 1,
- 0,
- tempForm
- );
- }
- }
- }
-
- this.currentIndex = -1;
- },
- cancle: function () {
- this.$refs.dialog.hide();
- },
- GetConfigInfo: function () {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
-
- 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;
-
- for (let i = 0; i < response.data.data.drugs.length; i++) {
- this.goodType.push(response.data.data.drugs[i]);
- if (response.data.data.drugs[i].drug_specs != null) {
- for (
- let b = 0;
- b < response.data.data.drugs[i].drug_specs.length;
- b++
- ) {
- this.goodInfo.push(response.data.data.drugs[i].drug_specs[b]);
- }
- }
- }
- this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: "全部" });
- this.dealer.splice(0, 0, { id: 0, dealer_name: "全部" });
-
- this.form.manufacturer = 0;
- this.form.dealer = 0;
- this.list = response.data.data.list;
- this.storehouse_id =response.data.data.configlist.drug_storehouse_info;
- }
- loading.close();
- });
- },
- typeName: function (drug_id) {
- let name = "";
- for (let i = 0; i < this.goodInfo.length; i++) {
- if (this.goodInfo[i].id == drug_id) {
- name = this.goodInfo[i].drug_name;
- }
- }
- return name;
- },
- specificationName: function (drug_id) {
- let name = "";
- for (let i = 0; i < this.goodInfo.length; i++) {
- if (this.goodInfo[i].id == drug_id) {
- name = this.goodInfo[i].drug_spec;
- }
- }
- return name;
- },
- getDrugName: function (drug_id) {
- let name = "";
- for (let i = 0; i < this.recordInfo.recordData.length; i++) {
- if (drug_id == this.recordInfo.recordData[i].id) {
- name =
- this.recordInfo.recordData[i].dose +
- this.recordInfo.recordData[i].dose_unit +
- "*" +
- this.recordInfo.recordData[i].min_number +
- this.recordInfo.recordData[i].min_unit +
- "/" +
- this.recordInfo.recordData[i].max_unit;
- }
- }
- return name;
- },
- handleEdit: function (index, row) {
- const tempObj = {};
- tempObj["id"] = 0;
- tempObj["drug_name"] = "";
- tempObj["drug_id"] = 0;
- tempObj["number"] = "";
- tempObj["product_date"] = "";
- tempObj["expiry_date"] = "";
- tempObj["warehousing_count"] = "";
- tempObj["retail_price"] = "";
- tempObj["price"] = "";
- tempObj["remark"] = "";
- tempObj["dealer"] = "";
- tempObj["manufacturer"] = "";
- tempObj["min_unit"] = "";
- tempObj["max_unit"] = "";
- tempObj["drug_type"] = "";
- tempObj["batch_number"] = "";
- tempObj["dose"] = "";
- tempObj["dose_unit"] = "";
- tempObj["dealer"] = "";
- tempObj["last_price"] = "";
- tempObj["count_unit"] = "";
- tempObj["min_number"] = "";
- tempObj["drug_code"] = ""
- this.recordInfo.recordData.push(tempObj);
- },
- handleDelete: function (index, row) {
- if (this.recordInfo.recordData.length <= 1) {
- this.$message.error("只有一条记录的时候无法删除");
- return;
- } else {
- this.recordInfo.recordData.splice(index, 1);
- }
- },
- calculate: function (val) {
- if (val == 0) {
- return "";
- }
- return Math.round(parseFloat(val) * 100) / 100;
- },
-
- getTime(val, temp) {
- if (val != 0) {
- return uParseTime(val, temp);
- } else {
- return "";
- }
- },
- getTimeOne(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d}')
- }
- },
- showDialog(index, row) {
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- this.currentIndex = index;
- this.isVisibility = true;
- const params = {
- manufacturer_id: this.form.manufacturer,
- dealer_id: this.form.dealer,
- };
-
- GetAllDrugInfoByID(params).then((response) => {
- if (response.data.state == 0) {
- this.$message.error(response.data.msg);
- return false;
- loading.close();
- } else {
- loading.close();
-
- if (response.data.data.drugs.length <= 0) {
- this.$message.error("该厂商或经销商没有药品信息");
- return;
- }
- for (let i = 0; i < response.data.data.drugs.length; i++) {
- this.propForm.goods.push(response.data.data.drugs[i]);
- }
- this.$refs.dialog.show();
- const obj = {};
- this.propForm.goods = this.propForm.goods.reduce((cur, next) => {
- obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
- return cur;
- }, []); // 设置cur默认类型为数组,并且初始值为空的数组
- }
-
- for (let i = 0; i < this.propForm.goods.length; i++) {
- for (let a = 0; a < this.propForm.goods[i].drug_specs.length; a++) {
- var respObj = this.propForm.goods[i].drug_specs[a];
- respObj["isSelected"] = false;
- }
- }
- });
- },
- getSummaries(param) {
- const { columns, data } = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = "总价";
- return;
- }
- const values = data.map((item) => Number(item[column.property]));
- if (!values.every((value) => isNaN(value))) {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] += " 元";
- } else {
- sums[index] = "N/A";
- }
- });
-
- return sums;
- },
- back() {
- this.$router.go(-1);
- },
- submit() {
- this.$refs["tableForm"].validate((valid) => {
- if (valid) {
- this.loading = true;
- const array = this.recordInfo.recordData;
- if (this.storehouse_id == 0) {
- this.$message.error("仓库不能为空!");
- this.loading = false;
- return false;
- }
- for (let i = 0; i < array.length; i++) {
- if (array[i].drug_id == 0) {
- this.$message.error("药品名称或者药品规格名称不能为空");
- this.loading = false;
- return;
- }
- }
-
- if (this.recordInfo.recordData.length <= 0) {
- this.$message.success("请添加入库商品");
- this.loading = false;
- return;
- }
-
- for (let i = 0; i < this.recordInfo.recordData.length; i++) {
- if (this.recordInfo.recordData[i].dealer == "") {
- this.recordInfo.recordData[i].dealer = 0;
- }
- this.recordInfo.recordData[i].last_price =
- this.recordInfo.recordData[i].last_price.toString();
- this.recordInfo.recordData[i].retail_price =
- this.recordInfo.recordData[i].retail_price.toString();
- if (this.recordInfo.recordData[i].dealer == "") {
- this.recordInfo.recordData[i].dealer = 0;
- }
- for (let j = 0; j < this.manufacturerList.length; j++) {
- if (
- this.recordInfo.recordData[i].manufacturer ==
- this.manufacturerList[j].manufacturer_name
- ) {
- this.recordInfo.recordData[i].manufacturer =
- this.manufacturerList[j].id;
- }
- }
-
- for (let z = 0; z < this.dealerList.length; z++) {
- if (
- this.recordInfo.recordData[i].dealer ==
- this.dealerList[z].dealer_name
- ) {
- this.recordInfo.recordData[i].dealer = this.dealerList[z].id;
- }
- }
- }
- const params = {
- stockIn: this.recordInfo.recordData,
- };
-
- postDrugWarehouse(
- params,
- this.warehousing_time,
- this.form.manufacturer,
- this.form.dealer,
- this.type,
- this.storehouse_id,
- this.warehousing_id,
- ).then((response) => {
- if (response.data.state == 0) {
- this.loading = false;
- this.$message.error(response.data.msg);
- return false;
- } else {
- this.loading = false;
- this.$message.success("保存成功");
- this.listLoading = false;
- var info = response.data.data.info
- this.warehousing_id = info.id
- var list = response.data.data.list
- var manufacturerList = response.data.data.manufacturerList
- var dealerList = response.data.data.dealerList
- var drugTypeList = response.data.data.drugTypeList
- for(let i=0;i<list.length;i++){
- for(let j=0;j<manufacturerList.length;j++){
- if(list[i].manufacturer_id == manufacturerList[j].id){
- list[i].manufacturer_id = manufacturerList[j].manufacturer_name
- }
- }
- for(let s=0;s<dealerList.length;s++){
- if(list[i].dealer_id == dealerList[s].id){
- list[i].dealer_id = dealerList[s].manufacturer_name
- }
- }
-
- list[i].expiry_date = this.getTimeOne(list[i].expiry_date)
- list[i].product_date = this.getTimeOne(list[i].product_date)
- list[i].drug_name = list[i].drug.drug_name
- list[i].name = list[i].drug.dose + list[i].drug.dose_unit +"*"+list[i].drug.min_number +list[i].drug.min_unit+"/"+list[i].drug.max_unit
- for(let z=0;z<drugTypeList.length;z++){
- if(list[i].drug.drug_type == drugTypeList[z].value){
- list[i].drug_type = drugTypeList[z].name
- }
- }
- list[i].last_price = list[i].price
- list[i].warehousing_count = list[i].warehousing_count.toString()
- list[i].unitList = []
- list[i].drug_code = list[i].drug_code
- var obj = {id:1,name:""}
- obj.name = list[i].drug.max_unit
- var objOne = {id:2,name:""}
- objOne.name = list[i].drug.min_unit
- list[i].unitList.push(obj)
- list[i].unitList.push(objOne)
- }
- this.recordInfo.recordData = []
- this.recordInfo.recordData = list
- this.showCheck = true
- this.showReturnCheck = false
- // this.$router.back(-1);
- }
- });
- } else {
- return false;
- }
- });
- },
- changeManufacturer(val) {},
- changeDealer(val) {
- this.form.dealer = val;
- this.propForm.goods = [];
- },
- getDataConfig(module, filed_name) {
- return getDataConfig(module, filed_name);
- },
-
- getDictionaryDataConfig(module, filed_name) {
- return getDictionaryDataConfig(module, filed_name);
- },
-
- // 改版后的JS
- getlist() {
- getAllDrugList().then((response) => {
- if (response.data.state == 1) {
- var list = response.data.data.list;
- this.drugList = list;
- var manufacturerList = response.data.data.manufacturerList;
- this.manufacturerList = manufacturerList;
- for (let i = 0; i < this.drugList.length; i++) {
- for (let j = 0; j < this.manufacturerList.length; j++) {
- if (
- this.drugList[i].manufacturer == this.manufacturerList[j].id
- ) {
- this.drugList[i].manufacturer =
- this.manufacturerList[j].manufacturer_name;
- }
- }
- }
- }
- });
- },
-
- changeDrugName(val) {
- this.showOne = false;
- this.showTwo = true;
- },
- querySearchAsync(keyword, cb) {
- let key = "";
- if (keyword != undefined) {
- key = keyword;
- }
- let searchArray = [];
- postSearchDrugList(key, this.storehouse_id).then((response) => {
- if (response.data.state == 1) {
- searchArray = response.data.data.list;
-
- var list = response.data.data.list;
-
- this.drugList = list;
- var manufacturerList = response.data.data.manufacturerList;
- this.manufacturerList = manufacturerList;
- var dealerList = response.data.data.dealerList;
- this.dealerList = dealerList;
- for (let i = 0; i < this.drugList.length; i++) {
- for (let j = 0; j < this.manufacturerList.length; j++) {
- if (
- this.drugList[i].manufacturer == this.manufacturerList[j].id
- ) {
- this.drugList[i].manufacturer =
- this.manufacturerList[j].manufacturer_name;
- }
- }
-
- for (let z = 0; z < dealerList.length; z++) {
- if (this.drugList[i].dealer == this.dealerList[z].id) {
- this.drugList[i].dealer = this.dealerList[z].dealer_name;
- }
- }
- }
-
- cb(this.drugList);
- } else {
- cb([]);
- }
- });
- },
- changeDrugName(val) {
- this.currentIndex = val;
- },
- handleSelect(val) {
- for (let i = 0; i < this.recordInfo.recordData.length; i++) {
- if (i == this.currentIndex) {
- this.recordInfo.recordData[i].drug_id = val.id;
- this.recordInfo.recordData[i].drug_name = val.drug_name;
- this.recordInfo.recordData[i].drug_type = val.drug_type;
- this.recordInfo.recordData[i].name =
- val.dose +
- val.dose_unit +
- "*" +
- val.min_number +
- val.min_unit +
- "/" +
- val.max_unit;
- this.recordInfo.recordData[i].last_price = val.last_price;
-
- this.recordInfo.recordData[i].retail_price = val.min_price;
- this.recordInfo.recordData[i].manufacturer = val.manufacturer;
- this.recordInfo.recordData[i].number = val.number;
- this.recordInfo.recordData[i].max_unit = val.max_unit;
- this.recordInfo.recordData[i].min_unit = val.min_unit;
- this.recordInfo.recordData[i].count_unit = val.max_unit;
- this.recordInfo.recordData[i].min_number = val.min_number
- if (val.dealer == 0) {
- this.recordInfo.recordData[i].dealer = "";
- } else {
- this.recordInfo.recordData[i].dealer = val.dealer;
- }
- this.recordInfo.recordData[i].unitList = []
- var obj = {id:1,name:""}
- var objOne= {id:2,name:""}
- obj.name = val.max_unit
- objOne.name = val.min_unit
- this.recordInfo.recordData[i].unitList.push(obj)
- this.recordInfo.recordData[i].unitList.push(objOne)
- }
-
- }
- },
- toCheck(){
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- var params = {
- warehousing_id:this.warehousing_id,
- }
- toCheckWarehousingInfo(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- this.$message.success("审核成功!")
- this.$router.back(-1);
- this.showCheck = false
- this.showReturnCheck = true
- loading.close()
- }else{
- this.$message.error("审核失败!")
- loading.close()
- }
- })
- },
- toReturnCheck(){
- const loading = this.$loading({
- lock: true,
- text: "Loading",
- spinner: "el-icon-loading",
- background: "rgba(0, 0, 0, 0.7)",
- });
- var params = {
- warehousing_id:this.warehousing_id,
- }
- toReturnCheckWarehousing(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- this.$message.success("反审核成功!")
- this.showCheck = true
- this.showReturnCheck = false
- loading.close()
- }else{
- this.$message.error("反审核失败!")
- loading.close()
- }
- })
- },
- changeUnit(val,index){
- // console.log("val3232323232",val)
- // for(let i=0;i<this.recordInfo.recordData.length;i++){
- // if(i == index){
- // if(this.recordInfo.recordData[i].max_unit == this.recordInfo.recordData[i].count_unit){
-
- // }
- // if(this.recordInfo.recordData[i].min_unit == this.recordInfo.recordData[i].count_unit){
-
- // }
- // }
- // }
- },
- getTotalPirce(){
-
- var total_price = 0
- if(this.recordInfo.recordData!=null && this.recordInfo.recordData.length>0){
-
- for(let i=0;i<this.recordInfo.recordData.length;i++){
- total_price += this.recordInfo.recordData[i].last_price * parseInt(this.recordInfo.recordData[i].warehousing_count)
- }
-
- if(total_price>0){
- return total_price.toFixed(4)
- }else{
- return ""
- }
- }
- }
- },
- created() {
- if (this.$route.path == "/Pharmacy/in/add") {
- this.crumbs = [
- { path: false, name: "药品管理" },
- { path: false, name: "药品入库单" },
- { path: false, name: "新增入库单" },
- ];
- }
- this.drugTypeList = getDictionaryDataConfig("system", "drug_type");
-
- var nowDate = new Date();
- var nowYear = nowDate.getFullYear();
- var nowMonth = nowDate.getMonth() + 1;
- var nowDay = nowDate.getDate();
- this.warehousing_time =
- nowYear +
- "-" +
- (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
- "-" +
- (nowDay < 10 ? "0" + nowDay : nowDay);
- const tempObj = {};
- tempObj["id"] = 0;
- tempObj["drug_id"] = 0;
- tempObj["drug_name"] = "";
- tempObj["dosage"] = "";
- tempObj["max_unit"] = "";
- tempObj["min_unit"] = "",
- tempObj["lot_number"] = "";
- tempObj["product_date"] = "";
- tempObj["expiry_date"] = "";
- tempObj["warehousing_count"] = "";
- tempObj["retail_price"] = "";
- tempObj["last_price"] = "";
- tempObj["remark"] = "";
- tempObj["dealer"] = "";
- tempObj["manufacturer"] = "";
- tempObj["batch_number"] = "";
- tempObj["drug_type"] = "";
- tempObj["dealer"] = "";
- tempObj["number"] = "";
- tempObj["count_unit"] = "";
- tempObj["min_number"] = "";
- tempObj["drug_code"] = ""
- this.recordInfo.recordData.push(tempObj);
-
- this.GetConfigInfo();
- this.propForm.goodUnit = this.$store.getters.good_unit;
-
- // this.unitList = getDataConfig("hemodialysis", "units");
- // console.log("hhahdhhafd",this.unitList)
- },
- };
- </script>
-
- <style>
- #oictable ::-webkit-scrollbar {
- height: 15px;
- }
- </style>
-
- <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;
- }
-
- .titleOne {
- width: 120px;
- display: inline-block;
- font-weight: normal;
- color: #909399;
- padding: 6px 0;
- margin-left: 20px;
- }
- </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;
- }
- .el-autocomplete-suggestion {
- width: 400px !important;
- }
- </style>
|