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

inventory.vue 47KB

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