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

inventory.vue 35KB

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