cancelDrugStockOrder.vue 25KB

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