Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

inventory.vue 33KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889
  1. <template>
  2. <div>
  3. <div v-show="showSearch">
  4. <el-autocomplete
  5. class="checkSearch"
  6. popper-class="my-autocomplete"
  7. v-model="form.drug_name"
  8. :fetch-suggestions="querySearchAsync"
  9. :trigger-on-focus="true"
  10. placeholder="请输入药品名称"
  11. @select="handleSelect"
  12. style="width:300px;"
  13. >
  14. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  15. <template slot-scope="{ item }">
  16. <div class="name">{{ item.drug_name + item.dose + item.dose_unit + "*" +item.min_number + item.min_unit +"/" + item.max_unit + " "+item.manufacturer}}</div>
  17. </template>
  18. </el-autocomplete>
  19. </div>
  20. <div v-show="showTable">
  21. <div>日期:{{nowTime}} 盘点人:{{user_name}}</div>
  22. <div style="float:right;margin-bottom:10px"><el-button type="primary" @click="saveInentoryList">保存</el-button></div>
  23. <el-collapse v-model="activeNames">
  24. <el-collapse-item :name="index" v-for="(item,index) in tableData" :key="index">
  25. <template slot="title">
  26. <div style="font-size:16px">{{item.drug_name}}</div> &nbsp;&nbsp;{{item.specification_name}} <el-button type="warning" icon="el-icon-remove" style="margin-left:20px;" @click="toMove(item,index)">移除</el-button>
  27. </template>
  28. <el-table :data="item.child" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }" style="width:100%">
  29. <el-table-column prop="date" label="药品名称" width="150" align="center">
  30. <template slot-scope="scope">
  31. {{scope.row.drug_name}}
  32. </template>
  33. </el-table-column>
  34. <el-table-column prop="name" label="规格" width="100" align="center">
  35. <template slot-scope="scope">
  36. {{scope.row.specification_name}}
  37. </template>
  38. </el-table-column>
  39. <el-table-column prop="name" label="入库单号" width="100" align="center">
  40. <template slot-scope="scope">
  41. {{scope.row.warehousing_order}}
  42. </template>
  43. </el-table-column>
  44. <el-table-column prop="name" label="有效期" width="100" align="center">
  45. <template slot-scope="scope">
  46. {{getTime(scope.row.expiry_date)}}
  47. </template>
  48. </el-table-column>
  49. <el-table-column prop="name" label="批号" width="100" align="center">
  50. <template slot-scope="scope">
  51. {{scope.row.batch_number}}
  52. </template>
  53. </el-table-column>
  54. <el-table-column prop="name" label="进货价" width="100" align="center">
  55. <template slot-scope="scope">
  56. {{scope.row.price}}
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="name" label="生产厂商" width="100" align="center">
  60. <template slot-scope="scope">
  61. {{scope.row.manufacturer_name}}
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="name" label="盘点前数量" width="180" align="center">
  65. <template slot-scope="scope">
  66. <span><el-input style="width:50px" v-model="scope.row.stock_max_number" :disabled="true"></el-input>{{scope.row.max_unit}}</span>
  67. <span><el-input style="width:50px" v-model="scope.row.stock_min_number" :disabled="true"></el-input>{{scope.row.min_unit}}</span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="name" label="盘点后数量" width="180" align="center">
  71. <template slot-scope="scope">
  72. <el-input style="width:50px" v-model="scope.row.last_stock_max_number"></el-input>{{scope.row.max_unit}}
  73. <el-input style="width:50px" v-model="scope.row.last_stock_min_number"></el-input>{{scope.row.min_unit}}
  74. </template>
  75. </el-table-column>
  76. <el-table-column prop="name" label="盘点原因" width="180" align="center">
  77. <template slot-scope="scope">
  78. <el-select v-model="scope.row.type" placeholder="请选择">
  79. <el-option
  80. v-for="item in reasonList"
  81. :key="item.id"
  82. :label="item.name"
  83. :value="item.id">
  84. </el-option>
  85. </el-select>
  86. </template>
  87. </el-table-column>
  88. <el-table-column prop="name" width="200" align="center">
  89. <template slot-scope="scope">
  90. <span><el-button type="danger" @click="toDelete(scope.$index,scope.row.drug_id)">不盘点此批次</el-button></span>
  91. </template>
  92. </el-table-column>
  93. </el-table>
  94. </el-collapse-item>
  95. <el-autocomplete
  96. class="checkSearch"
  97. popper-class="my-autocomplete"
  98. v-model="form.drug_name"
  99. :fetch-suggestions="querySearchAsync"
  100. :trigger-on-focus="true"
  101. placeholder="请输入药品名称"
  102. @select="handleSelect"
  103. style="width:300px;"
  104. v-show="showTableOne"
  105. >
  106. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  107. <template slot-scope="{ item }">
  108. <div class="name">{{ item.drug_name + item.dose + item.dose_unit + "*" +item.min_number + item.min_unit +"/" + item.max_unit + " "+item.manufacturer}}</div>
  109. </template>
  110. </el-autocomplete>
  111. </el-collapse>
  112. </div>
  113. </div>
  114. </template>
  115. <script>
  116. import { uParseTime } from '@/utils/tools'
  117. import { postSearchDrugWarehouseList,getDrugWarehouseInfoList,saveDrugInventory,getDrugInventoryList,SaveDrugCheckedInventory,getDrugInventoryDetail,modifyInventory,SaveDrugProofInventory,getDrugWarehouseInfoTotal,deleteDrugInventory,saveInentoryList} from "@/api/drug/drug"
  118. import { getDrugBatchNumber } from "@/api/drug/drug_stock"
  119. import { getDataConfig } from '@/utils/data'
  120. const moment = require("moment");
  121. export default {
  122. name: "drugInventory",
  123. data() {
  124. return{
  125. nowTime: moment(new Date()).format("YYYY-MM-DD HH:MM:SS"),
  126. user_name:this.$store.getters.xt_user.user.user_name,
  127. searchKey:'',
  128. value1:'',
  129. value2:'',
  130. tableData: [],
  131. dialogVisible:false,
  132. form: {
  133. id:"",
  134. drug_name: '',
  135. retail_price :'',
  136. new_price:"",
  137. count:"",
  138. remark:"",
  139. warehousing_order:"",
  140. manufacturer:"",
  141. dealer:"",
  142. number:"",
  143. warehousing_unit:"",
  144. specification_name:"",
  145. buy_price:"",
  146. drug_id:"",
  147. packing_unit:"",
  148. drug_origin_place:"",
  149. report_count:"",
  150. total:"",
  151. dose:"",
  152. dose_unit:"",
  153. min_number:"",
  154. min_unit:"",
  155. max_unit:"",
  156. last_price:"",
  157. batch_number:"",
  158. product_date:"",
  159. expiry_date:"",
  160. warehouse_info_id:"",
  161. proof_count:"",
  162. min_count:"",
  163. min_unit:"",
  164. },
  165. total: 0,
  166. editdialogVisible:false,
  167. limit:10,
  168. page:1,
  169. start_time:"",
  170. end_time:"",
  171. tableList:[],
  172. doctorList:[],
  173. checkDialogVisible:false,
  174. ids:"",
  175. checker:this.$store.getters.xt_user.user.id,
  176. check_time:new Date(),
  177. id:"",
  178. modifydialogVisible:false,
  179. numberList:[],
  180. profdialogVisible:false,
  181. index:"",
  182. unitList:[],
  183. reasonList:[
  184. {id:6,name:"默认"},
  185. {id:1,name:"到期退货"},
  186. {id:2,name:"异常退货"},
  187. {id:3,name:"退货"},
  188. {id:4,name:"人为损坏"},
  189. {id:5,name:"不计入报损分析"},
  190. ],
  191. activeNames: [0,1,2,3,4,5,6,7,8,9,10],
  192. showTable:false,
  193. showSearch:true,
  194. inventory_total:0,
  195. WarehouseList:[],
  196. showTableOne:false,
  197. }
  198. },
  199. methods:{
  200. changeNumber(val){
  201. this.form.warehouse_info_id = val
  202. this.getDrugWarehouseInfoTotal(val)
  203. },
  204. search(){
  205. this.getlist()
  206. },
  207. print(){
  208. if(this.ids == ""){
  209. this.$message.error("请勾选打印数据")
  210. return false
  211. }
  212. this.$router.push({path:'/stock/drugs/inventoryPrint?ids='+this.ids})
  213. },
  214. handleSizeChange(val){
  215. this.limit = val
  216. this.getlist()
  217. },
  218. handleCurrentChange(val){
  219. this.page = val
  220. this.getlist()
  221. },
  222. querySearchAsync(keyword, cb) {
  223. let key = '';
  224. if (keyword != undefined) {
  225. key = keyword
  226. }
  227. console.log("keyword23323232323223",keyword)
  228. var params = {
  229. keyword:key,
  230. }
  231. postSearchDrugWarehouseList(params).then(response => {
  232. if (response.data.state == 1) {
  233. var list = response.data.data.list
  234. // console.log("列表数据",list)
  235. this.drugList = list
  236. var manufacturerList = response.data.data.manufacturerList
  237. this.manufacturerList = manufacturerList
  238. var dealer = response.data.data.dealerList
  239. this.dealerList = dealer
  240. for(let i=0;i<this.drugList.length;i++){
  241. for(let j=0;j<this.manufacturerList.length;j++){
  242. if(this.drugList[i].manufacturer == this.manufacturerList[j].id){
  243. this.drugList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  244. }
  245. }
  246. }
  247. for(let i=0;i<this.drugList.length;i++){
  248. for(let j=0;j<this.dealerList.length;j++){
  249. if(this.drugList[i].dealer == this.dealerList[j].id){
  250. this.drugList[i].dealer = this.dealerList[j].dealer_name
  251. }
  252. }
  253. }
  254. cb(this.drugList)
  255. } else {
  256. cb([])
  257. }
  258. })
  259. },
  260. handleSelect(val){
  261. var drugIds = []
  262. for(let i=0;i<this.tableData.length;i++){
  263. drugIds.push(this.tableData[i].drug_id)
  264. }
  265. var strId = drugIds.join(",")
  266. if (strId.indexOf(val.drug_id)!=-1){
  267. this.$message.error("不能添加重复药品!")
  268. return
  269. }
  270. var params = {
  271. id:val.drug_id
  272. }
  273. getDrugWarehouseInfoList(params).then(response=>{
  274. if(response.data.state == 1){
  275. var list = response.data.data.list
  276. console.log("表哥323322332232323",this.tableData)
  277. for(let i=0;i<list.length;i++){
  278. list[i].drug_name = list[i].XtBaseDrug.drug_name
  279. list[i].specification_name = list[i].XtBaseDrug.dose +list[i].XtBaseDrug.dose_unit + "*"+list[i].XtBaseDrug.min_number +list[i].XtBaseDrug.min_unit+"/"+list[i].XtBaseDrug.max_unit
  280. list[i].warehouseing_unit = list[i].max_unit
  281. list[i].max_unit = list[i].XtBaseDrug.max_unit
  282. list[i].min_unit = list[i].XtBaseDrug.min_unit
  283. list[i].last_stock_max_number = ""
  284. list[i].last_stock_min_number = ""
  285. list[i].min_number = list[i].XtBaseDrug.min_number
  286. list[i].manufacturer_name = ""
  287. list[i].type = 6
  288. for(let j=0;j<this.manufacturerList.length;j++){
  289. if(list[i].manufacturer == this.manufacturerList[j].id){
  290. list[i].manufacturer_name = this.manufacturerList[j].manufacturer_name
  291. }
  292. }
  293. this.WarehouseList.push(list[i])
  294. }
  295. let objInfo = {}
  296. this.WarehouseList.forEach((item,index)=>{
  297. let { drug_id } = item
  298. if(!objInfo[drug_id]){
  299. objInfo[drug_id] = {
  300. drug_id,
  301. child:[],
  302. drug_name:item.drug_name,
  303. specification_name:item.specification_name,
  304. warehouseing_unit:item.max_unit,
  305. price:item.price,
  306. max_unit:item.max_unit,
  307. min_unit:item.min_unit,
  308. batch_number:item.batch_number,
  309. expiry_date:item.expiry_date,
  310. type:0,
  311. }
  312. }
  313. })
  314. let newList = Object.values(objInfo);
  315. for(let i=0;i<this.WarehouseList.length;i++){
  316. for(let j=0;j<newList.length;j++){
  317. if(this.WarehouseList[i].drug_id == newList[j].drug_id){
  318. newList[j].child.push(this.WarehouseList[i])
  319. }
  320. }
  321. }
  322. console.log("newlist23233223323222323232332",newList)
  323. this.tableData = newList
  324. this.showSearch = false
  325. this.showTable = true
  326. if(this.tableData.length >=1){
  327. this.showTableOne = true
  328. }
  329. this.inventory_total = this.tableData.length
  330. }
  331. })
  332. },
  333. getTime(val) {
  334. if(val < 0){
  335. return ""
  336. }
  337. if(val == ""){
  338. return ""
  339. }else {
  340. return uParseTime(val, '{y}-{m}-{d}')
  341. }
  342. },
  343. getTotal(total,max_unit,min_unit,min_number){
  344. var str = ""
  345. var min_str = ""
  346. if(total<min_number){
  347. str = ""
  348. min_str = total + min_unit
  349. }
  350. if(total >= min_number){
  351. if(parseInt(total/min_number)!=0){
  352. str = parseInt(total/min_number)+ max_unit
  353. }
  354. if((total%min_number)!=0){
  355. min_str = total%min_number + min_unit
  356. }
  357. }
  358. return str + min_str
  359. },
  360. addInventory(){
  361. if(this.form.drug_name == ""){
  362. this.$message.error("请输入药品名称")
  363. return
  364. }
  365. if(this.form.batch_number == undefined){
  366. this.$message.error("请选择批次")
  367. return
  368. }
  369. if(this.form.count == ""){
  370. this.$message.error("请输入盘点数量")
  371. return
  372. }
  373. if(this.form.min_count == ""){
  374. this.form.min_count = 0
  375. }
  376. var obj = {
  377. drug_id:this.form.drug_id,
  378. drug_name:this.form.drug_name,
  379. warehousing_unit:this.form.warehousing_unit,
  380. count:this.form.count,
  381. min_count:this.form.min_count,
  382. min_unit:this.form.min_unit,
  383. retail_price:this.form.retail_price.toString(),
  384. manufacturer:this.form.manufacturer,
  385. drug_origin_place:this.form.drug_origin_place,
  386. remark:this.form.remark,
  387. new_price:this.form.new_price.toString(),
  388. warehousing_order:this.form.warehousing_order,
  389. dealer:this.form.dealer,
  390. last_price:this.form.last_price,
  391. start_time:this.getTime(new Date()),
  392. number:this.form.number,
  393. total:this.form.total,
  394. specification_name:this.form.specification_name,
  395. batch_number:this.form.batch_number,
  396. expiry_date:this.form.expiry_date,
  397. product_date:this.form.product_date,
  398. warehouse_info_id:this.form.warehouse_info_id,
  399. }
  400. this.tableData.push(obj)
  401. this.form.drug_name = ""
  402. this.form.warehousing_unit = ""
  403. this.form.count = ""
  404. this.form.retail_price = ""
  405. this.form.manufacturer = ""
  406. this.form.drug_origin_place = ""
  407. this.form.number = ""
  408. this.form.remark = ""
  409. this.form.new_price = ""
  410. this.form.warehousing_order = ""
  411. this.form.dealer = ""
  412. this.form.last_price = ""
  413. this.form.number = ""
  414. this.form.total = ""
  415. this.form.specification_name = ""
  416. this.form.batch_number = ""
  417. this.form.expiry_date = ""
  418. this.form.product_date = ""
  419. },
  420. toEdit(val,index){
  421. this.form.id= val.id
  422. this.form.drug_id = val.drug_id,
  423. this.form.drug_name = val.drug_name
  424. this.form.retail_price = val.retail_price
  425. this.form.warehousing_order = val.warehousing_order
  426. this.form.number = val.number
  427. this.form.dealer = val.dealer
  428. this.form.manufacturer = val.manufacturer
  429. this.form.remark = val.remark
  430. this.form.warehousing_unit = val.warehousing_unit
  431. this.form.total = val.total
  432. this.form.batch_number = val.batch_number
  433. this.form.last_price = val.last_price
  434. this.form.specification_name = val.specification_name
  435. this.form.expiry_date = val.expiry_date
  436. this.form.product_date =val.product_date
  437. this.form.count = val.count
  438. this.form.min_count = val.min_count
  439. this.form.min_unit = val.min_unit
  440. this.index = index
  441. this.editdialogVisible = true
  442. },
  443. saveInventory(){
  444. for(let i=0;i<this.tableData.length;i++){
  445. if(this.form.id == this.tableData[i].id){
  446. this.tableData[i].drug_id = this.form.drug_id
  447. this.tableData[i].drug_name = this.form.drug_name
  448. this.tableData[i].retail_price = this.form.retail_price
  449. this.tableData[i].warehousing_order = this.form.warehousing_order
  450. this.tableData[i].number = this.form.number
  451. this.tableData[i].dealer = this.form.dealer
  452. this.tableData[i].manufacturer = this.form.manufacturer
  453. this.tableData[i].remark = this.form.remark
  454. this.tableData[i].warehouseing_unit = this.form.warehousing_unit
  455. this.tableData[i].total = this.form.total
  456. this.tableData[i].batch_number = this.form.batch_number
  457. this.tableData[i].last_price = this.form.last_price
  458. this.tableData[i].specification_name = this.form.specification_name
  459. this.tableData[i].expiry_date = this.form.expiry_date
  460. this.tableData[i].product_date = this.form.product_date
  461. this.tableData[i].count =this.form.count
  462. this.tableData[i].min_unit = this.form.min_unit
  463. this.tableData[i].min_count = this.form.min_count
  464. }
  465. if(this.index == i){
  466. this.tableData[i].drug_id = this.form.drug_id
  467. this.tableData[i].drug_name = this.form.drug_name
  468. this.tableData[i].retail_price = this.form.retail_price
  469. this.tableData[i].warehousing_order = this.form.warehousing_order
  470. this.tableData[i].number = this.form.number
  471. this.tableData[i].dealer = this.form.dealer
  472. this.tableData[i].manufacturer = this.form.manufacturer
  473. this.tableData[i].remark = this.form.remark
  474. this.tableData[i].warehouseing_unit = this.form.warehousing_unit
  475. this.tableData[i].total = this.form.total
  476. this.tableData[i].batch_number = this.form.batch_number
  477. this.tableData[i].last_price = this.form.last_price
  478. this.tableData[i].specification_name = this.form.specification_name
  479. this.tableData[i].expiry_date = this.form.expiry_date
  480. this.tableData[i].product_date = this.form.product_date
  481. this.tableData[i].count =this.form.count
  482. this.tableData[i].min_unit = this.form.min_unit
  483. this.tableData[i].min_count = this.form.min_count
  484. }
  485. }
  486. this.editdialogVisible = false
  487. },
  488. saveDrugInventory(){
  489. for(let i=0;i<this.tableData.length;i++){
  490. this.tableData[i].retail_price = this.tableData[i].retail_price.toString()
  491. this.tableData[i].last_price = this.tableData[i].last_price.toString()
  492. this.tableData[i].count = parseInt(this.tableData[i].count)
  493. this.tableData[i].min_count = parseInt(this.tableData[i].min_count)
  494. if(this.tableData[i].expiry_date == undefined){
  495. this.tableData[i].expiry_date = 0
  496. }else{
  497. this.tableData[i].expiry_date = this.tableData[i].expiry_date
  498. }
  499. if( this.tableData[i].product_date == undefined){
  500. this.tableData[i].product_date = 0
  501. }else{
  502. this.tableData[i].product_date = this.tableData[i].product_date
  503. }
  504. if(this.tableData[i].dealer == 0){
  505. this.tableData[i].dealer = ""
  506. }
  507. if(this.tableData[i].manufacturer == 0){
  508. this.tableData[i].manufacturer = ""
  509. }
  510. if(this.tableData[i].batch_number == undefined){
  511. this.tableData[i].batch_number = ""
  512. }
  513. }
  514. var params = {
  515. tableData:this.tableData
  516. }
  517. saveDrugInventory(params).then(response=>{
  518. if(response.data.state == 1){
  519. var msg = response.data.data.msg
  520. this.$message.success("保存成功")
  521. this.getlist()
  522. this.editdialogVisible = false
  523. this.dialogVisible = false
  524. }
  525. })
  526. },
  527. getlist(){
  528. var params = {
  529. limit:this.limit,
  530. page:this.page,
  531. keyword:this.searchKey,
  532. start_time:this.start_time,
  533. end_time:this.end_time,
  534. }
  535. getDrugInventoryList(params).then(response=>{
  536. if(response.data.state == 1){
  537. this.total = response.data.data.total
  538. this.tableList = response.data.data.list
  539. this.doctorList = response.data.data.doctorList
  540. }
  541. })
  542. },
  543. getDoctorName(id){
  544. var name = ""
  545. for(let i=0;i<this.doctorList.length;i++){
  546. if(id == this.doctorList[i].admin_user_id){
  547. name = this.doctorList[i].user_name
  548. }
  549. }
  550. return name
  551. },
  552. changePrice(val){
  553. var arr = []
  554. for(let i=0;i<val.length;i++){
  555. arr.push(val[i].id)
  556. }
  557. var str = arr.join(",")
  558. console.log("str",str)
  559. this.ids = str
  560. },
  561. toCheck(){
  562. if(this.ids.length <=0){
  563. this.$message.error("请勾选核对数据")
  564. return
  565. }else{
  566. this.checkDialogVisible = true
  567. }
  568. },
  569. SaveDrugCheckedInventory(){
  570. var params = {
  571. ids:this.ids,
  572. check_time:this.getTime(this.check_time),
  573. checker:this.checker,
  574. }
  575. console.log("params",params)
  576. SaveDrugCheckedInventory(params).then(response=>{
  577. if(response.data.state == 1){
  578. this.$message.success("保存成功")
  579. var msg = response.data.data.msg
  580. this.checkDialogVisible = false
  581. this.tableData = []
  582. this.getlist()
  583. }
  584. })
  585. },
  586. editInventory(id,check_status){
  587. if(check_status == 1){
  588. this.$message.error("已核对不能编辑")
  589. return false
  590. }
  591. getDrugInventoryDetail(id).then(response=>{
  592. if(response.data.state == 1){
  593. var detail = response.data.data.detail
  594. console.log("detial2323223",detail)
  595. this.id = detail.id
  596. this.form.drug_id = detail.drug_id
  597. this.form.drug_name = detail.drug_name
  598. this.form.specification_name = detail.specification_name
  599. this.form.retail_price = detail.retail_price
  600. this.form.warehousing_order =detail.warehousing_order
  601. this.form.number = detail.number
  602. this.form.manufacturer = detail.manufacturer
  603. this.form.remark = detail.remark
  604. this.form.warehousing_unit = detail.warehousing_unit
  605. this.form.total = detail.total
  606. this.form.last_price = detail.last_price
  607. this.form.count = parseInt(detail.count)
  608. this.form.drug_origin_place = detail.drug_origin_place
  609. this.form.stock_max_number = detail.stock_max_number
  610. this.form.stock_min_number = detail.stock_min_number
  611. this.form.warehouse_info_id = detail.warehouse_info_id
  612. this.form.min_unit = detail.min_unit
  613. this.form.min_count = detail.min_count
  614. this.modifydialogVisible = true
  615. }
  616. })
  617. },
  618. modifyInventory(){
  619. var params = {
  620. id:this.id,
  621. drug_id:this.form.drug_id,
  622. drug_name:this.form.drug_name,
  623. specification_name:this.form.specification_name,
  624. warehousing_unit:this.form.warehousing_unit,
  625. last_price:this.form.last_price,
  626. retail_price:this.form.retail_price,
  627. count:parseInt(this.form.count),
  628. total:this.form.total,
  629. drug_origin_place:this.form.drug_origin_place,
  630. batch_number:this.form.batch_number,
  631. manufacturer:this.form.manufacturer,
  632. remark:this.form.remark,
  633. stock_max_number:this.form.stock_max_number,
  634. stock_min_number:this.form.stock_min_number,
  635. warehouse_info_id:this.form.warehouse_info_id,
  636. min_count:parseInt(this.form.min_count),
  637. min_unit:this.form.min_unit,
  638. }
  639. console.log("params2222",params)
  640. modifyInventory(params).then(response=>{
  641. if(response.data.state == 1){
  642. var inventory = response.data.data.inventory
  643. this.modifydialogVisible = false
  644. this.getlist()
  645. }
  646. })
  647. },
  648. deleteDrugInventory(id,check_status,index){
  649. if(check_status == 1){
  650. this.$message.error("已核对的不能编辑")
  651. return
  652. }
  653. this.$confirm('是否删除所选内容?', '提示', {
  654. confirmButtonText: '确定',
  655. cancelButtonText: '取消',
  656. type: 'warning'
  657. }).then(() => {
  658. deleteDrugInventory(id).then(response => {
  659. if (response.data.state == 1) {
  660. var msg = response.data.data.msg
  661. this.$message.success("保存成功")
  662. this.tableList.splice(index,1)
  663. }
  664. })
  665. }).catch(() => {
  666. this.loading = false
  667. });
  668. },
  669. toMove(item,index){
  670. console.log("index",item)
  671. this.$confirm('此操作将移除药品整个批次, 是否继续?', '提示', {
  672. confirmButtonText: '确定',
  673. cancelButtonText: '取消',
  674. type: 'warning'
  675. }).then(() => {
  676. this.tableData.splice(index,1)
  677. this.WarehouseList = []
  678. this.activeNames = [0,1,2,3,4,5,6,7,8,9,10]
  679. console.log("hhhh233232",this.tableData)
  680. }).catch(() => {
  681. this.loading = false
  682. });
  683. },
  684. toDelete(index,drug_id){
  685. console.log("oo2o323323223",this.tableData)
  686. for(let i=0;i<this.tableData.length;i++){
  687. if(drug_id == this.tableData[i].drug_id){
  688. this.tableData[i].child.splice(index,1)
  689. if(this.tableData[i].child.length == 0){
  690. this.tableData.splice(index,1)
  691. }
  692. }
  693. }
  694. this.WarehouseList = []
  695. this.activeNames = [0,1,2,3,4,5,6,7,8,9,10]
  696. },
  697. exportList(){
  698. import('@/vendor/Export2Excel').then(excel => {
  699. const tHeader = ['药品名称', '规格', '单位','零售价','当前库存','盘点数','亏损金额']
  700. const filterVal = ['drug_name', 'spe', 'count','retail_price','total','count','']
  701. const data = this.formatJson(filterVal, this.tableList)
  702. excel.export_json_to_excel({
  703. header: tHeader,
  704. data,
  705. filename: '耗材盘点'
  706. })
  707. this.downloadLoading = false
  708. })
  709. },
  710. formatJson(filterVal, jsonData) {
  711. return jsonData.map(v => filterVal.map(j => v[j]));
  712. },
  713. getDrugBatchNumber(id){
  714. var params = {
  715. id:id
  716. }
  717. getDrugBatchNumber(params).then(response=>{
  718. if(response.data.state == 1){
  719. var list = response.data.data.list
  720. console.log("list2222",list)
  721. this.numberList = list
  722. }
  723. })
  724. },
  725. toProof(id){
  726. getDrugInventoryDetail(id).then(response=>{
  727. if(response.data.state == 1){
  728. var detail = response.data.data.detail
  729. console.log("detail22222222",detail)
  730. this.id = detail.id
  731. this.form.drug_id = detail.drug_id
  732. this.form.drug_name = detail.drug_name
  733. this.form.specification_name = detail.specification_name
  734. this.form.retail_price = detail.retail_price
  735. this.form.warehousing_order =detail.warehousing_order
  736. this.form.number = detail.number
  737. this.form.manufacturer = detail.manufacturer
  738. this.form.remark = detail.remark
  739. this.form.warehousing_unit = detail.warehousing_unit
  740. this.form.total = detail.total
  741. this.form.last_price = detail.last_price
  742. this.form.count = parseInt(detail.count)
  743. this.form.drug_origin_place = detail.drug_origin_place
  744. this.form.warehouse_info_id = detail.warehouse_info_id
  745. this.profdialogVisible = true
  746. }
  747. })
  748. },
  749. proofInventory(){
  750. var params = {
  751. id:this.id,
  752. warehouseing_unit:this.form.warehousing_unit,
  753. warehouse_info_id:this.form.warehouse_info_id,
  754. total:this.total.toString(),
  755. remark:this.remark,
  756. proof_count:parseInt(this.form.proof_count),
  757. }
  758. console.log("params",params)
  759. SaveDrugProofInventory(params).then(response=>{
  760. if(response.data.state == 1){
  761. var inventory = response.data.data.inventory
  762. console.log("inventory",inventory)
  763. this.profdialogVisible = false
  764. this.getlist()
  765. }
  766. })
  767. },
  768. changeStartTime(val){
  769. this.start_time = this.getTime(val)
  770. this.getlist()
  771. },
  772. changeEndTime(val){
  773. this.end_time = this.getTime(val)
  774. this.getlist()
  775. },
  776. getDrugWarehouseInfoTotal(val){
  777. var params = {
  778. id:val,
  779. }
  780. getDrugWarehouseInfoTotal(params).then(response=>{
  781. if(response.data.state == 1){
  782. var list = response.data.data.list
  783. console.log("list",list)
  784. var max_total = 0
  785. var min_total = 0
  786. for(let i=0;i<list.length;i++){
  787. max_total += list[i].stock_max_number
  788. min_total +=list[i].stock_min_number
  789. }
  790. if(max_total >0 ){
  791. this.form.total = max_total + list[0].XtBaseDrug.max_unit
  792. }
  793. if(min_total > 0){
  794. this.form.total = this.form.total + min_total + list[0].XtBaseDrug.min_unit
  795. }
  796. }
  797. })
  798. },
  799. getDataConfig(module, filed_name) {
  800. return getDataConfig(module, filed_name)
  801. },
  802. changeMaxUnit(val){
  803. this.form.warehousing_unit = val
  804. },
  805. saveInentoryList(){
  806. var arr = []
  807. for(let i=0;i<this.tableData.length;i++){
  808. for(let j=0;j<this.tableData[i].child.length;j++){
  809. arr.push(this.tableData[i].child[j])
  810. }
  811. }
  812. for(let i=0;i<arr.length;i++){
  813. if(arr[i].last_stock_max_number == ""){
  814. arr[i].last_stock_max_number = 0
  815. }
  816. if(arr[i].last_stock_min_number == ""){
  817. arr[i].last_stock_min_number = 0
  818. }
  819. arr[i].last_stock_max_number = parseInt(arr[i].last_stock_max_number)
  820. arr[i].last_stock_min_number = parseInt(arr[i].last_stock_min_number)
  821. }
  822. var params = {
  823. tableData:arr
  824. }
  825. saveInentoryList(params).then(response=>{
  826. if(response.data.state == 1){
  827. var inventory = response.data.data.inventory
  828. this.$message.success("保存成功")
  829. this.tableData = []
  830. }
  831. })
  832. }
  833. },
  834. created(){
  835. this.unitList = this.getDataConfig('hemodialysis','units')
  836. console.log("单位",this.unitList)
  837. this.getlist()
  838. },
  839. mounted() {
  840. },
  841. };
  842. </script>
  843. <style lang="scss">
  844. .addDrugsDialog {
  845. .el-dialog__body {
  846. padding-top: 0px;
  847. }
  848. .noMargin{
  849. .el-form-item__content{
  850. margin-left: 0 !important;
  851. }
  852. }
  853. }
  854. </style>