drugStockInOrder.vue 28KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  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. <el-input
  18. size="small"
  19. style="width: 400px;"
  20. v-model.trim="searchKey"
  21. class="filter-item"
  22. placeholder="单据编码/制单人/药品名称"
  23. />
  24. <el-button
  25. size="small"
  26. class="filter-item"
  27. type="primary"
  28. icon="el-icon-search"
  29. @click="search"
  30. >搜索</el-button
  31. >
  32. </div>
  33. <div class="cell clearfix">
  34. <label class="title"><span class="name">入库时间</span> : </label>
  35. <el-date-picker
  36. size="small"
  37. v-model="start_time"
  38. prefix-icon="el-icon-date"
  39. :editable="false"
  40. style="width: 196px;"
  41. type="date"
  42. placeholder="选择日期时间"
  43. align="right"
  44. format="yyyy-MM-dd"
  45. value-format="yyyy-MM-dd"
  46. @change="startTimeChange"
  47. ></el-date-picker>
  48. <span class="cellLine"> - </span>
  49. <el-date-picker
  50. size="small"
  51. v-model="end_time"
  52. prefix-icon="el-icon-date"
  53. :editable="false"
  54. style="width: 196px;"
  55. type="date"
  56. placeholder="选择日期时间"
  57. align="right"
  58. format="yyyy-MM-dd"
  59. value-format="yyyy-MM-dd"
  60. @change="endTimeChange"
  61. ></el-date-picker>
  62. </div>
  63. <div class="cell clearfix">
  64. <el-checkbox
  65. style="width: 70px"
  66. v-model="checked"
  67. @change="changeAllSelected"
  68. >全选</el-checkbox
  69. >
  70. <el-button size="small" icon="el-icon-delete" @click="batchDelete">删除</el-button>
  71. <el-button size="small" type="primary" @click="drugPrint()">打印</el-button>
  72. <el-button size="small" type="primary" @click="toExport()">导出</el-button>
  73. </div>
  74. <el-table
  75. :data="Warehouse.warehouseDate"
  76. :class="signAndWeighBoxPatients"
  77. style="width: 100%"
  78. border
  79. highlight-current-row
  80. v-loading="Warehouse.loading"
  81. ref="multipleTable"
  82. @selection-change="select"
  83. :row-style="{ color: '#303133' }"
  84. :header-cell-style="{
  85. backgroundColor: 'rgb(245, 247, 250)',
  86. color: '#606266'
  87. }"
  88. @current-change="handleCurrentChangeOne"
  89. >
  90. <el-table-column align="center" type="selection" width="55">
  91. </el-table-column>
  92. <el-table-column label="单据日期" align="center">
  93. <template slot-scope="scope">
  94. {{ scope.row.warehousing_time | parseTime("{y}-{m}-{d}") }}
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="单据编号" align="center">
  98. <template slot-scope="scope">
  99. {{ scope.row.warehousing_order }}
  100. </template>
  101. </el-table-column>
  102. <el-table-column label="制单人" align="center">
  103. <template slot-scope="scope">
  104. {{ getXuserName(scope.row.creater) }}
  105. </template>
  106. </el-table-column>
  107. <el-table-column label="操作" align="center" width="240">
  108. <template slot-scope="scope">
  109. <el-tooltip
  110. class="item"
  111. effect="dark"
  112. content="编辑"
  113. placement="top"
  114. >
  115. <el-button
  116. size="small"
  117. type="primary"
  118. icon="el-icon-edit-outline"
  119. @click="handleEdit(scope.$index, scope.row)"
  120. >
  121. </el-button>
  122. </el-tooltip>
  123. <el-tooltip
  124. class="item"
  125. effect="dark"
  126. content="删除"
  127. placement="top"
  128. >
  129. <el-button
  130. size="small"
  131. type="danger"
  132. icon="el-icon-delete"
  133. @click="handleDelete(scope.$index, scope.row)"
  134. >
  135. </el-button>
  136. </el-tooltip>
  137. </template>
  138. </el-table-column>
  139. </el-table>
  140. <el-pagination
  141. @size-change="handleSizeChange"
  142. @current-change="handleCurrentChange"
  143. :page-sizes="[5, 10, 50, 100]"
  144. :page-size="5"
  145. background
  146. style="margin-top:20px;text-align: right"
  147. layout="total, sizes, prev, pager, next, jumper"
  148. :total="total"
  149. >
  150. </el-pagination>
  151. <el-table
  152. v-show="showOne"
  153. :data="WarehouseInfo.warehouseInfoDate"
  154. :class="signAndWeighBoxPatients"
  155. style="width: 100%;margin-top:10px;"
  156. border
  157. highlight-current-row
  158. v-loading="Warehouse.loading"
  159. ref="multipleTableOne"
  160. @selection-change="select"
  161. :row-style="{ color: '#303133' }"
  162. :header-cell-style="{
  163. backgroundColor: 'rgb(245, 247, 250)',
  164. color: '#606266'
  165. }"
  166. >
  167. <el-table-column label="药品名称" align="center">
  168. <template slot-scope="scope">
  169. {{scope.row.drug.drug_name}}
  170. </template>
  171. </el-table-column>
  172. <el-table-column label="药品类型" align="center">
  173. <template slot-scope="scope">
  174. {{getDrugType(scope.row.drug.drug_type)}}
  175. </template>
  176. </el-table-column>
  177. <el-table-column label="规格&单位" align="center">
  178. <template slot-scope="scope">
  179. {{scope.row.drug.dose}}&nbsp;{{scope.row.drug.dose_unit}}*{{scope.row.drug.min_number}}{{scope.row.drug.min_unit}}/{{scope.row.drug.max_unit}}
  180. </template>
  181. </el-table-column>
  182. <el-table-column label="批号" align="center">
  183. <template slot-scope="scope">
  184. {{scope.row.batch_number}}
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="入库数量" align="center">
  188. <template slot-scope="scope">
  189. {{scope.row.warehousing_count}}{{scope.row.drug.max_unit}}
  190. </template>
  191. </el-table-column>
  192. <el-table-column label="进货价" align="center">
  193. <template slot-scope="scope">
  194. {{scope.row.price}}
  195. </template>
  196. </el-table-column>
  197. <el-table-column label="总价" align="center">
  198. <template slot-scope="scope">
  199. {{scope.row.total_price}}
  200. </template>
  201. </el-table-column>
  202. <el-table-column label="生产厂家" align="center">
  203. <template slot-scope="scope">
  204. {{getManufacturer(scope.row.drug.manufacturer)}}
  205. </template>
  206. </el-table-column>
  207. <el-table-column label="生产日期" align="center">
  208. <template slot-scope="scope">
  209. {{getTime(scope.row.product_date)}}
  210. </template>
  211. </el-table-column>
  212. <el-table-column label="有效日期" align="center">
  213. <template slot-scope="scope">
  214. {{getTime(scope.row.expiry_date)}}
  215. </template>
  216. </el-table-column>
  217. <el-table-column label="经销商" align="center">
  218. <template slot-scope="scope">
  219. {{getDealer(scope.row.dealer)}}
  220. </template>
  221. </el-table-column>
  222. <el-table-column label="批准文号" align="center">
  223. <template slot-scope="scope">
  224. {{scope.row.number}}
  225. </template>
  226. </el-table-column>
  227. <el-table-column label="备注" align="center">
  228. <template slot-scope="scope">
  229. {{scope.row.remark}}
  230. </template>
  231. </el-table-column>
  232. </el-table>
  233. </div>
  234. <el-dialog
  235. title="药品详细"
  236. :visible.sync="dialogVisible"
  237. width="60%">
  238. <span>
  239. <el-table
  240. :data="WarehouseInfo.warehouseInfoDate"
  241. :class="signAndWeighBoxPatients"
  242. style="width: 100%"
  243. border
  244. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  245. >
  246. <el-table-column min-width="35" align="center">
  247. <template slot="header" slot-scope="scope">
  248. <span>药品名称</span>
  249. </template>
  250. <template slot-scope="scope">
  251. <span v-if="scope.row.drug_id != 0">{{
  252. scope.row.drug.drug_name
  253. }}</span>
  254. </template>
  255. </el-table-column>
  256. <el-table-column min-width="35" align="center">
  257. <template slot="header" slot-scope="scope">
  258. <span>规格名称</span>
  259. </template>
  260. <template slot-scope="scope">
  261. <span v-if="scope.row.drug_id != 0">{{
  262. scope.row.drug?scope.row.drug.drug_spec:''
  263. }}</span>
  264. </template>
  265. </el-table-column>
  266. <el-table-column min-width="23" align="center">
  267. <template slot="header" slot-scope="scope">
  268. <span>单价</span>
  269. </template>
  270. <template slot-scope="scope">
  271. <span>{{ scope.row.price }}</span>
  272. </template>
  273. </el-table-column>
  274. <el-table-column min-width="23" align="center">
  275. <template slot="header" slot-scope="scope">
  276. <span>入库数量</span>
  277. </template>
  278. <template slot-scope="scope">
  279. <span>{{ scope.row.warehousing_count }}</span>
  280. </template>
  281. </el-table-column>
  282. <el-table-column label="总价" min-width="20" align="center">
  283. <template slot-scope="scope">
  284. {{ calculate(scope.row.price * scope.row.warehousing_count) }}
  285. </template>
  286. </el-table-column>
  287. <el-table-column align="center" min-width="25">
  288. <template slot="header" slot-scope="scope">
  289. <span>批号</span>
  290. </template>
  291. <template slot-scope="scope">
  292. <span>{{ scope.row.number }}</span>
  293. </template>
  294. </el-table-column>
  295. <el-table-column label="生产日期" min-width="40" align="center">
  296. <template v-if="scope.row.product_date != 0" slot-scope="scope">
  297. {{ scope.row.product_date | parseTime("{y}-{m}-{d}") }}
  298. </template>
  299. </el-table-column>
  300. <el-table-column label="有效日期" min-width="40" align="center">
  301. <template v-if="scope.row.expiry_date != 0" slot-scope="scope">
  302. {{ scope.row.expiry_date | parseTime("{y}-{m}-{d}") }}
  303. </template>
  304. </el-table-column>
  305. <el-table-column label="备注" min-width="20" align="center">
  306. <template slot-scope="scope">
  307. <el-popover placement="top-start" width="250" trigger="hover">
  308. <div>{{ scope.row.remark }}</div>
  309. <span slot="reference" v-if="scope.row.remark.length > 20">{{
  310. scope.row.remark.substr(0, 20) + "..."
  311. }}</span>
  312. <span slot="reference" v-else>{{ scope.row.remark }}</span>
  313. </el-popover>
  314. </template>
  315. </el-table-column>
  316. </el-table>
  317. </span>
  318. <span slot="footer" class="dialog-footer">
  319. <el-button @click="dialogVisible = false">取 消</el-button>
  320. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  321. </span>
  322. </el-dialog>
  323. </div>
  324. </template>
  325. <script>
  326. import { uParseTime } from "@/utils/tools";
  327. import { fetchAllAdminUsers, fetchAllDoctorAndNurse } from "@/api/doctor";
  328. import {
  329. deleteDrugWarehouseInfo,
  330. GetAllConfig,
  331. getDrugWarehouseInfoList,
  332. getDrugWarehouseList,
  333. exportDrugList
  334. } from "@/api/drug/drug_stock";
  335. import {getAllDrugList}from "@/api/data"
  336. import {getDictionaryDataConfig } from "@/utils/data";
  337. import BreadCrumb from "../../components/bread-crumb";
  338. export default {
  339. name: "drugStockInOrder",
  340. components: { BreadCrumb },
  341. created() {
  342. this.drugTypeList = getDictionaryDataConfig('system','drug_type')
  343. var nowDate = new Date();
  344. var nowYear = nowDate.getFullYear();
  345. var nowMonth = nowDate.getMonth() + 1;
  346. var nowDay = nowDate.getDate();
  347. this.end_time =
  348. nowYear +
  349. "-" +
  350. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  351. "-" +
  352. (nowDay < 10 ? "0" + nowDay : nowDay);
  353. nowDate.setMonth(nowDate.getMonth() - 1);
  354. nowYear = nowDate.getFullYear();
  355. nowMonth = nowDate.getMonth() + 1;
  356. nowDay = nowDate.getDate();
  357. this.start_time =
  358. nowYear +
  359. "-" +
  360. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  361. "-" +
  362. (nowDay < 10 ? "0" + nowDay : nowDay);
  363. this.GetWarehouse();
  364. this.fetchAllAdminUsers();
  365. },
  366. data() {
  367. return {
  368. crumbs: [
  369. { path: false, name: "库存管理" },
  370. { path: false, name: "入库单" }
  371. ],
  372. searchKey: "",
  373. type: 1,
  374. page: 1,
  375. limit: 5,
  376. checked: false,
  377. total: 0,
  378. pageTotal: 0,
  379. pageSelect: 0,
  380. adminUserOptions: [],
  381. multipleSelection: [],
  382. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  383. start_time: "",
  384. end_time: "",
  385. selectedTableData: [],
  386. Warehouse: {
  387. loading: false,
  388. warehouseDate: [],
  389. tableCurrentIndex: ""
  390. },
  391. WarehouseInfo: {
  392. loading: false,
  393. warehouseInfoDate: []
  394. },
  395. startTime: "",
  396. dialogVisible:false,
  397. showOne:false,
  398. drugTypeList:[],
  399. manufacturerList:[],
  400. order_id:"",
  401. dealerList:[],
  402. exportList:[],
  403. };
  404. },
  405. methods: {
  406. search: function() {
  407. const Params = {
  408. page: this.page,
  409. limit: this.limit,
  410. start_time: this.start_time,
  411. end_time: this.end_time,
  412. type: this.type,
  413. keywords: this.searchKey
  414. };
  415. console.log("parasm2222222",Params)
  416. this.Warehouse.warehouseDate = [];
  417. getDrugWarehouseList(Params).then(response => {
  418. if (response.data.state == 0) {
  419. this.Warehouse.loading = false;
  420. this.$message.error(response.data.msg);
  421. return false;
  422. } else {
  423. this.Warehouse.loading = false;
  424. this.total = response.data.data.total;
  425. for (let i = 0; i < response.data.data.list.length; i++) {
  426. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  427. }
  428. }
  429. });
  430. },
  431. GetWarehouse: function() {
  432. const Params = {
  433. page: this.page,
  434. limit: this.limit,
  435. start_time: this.start_time,
  436. end_time: this.end_time,
  437. type: this.type,
  438. keywords:this.searchKey,
  439. };
  440. this.Warehouse.warehouseDate = [];
  441. getDrugWarehouseList(Params).then(response => {
  442. if (response.data.state == 0) {
  443. this.Warehouse.loading = false;
  444. this.$message.error(response.data.msg);
  445. return false;
  446. } else {
  447. this.Warehouse.loading = false;
  448. this.total = response.data.data.total;
  449. for (let i = 0; i < response.data.data.list.length; i++) {
  450. this.Warehouse.warehouseDate.push(response.data.data.list[i]);
  451. }
  452. console.log("列表999988888",this.warehouse.warehouseDate)
  453. }
  454. });
  455. },
  456. tableRowClassName({ row, rowIndex }) {
  457. // 把每一行的索引放进row
  458. row.index = rowIndex;
  459. },
  460. onRowClick(row, event, column) {
  461. this.WarehouseInfo.warehouseInfoDate = [];
  462. this.Warehouse.tableCurrentIndex = row.index;
  463. const params = {
  464. id: row.id
  465. };
  466. this.WarehouseInfo.loading = true;
  467. getDrugWarehouseInfoList(params).then(response => {
  468. if (response.data.state == 0) {
  469. this.WarehouseInfo.loading = false;
  470. this.$message.error(response.data.msg);
  471. return false;
  472. } else {
  473. this.WarehouseInfo.loading = false;
  474. for (let i = 0; i < response.data.data.info.length; i++) {
  475. this.WarehouseInfo.warehouseInfoDate.push(
  476. response.data.data.info[i]
  477. );
  478. }
  479. }
  480. });
  481. },
  482. getXuserName(id) {
  483. if (id <= 0) {
  484. return "";
  485. }
  486. var name = "";
  487. if (
  488. this.adminUserOptions == null ||
  489. typeof this.adminUserOptions.length === "undefined"
  490. ) {
  491. return name;
  492. }
  493. var leng = this.adminUserOptions.length;
  494. if (leng == 0) {
  495. return name;
  496. }
  497. for (let index = 0; index < leng; index++) {
  498. if (this.adminUserOptions[index].id == id) {
  499. name = this.adminUserOptions[index].name;
  500. break;
  501. }
  502. }
  503. return name;
  504. },
  505. fetchAllDoctorAndNurse() {
  506. fetchAllDoctorAndNurse().then(response => {
  507. if (response.data.state == 1) {
  508. this.doctorOptions = response.data.data.doctors;
  509. }
  510. });
  511. },
  512. fetchAllAdminUsers() {
  513. fetchAllAdminUsers().then(response => {
  514. console.log(response);
  515. if (response.data.state == 1) {
  516. this.adminUserOptions = response.data.data.users;
  517. console.log("制单人2222222",this.adminUserOptions)
  518. var alen = this.adminUserOptions.length;
  519. for (let index = 0; index < alen; index++) {
  520. if (this.adminUserOptions[index].user_type == 2) {
  521. // this.doctorOptions.push(this.adminUserOptions[index]);
  522. }
  523. }
  524. }
  525. });
  526. },
  527. clicks: function() {
  528. console.log(this.WarehouseInfo.warehouseInfoDate);
  529. },
  530. handleWarehouse: function() {
  531. this.$router.push({ path: "/drugstock/in/add", query: { type: this.type } });
  532. },
  533. handleSelectionChange: function(val) {
  534. this.multipleSelection = val;
  535. },
  536. handleSizeChange(val) {
  537. this.limit = val;
  538. this.GetWarehouse();
  539. },
  540. handleCurrentChange(val) {
  541. this.page = val;
  542. this.GetWarehouse();
  543. },
  544. startTimeChange(val) {
  545. var time = this.getTimestamp(val) - this.getTimestamp(this.end_time);
  546. if (time > 0) {
  547. this.$message.error("结束时间不能小于开始时间");
  548. this.start_time = "";
  549. } else {
  550. this.startTime = this.getTimestamp(val);
  551. this.start_time = val
  552. this.GetWarehouse();
  553. }
  554. },
  555. endTimeChange(val) {
  556. var time = this.getTimestamp(val) - this.getTimestamp(this.start_time);
  557. if (time < 0) {
  558. this.$message.error("结束时间不能小于开始时间");
  559. this.end_time = "";
  560. } else {
  561. this.end_time = val
  562. this.GetWarehouse();
  563. }
  564. },
  565. getTimestamp(time) {
  566. // 把时间日期转成时间戳
  567. return new Date(time).getTime() / 1000;
  568. },
  569. calculate: function(val) {
  570. return Math.round(parseFloat(val) * 100) / 100;
  571. },
  572. // handleEdit: function(index, row) {
  573. // this.$router.push({
  574. // name: "drugStockInDetail",
  575. // query: { id: row.id, type: this.type }
  576. // });
  577. // },
  578. handleEdit:function(index,row){
  579. this.$router.push({
  580. name:"drugStockInOrderEdit",
  581. query:{id:row.id,type:this.type}
  582. })
  583. },
  584. handleSearch(id){
  585. this.WarehouseInfo.warehouseInfoDate=[]
  586. this.GetOrderDetail(id);
  587. this.dialogVisible = true
  588. },
  589. GetOrderDetail(order_id) {
  590. const params = {
  591. id: order_id
  592. };
  593. console.log("parasm222222222",params)
  594. this.WarehouseInfo.warehouseInfoDate = []
  595. getDrugWarehouseInfoList(params).then(response => {
  596. if (response.data.state == 0) {
  597. this.$message.error(response.data.msg);
  598. return false;
  599. } else {
  600. console.log("hhhhhhhhhh",response.data.data.info)
  601. for (let i = 0; i < response.data.data.info.length; i++) {
  602. this.showOne = true
  603. this.WarehouseInfo.warehouseInfoDate.push(response.data.data.info[i]);
  604. console.log("列表详情",this.WarehouseInfo.warehouseInfoDate)
  605. }
  606. this.WarehouseInfo.warehouse = response.data.data.warehousing;
  607. this.getAllDrugList()
  608. }
  609. });
  610. },
  611. handleDelete: function(index, row) {
  612. const ids = [];
  613. ids.push(row.id);
  614. const idStr = ids.join(",");
  615. const params = {
  616. ids: idStr
  617. };
  618. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  619. confirmButtonText: "确定",
  620. cancelButtonText: "取消",
  621. type: "warning"
  622. })
  623. .then(() => {
  624. deleteDrugWarehouseInfo(params).then(response => {
  625. if (response.data.state == 0) {
  626. this.$message.error(response.data.msg);
  627. return false;
  628. } else {
  629. this.$notify({
  630. title: "成功",
  631. message: "删除成功",
  632. type: "success",
  633. duration: 2000
  634. });
  635. for (let i = 0; i < ids.length; i++) {
  636. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  637. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  638. this.Warehouse.warehouseDate.splice(y, 1);
  639. }
  640. }
  641. }
  642. }
  643. });
  644. })
  645. .catch(() => {});
  646. },
  647. changeAllSelected: function(val) {
  648. if (val) {
  649. this.$refs.multipleTable.toggleAllSelection();
  650. } else {
  651. this.$refs.multipleTable.clearSelection();
  652. }
  653. },
  654. select(selection) {
  655. var ids=[]
  656. for(let i=0;i<selection.length;i++){
  657. ids.push(selection[i].id)
  658. }
  659. this.order_id = ids.join(",")
  660. this.selectedTableData = selection;
  661. this.exportDrugList()
  662. },
  663. batchDelete() {
  664. if (this.selectedTableData.length <= 0) {
  665. this.$message.error("请选择要删除的记录");
  666. return;
  667. }
  668. const ids = [];
  669. for (let i = 0; i < this.selectedTableData.length; i++) {
  670. ids.push(this.selectedTableData[i].id);
  671. }
  672. const idStr = ids.join(",");
  673. const params = {
  674. ids: idStr
  675. };
  676. this.$confirm("确认删除入库单记录?", "删除入库单记录", {
  677. confirmButtonText: "确定",
  678. cancelButtonText: "取消",
  679. type: "warning"
  680. })
  681. .then(() => {
  682. deleteDrugWarehouseInfo(params).then(response => {
  683. if (response.data.state == 0) {
  684. this.$message.error(response.data.msg);
  685. return false;
  686. } else {
  687. this.$notify({
  688. title: "成功",
  689. message: "删除成功",
  690. type: "success",
  691. duration: 2000
  692. });
  693. for (let i = 0; i < ids.length; i++) {
  694. for (let y = 0; y < this.Warehouse.warehouseDate.length; y++) {
  695. if (ids[i] == this.Warehouse.warehouseDate[y].id) {
  696. this.Warehouse.warehouseDate.splice(y, 1);
  697. }
  698. }
  699. }
  700. }
  701. });
  702. })
  703. .catch(() => {});
  704. },
  705. handleCurrentChangeOne(val){
  706. this.GetOrderDetail(val.id)
  707. },
  708. getTime(val) {
  709. if(val < 0){
  710. return ""
  711. }
  712. if(val == ""){
  713. return ""
  714. }else {
  715. return uParseTime(val, '{y}-{m}-{d}')
  716. }
  717. },
  718. getDrugType(id){
  719. var name = ""
  720. for(let i=0;i<this.drugTypeList.length;i++){
  721. if(id == this.drugTypeList[i].id){
  722. name = this.drugTypeList[i].name
  723. }
  724. }
  725. return name
  726. },
  727. getAllDrugList(){
  728. getAllDrugList().then(response=>{
  729. if(response.data.state == 1){
  730. var manufacturerList = response.data.data.manufacturerList
  731. this.manufacturerList = manufacturerList
  732. this.dealerList = response.data.data.dealerList
  733. }
  734. })
  735. },
  736. getManufacturer(id){
  737. var name = ""
  738. for(let i=0;i<this.manufacturerList.length;i++){
  739. if(id == this.manufacturerList[i].id){
  740. name = this.manufacturerList[i].manufacturer_name
  741. }
  742. }
  743. return name
  744. },
  745. getDealer(id){
  746. var name = ""
  747. for(let i=0;i<this.dealerList.length;i++){
  748. if(id == this.dealerList[i].id){
  749. name = this.dealerList[i].dealer_name
  750. }
  751. }
  752. return name
  753. },
  754. getDictionaryDataConfig(module, filed_name) {
  755. return getDictionaryDataConfig(module, filed_name)
  756. },
  757. drugPrint(){
  758. if(this.order_id == ""){
  759. this.$message.error("请选择入库单")
  760. }else{
  761. this.$router.push({path:"/stock/drugStockInOrderDetailPrint?id="+this.order_id})
  762. }
  763. },
  764. exportDrugList(){
  765. var params = {
  766. order_id:this.order_id,
  767. }
  768. exportDrugList(params).then(response=>{
  769. if(response.data.state == 1){
  770. var list = response.data.data.list
  771. console.log("list23232323",list)
  772. for(let i=0;i<list.length;i++){
  773. list[i].product_date = this.getTime(list[i].product_date)
  774. list[i].expiry_date = this.getTime(list[i].expiry_date)
  775. }
  776. this.exportList = list
  777. var manufacturerList = response.data.data.manufacturerList
  778. this.manufacturerList = manufacturerList
  779. var dealerList = response.data.data.dealerList
  780. console.log("经销是,",dealerList)
  781. this.dealerList = dealerList
  782. }
  783. })
  784. },
  785. toExport(){
  786. if(this.order_id == ""){
  787. this.$message.error("请勾选入库单")
  788. }
  789. console.log("hhhh2323",this.exportList)
  790. for(let i=0;i<this.exportList.length;i++){
  791. this.exportList[i].unit = this.exportList[i].dose + this.exportList[i].dose_unit + "*" + this.exportList[i].min_number + this.exportList[i].min_unit + "/"+this.exportList[i].max_unit
  792. this.exportList[i].total_price = (this.exportList[i].warehousing_count * this.exportList[i].price).toFixed(2)
  793. for(let j=0;j<this.manufacturerList.length;j++){
  794. if(this.exportList[i].manufacturer == this.manufacturerList[j].id){
  795. this.exportList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  796. }
  797. }
  798. for(let z=0;z<this.dealerList.length;z++){
  799. if(this.exportList[i].dealer == this.dealerList[z].id){
  800. this.exportList[i].dealer = this.dealerList[z].dealer_name
  801. }
  802. }
  803. }
  804. import('@/vendor/Export2Excel').then(excel => {
  805. console.log("232323",this.drugTypeList)
  806. console.log("hhh23",this.exportList)
  807. for(let i=0;i<this.exportList.length;i++){
  808. for(let j=0;j<this.drugTypeList.length;j++){
  809. if(this.exportList[i].drug_type == this.drugTypeList[j].value){
  810. this.exportList[i].drug_type = this.drugTypeList[j].name
  811. }
  812. }
  813. }
  814. const tHeader = ['药品名称','药品类型','规格&单位', '批号','入库数量','进货价','总价','生产厂家','生产日期','有效日期','经销商','批注文号','备注']
  815. const filterVal = ['drug_name', 'drug_type','unit','number','warehousing_count','price','total_price','manufacturer','product_date','expiry_date','dealer','batch_number','remark']
  816. console.log("table",this.exportList)
  817. const data = this.formatJson(filterVal, this.exportList)
  818. excel.export_json_to_excel({
  819. header: tHeader,
  820. data,
  821. filename: '药品入库单详情'
  822. })
  823. this.downloadLoading = false
  824. })
  825. },
  826. formatJson(filterVal, jsonData) {
  827. return jsonData.map(v => filterVal.map(j => v[j]));
  828. },
  829. }
  830. };
  831. </script>
  832. <style rel="stylesheet/css" lang="scss" scoped>
  833. .information {
  834. border: 1px #dcdfe6 solid;
  835. padding: 30px 20px 30px 20px;
  836. .border {
  837. border-bottom: 1px #dcdfe6 solid;
  838. margin: 0px 0 20px 0;
  839. }
  840. }
  841. .edit_separater {
  842. border-top: 1px solid rgb(233, 233, 233);
  843. margin-top: 15px;
  844. margin-bottom: 15px;
  845. }
  846. </style>
  847. <style>
  848. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  849. font-size: 12px;
  850. }
  851. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  852. background: #6fb5fa;
  853. }
  854. .count {
  855. color: #bd2c00;
  856. }
  857. .el-table td,
  858. .el-table th.is-leaf,
  859. .el-table--border,
  860. .el-table--group {
  861. border-color: #d0d3da;
  862. }
  863. .el-table--border::after,
  864. .el-table--group::after,
  865. .el-table::before {
  866. background-color: #d0d3da;
  867. }
  868. </style>