123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143 |
- <template>
- <div>
- <div style="display: flex;align-items: center;justify-content: space-between;margin-bottom:10px;">
- <div>
- <el-input
- size="small"
- style="width: 200px;margin-left:10px;"
- 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
- >
- <el-date-picker
- size="small"
- v-model="start_time"
- type="date"
- style="margin-left:5px;width:140px;"
- placeholder="选择日期"
- @change="changeStartTime">
- </el-date-picker>
- <el-date-picker
- size="small"
- v-model="end_time"
- type="date"
- style="margin-left:5px;width:140px;"
- placeholder="选择日期"
- @change="changeEndTime">
- </el-date-picker>
- </div>
- <div>
- <el-button size="small" type="primary" @click="dialogVisible = true">新增</el-button>
- <el-button size="small" type="primary" @click="toCheck">核对</el-button>
- <!-- <el-button size="small" type="primary" @click="print">打印</el-button>
- <el-button size="small" type="primary" @click="exportList">导出</el-button> -->
- </div>
- </div>
- <el-table :data="tableList" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }" @selection-change="changePrice">
- <el-table-column type="selection" width="55" align="center"> </el-table-column>
- <el-table-column prop="date" label="盘点编号" align="center">
- <template slot-scope="scope">
- {{scope.row.warehousing_order}}
- </template>
- </el-table-column>
- <el-table-column prop="date" label="盘点日期" align="center">
- <template slot-scope="scope">
- {{getTime(scope.row.start_time)}}
- </template>
- </el-table-column>
- <el-table-column prop="date" label="药品名称" align="center">
- <template slot-scope="scope">
- {{scope.row.drug_name}}
- </template>
- </el-table-column>
- <el-table-column prop="date" label="药品规格" align="center">
- <template slot-scope="scope">
- {{scope.row.specification_name}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="盘点数量" align="center">
- <template slot-scope="scope">
- {{scope.row.count}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="盘点人" align="center">
- <template slot-scope="scope">
- {{getDoctorName(scope.row.creater)}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="审核日期" align="center">
- <template slot-scope="scope">
- {{getTime(scope.row.checker_time)}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="审核人" align="center">
- <template slot-scope="scope">
- {{getDoctorName(scope.row.checker)}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="状态" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.checker_status == 1">盘点完成</span>
- <span v-if="scope.row.checker_status == 2">正在盘点</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="260">
- <template slot-scope="scope">
- <el-button type="primary" size="small" @click="editInventory(scope.row.id,scope.row.checker_status,scope.$index)">编辑</el-button>
- <el-button type="danger" size="small" @click="deleteDrugInventory(scope.row.id,scope.row.checker_status,scope.$index)">删除</el-button>
-
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 20, 40, 100]"
- :page-size="10"
- background
- style="margin-top:20px;text-align: right"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- >
- </el-pagination>
- <el-dialog
- title="药品盘点"
- :visible.sync="dialogVisible"
- width="1200px">
- <el-form :model="form" class="modifyDialog" label-width="120px">
- <el-form-item label="药品ID">
- <el-input v-model="form.drug_id" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="药品名称">
- <el-autocomplete
- class="checkSearch"
- popper-class="my-autocomplete"
- v-model="form.drug_name"
- :fetch-suggestions="querySearchAsync"
- :trigger-on-focus="true"
- placeholder="请输入药品名称"
- @select="handleSelect"
- 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>
- <el-form-item label="批次">
- <el-select v-model="form.batch_number" filterable placeholder="请选择" @change="changeNumber">
- <el-option
- v-for="(item,index) in numberList"
- :key="index"
- :label="item.batch_number"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
-
- <el-form-item label="规格">
- <el-input v-model="form.specification_name" :disabled="true"></el-input>
- </el-form-item>
- <!-- <el-form-item label="单位">
- <el-input v-model="form.warehousing_unit" :disabled="true"></el-input>
- </el-form-item> -->
- <el-form-item prop="max_unit" label="单位">
- <el-select v-model="form.warehousing_unit" style="width:160px;" placeholder="单位" @change="changeMaxUnit">
- <el-option
- v-for="(item,index) in getDataConfig('hemodialysis','units')"
- :key="index"
- :label="item.name"
- :value="item.name">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="进货价">
- <el-input v-model="form.last_price" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="零售价">
- <el-input v-model="form.retail_price" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="盘点数量">
- <el-input v-model="form.count"></el-input>
- </el-form-item>
- <el-form-item label="库存">
- <el-input v-model="form.total" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="产地">
- <el-input v-model="form.drug_origin_place" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="批准文号">
- <el-input v-model="form.number" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="生产厂商">
- <el-input v-model="form.manufacturer" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="备注">
- <div style="display:flex;">
- <el-input v-model="form.name"></el-input>
- <el-button style="margin-left:5px;" type="primary" @click="addInventory">添加</el-button>
- </div>
- </el-form-item>
- </el-form>
- <el-table :data="tableData" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }">
- <el-table-column prop="date" label="耗材ID" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.drug_id}}
- </template>
- </el-table-column>
- <el-table-column prop="date" label="耗材名称" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.drug_name}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="规格" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.specification_name}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="单位" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.warehousing_unit}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="盘点数量" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.count}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="原进货价" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.last_price}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="原零售价" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.retail_price}}
- </template>
- </el-table-column>
-
- <el-table-column prop="name" label="生产厂商" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.manufacturer}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="产地" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.drug_origin_place}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="批准文号" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.number}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="备注" width="100" align="center">
- <template slot-scope="scope">
- {{scope.row.remark}}
- </template>
- </el-table-column>
- <el-table-column
- fixed="right"
- width="100"
- label="操作">
- <template slot-scope="scope">
- <el-button type="text" size="small" @click="toEdit(scope.row,scope.$index)">编辑</el-button>
- <el-button type="text" size="small" @click="toDelete(scope.$index)">删除</el-button>
-
- </template>
- </el-table-column>
- </el-table>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="saveDrugInventory">确 定</el-button>
- </span>
- </el-dialog>
-
-
- <el-dialog
- title="库房调价"
- :visible.sync="editdialogVisible"
- width="1200px">
- <el-form :model="form" class="modifyDialog" label-width="120px">
-
- <el-form-item label="耗材ID">
- <el-input v-model="form.drug_id" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="药品名称">
- <el-autocomplete
- class="checkSearch"
- popper-class="my-autocomplete"
- v-model="form.drug_name"
- :fetch-suggestions="querySearchAsync"
- :trigger-on-focus="true"
- placeholder="请输入药品名称"
- @select="handleSelect"
- 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>
- <el-form-item label="规格">
- <el-input v-model="form.specification_name" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="批次">
- <el-select v-model="form.batch_number" filterable placeholder="请选择" @change="changeNumber">
- <el-option
- v-for="(item,index) in numberList"
- :key="index"
- :label="item.batch_number"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="单位">
- <el-input v-model="form.warehousing_unit" :disabled="true"></el-input>
- </el-form-item> -->
- <el-form-item prop="warehousing_unit" label="单位">
- <el-select v-model="form.warehousing_unit" style="width:160px;" placeholder="单位" @change="changeMaxUnit">
- <el-option
- v-for="(item,index) in getDataConfig('hemodialysis','units')"
- :key="index"
- :label="item.name"
- :value="item.name">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="进货价">
- <el-input v-model="form.last_price" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="零售价">
- <el-input v-model="form.retail_price" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="盘点数量">
- <el-input v-model="form.count"></el-input>
- </el-form-item>
- <el-form-item label="库存">
- <el-input v-model="form.total" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="产地">
- <el-input v-model="form.drug_origin_place"></el-input>
- </el-form-item>
- <el-form-item label="批准文号">
- <el-input v-model="form.number"></el-input>
- </el-form-item>
- <el-form-item label="生产厂商">
- <el-input v-model="form.manufacturer"></el-input>
- </el-form-item>
- <el-form-item label="备注">
- <div style="display:flex;">
- <el-input v-model="form.remark"></el-input>
- </div>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="editdialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="saveInventory">确 定</el-button>
- </span>
- </el-dialog>
-
- <el-dialog
- title="药品盘点核对"
- :visible.sync="checkDialogVisible"
- width="30%"
- >
- <span>
- <el-form :model="form">
- <el-row>
- <el-col>
- <el-form-item label="核对时间">
- <el-date-picker
- size="small"
- v-model="check_time"
- type="date"
- style="margin-left:5px;width:140px;"
- placeholder="选择日期">
- </el-date-picker>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col>
- <el-form-item label="核对人">
- <el-select v-model="checker" placeholder="请选择">
- <el-option
- v-for="item in doctorList"
- :key="item.admin_user_id"
- :label="item.user_name"
- :value="item.admin_user_id">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="checkDialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="SaveDrugCheckedInventory">保 存</el-button>
- </span>
- </el-dialog>
-
-
- <el-dialog
- title="库房调价"
- :visible.sync="modifydialogVisible"
- width="1200px">
- <el-form :model="form" class="modifyDialog" label-width="120px">
-
- <el-form-item label="耗材ID">
- <el-input v-model="form.drug_id"></el-input>
- </el-form-item>
- <el-form-item label="药品名称">
- <el-autocomplete
- class="checkSearch"
- popper-class="my-autocomplete"
- v-model="form.drug_name"
- :fetch-suggestions="querySearchAsync"
- :trigger-on-focus="true"
- placeholder="请输入药品名称"
- @select="handleSelect"
- 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>
- <el-form-item label="规格">
- <el-input v-model="form.specification_name" :disabled="true"></el-input>
- </el-form-item>
- <!-- <el-form-item label="单位">
- <el-input v-model="form.warehousing_unit" :disabled="true"></el-input>
- </el-form-item> -->
- <el-form-item prop="warehousing_unit" label="单位">
- <el-select v-model="form.warehousing_unit" style="width:160px;" placeholder="单位" @change="changeMaxUnit">
- <el-option
- v-for="(item,index) in getDataConfig('hemodialysis','units')"
- :key="index"
- :label="item.name"
- :value="item.name">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="进货价">
- <el-input v-model="form.last_price" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="零售价">
- <el-input v-model="form.retail_price" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="盘点数量">
- <el-input v-model="form.count"></el-input>
- </el-form-item>
- <el-form-item label="库存">
- <el-input v-model="form.total" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="产地">
- <el-input v-model="form.drug_origin_place" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="批准文号">
- <el-input v-model="form.number" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="生产厂商">
- <el-input v-model="form.manufacturer" :disabled="true"></el-input>
- </el-form-item>
- <el-form-item label="备注">
- <div style="display:flex;">
- <el-input v-model="form.remark"></el-input>
- </div>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="modifydialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="modifyInventory">确 定</el-button>
- </span>
- </el-dialog>
-
-
- <el-dialog
- title="校正"
- :visible.sync="profdialogVisible"
- width="1200px">
- <el-form :model="form" class="modifyDialog" label-width="120px">
-
- <el-form-item label="药品名称">
- <el-autocomplete
- class="checkSearch"
- popper-class="my-autocomplete"
- v-model="form.drug_name"
- :fetch-suggestions="querySearchAsync"
- :trigger-on-focus="true"
- placeholder="请输入药品名称"
- @select="handleSelect"
- 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>
- <!-- <el-form-item label="单位">
- <el-input v-model="form.warehousing_unit"></el-input>
- </el-form-item> -->
- <el-form-item prop="warehousing_unit" label="单位">
- <el-select v-model="form.warehousing_unit" style="width:160px;" placeholder="单位" @change="changeMaxUnit">
- <el-option
- v-for="(item,index) in getDataConfig('hemodialysis','units')"
- :key="index"
- :label="item.name"
- :value="item.name">
- </el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="盘点数量">
- <el-input v-model="form.count"></el-input>
- </el-form-item>
- <el-form-item label="校正数量">
- <el-input v-model="form.proof_count" type="number"></el-input>
- </el-form-item>
-
- <el-form-item label="库存">
- <el-input v-model="form.total" :disabled="true"></el-input>
- </el-form-item>
-
- <el-form-item label="备注">
- <div style="display:flex;">
- <el-input v-model="form.remark"></el-input>
- </div>
- </el-form-item>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="profdialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="proofInventory">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
-
- <script>
- import { uParseTime } from '@/utils/tools'
- import { postSearchDrugWarehouseList,getDrugWarehouseInfoList,saveDrugInventory,getDrugInventoryList,SaveDrugCheckedInventory,getDrugInventoryDetail,modifyInventory,SaveDrugProofInventory,getDrugWarehouseInfoTotal,deleteDrugInventory} from "@/api/drug/drug"
- import { getDrugBatchNumber } from "@/api/drug/drug_stock"
- import { getDataConfig } from '@/utils/data'
- export default {
- name: "drugInventory",
- data() {
- return{
- searchKey:'',
- value1:'',
- value2:'',
- tableData: [],
- dialogVisible:false,
- form: {
- id:"",
- drug_name: '',
- retail_price :'',
- new_price:"",
- count:"",
- remark:"",
- warehousing_order:"",
- manufacturer:"",
- dealer:"",
- number:"",
- warehousing_unit:"",
- specification_name:"",
- buy_price:"",
- drug_id:"",
- packing_unit:"",
- drug_origin_place:"",
- report_count:"",
- total:"",
- dose:"",
- dose_unit:"",
- min_number:"",
- min_unit:"",
- max_unit:"",
- last_price:"",
- batch_number:"",
- product_date:"",
- expiry_date:"",
- warehouse_info_id:"",
- proof_count:"",
- },
- total: 0,
- editdialogVisible:false,
- limit:10,
- page:1,
- start_time:"",
- end_time:"",
- tableList:[],
- doctorList:[],
- checkDialogVisible:false,
- ids:"",
- checker:this.$store.getters.xt_user.user.id,
- check_time:new Date(),
- id:"",
- modifydialogVisible:false,
- numberList:[],
- profdialogVisible:false,
- index:"",
- unitList:[],
- }
- },
- methods:{
- changeNumber(val){
- this.form.warehouse_info_id = val
- this.getDrugWarehouseInfoTotal(val)
- },
- search(){
- this.getlist()
- },
- print(){
- if(this.ids == ""){
- this.$message.error("请勾选打印数据")
- return false
- }
- this.$router.push({path:'/stock/drugs/inventoryPrint?ids='+this.ids})
-
- },
- handleSizeChange(val){
- this.limit = val
- this.getlist()
- },
- handleCurrentChange(val){
- this.page = val
- this.getlist()
- },
- querySearchAsync(keyword, cb) {
- let key = '';
- if (keyword != undefined) {
- key = keyword
- }
- postSearchDrugWarehouseList(key).then(response => {
- if (response.data.state == 1) {
-
- var list = response.data.data.list
- console.log("列表数据",list)
- this.drugList = list
- var manufacturerList = response.data.data.manufacturerList
- this.manufacturerList = manufacturerList
- var dealer = response.data.data.dealerList
- this.dealerList = dealer
- 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 i=0;i<this.drugList.length;i++){
- for(let j=0;j<this.dealerList.length;j++){
- if(this.drugList[i].dealer == this.dealerList[j].id){
- this.drugList[i].dealer = this.dealerList[j].dealer_name
- }
- }
- }
-
- cb(this.drugList)
- } else {
- cb([])
- }
- })
- },
- handleSelect(val){
- console.log("val233223232332",val)
- this.getDrugBatchNumber(val.drug_id)
-
- var params = {
- id:val.drug_id
- }
- getDrugWarehouseInfoList(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- for(let i=0;i<list.length;i++){
- list[i].stock_max_number = val.min_number * list[i].stock_max_number
- }
- var total = 0
- for(let i=0;i<list.length;i++){
- total += (list[i].stock_max_number+list[i].stock_min_number)
- }
- console.log("total",total)
- console.log("库存",list)
- this.form.id = val.id
- this.form.drug_id = val.drug_id,
- this.form.drug_name = val.drug_name
- this.form.retail_price = val.retail_price
- this.form.warehousing_order = val.warehousing_order
- this.form.number = val.number
- this.form.dealer = val.dealer
- this.form.manufacturer = val.manufacturer
- this.form.remark = val.remark
- this.form.warehousing_unit = val.max_unit
- this.form.total = ""
- // this.form.total = this.getTotal(total,val.max_unit,val.min_unit,val.min_number)
- this.form.batch_number = val.batch_number
- this.form.last_price = val.last_price
- this.form.specification_name = val.dose + val.dose_unit +"*"+val.min_number+val.min_unit+"/"+val.max_unit
- this.form.expiry_date = val.expiry_date
- this.form.product_date =val.product_date
- this.form.drug_origin_place = val.drug_origin_place
- }
- })
- },
- getTime(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d}')
- }
- },
- getTotal(total,max_unit,min_unit,min_number){
- var str = ""
- var min_str = ""
- 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
- },
- addInventory(){
- var obj = {
- drug_id:this.form.drug_id,
- drug_name:this.form.drug_name,
- warehousing_unit:this.form.warehousing_unit,
- count:this.form.count,
- retail_price:this.form.retail_price.toString(),
- manufacturer:this.form.manufacturer,
- drug_origin_place:this.form.drug_origin_place,
- number:this.form.number,
- remark:this.form.remark,
- new_price:this.form.new_price.toString(),
- warehousing_order:this.form.warehousing_order,
- dealer:this.form.dealer,
- last_price:this.form.last_price,
- start_time:this.getTime(new Date()),
- number:this.form.number,
- total:this.form.total,
- specification_name:this.form.specification_name,
- batch_number:this.form.batch_number,
- expiry_date:this.form.expiry_date,
- product_date:this.form.product_date,
- warehouse_info_id:this.form.warehouse_info_id,
- }
- this.tableData.push(obj)
- this.form.drug_name = ""
- this.form.warehousing_unit = ""
- this.form.count = ""
- this.form.retail_price = ""
- this.form.manufacturer = ""
- this.form.drug_origin_place = ""
- this.form.number = ""
- this.form.remark = ""
- this.form.new_price = ""
- this.form.warehousing_order = ""
- this.form.dealer = ""
- this.form.last_price = ""
- this.form.number = ""
- this.form.total = ""
- this.form.specification_name = ""
- this.form.batch_number = ""
- this.form.expiry_date = ""
- this.form.product_date = ""
- },
- toDelete(index){
- this.tableData.splice(index,1)
- },
- toEdit(val,index){
- this.form.id= val.id
- this.form.drug_id = val.drug_id,
- this.form.drug_name = val.drug_name
- this.form.retail_price = val.retail_price
- this.form.warehousing_order = val.warehousing_order
- this.form.number = val.number
- this.form.dealer = val.dealer
- this.form.manufacturer = val.manufacturer
- this.form.remark = val.remark
- this.form.warehousing_unit = val.max_unit
- this.form.total = val.total
- this.form.batch_number = val.batch_number
- this.form.last_price = val.last_price
- this.form.specification_name = val.specification_name
- this.form.expiry_date = val.expiry_date
- this.form.product_date =val.product_date
- this.form.count = val.count
- this.index = index
- this.editdialogVisible = true
- },
- saveInventory(){
- for(let i=0;i<this.tableData.length;i++){
- if(this.form.id == this.tableData[i].id){
- this.tableData[i].drug_id = this.form.drug_id
- this.tableData[i].drug_name = this.form.drug_name
- this.tableData[i].retail_price = this.form.retail_price
- this.tableData[i].warehousing_order = this.form.warehousing_order
- this.tableData[i].number = this.form.number
- this.tableData[i].dealer = this.form.dealer
- this.tableData[i].manufacturer = this.form.manufacturer
- this.tableData[i].remark = this.form.remark
- this.tableData[i].warehouseing_unit = this.form.warehousing_unit
- this.tableData[i].total = this.form.total
- this.tableData[i].batch_number = this.form.batch_number
- this.tableData[i].last_price = this.form.last_price
- this.tableData[i].specification_name = this.form.specification_name
- this.tableData[i].expiry_date = this.form.expiry_date
- this.tableData[i].product_date = this.form.product_date
- this.tableData[i].count =this.form.count
- }
- if(this.index == i){
- this.tableData[i].drug_id = this.form.drug_id
- this.tableData[i].drug_name = this.form.drug_name
- this.tableData[i].retail_price = this.form.retail_price
- this.tableData[i].warehousing_order = this.form.warehousing_order
- this.tableData[i].number = this.form.number
- this.tableData[i].dealer = this.form.dealer
- this.tableData[i].manufacturer = this.form.manufacturer
- this.tableData[i].remark = this.form.remark
- this.tableData[i].warehouseing_unit = this.form.warehousing_unit
- this.tableData[i].total = this.form.total
- this.tableData[i].batch_number = this.form.batch_number
- this.tableData[i].last_price = this.form.last_price
- this.tableData[i].specification_name = this.form.specification_name
- this.tableData[i].expiry_date = this.form.expiry_date
- this.tableData[i].product_date = this.form.product_date
- this.tableData[i].count =this.form.count
- }
- }
- this.editdialogVisible = false
- },
- saveDrugInventory(){
- for(let i=0;i<this.tableData.length;i++){
- this.tableData[i].retail_price = this.tableData[i].retail_price.toString()
- this.tableData[i].last_price = this.tableData[i].last_price.toString()
- this.tableData[i].count = parseInt(this.tableData[i].count)
- if(this.tableData[i].expiry_date == undefined){
- this.tableData[i].expiry_date = 0
- }else{
- this.tableData[i].expiry_date = this.tableData[i].expiry_date
- }
- if( this.tableData[i].product_date == undefined){
- this.tableData[i].product_date = 0
- }else{
- this.tableData[i].product_date = this.tableData[i].product_date
- }
-
-
- if(this.tableData[i].dealer == 0){
- this.tableData[i].dealer = ""
- }
- if(this.tableData[i].manufacturer == 0){
- this.tableData[i].manufacturer = ""
- }
- if(this.tableData[i].batch_number == undefined){
- this.tableData[i].batch_number = ""
- }
- }
- var params = {
- tableData:this.tableData
- }
- console.log("parasm222",params)
-
- saveDrugInventory(params).then(response=>{
- if(response.data.state == 1){
- var msg = response.data.data.msg
- this.$message.success("保存成功")
- this.getlist()
- this.editdialogVisible = false
- this.dialogVisible = false
- }
- })
- },
- getlist(){
- var params = {
- limit:this.limit,
- page:this.page,
- keyword:this.searchKey,
- start_time:this.start_time,
- end_time:this.end_time,
- }
- console.log("params2332332",params)
- getDrugInventoryList(params).then(response=>{
-
- if(response.data.state == 1){
- this.total = response.data.data.total
- this.tableList = response.data.data.list
- console.log("09999999",this.tableList)
- console.log("表格",this.tableList)
- this.doctorList = response.data.data.doctorList
- console.log("医生",this.doctorList)
-
- }
- })
- },
- getDoctorName(id){
- var name = ""
- for(let i=0;i<this.doctorList.length;i++){
- if(id == this.doctorList[i].admin_user_id){
- name = this.doctorList[i].user_name
- }
- }
- return name
- },
- changePrice(val){
- var arr = []
- for(let i=0;i<val.length;i++){
- arr.push(val[i].id)
- }
- var str = arr.join(",")
- console.log("str",str)
- this.ids = str
- },
- toCheck(){
- if(this.ids.length <=0){
- this.$message.error("请勾选核对数据")
- return
- }else{
- this.checkDialogVisible = true
- }
- },
- SaveDrugCheckedInventory(){
- var params = {
- ids:this.ids,
- check_time:this.getTime(this.check_time),
- checker:this.checker,
- }
- console.log("params",params)
- SaveDrugCheckedInventory(params).then(response=>{
- if(response.data.state == 1){
- this.$message.success("保存成功")
- var msg = response.data.data.msg
- this.checkDialogVisible = false
- this.tableData = []
- this.getlist()
- }
- })
- },
- editInventory(id,check_status){
- if(check_status == 1){
- this.$message.error("已核对不能编辑")
- return false
- }
- getDrugInventoryDetail(id).then(response=>{
- if(response.data.state == 1){
- var detail = response.data.data.detail
- console.log("detial2323223",detail)
- this.id = detail.id
- this.form.drug_id = detail.drug_id
- this.form.drug_name = detail.drug_name
- this.form.specification_name = detail.specification_name
- this.form.retail_price = detail.retail_price
- this.form.warehousing_order =detail.warehousing_order
- this.form.number = detail.number
-
- this.form.manufacturer = detail.manufacturer
- this.form.remark = detail.remark
- this.form.warehousing_unit = detail.warehousing_unit
- this.form.total = detail.total
-
- this.form.last_price = detail.last_price
-
- this.form.count = parseInt(detail.count)
- this.form.drug_origin_place = detail.drug_origin_place
- this.form.stock_max_number = detail.stock_max_number
- this.form.stock_min_number = detail.stock_min_number
- this.form.warehouse_info_id = detail.warehouse_info_id
- this.modifydialogVisible = true
- }
- })
- },
- modifyInventory(){
- var params = {
- id:this.id,
- drug_id:this.form.drug_id,
- drug_name:this.form.drug_name,
- specification_name:this.form.specification_name,
- warehousing_unit:this.form.warehousing_unit,
- last_price:this.form.last_price,
- retail_price:this.form.retail_price,
- count:this.form.count,
- total:this.form.total,
- drug_origin_place:this.form.drug_origin_place,
- batch_number:this.form.batch_number,
- manufacturer:this.form.manufacturer,
- remark:this.form.remark,
- stock_max_number:this.form.stock_max_number,
- stock_min_number:this.form.stock_min_number,
- warehouse_info_id:this.form.warehouse_info_id,
- }
- console.log("params2222",params)
-
- modifyInventory(params).then(response=>{
- if(response.data.state == 1){
- var inventory = response.data.data.inventory
- this.modifydialogVisible = false
- this.getlist()
- }
- })
- },
- deleteDrugInventory(id,check_status,index){
- if(check_status == 1){
- this.$message.error("已核对的不能编辑")
- return
- }
- this.$confirm('是否删除所选内容?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
-
- deleteDrugInventory(id).then(response => {
- if (response.data.state == 1) {
- var msg = response.data.data.msg
- this.$message.success("保存成功")
- this.tableList.splice(index,1)
- }
- })
- }).catch(() => {
- this.loading = false
- });
- },
- exportList(){
-
- import('@/vendor/Export2Excel').then(excel => {
- const tHeader = ['药品名称', '规格', '单位','零售价','当前库存','盘点数','亏损金额']
- const filterVal = ['drug_name', 'spe', 'count','retail_price','total','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]));
- },
- getDrugBatchNumber(id){
- var params = {
- id:id
- }
- getDrugBatchNumber(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- console.log("list2222",list)
- this.numberList = list
- }
- })
- },
- toProof(id){
- getDrugInventoryDetail(id).then(response=>{
- if(response.data.state == 1){
- var detail = response.data.data.detail
- console.log("detail22222222",detail)
- this.id = detail.id
- this.form.drug_id = detail.drug_id
- this.form.drug_name = detail.drug_name
- this.form.specification_name = detail.specification_name
- this.form.retail_price = detail.retail_price
- this.form.warehousing_order =detail.warehousing_order
- this.form.number = detail.number
- this.form.manufacturer = detail.manufacturer
- this.form.remark = detail.remark
- this.form.warehousing_unit = detail.warehousing_unit
- this.form.total = detail.total
- this.form.last_price = detail.last_price
- this.form.count = parseInt(detail.count)
- this.form.drug_origin_place = detail.drug_origin_place
- this.form.warehouse_info_id = detail.warehouse_info_id
- this.profdialogVisible = true
- }
- })
- },
- proofInventory(){
- var params = {
- id:this.id,
- warehouseing_unit:this.form.warehousing_unit,
- warehouse_info_id:this.form.warehouse_info_id,
- total:this.total.toString(),
- remark:this.remark,
- proof_count:parseInt(this.form.proof_count),
- }
- console.log("params",params)
- SaveDrugProofInventory(params).then(response=>{
- if(response.data.state == 1){
- var inventory = response.data.data.inventory
- console.log("inventory",inventory)
- this.profdialogVisible = false
- this.getlist()
- }
- })
- },
- changeStartTime(val){
- this.start_time = this.getTime(val)
- this.getlist()
- },
- changeEndTime(val){
- this.end_time = this.getTime(val)
- this.getlist()
- },
- getDrugWarehouseInfoTotal(val){
- var params = {
- id:val,
- }
- getDrugWarehouseInfoTotal(params).then(response=>{
- if(response.data.state == 1){
- var list = response.data.data.list
- console.log("list",list)
-
- if(list.stock_max_number > 0){
- this.form.total = list.stock_max_number + list.XtBaseDrug.max_unit
- this.form.stock_max_number = list.stock_max_number
- }
- if(list.stock_min_number >0 ){
- this.form.total = list.stock_min_number + list.XtBaseDrug.min_unit
- this.form.stock_min_number = list.stock_min_number
- }
-
- }
- })
- },
- getDataConfig(module, filed_name) {
- return getDataConfig(module, filed_name)
- },
- changeMaxUnit(val){
- console.log("val23232",val)
- this.form.warehousing_unit = val
- }
- },
- created(){
- this.unitList = this.getDataConfig('hemodialysis','units')
- console.log("单位",this.unitList)
- this.getlist()
- },
- mounted() {
- },
- };
- </script>
|