drugStockInOrder.vue 37KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. <el-button
  6. size="small"
  7. @click="handleWarehouse"
  8. class="filter-item"
  9. style="float: right"
  10. type="primary"
  11. icon="el-icon-circle-plus-outline"
  12. >新增</el-button
  13. >
  14. </div>
  15. <div class="app-container">
  16. <div class="cell clearfix">
  17. <label class="title"><span class="name">仓库</span> :</label>
  18. <el-select
  19. size="small"
  20. v-model="storehouse_id"
  21. filterable
  22. placeholder="请选择仓库"
  23. style="width: 200px"
  24. @change="changeStoreHouse"
  25. >
  26. <el-option
  27. v-for="(option, index) in houseList"
  28. :key="index"
  29. :label="option.storehouse_name"
  30. :value="option.id"
  31. >
  32. </el-option>
  33. </el-select>
  34. <el-input
  35. size="small"
  36. style="width: 200px"
  37. v-model.trim="searchKey"
  38. class="filter-item"
  39. placeholder="单据编码/制单人/药品名称"
  40. />
  41. <el-button
  42. size="small"
  43. class="filter-item"
  44. type="primary"
  45. icon="el-icon-search"
  46. @click="search"
  47. >搜索</el-button
  48. >
  49. <div style="margin-left: 10px">
  50. <label class="title"><span class="name">入库时间</span> : </label>
  51. <el-date-picker
  52. size="small"
  53. v-model="start_time"
  54. prefix-icon="el-icon-date"
  55. :editable="false"
  56. style="width: 196px"
  57. type="date"
  58. placeholder="选择日期时间"
  59. align="right"
  60. format="yyyy-MM-dd"
  61. value-format="yyyy-MM-dd"
  62. @change="startTimeChange"
  63. ></el-date-picker>
  64. <span class="cellLine"> - </span>
  65. <el-date-picker
  66. size="small"
  67. v-model="end_time"
  68. prefix-icon="el-icon-date"
  69. :editable="false"
  70. style="width: 196px"
  71. type="date"
  72. placeholder="选择日期时间"
  73. align="right"
  74. format="yyyy-MM-dd"
  75. value-format="yyyy-MM-dd"
  76. @change="endTimeChange"
  77. ></el-date-picker>
  78. </div>
  79. <!-- <div style="margin-left: 10px">
  80. <span>审核状态:</span>
  81. <el-select
  82. v-model="check_id"
  83. style="width: 140px; margin-right: 10px"
  84. placeholder="请选择"
  85. @change="changeTypeName"
  86. >
  87. <el-option
  88. v-for="item in checkList"
  89. :key="item.id"
  90. :label="item.name"
  91. :value="item.id"
  92. >
  93. </el-option>
  94. </el-select>
  95. </div> -->
  96. </div>
  97. <div class="cell clearfix">
  98. <el-checkbox
  99. style="width: 70px"
  100. v-model="checked"
  101. @change="changeAllSelected"
  102. >全选</el-checkbox
  103. >
  104. <el-button size="small" icon="el-icon-delete" @click="batchDelete"
  105. >删除</el-button
  106. >
  107. <el-button size="small" type="primary" @click="drugPrint()"
  108. >打印</el-button
  109. >
  110. <el-button size="small" type="primary" @click="toExport()" :disabled="exportLoding">导出</el-button>
  111. <div>
  112. <span>&nbsp;&nbsp;</span>
  113. <label class="title"><span class="name">审核状态</span> :</label>
  114. <el-select
  115. size="small"
  116. v-model="check_type"
  117. filterable
  118. placeholder="请选择仓库"
  119. style="width: 200px"
  120. @change="changeCheckType"
  121. >
  122. <el-option
  123. v-for="(option, index) in checkList"
  124. :key="index"
  125. :label="option.name"
  126. :value="option.id"
  127. >
  128. </el-option>
  129. </el-select>
  130. </div>
  131. </div>
  132. <el-table
  133. :data="Warehouse.warehouseDate"
  134. :class="signAndWeighBoxPatients"
  135. style="width: 100%"
  136. border
  137. highlight-current-row
  138. v-loading="Warehouse.loading"
  139. ref="multipleTable"
  140. @selection-change="select"
  141. :row-style="{ color: '#303133' }"
  142. :header-cell-style="{
  143. backgroundColor: 'rgb(245, 247, 250)',
  144. color: '#606266',
  145. }"
  146. @current-change="handleCurrentChangeOne"
  147. >
  148. <el-table-column align="center" type="selection" width="55">
  149. </el-table-column>
  150. <el-table-column label="单据日期" align="center">
  151. <template slot-scope="scope">
  152. {{ scope.row.warehousing_time | parseTime("{y}-{m}-{d}") }}
  153. </template>
  154. </el-table-column>
  155. <el-table-column label="单据编号" align="center">
  156. <template slot-scope="scope">
  157. {{ scope.row.warehousing_order }}
  158. </template>
  159. </el-table-column>
  160. <el-table-column label="仓库名称" align="center">
  161. <template slot-scope="scope">
  162. {{ getHouseName(scope.row.storehouse_id) }}
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="制单人" align="center">
  166. <template slot-scope="scope">
  167. {{ getXuserName(scope.row.creater) }}
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="审核人" align="center" v-if="org_id == 3877 || org_id == 10318">
  171. <template slot-scope="scope">
  172. {{ getXuserName(scope.row.checker) }}
  173. </template>
  174. </el-table-column>
  175. <el-table-column label="入库方式" align="center">
  176. <template slot-scope="scope">
  177. <span v-if="scope.row.is_sys == 13">调拨入库</span>
  178. <span v-else>
  179. <span v-if="org_id !=10633"> 手动入库</span>
  180. <span v-if="org_id ==10633"> 验货入库</span>
  181. </span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="审核状态" align="center">
  185. <template slot-scope="scope">
  186. <span v-if="scope.row.is_check == 1">已审核</span>
  187. <span v-if="scope.row.is_check == 2">未审核</span>
  188. </template>
  189. </el-table-column>
  190. <el-table-column label="操作" align="center" width="240">
  191. <template slot-scope="scope">
  192. <el-tooltip
  193. class="item"
  194. effect="dark"
  195. content="编辑"
  196. placement="top"
  197. >
  198. <el-button
  199. size="small"
  200. type="primary"
  201. icon="el-icon-edit-outline"
  202. @click="handleEdit(scope.$index, scope.row)"
  203. >
  204. </el-button>
  205. </el-tooltip>
  206. <el-tooltip
  207. class="item"
  208. effect="dark"
  209. content="删除"
  210. placement="top"
  211. >
  212. <el-button
  213. size="small"
  214. type="danger"
  215. icon="el-icon-delete"
  216. @click="handleDelete(scope.$index, scope.row)"
  217. >
  218. </el-button>
  219. </el-tooltip>
  220. </template>
  221. </el-table-column>
  222. </el-table>
  223. <el-pagination
  224. @size-change="handleSizeChange"
  225. @current-change="handleCurrentChange"
  226. :page-sizes="[5, 10, 50, 100]"
  227. :page-size="5"
  228. background
  229. style="margin-top: 20px; text-align: right"
  230. layout="total, sizes, prev, pager, next, jumper"
  231. :total="total"
  232. >
  233. </el-pagination>
  234. <el-table
  235. v-show="showOne"
  236. :data="WarehouseInfo.warehouseInfoDate"
  237. :class="signAndWeighBoxPatients"
  238. style="width: 100%; margin-top: 10px"
  239. border
  240. highlight-current-row
  241. v-loading="Warehouse.loading"
  242. ref="multipleTableOne"
  243. @selection-change="select"
  244. :row-style="{ color: '#303133' }"
  245. :header-cell-style="{
  246. backgroundColor: 'rgb(245, 247, 250)',
  247. color: '#606266',
  248. }"
  249. >
  250. <el-table-column label="药品名称" align="center">
  251. <template slot-scope="scope">
  252. <span v-if="scope.row.is_total == 0">
  253. {{ scope.row.drug.drug_name }}
  254. </span>
  255. </template>
  256. </el-table-column>
  257. <el-table-column label="药品类型" align="center">
  258. <template slot-scope="scope">
  259. <span v-if="scope.row.is_total == 0"> {{ getDrugType(scope.row.drug.drug_type) }}</span>
  260. </template>
  261. </el-table-column>
  262. <el-table-column label="规格&单位" align="center">
  263. <template slot-scope="scope">
  264. <span v-if="scope.row.is_total ==0">{{ scope.row.drug.dose }}&nbsp;{{ scope.row.drug.dose_unit }}*{{
  265. scope.row.drug.min_number
  266. }}{{ scope.row.drug.min_unit }}/{{ scope.row.drug.max_unit }}
  267. </span>
  268. </template>
  269. </el-table-column>
  270. <el-table-column label="国家编码" align="center">
  271. <template slot-scope="scope">
  272. <span v-if="scope.row.is_total == 0">
  273. {{ scope.row.drug.medical_insurance_number }}
  274. </span>
  275. </template>
  276. </el-table-column>
  277. <el-table-column label="批号" align="center">
  278. <template slot-scope="scope">
  279. <span v-if="scope.row.is_total == 0"> {{ scope.row.batch_number }}</span>
  280. </template>
  281. </el-table-column>
  282. <el-table-column label="药品追溯码" align="center">
  283. <template slot-scope="scope">
  284. {{ scope.row.drug_code }}
  285. </template>
  286. </el-table-column>
  287. <el-table-column label="追溯码数量" align="center">
  288. <template slot-scope="scope">
  289. {{ getGoodCode(scope.row.drug_code) }}
  290. </template>
  291. </el-table-column>
  292. <el-table-column label="仓库名称" align="center">
  293. <template slot-scope="scope">
  294. <span v-if="scope.row.is_total == 0">
  295. {{ getHouseName(scope.row.storehouse_id) }}
  296. </span>
  297. </template>
  298. </el-table-column>
  299. <el-table-column label="入库数量" align="center">
  300. <template slot-scope="scope">
  301. <span v-if="scope.row.is_total == 0">
  302. {{ scope.row.warehousing_count }}{{ scope.row.max_unit }}
  303. </span>
  304. </template>
  305. </el-table-column>
  306. <!-- <el-table-column label="拆零零售价" align="center">
  307. <template slot-scope="scope">
  308. {{scope.row.retail_price}}
  309. </template>
  310. </el-table-column> -->
  311. <el-table-column label="进货价" align="center">
  312. <template slot-scope="scope">
  313. <span v-if="scope.row.is_total == 0">{{ scope.row.price }}</span>
  314. </template>
  315. </el-table-column>
  316. <el-table-column label="总价" align="center">
  317. <template slot-scope="scope">
  318. <!-- {{scope.row.total_price}} -->
  319. <span v-if="scope.row.is_total == 0">{{ (scope.row.warehousing_count * scope.row.price).toFixed(2) }}</span>
  320. <span v-if="scope.row.is_total == 1">
  321. {{(scope.row.total_count).toFixed(2)}}
  322. </span>
  323. </template>
  324. </el-table-column>
  325. <el-table-column label="生产厂家" align="center">
  326. <template slot-scope="scope">
  327. <span v-if="scope.row.is_total== 0">
  328. {{ getManufacturer(scope.row.manufacturer) }}
  329. </span>
  330. </template>
  331. </el-table-column>
  332. <el-table-column label="生产日期" align="center">
  333. <template slot-scope="scope">
  334. <span v-if="scope.row.is_total ==0">{{ getTime(scope.row.product_date) }} </span>
  335. </template>
  336. </el-table-column>
  337. <el-table-column label="有效日期" align="center">
  338. <template slot-scope="scope">
  339. <span v-if="scope.row.is_total == 0">
  340. {{ getTime(scope.row.expiry_date) }}
  341. </span>
  342. </template>
  343. </el-table-column>
  344. <el-table-column label="经销商" align="center">
  345. <template slot-scope="scope">
  346. <span v-if="scope.row.is_total == 0">
  347. {{ getDealer(scope.row.dealer) }}
  348. </span>
  349. </template>
  350. </el-table-column>
  351. <el-table-column label="批准文号" align="center">
  352. <template slot-scope="scope">
  353. <span v-if="scope.row.is_total == 0">
  354. {{ scope.row.number }}
  355. </span>
  356. </template>
  357. </el-table-column>
  358. <el-table-column label="备注" align="center">
  359. <template slot-scope="scope">
  360. <span v-if="scope.row.is_total == 0">
  361. {{ scope.row.remark }}
  362. </span>
  363. </template>
  364. </el-table-column>
  365. </el-table>
  366. </div>
  367. <el-dialog title="药品详细" :visible.sync="dialogVisible" width="60%">
  368. <span>
  369. <el-table
  370. :data="WarehouseInfo.warehouseInfoDate"
  371. :class="signAndWeighBoxPatients"
  372. style="width: 100%"
  373. border
  374. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  375. >
  376. <el-table-column min-width="35" align="center">
  377. <template slot="header" slot-scope="scope">
  378. <span>药品名称</span>
  379. </template>
  380. <template slot-scope="scope">
  381. <span v-if="scope.row.drug_id != 0">{{
  382. scope.row.drug.drug_name
  383. }}</span>
  384. </template>
  385. </el-table-column>
  386. <el-table-column min-width="35" align="center">
  387. <template slot="header" slot-scope="scope">
  388. <span>规格名称</span>
  389. </template>
  390. <template slot-scope="scope">
  391. <span v-if="scope.row.drug_id != 0">{{
  392. scope.row.drug ? scope.row.drug.drug_spec : ""
  393. }}</span>
  394. </template>
  395. </el-table-column>
  396. <el-table-column min-width="23" align="center">
  397. <template slot="header" slot-scope="scope">
  398. <span>单价</span>
  399. </template>
  400. <template slot-scope="scope">
  401. <span>{{ scope.row.price }}</span>
  402. </template>
  403. </el-table-column>
  404. <el-table-column min-width="23" align="center">
  405. <template slot="header" slot-scope="scope">
  406. <span>入库数量</span>
  407. </template>
  408. <template slot-scope="scope">
  409. <span>{{ scope.row.warehousing_count }}</span>
  410. </template>
  411. </el-table-column>
  412. <el-table-column label="总价" min-width="20" align="center">
  413. <template slot-scope="scope">
  414. {{ calculate(scope.row.price * scope.row.warehousing_count) }}
  415. </template>
  416. </el-table-column>
  417. <el-table-column align="center" min-width="25">
  418. <template slot="header" slot-scope="scope">
  419. <span>批号</span>
  420. </template>
  421. <template slot-scope="scope">
  422. <span>{{ scope.row.number }}</span>
  423. </template>
  424. </el-table-column>
  425. <el-table-column label="生产日期" min-width="40" align="center">
  426. <template v-if="scope.row.product_date != 0" slot-scope="scope">
  427. {{ scope.row.product_date | parseTime("{y}-{m}-{d}") }}
  428. </template>
  429. </el-table-column>
  430. <el-table-column label="有效日期" min-width="40" align="center">
  431. <template v-if="scope.row.expiry_date != 0" slot-scope="scope">
  432. {{ scope.row.expiry_date | parseTime("{y}-{m}-{d}") }}
  433. </template>
  434. </el-table-column>
  435. <el-table-column label="备注" min-width="20" align="center">
  436. <template slot-scope="scope">
  437. <el-popover placement="top-start" width="250" trigger="hover">
  438. <div>{{ scope.row.remark }}</div>
  439. <span slot="reference" v-if="scope.row.remark.length > 20">{{
  440. scope.row.remark.substr(0, 20) + "..."
  441. }}</span>
  442. <span slot="reference" v-else>{{ scope.row.remark }}</span>
  443. </el-popover>
  444. </template>
  445. </el-table-column>
  446. </el-table>
  447. </span>
  448. <span slot="footer" class="dialog-footer">
  449. <el-button @click="dialogVisible = false">取 消</el-button>
  450. <el-button type="primary" @click="dialogVisible = false"
  451. >确 定</el-button
  452. >
  453. </span>
  454. </el-dialog>
  455. </div>
  456. </template>
  457. <script>
  458. import { uParseTime } from "@/utils/tools";
  459. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  460. import {
  461. deleteDrugWarehouseInfo,
  462. GetAllConfig,
  463. getDrugWarehouseInfoList,
  464. getDrugWarehouseList,
  465. exportDrugList,
  466. } from "@/api/drug/drug_stock";
  467. import { getAllDrugList } from "@/api/data";
  468. import { getDictionaryDataConfig } from "@/utils/data";
  469. import BreadCrumb from "../../components/bread-crumb";
  470. export default {
  471. name: "drugStockInOrder",
  472. components: { BreadCrumb },
  473. created() {
  474. this.org_id = this.$store.getters.xt_user.org.id
  475. if (this.$route.path == "/Pharmacy/drugs/stock/in") {
  476. this.crumbs = [
  477. { path: false, name: "药品管理" },
  478. { path: "/stock/drugs/stock/query", name: "入库单·" },
  479. ];
  480. }
  481. this.drugTypeList = getDictionaryDataConfig("system", "drug_type");
  482. var nowDate = new Date();
  483. var nowYear = nowDate.getFullYear();
  484. var nowMonth = nowDate.getMonth() + 1;
  485. var nowDay = nowDate.getDate();
  486. this.end_time =
  487. nowYear +
  488. "-" +
  489. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  490. "-" +
  491. (nowDay < 10 ? "0" + nowDay : nowDay);
  492. nowDate.setMonth(nowDate.getMonth() - 1);
  493. nowYear = nowDate.getFullYear();
  494. nowMonth = nowDate.getMonth() + 1;
  495. nowDay = nowDate.getDate();
  496. this.start_time =
  497. nowYear +
  498. "-" +
  499. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  500. "-" +
  501. (nowDay < 10 ? "0" + nowDay : nowDay);
  502. this.GetWarehouse();
  503. this.fetchAllAdminUsers();
  504. },
  505. data() {
  506. return {
  507. crumbs: [
  508. { path: false, name: "库存管理" },
  509. { path: false, name: "入库单" },
  510. ],
  511. searchKey: "",
  512. type: 1,
  513. page: 1,
  514. limit: 5,
  515. checked: false,
  516. total: 0,
  517. pageTotal: 0,
  518. pageSelect: 0,
  519. adminUserOptions: [],
  520. multipleSelection: [],
  521. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  522. start_time: "",
  523. end_time: "",
  524. selectedTableData: [],
  525. Warehouse: {
  526. loading: false,
  527. warehouseDate: [],
  528. tableCurrentIndex: "",
  529. },
  530. WarehouseInfo: {
  531. loading: false,
  532. warehouseInfoDate: [],
  533. },
  534. check_id: 0,
  535. startTime: "",
  536. dialogVisible: false,
  537. showOne: false,
  538. drugTypeList: [],
  539. manufacturerList: [],
  540. order_id: "",
  541. dealerList: [],
  542. exportList: [],
  543. houseList: [],
  544. storehouse_id: 0,
  545. check_type: 0,
  546. checkList: [
  547. { id: 0, name: "全部" },
  548. { id: 1, name: "已审核" },
  549. { id: 2, name: "未审核" },
  550. ],
  551. exportLoding:false,
  552. org_id:0
  553. };
  554. },
  555. methods: {
  556. getGoodCode(val){
  557. var newArr = []
  558. var total = 0
  559. if(val!=undefined){
  560. newArr = val.split(",")
  561. total = newArr.length - 1
  562. if(total >0){
  563. return total
  564. }else{
  565. return ""
  566. }
  567. }
  568. },
  569. changeTypeName() {
  570. this.getlist();
  571. },
  572. getlist() {
  573. var params = {
  574. check_id: this.check_id,
  575. start_time: this.start_time,
  576. end_time: this.end_time,
  577. keyword: this.keywords,
  578. page: this.page,
  579. limit: this.limit,
  580. };
  581. getAllSecondOrderList(params).then((response) => {
  582. if (response.data.state == 1) {
  583. var list = response.data.data.list;
  584. this.tableList = list;
  585. var total = response.data.data.total;
  586. this.total = total;
  587. this.houseList = response.data.data.houseList;
  588. this.doctorList = response.data.data.doctorList;
  589. }
  590. });
  591. },
  592. search: function () {
  593. const Params = {
  594. page: this.page,
  595. limit: this.limit,
  596. start_time: this.start_time,
  597. end_time: this.end_time,
  598. type: this.type,
  599. keywords: this.searchKey,
  600. storehouse_id: this.storehouse_id,
  601. check_type: this.check_type,
  602. };
  603. this.Warehouse.warehouseDate = [];
  604. getDrugWarehouseList(Params).then((response) => {
  605. if (response.data.state == 0) {
  606. this.Warehouse.loading = false;
  607. this.$message.error(response.data.msg);
  608. return false;
  609. } else {
  610. this.Warehouse.loading = false;
  611. this.total = response.data.data.total;
  612. for (let i = 0; i < response.data.data.list.length; i++) {
  613. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  614. }
  615. }
  616. });
  617. },
  618. GetWarehouse: function () {
  619. const Params = {
  620. page: this.page,
  621. limit: this.limit,
  622. start_time: this.start_time,
  623. end_time: this.end_time,
  624. type: this.type,
  625. keywords: this.searchKey,
  626. storehouse_id: this.storehouse_id,
  627. check_type: this.check_type,
  628. };
  629. this.Warehouse.warehouseDate = [];
  630. getDrugWarehouseList(Params).then((response) => {
  631. if (response.data.state == 0) {
  632. this.Warehouse.loading = false;
  633. this.$message.error(response.data.msg);
  634. return false;
  635. } else {
  636. this.Warehouse.loading = false;
  637. this.total = response.data.data.total;
  638. for (let i = 0; i < response.data.data.list.length; i++) {
  639. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  640. }
  641. var obj = { id: 0, storehouse_name: "全部" };
  642. this.houseList = [];
  643. this.houseList.push(obj);
  644. for (let i = 0; i < response.data.data.houseList.length; i++) {
  645. this.houseList.push(response.data.data.houseList[i]);
  646. }
  647. }
  648. });
  649. },
  650. tableRowClassName({ row, rowIndex }) {
  651. // 把每一行的索引放进row
  652. row.index = rowIndex;
  653. },
  654. onRowClick(row, event, column) {
  655. this.WarehouseInfo.warehouseInfoDate = [];
  656. this.Warehouse.tableCurrentIndex = row.index;
  657. const params = {
  658. id: row.id,
  659. };
  660. this.WarehouseInfo.loading = true;
  661. getDrugWarehouseInfoList(params).then((response) => {
  662. if (response.data.state == 0) {
  663. this.WarehouseInfo.loading = false;
  664. this.$message.error(response.data.msg);
  665. return false;
  666. } else {
  667. this.WarehouseInfo.loading = false;
  668. for (let i = 0; i < response.data.data.info.length; i++) {
  669. this.WarehouseInfo.warehouseInfoDate.push(
  670. response.data.data.info[i]
  671. );
  672. }
  673. }
  674. });
  675. },
  676. getXuserName(id) {
  677. if (id <= 0) {
  678. return "";
  679. }
  680. var name = "";
  681. if (
  682. this.adminUserOptions == null ||
  683. typeof this.adminUserOptions.length === "undefined"
  684. ) {
  685. return name;
  686. }
  687. var leng = this.adminUserOptions.length;
  688. if (leng == 0) {
  689. return name;
  690. }
  691. for (let index = 0; index < leng; index++) {
  692. if (this.adminUserOptions[index].id == id) {
  693. name = this.adminUserOptions[index].name;
  694. break;
  695. }
  696. }
  697. return name;
  698. },
  699. fetchAllDoctorAndNurse() {
  700. fetchAllDoctorAndNurse().then((response) => {
  701. if (response.data.state == 1) {
  702. this.doctorOptions = response.data.data.doctors;
  703. }
  704. });
  705. },
  706. fetchAllAdminUsers() {
  707. fetchAllAdminUsers().then((response) => {
  708. if (response.data.state == 1) {
  709. this.adminUserOptions = response.data.data.users;
  710. var alen = this.adminUserOptions.length;
  711. for (let index = 0; index < alen; index++) {
  712. if (this.adminUserOptions[index].user_type == 2) {
  713. // this.doctorOptions.push(this.adminUserOptions[index]);
  714. }
  715. }
  716. }
  717. });
  718. },
  719. clicks: function () {},
  720. handleWarehouse: function () {
  721. if (this.$route.path == "/Pharmacy/drugs/stock/in") {
  722. this.$router.push({
  723. path: "/Pharmacy/in/add",
  724. query: { type: this.type },
  725. });
  726. } else {
  727. this.$router.push({
  728. path: "/drugstock/in/add",
  729. query: { type: this.type },
  730. });
  731. }
  732. },
  733. handleSelectionChange: function (val) {
  734. this.multipleSelection = val;
  735. },
  736. handleSizeChange(val) {
  737. this.limit = val;
  738. this.GetWarehouse();
  739. },
  740. handleCurrentChange(val) {
  741. this.page = val;
  742. this.GetWarehouse();
  743. },
  744. startTimeChange(val) {
  745. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  746. if (time > 0) {
  747. this.$message.error("结束时间不能小于开始时间");
  748. this.start_time = "";
  749. } else {
  750. this.startTime = this.getTimestamp(val);
  751. this.start_time = val;
  752. this.GetWarehouse();
  753. }
  754. },
  755. endTimeChange(val) {
  756. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  757. if (time < 0) {
  758. this.$message.error("结束时间不能小于开始时间");
  759. this.end_time = "";
  760. } else {
  761. this.end_time = val;
  762. this.GetWarehouse();
  763. }
  764. },
  765. getTimestamp(time) {
  766. // 把时间日期转成时间戳
  767. return new Date(time).getTime() / 1000;
  768. },
  769. calculate: function (val) {
  770. return Math.round(parseFloat(val) * 100) / 100;
  771. },
  772. // handleEdit: function(index, row) {
  773. // this.$router.push({
  774. // name: "drugStockInDetail",
  775. // query: { id: row.id, type: this.type }
  776. // });
  777. // },
  778. handleEdit: function (index, row) {
  779. this.$router.push({
  780. name: "drugStockInOrderEdit",
  781. query: {
  782. id: row.id,
  783. type: this.type,
  784. supply_warehouse_id: row.supply_warehouse_id,
  785. is_sys: row.is_sys,
  786. is_check: row.is_check,
  787. },
  788. });
  789. },
  790. handleSearch(id) {
  791. this.WarehouseInfo.warehouseInfoDate = [];
  792. this.GetOrderDetail(id);
  793. this.dialogVisible = true;
  794. },
  795. GetOrderDetail(order_id) {
  796. const params = {
  797. id: order_id,
  798. };
  799. this.WarehouseInfo.warehouseInfoDate = [];
  800. getDrugWarehouseInfoList(params).then((response) => {
  801. if (response.data.state == 0) {
  802. this.$message.error(response.data.msg);
  803. return false;
  804. } else {
  805. var obj = {total_count:0,is_total:1}
  806. for (let i = 0; i < response.data.data.info.length; i++) {
  807. response.data.data.info[i].is_total = 0
  808. this.showOne = true;
  809. this.WarehouseInfo.warehouseInfoDate.push(
  810. response.data.data.info[i]
  811. );
  812. obj.total_count += (response.data.data.info[i].warehousing_count *response.data.data.info[i].price)
  813. }
  814. this.WarehouseInfo.warehouseInfoDate.push(obj)
  815. this.WarehouseInfo.warehouse = response.data.data.warehousing;
  816. this.getAllDrugList();
  817. }
  818. });
  819. },
  820. handleDelete: function (index, row) {
  821. if (row.is_sys == 13) {
  822. this.$message.error("调拨入库数据不能删除!");
  823. return false;
  824. }
  825. if (row.supply_warehouse_id > 0) {
  826. this.$message.error("自动入库数据不能删除!");
  827. return false;
  828. }
  829. if (row.is_check == 1) {
  830. this.$message.error("已审核的单据不能删除");
  831. return false;
  832. }
  833. const ids = [];
  834. ids.push(row.id);
  835. const idStr = ids.join(",");
  836. const params = {
  837. ids: idStr,
  838. };
  839. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  840. confirmButtonText: "确定",
  841. cancelButtonText: "取消",
  842. type: "warning",
  843. })
  844. .then(() => {
  845. deleteDrugWarehouseInfo(params).then((response) => {
  846. if (response.data.state == 0) {
  847. this.$message.error(response.data.msg);
  848. return false;
  849. } else {
  850. this.$notify({
  851. title: "成功",
  852. message: "删除成功",
  853. type: "success",
  854. duration: 2000,
  855. });
  856. for (let i = 0; i < ids.length; i++) {
  857. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  858. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  859. this.Warehouse.warehouseDate.splice(y, 1);
  860. }
  861. }
  862. }
  863. }
  864. });
  865. })
  866. .catch(() => {});
  867. },
  868. changeAllSelected: function (val) {
  869. if (val) {
  870. this.$refs.multipleTable.toggleAllSelection();
  871. } else {
  872. this.$refs.multipleTable.clearSelection();
  873. }
  874. },
  875. select(selection) {
  876. var ids = [];
  877. for (let i = 0; i < selection.length; i++) {
  878. ids.push(selection[i].id);
  879. }
  880. this.order_id = ids.join(",");
  881. this.selectedTableData = selection;
  882. this.exportDrugList();
  883. },
  884. batchDelete() {
  885. if (this.selectedTableData.length <= 0) {
  886. this.$message.error("请选择要删除的记录");
  887. return;
  888. }
  889. const ids = [];
  890. const idOne = [];
  891. for (let i = 0; i < this.selectedTableData.length; i++) {
  892. if (this.selectedTableData[i].is_check == 1) {
  893. this.$message.error("已审核单据不能删除!");
  894. return false;
  895. }
  896. if (this.selectedTableData[i].is_sys == 13) {
  897. this.$message.error("调拨入库数据不能删除!");
  898. return false;
  899. }
  900. ids.push(this.selectedTableData[i].id);
  901. if (this.selectedTableData[i].supply_warehouse_id > 0) {
  902. idOne.push(this.selectedTableData[i].supply_warehouse_id);
  903. }
  904. }
  905. for (let i = 0; i < idOne.length; i++) {
  906. if (idOne[i] > 0) {
  907. this.$message.error("自动入库数据不能删除!");
  908. return false;
  909. }
  910. }
  911. const idStr = ids.join(",");
  912. const params = {
  913. ids: idStr,
  914. };
  915. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  916. confirmButtonText: "确定",
  917. cancelButtonText: "取消",
  918. type: "warning",
  919. })
  920. .then(() => {
  921. deleteDrugWarehouseInfo(params).then((response) => {
  922. if (response.data.state == 0) {
  923. this.$message.error(response.data.msg);
  924. return false;
  925. } else {
  926. this.$notify({
  927. title: "成功",
  928. message: "删除成功",
  929. type: "success",
  930. duration: 2000,
  931. });
  932. for (let i = 0; i < ids.length; i++) {
  933. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  934. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  935. this.Warehouse.warehouseDate.splice(y, 1);
  936. }
  937. }
  938. }
  939. }
  940. });
  941. })
  942. .catch(() => {});
  943. },
  944. handleCurrentChangeOne(val) {
  945. this.GetOrderDetail(val.id);
  946. },
  947. getTime(val) {
  948. if (val < 0) {
  949. return "";
  950. }
  951. if (val == "") {
  952. return "";
  953. } else {
  954. return uParseTime(val, "{y}-{m}-{d}");
  955. }
  956. },
  957. getDrugType(id) {
  958. var name = "";
  959. for (let i = 0; i < this.drugTypeList.length; i++) {
  960. if (id == this.drugTypeList[i].id) {
  961. name = this.drugTypeList[i].name;
  962. }
  963. }
  964. return name;
  965. },
  966. getAllDrugList() {
  967. getAllDrugList().then((response) => {
  968. if (response.data.state == 1) {
  969. var manufacturerList = response.data.data.manufacturerList;
  970. this.manufacturerList = manufacturerList;
  971. this.dealerList = response.data.data.dealerList;
  972. }
  973. });
  974. },
  975. getManufacturer(id) {
  976. var name = "";
  977. for (let i = 0; i < this.manufacturerList.length; i++) {
  978. if (id == this.manufacturerList[i].id) {
  979. name = this.manufacturerList[i].manufacturer_name;
  980. }
  981. }
  982. return name;
  983. },
  984. getDealer(id) {
  985. var name = "";
  986. for (let i = 0; i < this.dealerList.length; i++) {
  987. if (id == this.dealerList[i].id) {
  988. name = this.dealerList[i].dealer_name;
  989. }
  990. }
  991. return name;
  992. },
  993. getDictionaryDataConfig(module, filed_name) {
  994. return getDictionaryDataConfig(module, filed_name);
  995. },
  996. drugPrint() {
  997. if (this.order_id == "") {
  998. this.$message.error("请选择入库单");
  999. } else {
  1000. this.$router.push({
  1001. path: "/stock/drugStockInOrderDetailPrint?id=" + this.order_id,
  1002. });
  1003. }
  1004. },
  1005. exportDrugList() {
  1006. var params = {
  1007. order_id: this.order_id,
  1008. };
  1009. this.exportLoding = true
  1010. exportDrugList(params).then((response) => {
  1011. if (response.data.state == 1) {
  1012. var list = response.data.data.list;
  1013. for (let i = 0; i < list.length; i++) {
  1014. list[i].product_date = this.getTime(list[i].product_date);
  1015. list[i].expiry_date = this.getTime(list[i].expiry_date);
  1016. }
  1017. this.exportList = list;
  1018. this.exportLoding = false
  1019. var manufacturerList = response.data.data.manufacturerList;
  1020. this.manufacturerList = manufacturerList;
  1021. var dealerList = response.data.data.dealerList;
  1022. this.dealerList = dealerList;
  1023. }
  1024. });
  1025. },
  1026. lili(){
  1027. console.log("exportList",this.exportList)
  1028. },
  1029. toExport() {
  1030. if (this.order_id == "") {
  1031. this.$message.error("请勾选入库单");
  1032. }
  1033. for (let i = 0; i < this.exportList.length; i++) {
  1034. this.exportList[i].index = i + 1;
  1035. this.exportList[i].warehousing_time = this.getTime(this.exportList[i].warehousing_time)
  1036. this.exportList[i].unit =
  1037. this.exportList[i].dose +
  1038. this.exportList[i].dose_unit +
  1039. "*" +
  1040. this.exportList[i].min_number +
  1041. this.exportList[i].min_unit +
  1042. "/" +
  1043. this.exportList[i].max_unit;
  1044. this.exportList[i].total_price = (
  1045. this.exportList[i].warehousing_count * this.exportList[i].price
  1046. ).toFixed(2);
  1047. for (let j = 0; j < this.manufacturerList.length; j++) {
  1048. if (this.exportList[i].manufacturer == this.manufacturerList[j].id) {
  1049. this.exportList[i].manufacturer =
  1050. this.manufacturerList[j].manufacturer_name;
  1051. }
  1052. if (this.exportList[i].manufacturer == 0) {
  1053. this.exportList[i].manufacturer = "";
  1054. }
  1055. }
  1056. for (let z = 0; z < this.dealerList.length; z++) {
  1057. if (this.exportList[i].dealer == this.dealerList[z].id) {
  1058. this.exportList[i].dealer = this.dealerList[z].dealer_name;
  1059. }
  1060. if (this.exportList[i].dealer == 0) {
  1061. this.exportList[i].dealer = "";
  1062. }
  1063. }
  1064. }
  1065. import("@/vendor/Export2Excel").then((excel) => {
  1066. for (let i = 0; i < this.exportList.length; i++) {
  1067. for (let j = 0; j < this.drugTypeList.length; j++) {
  1068. if (this.exportList[i].drug_type == this.drugTypeList[j].id) {
  1069. this.exportList[i].drug_type = this.drugTypeList[j].name;
  1070. }
  1071. }
  1072. }
  1073. const tHeader = [
  1074. "序号",
  1075. "单据日期",
  1076. "药品名称",
  1077. "药品类型",
  1078. "规格&单位",
  1079. "批号",
  1080. "入库数量",
  1081. "进货价",
  1082. "总价",
  1083. "生产厂家",
  1084. "生产日期",
  1085. "有效日期",
  1086. "经销商",
  1087. "批注文号",
  1088. "备注",
  1089. ];
  1090. const filterVal = [
  1091. "index",
  1092. "warehousing_time",
  1093. "drug_name",
  1094. "drug_type",
  1095. "unit",
  1096. "batch_number",
  1097. "warehousing_count",
  1098. "price",
  1099. "total_price",
  1100. "manufacturer",
  1101. "product_date",
  1102. "expiry_date",
  1103. "dealer",
  1104. "number",
  1105. "remark",
  1106. ];
  1107. const data = this.formatJson(filterVal, this.exportList);
  1108. excel.export_json_to_excel({
  1109. header: tHeader,
  1110. data,
  1111. filename: "药品入库单详情",
  1112. });
  1113. this.downloadLoading = false;
  1114. });
  1115. },
  1116. formatJson(filterVal, jsonData) {
  1117. return jsonData.map((v) => filterVal.map((j) => v[j]));
  1118. },
  1119. getHouseName(id) {
  1120. var storehouse_name = "";
  1121. for (let i = 0; i < this.houseList.length; i++) {
  1122. if (id == this.houseList[i].id) {
  1123. storehouse_name = this.houseList[i].storehouse_name;
  1124. }
  1125. }
  1126. return storehouse_name;
  1127. },
  1128. changeStoreHouse() {
  1129. this.GetWarehouse();
  1130. },
  1131. changeCheckType() {
  1132. this.GetWarehouse();
  1133. },
  1134. },
  1135. };
  1136. </script>
  1137. <style rel="stylesheet/css" lang="scss" scoped>
  1138. .information {
  1139. border: 1px #dcdfe6 solid;
  1140. padding: 30px 20px 30px 20px;
  1141. .border {
  1142. border-bottom: 1px #dcdfe6 solid;
  1143. margin: 0px 0 20px 0;
  1144. }
  1145. }
  1146. .edit_separater {
  1147. border-top: 1px solid rgb(233, 233, 233);
  1148. margin-top: 15px;
  1149. margin-bottom: 15px;
  1150. }
  1151. </style>
  1152. <style>
  1153. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1154. font-size: 12px;
  1155. }
  1156. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1157. background: #6fb5fa;
  1158. }
  1159. .count {
  1160. color: #bd2c00;
  1161. }
  1162. .el-table td,
  1163. .el-table th.is-leaf,
  1164. .el-table--border,
  1165. .el-table--group {
  1166. border-color: #d0d3da;
  1167. }
  1168. .el-table--border::after,
  1169. .el-table--group::after,
  1170. .el-table::before {
  1171. background-color: #d0d3da;
  1172. }
  1173. </style>